Log in

View Full Version : A method to optimize XVID encoder


Legend_Wolf
24th December 2003, 07:13
There is a method to optimize XVID encoder:

In XVID P frame, MotionEstimaiotn(ME) was firstly done by the whole frame. And then based on Macroblock to do MC(PREDICTION)-> DCT->Quantization-> VLC->output streame(reconstruction). This is two loops. One LOOP for ME, the other loop for MC-->DCT-->Q->VLC.

Because XVID quantizaiton is based on FRAME, why not merge the ME into MC and it would be one loop.That is:
ME(based on Macroblock)-->MC(PREDICTION)-->DCT--->Q->VLC(OR reconstruction and ME)

sysKin
24th December 2003, 10:36
You're right provided that encoder won't change.
You see, developers always agreed that there might be something "smart" going on between ME and real coding. At the begining, it was keyframe decision (if ME decided on too many intra blocks, it went 'back' and coded a keyframe instead). In the future, it might be some kind of activity/motion HVS model.

Just another example: imagine we want to use data partitioning, which means we're encoding macroblock modes and motion first, then texture info. We can do it simply now, but if we join the loops we're in trouble.

Turning everything into a single loop might work better now, but we'll be stucked with this model forever.

I don't think the speed gain will be high btw: we might utilize cpu's cache better because we're only accessing the picture once. At the other hand, we're using several different functions one after another which means we need more cache to keep all the functions in memory, with their data. It might even be slower if we're unlucky.

Radek