[XviD-devel] multithreaded pvop-ME

Radek Czyz radoslaw at syskin.cjb.net
Sun Dec 18 16:39:09 CET 2005

Hi everyone :)

I just finished my multithreaded ME for p-frames project ^___^

How it works: each thread gets every second (third, fourth etc, 
depending on # of threads) row of macroblocks. It keeps record of how 
many MBs has already been processed in any line, and it also has access 
to the same record for the line above it.

Every time a thread needs something to do, it reads the record of line 
above it and remembers how many macroblocks it can process now. Once it 
finishes, it reads the record again.

Thing to notice: if the record is stale and too old, it just means 
smaller data chunk at a time. No need for mutexes.

Patch at:

Test results (defaults, no b-frames, vhq4):
1 thread :  1:48
2 threads : 1:05
3 threads : 1:06
4 threads : 1:08
16 threads: 1:11

That's on amd X2 4200+. Clip is 608x256 (-> 16 rows of macroblocks).

Tomorrow, bframes.

Yet another thread can be introduced to encode data to the bitstream. 
That needs some extra code changes, so I'll leave it for later.


More information about the XviD-devel mailing list