From b4a3d5417016e94743120d4902fe5829c0225257 Mon Sep 17 00:00:00 2001 From: Joose Sainio Date: Wed, 4 May 2022 12:51:17 +0300 Subject: [PATCH] [rate_control] fix gop 0 + OBA --- src/rate_control.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rate_control.c b/src/rate_control.c index 7c1ff40f..27cc86ba 100644 --- a/src/rate_control.c +++ b/src/rate_control.c @@ -492,7 +492,7 @@ static INLINE double calculate_weights(encoder_state_t* const state, const int c void uvg_estimate_pic_lambda(encoder_state_t * const state) { const encoder_control_t * const encoder = state->encoder_control; - const int layer = encoder->cfg.gop[state->frame->gop_offset].layer - (state->frame->is_irap ? 1 : 0); + const int layer = MAX(encoder->cfg.gop[state->frame->gop_offset].layer - (state->frame->is_irap ? 1 : 0), 0); const int ctu_count = state->tile->frame->height_in_lcu * state->tile->frame->width_in_lcu; double alpha;