[XviD-devel] Is Motion search a separable function?
Bryan Mayland
bmayland at leoninedev.com
Tue Jul 12 23:42:16 CEST 2005
I was looking recently into breaking up xvid's motion search to be more
multi-core friendly when I realized that my changes had seriously
degraded quality. My basic approach is to vertically divide a frame
into 2 halves (top and bottom), then have two separate threads run the
MotionEstimation() function on each half of the image. Each thread has
its own SearchData struct, but share the common current and reference
frame information as well as params, interH, interV, and interHV.
At first I assumed the quality issue was due to a lack of thread-safety
on any of the data. To eliminate that, I had the bottom-half thread
wait for the top-half thread before starting. Everything looked fine
again. Then I switched them to make the bottom half go first and have
the top half wait for it. Quality took a nose-dive. Finally I removed
all my code and modified the original MotionEstimation() to loop
for (y=mb_height/2; y<mb_height; y++)
then copy the loop code and run again
for (y=0 y<mb_height/2; y++)
This also exhibited the same degradation.
I've only made changes to the I-VOP code, b-frames and GMC are off.
Long story short, I was under the impression that the motion search
function would be separable, in that I could do MS on the macroblocks in
any order I wanted (as long as I did them all). Is this not the case?
Does the MotionSearch() code for one macroblock rely on the search
results for another macroblock in the same frame? I can understand that
that would be an intelligent optimization; a large object moving across
the screen would share similar if not the same motion vectors across the
entire object.
Of course, I could just not even be looking at what I think I'm looking
at. Thanks for any information you can provide,
Bry
More information about the XviD-devel
mailing list