Index: source/libvpx/vp8/encoder/pickinter.c |
diff --git a/source/libvpx/vp8/encoder/pickinter.c b/source/libvpx/vp8/encoder/pickinter.c |
index f3443dbccdc85e250fce599d1c335f072ba51e3d..c41005a3bacfb377b72aaf107082a4963108ec61 100644 |
--- a/source/libvpx/vp8/encoder/pickinter.c |
+++ b/source/libvpx/vp8/encoder/pickinter.c |
@@ -72,7 +72,7 @@ static int macroblock_corner_grad(unsigned char* signal, int stride, |
int y2 = signal[offsetx * stride + offsety + sgny]; |
int y3 = signal[(offsetx + sgnx) * stride + offsety]; |
int y4 = signal[(offsetx + sgnx) * stride + offsety + sgny]; |
- return MAX(MAX(abs(y1 - y2), abs(y1 - y3)), abs(y1 - y4)); |
+ return VPXMAX(VPXMAX(abs(y1 - y2), abs(y1 - y3)), abs(y1 - y4)); |
} |
static int check_dot_artifact_candidate(VP8_COMP *cpi, |
@@ -1136,8 +1136,9 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, |
#if CONFIG_MULTI_RES_ENCODING |
if (parent_ref_valid && (parent_ref_frame == this_ref_frame) && |
dissim <= 2 && |
- MAX(abs(best_ref_mv.as_mv.row - parent_ref_mv.as_mv.row), |
- abs(best_ref_mv.as_mv.col - parent_ref_mv.as_mv.col)) <= 4) |
+ VPXMAX(abs(best_ref_mv.as_mv.row - parent_ref_mv.as_mv.row), |
+ abs(best_ref_mv.as_mv.col - parent_ref_mv.as_mv.col)) <= |
+ 4) |
{ |
d->bmi.mv.as_int = mvp_full.as_int; |
mode_mv[NEWMV].as_int = mvp_full.as_int; |
@@ -1240,7 +1241,10 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, |
} |
mode_mv[NEWMV].as_int = d->bmi.mv.as_int; |
- |
+ // The clamp below is not necessary from the perspective |
+ // of VP8 bitstream, but is added to improve ChromeCast |
+ // mirroring's robustness. Please do not remove. |
+ vp8_clamp_mv2(&mode_mv[this_mode], xd); |
/* mv cost; */ |
rate2 += vp8_mv_bit_cost(&mode_mv[NEWMV], &best_ref_mv, |
cpi->mb.mvcost, 128); |
@@ -1248,7 +1252,6 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, |
case NEARESTMV: |
case NEARMV: |
- |
if (mode_mv[this_mode].as_int == 0) |
continue; |