[theora] question on theora encoding

xiphmont at xiph.org xiphmont at xiph.org
Fri Jan 4 15:03:11 PST 2008

On Jan 3, 2008 6:35 PM, Nikos Parastatidis <nparasta at auth.gr> wrote:

> I am building a function that calculates motion estimation. When making
> motion estimations must I scan each and every macroblock in coded order?

It doesn't matter in what order MVs are calculated.  Current mainline
and theora-exp calculate MVs in Hilbert order [for no really good
reason], and Thusnelda is currently moving to calculating in raster
order.  Funny you should have asked now, as this is the code I'm
working on at the moment.

Note that theora-exp's MV code is far better than mainline's.
Thusnelda is adopting exp's approach, originally described in the
paper _Enhanced Predictive Zonal Search for Single and Multiple Frame
Motion Estimation_ by Alexis M. Tourapis.

> After that the motion vectors should be stored in the same order?

Macroblock modes and motion vectors are coded by macroblock with the
macroblocks scanned in Hilbert order.  The only oddity is that 4MV
macroblocks code their four MVs in raster order within the macroblock
rather than in Hilbert order (which would would have been needlessly
complex.  Of course, one can argue that Hilbert ordering was
needlessly complex from the beginning).

> Except
> for that how should the program decide what kind of coding mode to use?

Coding mode is calculated entirely independently after MV
determination is complete. Modes should be chosen to minimize the
number of coding bits required.

This is not the only way to do it, of course, but it's generally
recognized that a R-D optimization process that fully accounts for the
coding requirements of mode and MV selection together is impractical


More information about the theora mailing list