Unified · Split
| @@ -257,8 +257,8 @@ static INLINE void set_mode_info_offsets(VP9_COMMON *const cm, · 256 unmodified lines | ||
| 257 | 257 | x->mbmi_ext = x->mbmi_ext_base + (mi_row * cm->mi_cols + mi_col); |
| 258 | 258 | } |
| 259 | 259 | |
| 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) { | |
| 262 | 262 | const VP9_COMMON *const cm = &cpi->common; |
| 263 | 263 | |
| 264 | 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 | 270 | const int index = row * num_cols + col; |
| 271 | 271 | |
| 272 | 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 | 276 | vpx_clear_system_state(); |
| 274 | − return cpi->mi_ssim_rdmult_scaling_factors[index]; | |
| 275 | 277 | } |
| 276 | 278 | |
| 277 | 279 | 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 | ||
| 310 | 312 | x->rddiv = cpi->rd.RDDIV; |
| 311 | 313 | x->rdmult = cpi->rd.RDMULT; |
| 312 | 314 | 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); | |
| 317 | 316 | } |
| 318 | 317 | |
| 319 | 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 | 1963 | 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); | |
| 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 | 2204 | const VP9EncoderConfig *const oxcf = &cpi->oxcf; |
| 2209 | 2205 | x->rdmult = x->cb_rdmult; |
| 2210 | 2206 | 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); | |
| 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 | 3818 | int partition_mul = x->cb_rdmult; |
| 3826 | 3819 | 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); | |
| 3831 | 3821 | } |
| 3832 | 3822 | |
| 3833 | 3823 | (void)*tp_orig; |