From edccfcebb28882681a7566c47f5c1f866a917033 Mon Sep 17 00:00:00 2001 From: Dmitry Kovalev Date: Tue, 27 May 2014 18:19:19 -0700 Subject: [PATCH] Using 2 instead of 3 elements for last_q array. Change-Id: I2c6950e7d79fc89c6f97e6dcf47317ef66c453a5 --- vp9/encoder/vp9_ratectrl.c | 6 ++---- vp9/encoder/vp9_ratectrl.h | 2 +- vp9/encoder/vp9_svc_layercontext.c | 5 ++--- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c index 9ad851754..6f646ea0e 100644 --- a/vp9/encoder/vp9_ratectrl.c +++ b/vp9/encoder/vp9_ratectrl.c @@ -200,9 +200,8 @@ void vp9_rc_init(const VP9EncoderConfig *oxcf, int pass, RATE_CONTROL *rc) { oxcf->best_allowed_q) / 2; } - rc->last_q[0] = oxcf->best_allowed_q; - rc->last_q[1] = oxcf->best_allowed_q; - rc->last_q[2] = oxcf->best_allowed_q; + rc->last_q[KEY_FRAME] = oxcf->best_allowed_q; + rc->last_q[INTER_FRAME] = oxcf->best_allowed_q; rc->buffer_level = oxcf->starting_buffer_level; rc->bits_off_target = oxcf->starting_buffer_level; @@ -1090,7 +1089,6 @@ void vp9_rc_postencode_update(VP9_COMP *cpi, uint64_t bytes_used) { } else if (!rc->is_src_frame_alt_ref && (cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame) && !(cpi->use_svc && oxcf->rc_mode == RC_MODE_CBR)) { - rc->last_q[2] = qindex; rc->avg_frame_qindex[2] = ROUND_POWER_OF_TWO(3 * rc->avg_frame_qindex[2] + qindex, 2); } else { diff --git a/vp9/encoder/vp9_ratectrl.h b/vp9/encoder/vp9_ratectrl.h index b1cc67609..614078eef 100644 --- a/vp9/encoder/vp9_ratectrl.h +++ b/vp9/encoder/vp9_ratectrl.h @@ -30,7 +30,7 @@ typedef struct { int this_frame_target; // Actual frame target after rc adjustment. int projected_frame_size; int sb64_target_rate; - int last_q[3]; // Separate values for Intra/Inter/ARF-GF + int last_q[FRAME_TYPES]; // Separate values for Intra/Inter int last_boosted_qindex; // Last boosted GF/KF/ARF q int gfu_boost; diff --git a/vp9/encoder/vp9_svc_layercontext.c b/vp9/encoder/vp9_svc_layercontext.c index 48aa64c13..95ea1072d 100644 --- a/vp9/encoder/vp9_svc_layercontext.c +++ b/vp9/encoder/vp9_svc_layercontext.c @@ -50,9 +50,8 @@ void vp9_init_layer_context(VP9_COMP *const cpi) { lrc->last_q[INTER_FRAME] = oxcf->worst_allowed_q; } else { lc->target_bandwidth = oxcf->ss_target_bitrate[layer]; - lrc->last_q[0] = oxcf->best_allowed_q; - lrc->last_q[1] = oxcf->best_allowed_q; - lrc->last_q[2] = oxcf->best_allowed_q; + lrc->last_q[KEY_FRAME] = oxcf->best_allowed_q; + lrc->last_q[INTER_FRAME] = oxcf->best_allowed_q; } lrc->buffer_level = vp9_rescale((int)(oxcf->starting_buffer_level),