From df7593182958385f33ef91089b04c649bcadf021 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Fri, 30 May 2025 18:40:58 +0200 Subject: [PATCH 4/4] avcodec/libaomenc: Increase code locality Signed-off-by: Andreas Rheinhardt --- libavcodec/libaomenc.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c index 9a384fcc39..903292d164 100644 --- a/libavcodec/libaomenc.c +++ b/libavcodec/libaomenc.c @@ -681,7 +681,6 @@ static av_cold int aom_init(AVCodecContext *avctx, struct aom_codec_enc_cfg enccfg = { 0 }; aom_codec_flags_t flags = (avctx->flags & AV_CODEC_FLAG_PSNR) ? AOM_CODEC_USE_PSNR : 0; - AVCPBProperties *cpb_props; int res; aom_img_fmt_t img_fmt; aom_codec_caps_t codec_caps = aom_codec_get_caps(iface); @@ -989,10 +988,6 @@ static av_cold int aom_init(AVCodecContext *avctx, if (codec_caps & AOM_CODEC_CAP_HIGHBITDEPTH) ctx->rawimg.bit_depth = enccfg.g_bit_depth; - cpb_props = ff_encode_add_cpb_side_data(avctx); - if (!cpb_props) - return AVERROR(ENOMEM); - ctx->dovi.logctx = avctx; if ((res = ff_dovi_configure(&ctx->dovi, avctx)) < 0) return res; @@ -1019,6 +1014,10 @@ static av_cold int aom_init(AVCodecContext *avctx, return ret; } + AVCPBProperties *cpb_props = ff_encode_add_cpb_side_data(avctx); + if (!cpb_props) + return AVERROR(ENOMEM); + if (enccfg.rc_end_usage == AOM_CBR || enccfg.g_pass != AOM_RC_ONE_PASS) { cpb_props->max_bitrate = avctx->rc_max_rate; -- 2.45.2