I wanted to start a discussion on a couple rate control issues and how
they relate to the API. I'm cribbing much of this text from a related
issue[1] and change set[2], please look at those links for the
original sources.
[1]: http://code.google.com/p/webm/issues/detail?id=270
[2]: https://review.webmproject.org/#change,1890
I'm trying to understand:
1) Adding new parameters to the configuration structure breaks the
ABI/API. As our next release will be around the 1 year anniversary of
the launch, it may be reasonable to bump to version 1.0.0 and
incorporate some minor API changes. Does this sound unreasonable to
anyone?
2) Are these the *right* variables to expose to an application? Do the
proposed controls in these two patches accurately describe the most
useful variables to expose to an application, or are they "just"
working around specific problems inside the codec?
3) Are there any other variables we need to be considering here?
Changes people are working on, etc? Let's get all the cards on the
table.
What does everyone think?
Aron Rosenberg proposed a patch (Issue 270)[1]:
The VPX codec has many hard coded constraints/parameters that control
the minimum and maximum sizes of the per frame targets for both inter
and intra encoding. The problem with these constraints is the
following:
1) They force the size of all intra encoded frames to be excessively
large for real time encoding
2) They limit the speed at which the adjusted per-frame targets
increase or decrease in size, thus limiting the speed at which rate
control can adapt video to the target data rate.
3) The codec will often under or over-shoot the rate, based on
content, and not recover quickly or obey the buffer constraints
4) The minimum frame size is hardcoded, resulting in an effective
quality floor that can't be over-ridden by user choice, and resulting
in target data rates being exceeded for some content types
[...]
The attached "discussion" patch enables fixes for these issues by
adding the following four encoder level variables.
/*!\brief Rate control adaptation undershoot and overshoot tolerance
*
* This value, expressed as a percentage of the target
bitrate, controls the
* maximum allowed adaptation speed of the codec in terms of
maintaining the
* buffer size at the correct fill size in terms of a higher rate
*/
unsigned int rc_undershoot_buffer_pct;
unsigned int rc_overshoot_buffer_pct;
/*!\brief Set the percentage of the per second data rate to
allow for I-Frames
*
* This value, expressed as a percentage of the target bitrate, sets
* the default and minimum bitrate for an i-Frame as a
percentage of the kbps
* bit rate target- can be increased above the value in
error_resilient mode
*/
unsigned int rc_min_intra_pct;
/*!\brief Set the percentage of the per second data rate to
allow for I-Frames
*
* This value, expressed as a percentage of the target bitrate, sets
* the minimum allowed bitrate for a p-Frame as a percentage
of the per-frame
* target data rate
*/
unsigned int rc_min_inter_pct;
Note: (Aron) added new undershoot and overshoot variables which
precisely work so that the API would (sic?) break for people using the
existing undershoot. (Existing overshoot was defined, but never used).
Mikhal Shemer proposed this patch (Change 1890)[2]
/*!\brief Initial Key Quantizer
*
* This value allows the user to specify the quantizer value for the
* first key frame of a sequence. Set to zero to use the codec default.
*/
unsigned int rc_initial_key_quantizer;
A few quick thoughts from me:
Do we need both rc_undershoot_buffer_pct and rc_undershoot_pct?
rc_min_intra_pct: need a max too? that's the use case for
rc_initial_key_quantizer.
rc_initial_key_quantizer is a very specific control -- if we want
precise control over q selection, maybe we should have an interface to
set the q for any given frame, which would be useful for development
too. See change[3] 1306 for related comments. Or if this is just about
rate, maybe we should do something in those terms, like
rc_{min,max}_intra_pct.
[3]: https://review.webmproject.org/#change,1306
Thanks!
John
P.S. Sorry to Aron and Mikhal that this issue has gone unaddressed for so long.
rc_undershoot_buffer_pct;
rc_overshoot_buffer_pct;
rc_min_intra_pct;
rc_min_inter_pct;
rc_max_intra_pct;
rc_initial_key_quantizer;
rc_dropframe_thresh;
rc_temporaldecimation_thresh;
vp8e_set_bitrate()
VP8E_SET_ENABLEAUTOGF
VP8E_SET_GF_FREQUENCY
VP8E_SET_ARF_FREQUENCY
I think this may get a little unwieldy to handle all in the same
thread, so let's just focus on a couple at a time. I'll make sure we
hit them all.
Let's start with these two:
rc_undershoot_buffer_pct;
rc_overshoot_buffer_pct;
My understanding of this patch is that it tries to give control over
how fast the rate targeting adapts by limiting the amount of the
difference between the current and target buffer levels is applied to
the current frame target. The existing parameters are
rc_undershoot_pct, which only applies a fixed bias to the target rate,
and rc_overshoot_pct, which is unused.
I propose that we use the existing names and the new behavior from the
patch, rather than introducing new parameters. Any objections?
Drawbacks? Another option would be to remove the current variables and
introduce these new controls under new names (as proposed or
different) to better signal to users that the semantics have changed.
My reading is that the current variables are mostly useless, so
changing the semantics (probably) isn't going to hurt anybody, and
it's not worth introducing a new name unless the new name is
better/more accurate/etc, but happy to hear other thoughts?
(correcting cc:)
--
You received this message because you are subscribed to the Google Groups "Codec Developers" group.
To post to this group, send email to codec...@webmproject.org.
To unsubscribe from this group, send email to codec-devel...@webmproject.org.
For more options, visit this group at http://groups.google.com/a/webmproject.org/group/codec-devel/?hl=en.
https://review.webmproject.org/2142
I've given it some cursory testing, but I refactored a few things from
the original patch so it could use some more. Also, anyone have better
language for vpx_encoder.h? I still find it confusing.
In real time mode, the higher value will force the codec to adapt to the target data rate faster. That is the essence of the patch. I haven't tested two pass mode, perhaps slow adaptation is handled in a different manner in two pass? I haven't analyzed/tested that pathway, but I would imagine the effect would be similar- less short term variation in rate (more CBR).
Tom
John Koleszar ---04/11/2011 08:48:45 AM---Ok. Updated patch available here: https://review.webmproject.org/2142
I am not strongly tied to using rc_min_intra_pct, but I do use it. I am fine with some other method of controlling key frame size, as long as its consistent and we don't break the error_resilient_mode case.
I use rc_min_intra_pct to make sure that this_frame_target is set to a number that should in theory use up the amount of a second's worth of bandwidth that we would prefer- in this case we are hoping that each frame doesn't consume more than say 4.5 frames of equivalent inter frame data rate. Unfortunately, I also have to use error_resilient_mode for reasons I think having to do with sending the loop filter deltas. Using error_resilient_mode makes it so any value set by rc_min_intra_pct is modified in pick_frame_size on the very first frame, and ignored in vp8_calc_iframe_target_size on subsequent key frames. I am unsure as why error_resilient_mode requires 2-3x more data, it seems like less would be needed.
So, I am fine with some other method as long as error_resilient_mode doesn't break.
As far as rc_min_inter_pct, we set it close to 0 in order to hint to the codec that we'll allow the target frame size to approach 0 in some cases in order to keep the rate constant. That we need.
Tom
John Koleszar ---04/13/2011 01:05:34 PM---Ok. I'm still not wild about the current language describing these controls, but I think we can take
From: John Koleszar <jkol...@google.com>
To: codec...@webmproject.org
Cc: tom_h...@logitech.com, Mikhal Shemer <mik...@google.com>, Aron Rosenberg <arose...@logitech.com>
Date: 04/13/2011 01:05 PM
Subject: Re: [RFC] Issues with undershoot and overshoot and intra/inter frame percentages
Ok. I'm still not wild about the current language describing these controls, but I think we can take that as an open documentation issue and move on. Can you guys elaborate on how you're using these controls? Is this just set it and forget it (if so, to what?) or are you actually adapting this to current conditions? I'd be interested to hear about your experiences.
The next set of controls up for discussion is:
rc_min_intra_pct;
rc_min_inter_pct;
rc_max_intra_pct;
rc_initial_key_quantizer;
My thoughts:
1) Regarding rc_{min,max}_intra_pct, interesting that people have found the I-frame boost to be both too high and too low. Maybe you can share some of your experiences?
Internally, the boost used is a curve based on the selected q. These controls don't take the selected q into account, they just apply a clamp. So at low q, rc_min_intra_pct may not have any effect if you get limited by the internal curve. Is this the behavior users want? Or do we maybe want a multiplier or shift on the curve instead?
This control sort of makes me nervous since it's one you can shoot yourself in the foot with it pretty easily, and there are times when aggressive boosting isn't the right thing to do (like forced vs natural keyframes), which opens up issues like when do we ignore what the user's asking for, etc.
2) Regarding rc_min_inter_pct, what's the use case here? What's the behavior you're seeing?
3) Regarding the rc_initial_key_quantizer, I think rc_max_intra_pct should cover the same use case and is more flexible in general. Suggest we proceed in that direction.
On Mon, Apr 11, 2011 at 12:01 PM, <tom_h...@logitech.com> wrote: