[FFmpeg-cvslog] libvpxenc,vp9: add corpus-complexity option
James Zern
git at videolan.org
Wed Nov 29 01:19:20 EET 2017
ffmpeg | branch: master | James Zern <jzern at google.com> | Mon Nov 20 17:32:23 2017 -0800| [86cead525633cd6114824b33a74d71be677f9546] | committer: James Zern
libvpxenc,vp9: add corpus-complexity option
Corpus VBR mode is a variant of standard VBR where the complexity
distribution midpoint is passed in rather than calculated for a specific
clip or chunk.
The valid range is [0, 10000]. 0 (default) uses standard VBR.
Signed-off-by: James Zern <jzern at google.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=86cead525633cd6114824b33a74d71be677f9546
---
doc/encoders.texi | 5 +++++
libavcodec/libvpxenc.c | 16 ++++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/doc/encoders.texi b/doc/encoders.texi
index 23451b7b92..88ef8f9b23 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1683,6 +1683,11 @@ colorspaces:
Enable row based multi-threading.
@item tune-content
Set content type: default (0), screen (1), film (2).
+ at item corpus-complexity
+Corpus VBR mode is a variant of standard VBR where the complexity distribution
+midpoint is passed in rather than calculated for a specific clip or chunk.
+
+The valid range is [0, 10000]. 0 (default) uses standard VBR.
@end table
@end table
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 0258396d08..9861e9d5ae 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -110,6 +110,7 @@ typedef struct VPxEncoderContext {
float level;
int row_mt;
int tune_content;
+ int corpus_complexity;
} VPxContext;
/** String mappings for enum vp8e_enc_control_id */
@@ -213,6 +214,10 @@ static av_cold void dump_enc_cfg(AVCodecContext *avctx,
width, "rc_2pass_vbr_bias_pct:", cfg->rc_2pass_vbr_bias_pct,
width, "rc_2pass_vbr_minsection_pct:", cfg->rc_2pass_vbr_minsection_pct,
width, "rc_2pass_vbr_maxsection_pct:", cfg->rc_2pass_vbr_maxsection_pct);
+#if VPX_ENCODER_ABI_VERSION >= 14
+ av_log(avctx, level, " %*s%u\n",
+ width, "rc_2pass_vbr_corpus_complexity:", cfg->rc_2pass_vbr_corpus_complexity);
+#endif
av_log(avctx, level, "keyframing settings\n"
" %*s%d\n %*s%u\n %*s%u\n",
width, "kf_mode:", cfg->kf_mode,
@@ -565,6 +570,14 @@ FF_ENABLE_DEPRECATION_WARNINGS
if (avctx->rc_max_rate)
enccfg.rc_2pass_vbr_maxsection_pct =
avctx->rc_max_rate * 100LL / avctx->bit_rate;
+#if CONFIG_LIBVPX_VP9_ENCODER
+ if (avctx->codec_id == AV_CODEC_ID_VP9) {
+#if VPX_ENCODER_ABI_VERSION >= 14
+ if (ctx->corpus_complexity >= 0)
+ enccfg.rc_2pass_vbr_corpus_complexity = ctx->corpus_complexity;
+#endif
+ }
+#endif
if (avctx->rc_buffer_size)
enccfg.rc_buf_sz =
@@ -1141,6 +1154,9 @@ static const AVOption vp9_options[] = {
{ "film", "Film content; improves grain retention", 0, AV_OPT_TYPE_CONST, {.i64 = 2}, 0, 0, VE, "tune_content" },
#endif
#endif
+#if VPX_ENCODER_ABI_VERSION >= 14
+ { "corpus-complexity", "corpus vbr complexity midpoint", OFFSET(corpus_complexity), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 10000, VE },
+#endif
LEGACY_OPTIONS
{ NULL }
};
More information about the ffmpeg-cvslog
mailing list