diff options
author | Timothy Gu <timothygu99@gmail.com> | 2013-07-31 06:40:45 +0400 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2014-04-07 01:23:13 +0400 |
commit | c389a804943095ebf078daec6b64690d2c97069c (patch) | |
tree | 18a5bee6000238f4ecf087aee3f129f487fce8b1 /libavcodec/libxvid.c | |
parent | 5ce7ca68b86856ee8e9d6530dffdadc4eca4f8d1 (diff) |
libxvid: Add SSIM displaying through a libxvidcore plugin
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Diffstat (limited to 'libavcodec/libxvid.c')
-rw-r--r-- | libavcodec/libxvid.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c index 42614eaab4..9970d8632e 100644 --- a/libavcodec/libxvid.c +++ b/libavcodec/libxvid.c @@ -62,6 +62,8 @@ struct xvid_context { unsigned char *inter_matrix; /**< I-Frame Quant Matrix */ int lumi_aq; /**< Lumi masking as an aq method */ int variance_aq; /**< Variance adaptive quantization */ + int ssim; /**< SSIM information display mode */ + int ssim_acc; /**< SSIM accuracy. 0: accurate. 4: fast. */ }; /** @@ -354,6 +356,7 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx) { xvid_plugin_2pass2_t rc2pass2 = { 0 }; xvid_plugin_lumimasking_t masking_l = { 0 }; /* For lumi masking */ xvid_plugin_lumimasking_t masking_v = { 0 }; /* For variance AQ */ + xvid_plugin_ssim_t ssim = { 0 }; xvid_gbl_init_t xvid_gbl_init = { 0 }; xvid_enc_create_t xvid_enc_create = { 0 }; xvid_enc_plugin_t plugins[7]; @@ -552,6 +555,17 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx) { xvid_enc_create.num_plugins++; } + /* SSIM */ + if (x->ssim) { + plugins[xvid_enc_create.num_plugins].func = xvid_plugin_ssim; + ssim.b_printstat = x->ssim == 2; + ssim.acc = x->ssim_acc; + ssim.cpu_flags = xvid_gbl_init.cpu_flags; + ssim.b_visualize = 0; + plugins[xvid_enc_create.num_plugins].param = &ssim; + xvid_enc_create.num_plugins++; + } + /* Frame Rate and Key Frames */ xvid_correct_framerate(avctx); xvid_enc_create.fincr = avctx->time_base.num; @@ -780,6 +794,11 @@ static av_cold int xvid_encode_close(AVCodecContext *avctx) { static const AVOption options[] = { { "lumi_aq", "Luminance masking AQ", OFFSET(lumi_aq), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, { "variance_aq", "Variance AQ", OFFSET(variance_aq), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, + { "ssim", "Show SSIM information to stdout", OFFSET(ssim), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 2, VE, "ssim" }, + { "off", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE, "ssim" }, + { "avg", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, VE, "ssim" }, + { "frame", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, INT_MIN, INT_MAX, VE, "ssim" }, + { "ssim_acc", "SSIM accuracy", OFFSET(ssim_acc), AV_OPT_TYPE_INT, { .i64 = 2 }, 0, 4, VE }, { NULL }, }; |