Commit d808bfcf authored by Yushin Cho's avatar Yushin Cho

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 {
*/
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.
*
* This will set the maximum number of tile groups. This will be
......@@ -622,7 +637,14 @@ typedef enum {
* 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 */
/*!\brief Encoder control function parameter type
......@@ -693,6 +715,9 @@ AOM_CTRL_USE_TYPE(AV1E_SET_LOSSLESS, unsigned int)
AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_QM, unsigned int)
#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)
#define AOM_CTRL_AV1E_SET_QM_MIN
......
......@@ -377,10 +377,16 @@ static const arg_def_t arnr_maxframes =
static const arg_def_t arnr_strength =
ARG_DEF(NULL, "arnr-strength", 1, "AltRef filter strength (0..6)");
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 =
ARG_DEF_ENUM(NULL, "tune", 1, "Material to favor", tuning_enum);
static const arg_def_t tune_metric =
ARG_DEF_ENUM(NULL, "tune", 1, "Distortion metric tuned with", tuning_enum);
static const arg_def_t cq_level =
ARG_DEF(NULL, "cq-level", 1, "Constant/Constrained Quality level");
static const arg_def_t max_intra_rate_pct =
......@@ -418,6 +424,11 @@ static const arg_def_t qm_min = ARG_DEF(
static const arg_def_t qm_max = ARG_DEF(
NULL, "qm-max", 1, "Max quant matrix flatness (0..15), default is 16");
#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(
NULL, "num-tile-groups", 1, "Maximum number of tile groups, default is 1");
static const arg_def_t mtu_size =
......@@ -550,7 +561,7 @@ static const arg_def_t *av1_args[] = { &cpu_used_av1,
#endif // CONFIG_LOOPFILTERING_ACROSS_TILES
&arnr_maxframes,
&arnr_strength,
&tune_ssim,
&tune_metric,
&cq_level,
&max_intra_rate_pct,
&max_inter_rate_pct,
......@@ -560,6 +571,9 @@ static const arg_def_t *av1_args[] = { &cpu_used_av1,
&enable_qm,
&qm_min,
&qm_max,
#endif
#if CONFIG_DIST_8X8
&enable_dist_8x8,
#endif
&frame_parallel_decoding,
&aq_mode,
......@@ -616,6 +630,9 @@ static const int av1_arg_ctrl_map[] = { AOME_SET_CPUUSED,
AV1E_SET_ENABLE_QM,
AV1E_SET_QM_MIN,
AV1E_SET_QM_MAX,
#endif
#if CONFIG_DIST_8X8
AV1E_SET_ENABLE_DIST_8X8,
#endif
AV1E_SET_FRAME_PARALLEL_DECODING,
AV1E_SET_AQ_MODE,
......
......@@ -57,6 +57,9 @@ struct av1_extracfg {
unsigned int enable_qm;
unsigned int qm_min;
unsigned int qm_max;
#endif
#if CONFIG_DIST_8X8
unsigned int enable_dist_8x8;
#endif
unsigned int num_tg;
unsigned int mtu_size;
......@@ -121,6 +124,9 @@ static struct av1_extracfg default_extra_cfg = {
0, // enable_qm
DEFAULT_QM_FIRST, // qm_min
DEFAULT_QM_LAST, // qm_max
#endif
#if CONFIG_DIST_8X8
0,
#endif
1, // max number of tile groups
0, // mtu_size
......@@ -326,6 +332,14 @@ static aom_codec_err_t validate_config(aom_codec_alg_priv_t *ctx,
if (extra_cfg->tuning == AOM_TUNE_SSIM)
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 !CONFIG_XIPHRC
const size_t packet_sz = sizeof(FIRSTPASS_STATS);
......@@ -480,7 +494,12 @@ static aom_codec_err_t set_encoder_config(
oxcf->qm_minlevel = extra_cfg->qm_min;
oxcf->qm_maxlevel = extra_cfg->qm_max;
#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;
#if CONFIG_EXT_TILE
// 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,
return update_extra_cfg(ctx, &extra_cfg);
}
#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,
va_list args) {
struct av1_extracfg extra_cfg = ctx->extra_cfg;
......@@ -1546,6 +1572,9 @@ static aom_codec_ctrl_fn_map_t encoder_ctrl_maps[] = {
{ AV1E_SET_ENABLE_QM, ctrl_set_enable_qm },
{ AV1E_SET_QM_MIN, ctrl_set_qm_min },
{ AV1E_SET_QM_MAX, ctrl_set_qm_max },
#endif
#if CONFIG_DIST_8X8
{ AV1E_SET_ENABLE_DIST_8X8, ctrl_set_enable_dist_8x8 },
#endif
{ AV1E_SET_NUM_TG, ctrl_set_num_tg },
{ AV1E_SET_MTU, ctrl_set_mtu },
......
......@@ -206,6 +206,9 @@ typedef struct AV1EncoderConfig {
int using_qm;
int qm_minlevel;
int qm_maxlevel;
#endif
#if CONFIG_DIST_8X8
int using_dist_8x8;
#endif
unsigned int num_tile_groups;
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