Commit 57486c5f authored by Rupert Swarbrick's avatar Rupert Swarbrick Committed by Debargha Mukherjee

Replace magic 32/64 constants with 8 * MI_SIZE

These multiplications convert from mi units to subpels (1/8th pixel)
and weren't correct if MI_SIZE was 4 rather than 8. This patch
rephrases the multiplications as x * 8 * MI_SIZE or x/2 * 8 *
MI_SIZE (for obmc calculations where you need the middle of a block).

Change-Id: I7997b1221ac417a223a94f1f26a86b6acd27c5da
parent 181fc08f
......@@ -701,7 +701,7 @@ typedef struct macroblockd {
const aom_prob (*partition_probs)[PARTITION_TYPES - 1];
/* Distance of MB away from frame edges */
/* Distance of MB away from frame edges in subpixels (1/8th pixel) */
int mb_to_left_edge;
int mb_to_right_edge;
int mb_to_top_edge;
......
......@@ -2197,7 +2197,7 @@ void av1_build_prediction_by_above_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
if (mi_row <= tile->mi_row_start) return;
xd->mb_to_bottom_edge += xd->n8_h * 32;
xd->mb_to_bottom_edge += xd->n8_h / 2 * MI_SIZE * 8;
for (i = 0; i < ilimit; i += mi_step) {
int mi_row_offset = -1;
int mi_col_offset = i;
......@@ -2260,7 +2260,7 @@ void av1_build_prediction_by_above_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
xd->mb_to_left_edge = -(((mi_col + i) * MI_SIZE) * 8);
xd->mb_to_right_edge =
mb_to_right_edge_base + (xd->n8_w - i - mi_step) * 64;
mb_to_right_edge_base + (xd->n8_w - i - mi_step) * MI_SIZE * 8;
mi_x = (mi_col + i) << MI_SIZE_LOG2;
mi_y = mi_row << MI_SIZE_LOG2;
......@@ -2283,7 +2283,7 @@ void av1_build_prediction_by_above_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
}
xd->mb_to_left_edge = -((mi_col * MI_SIZE) * 8);
xd->mb_to_right_edge = mb_to_right_edge_base;
xd->mb_to_bottom_edge -= xd->n8_h * 32;
xd->mb_to_bottom_edge -= xd->n8_h / 2 * MI_SIZE * 8;
}
void av1_build_prediction_by_left_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
......@@ -2302,7 +2302,7 @@ void av1_build_prediction_by_left_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
if (mi_col == 0 || (mi_col - 1 < tile->mi_col_start)) return;
xd->mb_to_right_edge += xd->n8_w * 32;
xd->mb_to_right_edge += xd->n8_w / 2 * MI_SIZE * 8;
for (i = 0; i < ilimit; i += mi_step) {
int mi_row_offset = i;
int mi_col_offset = -1;
......@@ -2362,7 +2362,7 @@ void av1_build_prediction_by_left_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
xd->mb_to_top_edge = -(((mi_row + i) * MI_SIZE) * 8);
xd->mb_to_bottom_edge =
mb_to_bottom_edge_base + (xd->n8_h - i - mi_step) * 64;
mb_to_bottom_edge_base + (xd->n8_h - i - mi_step) * MI_SIZE * 8;
mi_x = mi_col << MI_SIZE_LOG2;
mi_y = (mi_row + i) << MI_SIZE_LOG2;
......@@ -2385,7 +2385,7 @@ void av1_build_prediction_by_left_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
}
xd->mb_to_top_edge = -((mi_row * MI_SIZE) * 8);
xd->mb_to_bottom_edge = mb_to_bottom_edge_base;
xd->mb_to_right_edge -= xd->n8_w * 32;
xd->mb_to_right_edge -= xd->n8_w / 2 * MI_SIZE * 8;
}
void av1_build_obmc_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCKD *xd,
......@@ -2567,7 +2567,7 @@ void av1_build_prediction_by_right_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
assert(bsize >= BLOCK_8X8);
xd->mb_to_left_edge -= xd->n8_w * 32;
xd->mb_to_left_edge -= xd->n8_w / 2 * MI_SIZE * 8;
for (i = 0; i < ilimit; i += mi_step) {
int mi_row_offset = i;
int mi_col_offset = xd->n8_w;
......@@ -2608,7 +2608,7 @@ void av1_build_prediction_by_right_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
xd->mb_to_top_edge = -(((mi_row + i) * MI_SIZE) * 8);
xd->mb_to_bottom_edge =
mb_to_bottom_edge_base + (xd->n8_h - i - mi_step) * 64;
mb_to_bottom_edge_base + (xd->n8_h - i - mi_step) * MI_SIZE * 8;
mi_x = (mi_col << MI_SIZE_LOG2) + xd->n8_w * (MI_SIZE >> 1);
mi_y = (mi_row + i) << MI_SIZE_LOG2;
......@@ -2656,7 +2656,7 @@ void av1_build_prediction_by_right_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
}
xd->mb_to_top_edge = -((mi_row * MI_SIZE) * 8);
xd->mb_to_bottom_edge = mb_to_bottom_edge_base;
xd->mb_to_left_edge += xd->n8_w * 32;
xd->mb_to_left_edge += xd->n8_w / 2 * MI_SIZE * 8;
}
// This function combines motion compensated predictions that is generated by
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment