aboutsummaryrefslogtreecommitdiffstats
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:03 +0200
commitfaaecd47082413bcbd94a66ead544c4227fe243e (patch)
tree677b00d713a7726f8f5ae3be77cb2823415fefe6
parent3b81636f33e9df53153d7e7add02167c0544e695 (diff)
downloadffmpeg-faaecd47082413bcbd94a66ead544c4227fe243e.tar.gz
libx264: add 'ssim' private option.
Deprecate CODEC_FLAG2_SSIM.
-rw-r--r--libavcodec/avcodec.h2
-rw-r--r--libavcodec/libx264.c6
-rw-r--r--libavcodec/options.c2
3 files changed, 8 insertions, 2 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 3c7d781ad0..6e16625842 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 fc751a4fd8..7c4db79959 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -49,6 +49,7 @@ typedef struct X264Context {
char *psy_rd;
int rc_lookahead;
int weightp;
+ int ssim;
} X264Context;
static void X264_log(void *p, int level, const char *fmt, va_list args)
@@ -323,6 +324,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)
@@ -338,6 +340,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)
@@ -357,7 +361,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;
@@ -426,6 +429,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 784d3b11a6..1bde206663 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},