summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vp9/encoder/vp9_encoder.h2
-rw-r--r--vp9/encoder/vp9_speed_features.c4
-rw-r--r--vp9/vp9_cx_iface.c12
-rw-r--r--vpx/vp8cx.h11
-rw-r--r--vpxenc.c6
5 files changed, 33 insertions, 2 deletions
diff --git a/vp9/encoder/vp9_encoder.h b/vp9/encoder/vp9_encoder.h
index 038413a96..6a825800d 100644
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -248,6 +248,8 @@ typedef struct VP9EncoderConfig {
int tile_columns;
int tile_rows;
+ int enable_tpl_model;
+
int max_threads;
unsigned int target_level;
diff --git a/vp9/encoder/vp9_speed_features.c b/vp9/encoder/vp9_speed_features.c
index d522a623b..dca47924e 100644
--- a/vp9/encoder/vp9_speed_features.c
+++ b/vp9/encoder/vp9_speed_features.c
@@ -849,9 +849,9 @@ void vp9_set_speed_features_framesize_independent(VP9_COMP *cpi) {
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;
diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c
index 3da8758d9..45a846459 100644
--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -30,6 +30,7 @@ struct vp9_extracfg {
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 @@ static struct vp9_extracfg default_extra_cfg = {
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 @@ static vpx_codec_err_t set_encoder_config(
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 @@ static vpx_codec_err_t ctrl_set_tile_rows(vpx_codec_alg_priv_t *ctx,
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 @@ static vpx_codec_ctrl_fn_map_t encoder_ctrl_maps[] = {
{ 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 },
diff --git a/vpx/vp8cx.h b/vpx/vp8cx.h
index ea720cfb3..5ede91a20 100644
--- a/vpx/vp8cx.h
+++ b/vpx/vp8cx.h
@@ -652,6 +652,14 @@ enum vp8e_enc_control_id {
* 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
@@ -897,6 +905,9 @@ VPX_CTRL_USE_TYPE(VP9E_SET_TILE_COLUMNS, int)
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
VPX_CTRL_USE_TYPE(VP8E_GET_LAST_QUANTIZER_64, int *)
diff --git a/vpxenc.c b/vpxenc.c
index 3d8d95940..770a91762 100644
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -412,6 +412,10 @@ static const arg_def_t tile_cols =
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 const arg_def_t *vp9_args[] = { &cpu_used_vp9,
&static_thresh,
&tile_cols,
&tile_rows,
+ &enable_tpl_model,
&arnr_maxframes,
&arnr_strength,
&arnr_type,
@@ -528,6 +533,7 @@ static const int vp9_arg_ctrl_map[] = { VP8E_SET_CPUUSED,
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,