Commit d565529d authored by Yunqing Wang's avatar Yunqing Wang
Browse files

Revert "Refactor and generalise OBMC prediction code"

This reverts commit 29824a42.

Unit test failure was seen.
AV1/AVxEncoderThreadLSTest.EncoderResultTest/2
AV1/TileIndependenceTestLarge.MD5Match/2

Change-Id: I836b6ef8b8eeac45014a439d1f5d4d45d17110f9
parent f67fd8ab
...@@ -1944,42 +1944,47 @@ void av1_count_overlappable_neighbors(const AV1_COMMON *cm, MACROBLOCKD *xd, ...@@ -1944,42 +1944,47 @@ void av1_count_overlappable_neighbors(const AV1_COMMON *cm, MACROBLOCKD *xd,
if (!is_motion_variation_allowed_bsize(mbmi->sb_type)) return; if (!is_motion_variation_allowed_bsize(mbmi->sb_type)) return;
if (xd->up_available) { if (xd->up_available) {
const int cols_remaining = cm->mi_cols - mi_col; const int ilimit = AOMMIN(xd->n8_w, cm->mi_cols - mi_col);
int ilimit = AOMMIN(xd->n8_w, cols_remaining);
for (i = 0; i < ilimit; i += mi_step) { for (i = 0; i < ilimit; i += mi_step) {
MB_MODE_INFO *above_mbmi = &xd->mi[i - 1 * xd->mi_stride]->mbmi; int mi_row_offset = -1;
mi_step = mi_size_wide[above_mbmi->sb_type]; int mi_col_offset = i;
MODE_INFO *above_mi =
xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride];
MB_MODE_INFO *above_mbmi = &above_mi->mbmi;
#if CONFIG_CHROMA_SUB8X8 #if CONFIG_CHROMA_SUB8X8
// With chroma-sub8x8, the chroma information is found to the right if (above_mbmi->sb_type < BLOCK_8X8) {
// (i.e. with odd mi_col) when blocks are narrower than 8x8. This will ++mi_col_offset;
// only make a difference when the block immediately above has width less above_mbmi =
// than 8 (which means that mi_step is 1) and when mi_col + i is even. In &xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi;
// that case, skip that block and start again at the one to its
// right. Bump ilimit if necessary to make sure we actually do the loop
// again.
if (mi_step == 1 && ((mi_col + i) % 2 == 0)) {
ilimit = AOMMIN(AOMMAX(ilimit, i + 1), cols_remaining);
continue;
} }
#endif #endif
BLOCK_SIZE above_bsize = AOMMAX(above_mbmi->sb_type, BLOCK_8X8);
mi_step = AOMMIN(xd->n8_w, mi_size_wide[above_bsize]);
if (is_neighbor_overlappable(above_mbmi)) if (is_neighbor_overlappable(above_mbmi))
xd->mi[0]->mbmi.overlappable_neighbors[0]++; xd->mi[0]->mbmi.overlappable_neighbors[0]++;
} }
} }
if (xd->left_available) { if (xd->left_available) {
const int rows_remaining = cm->mi_rows - mi_row; const int ilimit = AOMMIN(xd->n8_h, cm->mi_rows - mi_row);
int ilimit = AOMMIN(xd->n8_h, rows_remaining);
for (i = 0; i < ilimit; i += mi_step) { for (i = 0; i < ilimit; i += mi_step) {
MB_MODE_INFO *left_mbmi = &xd->mi[-1 + i * xd->mi_stride]->mbmi; int mi_row_offset = i;
mi_step = mi_size_high[left_mbmi->sb_type]; int mi_col_offset = -1;
MODE_INFO *left_mi =
xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride];
MB_MODE_INFO *left_mbmi = &left_mi->mbmi;
#if CONFIG_CHROMA_SUB8X8 #if CONFIG_CHROMA_SUB8X8
// See note above about blocks with width < 8 if (left_mbmi->sb_type < BLOCK_8X8) {
if (mi_step == 1 && ((mi_row + i) % 2 == 0)) { ++mi_row_offset;
ilimit = AOMMIN(AOMMAX(ilimit, i + 1), rows_remaining); left_mbmi =
continue; &xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi;
} }
#endif #endif
BLOCK_SIZE left_bsize = AOMMAX(left_mbmi->sb_type, BLOCK_8X8);
mi_step = AOMMIN(xd->n8_h, mi_size_high[left_bsize]);
if (is_neighbor_overlappable(left_mbmi)) if (is_neighbor_overlappable(left_mbmi))
xd->mi[0]->mbmi.overlappable_neighbors[1]++; xd->mi[0]->mbmi.overlappable_neighbors[1]++;
} }
...@@ -2034,36 +2039,38 @@ void av1_build_obmc_inter_prediction(const AV1_COMMON *cm, MACROBLOCKD *xd, ...@@ -2034,36 +2039,38 @@ void av1_build_obmc_inter_prediction(const AV1_COMMON *cm, MACROBLOCKD *xd,
// handle above row // handle above row
if (xd->up_available) { if (xd->up_available) {
const int overlap = const int overlap =
AOMMIN(block_size_high[bsize], block_size_high[BLOCK_64X64]) >> 1; AOMMIN(block_size_high[bsize] >> 1, block_size_high[BLOCK_64X64] >> 1);
const int miw = AOMMIN(xd->n8_w, cm->mi_cols - mi_col);
const int cols_remaining = cm->mi_cols - mi_col; const int mi_row_offset = -1;
int ilimit = AOMMIN(xd->n8_w, cols_remaining);
assert(ilimit > 0);
int mi_step;
const int neighbor_limit = max_neighbor_obmc[b_width_log2_lookup[bsize]]; const int neighbor_limit = max_neighbor_obmc[b_width_log2_lookup[bsize]];
int neighbor_count = 0; int neighbor_count = 0;
for (i = 0; i < ilimit; i += mi_step) { assert(miw > 0);
MB_MODE_INFO *above_mbmi = &xd->mi[i - 1 * xd->mi_stride]->mbmi;
mi_step = mi_size_wide[above_mbmi->sb_type]; i = 0;
do { // for each mi in the above row
int mi_col_offset = i;
MB_MODE_INFO *above_mbmi =
&xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi;
#if CONFIG_CHROMA_SUB8X8 #if CONFIG_CHROMA_SUB8X8
// With chroma-sub8x8, the chroma information is found to the right if (above_mbmi->sb_type < BLOCK_8X8) {
// (i.e. with odd mi_col) when blocks are narrower than 8x8. See ++mi_col_offset;
// av1_count_overlappable_neighbors for details. above_mbmi =
if (mi_step == 1 && ((mi_col + i) % 2 == 0)) { &xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi;
ilimit = AOMMIN(AOMMAX(ilimit, i + 1), cols_remaining);
continue;
} }
#endif #endif
const BLOCK_SIZE a_bsize = AOMMAX(BLOCK_8X8, above_mbmi->sb_type);
const int above_step =
AOMMIN(mi_size_wide[a_bsize], mi_size_wide[BLOCK_64X64]);
const int mi_step = AOMMIN(xd->n8_w, above_step);
if (is_neighbor_overlappable(above_mbmi)) { if (is_neighbor_overlappable(above_mbmi)) {
neighbor_count++; neighbor_count++;
if (neighbor_count > neighbor_limit) break; if (neighbor_count > neighbor_limit) break;
const int trunc_width = AOMMIN(xd->n8_w, mi_step);
for (plane = 0; plane < MAX_MB_PLANE; ++plane) { for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
const struct macroblockd_plane *pd = &xd->plane[plane]; const struct macroblockd_plane *pd = &xd->plane[plane];
const int bw = const int bw = (mi_step * MI_SIZE) >> pd->subsampling_x;
AOMMAX((trunc_width * MI_SIZE) >> pd->subsampling_x, 4);
const int bh = overlap >> pd->subsampling_y; const int bh = overlap >> pd->subsampling_y;
if (skip_u4x4_pred_in_obmc(bsize, pd, 0)) continue; if (skip_u4x4_pred_in_obmc(bsize, pd, 0)) continue;
...@@ -2085,44 +2092,46 @@ void av1_build_obmc_inter_prediction(const AV1_COMMON *cm, MACROBLOCKD *xd, ...@@ -2085,44 +2092,46 @@ void av1_build_obmc_inter_prediction(const AV1_COMMON *cm, MACROBLOCKD *xd,
tmp_stride, mask, bh, bw); tmp_stride, mask, bh, bw);
} }
} }
} i += mi_step;
} while (i < miw);
} }
// handle left column // handle left column
if (xd->left_available) { if (xd->left_available) {
const int overlap = const int overlap =
AOMMIN(block_size_wide[bsize] >> 1, block_size_wide[BLOCK_64X64] >> 1); AOMMIN(block_size_wide[bsize] >> 1, block_size_wide[BLOCK_64X64] >> 1);
const int mih = AOMMIN(xd->n8_h, cm->mi_rows - mi_row);
const int rows_remaining = cm->mi_rows - mi_row; const int mi_col_offset = -1;
int ilimit = AOMMIN(xd->n8_h, rows_remaining);
assert(ilimit > 0);
int mi_step;
const int neighbor_limit = max_neighbor_obmc[b_height_log2_lookup[bsize]]; const int neighbor_limit = max_neighbor_obmc[b_height_log2_lookup[bsize]];
int neighbor_count = 0; int neighbor_count = 0;
// for each mi in the left column assert(mih > 0);
for (i = 0; i < ilimit; i += mi_step) {
MB_MODE_INFO *left_mbmi = &xd->mi[-1 + i * xd->mi_stride]->mbmi; i = 0;
mi_step = mi_size_high[left_mbmi->sb_type]; do { // for each mi in the left column
int mi_row_offset = i;
MB_MODE_INFO *left_mbmi =
&xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi;
#if CONFIG_CHROMA_SUB8X8 #if CONFIG_CHROMA_SUB8X8
// With chroma-sub8x8, the chroma information is found in the lower half if (left_mbmi->sb_type < BLOCK_8X8) {
// (i.e. with odd mi_row) when blocks are shorter than 8x8. See ++mi_row_offset;
// av1_count_overlappable_neighbors for details. left_mbmi =
if (mi_step == 1 && ((mi_row + i) % 2 == 0)) { &xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi;
ilimit = AOMMIN(AOMMAX(ilimit, i + 1), rows_remaining);
continue;
} }
#endif #endif
const BLOCK_SIZE l_bsize = AOMMAX(BLOCK_8X8, left_mbmi->sb_type);
const int left_step =
AOMMIN(mi_size_high[l_bsize], mi_size_high[BLOCK_64X64]);
const int mi_step = AOMMIN(xd->n8_h, left_step);
if (is_neighbor_overlappable(left_mbmi)) { if (is_neighbor_overlappable(left_mbmi)) {
neighbor_count++; neighbor_count++;
if (neighbor_count > neighbor_limit) break; if (neighbor_count > neighbor_limit) break;
const int trunc_height = AOMMIN(xd->n8_h, mi_step);
for (plane = 0; plane < MAX_MB_PLANE; ++plane) { for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
const struct macroblockd_plane *pd = &xd->plane[plane]; const struct macroblockd_plane *pd = &xd->plane[plane];
const int bw = overlap >> pd->subsampling_x; const int bw = overlap >> pd->subsampling_x;
const int bh = const int bh = (mi_step * MI_SIZE) >> pd->subsampling_y;
AOMMAX((trunc_height * MI_SIZE) >> pd->subsampling_y, 4);
if (skip_u4x4_pred_in_obmc(bsize, pd, 1)) continue; if (skip_u4x4_pred_in_obmc(bsize, pd, 1)) continue;
...@@ -2144,7 +2153,8 @@ void av1_build_obmc_inter_prediction(const AV1_COMMON *cm, MACROBLOCKD *xd, ...@@ -2144,7 +2153,8 @@ void av1_build_obmc_inter_prediction(const AV1_COMMON *cm, MACROBLOCKD *xd,
tmp_stride, mask, bh, bw); tmp_stride, mask, bh, bw);
} }
} }
} i += mi_step;
} while (i < mih);
} }
} }
...@@ -2179,8 +2189,7 @@ void av1_build_prediction_by_above_preds(const AV1_COMMON *cm, MACROBLOCKD *xd, ...@@ -2179,8 +2189,7 @@ void av1_build_prediction_by_above_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
const TileInfo *const tile = &xd->tile; const TileInfo *const tile = &xd->tile;
BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type; BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type;
int i, j, mi_step, ref; int i, j, mi_step, ref;
const int cols_remaining = cm->mi_cols - mi_col; const int ilimit = AOMMIN(xd->n8_w, cm->mi_cols - mi_col);
int ilimit = AOMMIN(xd->n8_w, cols_remaining);
int mb_to_right_edge_base = xd->mb_to_right_edge; int mb_to_right_edge_base = xd->mb_to_right_edge;
const int neighbor_limit = max_neighbor_obmc[b_width_log2_lookup[bsize]]; const int neighbor_limit = max_neighbor_obmc[b_width_log2_lookup[bsize]];
int neighbor_count = 0; int neighbor_count = 0;
...@@ -2189,20 +2198,26 @@ void av1_build_prediction_by_above_preds(const AV1_COMMON *cm, MACROBLOCKD *xd, ...@@ -2189,20 +2198,26 @@ void av1_build_prediction_by_above_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
xd->mb_to_bottom_edge += xd->n8_h * 32; xd->mb_to_bottom_edge += xd->n8_h * 32;
for (i = 0; i < ilimit; i += mi_step) { for (i = 0; i < ilimit; i += mi_step) {
int mi_row_offset = -1;
int mi_col_offset = i;
int mi_x, mi_y, bw, bh; int mi_x, mi_y, bw, bh;
MB_MODE_INFO *above_mbmi = &xd->mi[i - 1 * xd->mi_stride]->mbmi; MODE_INFO *above_mi = xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride];
mi_step = mi_size_wide[above_mbmi->sb_type]; MB_MODE_INFO *above_mbmi = &above_mi->mbmi;
#if CONFIG_CHROMA_SUB8X8 #if CONFIG_CHROMA_SUB8X8
// See note in av1_count_overlappable_neighbors for how this works if (above_mbmi->sb_type < BLOCK_8X8) {
if (mi_step == 1 && ((mi_col + i) % 2 == 0)) { ++mi_col_offset;
ilimit = AOMMIN(AOMMAX(ilimit, i + 1), cols_remaining); above_mbmi = &xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi;
continue;
} }
#endif #endif
const BLOCK_SIZE a_bsize = AOMMAX(BLOCK_8X8, above_mbmi->sb_type); const BLOCK_SIZE a_bsize = AOMMAX(BLOCK_8X8, above_mbmi->sb_type);
MB_MODE_INFO backup_mbmi; MB_MODE_INFO backup_mbmi;
const int above_step =
AOMMIN(mi_size_wide[a_bsize], mi_size_wide[BLOCK_64X64]);
mi_step = AOMMIN(xd->n8_w, above_step);
if (!is_neighbor_overlappable(above_mbmi)) continue; if (!is_neighbor_overlappable(above_mbmi)) continue;
neighbor_count++; neighbor_count++;
...@@ -2244,16 +2259,13 @@ void av1_build_prediction_by_above_preds(const AV1_COMMON *cm, MACROBLOCKD *xd, ...@@ -2244,16 +2259,13 @@ 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_left_edge = -(((mi_col + i) * MI_SIZE) * 8);
xd->mb_to_right_edge = xd->mb_to_right_edge =
mb_to_right_edge_base + (xd->n8_w - AOMMIN(i + mi_step, xd->n8_w)) * 64; mb_to_right_edge_base + (xd->n8_w - i - mi_step) * 64;
mi_x = (mi_col + i) << MI_SIZE_LOG2; mi_x = (mi_col + i) << MI_SIZE_LOG2;
mi_y = mi_row << MI_SIZE_LOG2; mi_y = mi_row << MI_SIZE_LOG2;
int mi_row_offset = -1;
int mi_col_offset = i;
for (j = 0; j < MAX_MB_PLANE; ++j) { for (j = 0; j < MAX_MB_PLANE; ++j) {
const struct macroblockd_plane *pd = &xd->plane[j]; const struct macroblockd_plane *pd = &xd->plane[j];
bw = AOMMAX((mi_step * MI_SIZE) >> pd->subsampling_x, 4); bw = (mi_step * MI_SIZE) >> pd->subsampling_x;
bh = AOMMAX((num_4x4_blocks_high_lookup[bsize] * 2) >> pd->subsampling_y, bh = AOMMAX((num_4x4_blocks_high_lookup[bsize] * 2) >> pd->subsampling_y,
4); 4);
bh = AOMMIN(bh, block_size_high[BLOCK_64X64] >> (pd->subsampling_y + 1)); bh = AOMMIN(bh, block_size_high[BLOCK_64X64] >> (pd->subsampling_y + 1));
...@@ -2282,9 +2294,7 @@ void av1_build_prediction_by_left_preds(const AV1_COMMON *cm, MACROBLOCKD *xd, ...@@ -2282,9 +2294,7 @@ void av1_build_prediction_by_left_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
const TileInfo *const tile = &xd->tile; const TileInfo *const tile = &xd->tile;
BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type; BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type;
int i, j, mi_step, ref; int i, j, mi_step, ref;
const int ilimit = AOMMIN(xd->n8_h, cm->mi_rows - mi_row);
const int rows_remaining = cm->mi_rows - mi_row;
int ilimit = AOMMIN(xd->n8_h, rows_remaining);
int mb_to_bottom_edge_base = xd->mb_to_bottom_edge; int mb_to_bottom_edge_base = xd->mb_to_bottom_edge;
const int neighbor_limit = max_neighbor_obmc[b_height_log2_lookup[bsize]]; const int neighbor_limit = max_neighbor_obmc[b_height_log2_lookup[bsize]];
int neighbor_count = 0; int neighbor_count = 0;
...@@ -2293,19 +2303,24 @@ void av1_build_prediction_by_left_preds(const AV1_COMMON *cm, MACROBLOCKD *xd, ...@@ -2293,19 +2303,24 @@ void av1_build_prediction_by_left_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
xd->mb_to_right_edge += xd->n8_w * 32; xd->mb_to_right_edge += xd->n8_w * 32;
for (i = 0; i < ilimit; i += mi_step) { for (i = 0; i < ilimit; i += mi_step) {
int mi_row_offset = i;
int mi_col_offset = -1;
int mi_x, mi_y, bw, bh; int mi_x, mi_y, bw, bh;
MB_MODE_INFO *left_mbmi = &xd->mi[-1 + i * xd->mi_stride]->mbmi; MODE_INFO *left_mi = xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride];
mi_step = mi_size_high[left_mbmi->sb_type]; MB_MODE_INFO *left_mbmi = &left_mi->mbmi;
#if CONFIG_CHROMA_SUB8X8 #if CONFIG_CHROMA_SUB8X8
// See note in av1_count_overlappable_neighbors for how this works if (left_mbmi->sb_type < BLOCK_8X8) {
if (mi_step == 1 && ((mi_row + i) % 2 == 0)) { ++mi_row_offset;
ilimit = AOMMIN(AOMMAX(ilimit, i + 1), rows_remaining); left_mbmi = &xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi;
continue;
} }
#endif #endif
const BLOCK_SIZE l_bsize = AOMMAX(left_mbmi->sb_type, BLOCK_8X8); const BLOCK_SIZE l_bsize = AOMMAX(left_mbmi->sb_type, BLOCK_8X8);
MB_MODE_INFO backup_mbmi; MB_MODE_INFO backup_mbmi;
const int left_step =
AOMMIN(mi_size_high[l_bsize], mi_size_high[BLOCK_64X64]);
mi_step = AOMMIN(xd->n8_h, left_step);
if (!is_neighbor_overlappable(left_mbmi)) continue; if (!is_neighbor_overlappable(left_mbmi)) continue;
...@@ -2345,20 +2360,17 @@ void av1_build_prediction_by_left_preds(const AV1_COMMON *cm, MACROBLOCKD *xd, ...@@ -2345,20 +2360,17 @@ 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_top_edge = -(((mi_row + i) * MI_SIZE) * 8);
xd->mb_to_bottom_edge = mb_to_bottom_edge_base + xd->mb_to_bottom_edge =
(xd->n8_h - AOMMIN(i + mi_step, xd->n8_h)) * 64; mb_to_bottom_edge_base + (xd->n8_h - i - mi_step) * 64;
mi_x = mi_col << MI_SIZE_LOG2; mi_x = mi_col << MI_SIZE_LOG2;
mi_y = (mi_row + i) << MI_SIZE_LOG2; mi_y = (mi_row + i) << MI_SIZE_LOG2;
int mi_row_offset = i;
int mi_col_offset = -1;
for (j = 0; j < MAX_MB_PLANE; ++j) { for (j = 0; j < MAX_MB_PLANE; ++j) {
const struct macroblockd_plane *pd = &xd->plane[j]; const struct macroblockd_plane *pd = &xd->plane[j];
bw = AOMMAX((num_4x4_blocks_wide_lookup[bsize] * 2) >> pd->subsampling_x, bw = AOMMAX((num_4x4_blocks_wide_lookup[bsize] * 2) >> pd->subsampling_x,
4); 4);
bw = AOMMIN(bw, block_size_wide[BLOCK_64X64] >> (pd->subsampling_x + 1)); bw = AOMMIN(bw, block_size_wide[BLOCK_64X64] >> (pd->subsampling_x + 1));
bh = AOMMAX((mi_step << MI_SIZE_LOG2) >> pd->subsampling_y, 4); bh = (mi_step << MI_SIZE_LOG2) >> pd->subsampling_y;
if (skip_u4x4_pred_in_obmc(bsize, pd, 1)) continue; if (skip_u4x4_pred_in_obmc(bsize, pd, 1)) continue;
build_inter_predictors(cm, xd, j, mi_col_offset, mi_row_offset, 0, bw, bh, build_inter_predictors(cm, xd, j, mi_col_offset, mi_row_offset, 0, bw, bh,
......
...@@ -12466,6 +12466,7 @@ static void calc_target_weighted_pred(const AV1_COMMON *cm, const MACROBLOCK *x, ...@@ -12466,6 +12466,7 @@ static void calc_target_weighted_pred(const AV1_COMMON *cm, const MACROBLOCK *x,
const int overlap = const int overlap =
AOMMIN(block_size_high[bsize] >> 1, block_size_high[BLOCK_64X64] >> 1); AOMMIN(block_size_high[bsize] >> 1, block_size_high[BLOCK_64X64] >> 1);
const int miw = AOMMIN(xd->n8_w, cm->mi_cols - mi_col); const int miw = AOMMIN(xd->n8_w, cm->mi_cols - mi_col);
const int mi_row_offset = -1;
const uint8_t *const mask1d = av1_get_obmc_mask(overlap); const uint8_t *const mask1d = av1_get_obmc_mask(overlap);
const int neighbor_limit = max_neighbor_obmc[b_width_log2_lookup[bsize]]; const int neighbor_limit = max_neighbor_obmc[b_width_log2_lookup[bsize]];
int neighbor_count = 0; int neighbor_count = 0;
...@@ -12474,24 +12475,22 @@ static void calc_target_weighted_pred(const AV1_COMMON *cm, const MACROBLOCK *x, ...@@ -12474,24 +12475,22 @@ static void calc_target_weighted_pred(const AV1_COMMON *cm, const MACROBLOCK *x,
i = 0; i = 0;
do { // for each mi in the above row do { // for each mi in the above row
const MB_MODE_INFO *above_mbmi = &xd->mi[i + (-1) * xd->mi_stride]->mbmi; const int mi_col_offset = i;
const int above_width = mi_size_wide[above_mbmi->sb_type]; const MB_MODE_INFO *above_mbmi =
int above_step = AOMMIN(above_width, mi_size_wide[BLOCK_64X64]); &xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi;
#if CONFIG_CHROMA_SUB8X8 #if CONFIG_CHROMA_SUB8X8
// If the block above is narrower than 8x8 and starts at an even column, if (above_mbmi->sb_type < BLOCK_8X8)
// we need to skip right one to get to the block with the correct chroma above_mbmi =
// information. &xd->mi[mi_col_offset + 1 + mi_row_offset * xd->mi_stride]->mbmi;
if (above_width == 1 && ((mi_col + i) % 2 == 0)) {
above_mbmi = &xd->mi[i + 1 + (-1) * xd->mi_stride]->mbmi;
above_step = 2;
}
#endif #endif
const BLOCK_SIZE a_bsize = AOMMAX(above_mbmi->sb_type, BLOCK_8X8);
const int above_step =
AOMMIN(mi_size_wide[a_bsize], mi_size_wide[BLOCK_64X64]);
const int mi_step = AOMMIN(xd->n8_w, above_step); const int mi_step = AOMMIN(xd->n8_w, above_step);
const int neighbor_bw = mi_step * MI_SIZE; const int neighbor_bw = mi_step * MI_SIZE;
if (is_neighbor_overlappable(above_mbmi)) { if (is_neighbor_overlappable(above_mbmi)) {
if (!CONFIG_CB4X4 && above_width == mi_size_wide[BLOCK_4X4]) if (!CONFIG_CB4X4 && (a_bsize == BLOCK_4X4 || a_bsize == BLOCK_4X8))
neighbor_count += 2; neighbor_count += 2;
else else
neighbor_count++; neighbor_count++;
...@@ -12549,6 +12548,7 @@ static void calc_target_weighted_pred(const AV1_COMMON *cm, const MACROBLOCK *x, ...@@ -12549,6 +12548,7 @@ static void calc_target_weighted_pred(const AV1_COMMON *cm, const MACROBLOCK *x,
const int overlap = const int overlap =
AOMMIN(block_size_wide[bsize] >> 1, block_size_wide[BLOCK_64X64] >> 1); AOMMIN(block_size_wide[bsize] >> 1, block_size_wide[BLOCK_64X64] >> 1);
const int mih = AOMMIN(xd->n8_h, cm->mi_rows - mi_row); const int mih = AOMMIN(xd->n8_h, cm->mi_rows - mi_row);
const int mi_col_offset = -1;
const uint8_t *const mask1d = av1_get_obmc_mask(overlap); const uint8_t *const mask1d = av1_get_obmc_mask(overlap);
const int neighbor_limit = max_neighbor_obmc[b_height_log2_lookup[bsize]]; const int neighbor_limit = max_neighbor_obmc[b_height_log2_lookup[bsize]];
int neighbor_count = 0; int neighbor_count = 0;
...@@ -12557,23 +12557,23 @@ static void calc_target_weighted_pred(const AV1_COMMON *cm, const MACROBLOCK *x, ...@@ -12557,23 +12557,23 @@ static void calc_target_weighted_pred(const AV1_COMMON *cm, const MACROBLOCK *x,
i = 0; i = 0;
do { // for each mi in the left column do { // for each mi in the left column
const MB_MODE_INFO *left_mbmi = &xd->mi[-1 + i * xd->mi_stride]->mbmi; const int mi_row_offset = i;
const int left_height = mi_size_high[left_mbmi->sb_type]; MB_MODE_INFO *left_mbmi =
int left_step = AOMMIN(left_height, mi_size_high[BLOCK_64X64]); &xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi;
#if CONFIG_CHROMA_SUB8X8 #if CONFIG_CHROMA_SUB8X8
// If the block is shorter than 8x8 and starts on an even row, we need to if (left_mbmi->sb_type < BLOCK_8X8)
// skip down one to get to the block with the correct chroma information. left_mbmi =
if (left_height == 1 && ((mi_row + i) % 2 == 0)) { &xd->mi[mi_col_offset + (mi_row_offset + 1) * xd->mi_stride]->mbmi;
left_mbmi = &xd->mi[-1 + (i + 1) * xd->mi_stride]->mbmi;
left_step = 2;
}
#endif #endif
const BLOCK_SIZE l_bsize = AOMMAX(left_mbmi->sb_type, BLOCK_8X8);
const int left_step =
AOMMIN(mi_size_high[l_bsize], mi_size_high[BLOCK_64X64]);
const int mi_step = AOMMIN(xd->n8_h, left_step); const int mi_step = AOMMIN(xd->n8_h, left_step);
const int neighbor_bh = mi_step * MI_SIZE; const int neighbor_bh = mi_step * MI_SIZE;
if (is_neighbor_overlappable(left_mbmi)) { if (is_neighbor_overlappable(left_mbmi)) {
if (!CONFIG_CB4X4 && (left_height == mi_size_wide[BLOCK_4X4])) if (!CONFIG_CB4X4 && (l_bsize == BLOCK_4X4 || l_bsize == BLOCK_8X4))
neighbor_count += 2; neighbor_count += 2;
else else
neighbor_count++; neighbor_count++;
......
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