summaryrefslogtreecommitdiff
path: root/libavcodec/libvpxenc.c
diff options
context:
space:
mode:
authorJames Zern <jzern@google.com>2011-09-07 19:14:33 -0700
committerMichael Niedermayer <michaelni@gmx.at>2011-09-08 05:53:54 +0200
commit3dc14b4628a0f6d0fac3d3e7fc0f7929f6b7ca65 (patch)
tree293486492e959c7556128a5be7aec65f0496fa34 /libavcodec/libvpxenc.c
parentfb99d78778088aaa01a412adebcdf89f2b2cc946 (diff)
libvpxenc: add 'rc_lookahead' private option
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/libvpxenc.c')
-rw-r--r--libavcodec/libvpxenc.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 6e768eb57e..6db20e736c 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -68,6 +68,8 @@ typedef struct VP8EncoderContext {
int arnr_max_frames;
int arnr_strength;
int arnr_type;
+
+ int rc_lookahead;
} VP8Context;
#define V AV_OPT_FLAG_VIDEO_PARAM
@@ -85,6 +87,11 @@ static const AVOption options[]={
{"arnr_max_frames", "altref noise reduction max frame count", offsetof(VP8Context, arnr_max_frames), FF_OPT_TYPE_INT, {.dbl = 0}, 0, 15, V|E},
{"arnr_strength", "altref noise reduction filter strength", offsetof(VP8Context, arnr_strength), FF_OPT_TYPE_INT, {.dbl = 3}, 0, 6, V|E},
{"arnr_type", "altref noise reduction filter type", offsetof(VP8Context, arnr_type), FF_OPT_TYPE_INT, {.dbl = 3}, 1, 3, V|E},
+#if FF_API_X264_GLOBAL_OPTS
+{"rc_lookahead", "Number of frames to look ahead for alternate reference frame selection", offsetof(VP8Context, rc_lookahead), FF_OPT_TYPE_INT, {.dbl = -1}, -1, 25, V|E},
+#else
+{"rc_lookahead", "Number of frames to look ahead for alternate reference frame selection", offsetof(VP8Context, rc_lookahead), FF_OPT_TYPE_INT, {.dbl = 25}, 0, 25, V|E},
+#endif
{NULL}
};
static const AVClass class = { "libvpx", av_default_item_name, options, LIBAVUTIL_VERSION_INT };
@@ -261,7 +268,13 @@ static av_cold int vp8_init(AVCodecContext *avctx)
enccfg.g_timebase.num = avctx->time_base.num;
enccfg.g_timebase.den = avctx->time_base.den;
enccfg.g_threads = avctx->thread_count;
+#if FF_API_X264_GLOBAL_OPTS
enccfg.g_lag_in_frames= FFMIN(avctx->rc_lookahead, 25); //0-25, avoids init failure
+ if (ctx->rc_lookahead >= 0)
+ enccfg.g_lag_in_frames= ctx->rc_lookahead;
+#else
+ enccfg.g_lag_in_frames= ctx->rc_lookahead;
+#endif
if (avctx->flags & CODEC_FLAG_PASS1)
enccfg.g_pass = VPX_RC_FIRST_PASS;