summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorangiebird <angiebird@google.com>2019-11-19 13:58:36 -0800
committerangiebird <angiebird@google.com>2019-11-20 10:41:16 -0800
commit93e2e701a9fd2b979ff9f3811146858a3d9f81b0 (patch)
treeb5a1cb1d5f418af3a6f3ac9aa102423f7e083eec
parentfb4f013f27e3c5304a12f9cc2a863e093ceb3cc2 (diff)
downloadlibvpx-93e2e701a9fd2b979ff9f3811146858a3d9f81b0.tar.gz
Fix a bug related to use_external_quantize_index
Move the break point in encode_with_recode_loop after save_coding_context() so that restore_coding_context can work properly. Change-Id: I58f46928c8cae0ae542fd8343076670fb35681bf
-rw-r--r--vp9/encoder/vp9_encoder.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c
index 511ffec86..8ca7eb653 100644
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -4319,13 +4319,6 @@ static void encode_with_recode_loop(VP9_COMP *cpi, size_t *size,
// update_base_skip_probs(cpi);
vpx_clear_system_state();
-#if CONFIG_RATE_CTRL
- // TODO(angiebird): This is a hack for making sure the encoder use the
- // external_quantize_index exactly. Avoid this kind of hack later.
- if (cpi->encode_command.use_external_quantize_index) {
- break;
- }
-#endif
// Dummy pack of the bitstream using up to date stats to get an
// accurate estimate of output frame size to determine if we need
@@ -4339,6 +4332,16 @@ static void encode_with_recode_loop(VP9_COMP *cpi, size_t *size,
if (frame_over_shoot_limit == 0) frame_over_shoot_limit = 1;
}
+#if CONFIG_RATE_CTRL
+ // This part needs to be after save_coding_context() because
+ // restore_coding_context may be called in the end of this function.
+ // TODO(angiebird): This is a hack for making sure the encoder use the
+ // external_quantize_index exactly. Avoid this kind of hack later.
+ if (cpi->encode_command.use_external_quantize_index) {
+ break;
+ }
+#endif
+
if (oxcf->rc_mode == VPX_Q) {
loop = 0;
} else {