[FFmpeg-devel] [PATCH] lavc/libvpxenc: fix -auto-alt-ref option type

James Zern jzern at google.com
Fri Oct 21 06:14:32 EEST 2016


On Thu, Oct 20, 2016 at 8:31 AM, Kagami Hiiragi <kagami at genshiken.org> wrote:
> vp9_cx_iface actually allows values in range [0..2].
> This fixes ticket #5894.
>
> Signed-off-by: Kagami Hiiragi <kagami at genshiken.org>
> ---
>  libavcodec/libvpxenc.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>

This is all right in the sense that the library exposes the option. In
practice the feature was never fully developed and will cause failures
in certain hardware decoders.

> diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
> index 2db87f7..bedaa70 100644
> --- a/libavcodec/libvpxenc.c
> +++ b/libavcodec/libvpxenc.c
> @@ -615,6 +615,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
>          }
>      }
>
> +    if (ctx->auto_alt_ref > 1 && avctx->codec_id == AV_CODEC_ID_VP8) {
> +        av_log(avctx, AV_LOG_ERROR, "auto_alt_ref > 1 is forbidden for libvpx-vp8\n");
> +        return AVERROR(EINVAL);
> +    }
> +
>      //codec control failures are currently treated only as warnings
>      av_log(avctx, AV_LOG_DEBUG, "vpx_codec_control\n");
>      codecctl_int(avctx, VP8E_SET_CPUUSED,          ctx->cpu_used);
> @@ -1025,7 +1030,7 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt,
>
>  #define COMMON_OPTIONS \
>      { "auto-alt-ref",    "Enable use of alternate reference " \
> -                         "frames (2-pass only)",                   OFFSET(auto_alt_ref),    AV_OPT_TYPE_BOOL, {.i64 = -1},     -1,      1,       VE}, \
> +                         "frames (2-pass only)",                   OFFSET(auto_alt_ref),    AV_OPT_TYPE_INT, {.i64 = -1},      -1,      2,       VE}, \
>      { "lag-in-frames",   "Number of frames to look ahead for " \
>                           "alternate reference frame selection",    OFFSET(lag_in_frames),   AV_OPT_TYPE_INT, {.i64 = -1},      -1,      INT_MAX, VE}, \
>      { "arnr-maxframes",  "altref noise reduction max frame count", OFFSET(arnr_max_frames), AV_OPT_TYPE_INT, {.i64 = -1},      -1,      INT_MAX, VE}, \
> --
> 2.7.3
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


More information about the ffmpeg-devel mailing list