summaryrefslogtreecommitdiff
path: root/vp9/encoder
diff options
context:
space:
mode:
authorPaul Wilkins <paulwilkins@google.com>2014-04-04 12:56:50 +0100
committerPaul Wilkins <paulwilkins@google.com>2014-04-11 15:00:06 +0100
commitd83f6f06328e9ac9370481f60589329c5de9afc4 (patch)
tree9136f38f992e8c29124895b058d46da54b155304 /vp9/encoder
parentb5bf64668e57b5575c906ca340100e9cfebe33aa (diff)
downloadlibvpx-d83f6f06328e9ac9370481f60589329c5de9afc4.tar
libvpx-d83f6f06328e9ac9370481f60589329c5de9afc4.tar.gz
libvpx-d83f6f06328e9ac9370481f60589329c5de9afc4.tar.bz2
libvpx-d83f6f06328e9ac9370481f60589329c5de9afc4.zip
Change Qlimit for arf kf.
The limits applied under the flag "LIMIT_QRANGE_FOR_ALTREF_AND_KEY" behaved in an undesirable way if the gap between active_worst_quality and active_best_quality was changed. In this patch, the adjustment is made using the vp9_compute_qdelta_by_rate() function and fixed rate multiplier values. Hence it is not impacted by the relative value of active_best_quality. Change-Id: I93b3308e04ade1e4eb5af63edf64f91cd3700249
Diffstat (limited to 'vp9/encoder')
-rw-r--r--vp9/encoder/vp9_ratectrl.c61
1 files changed, 44 insertions, 17 deletions
diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c
index 00489cd23..960a3d8be 100644
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -565,11 +565,18 @@ static int rc_pick_q_and_bounds_one_pass_cbr(const VP9_COMP *cpi,
#if LIMIT_QRANGE_FOR_ALTREF_AND_KEY
// Limit Q range for the adaptive loop.
- if (cm->frame_type == KEY_FRAME && !rc->this_key_frame_forced) {
- if (!(cm->current_video_frame == 0))
- *top_index = (active_worst_quality + active_best_quality * 3) / 4;
+ if (cm->frame_type == KEY_FRAME &&
+ !rc->this_key_frame_forced &&
+ !(cm->current_video_frame == 0)) {
+ int qdelta = 0;
+ vp9_clear_system_state();
+ qdelta = vp9_compute_qdelta_by_rate(&cpi->rc, cm->frame_type,
+ active_worst_quality, 2.0);
+ *top_index = active_worst_quality + qdelta;
+ *top_index = (*top_index > *bottom_index) ? *top_index : *bottom_index;
}
#endif
+
// Special case code to try and match quality with forced key frames
if (cm->frame_type == KEY_FRAME && rc->this_key_frame_forced) {
q = rc->last_boosted_qindex;
@@ -725,15 +732,26 @@ static int rc_pick_q_and_bounds_one_pass_vbr(const VP9_COMP *cpi,
*bottom_index = active_best_quality;
#if LIMIT_QRANGE_FOR_ALTREF_AND_KEY
- // Limit Q range for the adaptive loop.
- if (cm->frame_type == KEY_FRAME && !rc->this_key_frame_forced) {
- if (!(cm->current_video_frame == 0))
- *top_index = (active_worst_quality + active_best_quality * 3) / 4;
- } else if (!rc->is_src_frame_alt_ref &&
- (cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame)) {
- *top_index = (active_worst_quality + active_best_quality) / 2;
+ {
+ int qdelta = 0;
+ vp9_clear_system_state();
+
+ // Limit Q range for the adaptive loop.
+ if (cm->frame_type == KEY_FRAME &&
+ !rc->this_key_frame_forced &&
+ !(cm->current_video_frame == 0)) {
+ qdelta = vp9_compute_qdelta_by_rate(&cpi->rc, cm->frame_type,
+ active_worst_quality, 2.0);
+ } else if (!rc->is_src_frame_alt_ref &&
+ (cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame)) {
+ qdelta = vp9_compute_qdelta_by_rate(&cpi->rc, cm->frame_type,
+ active_worst_quality, 1.75);
+ }
+ *top_index = active_worst_quality + qdelta;
+ *top_index = (*top_index > *bottom_index) ? *top_index : *bottom_index;
}
#endif
+
if (oxcf->end_usage == USAGE_CONSTANT_QUALITY) {
q = active_best_quality;
// Special case code to try and match quality with forced key frames
@@ -907,13 +925,22 @@ static int rc_pick_q_and_bounds_two_pass(const VP9_COMP *cpi,
*bottom_index = active_best_quality;
#if LIMIT_QRANGE_FOR_ALTREF_AND_KEY
- // Limit Q range for the adaptive loop.
- if (cm->frame_type == KEY_FRAME && !rc->this_key_frame_forced) {
- *top_index = (active_worst_quality + active_best_quality * 3) / 4;
- } else if (!rc->is_src_frame_alt_ref &&
- (oxcf->end_usage != USAGE_STREAM_FROM_SERVER) &&
- (cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame)) {
- *top_index = (active_worst_quality + active_best_quality) / 2;
+ {
+ int qdelta = 0;
+ vp9_clear_system_state();
+
+ // Limit Q range for the adaptive loop.
+ if (cm->frame_type == KEY_FRAME && !rc->this_key_frame_forced) {
+ qdelta = vp9_compute_qdelta_by_rate(&cpi->rc, cm->frame_type,
+ active_worst_quality, 2.0);
+ } else if (!rc->is_src_frame_alt_ref &&
+ (oxcf->end_usage != USAGE_STREAM_FROM_SERVER) &&
+ (cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame)) {
+ qdelta = vp9_compute_qdelta_by_rate(&cpi->rc, cm->frame_type,
+ active_worst_quality, 1.75);
+ }
+ *top_index = active_worst_quality + qdelta;
+ *top_index = (*top_index > *bottom_index) ? *top_index : *bottom_index;
}
#endif