[XviD-devel] Smart Rendering

Stephan Assmus superstippi at gmx.de
Thu May 15 13:49:20 CEST 2008


Hi all,

I am considering the problem of Smart Rendering. I think this term is now 
commonly used for the situation that only a part of a stream is re-encoded 
and other parts are reused from the original encoding.

My question is about finding the correct "cut" frames. For the beginning of 
the unchanged stream, it is quite obvious that the cut has to happen at a 
keyframe. However when switching from unchanged to re-encoded, there are 
some interesting constraints with regard to frames that reference frames in 
the future. Ie, you cannot stop reusing existing chunk data at a point 
where the encoded frames still reference some following frames.

My question is now simply, which API can I use in the case of Xvid to find 
out about these contraints? To illustrate:

                        * (want to re encode starting here)
... I P P B P P B P P B P P I P P P B P P B ...
          '-^-^ '-^   '-^-^         '-^-^

I have marked the position at which the program wants to start re-encoding. 
Up to that position, it wants to reuse the existing chunk data. But, 
shortly before the desired cut position, there is a B frame which 
references the following two frames, which would be cut off. What I want to 
do now, is use some Xvid API to find out about this situation, so that I 
can adjust the cut position to one frame earlier.

I am writing all this without a deep understanding of B frames. Maybe the 
requirements are much more involved. For example, if it happens to be the 
case that a B frame could reference any following frames, then it looks 
like this could be much too involved, and the simpler solution is to always 
cut at I frames and never reuse only partial sequences after a keyframe. 
However, considering that GOPs are now quite long with the more recent 
codecs, it seems desirable to try to reuse parts of them.

Best regards,
-Stephan


More information about the XviD-devel mailing list