[Mp4-tech] ideal rate control algorithm
Gary Sullivan
garysull windows.microsoft.com
Tue Oct 12 08:38:14 EDT 2004
Bharat et al,
The key thing to think about is the size of the rate buffer.
That is what determines how much the bit allocation can vary locally
in CBR operation. If the rate buffer in the decoder is small, there
is relatively little ability for the local bit allocation for a segment
of the video content to vary. However if the rate buffer is large,
the buffer can be used very effectively (although with high end-to-end
delay) to allow the number of bits per picture to vary in different
parts of the content while retaining CBR (constant bit rate flowing
into the buffer).
Four examples may be useful to illustrate the situation:
1. To take one extreme, if the frame rate is 1/T frames per second and
the CBR bit rate is R bits per second, and the buffer size is only
R*T bits, then the number of bits used on each frame can't vary at all.
Every frame must use exactly R*T bits.
2. To take another extreme, if the entire video sequence is L seconds in
length and the CBR bit rate is R bits per second (and if only R*L bits
are spent coding the video), then if the buffer size is R*L bits or
more, the encoder can use any extreme variations it wants regarding how
many bits it spends on each picture (within the total bit rate
constraint).
3. MPEG-2 video Main profile at Main level has a maximum bit rate of
15 Mbits/sec and a VBV buffer size requirement of 1.835 Mbits. That
means that the buffer can only hold 0.122 seconds of video (at the
maximum bit rate), so CBR operation with MPEG-2 has a rather limited
ability to vary the bit allocation to different parts of a video
sequence.
It can spend more bits on an I frame than on a B frame, but the average
number of bits per picture over a half-second or so must be pretty
close to R.
4. MPEG-4/H.264 AVC Main profile at level 3.1 has a maximum VCL bit
rate of 14 Mbits/sec and an HRD buffer size requirement of 14 Mbits.
That's 8.2 TIMES the size in terms of seconds of video at the maximum
bit rate, when compared with MPEG-2. The buffer can hold an entire
second of video, so although CBR operation does enforce some smoothness
of the video bit rate over extended periods of tims, it allows
significant variation in bit rate over shorter periods (e.g., perhaps
ten or so frames). If the encoder wants to, it can double the number
of bits per frame for a quarter second or or so of critical very active
video content and make up for it later by being stingy on subsequent
pictures.
Best Regards,
Gary Sullivan
+> -----Original Message-----
+> From: Bharat P. SONI [mailto:bharat.soni st.com]
+> Sent: Monday, October 11, 2023 12:15 AM
+> To: Gary Sullivan; kaustubh.patankar vsnl.net
+> Cc: mp4-tech lists.mpegif.org
+> Subject: RE: RE: RE: [Mp4-tech] ideal rate control algorithm
+>
+> Dear Gary,
+>
+> You said "the rate of bits flowing into the input buffer of
+> the hypothetical
+> decoder is constant". I fully agree with this statement. But
+> size of this
+> decoding buffer is mainly useful to control
+> overflow/underflow condition. I
+> think the size of this buffer has little role on controlling
+> the bitrate (in
+> case of CBR)if it is sufficiently high. The bitrate is
+> controlled based on
+> the Target bits available for encoding the remaining
+> pictures in an encoding
+> segment (say a GOP) over which bitrate is being
+> controlled/monitored.
+> Keeping this input buffer quite large (specifically for CBR)
+> may not be a
+> good solution as this buffer may not underflow, but it is
+> possible that
+> quality will fluctuate drastically in case of fast moving sequence.
+>
+> Correct me if I am wrong.
+>
+> Regards,
+> Bharat
+>
+> -----Original Message-----
+> From: Gary Sullivan [mailto:garysull windows.microsoft.com]
+> Sent: Sunday, October 10, 2023 9:47 PM
+> To: kaustubh.patankar vsnl.net
+> Cc: Bharat P. SONI; mp4-tech lists.mpegif.org
+> Subject: RE: RE: RE: [Mp4-tech] ideal rate control algorithm
+>
+>
+>
+> In CBR operation, the rate of bits flowing into the input
+> buffer of the
+> hypothetical decoder is constant for the duration of the coded video
+> sequence. In VBR operation, it is not necessarily constant.
+>
+> Yes, the quantization fidelity probably needs to be adjusted
+> once in a while
+> to maintain CBR operation. However, it doesn't have to be
+> very often if the
+> input buffer is sufficiently large. The number of bits per
+> macroblock or per
+> picture can vary a lot on a local basis while still maintaining CBR
+> operation.
+>
+> The size of the required input buffer is specified in the
+> standard. It can
+> be used to smooth out local variations, which can be considerable in
+> magnitude.
+>
+> Best Regards,
+>
+> Gary Sullivan
+>
+> +> -----Original Message-----
+> +> From: kaustubh.patankar vsnl.net
+> [mailto:kaustubh.patankar vsnl.net]
+> +> Sent: Sunday, October 10, 2023 6:21 AM
+> +> To: Gary Sullivan
+> +> Cc: Bharat P. SONI; mp4-tech lists.mpegif.org
+> +> Subject: Re: RE: RE: [Mp4-tech] ideal rate control algorithm
+> +>
+> +> Dear Gary,
+> +>
+> +> I have one question,
+> +>
+> +> The rate to the Hypo. decoder should remain constant over
+> +> picture or complete seq or over the time.
+> +>
+> +> Also my answer to the CBR was the the Q parameter needs to
+> +> be variaed, if required over macro block / picture.
+> +>
+> +> Also in that case what is the precise difference between
+> CBR and VBR
+> +>
+> +> with regards
+> +>
+> +> Kaustubh
+> +>
+> +> ----- Original Message -----
+> +> From: Gary Sullivan <garysull windows.microsoft.com>
+> +> Date: Sunday, October 10, 2023 1:17 am
+> +> Subject: RE: RE: [Mp4-tech] ideal rate control algorithm
+> +>
+> +> >
+> +> > There is some confusion in these replies regarding the
+> +> definition of
+> +> > CBR.
+> +> >
+> +> > CBR does not mean that the number of bits used is kept
+> constant for
+> +> > every picture or for every macroblock. In fact, there
+> can be very
+> +> > large variations in bit usage from picture-to-picture in CBR
+> +> > operation, or even for significanly-long sequences of pictures.
+> +> >
+> +> > Instead, CBR operation means that the rate of the flow of bits
+> +> > into the
+> +> > input buffer of the (hypothetical) decoder is constant.
+> When that
+> +> > buffer is large, there can be large variations in bit usage from
+> +> > picture-to-picture while relying on the buffer capacity to
+> +> smooth over
+> +> > those variations.
+> +> >
+> +> > Best Regards,
+> +> >
+> +> > Gary Sullivan
+> +> >
+> +> > +> -----Original Message-----
+> +> > +> From: mp4-tech-bounces lists.mpegif.org
+> +> > +> [mp4-tech-bounces lists.mpegif.org] On Behalf Of
+> +> > +> kaustubh.patankar vsnl.net
+> +> > +> Sent: Thursday, October 07, 2023 5:50 AM
+> +> > +> To: Bharat P. SONI
+> +> > +> Cc: mp4-tech lists.mpegif.org
+> +> > +> Subject: Re: RE: [Mp4-tech] ideal rate control algorithm
+> +> > +>
+> +> > +> Dear Satendar,
+> +> > +>
+> +> > +> I have few inputs.
+> +> > +>
+> +> > +> Please check the algorithm to refer for interlaced and
+> +> > +> progressive sequences. Please refer to TM5 rate control
+> +> > +> model for inplementation of the algorithms.
+> +> > +> The rate control can be classified as
+> +> > +> 1. VBR with may be a specified band for variation where the
+> +> > +> average bit-rate is important. Ultimately the file size can
+> +> > +> depend on the average bit rate.
+> +> > +> 2. the purpose of VBR is to allocate maximum bit rate for
+> +> > +> the complex sequences
+> +> > +> 3. There are multi pass VBR implementations also avaialbles.
+> +> > +> 4. regarding the CBR, the purpose can be to achieve constant
+> +> > +> bit rate with variation in Q parameter over macro block.
+> +> > +>
+> +> > +> I think this may be helpful
+> +> > +>
+> +> > +> Kaustubh
+> +> > +>
+> +> > +> ----- Original Message -----
+> +> > +> From: "Bharat P. SONI" <bharat.soni st.com>
+> +> > +> Date: Thursday, October 7, 2023 11:47 am
+> +> > +> Subject: RE: [Mp4-tech] ideal rate control algorithm
+> +> > +>
+> +> > +> > Hi Satendra,
+> +> > +> >
+> +> > +> > The ideal rate control algorithm, I would say practically
+> +> > does not
+> +> > +> > exist. It
+> +> > +> > is dependent on the requirements. If you define your
+> +> > requirements
+> +> > +> > and if an
+> +> > +> > algorithm meets your requirement then I would call it an
+> +> > ideal
+> +> > +> > algorithm.There are three possible scenarios,
+> +> > +> > 1 constant bitrate: bitrate is constant through out the
+> +> > +> sequence (the
+> +> > +> > quality may vary).
+> +> > +> > 2 Variable bitrate: bitrate varies over the
+> sequence based on
+> +> > the
+> +> > +> > videocomplexity, but the quality is maintained at
+> same level.
+> +> > +> > 3 A mix of CBR and VBR: In this case one can allow to vary
+> +> > the
+> +> > +> > bitrate over
+> +> > +> > small duration of sequence but the overall bitrate is
+> +> > +> controlled and
+> +> > +> > averaged out to be a constant. In this case the quality is
+> +> > better
+> +> > +> > than CBR.
+> +> > +> >
+> +> > +> > Regards,
+> +> > +> > bharat
+> +> > +> >
+> +> > +> > -----Original Message-----
+> +> > +> > From: mp4-tech-bounces lists.mpegif.org
+> +> > +> > [mp4-tech-bounces lists.mpegif.org] On Behalf Of Satendra
+> +> > +> > Sent: Wednesday, October 06, 2023 4:47 PM
+> +> > +> > To: mp4-tech lists.mpegif.org
+> +> > +> > Subject: [Mp4-tech] ideal rate control algorithm
+> +> > +> >
+> +> > +> >
+> +> > +> > hi,
+> +> > +> >
+> +> > +> > I am working on rate control for MPEG-2. I want
+> to know what
+> +> > +> > should be the
+> +> > +> > characteristics of an ideal rate control
+> algorithm? and how
+> +> > can
+> +> > +> > we build
+> +> > +> > that?
+> +> > +> >
+> +> > +> >
+> +> > +> > Thanx
+> +> > +> > _______________________________________________
+> +> > +> > NOTE: Please use clear subject lines for your posts.
+> +> > +> Include [audio,
+> +> > +> > [video], [systems], [general] or another apppropriate
+> +> > identifier
+> +> > +> > to indicate
+> +> > +> > the type of question you have.
+> +> > +> >
+> +> > +> > Note: Conduct on the mailing list is subject to
+> the Antitrust
+> +> > +> > guidelinesfound at
+> +> > +> > http://www.mpegif.org/public/documents/vault/mp-out-30042-
+> +> > +> > Antitrust.php
+> +> > +> >
+> +> > +> > _______________________________________________
+> +> > +> > NOTE: Please use clear subject lines for your
+> posts. Include
+> +> > +> > [audio, [video], [systems], [general] or another
+> apppropriate
+> +> > +> > identifier to indicate the type of question you have.
+> +> > +> >
+> +> > +> > Note: Conduct on the mailing list is subject to
+> the Antitrust
+> +> > +> > guidelines found at
+> +> > +> > http://www.mpegif.org/public/documents/vault/mp-out-30042-
+> +> > +> > Antitrust.php
+> +> > +>
+> +> > +> _______________________________________________
+> +> > +> NOTE: Please use clear subject lines for your posts. Include
+> +> > +> [audio, [video], [systems], [general] or another
+> +> > +> apppropriate identifier to indicate the type of
+> +> question you have.
+> +> > +>
+> +> > +> Note: Conduct on the mailing list is subject to the
+> +> > +> Antitrust guidelines found at
+> +> > +> http://www.mpegif.org/public/documents/vault/mp-out-30042-Ant
+> +> > +> itrust.php
+> +> > +>
+> +> >
+> +> > _______________________________________________
+> +> > NOTE: Please use clear subject lines for your posts. Include
+> +> > [audio, [video], [systems], [general] or another apppropriate
+> +> > identifier to indicate the type of question you have.
+> +> >
+> +> > Note: Conduct on the mailing list is subject to the Antitrust
+> +> > guidelines found at
+> +> > http://www.mpegif.org/public/documents/vault/mp-out-30042-
+> +> > Antitrust.php
+> +>
+> +>
+>
+>
More information about the Mp4-tech
mailing list