From d4b967131842e7c225e5f83cb82337d4474a0bb7 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 22 Aug 2011 07:55:34 +0200 Subject: libx264: add 'rc_lookahead' private option. Deprecate corresponding global option. --- libavcodec/avcodec.h | 4 ++-- libavcodec/libx264.c | 8 ++++++-- libavcodec/options.c | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index c36c35e686..77544e3837 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2756,7 +2756,6 @@ typedef struct AVCodecContext { * - decoding: unused */ attribute_deprecated float psy_trellis; -#endif /** * RC lookahead @@ -2764,7 +2763,8 @@ typedef struct AVCodecContext { * - encoding: Set by user * - decoding: unused */ - int rc_lookahead; + attribute_deprecated int rc_lookahead; +#endif /** * Constant rate factor maximum diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index 30bbfe6bc6..72033b9310 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -47,6 +47,7 @@ typedef struct X264Context { float aq_strength; float psy_rd; float psy_trellis; + int rc_lookahead; } X264Context; static void X264_log(void *p, int level, const char *fmt, va_list args) @@ -238,8 +239,6 @@ static av_cold int X264_init(AVCodecContext *avctx) x4->params.analyse.i_me_method = X264_ME_TESA; else x4->params.analyse.i_me_method = X264_ME_HEX; - x4->params.rc.i_lookahead = avctx->rc_lookahead; - x4->params.analyse.b_psy = avctx->flags2 & CODEC_FLAG2_PSY; x4->params.analyse.i_me_range = avctx->me_range; @@ -317,6 +316,8 @@ static av_cold int X264_init(AVCodecContext *avctx) x4->params.analyse.f_psy_rd = avctx->psy_rd; if (avctx->psy_trellis >= 0) x4->params.analyse.f_psy_trellis = avctx->psy_trellis; + if (avctx->rc_lookahead >= 0) + x4->params.rc.i_lookahead = avctx->rc_lookahead; #endif if (x4->aq_mode >= 0) @@ -327,6 +328,8 @@ static av_cold int X264_init(AVCodecContext *avctx) x4->params.analyse.f_psy_rd = x4->psy_rd; if (x4->psy_trellis >= 0) x4->params.analyse.f_psy_trellis = x4->psy_trellis; + if (x4->rc_lookahead >= 0) + x4->params.rc.i_lookahead = x4->rc_lookahead; if (x4->fastfirstpass) @@ -410,6 +413,7 @@ static const AVOption options[] = { { "aq_strength", "AQ strength. Reduces blocking and blurring in flat and textured areas.", OFFSET(aq_strength), FF_OPT_TYPE_FLOAT, {-1}, -1, FLT_MAX, VE}, { "pdy_rd", "Psy RD strength.", OFFSET(psy_rd), FF_OPT_TYPE_FLOAT, {-1 }, -1, FLT_MAX, VE}, { "psy_trellis", "Psy trellis strength", OFFSET(psy_trellis), FF_OPT_TYPE_FLOAT, {-1 }, -1, FLT_MAX, VE}, + { "rc_lookahead", "Number of frames to look ahead for frametype and ratecontrol", OFFSET(rc_lookahead), FF_OPT_TYPE_INT, {-1 }, -1, INT_MAX, VE }, { NULL }, }; diff --git a/libavcodec/options.c b/libavcodec/options.c index 365f8608ad..00a4376957 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -442,8 +442,8 @@ static const AVOption options[]={ {"psy_trellis", "specify psycho visual trellis", OFFSET(psy_trellis), FF_OPT_TYPE_FLOAT, {.dbl = -1 }, -1, FLT_MAX, V|E}, {"aq_mode", "specify aq method", OFFSET(aq_mode), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, INT_MAX, V|E}, {"aq_strength", "specify aq strength", OFFSET(aq_strength), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1, FLT_MAX, V|E}, -#endif {"rc_lookahead", "specify number of frames to look ahead for frametype", OFFSET(rc_lookahead), FF_OPT_TYPE_INT, {.dbl = 40 }, 0, INT_MAX, V|E}, +#endif {"ssim", "ssim will be calculated during encoding", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_SSIM }, INT_MIN, INT_MAX, V|E, "flags2"}, {"intra_refresh", "use periodic insertion of intra blocks instead of keyframes", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_INTRA_REFRESH }, INT_MIN, INT_MAX, V|E, "flags2"}, {"crf_max", "in crf mode, prevents vbv from lowering quality beyond this point", OFFSET(crf_max), FF_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, 0, 51, V|E}, -- cgit v1.2.3