From 67a60a35e31f8fe94f79428df394d1b2f7e9c31e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arttu=20Yl=C3=A4-Outinen?= Date: Thu, 6 Jul 2017 13:20:31 +0300 Subject: [PATCH] Fix invalid calls to normalize_lcu_weights Changes encoder_state_init_new_frame to only call normalize_lcu_weights when the weights have been written to the array and rate control is enabled. When rate control is disabled, the weights are not used. --- src/encoderstate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/encoderstate.c b/src/encoderstate.c index 25a3aa56..93ae4fb8 100644 --- a/src/encoderstate.c +++ b/src/encoderstate.c @@ -1228,7 +1228,9 @@ static void encoder_state_init_new_frame(encoder_state_t * const state, kvz_pict encoder_state_remove_refs(state); encoder_state_ref_sort(state); - normalize_lcu_weights(state); + if (cfg->target_bitrate > 0 && state->frame->num > cfg->owf) { + normalize_lcu_weights(state); + } kvz_set_picture_lambda_and_qp(state); encoder_state_init_children(state);