Fix command line option to disable tpl model Change-Id: I8ca358ca44bfc2b9f5d2bec2cfd26daceb879916
diff --git a/apps/aomenc.c b/apps/aomenc.c index 9c487c2..a2baf9ce 100644 --- a/apps/aomenc.c +++ b/apps/aomenc.c
@@ -416,7 +416,8 @@ static const arg_def_t enable_tpl_model = ARG_DEF(NULL, "enable-tpl-model", 1, "RDO based on frame temporal dependency " - "(0: off, 1: backward source based, 2: forward 2-pass"); + "(0: off, 1: backward source based, 2: forward 2-pass). " + "This is required for deltaq mode."); static const arg_def_t enable_keyframe_filtering = ARG_DEF(NULL, "enable-keyframe-filtering", 1, "Apply temporal filtering on key frame " @@ -449,7 +450,7 @@ static const arg_def_t min_partition_size = ARG_DEF(NULL, "min-partition-size", 4, "Set min partition size " - "(4:4x4, 8:8x8, 16:16x16, 32:32x32, 64:64x64, 128:128x128)." + "(4:4x4, 8:8x8, 16:16x16, 32:32x32, 64:64x64, 128:128x128). " "On frame with 4k+ resolutions or higher speed settings, the min " "partition size will have a minimum of 8."); static const arg_def_t max_partition_size = @@ -646,8 +647,9 @@ "3: cyclic refresh)"); static const arg_def_t deltaq_mode = ARG_DEF(NULL, "deltaq-mode", 1, - "Delta qindex mode (0: off, 1: deltaq pred efficiency (default), " - "2: deltaq perceptual)"); + "Delta qindex mode (0: off, 1: deltaq objective (default), " + "2: deltaq perceptual). " + "Currently this requires enable-tpl-model as a prerequisite."); static const arg_def_t deltalf_mode = ARG_DEF( NULL, "delta-lf-mode", 1, "Enable delta-lf-mode (0: off (default), 1: on)"); static const arg_def_t frame_periodic_boost =
diff --git a/av1/av1_cx_iface.c b/av1/av1_cx_iface.c index 427e017..ed85cf5 100644 --- a/av1/av1_cx_iface.c +++ b/av1/av1_cx_iface.c
@@ -937,12 +937,6 @@ oxcf->enable_chroma_deltaq = extra_cfg->enable_chroma_deltaq; oxcf->aq_mode = extra_cfg->aq_mode; oxcf->deltaq_mode = extra_cfg->deltaq_mode; - // Turn on tpl model for deltaq_mode == DELTA_Q_OBJECTIVE and no - // superres. If superres is being used on the other hand, turn - // delta_q off. - if (oxcf->deltaq_mode == DELTA_Q_OBJECTIVE && !oxcf->enable_tpl_model) { - oxcf->enable_tpl_model = 1; - } oxcf->deltalf_mode = (oxcf->deltaq_mode != NO_DELTA_Q) && extra_cfg->deltalf_mode;
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c index 2974a7e..dad696d 100644 --- a/av1/encoder/encodeframe.c +++ b/av1/encoder/encodeframe.c
@@ -3898,15 +3898,21 @@ current_qindex = av1_compute_q_from_energy_level_deltaq_mode(cpi, block_var_level); } - } else if (cpi->oxcf.deltaq_mode == DELTA_Q_OBJECTIVE) { - assert(cpi->oxcf.enable_tpl_model); + } else if (cpi->oxcf.deltaq_mode == DELTA_Q_OBJECTIVE && + cpi->oxcf.enable_tpl_model) { // Setup deltaq based on tpl stats current_qindex = get_q_for_deltaq_objective(cpi, sb_size, mi_row, mi_col); } const int delta_q_res = delta_q_info->delta_q_res; - current_qindex = - clamp(current_qindex, delta_q_res, 256 - delta_q_info->delta_q_res); + // Right now aq only works with tpl model. So if tpl is disabled, we set the + // current_qindex to base_qindex. + if (cpi->oxcf.enable_tpl_model && cpi->oxcf.deltaq_mode != NO_DELTA_Q) { + current_qindex = + clamp(current_qindex, delta_q_res, 256 - delta_q_info->delta_q_res); + } else { + current_qindex = cm->base_qindex; + } MACROBLOCKD *const xd = &x->e_mbd; const int sign_deltaq_index =