| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 return skin_diff; | 65 return skin_diff; |
| 66 } | 66 } |
| 67 | 67 |
| 68 static int macroblock_corner_grad(unsigned char* signal, int stride, | 68 static int macroblock_corner_grad(unsigned char* signal, int stride, |
| 69 int offsetx, int offsety, int sgnx, int sgny) | 69 int offsetx, int offsety, int sgnx, int sgny) |
| 70 { | 70 { |
| 71 int y1 = signal[offsetx * stride + offsety]; | 71 int y1 = signal[offsetx * stride + offsety]; |
| 72 int y2 = signal[offsetx * stride + offsety + sgny]; | 72 int y2 = signal[offsetx * stride + offsety + sgny]; |
| 73 int y3 = signal[(offsetx + sgnx) * stride + offsety]; | 73 int y3 = signal[(offsetx + sgnx) * stride + offsety]; |
| 74 int y4 = signal[(offsetx + sgnx) * stride + offsety + sgny]; | 74 int y4 = signal[(offsetx + sgnx) * stride + offsety + sgny]; |
| 75 return MAX(MAX(abs(y1 - y2), abs(y1 - y3)), abs(y1 - y4)); | 75 return VPXMAX(VPXMAX(abs(y1 - y2), abs(y1 - y3)), abs(y1 - y4)); |
| 76 } | 76 } |
| 77 | 77 |
| 78 static int check_dot_artifact_candidate(VP8_COMP *cpi, | 78 static int check_dot_artifact_candidate(VP8_COMP *cpi, |
| 79 MACROBLOCK *x, | 79 MACROBLOCK *x, |
| 80 unsigned char *target_last, | 80 unsigned char *target_last, |
| 81 int stride, | 81 int stride, |
| 82 unsigned char* last_ref, | 82 unsigned char* last_ref, |
| 83 int mb_row, | 83 int mb_row, |
| 84 int mb_col, | 84 int mb_col, |
| 85 int channel) | 85 int channel) |
| (...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 { | 1129 { |
| 1130 mvp.as_int = best_ref_mv.as_int; | 1130 mvp.as_int = best_ref_mv.as_int; |
| 1131 mvp_full.as_mv.col = best_ref_mv.as_mv.col>>3; | 1131 mvp_full.as_mv.col = best_ref_mv.as_mv.col>>3; |
| 1132 mvp_full.as_mv.row = best_ref_mv.as_mv.row>>3; | 1132 mvp_full.as_mv.row = best_ref_mv.as_mv.row>>3; |
| 1133 } | 1133 } |
| 1134 } | 1134 } |
| 1135 | 1135 |
| 1136 #if CONFIG_MULTI_RES_ENCODING | 1136 #if CONFIG_MULTI_RES_ENCODING |
| 1137 if (parent_ref_valid && (parent_ref_frame == this_ref_frame) && | 1137 if (parent_ref_valid && (parent_ref_frame == this_ref_frame) && |
| 1138 dissim <= 2 && | 1138 dissim <= 2 && |
| 1139 MAX(abs(best_ref_mv.as_mv.row - parent_ref_mv.as_mv.row), | 1139 VPXMAX(abs(best_ref_mv.as_mv.row - parent_ref_mv.as_mv.row), |
| 1140 abs(best_ref_mv.as_mv.col - parent_ref_mv.as_mv.col)) <= 4) | 1140 abs(best_ref_mv.as_mv.col - parent_ref_mv.as_mv.col)) <= |
| 1141 4) |
| 1141 { | 1142 { |
| 1142 d->bmi.mv.as_int = mvp_full.as_int; | 1143 d->bmi.mv.as_int = mvp_full.as_int; |
| 1143 mode_mv[NEWMV].as_int = mvp_full.as_int; | 1144 mode_mv[NEWMV].as_int = mvp_full.as_int; |
| 1144 | 1145 |
| 1145 cpi->find_fractional_mv_step(x, b, d, &d->bmi.mv, &best_ref_mv, | 1146 cpi->find_fractional_mv_step(x, b, d, &d->bmi.mv, &best_ref_mv, |
| 1146 x->errorperbit, | 1147 x->errorperbit, |
| 1147 &cpi->fn_ptr[BLOCK_16X16], | 1148 &cpi->fn_ptr[BLOCK_16X16], |
| 1148 cpi->mb.mvcost, | 1149 cpi->mb.mvcost, |
| 1149 &distortion2,&sse); | 1150 &distortion2,&sse); |
| 1150 }else | 1151 }else |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1233 | 1234 |
| 1234 if (bestsme < INT_MAX) | 1235 if (bestsme < INT_MAX) |
| 1235 cpi->find_fractional_mv_step(x, b, d, &d->bmi.mv, | 1236 cpi->find_fractional_mv_step(x, b, d, &d->bmi.mv, |
| 1236 &best_ref_mv, x->errorperbit, | 1237 &best_ref_mv, x->errorperbit, |
| 1237 &cpi->fn_ptr[BLOCK_16X16], | 1238 &cpi->fn_ptr[BLOCK_16X16], |
| 1238 cpi->mb.mvcost, | 1239 cpi->mb.mvcost, |
| 1239 &distortion2,&sse); | 1240 &distortion2,&sse); |
| 1240 } | 1241 } |
| 1241 | 1242 |
| 1242 mode_mv[NEWMV].as_int = d->bmi.mv.as_int; | 1243 mode_mv[NEWMV].as_int = d->bmi.mv.as_int; |
| 1243 | 1244 // The clamp below is not necessary from the perspective |
| 1245 // of VP8 bitstream, but is added to improve ChromeCast |
| 1246 // mirroring's robustness. Please do not remove. |
| 1247 vp8_clamp_mv2(&mode_mv[this_mode], xd); |
| 1244 /* mv cost; */ | 1248 /* mv cost; */ |
| 1245 rate2 += vp8_mv_bit_cost(&mode_mv[NEWMV], &best_ref_mv, | 1249 rate2 += vp8_mv_bit_cost(&mode_mv[NEWMV], &best_ref_mv, |
| 1246 cpi->mb.mvcost, 128); | 1250 cpi->mb.mvcost, 128); |
| 1247 } | 1251 } |
| 1248 | 1252 |
| 1249 case NEARESTMV: | 1253 case NEARESTMV: |
| 1250 case NEARMV: | 1254 case NEARMV: |
| 1251 | |
| 1252 if (mode_mv[this_mode].as_int == 0) | 1255 if (mode_mv[this_mode].as_int == 0) |
| 1253 continue; | 1256 continue; |
| 1254 | 1257 |
| 1255 case ZEROMV: | 1258 case ZEROMV: |
| 1256 | 1259 |
| 1257 /* Trap vectors that reach beyond the UMV borders | 1260 /* Trap vectors that reach beyond the UMV borders |
| 1258 * Note that ALL New MV, Nearest MV Near MV and Zero MV code drops | 1261 * Note that ALL New MV, Nearest MV Near MV and Zero MV code drops |
| 1259 * through to this point because of the lack of break statements | 1262 * through to this point because of the lack of break statements |
| 1260 * in the previous two cases. | 1263 * in the previous two cases. |
| 1261 */ | 1264 */ |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1539 error4x4 = pick_intra4x4mby_modes(x, &rate, | 1542 error4x4 = pick_intra4x4mby_modes(x, &rate, |
| 1540 &best_sse); | 1543 &best_sse); |
| 1541 if (error4x4 < error16x16) | 1544 if (error4x4 < error16x16) |
| 1542 { | 1545 { |
| 1543 xd->mode_info_context->mbmi.mode = B_PRED; | 1546 xd->mode_info_context->mbmi.mode = B_PRED; |
| 1544 best_rate = rate; | 1547 best_rate = rate; |
| 1545 } | 1548 } |
| 1546 | 1549 |
| 1547 *rate_ = best_rate; | 1550 *rate_ = best_rate; |
| 1548 } | 1551 } |
| OLD | NEW |