History

Merge "Refactor the SSIM based rdmult update function"

Sai Deng committed 7 years ago

Commit dff4d372 parents 2a26032 e779b2f1 file · +9 −19Browse files

Unified · Split

vp9/encoder/vp9_encodeframe.c+9−19
@@ -257,8 +257,8 @@ static INLINE void set_mode_info_offsets(VP9_COMMON *const cm, · 256 unmodified lines
257257 x->mbmi_ext = x->mbmi_ext_base + (mi_row * cm->mi_cols + mi_col);
258258 }
259259
260−static double get_ssim_rdmult_scaling_factor(VP9_COMP *const cpi, int mi_row,
261− int mi_col) {
260+static void set_ssim_rdmult(VP9_COMP *const cpi, int mi_row, int mi_col,
261+ int *rdmult) {
262262 const VP9_COMMON *const cm = &cpi->common;
263263
264264 // 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, · 5 unmodified lines
270270 const int index = row * num_cols + col;
271271
272272 assert(cpi->oxcf.tuning == VP8_TUNE_SSIM);
273+ *rdmult =
274+ (int)((double)(*rdmult) * cpi->mi_ssim_rdmult_scaling_factors[index]);
275+ *rdmult = VPXMAX(*rdmult, 1);
273276 vpx_clear_system_state();
274− return cpi->mi_ssim_rdmult_scaling_factors[index];
275277 }
276278
277279 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, · 32 unmodified lines
310312 x->rddiv = cpi->rd.RDDIV;
311313 x->rdmult = cpi->rd.RDMULT;
312314 if (oxcf->tuning == VP8_TUNE_SSIM) {
313− const double ssim_factor =
314− get_ssim_rdmult_scaling_factor(cpi, mi_row, mi_col);
315− x->rdmult = (int)(ssim_factor * x->rdmult);
316− vpx_clear_system_state();
315+ set_ssim_rdmult(cpi, mi_row, mi_col, &x->rdmult);
317316 }
318317
319318 // 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, · 1642 unmodified lines
19621961 }
19631962
19641963 if (oxcf->tuning == VP8_TUNE_SSIM) {
1965− const double ssim_factor =
1966− get_ssim_rdmult_scaling_factor(cpi, mi_row, mi_col);
1967− x->rdmult = (int)(ssim_factor * x->rdmult);
1968− vpx_clear_system_state();
1964+ set_ssim_rdmult(cpi, mi_row, mi_col, &x->rdmult);
19691965 }
19701966 }
19711967
@@ -2208,10 +2204,7 @@ static void encode_b(VP9_COMP *cpi, const TileInfo *const tile, ThreadData *td, · 236 unmodified lines
22082204 const VP9EncoderConfig *const oxcf = &cpi->oxcf;
22092205 x->rdmult = x->cb_rdmult;
22102206 if (oxcf->tuning == VP8_TUNE_SSIM) {
2211− const double ssim_factor =
2212− get_ssim_rdmult_scaling_factor(cpi, mi_row, mi_col);
2213− x->rdmult = (int)(ssim_factor * x->rdmult);
2214− vpx_clear_system_state();
2207+ set_ssim_rdmult(cpi, mi_row, mi_col, &x->rdmult);
22152208 }
22162209 }
22172210
@@ -3824,10 +3817,7 @@ static void rd_pick_partition(VP9_COMP *cpi, ThreadData *td, · 1606 unmodified lines
38243817
38253818 int partition_mul = x->cb_rdmult;
38263819 if (oxcf->tuning == VP8_TUNE_SSIM) {
3827− const double ssim_factor =
3828− get_ssim_rdmult_scaling_factor(cpi, mi_row, mi_col);
3829− partition_mul = (int)(ssim_factor * partition_mul);
3830− vpx_clear_system_state();
3820+ set_ssim_rdmult(cpi, mi_row, mi_col, &partition_mul);
38313821 }
38323822
38333823 (void)*tp_orig;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t