diff mbox series

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

Message ID 20210814021104.3439870-1-jzern@google.com
State New
Headers show
Series [FFmpeg-devel] avcodec/libaomenc: use ctx->usage to get default cfg
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

James Zern Aug. 14, 2021, 2:11 a.m. UTC
this prevents some mismatches in config values for realtime and all
intra modes, avoiding failures like:

[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(-)

Comments

James Zern Aug. 14, 2021, 2:18 a.m. UTC | #1
On Fri, Aug 13, 2021 at 7:11 PM James Zern <jzern@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
>
Mapul Bhola Aug. 14, 2021, 3:08 a.m. UTC | #2
August 13, 2021 10:11 PM, "James Zern" <jzern-at-google.com@ffmpeg.org> wrote:

> this prevents some mismatches in config values for realtime and all
> intra modes, avoiding failures like:
> 
> [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;
> 

LGTM

> -- 
> 2.33.0.rc1.237.g0d66db33f3-goog
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Mapul Bhola Aug. 14, 2021, 3:17 a.m. UTC | #3
August 13, 2021 10:11 PM, "James Zern" <jzern-at-google.com@ffmpeg.org> wrote:

> this prevents some mismatches in config values for realtime and all
> intra modes, avoiding failures like:
> 
> [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;
> 
LGTM, first email appears not to have sent.
> -- 
> 2.33.0.rc1.237.g0d66db33f3-goog
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
James Zern Aug. 19, 2021, midnight UTC | #4
On Fri, Aug 13, 2021 at 7:11 PM James Zern <jzern@google.com> wrote:
>
> this prevents some mismatches in config values for realtime and all
> intra modes, avoiding failures like:
>
> [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(-)
>

I bumped the patch version locally.

> 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
>
James Zern Aug. 21, 2021, 1:57 a.m. UTC | #5
On Wed, Aug 18, 2021 at 5:00 PM James Zern <jzern@google.com> wrote:
>
> On Fri, Aug 13, 2021 at 7:11 PM James Zern <jzern@google.com> wrote:
> >
> > this prevents some mismatches in config values for realtime and all
> > intra modes, avoiding failures like:
> >
> > [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(-)
> >
>
> I bumped the patch version locally.
>

I'll submit this next week if there aren't any comments.

> > 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
> >
diff mbox series

Patch

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;