summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Paniconi <marpan@google.com>2018-07-18 14:36:17 -0700
committerMarco Paniconi <marpan@google.com>2018-07-18 14:53:24 -0700
commitfba011507b1ee160caa82488cfeb4c7ad9471341 (patch)
tree0ac5932ceb769c322812e80a8d0cafc4db8320b7
parentb1284dffdb16b82e940e39b226b656801c83289b (diff)
downloadlibvpx-fba011507b1ee160caa82488cfeb4c7ad9471341.tar
libvpx-fba011507b1ee160caa82488cfeb4c7ad9471341.tar.gz
libvpx-fba011507b1ee160caa82488cfeb4c7ad9471341.tar.bz2
libvpx-fba011507b1ee160caa82488cfeb4c7ad9471341.zip
vp9: Screen-content after slide-change: increase refresh rate
For screen-content real-time CBR mode: on a detected slide change that is encoded at max Q (to prevent excessive overshoot), increase the perc_refresh in the cyclic refresh following the slide change. Use counter to increase refresh up to some #frames from slide change. This is attempt to increase quality ramp-up after slide change without causing too much excess overshoot. Change-Id: Ie4ec4361082803a522f4a8794b3bb0178c9cf307
-rw-r--r--vp9/encoder/vp9_aq_cyclicrefresh.c7
-rw-r--r--vp9/encoder/vp9_aq_cyclicrefresh.h1
-rw-r--r--vp9/encoder/vp9_ratectrl.c1
3 files changed, 9 insertions, 0 deletions
diff --git a/vp9/encoder/vp9_aq_cyclicrefresh.c b/vp9/encoder/vp9_aq_cyclicrefresh.c
index 6fcc782c4..f291a0dd5 100644
--- a/vp9/encoder/vp9_aq_cyclicrefresh.c
+++ b/vp9/encoder/vp9_aq_cyclicrefresh.c
@@ -39,6 +39,7 @@ CYCLIC_REFRESH *vp9_cyclic_refresh_alloc(int mi_rows, int mi_cols) {
}
assert(MAXQ <= 255);
memset(cr->last_coded_q_map, MAXQ, last_coded_q_map_size);
+ cr->counter_encode_maxq_scene_change = 0;
return cr;
}
@@ -466,6 +467,9 @@ void vp9_cyclic_refresh_update_parameters(VP9_COMP *const cpi) {
// TODO(marpan): Consider increasing refresh rate after slide change.
if (cpi->oxcf.content == VP9E_CONTENT_SCREEN) {
cr->percent_refresh = 10;
+ // Increase the amount of refresh on scene change that is encoded at max Q,
+ // increase for a few cycles of the refresh period (~30 frames).
+ if (cr->counter_encode_maxq_scene_change < 30) cr->percent_refresh = 15;
cr->rate_ratio_qdelta = 2.0;
cr->rate_boost_fac = 10;
}
@@ -533,12 +537,14 @@ void vp9_cyclic_refresh_setup(VP9_COMP *const cpi) {
cm->mi_rows * cm->mi_cols * sizeof(*cr->last_coded_q_map));
cr->sb_index = 0;
cr->reduce_refresh = 0;
+ cr->counter_encode_maxq_scene_change = 0;
}
return;
} else {
int qindex_delta = 0;
int qindex2;
const double q = vp9_convert_qindex_to_q(cm->base_qindex, cm->bit_depth);
+ cr->counter_encode_maxq_scene_change++;
vpx_clear_system_state();
// Set rate threshold to some multiple (set to 2 for now) of the target
// rate (target is given by sb64_target_rate and scaled by 256).
@@ -606,6 +612,7 @@ void vp9_cyclic_refresh_reset_resize(VP9_COMP *const cpi) {
cr->sb_index = 0;
cpi->refresh_golden_frame = 1;
cpi->refresh_alt_ref_frame = 1;
+ cr->counter_encode_maxq_scene_change = 0;
}
void vp9_cyclic_refresh_limit_q(const VP9_COMP *cpi, int *q) {
diff --git a/vp9/encoder/vp9_aq_cyclicrefresh.h b/vp9/encoder/vp9_aq_cyclicrefresh.h
index f59f193f6..50789e87c 100644
--- a/vp9/encoder/vp9_aq_cyclicrefresh.h
+++ b/vp9/encoder/vp9_aq_cyclicrefresh.h
@@ -68,6 +68,7 @@ struct CYCLIC_REFRESH {
int reduce_refresh;
double weight_segment;
int apply_cyclic_refresh;
+ int counter_encode_maxq_scene_change;
};
struct VP9_COMP;
diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c
index 5b4ca6427..f5a06415d 100644
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -2809,6 +2809,7 @@ int vp9_encodedframe_overshoot(VP9_COMP *cpi, int frame_size, int *q) {
int enumerator;
// Force a re-encode, and for now use max-QP.
*q = cpi->rc.worst_quality;
+ cpi->cyclic_refresh->counter_encode_maxq_scene_change = 0;
// If the frame_size is much larger than the threshold (big content change)
// and the encoded frame used alot of Intra modes, then force hybrid_intra
// encoding for the re-encode on this scene change. hybrid_intra will