[FFmpeg-devel] [PATCH] avcodec/libaomenc: use ctx->usage to get default cfg

James Zern jzern at google.com
Sat Aug 14 05:18:11 EEST 2021


On Fri, Aug 13, 2021 at 7:11 PM James Zern <jzern at google.com> wrote:
>
> this prevents some mismatches in config values for realtime and all
> intra modes, avoiding failures like:
>

The logic for default crf may need some work with -usage 2.

> [libaom-av1 @ ...] Failed to initialize encoder: Invalid parameter
> [libaom-av1 @ ...]   Additional information: g_lag_in_frames out of
> range [..0]
> ---
>  libavcodec/libaomenc.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
> index 9c0317f3b2..800fda0591 100644
> --- a/libavcodec/libaomenc.c
> +++ b/libavcodec/libaomenc.c
> @@ -599,7 +599,7 @@ static av_cold int aom_init(AVCodecContext *avctx,
>      av_log(avctx, AV_LOG_INFO, "%s\n", aom_codec_version_str());
>      av_log(avctx, AV_LOG_VERBOSE, "%s\n", aom_codec_build_config());
>
> -    if ((res = aom_codec_enc_config_default(iface, &enccfg, 0)) != AOM_CODEC_OK) {
> +    if ((res = aom_codec_enc_config_default(iface, &enccfg, ctx->usage)) != AOM_CODEC_OK) {
>          av_log(avctx, AV_LOG_ERROR, "Failed to get config: %s\n",
>                 aom_codec_err_to_string(res));
>          return AVERROR(EINVAL);
> @@ -623,8 +623,6 @@ static av_cold int aom_init(AVCodecContext *avctx,
>      enccfg.g_threads      =
>          FFMIN(avctx->thread_count ? avctx->thread_count : av_cpu_count(), 64);
>
> -    enccfg.g_usage        = ctx->usage;
> -
>      if (ctx->lag_in_frames >= 0)
>          enccfg.g_lag_in_frames = ctx->lag_in_frames;
>
> --
> 2.33.0.rc1.237.g0d66db33f3-goog
>


More information about the ffmpeg-devel mailing list