Deprecate CODEC_FLAG2_SSIM.
---
libavcodec/avcodec.h | 2 ++
libavcodec/libx264.c | 6 +++++-
libavcodec/options.c | 2 +-
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index c0dcae5..7fd9095 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -623,7 +623,9 @@ typedef struct RcOverride{
#define CODEC_FLAG2_BIT_RESERVOIR 0x00020000 ///< Use a bit reservoir when
encoding if possible
#define CODEC_FLAG2_MBTREE 0x00040000 ///< Use macroblock tree
ratecontrol (x264 only)
#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.
/* Unsupported options :
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index ebbb217..b03a495 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -50,6 +50,7 @@ typedef struct X264Context {
float psy_trellis;
int rc_lookahead;
int weightp;
+ int ssim;
} X264Context;
static void X264_log(void *p, int level, const char *fmt, va_list args)
@@ -324,6 +325,7 @@ static av_cold int X264_init(AVCodecContext *avctx)
x4->params.rc.i_lookahead = avctx->rc_lookahead;
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;
#endif
if (x4->aq_mode >= 0)
@@ -339,6 +341,8 @@ static av_cold int X264_init(AVCodecContext *avctx)
if (x4->weightp >= 0)
x4->params.analyse.i_weighted_pred = x4->weightp;
+ if (x4->ssim >= 0)
+ x4->params.analyse.b_ssim = x4->ssim;
if (x4->fastfirstpass)
@@ -358,7 +362,6 @@ static av_cold int X264_init(AVCodecContext *avctx)
x4->params.i_fps_den = x4->params.i_timebase_num = avctx->time_base.num;
x4->params.analyse.b_psnr = avctx->flags & CODEC_FLAG_PSNR;
- x4->params.analyse.b_ssim = avctx->flags2 & CODEC_FLAG2_SSIM;
x4->params.b_aud = avctx->flags2 & CODEC_FLAG2_AUD;
@@ -428,6 +431,7 @@ static const AVOption options[] = {
{ "none", NULL, 0, FF_OPT_TYPE_CONST, {X264_WEIGHTP_NONE},
INT_MIN, INT_MAX, VE, "weightp" },
{ "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 },
{ NULL },
};
diff --git a/libavcodec/options.c b/libavcodec/options.c
index 784d3b1..1bde206 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -445,8 +445,8 @@ static const AVOption options[]={
{"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},
{"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"},
+#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},
--
1.7.5.4
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel