Commit faaecd47 authored by Anton Khirnov's avatar Anton Khirnov

libx264: add 'ssim' private option.

Deprecate CODEC_FLAG2_SSIM.
parent 3b81636f
......@@ -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 :
......
......@@ -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 },
};
......
......@@ -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},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment