[FFmpeg-devel] [PATCH] lavc/libvpxenc: fix -auto-alt-ref option type
James Zern
jzern at google.com
Fri Oct 21 09:22:10 EEST 2016
On Thu, Oct 20, 2016 at 11:51 AM, Rostislav Pehlivanov
<atomnuker at gmail.com> wrote:
> On 20 October 2016 at 16:31, 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(-)
>>
>> 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
>>
>
> lgtm
> You could have moved the check after the tuning ifs before the alpha
> channel check but it's okay like it is, whoever commits it could do it
> anyway if they feel like it.
>
The library will report an error (treated as a warning here) which is
probably enough.
More information about the ffmpeg-devel
mailing list