ref: d20d9259a5e8c9367d7b5cd988465007f635d2d5
parent: 25ca4edf74151dcd871c4012ac9748831526f49f
author: Jingning Han <[email protected]>
date: Mon Aug 13 10:47:54 EDT 2018
Add vpxenc control to turn on/off tpl model The default is set to turn on the temporal dependency model at speed 0. Use --enable-tpl to control turning it on/off when calling vpxenc. Change-Id: I61614cd8100ae57dc01fd46b2a69c5b67287f18a
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -248,6 +248,8 @@
int tile_columns;
int tile_rows;
+ int enable_tpl_model;
+
int max_threads;
unsigned int target_level;
--- a/vp9/encoder/vp9_speed_features.c
+++ b/vp9/encoder/vp9_speed_features.c
@@ -849,9 +849,9 @@
sf->allow_acl = 1;
#if CONFIG_VP9_HIGHBITDEPTH
// TODO(jingning): Make the model support high bit-depth route.
- sf->enable_tpl_model = !cm->use_highbitdepth;
+ sf->enable_tpl_model = !cm->use_highbitdepth && oxcf->enable_tpl_model;
#else
- sf->enable_tpl_model = 1;
+ sf->enable_tpl_model = oxcf->enable_tpl_model;
#endif
sf->prune_ref_frame_for_rect_partitions = 0;
--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -30,6 +30,7 @@
unsigned int static_thresh;
unsigned int tile_columns;
unsigned int tile_rows;
+ unsigned int enable_tpl_model;
unsigned int arnr_max_frames;
unsigned int arnr_strength;
unsigned int min_gf_interval;
@@ -63,6 +64,7 @@
0, // static_thresh
6, // tile_columns
0, // tile_rows
+ 1, // enable_tpl_model
7, // arnr_max_frames
5, // arnr_strength
0, // min_gf_interval; 0 -> default decision
@@ -544,6 +546,8 @@
oxcf->tile_columns = extra_cfg->tile_columns;
+ oxcf->enable_tpl_model = extra_cfg->enable_tpl_model;
+
// TODO(yunqing): The dependencies between row tiles cause error in multi-
// threaded encoding. For now, tile_rows is forced to be 0 in this case.
// The further fix can be done by adding synchronizations after a tile row
@@ -740,6 +744,13 @@
return update_extra_cfg(ctx, &extra_cfg);
}
+static vpx_codec_err_t ctrl_set_tpl_model(vpx_codec_alg_priv_t *ctx,
+ va_list args) {
+ struct vp9_extracfg extra_cfg = ctx->extra_cfg;
+ extra_cfg.enable_tpl_model = CAST(VP9E_SET_TPL, args);
+ return update_extra_cfg(ctx, &extra_cfg);
+}
+
static vpx_codec_err_t ctrl_set_arnr_max_frames(vpx_codec_alg_priv_t *ctx,
va_list args) {
struct vp9_extracfg extra_cfg = ctx->extra_cfg;
@@ -1618,6 +1629,7 @@
{ VP8E_SET_STATIC_THRESHOLD, ctrl_set_static_thresh },
{ VP9E_SET_TILE_COLUMNS, ctrl_set_tile_columns },
{ VP9E_SET_TILE_ROWS, ctrl_set_tile_rows },
+ { VP9E_SET_TPL, ctrl_set_tpl_model },
{ VP8E_SET_ARNR_MAXFRAMES, ctrl_set_arnr_max_frames },
{ VP8E_SET_ARNR_STRENGTH, ctrl_set_arnr_strength },
{ VP8E_SET_ARNR_TYPE, ctrl_set_arnr_type },
--- a/vpx/vp8cx.h
+++ b/vpx/vp8cx.h
@@ -652,6 +652,14 @@
* Supported in codecs: VP9
*/
VP9E_SET_SVC_SPATIAL_LAYER_SYNC,
+
+ /*!\brief Codec control function to enable temporal dependency model.
+ *
+ * Vp9 allows the encoder to run temporal dependency model and use it to
+ * improve the compression performance. To enable, set this parameter to be
+ * 1. The default value is set to be 1.
+ */
+ VP9E_SET_TPL,
};
/*!\brief vpx 1-D scaling mode
@@ -896,6 +904,9 @@
#define VPX_CTRL_VP9E_SET_TILE_COLUMNS
VPX_CTRL_USE_TYPE(VP9E_SET_TILE_ROWS, int)
#define VPX_CTRL_VP9E_SET_TILE_ROWS
+
+VPX_CTRL_USE_TYPE(VP9E_SET_TPL, int)
+#define VPX_CTRL_VP9E_SET_TPL
VPX_CTRL_USE_TYPE(VP8E_GET_LAST_QUANTIZER, int *)
#define VPX_CTRL_VP8E_GET_LAST_QUANTIZER
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -412,6 +412,10 @@
static const arg_def_t tile_rows =
ARG_DEF(NULL, "tile-rows", 1,
"Number of tile rows to use, log2 (set to 0 while threads > 1)");
+
+static const arg_def_t enable_tpl_model =
+ ARG_DEF(NULL, "enable-tpl", 1, "Enable temporal dependency model");
+
static const arg_def_t lossless =
ARG_DEF(NULL, "lossless", 1, "Lossless mode (0: false (default), 1: true)");
static const arg_def_t frame_parallel_decoding = ARG_DEF(
@@ -497,6 +501,7 @@
&static_thresh,
&tile_cols,
&tile_rows,
+ &enable_tpl_model,
&arnr_maxframes,
&arnr_strength,
&arnr_type,
@@ -528,6 +533,7 @@
VP8E_SET_STATIC_THRESHOLD,
VP9E_SET_TILE_COLUMNS,
VP9E_SET_TILE_ROWS,
+ VP9E_SET_TPL,
VP8E_SET_ARNR_MAXFRAMES,
VP8E_SET_ARNR_STRENGTH,
VP8E_SET_ARNR_TYPE,