[FFmpeg-cvslog] libx264: add 'intra-refresh' private option.

Anton Khirnov git at videolan.org
Thu Sep 1 00:03:03 CEST 2011


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Mon Aug 22 07:55:34 2011 +0200| [5d4a1048ee251cf7cb2da7d24f23da6d8a34459a] | committer: Anton Khirnov

libx264: add 'intra-refresh' private option.

Deprecate CODEC_FLAG2_INTRA_REFRESH.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5d4a1048ee251cf7cb2da7d24f23da6d8a34459a
---

 libavcodec/avcodec.h |    2 +-
 libavcodec/libx264.c |    6 +++++-
 libavcodec/options.c |    2 --
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 6e16625..ea05ed4 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 7c4db79..2cf3009 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 1bde206..3ae621b 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 },



More information about the ffmpeg-cvslog mailing list