Skip to content

Commit

Permalink
Clybius: add --tune 3 (Subjective SSIM), and --sharpness
Browse files Browse the repository at this point in the history
  • Loading branch information
juliobbv authored and gianni-rosato committed Mar 13, 2024
1 parent a8d88f3 commit 2b33e4b
Show file tree
Hide file tree
Showing 22 changed files with 290 additions and 115 deletions.
4 changes: 2 additions & 2 deletions Source/API/EbDebugMacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ extern "C" {
#define NO_ENCDEC 0 // bypass encDec to test cmpliance of MD. complained achieved when skip_flag is OFF. Port sample code from VCI-SW_AV1_Candidate1 branch
#define DEBUG_TPL 0 // Prints to debug TPL
#define DETAILED_FRAME_OUTPUT 0 // Prints detailed frame output from the library for debugging
#define TUNE_CHROMA_SSIM 0 // Allows for Chroma and SSIM BDR-based Tuning
#define TUNE_CQP_CHROMA_SSIM 0 // Tune CQP qp scaling towards improved chroma and SSIM BDR
#define TUNE_CHROMA_SSIM 1 // Allows for Chroma and SSIM BDR-based Tuning
#define TUNE_CQP_CHROMA_SSIM 1 // Tune CQP qp scaling towards improved chroma and SSIM BDR

#define MIN_PIC_PARALLELIZATION 0 // Use the minimum amount of picture parallelization
#define SRM_REPORT 0 // Report SRM status
Expand Down
13 changes: 7 additions & 6 deletions Source/API/EbSvtAv1Enc.h
Original file line number Diff line number Diff line change
Expand Up @@ -960,12 +960,13 @@ typedef struct EbSvtAv1EncConfiguration {
*/
uint8_t new_variance_octile;

/* New parameters can go in under this line. Also deduct the size of the parameter */
/* from the padding array */

/*Add 128 Byte Padding to Struct to avoid changing the size of the public configuration struct*/
uint8_t padding[128];

/* @brief Affects loopfilter deblock sharpness and rate distortion
*
* Min value is -7.
* Max is 7.
* Default is 0 (off).
*/
int8_t sharpness;
} EbSvtAv1EncConfiguration;

/**
Expand Down
14 changes: 12 additions & 2 deletions Source/App/EncApp/EbAppConfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@
#define VARIANCE_BOOST_STRENGTH_TOKEN "--variance-boost-strength"
#define NEW_VARIANCE_OCTILE_TOKEN "--new-variance-octile"

#define SHARPNESS_TOKEN "--sharpness"

static EbErrorType validate_error(EbErrorType err, const char *token, const char *value) {
switch (err) {
case EB_ErrorNone: return EB_ErrorNone;
Expand Down Expand Up @@ -1045,9 +1047,9 @@ ConfigEntry config_entry_specific[] = {
// --- end: ALTREF_FILTERING_SUPPORT
{SINGLE_INPUT,
TUNE_TOKEN,
"Specifies whether to use PSNR or VQ as the tuning metric [0 = VQ, 1 = PSNR, 2 = SSIM], "
"Specifies whether to use PSNR, VQ, or SSIM as the tuning metric [0 = VQ, 1 = PSNR, 2 = SSIM, 3 = Subjective SSIM], "
"default is 1 "
"[0-2]",
"[0-3]",
set_cfg_generic_token},
// MD Parameters
{SINGLE_INPUT,
Expand Down Expand Up @@ -1187,6 +1189,11 @@ ConfigEntry config_entry_variance_boost[] = {
NEW_VARIANCE_OCTILE_TOKEN,
"Octile for new 8x8 variance algorithm. Set to 0 to use 64x64 variance algorithm, default is 6 [0-8]",
set_cfg_generic_token},
// Sharpness
{SINGLE_INPUT,
SHARPNESS_TOKEN,
"Affects loopfilter deblock sharpness and rate distortion, default is 0 [+-7]",
set_cfg_generic_token},
// Termination
{SINGLE_INPUT, NULL, NULL, NULL}};

Expand Down Expand Up @@ -1368,6 +1375,9 @@ ConfigEntry config_entry[] = {
{SINGLE_INPUT, VARIANCE_BOOST_STRENGTH_TOKEN, "VarianceBoostStrength", set_cfg_generic_token},
{SINGLE_INPUT, NEW_VARIANCE_OCTILE_TOKEN, "NewVarianceOctile", set_cfg_generic_token},

// Sharpness
{SINGLE_INPUT, SHARPNESS_TOKEN, "Sharpness", set_cfg_generic_token},

// Termination
{SINGLE_INPUT, NULL, NULL, NULL}};

Expand Down
2 changes: 1 addition & 1 deletion Source/Lib/Encoder/Codec/EbCodingLoop.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ static void av1_encode_loop(PictureControlSet *pcs, EncDecContext *ed_ctx, Super
md_ctx->blk_org_y = ed_ctx->blk_org_y;
//Get the new lambda for current block
svt_aom_set_tuned_blk_lambda(md_ctx, pcs);
} else if (pcs->ppcs->scs->static_config.tune == 2) {
} else if (pcs->ppcs->scs->static_config.tune == 2 || pcs->ppcs->scs->static_config.tune == 3) {
md_ctx->blk_geom = ed_ctx->blk_geom;
md_ctx->blk_org_x = ed_ctx->blk_org_x;
md_ctx->blk_org_y = ed_ctx->blk_org_y;
Expand Down
2 changes: 1 addition & 1 deletion Source/Lib/Encoder/Codec/EbDeblockingFilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@ EbErrorType svt_av1_pick_filter_level(EbPictureBufferDesc *srcBuffer, // source
FrameHeader *frm_hdr = &pcs->ppcs->frm_hdr;
(void)srcBuffer;
struct LoopFilter *const lf = &frm_hdr->loop_filter_params;
lf->sharpness_level = 0;
lf->sharpness_level = pcs->scs->static_config.sharpness > 0 ? pcs->scs->static_config.sharpness : 0;

if (method == LPF_PICK_MINIMAL_LPF)
lf->filter_level[0] = lf->filter_level[1] = 0;
Expand Down
7 changes: 4 additions & 3 deletions Source/Lib/Encoder/Codec/EbFullLoop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,7 @@ static void svt_av1_optimize_b(ModeDecisionContext *ctx, int16_t txb_skip_contex
const TranLow *coeff_ptr, const MacroblockPlane *p, TranLow *qcoeff_ptr,
TranLow *dqcoeff_ptr, uint16_t *eob, const QuantParam *qparam, TxSize tx_size,
TxType tx_type, Bool is_inter, uint8_t use_sharpness, uint8_t delta_q_present,
uint8_t picture_qp, uint32_t lambda, int plane)
uint8_t picture_qp, uint32_t lambda, int plane, PictureControlSet *pcs)

{
int sharpness = 0; // No Sharpness
Expand Down Expand Up @@ -1166,7 +1166,7 @@ static void svt_av1_optimize_b(ModeDecisionContext *ctx, int16_t txb_skip_contex
return;
}
int rweight = 100;
const int rshift = 2;
const int rshift = (pcs->scs->static_config.sharpness > 0 ? pcs->scs->static_config.sharpness : 0) + 2;
if (use_sharpness && delta_q_present && plane == 0) {
int diff = ctx->sb_ptr->qindex - quantizer_to_qindex[picture_qp];
if (diff < 0) {
Expand Down Expand Up @@ -1675,7 +1675,8 @@ uint8_t svt_aom_quantize_inv_quantize(PictureControlSet *pcs, ModeDecisionContex
pcs->ppcs->frm_hdr.delta_q_params.delta_q_present,
pcs->picture_qp,
lambda,
(component_type == COMPONENT_LUMA) ? 0 : 1);
(component_type == COMPONENT_LUMA) ? 0 : 1,
pcs);
}

if (!ctx->rate_est_ctrls.update_skip_ctx_dc_sign_ctx)
Expand Down
6 changes: 3 additions & 3 deletions Source/Lib/Encoder/Codec/EbInitialRateControlProcess.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ EbErrorType svt_aom_initial_rate_control_context_ctor(EbThreadContext *thread_ct
}

void svt_av1_build_quantizer(EbBitDepth bit_depth, int32_t y_dc_delta_q, int32_t u_dc_delta_q, int32_t u_ac_delta_q,
int32_t v_dc_delta_q, int32_t v_ac_delta_q, Quants *const quants, Dequants *const deq);
int32_t v_dc_delta_q, int32_t v_ac_delta_q, Quants *const quants, Dequants *const deq, PictureParentControlSet *pcs);

#if LAD_MG_PRINT

Expand Down Expand Up @@ -776,12 +776,12 @@ void *svt_aom_initial_rate_control_kernel(void *input_ptr) {
if (pcs->picture_number == 0) {
Quants *const quants_8bit = &scs->enc_ctx->quants_8bit;
Dequants *const deq_8bit = &scs->enc_ctx->deq_8bit;
svt_av1_build_quantizer(EB_EIGHT_BIT, 0, 0, 0, 0, 0, quants_8bit, deq_8bit);
svt_av1_build_quantizer(EB_EIGHT_BIT, 0, 0, 0, 0, 0, quants_8bit, deq_8bit, pcs);

if (scs->static_config.encoder_bit_depth == EB_TEN_BIT) {
Quants *const quants_bd = &scs->enc_ctx->quants_bd;
Dequants *const deq_bd = &scs->enc_ctx->deq_bd;
svt_av1_build_quantizer(EB_TEN_BIT, 0, 0, 0, 0, 0, quants_bd, deq_bd);
svt_av1_build_quantizer(EB_TEN_BIT, 0, 0, 0, 0, 0, quants_bd, deq_bd, pcs);
}
}
// Set the one pass VBR parameters based on the look ahead data
Expand Down
25 changes: 16 additions & 9 deletions Source/Lib/Encoder/Codec/EbModeDecision.c
Original file line number Diff line number Diff line change
Expand Up @@ -4963,6 +4963,11 @@ uint32_t svt_aom_product_full_mode_decision(
cost = (cost * uni_psy_bias[pcs->picture_qp]) / 100;
}

if (scs->static_config.tune == 3 &&
is_inter_singleref_mode(buffer_ptr_array[cand_index]->cand->pred_mode)) {
cost = (cost * bi_psy_bias[pcs->picture_qp]) / 100;
}

if (cost < lowest_cost) {
lowest_cost_index = cand_index;
lowest_cost = cost;
Expand Down Expand Up @@ -5234,12 +5239,13 @@ void aom_av1_set_ssim_rdmult(struct ModeDecisionContext *ctx, PictureControlSet
}
geom_mean_of_scale = exp(geom_mean_of_scale / num_of_mi);

const bool is_tune_3 = pcs->ppcs->scs->static_config.tune == 3;
if (!pcs->ppcs->blk_lambda_tuning) {
ctx->full_lambda_md[EB_8_BIT_MD] = (uint32_t)((double)ctx->ed_ctx->pic_full_lambda[EB_8_BIT_MD] * geom_mean_of_scale + 0.5);
ctx->full_lambda_md[EB_10_BIT_MD] = (uint32_t)((double)ctx->ed_ctx->pic_full_lambda[EB_10_BIT_MD] * geom_mean_of_scale + 0.5);
ctx->full_lambda_md[EB_8_BIT_MD] = (uint32_t)((double)ctx->ed_ctx->pic_full_lambda[EB_8_BIT_MD] * pow(geom_mean_of_scale, geom_mean_of_scale <= 1.0 ? (is_tune_3 ? 1.5 : 1.0) : (is_tune_3 ? 0.5 : 1.0)) + 0.5);
ctx->full_lambda_md[EB_10_BIT_MD] = (uint32_t)((double)ctx->ed_ctx->pic_full_lambda[EB_10_BIT_MD] * pow(geom_mean_of_scale, geom_mean_of_scale <= 1.0 ? (is_tune_3 ? 1.5 : 1.0) : (is_tune_3 ? 0.5 : 1.0)) + 0.5);

ctx->fast_lambda_md[EB_8_BIT_MD] = (uint32_t)((double)ctx->ed_ctx->pic_fast_lambda[EB_8_BIT_MD] * geom_mean_of_scale + 0.5);
ctx->fast_lambda_md[EB_10_BIT_MD] = (uint32_t)((double)ctx->ed_ctx->pic_fast_lambda[EB_10_BIT_MD] * geom_mean_of_scale + 0.5);
ctx->fast_lambda_md[EB_8_BIT_MD] = (uint32_t)((double)ctx->ed_ctx->pic_fast_lambda[EB_8_BIT_MD] * pow(geom_mean_of_scale, geom_mean_of_scale <= 1.0 ? (is_tune_3 ? 1.5 : 1.0) : (is_tune_3 ? 0.5 : 1.0)) + 0.5);
ctx->fast_lambda_md[EB_10_BIT_MD] = (uint32_t)((double)ctx->ed_ctx->pic_fast_lambda[EB_10_BIT_MD] * pow(geom_mean_of_scale, geom_mean_of_scale <= 1.0 ? (is_tune_3 ? 1.5 : 1.0) : (is_tune_3 ? 0.5 : 1.0)) + 0.5);
}else {
ctx->full_lambda_md[EB_8_BIT_MD] = (uint32_t)((double)ctx->full_lambda_md[EB_8_BIT_MD] * geom_mean_of_scale + 0.5);
ctx->full_lambda_md[EB_10_BIT_MD] = (uint32_t)((double)ctx->full_lambda_md[EB_10_BIT_MD] * geom_mean_of_scale + 0.5);
Expand Down Expand Up @@ -5301,13 +5307,14 @@ void svt_aom_set_tuned_blk_lambda(struct ModeDecisionContext *ctx, PictureContr

geom_mean_of_scale = exp(geom_mean_of_scale / base_block_count);

ctx->full_lambda_md[EB_8_BIT_MD] = (uint32_t)((double)ctx->ed_ctx->pic_full_lambda[EB_8_BIT_MD] * geom_mean_of_scale + 0.5);
ctx->full_lambda_md[EB_10_BIT_MD] = (uint32_t)((double)ctx->ed_ctx->pic_full_lambda[EB_10_BIT_MD] * geom_mean_of_scale + 0.5);
const bool is_tune_3 = ppcs->scs->static_config.tune == 3;
ctx->full_lambda_md[EB_8_BIT_MD] = (uint32_t)((double)ctx->ed_ctx->pic_full_lambda[EB_8_BIT_MD] * pow(geom_mean_of_scale, geom_mean_of_scale <= 1.0 ? (is_tune_3 ? 0.5 : 1.0) : (is_tune_3 ? 0.25 : 1.0)) + 0.5);
ctx->full_lambda_md[EB_10_BIT_MD] = (uint32_t)((double)ctx->ed_ctx->pic_full_lambda[EB_10_BIT_MD] * pow(geom_mean_of_scale, geom_mean_of_scale <= 1.0 ? (is_tune_3 ? 0.5 : 1.0) : (is_tune_3 ? 0.25 : 1.0)) + 0.5);

ctx->fast_lambda_md[EB_8_BIT_MD] = (uint32_t)((double)ctx->ed_ctx->pic_fast_lambda[EB_8_BIT_MD] * geom_mean_of_scale + 0.5);
ctx->fast_lambda_md[EB_10_BIT_MD] = (uint32_t)((double)ctx->ed_ctx->pic_fast_lambda[EB_10_BIT_MD] * geom_mean_of_scale + 0.5);
ctx->fast_lambda_md[EB_8_BIT_MD] = (uint32_t)((double)ctx->ed_ctx->pic_fast_lambda[EB_8_BIT_MD] * pow(geom_mean_of_scale, geom_mean_of_scale <= 1.0 ? (is_tune_3 ? 0.5 : 1.0) : (is_tune_3 ? 0.25 : 1.0)) + 0.5);
ctx->fast_lambda_md[EB_10_BIT_MD] = (uint32_t)((double)ctx->ed_ctx->pic_fast_lambda[EB_10_BIT_MD] * pow(geom_mean_of_scale, geom_mean_of_scale <= 1.0 ? (is_tune_3 ? 0.5 : 1.0) : (is_tune_3 ? 0.25 : 1.0)) + 0.5);

if (ppcs->scs->static_config.tune == 2) {
if (ppcs->scs->static_config.tune == 2 || is_tune_3) {
aom_av1_set_ssim_rdmult(ctx, pcs, mi_row, mi_col);
}
}
Expand Down
35 changes: 31 additions & 4 deletions Source/Lib/Encoder/Codec/EbModeDecisionConfigurationProcess.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,44 @@ void set_global_motion_field(PictureControlSet *pcs) {
}

void svt_av1_build_quantizer(EbBitDepth bit_depth, int32_t y_dc_delta_q, int32_t u_dc_delta_q, int32_t u_ac_delta_q,
int32_t v_dc_delta_q, int32_t v_ac_delta_q, Quants *const quants, Dequants *const deq) {
int32_t v_dc_delta_q, int32_t v_ac_delta_q, Quants *const quants, Dequants *const deq, PictureParentControlSet *pcs) {
int32_t i, q, quant_qtx;

for (q = 0; q < QINDEX_RANGE; q++) {
const int32_t qzbin_factor = svt_aom_get_qzbin_factor(q, bit_depth);
const int32_t qrounding_factor = q == 0 ? 64 : 48;
int32_t qzbin_factor = svt_aom_get_qzbin_factor(q, bit_depth);
int32_t qrounding_factor = q == 0 ? 64 : 48;
int32_t qrounding_factor_fp = pcs->scs->static_config.tune != 3 ? 64 : 48;
int diff = q - pcs->frm_hdr.quantization_params.base_q_idx; // q-range diff based on current quantizer

for (i = 0; i < 2; ++i) {
int32_t qrounding_factor_fp = 64;
quant_qtx = i == 0 ? svt_aom_dc_quant_qtx(q, y_dc_delta_q, bit_depth)
: svt_aom_ac_quant_qtx(q, 0, bit_depth);
if (pcs->scs->static_config.sharpness != 0) {
if (pcs->scs->static_config.sharpness > 0) { // If sharpness is positive
if (diff < 0) { // If we're going to lower quant, decrease zbin factor and increase rounding
qzbin_factor -= MAX(pcs->scs->static_config.sharpness << 1, abs(diff)); // Example range with --sharpness 4: Subtract qzbin_factor by diff, or by (4 << 1), preferring which is closer to 0
qrounding_factor += MAX(pcs->scs->static_config.sharpness << 1, abs(diff));
qrounding_factor_fp += MAX(pcs->scs->static_config.sharpness << 1, abs(diff));
} else if (diff > 0) { // If we're going higher quant, reset both zbin and rounding factor
qzbin_factor = svt_aom_get_qzbin_factor(q, bit_depth);
qrounding_factor = q == 0 ? 64 : 48;
qrounding_factor_fp = pcs->scs->static_config.tune != 3 ? 64 : 48;
}
} else if (pcs->scs->static_config.sharpness < 0) { // If sharpness is negative
if (diff < 0) { // If we're going to lower quant, reset both zbin and rounding factor
qzbin_factor = svt_aom_get_qzbin_factor(q, bit_depth);
qrounding_factor = q == 0 ? 64 : 48;
qrounding_factor_fp = pcs->scs->static_config.tune != 3 ? 64 : 48;
} else if (diff > 0) { // If we're going higher quant, increase zbin and decrease rounding factors
qzbin_factor += MIN(abs(pcs->scs->static_config.sharpness) << 1, diff); // Choose minimum here since diff > 0
qrounding_factor -= MIN(abs(pcs->scs->static_config.sharpness) << 1, diff);
qrounding_factor_fp -= MIN(abs(pcs->scs->static_config.sharpness) << 1, diff);
}
}
qzbin_factor = MIN(MAX(qzbin_factor, 1), 256); // Ensure we don't go too low or high
qrounding_factor = MIN(MAX(qrounding_factor, 1), 256);
qrounding_factor_fp = MIN(MAX(qrounding_factor_fp, 1), 256);
}
svt_aom_invert_quant(&quants->y_quant[q][i], &quants->y_quant_shift[q][i], quant_qtx);
quants->y_quant_fp[q][i] = (int16_t)((1 << 16) / quant_qtx);
quants->y_round_fp[q][i] = (int16_t)((qrounding_factor_fp * quant_qtx) >> 7);
Expand Down
5 changes: 5 additions & 0 deletions Source/Lib/Encoder/Codec/EbModeDecisionProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -1282,6 +1282,11 @@ static const uint8_t uni_psy_bias[] = {
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
95, 95, 95, 95, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
};
static const uint8_t bi_psy_bias[] = {
115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 105, 105, 105, 105, 105, 105,
105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
105, 105, 105, 105, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
};
extern void svt_aom_reset_mode_decision(SequenceControlSet *scs, ModeDecisionContext *ctx, PictureControlSet *pcs,
uint16_t tile_row_idx, uint32_t segment_index);

Expand Down
2 changes: 1 addition & 1 deletion Source/Lib/Encoder/Codec/EbPictureControlSet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1507,7 +1507,7 @@ static EbErrorType me_ctor(MotionEstimationData *object_ptr, EbPtr object_init_d
const uint16_t picture_height_in_mb = (uint16_t)((init_data_ptr->picture_height + 15) / 16);
uint16_t adaptive_picture_width_in_mb = (uint16_t)((init_data_ptr->picture_width + 15) / 16);
uint16_t adaptive_picture_height_in_mb = (uint16_t)((init_data_ptr->picture_height + 15) / 16);
if (init_data_ptr->static_config.tune == 2) {
if (init_data_ptr->static_config.tune == 2 || init_data_ptr->static_config.tune == 3) {
EB_MALLOC_ARRAY(object_ptr->ssim_rdmult_scaling_factors,
adaptive_picture_width_in_mb * adaptive_picture_height_in_mb);
} else {
Expand Down
1 change: 1 addition & 0 deletions Source/Lib/Encoder/Codec/EbPictureControlSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,7 @@ typedef struct PictureControlSetInitData {
bool rtc_tune;
uint8_t variance_boost_strength;
uint8_t new_variance_octile;
int8_t sharpness;
} PictureControlSetInitData;

typedef struct Av1Comp {
Expand Down
9 changes: 6 additions & 3 deletions Source/Lib/Encoder/Codec/EbProductCodingLoop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1749,6 +1749,9 @@ static void md_stage_0(PictureControlSet *pcs, ModeDecisionContext *ctx,
if (apply_unipred_bias && is_inter_singleref_mode(cand_bf->cand->pred_mode)) {
*cand_bf->fast_cost = (*cand_bf->fast_cost * uni_psy_bias[pcs->picture_qp]) / 100;
}
if (pcs->scs->static_config.tune == 3 && is_inter_singleref_mode(cand_bf->cand->pred_mode)) {
*cand_bf->fast_cost = (*cand_bf->fast_cost * bi_psy_bias[pcs->picture_qp]) / 100;
}
if (*cand_bf->fast_cost < ctx->mds0_best_cost) {
ctx->mds0_best_cost = *cand_bf->fast_cost;
ctx->mds0_best_class = cand->cand_class;
Expand Down Expand Up @@ -8627,7 +8630,7 @@ static void md_encode_block_light_pd1(PictureControlSet *pcs, ModeDecisionContex
//Get the new lambda for current block
if (pcs->ppcs->blk_lambda_tuning) {
svt_aom_set_tuned_blk_lambda(ctx, pcs);
} else if (pcs->ppcs->scs->static_config.tune == 2) {
} else if (pcs->ppcs->scs->static_config.tune == 2 || pcs->ppcs->scs->static_config.tune == 3) {
int mi_row = ctx->blk_org_y / 4;
int mi_col = ctx->blk_org_x / 4;
aom_av1_set_ssim_rdmult(ctx, pcs, mi_row, mi_col);
Expand Down Expand Up @@ -8986,7 +8989,7 @@ static void md_encode_block(PictureControlSet *pcs, ModeDecisionContext *ctx, ui
//Get the new lambda for current block
if (pcs->ppcs->blk_lambda_tuning) {
svt_aom_set_tuned_blk_lambda(ctx, pcs);
} else if (pcs->ppcs->scs->static_config.tune == 2) {
} else if (pcs->ppcs->scs->static_config.tune == 2 || pcs->ppcs->scs->static_config.tune == 3) {
int mi_row = ctx->blk_org_y / 4;
int mi_col = ctx->blk_org_x / 4;
aom_av1_set_ssim_rdmult(ctx, pcs, mi_row, mi_col);
Expand Down Expand Up @@ -9265,7 +9268,7 @@ static void md_encode_block(PictureControlSet *pcs, ModeDecisionContext *ctx, ui
}
// 3rd Full-Loop
ctx->md_stage = MD_STAGE_3;
ctx->tune_ssim_level = (pcs->scs->static_config.tune == 2) && (ctx->pd_pass == PD_PASS_1) ? SSIM_LVL_3 : SSIM_LVL_0;
ctx->tune_ssim_level = (pcs->scs->static_config.tune == 2 || pcs->ppcs->scs->static_config.tune == 3) && (ctx->pd_pass == PD_PASS_1) ? SSIM_LVL_3 : SSIM_LVL_0;
md_stage_3(pcs,
ctx,
input_pic,
Expand Down
Loading

0 comments on commit 2b33e4b

Please sign in to comment.