From: angiebird Date: Wed, 5 Aug 2020 20:44:01 +0000 (-0700) Subject: Make initial q_index guess at 128 X-Git-Tag: v1.10.0-rc1~86 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e3ae48b861d18badb414c8fbe201e5c4aafb5180;p=libvpx Make initial q_index guess at 128 This reduce the average recode times per frame from 2.81 to 2.73 when targeting 15% error for target bitrate per frame. Change-Id: I58f0be86443643ba23623cb1d522ae41897734a3 --- diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 7985e18d8..169cd190e 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -4265,7 +4265,7 @@ static double get_bits_percent_diff(int target_bits, int actual_bits) { static int rq_model_predict_q_index(const RATE_QSTEP_MODEL *rq_model, const RATE_QINDEX_HISTORY *rq_history, int target_bits) { - int q_index = -1; + int q_index = 128; if (rq_history->recode_count > 0) { const int actual_bits = rq_history->rate_history[rq_history->recode_count - 1]; @@ -4405,12 +4405,9 @@ static void encode_with_recode_loop(VP9_COMP *cpi, size_t *size, } #if CONFIG_RATE_CTRL - { - const int suggested_q_index = rq_model_predict_q_index( - rq_model, &rq_history, rc->this_frame_target); - if (suggested_q_index != -1) { - q = suggested_q_index; - } + if (cpi->encode_command.use_external_target_frame_bits) { + q = rq_model_predict_q_index(rq_model, &rq_history, + rc->this_frame_target); } #endif // CONFIG_RATE_CTRL // Decide frame size bounds first time through.