| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 vp9_cost_tokens((int *)c[t][i][j][k][0][l], probs, | 86 vp9_cost_tokens((int *)c[t][i][j][k][0][l], probs, |
| 87 vp9_coef_tree); | 87 vp9_coef_tree); |
| 88 vp9_cost_tokens_skip((int *)c[t][i][j][k][1][l], probs, | 88 vp9_cost_tokens_skip((int *)c[t][i][j][k][1][l], probs, |
| 89 vp9_coef_tree); | 89 vp9_coef_tree); |
| 90 assert(c[t][i][j][k][0][l][EOB_TOKEN] == | 90 assert(c[t][i][j][k][0][l][EOB_TOKEN] == |
| 91 c[t][i][j][k][1][l][EOB_TOKEN]); | 91 c[t][i][j][k][1][l][EOB_TOKEN]); |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 | 94 |
| 95 // Values are now correlated to quantizer. | 95 // Values are now correlated to quantizer. |
| 96 static int sad_per_bit16lut[QINDEX_RANGE]; | 96 static int sad_per_bit16lut_8[QINDEX_RANGE]; |
| 97 static int sad_per_bit4lut[QINDEX_RANGE]; | 97 static int sad_per_bit4lut_8[QINDEX_RANGE]; |
| 98 | 98 |
| 99 void vp9_init_me_luts() { | 99 #if CONFIG_VP9_HIGHBITDEPTH |
| 100 static int sad_per_bit16lut_10[QINDEX_RANGE]; |
| 101 static int sad_per_bit4lut_10[QINDEX_RANGE]; |
| 102 static int sad_per_bit16lut_12[QINDEX_RANGE]; |
| 103 static int sad_per_bit4lut_12[QINDEX_RANGE]; |
| 104 #endif |
| 105 |
| 106 static void init_me_luts_bd(int *bit16lut, int *bit4lut, int range, |
| 107 vpx_bit_depth_t bit_depth) { |
| 100 int i; | 108 int i; |
| 101 | |
| 102 // Initialize the sad lut tables using a formulaic calculation for now. | 109 // Initialize the sad lut tables using a formulaic calculation for now. |
| 103 // This is to make it easier to resolve the impact of experimental changes | 110 // This is to make it easier to resolve the impact of experimental changes |
| 104 // to the quantizer tables. | 111 // to the quantizer tables. |
| 105 for (i = 0; i < QINDEX_RANGE; ++i) { | 112 for (i = 0; i < range; i++) { |
| 106 const double q = vp9_convert_qindex_to_q(i); | 113 const double q = vp9_convert_qindex_to_q(i, bit_depth); |
| 107 sad_per_bit16lut[i] = (int)(0.0418 * q + 2.4107); | 114 bit16lut[i] = (int)(0.0418 * q + 2.4107); |
| 108 sad_per_bit4lut[i] = (int)(0.063 * q + 2.742); | 115 bit4lut[i] = (int)(0.063 * q + 2.742); |
| 109 } | 116 } |
| 110 } | 117 } |
| 111 | 118 |
| 119 void vp9_init_me_luts() { |
| 120 init_me_luts_bd(sad_per_bit16lut_8, sad_per_bit4lut_8, QINDEX_RANGE, |
| 121 VPX_BITS_8); |
| 122 #if CONFIG_VP9_HIGHBITDEPTH |
| 123 init_me_luts_bd(sad_per_bit16lut_10, sad_per_bit4lut_10, QINDEX_RANGE, |
| 124 VPX_BITS_10); |
| 125 init_me_luts_bd(sad_per_bit16lut_12, sad_per_bit4lut_12, QINDEX_RANGE, |
| 126 VPX_BITS_12); |
| 127 #endif |
| 128 } |
| 129 |
| 112 static const int rd_boost_factor[16] = { | 130 static const int rd_boost_factor[16] = { |
| 113 64, 32, 32, 32, 24, 16, 12, 12, | 131 64, 32, 32, 32, 24, 16, 12, 12, |
| 114 8, 8, 4, 4, 2, 2, 1, 0 | 132 8, 8, 4, 4, 2, 2, 1, 0 |
| 115 }; | 133 }; |
| 116 static const int rd_frame_type_factor[FRAME_UPDATE_TYPES] = { | 134 static const int rd_frame_type_factor[FRAME_UPDATE_TYPES] = { |
| 117 128, 144, 128, 128, 144 | 135 128, 144, 128, 128, 144 |
| 118 }; | 136 }; |
| 119 | 137 |
| 120 int vp9_compute_rd_mult(const VP9_COMP *cpi, int qindex) { | 138 int vp9_compute_rd_mult(const VP9_COMP *cpi, int qindex) { |
| 121 const int q = vp9_dc_quant(qindex, 0); | 139 const int q = vp9_dc_quant(qindex, 0, cpi->common.bit_depth); |
| 140 #if CONFIG_VP9_HIGHBITDEPTH |
| 141 int rdmult = 0; |
| 142 switch (cpi->common.bit_depth) { |
| 143 case VPX_BITS_8: |
| 144 rdmult = 88 * q * q / 24; |
| 145 break; |
| 146 case VPX_BITS_10: |
| 147 rdmult = ROUND_POWER_OF_TWO(88 * q * q / 24, 4); |
| 148 break; |
| 149 case VPX_BITS_12: |
| 150 rdmult = ROUND_POWER_OF_TWO(88 * q * q / 24, 8); |
| 151 break; |
| 152 default: |
| 153 assert(0 && "bit_depth should be VPX_BITS_8, VPX_BITS_10 or VPX_BITS_12"); |
| 154 return -1; |
| 155 } |
| 156 #else |
| 122 int rdmult = 88 * q * q / 24; | 157 int rdmult = 88 * q * q / 24; |
| 123 | 158 #endif |
| 124 if (cpi->oxcf.pass == 2 && (cpi->common.frame_type != KEY_FRAME)) { | 159 if (cpi->oxcf.pass == 2 && (cpi->common.frame_type != KEY_FRAME)) { |
| 125 const GF_GROUP *const gf_group = &cpi->twopass.gf_group; | 160 const GF_GROUP *const gf_group = &cpi->twopass.gf_group; |
| 126 const FRAME_UPDATE_TYPE frame_type = gf_group->update_type[gf_group->index]; | 161 const FRAME_UPDATE_TYPE frame_type = gf_group->update_type[gf_group->index]; |
| 127 const int boost_index = MIN(15, (cpi->rc.gfu_boost / 100)); | 162 const int boost_index = MIN(15, (cpi->rc.gfu_boost / 100)); |
| 128 | 163 |
| 129 rdmult = (rdmult * rd_frame_type_factor[frame_type]) >> 7; | 164 rdmult = (rdmult * rd_frame_type_factor[frame_type]) >> 7; |
| 130 rdmult += ((rdmult * rd_boost_factor[boost_index]) >> 7); | 165 rdmult += ((rdmult * rd_boost_factor[boost_index]) >> 7); |
| 131 } | 166 } |
| 132 return rdmult; | 167 return rdmult; |
| 133 } | 168 } |
| 134 | 169 |
| 135 static int compute_rd_thresh_factor(int qindex) { | 170 static int compute_rd_thresh_factor(int qindex, vpx_bit_depth_t bit_depth) { |
| 171 double q; |
| 172 #if CONFIG_VP9_HIGHBITDEPTH |
| 173 switch (bit_depth) { |
| 174 case VPX_BITS_8: |
| 175 q = vp9_dc_quant(qindex, 0, VPX_BITS_8) / 4.0; |
| 176 break; |
| 177 case VPX_BITS_10: |
| 178 q = vp9_dc_quant(qindex, 0, VPX_BITS_10) / 16.0; |
| 179 break; |
| 180 case VPX_BITS_12: |
| 181 q = vp9_dc_quant(qindex, 0, VPX_BITS_12) / 64.0; |
| 182 break; |
| 183 default: |
| 184 assert(0 && "bit_depth should be VPX_BITS_8, VPX_BITS_10 or VPX_BITS_12"); |
| 185 return -1; |
| 186 } |
| 187 #else |
| 188 (void) bit_depth; |
| 189 q = vp9_dc_quant(qindex, 0, VPX_BITS_8) / 4.0; |
| 190 #endif |
| 136 // TODO(debargha): Adjust the function below. | 191 // TODO(debargha): Adjust the function below. |
| 137 const int q = (int)(pow(vp9_dc_quant(qindex, 0) / 4.0, RD_THRESH_POW) * 5.12); | 192 return MAX((int)(pow(q, RD_THRESH_POW) * 5.12), 8); |
| 138 return MAX(q, 8); | |
| 139 } | 193 } |
| 140 | 194 |
| 141 void vp9_initialize_me_consts(VP9_COMP *cpi, int qindex) { | 195 void vp9_initialize_me_consts(VP9_COMP *cpi, int qindex) { |
| 142 cpi->mb.sadperbit16 = sad_per_bit16lut[qindex]; | 196 #if CONFIG_VP9_HIGHBITDEPTH |
| 143 cpi->mb.sadperbit4 = sad_per_bit4lut[qindex]; | 197 switch (cpi->common.bit_depth) { |
| 198 case VPX_BITS_8: |
| 199 cpi->mb.sadperbit16 = sad_per_bit16lut_8[qindex]; |
| 200 cpi->mb.sadperbit4 = sad_per_bit4lut_8[qindex]; |
| 201 break; |
| 202 case VPX_BITS_10: |
| 203 cpi->mb.sadperbit16 = sad_per_bit16lut_10[qindex]; |
| 204 cpi->mb.sadperbit4 = sad_per_bit4lut_10[qindex]; |
| 205 break; |
| 206 case VPX_BITS_12: |
| 207 cpi->mb.sadperbit16 = sad_per_bit16lut_12[qindex]; |
| 208 cpi->mb.sadperbit4 = sad_per_bit4lut_12[qindex]; |
| 209 break; |
| 210 default: |
| 211 assert(0 && "bit_depth should be VPX_BITS_8, VPX_BITS_10 or VPX_BITS_12"); |
| 212 } |
| 213 #else |
| 214 cpi->mb.sadperbit16 = sad_per_bit16lut_8[qindex]; |
| 215 cpi->mb.sadperbit4 = sad_per_bit4lut_8[qindex]; |
| 216 #endif |
| 144 } | 217 } |
| 145 | 218 |
| 146 static void set_block_thresholds(const VP9_COMMON *cm, RD_OPT *rd) { | 219 static void set_block_thresholds(const VP9_COMMON *cm, RD_OPT *rd) { |
| 147 int i, bsize, segment_id; | 220 int i, bsize, segment_id; |
| 148 | 221 |
| 149 for (segment_id = 0; segment_id < MAX_SEGMENTS; ++segment_id) { | 222 for (segment_id = 0; segment_id < MAX_SEGMENTS; ++segment_id) { |
| 150 const int qindex = | 223 const int qindex = |
| 151 clamp(vp9_get_qindex(&cm->seg, segment_id, cm->base_qindex) + | 224 clamp(vp9_get_qindex(&cm->seg, segment_id, cm->base_qindex) + |
| 152 cm->y_dc_delta_q, | 225 cm->y_dc_delta_q, 0, MAXQ); |
| 153 0, MAXQ); | 226 const int q = compute_rd_thresh_factor(qindex, cm->bit_depth); |
| 154 const int q = compute_rd_thresh_factor(qindex); | |
| 155 | 227 |
| 156 for (bsize = 0; bsize < BLOCK_SIZES; ++bsize) { | 228 for (bsize = 0; bsize < BLOCK_SIZES; ++bsize) { |
| 157 // Threshold here seems unnecessarily harsh but fine given actual | 229 // Threshold here seems unnecessarily harsh but fine given actual |
| 158 // range of values used for cpi->sf.thresh_mult[]. | 230 // range of values used for cpi->sf.thresh_mult[]. |
| 159 const int t = q * rd_thresh_block_size_factor[bsize]; | 231 const int t = q * rd_thresh_block_size_factor[bsize]; |
| 160 const int thresh_max = INT_MAX / t; | 232 const int thresh_max = INT_MAX / t; |
| 161 | 233 |
| 162 if (bsize >= BLOCK_8X8) { | 234 if (bsize >= BLOCK_8X8) { |
| 163 for (i = 0; i < MAX_MODES; ++i) | 235 for (i = 0; i < MAX_MODES; ++i) |
| 164 rd->threshes[segment_id][bsize][i] = | 236 rd->threshes[segment_id][bsize][i] = |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 default: | 428 default: |
| 357 assert(0 && "Invalid transform size."); | 429 assert(0 && "Invalid transform size."); |
| 358 break; | 430 break; |
| 359 } | 431 } |
| 360 } | 432 } |
| 361 | 433 |
| 362 void vp9_mv_pred(VP9_COMP *cpi, MACROBLOCK *x, | 434 void vp9_mv_pred(VP9_COMP *cpi, MACROBLOCK *x, |
| 363 uint8_t *ref_y_buffer, int ref_y_stride, | 435 uint8_t *ref_y_buffer, int ref_y_stride, |
| 364 int ref_frame, BLOCK_SIZE block_size) { | 436 int ref_frame, BLOCK_SIZE block_size) { |
| 365 MACROBLOCKD *xd = &x->e_mbd; | 437 MACROBLOCKD *xd = &x->e_mbd; |
| 366 MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; | 438 MB_MODE_INFO *mbmi = &xd->mi[0].src_mi->mbmi; |
| 367 int i; | 439 int i; |
| 368 int zero_seen = 0; | 440 int zero_seen = 0; |
| 369 int best_index = 0; | 441 int best_index = 0; |
| 370 int best_sad = INT_MAX; | 442 int best_sad = INT_MAX; |
| 371 int this_sad = INT_MAX; | 443 int this_sad = INT_MAX; |
| 372 int max_mv = 0; | 444 int max_mv = 0; |
| 373 uint8_t *src_y_ptr = x->plane[0].src.buf; | 445 uint8_t *src_y_ptr = x->plane[0].src.buf; |
| 374 uint8_t *ref_y_ptr; | 446 uint8_t *ref_y_ptr; |
| 375 const int num_mv_refs = MAX_MV_REF_CANDIDATES + | 447 const int num_mv_refs = MAX_MV_REF_CANDIDATES + |
| 376 (cpi->sf.adaptive_motion_search && | 448 (cpi->sf.adaptive_motion_search && |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 const YV12_BUFFER_CONFIG *vp9_get_scaled_ref_frame(const VP9_COMP *cpi, | 507 const YV12_BUFFER_CONFIG *vp9_get_scaled_ref_frame(const VP9_COMP *cpi, |
| 436 int ref_frame) { | 508 int ref_frame) { |
| 437 const VP9_COMMON *const cm = &cpi->common; | 509 const VP9_COMMON *const cm = &cpi->common; |
| 438 const int ref_idx = cm->ref_frame_map[get_ref_frame_idx(cpi, ref_frame)]; | 510 const int ref_idx = cm->ref_frame_map[get_ref_frame_idx(cpi, ref_frame)]; |
| 439 const int scaled_idx = cpi->scaled_ref_idx[ref_frame - 1]; | 511 const int scaled_idx = cpi->scaled_ref_idx[ref_frame - 1]; |
| 440 return (scaled_idx != ref_idx) ? &cm->frame_bufs[scaled_idx].buf : NULL; | 512 return (scaled_idx != ref_idx) ? &cm->frame_bufs[scaled_idx].buf : NULL; |
| 441 } | 513 } |
| 442 | 514 |
| 443 int vp9_get_switchable_rate(const VP9_COMP *cpi) { | 515 int vp9_get_switchable_rate(const VP9_COMP *cpi) { |
| 444 const MACROBLOCKD *const xd = &cpi->mb.e_mbd; | 516 const MACROBLOCKD *const xd = &cpi->mb.e_mbd; |
| 445 const MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; | 517 const MB_MODE_INFO *const mbmi = &xd->mi[0].src_mi->mbmi; |
| 446 const int ctx = vp9_get_pred_context_switchable_interp(xd); | 518 const int ctx = vp9_get_pred_context_switchable_interp(xd); |
| 447 return SWITCHABLE_INTERP_RATE_FACTOR * | 519 return SWITCHABLE_INTERP_RATE_FACTOR * |
| 448 cpi->switchable_interp_costs[ctx][mbmi->interp_filter]; | 520 cpi->switchable_interp_costs[ctx][mbmi->interp_filter]; |
| 449 } | 521 } |
| 450 | 522 |
| 451 void vp9_set_rd_speed_thresholds(VP9_COMP *cpi) { | 523 void vp9_set_rd_speed_thresholds(VP9_COMP *cpi) { |
| 452 int i; | 524 int i; |
| 453 RD_OPT *const rd = &cpi->rd; | 525 RD_OPT *const rd = &cpi->rd; |
| 454 SPEED_FEATURES *const sf = &cpi->sf; | 526 SPEED_FEATURES *const sf = &cpi->sf; |
| 455 | 527 |
| 456 // Set baseline threshold values. | 528 // Set baseline threshold values. |
| 457 for (i = 0; i < MAX_MODES; ++i) | 529 for (i = 0; i < MAX_MODES; ++i) |
| 458 rd->thresh_mult[i] = cpi->oxcf.mode == BEST ? -500 : 0; | 530 rd->thresh_mult[i] = cpi->oxcf.mode == BEST ? -500 : 0; |
| 459 | 531 |
| 460 rd->thresh_mult[THR_NEARESTMV] = 0; | 532 if (sf->adaptive_rd_thresh) { |
| 461 rd->thresh_mult[THR_NEARESTG] = 0; | 533 rd->thresh_mult[THR_NEARESTMV] = 300; |
| 462 rd->thresh_mult[THR_NEARESTA] = 0; | 534 rd->thresh_mult[THR_NEARESTG] = 300; |
| 535 rd->thresh_mult[THR_NEARESTA] = 300; |
| 536 } else { |
| 537 rd->thresh_mult[THR_NEARESTMV] = 0; |
| 538 rd->thresh_mult[THR_NEARESTG] = 0; |
| 539 rd->thresh_mult[THR_NEARESTA] = 0; |
| 540 } |
| 463 | 541 |
| 464 rd->thresh_mult[THR_DC] += 1000; | 542 rd->thresh_mult[THR_DC] += 1000; |
| 465 | 543 |
| 466 rd->thresh_mult[THR_NEWMV] += 1000; | 544 rd->thresh_mult[THR_NEWMV] += 1000; |
| 467 rd->thresh_mult[THR_NEWA] += 1000; | 545 rd->thresh_mult[THR_NEWA] += 1000; |
| 468 rd->thresh_mult[THR_NEWG] += 1000; | 546 rd->thresh_mult[THR_NEWG] += 1000; |
| 469 | 547 |
| 470 // Adjust threshold only in real time mode, which only uses last | 548 // Adjust threshold only in real time mode, which only uses last |
| 471 // reference frame. | 549 // reference frame. |
| 472 rd->thresh_mult[THR_NEWMV] += sf->elevate_newmv_thresh; | 550 rd->thresh_mult[THR_NEWMV] += sf->elevate_newmv_thresh; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 491 rd->thresh_mult[THR_COMP_ZEROGA] += 2500; | 569 rd->thresh_mult[THR_COMP_ZEROGA] += 2500; |
| 492 | 570 |
| 493 rd->thresh_mult[THR_H_PRED] += 2000; | 571 rd->thresh_mult[THR_H_PRED] += 2000; |
| 494 rd->thresh_mult[THR_V_PRED] += 2000; | 572 rd->thresh_mult[THR_V_PRED] += 2000; |
| 495 rd->thresh_mult[THR_D45_PRED ] += 2500; | 573 rd->thresh_mult[THR_D45_PRED ] += 2500; |
| 496 rd->thresh_mult[THR_D135_PRED] += 2500; | 574 rd->thresh_mult[THR_D135_PRED] += 2500; |
| 497 rd->thresh_mult[THR_D117_PRED] += 2500; | 575 rd->thresh_mult[THR_D117_PRED] += 2500; |
| 498 rd->thresh_mult[THR_D153_PRED] += 2500; | 576 rd->thresh_mult[THR_D153_PRED] += 2500; |
| 499 rd->thresh_mult[THR_D207_PRED] += 2500; | 577 rd->thresh_mult[THR_D207_PRED] += 2500; |
| 500 rd->thresh_mult[THR_D63_PRED] += 2500; | 578 rd->thresh_mult[THR_D63_PRED] += 2500; |
| 501 | |
| 502 // Disable frame modes if flags not set. | |
| 503 if (!(cpi->ref_frame_flags & VP9_LAST_FLAG)) { | |
| 504 rd->thresh_mult[THR_NEWMV ] = INT_MAX; | |
| 505 rd->thresh_mult[THR_NEARESTMV] = INT_MAX; | |
| 506 rd->thresh_mult[THR_ZEROMV ] = INT_MAX; | |
| 507 rd->thresh_mult[THR_NEARMV ] = INT_MAX; | |
| 508 } | |
| 509 if (!(cpi->ref_frame_flags & VP9_GOLD_FLAG)) { | |
| 510 rd->thresh_mult[THR_NEARESTG ] = INT_MAX; | |
| 511 rd->thresh_mult[THR_ZEROG ] = INT_MAX; | |
| 512 rd->thresh_mult[THR_NEARG ] = INT_MAX; | |
| 513 rd->thresh_mult[THR_NEWG ] = INT_MAX; | |
| 514 } | |
| 515 if (!(cpi->ref_frame_flags & VP9_ALT_FLAG)) { | |
| 516 rd->thresh_mult[THR_NEARESTA ] = INT_MAX; | |
| 517 rd->thresh_mult[THR_ZEROA ] = INT_MAX; | |
| 518 rd->thresh_mult[THR_NEARA ] = INT_MAX; | |
| 519 rd->thresh_mult[THR_NEWA ] = INT_MAX; | |
| 520 } | |
| 521 | |
| 522 if ((cpi->ref_frame_flags & (VP9_LAST_FLAG | VP9_ALT_FLAG)) != | |
| 523 (VP9_LAST_FLAG | VP9_ALT_FLAG)) { | |
| 524 rd->thresh_mult[THR_COMP_ZEROLA ] = INT_MAX; | |
| 525 rd->thresh_mult[THR_COMP_NEARESTLA] = INT_MAX; | |
| 526 rd->thresh_mult[THR_COMP_NEARLA ] = INT_MAX; | |
| 527 rd->thresh_mult[THR_COMP_NEWLA ] = INT_MAX; | |
| 528 } | |
| 529 if ((cpi->ref_frame_flags & (VP9_GOLD_FLAG | VP9_ALT_FLAG)) != | |
| 530 (VP9_GOLD_FLAG | VP9_ALT_FLAG)) { | |
| 531 rd->thresh_mult[THR_COMP_ZEROGA ] = INT_MAX; | |
| 532 rd->thresh_mult[THR_COMP_NEARESTGA] = INT_MAX; | |
| 533 rd->thresh_mult[THR_COMP_NEARGA ] = INT_MAX; | |
| 534 rd->thresh_mult[THR_COMP_NEWGA ] = INT_MAX; | |
| 535 } | |
| 536 } | 579 } |
| 537 | 580 |
| 538 void vp9_set_rd_speed_thresholds_sub8x8(VP9_COMP *cpi) { | 581 void vp9_set_rd_speed_thresholds_sub8x8(VP9_COMP *cpi) { |
| 539 const SPEED_FEATURES *const sf = &cpi->sf; | 582 const SPEED_FEATURES *const sf = &cpi->sf; |
| 540 RD_OPT *const rd = &cpi->rd; | 583 RD_OPT *const rd = &cpi->rd; |
| 541 int i; | 584 int i; |
| 542 | 585 |
| 543 for (i = 0; i < MAX_REFS; ++i) | 586 for (i = 0; i < MAX_REFS; ++i) |
| 544 rd->thresh_mult_sub8x8[i] = cpi->oxcf.mode == BEST ? -500 : 0; | 587 rd->thresh_mult_sub8x8[i] = cpi->oxcf.mode == BEST ? -500 : 0; |
| 545 | 588 |
| 546 rd->thresh_mult_sub8x8[THR_LAST] += 2500; | 589 rd->thresh_mult_sub8x8[THR_LAST] += 2500; |
| 547 rd->thresh_mult_sub8x8[THR_GOLD] += 2500; | 590 rd->thresh_mult_sub8x8[THR_GOLD] += 2500; |
| 548 rd->thresh_mult_sub8x8[THR_ALTR] += 2500; | 591 rd->thresh_mult_sub8x8[THR_ALTR] += 2500; |
| 549 rd->thresh_mult_sub8x8[THR_INTRA] += 2500; | 592 rd->thresh_mult_sub8x8[THR_INTRA] += 2500; |
| 550 rd->thresh_mult_sub8x8[THR_COMP_LA] += 4500; | 593 rd->thresh_mult_sub8x8[THR_COMP_LA] += 4500; |
| 551 rd->thresh_mult_sub8x8[THR_COMP_GA] += 4500; | 594 rd->thresh_mult_sub8x8[THR_COMP_GA] += 4500; |
| 552 | 595 |
| 553 // Check for masked out split cases. | 596 // Check for masked out split cases. |
| 554 for (i = 0; i < MAX_REFS; ++i) | 597 for (i = 0; i < MAX_REFS; ++i) |
| 555 if (sf->disable_split_mask & (1 << i)) | 598 if (sf->disable_split_mask & (1 << i)) |
| 556 rd->thresh_mult_sub8x8[i] = INT_MAX; | 599 rd->thresh_mult_sub8x8[i] = INT_MAX; |
| 557 | |
| 558 // Disable mode test if frame flag is not set. | |
| 559 if (!(cpi->ref_frame_flags & VP9_LAST_FLAG)) | |
| 560 rd->thresh_mult_sub8x8[THR_LAST] = INT_MAX; | |
| 561 if (!(cpi->ref_frame_flags & VP9_GOLD_FLAG)) | |
| 562 rd->thresh_mult_sub8x8[THR_GOLD] = INT_MAX; | |
| 563 if (!(cpi->ref_frame_flags & VP9_ALT_FLAG)) | |
| 564 rd->thresh_mult_sub8x8[THR_ALTR] = INT_MAX; | |
| 565 if ((cpi->ref_frame_flags & (VP9_LAST_FLAG | VP9_ALT_FLAG)) != | |
| 566 (VP9_LAST_FLAG | VP9_ALT_FLAG)) | |
| 567 rd->thresh_mult_sub8x8[THR_COMP_LA] = INT_MAX; | |
| 568 if ((cpi->ref_frame_flags & (VP9_GOLD_FLAG | VP9_ALT_FLAG)) != | |
| 569 (VP9_GOLD_FLAG | VP9_ALT_FLAG)) | |
| 570 rd->thresh_mult_sub8x8[THR_COMP_GA] = INT_MAX; | |
| 571 } | 600 } |
| OLD | NEW |