[Ffmpeg-devel] [patch] rc buffer bits reservation for I-frames
Loren Merritt
lorenm
Sat Nov 25 07:35:18 CET 2006
On Sat, 25 Nov 2006, Michael Niedermayer wrote:
> On Fri, Nov 24, 2006 at 04:11:32PM +0100, Jindrich Makovicka wrote:
>>
>> when using a short RC buffer and tight bitrate restrictions (typically
>> when encoding for DVB), the rate control sometimes tends to use too
>> much bits for P-frames, and when an I-frame gets encoded, there is not
>> enough bits available, causing a sudden quality decrease.
> [...]
>> Index: ratecontrol.h
>> ===================================================================
>> --- ratecontrol.h (revision 7165)
>> +++ ratecontrol.h (working copy)
>> @@ -63,6 +63,7 @@
>> int num_entries; ///< number of RateControlEntries
>> RateControlEntry *entry;
>> double buffer_index; ///< amount of bits in the video/audio buffer
>> + double prev_iframe_bits;
>> Predictor pred[5];
>
> hmm, cant predict_size() be used instead? or is that worse quality?
predict_size() requires some info about the frame. prev_iframe_bits is
used before the next I-frame is even given as input to lavc. I suppose you
use predict_size() on mb_var_sum of the current frame rather than the
exact size of the previous I-frame. Dunno if the variance in the estimate
would cause problems.
--Loren Merritt
More information about the ffmpeg-devel
mailing list