[XviD-devel] Dynamic B-frame setting

Christoph Lampert xvid-devel@xvid.org
Sun, 18 Aug 2002 14:38:56 +0200 (CEST)


Hi,

since we are on the road to become the best MPEG-4 codec ever, I
was thinking about the following:

At the moment, there is just the choice of using B-frames or not. 
But sometimes B-frames raise quality/bytes, sometimes not (at least in my
tests). So they should not always be active. 

I'd say, it would not be difficult to implement _dynamic_ B-frame setting. 

All we need is a routine that tests if the next chunk (2 frames for 
max_bframes=1, 3 frames for max_bframes=2 etc.) should be B-framed or not. 

Then we somehow use existing DX50-code to encode and return frames in
correct order. 

For the check routine I can think of three "levels":

1) Check only immediately after a scene-change I-frame. The result will be
used until next I-frame. I guess the decision if B-frames are useful will
not change much during images of the same scene. So this would be fast and 
better than no check at all. 

2) Check for every chunk (say 3 images) by simple encoding in both
ways. A simple criterion that seems to work in by tests would be if the
filesize is smaller for PBB with quant_ratio=100. But that may be too much
overhead... If the check is false, return PPP, if it's true, return
PBB. For the next chunk, check again, etc. 

3) Check for every chunk, but if the check is false, return only P and
check for the next chunk (including 2 already checked frames). This might
be unnecessary work... 

The advantage of 2 is, that the usual scene-change check could be
done, because every frame is P-MEed once. 
We might also use non-halfpelrefined ME for the checking step. 
Compared to the speed we lose _if_ B-frame mode is chosen, this is
hyper-fast. 

Christoph


-- 
Christoph H. Lampert chl@math,uni-bonn,de | Diese Signature wurde maschi-     
Beringstr. 6, Raum 14 Tel. (0228) 73-2948 | nell erstellt und bedarf
Sprechstunden: keine, aber meistens da    | keiner Unterschrift. AZ 27B-6