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
257 x->mbmi_ext = x->mbmi_ext_base + (mi_row * cm->mi_cols + mi_col);257 x->mbmi_ext = x->mbmi_ext_base + (mi_row * cm->mi_cols + mi_col);
258}258}
259 259
260static double get_ssim_rdmult_scaling_factor(VP9_COMP *const cpi, int mi_row,260static void set_ssim_rdmult(VP9_COMP *const cpi, int mi_row, int mi_col,
261 int mi_col) {261 int *rdmult) {
262 const VP9_COMMON *const cm = &cpi->common;262 const VP9_COMMON *const cm = &cpi->common;
263 263
264 // SSIM rdmult scaling factors are currently 64x64 based.264 // 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
270 const int index = row * num_cols + col;270 const int index = row * num_cols + col;
271 271
272 assert(cpi->oxcf.tuning == VP8_TUNE_SSIM);272 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);
273 vpx_clear_system_state();276 vpx_clear_system_state();
274 return cpi->mi_ssim_rdmult_scaling_factors[index];
275}277}
276 278
277static void set_offsets(VP9_COMP *cpi, const TileInfo *const tile,279static 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
310 x->rddiv = cpi->rd.RDDIV;312 x->rddiv = cpi->rd.RDDIV;
311 x->rdmult = cpi->rd.RDMULT;313 x->rdmult = cpi->rd.RDMULT;
312 if (oxcf->tuning == VP8_TUNE_SSIM) {314 if (oxcf->tuning == VP8_TUNE_SSIM) {
313 const double ssim_factor =315 set_ssim_rdmult(cpi, mi_row, mi_col, &x->rdmult);
314 get_ssim_rdmult_scaling_factor(cpi, mi_row, mi_col);
315 x->rdmult = (int)(ssim_factor * x->rdmult);
316 vpx_clear_system_state();
317 }316 }
318 317
319 // required by vp9_append_sub8x8_mvs_for_idx() and vp9_find_best_ref_mvs()318 // 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
1962 }1961 }
1963 1962
1964 if (oxcf->tuning == VP8_TUNE_SSIM) {1963 if (oxcf->tuning == VP8_TUNE_SSIM) {
1965 const double ssim_factor =1964 set_ssim_rdmult(cpi, mi_row, mi_col, &x->rdmult);
1966 get_ssim_rdmult_scaling_factor(cpi, mi_row, mi_col);
1967 x->rdmult = (int)(ssim_factor * x->rdmult);
1968 vpx_clear_system_state();
1969 }1965 }
1970}1966}
1971 1967
@@ -2208,10 +2204,7 @@ static void encode_b(VP9_COMP *cpi, const TileInfo *const tile, ThreadData *td, · 236 unmodified lines
2208 const VP9EncoderConfig *const oxcf = &cpi->oxcf;2204 const VP9EncoderConfig *const oxcf = &cpi->oxcf;
2209 x->rdmult = x->cb_rdmult;2205 x->rdmult = x->cb_rdmult;
2210 if (oxcf->tuning == VP8_TUNE_SSIM) {2206 if (oxcf->tuning == VP8_TUNE_SSIM) {
2211 const double ssim_factor =2207 set_ssim_rdmult(cpi, mi_row, mi_col, &x->rdmult);
2212 get_ssim_rdmult_scaling_factor(cpi, mi_row, mi_col);
2213 x->rdmult = (int)(ssim_factor * x->rdmult);
2214 vpx_clear_system_state();
2215 }2208 }
2216 }2209 }
2217 2210
@@ -3824,10 +3817,7 @@ static void rd_pick_partition(VP9_COMP *cpi, ThreadData *td, · 1606 unmodified lines
3824 3817
3825 int partition_mul = x->cb_rdmult;3818 int partition_mul = x->cb_rdmult;
3826 if (oxcf->tuning == VP8_TUNE_SSIM) {3819 if (oxcf->tuning == VP8_TUNE_SSIM) {
3827 const double ssim_factor =3820 set_ssim_rdmult(cpi, mi_row, mi_col, &partition_mul);
3828 get_ssim_rdmult_scaling_factor(cpi, mi_row, mi_col);
3829 partition_mul = (int)(ssim_factor * partition_mul);
3830 vpx_clear_system_state();
3831 }3821 }
3832 3822
3833 (void)*tp_orig;3823 (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