summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Paniconi <marpan@google.com>2019-01-15 12:12:47 -0800
committerMarco Paniconi <marpan@google.com>2019-01-15 14:09:15 -0800
commit7e2d732b8bf16579a28daa124a38ac19e1efd96c (patch)
tree879fc75c2a65c40b71c6050c217a6c45cf9389ef
parent3915f0616add47d9187b679802dd757a90f2977f (diff)
downloadlibvpx-7e2d732b8bf16579a28daa124a38ac19e1efd96c.tar
libvpx-7e2d732b8bf16579a28daa124a38ac19e1efd96c.tar.gz
libvpx-7e2d732b8bf16579a28daa124a38ac19e1efd96c.tar.bz2
libvpx-7e2d732b8bf16579a28daa124a38ac19e1efd96c.zip
vp9-svc: Fix to buffer update under frame_drops
For svc with frame dropping in full_superframe_drop or constrained dropped mode: the buffer level for a given layer may be capped from increasing too much. This is because that layer may be dropped even though its buffer is stable (the dropped is forced due to underflow in other layers in full/constrained svc-drop mode). This capping is needed to prevent decrease in qp over consecutive frame drops. The capping already exists and has been used, but this change introduce an error that prevented its usage: https://chromium-review.googlesource.com/c/webm/libvpx/+/1330875 The fix here is to also cap the bits_off_target as well, since after the change mentioned above, its the bits_off_target that is used to update buffer on next frame (which in turn affects qp for next frame/layer). Change-Id: Ifdab5d478e91cce20ecec51faa574eed375ee36b
-rw-r--r--vp9/encoder/vp9_ratectrl.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c
index 4b9fb2754..9df2eb333 100644
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -247,6 +247,9 @@ int vp9_rc_clamp_iframe_target_size(const VP9_COMP *const cpi, int target) {
return target;
}
+// TODO(marpan/jianj): bits_off_target and buffer_level are used in the saame
+// way for CBR mode, for the buffering updates below. Look into removing one
+// of these (i.e., bits_off_target).
// Update the buffer level before encoding with the per-frame-bandwidth,
static void update_buffer_level_preencode(VP9_COMP *cpi) {
RATE_CONTROL *const rc = &cpi->rc;
@@ -1924,8 +1927,10 @@ void vp9_rc_postencode_update_drop_frame(VP9_COMP *cpi) {
// increasing buffer levels/overflow for certain layers even though whole
// superframe is dropped, we cap buffer level if its already stable.
if (cpi->use_svc && cpi->svc.framedrop_mode != LAYER_DROP &&
- cpi->rc.buffer_level > cpi->rc.optimal_buffer_level)
+ cpi->rc.buffer_level > cpi->rc.optimal_buffer_level) {
cpi->rc.buffer_level = cpi->rc.optimal_buffer_level;
+ cpi->rc.bits_off_target = cpi->rc.optimal_buffer_level;
+ }
}
static int calc_pframe_target_size_one_pass_vbr(const VP9_COMP *const cpi) {