Commit d808bfcf authored by Yushin Cho's avatar Yushin Cho
Browse files

Add --enable-dist-8x8, rename existing '--tune' as '--tune-metric'

Added 'cdef-dist' and 'daala-dist' options to --tune-metric'.
(Actual bodies of the options will be added in later separate commits)

Also, if --tune=cdef-dist or --tune=daala-dist,
enable-dist-8x8 is automatically turned on.

This commit is a part of prep-work to remove DIST_8X8, CDEF_DIST,
and DAALA_DIST experimental flags.

Change-Id: I0790b9537dfaf166cb59741997ae27da10697a33
parent 1ae0ebfc
...@@ -458,6 +458,21 @@ enum aome_enc_control_id { ...@@ -458,6 +458,21 @@ enum aome_enc_control_id {
*/ */
AV1E_SET_QM_MAX, AV1E_SET_QM_MAX,
/*!\brief Codec control function to encode with dist_8x8.
*
* The dist_8x8 is enabled automatically for model tuning parameters that
* require measuring distortion at the 8x8 level. This control also allows
* measuring distortion at the 8x8 level for other tuning options
* (e.g., PSNR), for testing purposes.
* 0 = do not use dist_8x8
* 1 = use dist_8x8
*
* By default, the encoder does not use dist_8x8
*
* Experiment: DIST_8X8
*/
AV1E_SET_ENABLE_DIST_8X8,
/*!\brief Codec control function to set a maximum number of tile groups. /*!\brief Codec control function to set a maximum number of tile groups.
* *
* This will set the maximum number of tile groups. This will be * This will set the maximum number of tile groups. This will be
...@@ -622,7 +637,14 @@ typedef enum { ...@@ -622,7 +637,14 @@ typedef enum {
* Changes the encoder to tune for certain types of input material. * Changes the encoder to tune for certain types of input material.
* *
*/ */
typedef enum { AOM_TUNE_PSNR, AOM_TUNE_SSIM } aom_tune_metric; typedef enum {
AOM_TUNE_PSNR,
AOM_TUNE_SSIM,
#ifdef CONFIG_DIST_8X8
AOM_TUNE_CDEF_DIST,
AOM_TUNE_DAALA_DIST
#endif
} aom_tune_metric;
/*!\cond */ /*!\cond */
/*!\brief Encoder control function parameter type /*!\brief Encoder control function parameter type
...@@ -693,6 +715,9 @@ AOM_CTRL_USE_TYPE(AV1E_SET_LOSSLESS, unsigned int) ...@@ -693,6 +715,9 @@ AOM_CTRL_USE_TYPE(AV1E_SET_LOSSLESS, unsigned int)
AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_QM, unsigned int) AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_QM, unsigned int)
#define AOM_CTRL_AV1E_SET_ENABLE_QM #define AOM_CTRL_AV1E_SET_ENABLE_QM
AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_DIST_8X8, unsigned int)
#define AOM_CTRL_AV1E_SET_ENABLE_DIST_8X8
AOM_CTRL_USE_TYPE(AV1E_SET_QM_MIN, unsigned int) AOM_CTRL_USE_TYPE(AV1E_SET_QM_MIN, unsigned int)
#define AOM_CTRL_AV1E_SET_QM_MIN #define AOM_CTRL_AV1E_SET_QM_MIN
......
...@@ -377,10 +377,16 @@ static const arg_def_t arnr_maxframes = ...@@ -377,10 +377,16 @@ static const arg_def_t arnr_maxframes =
static const arg_def_t arnr_strength = static const arg_def_t arnr_strength =
ARG_DEF(NULL, "arnr-strength", 1, "AltRef filter strength (0..6)"); ARG_DEF(NULL, "arnr-strength", 1, "AltRef filter strength (0..6)");
static const struct arg_enum_list tuning_enum[] = { static const struct arg_enum_list tuning_enum[] = {
{ "psnr", AOM_TUNE_PSNR }, { "ssim", AOM_TUNE_SSIM }, { NULL, 0 } { "psnr", AOM_TUNE_PSNR },
{ "ssim", AOM_TUNE_SSIM },
#ifdef CONFIG_DIST_8X8
{ "cdef-dist", AOM_TUNE_CDEF_DIST },
{ "daala-dist", AOM_TUNE_DAALA_DIST },
#endif
{ NULL, 0 }
}; };
static const arg_def_t tune_ssim = static const arg_def_t tune_metric =
ARG_DEF_ENUM(NULL, "tune", 1, "Material to favor", tuning_enum); ARG_DEF_ENUM(NULL, "tune", 1, "Distortion metric tuned with", tuning_enum);
static const arg_def_t cq_level = static const arg_def_t cq_level =
ARG_DEF(NULL, "cq-level", 1, "Constant/Constrained Quality level"); ARG_DEF(NULL, "cq-level", 1, "Constant/Constrained Quality level");
static const arg_def_t max_intra_rate_pct = static const arg_def_t max_intra_rate_pct =
...@@ -418,6 +424,11 @@ static const arg_def_t qm_min = ARG_DEF( ...@@ -418,6 +424,11 @@ static const arg_def_t qm_min = ARG_DEF(
static const arg_def_t qm_max = ARG_DEF( static const arg_def_t qm_max = ARG_DEF(
NULL, "qm-max", 1, "Max quant matrix flatness (0..15), default is 16"); NULL, "qm-max", 1, "Max quant matrix flatness (0..15), default is 16");
#endif #endif
#if CONFIG_DIST_8X8
static const arg_def_t enable_dist_8x8 =
ARG_DEF(NULL, "enable-dist-8x8", 1,
"Enable dist-8x8 (0: false (default), 1: true)");
#endif // CONFIG_DIST_8X8
static const arg_def_t num_tg = ARG_DEF( static const arg_def_t num_tg = ARG_DEF(
NULL, "num-tile-groups", 1, "Maximum number of tile groups, default is 1"); NULL, "num-tile-groups", 1, "Maximum number of tile groups, default is 1");
static const arg_def_t mtu_size = static const arg_def_t mtu_size =
...@@ -550,7 +561,7 @@ static const arg_def_t *av1_args[] = { &cpu_used_av1, ...@@ -550,7 +561,7 @@ static const arg_def_t *av1_args[] = { &cpu_used_av1,
#endif // CONFIG_LOOPFILTERING_ACROSS_TILES #endif // CONFIG_LOOPFILTERING_ACROSS_TILES
&arnr_maxframes, &arnr_maxframes,
&arnr_strength, &arnr_strength,
&tune_ssim, &tune_metric,
&cq_level, &cq_level,
&max_intra_rate_pct, &max_intra_rate_pct,
&max_inter_rate_pct, &max_inter_rate_pct,
...@@ -560,6 +571,9 @@ static const arg_def_t *av1_args[] = { &cpu_used_av1, ...@@ -560,6 +571,9 @@ static const arg_def_t *av1_args[] = { &cpu_used_av1,
&enable_qm, &enable_qm,
&qm_min, &qm_min,
&qm_max, &qm_max,
#endif
#if CONFIG_DIST_8X8
&enable_dist_8x8,
#endif #endif
&frame_parallel_decoding, &frame_parallel_decoding,
&aq_mode, &aq_mode,
...@@ -616,6 +630,9 @@ static const int av1_arg_ctrl_map[] = { AOME_SET_CPUUSED, ...@@ -616,6 +630,9 @@ static const int av1_arg_ctrl_map[] = { AOME_SET_CPUUSED,
AV1E_SET_ENABLE_QM, AV1E_SET_ENABLE_QM,
AV1E_SET_QM_MIN, AV1E_SET_QM_MIN,
AV1E_SET_QM_MAX, AV1E_SET_QM_MAX,
#endif
#if CONFIG_DIST_8X8
AV1E_SET_ENABLE_DIST_8X8,
#endif #endif
AV1E_SET_FRAME_PARALLEL_DECODING, AV1E_SET_FRAME_PARALLEL_DECODING,
AV1E_SET_AQ_MODE, AV1E_SET_AQ_MODE,
......
...@@ -57,6 +57,9 @@ struct av1_extracfg { ...@@ -57,6 +57,9 @@ struct av1_extracfg {
unsigned int enable_qm; unsigned int enable_qm;
unsigned int qm_min; unsigned int qm_min;
unsigned int qm_max; unsigned int qm_max;
#endif
#if CONFIG_DIST_8X8
unsigned int enable_dist_8x8;
#endif #endif
unsigned int num_tg; unsigned int num_tg;
unsigned int mtu_size; unsigned int mtu_size;
...@@ -121,6 +124,9 @@ static struct av1_extracfg default_extra_cfg = { ...@@ -121,6 +124,9 @@ static struct av1_extracfg default_extra_cfg = {
0, // enable_qm 0, // enable_qm
DEFAULT_QM_FIRST, // qm_min DEFAULT_QM_FIRST, // qm_min
DEFAULT_QM_LAST, // qm_max DEFAULT_QM_LAST, // qm_max
#endif
#if CONFIG_DIST_8X8
0,
#endif #endif
1, // max number of tile groups 1, // max number of tile groups
0, // mtu_size 0, // mtu_size
...@@ -326,6 +332,14 @@ static aom_codec_err_t validate_config(aom_codec_alg_priv_t *ctx, ...@@ -326,6 +332,14 @@ static aom_codec_err_t validate_config(aom_codec_alg_priv_t *ctx,
if (extra_cfg->tuning == AOM_TUNE_SSIM) if (extra_cfg->tuning == AOM_TUNE_SSIM)
ERROR("Option --tune=ssim is not currently supported in AV1."); ERROR("Option --tune=ssim is not currently supported in AV1.");
#if CONFIG_DIST_8X8
if (extra_cfg->tuning == AOM_TUNE_CDEF_DIST)
ERROR("Option --tune=cdef-dist is not currently supported in AV1.");
if (extra_cfg->tuning == AOM_TUNE_DAALA_DIST)
ERROR("Option --tune=daala-dist is not currently supported in AV1.");
#endif // CONFIG_DIST_8X8
if (cfg->g_pass == AOM_RC_LAST_PASS) { if (cfg->g_pass == AOM_RC_LAST_PASS) {
#if !CONFIG_XIPHRC #if !CONFIG_XIPHRC
const size_t packet_sz = sizeof(FIRSTPASS_STATS); const size_t packet_sz = sizeof(FIRSTPASS_STATS);
...@@ -480,7 +494,12 @@ static aom_codec_err_t set_encoder_config( ...@@ -480,7 +494,12 @@ static aom_codec_err_t set_encoder_config(
oxcf->qm_minlevel = extra_cfg->qm_min; oxcf->qm_minlevel = extra_cfg->qm_min;
oxcf->qm_maxlevel = extra_cfg->qm_max; oxcf->qm_maxlevel = extra_cfg->qm_max;
#endif #endif
#if CONFIG_DIST_8X8
oxcf->using_dist_8x8 = extra_cfg->enable_dist_8x8;
if (extra_cfg->tuning == AOM_TUNE_CDEF_DIST ||
extra_cfg->tuning == AOM_TUNE_DAALA_DIST)
oxcf->using_dist_8x8 = 1;
#endif
oxcf->num_tile_groups = extra_cfg->num_tg; oxcf->num_tile_groups = extra_cfg->num_tg;
#if CONFIG_EXT_TILE #if CONFIG_EXT_TILE
// In large-scale tile encoding mode, num_tile_groups is always 1. // In large-scale tile encoding mode, num_tile_groups is always 1.
...@@ -865,7 +884,14 @@ static aom_codec_err_t ctrl_set_qm_max(aom_codec_alg_priv_t *ctx, ...@@ -865,7 +884,14 @@ static aom_codec_err_t ctrl_set_qm_max(aom_codec_alg_priv_t *ctx,
return update_extra_cfg(ctx, &extra_cfg); return update_extra_cfg(ctx, &extra_cfg);
} }
#endif #endif
#if CONFIG_DIST_8X8
static aom_codec_err_t ctrl_set_enable_dist_8x8(aom_codec_alg_priv_t *ctx,
va_list args) {
struct av1_extracfg extra_cfg = ctx->extra_cfg;
extra_cfg.enable_dist_8x8 = CAST(AV1E_SET_ENABLE_DIST_8X8, args);
return update_extra_cfg(ctx, &extra_cfg);
}
#endif
static aom_codec_err_t ctrl_set_num_tg(aom_codec_alg_priv_t *ctx, static aom_codec_err_t ctrl_set_num_tg(aom_codec_alg_priv_t *ctx,
va_list args) { va_list args) {
struct av1_extracfg extra_cfg = ctx->extra_cfg; struct av1_extracfg extra_cfg = ctx->extra_cfg;
...@@ -1546,6 +1572,9 @@ static aom_codec_ctrl_fn_map_t encoder_ctrl_maps[] = { ...@@ -1546,6 +1572,9 @@ static aom_codec_ctrl_fn_map_t encoder_ctrl_maps[] = {
{ AV1E_SET_ENABLE_QM, ctrl_set_enable_qm }, { AV1E_SET_ENABLE_QM, ctrl_set_enable_qm },
{ AV1E_SET_QM_MIN, ctrl_set_qm_min }, { AV1E_SET_QM_MIN, ctrl_set_qm_min },
{ AV1E_SET_QM_MAX, ctrl_set_qm_max }, { AV1E_SET_QM_MAX, ctrl_set_qm_max },
#endif
#if CONFIG_DIST_8X8
{ AV1E_SET_ENABLE_DIST_8X8, ctrl_set_enable_dist_8x8 },
#endif #endif
{ AV1E_SET_NUM_TG, ctrl_set_num_tg }, { AV1E_SET_NUM_TG, ctrl_set_num_tg },
{ AV1E_SET_MTU, ctrl_set_mtu }, { AV1E_SET_MTU, ctrl_set_mtu },
......
...@@ -206,6 +206,9 @@ typedef struct AV1EncoderConfig { ...@@ -206,6 +206,9 @@ typedef struct AV1EncoderConfig {
int using_qm; int using_qm;
int qm_minlevel; int qm_minlevel;
int qm_maxlevel; int qm_maxlevel;
#endif
#if CONFIG_DIST_8X8
int using_dist_8x8;
#endif #endif
unsigned int num_tile_groups; unsigned int num_tile_groups;
unsigned int mtu; unsigned int mtu;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment