[x264-devel] motion vectors and threads

Loren Merritt lorenm at u.washington.edu
Fri Jan 18 23:59:08 CET 2008


On Fri, 18 Jan 2008, Christian Bienia wrote:

> "To allow encoding of multiple frames in parallel, we have to ensure that any
> given macroblock uses motion vectors only from pieces of the refer
> ence frames that have been encoded already. This is usually not noticeable,
> but can matter for very fast upward motion."
>
> How come that the motion vectors of the reference frame are also required? Is
> this an optimization due to correlation of motion vectors, or is it a
> fundamental requirement?

Skip and Direct macroblock types in B-frames are predicted from the 
reference frame's mvs. Additionally, as a purely encoder-side 
optimization, x264 uses the reference frame's mvs to initialize motion 
estimation.

However, threads.txt refers to reference pixels and not reference mvs. 
That is, however you determine the current macroblock's mv, the region of 
the reference frame that the mv points to must be encoded already.

> I found it, thanks for the pointer. AFAIK B-Frames are sandwiched between
> their reference frames, so there must be some sort of scheduler which makes
> sure that frames which will be used as reference frames are encoded before
> any frames inbetween which will refer to them. Where is that implemented?

encoder.c lines 1330-1342. But that's not specific to threads.

--Loren Merritt



More information about the x264-devel mailing list