summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2011-08-22 07:55:34 +0200
committerAnton Khirnov <anton@khirnov.net>2011-08-31 10:23:26 +0200
commit5d4a1048ee251cf7cb2da7d24f23da6d8a34459a (patch)
treede9ba27495746f14e901a5f76184f5f810c5698b /libavcodec
parentfaaecd47082413bcbd94a66ead544c4227fe243e (diff)
libx264: add 'intra-refresh' private option.
Deprecate CODEC_FLAG2_INTRA_REFRESH.
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/avcodec.h2
-rw-r--r--libavcodec/libx264.c6
-rw-r--r--libavcodec/options.c2
3 files changed, 6 insertions, 4 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 6e16625842..ea05ed4102 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -625,8 +625,8 @@ typedef struct RcOverride{
#define CODEC_FLAG2_PSY 0x00080000 ///< Use psycho visual optimizations.
#if FF_API_X264_GLOBAL_OPTS
#define CODEC_FLAG2_SSIM 0x00100000 ///< Compute SSIM during encoding, error[] values are undefined.
-#endif
#define CODEC_FLAG2_INTRA_REFRESH 0x00200000 ///< Use periodic insertion of intra blocks instead of keyframes.
+#endif
/* Unsupported options :
* Syntax Arithmetic coding (SAC)
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 7c4db79959..2cf3009e4d 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -50,6 +50,7 @@ typedef struct X264Context {
int rc_lookahead;
int weightp;
int ssim;
+ int intra_refresh;
} X264Context;
static void X264_log(void *p, int level, const char *fmt, va_list args)
@@ -266,7 +267,6 @@ static av_cold int X264_init(AVCodecContext *avctx)
x4->params.p_log_private = avctx;
x4->params.i_log_level = X264_LOG_DEBUG;
- x4->params.b_intra_refresh = avctx->flags2 & CODEC_FLAG2_INTRA_REFRESH;
if (avctx->bit_rate) {
x4->params.rc.i_bitrate = avctx->bit_rate / 1000;
x4->params.rc.i_rc_method = X264_RC_ABR;
@@ -325,6 +325,7 @@ static av_cold int X264_init(AVCodecContext *avctx)
if (avctx->weighted_p_pred >= 0)
x4->params.analyse.i_weighted_pred = avctx->weighted_p_pred;
x4->params.analyse.b_ssim = avctx->flags2 & CODEC_FLAG2_SSIM;
+ x4->params.b_intra_refresh = avctx->flags2 & CODEC_FLAG2_INTRA_REFRESH;
#endif
if (x4->aq_mode >= 0)
@@ -342,6 +343,8 @@ static av_cold int X264_init(AVCodecContext *avctx)
if (x4->ssim >= 0)
x4->params.analyse.b_ssim = x4->ssim;
+ if (x4->intra_refresh >= 0)
+ x4->params.b_intra_refresh = x4->intra_refresh;
if (x4->fastfirstpass)
@@ -430,6 +433,7 @@ static const AVOption options[] = {
{ "simple", NULL, 0, FF_OPT_TYPE_CONST, {X264_WEIGHTP_SIMPLE}, INT_MIN, INT_MAX, VE, "weightp" },
{ "smart", NULL, 0, FF_OPT_TYPE_CONST, {X264_WEIGHTP_SMART}, INT_MIN, INT_MAX, VE, "weightp" },
{ "ssim", "Calculate and print SSIM stats.", OFFSET(ssim), FF_OPT_TYPE_INT, {-1 }, -1, 1, VE },
+ { "intra-refresh", "Use Periodic Intra Refresh instead of IDR frames.",OFFSET(intra_refresh),FF_OPT_TYPE_INT, {-1 }, -1, 1, VE },
{ NULL },
};
diff --git a/libavcodec/options.c b/libavcodec/options.c
index 1bde206663..3ae621b3f3 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -446,9 +446,7 @@ static const AVOption options[]={
{"aq_strength", "specify aq strength", OFFSET(aq_strength), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1, FLT_MAX, V|E},
{"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},
{"ssim", "ssim will be calculated during encoding", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_SSIM }, INT_MIN, INT_MAX, V|E, "flags2"},
-#endif
{"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"},
-#if FF_API_X264_GLOBAL_OPTS
{"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},
#endif
{"log_level_offset", "set the log level offset", OFFSET(log_level_offset), FF_OPT_TYPE_INT, {.dbl = 0 }, INT_MIN, INT_MAX },