summaryrefslogtreecommitdiff
path: root/libavcodec/libvpxenc.c
diff options
context:
space:
mode:
authorJames Zern <jzern@google.com>2017-11-20 17:32:23 -0800
committerJames Zern <jzern@google.com>2017-11-28 15:17:51 -0800
commit86cead525633cd6114824b33a74d71be677f9546 (patch)
tree731f0d979cd0f9ff309926ee54a670a6c90e3620 /libavcodec/libvpxenc.c
parented4a0c7923e8935d1829029a2c7eb980269f8ca3 (diff)
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@google.com>
Diffstat (limited to 'libavcodec/libvpxenc.c')
-rw-r--r--libavcodec/libvpxenc.c16
1 files changed, 16 insertions, 0 deletions
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 }
};