Commit 1ed20248 authored by Sebastien Alaiwan's avatar Sebastien Alaiwan

aomenc: add an option to disable loop-restoration

This mirrors the behavior of the corresponding option for CDEF.

Change-Id: Ifbdacb1bedbde2fa740086593384567a2f44b342
parent cad5ebce
......@@ -532,6 +532,16 @@ enum aome_enc_control_id {
*/
AV1E_SET_ENABLE_CDEF,
/*!\brief Codec control function to encode with Loop Restoration Filter.
*
* 0 = do not apply Restoration Filter
* 1 = apply Restoration Filter
*
* By default, the encoder applies Restoration Filter.
*
*/
AV1E_SET_ENABLE_RESTORATION,
/*!\brief Codec control function to encode with quantisation matrices.
*
* AOM can operate with default quantisation matrices dependent on
......@@ -916,6 +926,9 @@ AOM_CTRL_USE_TYPE(AV1E_SET_LOSSLESS, unsigned int)
AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_CDEF, unsigned int)
#define AOM_CTRL_AV1E_SET_ENABLE_CDEF
AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_RESTORATION, unsigned int)
#define AOM_CTRL_AV1E_SET_ENABLE_RESTORATION
AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_QM, unsigned int)
#define AOM_CTRL_AV1E_SET_ENABLE_QM
......
......@@ -458,6 +458,10 @@ static const arg_def_t enable_cdef =
ARG_DEF(NULL, "enable-cdef", 1,
"Enable the constrained directional enhancement filter (0: false, "
"1: true (default))");
static const arg_def_t enable_restoration =
ARG_DEF(NULL, "enable-restoration", 1,
"Enable the loop restoration filter (0: false, "
"1: true (default))");
#if CONFIG_AOM_QM
static const arg_def_t enable_qm =
ARG_DEF(NULL, "enable-qm", 1,
......@@ -696,6 +700,7 @@ static const arg_def_t *av1_args[] = { &cpu_used_av1,
&gf_cbr_boost_pct,
&lossless,
&enable_cdef,
&enable_restoration,
#if CONFIG_AOM_QM
&enable_qm,
&qm_min,
......@@ -771,6 +776,7 @@ static const int av1_arg_ctrl_map[] = { AOME_SET_CPUUSED,
AV1E_SET_GF_CBR_BOOST_PCT,
AV1E_SET_LOSSLESS,
AV1E_SET_ENABLE_CDEF,
AV1E_SET_ENABLE_RESTORATION,
#if CONFIG_AOM_QM
AV1E_SET_ENABLE_QM,
AV1E_SET_QM_MIN,
......
......@@ -65,6 +65,7 @@ struct av1_extracfg {
unsigned int gf_cbr_boost_pct;
unsigned int lossless;
unsigned int enable_cdef;
unsigned int enable_restoration;
#if CONFIG_AOM_QM
unsigned int enable_qm;
#if CONFIG_AOM_QM_EXT
......@@ -150,6 +151,7 @@ static struct av1_extracfg default_extra_cfg = {
0, // gf_cbr_boost_pct
0, // lossless
1, // enable_cdef
1, // enable_restoration
#if CONFIG_AOM_QM
0, // enable_qm
#if CONFIG_AOM_QM_EXT
......@@ -581,6 +583,7 @@ static aom_codec_err_t set_encoder_config(
oxcf->fixed_q = -1;
oxcf->using_cdef = extra_cfg->enable_cdef;
oxcf->using_restoration = extra_cfg->enable_restoration;
#if CONFIG_AOM_QM
oxcf->using_qm = extra_cfg->enable_qm;
#if CONFIG_AOM_QM_EXT
......@@ -1007,6 +1010,13 @@ static aom_codec_err_t ctrl_set_enable_cdef(aom_codec_alg_priv_t *ctx,
return update_extra_cfg(ctx, &extra_cfg);
}
static aom_codec_err_t ctrl_set_enable_restoration(aom_codec_alg_priv_t *ctx,
va_list args) {
struct av1_extracfg extra_cfg = ctx->extra_cfg;
extra_cfg.enable_restoration = CAST(AV1E_SET_ENABLE_RESTORATION, args);
return update_extra_cfg(ctx, &extra_cfg);
}
#if CONFIG_AOM_QM
static aom_codec_err_t ctrl_set_enable_qm(aom_codec_alg_priv_t *ctx,
va_list args) {
......@@ -1826,6 +1836,7 @@ static aom_codec_ctrl_fn_map_t encoder_ctrl_maps[] = {
{ AV1E_SET_GF_CBR_BOOST_PCT, ctrl_set_rc_gf_cbr_boost_pct },
{ AV1E_SET_LOSSLESS, ctrl_set_lossless },
{ AV1E_SET_ENABLE_CDEF, ctrl_set_enable_cdef },
{ AV1E_SET_ENABLE_RESTORATION, ctrl_set_enable_restoration },
#if CONFIG_AOM_QM
{ AV1E_SET_ENABLE_QM, ctrl_set_enable_qm },
#if CONFIG_AOM_QM_EXT
......
......@@ -5163,7 +5163,7 @@ static void loopfilter_frame(AV1_COMP *cpi, AV1_COMMON *cm) {
struct loopfilter *lf = &cm->lf;
int no_loopfilter = 0;
#if CONFIG_LOOP_RESTORATION
int no_restoration = 0;
int no_restoration = !cpi->oxcf.using_restoration;
#endif // CONFIG_LOOP_RESTORATION
if (is_lossless_requested(&cpi->oxcf)
......
......@@ -191,6 +191,7 @@ typedef struct AV1EncoderConfig {
DELTAQ_MODE deltaq_mode;
#endif
int using_cdef;
int using_restoration;
#if CONFIG_AOM_QM
int using_qm;
#if CONFIG_AOM_QM_EXT
......
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