[x264-devel] Fasten motion estimation

Jason Garrett-Glaser darkshikari at gmail.com
Fri Dec 5 11:51:20 CET 2008


On Fri, Dec 5, 2008 at 2:37 AM, Horst Weglanz <weglanz12 at yahoo.com> wrote:
> Hello,
>
> I've learned that motion vector estimation is a big part in the total sum of H.264 encoding. But I was wondering about this scenario: I've very little motion inside the scene but only from movement of the camera itself; and I know exactly what motion has occurred (in 3dimensional space). Is it possible to somehow precompute an offset for the motion estimation and tell x264: I've you are looking for moving pixels... I would start *here* if I were you? Simply tell him what motion has occurred in the scene so he can fasten the computation?

x264 has up to 10 predictors that it uses for the start of motion
estimation for each macroblock:

Median motion vector, as defined by the spec.
B-Direct, as defined by the spec (in B-frames)
Motion vectors as chosen by the left, top-left, top, and top-right
macroblocks relative to the current one (spatial predictors)
Motion vectors as chosen by the right, bottom right, and bottom
macroblocks relative to the current one, but from the previous frame,
and scaled appropriately (temporal predictors)
(firstpass/CRF/VBV modes only) The motion vector from the
low-resolution lookahead pass, scaled up by a factor of 2 accordingly

That's a lot of predictors.  Almost always, this is plenty to get the
motion search to an extremely good starting place.

What the human visual system does is actually a lot like a pyramidal
motion search: unfocus the eyes and view a large area and view its
overall motion (low-resolution search), then focus in closer and view
that area's motion relative to the larger area, etc.  x264 does one
level a pyramid search (the last predictor I mentioned).  One encoder
I know that does a full pyramid search (16x downscale, then 8x
downscale, then 4x downscale, then 2x downscale, then fullres) is the
Badaboom GPU encoder.  This was chosen not for quality reasons, but
because its much easier to implement in CUDA than x264's methods.

Dark Shikari


More information about the x264-devel mailing list