1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avcodec/libaomenc: Increase code locality

Reviewed-by: Niklas Haas <ffmpeg@haasn.xyz>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-05-30 18:40:58 +02:00
parent 1b5a291dcc
commit 27c5e4b39a

View File

@ -681,7 +681,6 @@ static av_cold int aom_init(AVCodecContext *avctx,
struct aom_codec_enc_cfg enccfg = { 0 }; struct aom_codec_enc_cfg enccfg = { 0 };
aom_codec_flags_t flags = aom_codec_flags_t flags =
(avctx->flags & AV_CODEC_FLAG_PSNR) ? AOM_CODEC_USE_PSNR : 0; (avctx->flags & AV_CODEC_FLAG_PSNR) ? AOM_CODEC_USE_PSNR : 0;
AVCPBProperties *cpb_props;
int res; int res;
aom_img_fmt_t img_fmt; aom_img_fmt_t img_fmt;
aom_codec_caps_t codec_caps = aom_codec_get_caps(iface); 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) if (codec_caps & AOM_CODEC_CAP_HIGHBITDEPTH)
ctx->rawimg.bit_depth = enccfg.g_bit_depth; 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; ctx->dovi.logctx = avctx;
if ((res = ff_dovi_configure(&ctx->dovi, avctx)) < 0) if ((res = ff_dovi_configure(&ctx->dovi, avctx)) < 0)
return res; return res;
@ -1019,6 +1014,10 @@ static av_cold int aom_init(AVCodecContext *avctx,
return ret; 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 || if (enccfg.rc_end_usage == AOM_CBR ||
enccfg.g_pass != AOM_RC_ONE_PASS) { enccfg.g_pass != AOM_RC_ONE_PASS) {
cpb_props->max_bitrate = avctx->rc_max_rate; cpb_props->max_bitrate = avctx->rc_max_rate;