[FFmpeg-devel] [PATCH] lavc/libvpxenc: fix -auto-alt-ref option type
Kagami Hiiragi
kagami at genshiken.org
Thu Oct 20 18:31:38 EEST 2016
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
More information about the ffmpeg-devel
mailing list