summaryrefslogtreecommitdiff
path: root/vpxenc.c
diff options
context:
space:
mode:
authorpaulwilkins <paulwilkins@google.com>2017-10-10 19:49:59 +0100
committerpaulwilkins <paulwilkins@google.com>2017-11-08 10:41:04 +0000
commit93e83fd7cfd7322da61960e8e8e5a5685b5245fb (patch)
treea4accda42ae9dd181445fe7000b2f6a2e95b17da /vpxenc.c
parent6fbc354c97ca45754a76674dba5f6b43c2b0c15a (diff)
downloadlibvpx-93e83fd7cfd7322da61960e8e8e5a5685b5245fb.tar
libvpx-93e83fd7cfd7322da61960e8e8e5a5685b5245fb.tar.gz
libvpx-93e83fd7cfd7322da61960e8e8e5a5685b5245fb.tar.bz2
libvpx-93e83fd7cfd7322da61960e8e8e5a5685b5245fb.zip
CVBR command line option.
Added command line control of Corpus VBR. The new corpus vbr mode is a variant of standard VBR (end-usage=0) where the complexity distribution mid point is passed in rather than calculated for a specific clip or chunk. The new variant is enabled by setting a new command line parameter --corpus-complexity to a zero value. Omitting this parameter or setting it to 0 will cause the codec to use standard vbr mode. The correct value for a given corpus needs to be derived experimentally using a training set such that the average rate for the corpus is close to the target value. For example our using our low res test set with upper and lower vbr limits of 50%-150% and a corpus complexity value of 650 gives a similar average data rate across the set to using standard vbr. However, with the corpus mode easier clips will be allocated fewer bits and harder clips more bits rather than having the same rate target for all. Change-Id: I03f0fc8c6fb0ee32dc03720fea6a3f1949118589
Diffstat (limited to 'vpxenc.c')
-rw-r--r--vpxenc.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/vpxenc.c b/vpxenc.c
index 845336a69..74c636ab7 100644
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -321,8 +321,11 @@ static const arg_def_t minsection_pct =
ARG_DEF(NULL, "minsection-pct", 1, "GOP min bitrate (% of target)");
static const arg_def_t maxsection_pct =
ARG_DEF(NULL, "maxsection-pct", 1, "GOP max bitrate (% of target)");
-static const arg_def_t *rc_twopass_args[] = { &bias_pct, &minsection_pct,
- &maxsection_pct, NULL };
+static const arg_def_t corpus_complexity =
+ ARG_DEF(NULL, "corpus-complexity", 1, "corpus vbr complexity midpoint");
+static const arg_def_t *rc_twopass_args[] = {
+ &bias_pct, &minsection_pct, &maxsection_pct, &corpus_complexity, NULL
+};
static const arg_def_t kf_min_dist =
ARG_DEF(NULL, "kf-min-dist", 1, "Minimum keyframe interval (frames)");
@@ -1235,6 +1238,11 @@ static int parse_stream_params(struct VpxEncoderConfig *global,
if (global->passes < 2)
warn("option %s ignored in one-pass mode.\n", arg.name);
+ } else if (arg_match(&arg, &corpus_complexity, argi)) {
+ config->cfg.rc_2pass_vbr_corpus_complexity = arg_parse_uint(&arg);
+
+ if (global->passes < 2)
+ warn("option %s ignored in one-pass mode.\n", arg.name);
} else if (arg_match(&arg, &kf_min_dist, argi)) {
config->cfg.kf_min_dist = arg_parse_uint(&arg);
} else if (arg_match(&arg, &kf_max_dist, argi)) {
@@ -1431,6 +1439,7 @@ static void show_stream_config(struct stream_state *stream,
SHOW(rc_2pass_vbr_bias_pct);
SHOW(rc_2pass_vbr_minsection_pct);
SHOW(rc_2pass_vbr_maxsection_pct);
+ SHOW(rc_2pass_vbr_corpus_complexity);
SHOW(kf_mode);
SHOW(kf_min_dist);
SHOW(kf_max_dist);