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
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;
// 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) {