summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeb Mukherjee <debargha@google.com>2013-11-25 18:58:45 -0800
committerDeb Mukherjee <debargha@google.com>2013-11-25 18:58:45 -0800
commit25f1195a25dc5ed21fbde75cb9858718dc9a8e43 (patch)
treea5e9893bbc3b1c27c96bb5e06b59d26f3dd60ce3
parent0a64f943fccc194a16c53af461f81bd48d840d71 (diff)
downloadlibvpx-25f1195a25dc5ed21fbde75cb9858718dc9a8e43.tar
libvpx-25f1195a25dc5ed21fbde75cb9858718dc9a8e43.tar.gz
libvpx-25f1195a25dc5ed21fbde75cb9858718dc9a8e43.tar.bz2
libvpx-25f1195a25dc5ed21fbde75cb9858718dc9a8e43.zip
Some cleanups on rate control
Removes the active_worst_qchanged variable since it is never set to 1. Change-Id: I29a291fd1068fd9b504a2db7768d45644c1eae3e
-rw-r--r--vp9/encoder/vp9_onyx_if.c23
-rw-r--r--vp9/encoder/vp9_onyx_int.h1
-rw-r--r--vp9/encoder/vp9_ratectrl.c2
-rw-r--r--vp9/encoder/vp9_ratectrl.h2
4 files changed, 9 insertions, 19 deletions
diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c
index 585f799df..17009e246 100644
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -2607,7 +2607,6 @@ static void encode_with_recode_loop(VP9_COMP *cpi,
int loop = 0;
int overshoot_seen = 0;
int undershoot_seen = 0;
- int active_worst_qchanged = 0;
int q_low = bottom_index, q_high = top_index;
do {
vp9_clear_system_state(); // __asm emms;
@@ -2655,7 +2654,6 @@ static void encode_with_recode_loop(VP9_COMP *cpi,
if (frame_over_shoot_limit == 0)
frame_over_shoot_limit = 1;
- active_worst_qchanged = 0;
if (cpi->oxcf.end_usage == USAGE_CONSTANT_QUALITY) {
loop = 0;
@@ -2716,16 +2714,12 @@ static void encode_with_recode_loop(VP9_COMP *cpi,
if (undershoot_seen || loop_count > 1) {
// Update rate_correction_factor unless
- // cpi->rc.active_worst_quality has changed.
- if (!active_worst_qchanged)
- vp9_update_rate_correction_factors(cpi, 1);
+ vp9_update_rate_correction_factors(cpi, 1);
q = (q_high + q_low + 1) / 2;
} else {
// Update rate_correction_factor unless
- // cpi->rc.active_worst_quality has changed.
- if (!active_worst_qchanged)
- vp9_update_rate_correction_factors(cpi, 0);
+ vp9_update_rate_correction_factors(cpi, 0);
q = vp9_regulate_q(cpi, cpi->rc.this_frame_target);
@@ -2744,15 +2738,13 @@ static void encode_with_recode_loop(VP9_COMP *cpi,
if (overshoot_seen || loop_count > 1) {
// Update rate_correction_factor unless
// cpi->rc.active_worst_quality has changed.
- if (!active_worst_qchanged)
- vp9_update_rate_correction_factors(cpi, 1);
+ vp9_update_rate_correction_factors(cpi, 1);
q = (q_high + q_low) / 2;
} else {
// Update rate_correction_factor unless
// cpi->rc.active_worst_quality has changed.
- if (!active_worst_qchanged)
- vp9_update_rate_correction_factors(cpi, 0);
+ vp9_update_rate_correction_factors(cpi, 0);
q = vp9_regulate_q(cpi, cpi->rc.this_frame_target);
@@ -2794,7 +2786,6 @@ static void encode_with_recode_loop(VP9_COMP *cpi,
#endif
}
} while (loop);
- cpi->rc.active_worst_qchanged = active_worst_qchanged;
}
static void encode_frame_to_data_rate(VP9_COMP *cpi,
@@ -3078,9 +3069,9 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
cpi->rc.projected_frame_size = (*size) << 3;
// Post encode loop adjustment of Q prediction.
- if (!cpi->rc.active_worst_qchanged)
- vp9_update_rate_correction_factors(cpi, (cpi->sf.recode_loop ||
- cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) ? 2 : 0);
+ vp9_update_rate_correction_factors(
+ cpi, (cpi->sf.recode_loop ||
+ cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) ? 2 : 0);
cpi->rc.last_q[cm->frame_type] = cm->base_qindex;
diff --git a/vp9/encoder/vp9_onyx_int.h b/vp9/encoder/vp9_onyx_int.h
index 8fa63854e..2ee856e39 100644
--- a/vp9/encoder/vp9_onyx_int.h
+++ b/vp9/encoder/vp9_onyx_int.h
@@ -339,7 +339,6 @@ typedef struct {
int active_worst_quality;
int best_quality;
int active_best_quality;
- int active_worst_qchanged;
} RATE_CONTROL;
typedef struct VP9_COMP {
diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c
index 1293e860f..312dfd60d 100644
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -381,7 +381,7 @@ void vp9_update_rate_correction_factors(VP9_COMP *cpi, int damp_var) {
}
-int vp9_regulate_q(VP9_COMP *cpi, int target_bits_per_frame) {
+int vp9_regulate_q(const VP9_COMP *cpi, int target_bits_per_frame) {
int q = cpi->rc.active_worst_quality;
int i;
diff --git a/vp9/encoder/vp9_ratectrl.h b/vp9/encoder/vp9_ratectrl.h
index 57dcd3f15..13357447a 100644
--- a/vp9/encoder/vp9_ratectrl.h
+++ b/vp9/encoder/vp9_ratectrl.h
@@ -21,7 +21,7 @@ void vp9_restore_coding_context(VP9_COMP *cpi);
void vp9_setup_key_frame(VP9_COMP *cpi);
void vp9_update_rate_correction_factors(VP9_COMP *cpi, int damp_var);
-int vp9_regulate_q(VP9_COMP *cpi, int target_bits_per_frame);
+int vp9_regulate_q(const VP9_COMP *cpi, int target_bits_per_frame);
void vp9_adjust_key_frame_context(VP9_COMP *cpi);
void vp9_compute_frame_size_bounds(VP9_COMP *cpi,
int *frame_under_shoot_limit,