diff options
author | Sai Deng <sdeng@google.com> | 2019-04-29 18:35:59 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-04-29 18:35:59 +0000 |
commit | dff4d376eaff3460e930711807ce865ff76aff3a (patch) | |
tree | f143db59de5052226b21eeae595ab809fa418603 /vp9 | |
parent | 2a26032bd2250407dbdc6447a82a7c1ff964d84b (diff) | |
parent | e779b2f3812954516c780e0ce4f182d581ad6d92 (diff) | |
download | libvpx-dff4d376eaff3460e930711807ce865ff76aff3a.tar libvpx-dff4d376eaff3460e930711807ce865ff76aff3a.tar.gz libvpx-dff4d376eaff3460e930711807ce865ff76aff3a.tar.bz2 libvpx-dff4d376eaff3460e930711807ce865ff76aff3a.zip |
Merge "Refactor the SSIM based rdmult update function"
Diffstat (limited to 'vp9')
-rw-r--r-- | vp9/encoder/vp9_encodeframe.c | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index a5d59b69b..0e3737f37 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -257,8 +257,8 @@ static INLINE void set_mode_info_offsets(VP9_COMMON *const cm, x->mbmi_ext = x->mbmi_ext_base + (mi_row * cm->mi_cols + mi_col); } -static double get_ssim_rdmult_scaling_factor(VP9_COMP *const cpi, int mi_row, - int mi_col) { +static void set_ssim_rdmult(VP9_COMP *const cpi, int mi_row, int mi_col, + int *rdmult) { const VP9_COMMON *const cm = &cpi->common; // SSIM rdmult scaling factors are currently 64x64 based. @@ -270,8 +270,10 @@ static double get_ssim_rdmult_scaling_factor(VP9_COMP *const cpi, int mi_row, const int index = row * num_cols + col; assert(cpi->oxcf.tuning == VP8_TUNE_SSIM); + *rdmult = + (int)((double)(*rdmult) * cpi->mi_ssim_rdmult_scaling_factors[index]); + *rdmult = VPXMAX(*rdmult, 1); vpx_clear_system_state(); - return cpi->mi_ssim_rdmult_scaling_factors[index]; } static void set_offsets(VP9_COMP *cpi, const TileInfo *const tile, @@ -310,10 +312,7 @@ static void set_offsets(VP9_COMP *cpi, const TileInfo *const tile, x->rddiv = cpi->rd.RDDIV; x->rdmult = cpi->rd.RDMULT; if (oxcf->tuning == VP8_TUNE_SSIM) { - const double ssim_factor = - get_ssim_rdmult_scaling_factor(cpi, mi_row, mi_col); - x->rdmult = (int)(ssim_factor * x->rdmult); - vpx_clear_system_state(); + set_ssim_rdmult(cpi, mi_row, mi_col, &x->rdmult); } // required by vp9_append_sub8x8_mvs_for_idx() and vp9_find_best_ref_mvs() @@ -1962,10 +1961,7 @@ static void set_segment_rdmult(VP9_COMP *const cpi, MACROBLOCK *const x, } if (oxcf->tuning == VP8_TUNE_SSIM) { - const double ssim_factor = - get_ssim_rdmult_scaling_factor(cpi, mi_row, mi_col); - x->rdmult = (int)(ssim_factor * x->rdmult); - vpx_clear_system_state(); + set_ssim_rdmult(cpi, mi_row, mi_col, &x->rdmult); } } @@ -2208,10 +2204,7 @@ static void encode_b(VP9_COMP *cpi, const TileInfo *const tile, ThreadData *td, const VP9EncoderConfig *const oxcf = &cpi->oxcf; x->rdmult = x->cb_rdmult; if (oxcf->tuning == VP8_TUNE_SSIM) { - const double ssim_factor = - get_ssim_rdmult_scaling_factor(cpi, mi_row, mi_col); - x->rdmult = (int)(ssim_factor * x->rdmult); - vpx_clear_system_state(); + set_ssim_rdmult(cpi, mi_row, mi_col, &x->rdmult); } } @@ -3824,10 +3817,7 @@ static void rd_pick_partition(VP9_COMP *cpi, ThreadData *td, int partition_mul = x->cb_rdmult; if (oxcf->tuning == VP8_TUNE_SSIM) { - const double ssim_factor = - get_ssim_rdmult_scaling_factor(cpi, mi_row, mi_col); - partition_mul = (int)(ssim_factor * partition_mul); - vpx_clear_system_state(); + set_ssim_rdmult(cpi, mi_row, mi_col, &partition_mul); } (void)*tp_orig; |