[Ffmpeg-devel] [patch] rc buffer bits reservation for I-frames

Michael Niedermayer michaelni
Sat Nov 25 00:28:25 CET 2006


Hi

On Fri, Nov 24, 2006 at 04:11:32PM +0100, Jindrich Makovicka wrote:
> Hi,
> 
> 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.
> 
> The attached patch adds an option to reserve a specified multiple of
> the last I-frame size in the RC buffer. Default value if 0, i.e.
> unchanged from the current state.
> 
> Sample mpeg2 movies with reservation factor set to 0 and 1 are available at
> 
> http://kmlinux.fjfi.cvut.cz/~makovick/res0.avi
> 
> http://kmlinux.fjfi.cvut.cz/~makovick/res1.avi .
> 
> The movies were encoded using mplayer with -lavcopts
> vcodec=mpeg2video:mbd=2:vbitrate=1500:vrc_maxrate=1500:vrc_buf_size=750
> 
> The difference is clearly visible when you open the movies in avidemux
> and look at the I-frames.
[...]
> 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?
also what effect does this patch have on PSNR?

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is




More information about the ffmpeg-devel mailing list