Commit 1cc50bc2 authored by Rupert Swarbrick's avatar Rupert Swarbrick

Deal correctly with 16x4/4x16 blocks in mvref_common.c

The logic that searches for motion vectors in scan_row_mbmi and
scan_col_mbmi steps in 4x4 units when the block size is less than
8x8. That test (bsize < BLOCK_8X8) doesn't work when you have 16X4 or
4X16 blocks, because they appear higher up in the enum.

Change-Id: Idb1a97f8a43b675fd78dbc76ae501fcdff7adbcd
parent a772ae72
......@@ -162,9 +162,11 @@ static uint8_t scan_row_mbmi(const AV1_COMMON *cm, const MACROBLOCKD *xd,
int col_offset = 0;
#if CONFIG_CB4X4
const int bsize = xd->mi[0]->mbmi.sb_type;
const int mi_offset = bsize < BLOCK_8X8 || abs(row_offset) > 1
? mi_size_wide[BLOCK_4X4]
: mi_size_wide[BLOCK_8X8];
const int mi_width = mi_size_wide[bsize];
const int mi_col_offset =
((abs(row_offset) > 1) || (mi_width < mi_size_wide[BLOCK_8X8]))
? mi_size_wide[BLOCK_4X4]
: mi_size_wide[BLOCK_8X8];
// TODO(jingning): Revisit this part after cb4x4 is stable.
if (abs(row_offset) > 1) {
row_offset *= 2;
......@@ -172,13 +174,12 @@ static uint8_t scan_row_mbmi(const AV1_COMMON *cm, const MACROBLOCKD *xd,
col_offset = 1;
if (bsize < BLOCK_8X8) {
if (mi_row & 0x01) row_offset += 1;
if (mi_col & 0x01) col_offset -= 1;
}
if (mi_row & 0x01 && mi_size_high[bsize] < mi_size_high[BLOCK_8X8])
++row_offset;
if (mi_col & 0x01 && mi_width < mi_size_wide[BLOCK_8X8]) --col_offset;
}
#else
const int mi_offset = mi_size_wide[BLOCK_8X8];
const int mi_col_offset = mi_size_wide[BLOCK_8X8];
#endif
for (i = 0; i < xd->n8_w && *refmv_count < MAX_REF_MV_STACK_SIZE;) {
......@@ -204,9 +205,9 @@ static uint8_t scan_row_mbmi(const AV1_COMMON *cm, const MACROBLOCKD *xd,
i += len;
} else {
if (use_step_16)
i += (mi_offset << 1);
i += (mi_col_offset << 1);
else
i += mi_offset;
i += mi_col_offset;
}
}
......@@ -223,22 +224,23 @@ static uint8_t scan_col_mbmi(const AV1_COMMON *cm, const MACROBLOCKD *xd,
int row_offset = 0;
#if CONFIG_CB4X4
const BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type;
const int mi_offset = (bsize < BLOCK_8X8) || (abs(col_offset) > 1)
? mi_size_high[BLOCK_4X4]
: mi_size_high[BLOCK_8X8];
const int mi_height = mi_size_high[bsize];
const int mi_row_offset =
((abs(col_offset) > 1) || (mi_height < mi_size_high[BLOCK_8X8]))
? mi_size_high[BLOCK_4X4]
: mi_size_high[BLOCK_8X8];
if (abs(col_offset) > 1) {
col_offset *= 2;
col_offset += 1;
row_offset = 1;
if (bsize < BLOCK_8X8) {
if (mi_row & 0x01) row_offset -= 1;
if (mi_col & 0x01) col_offset += 1;
}
if (mi_row & 0x01 && mi_height < mi_size_high[BLOCK_8X8]) --row_offset;
if (mi_col & 0x01 && mi_size_wide[bsize] < mi_size_wide[BLOCK_8X8])
++col_offset;
}
#else
const int mi_offset = mi_size_wide[BLOCK_8X8];
const int mi_row_offset = mi_size_wide[BLOCK_8X8];
#endif
for (i = 0; i < xd->n8_h && *refmv_count < MAX_REF_MV_STACK_SIZE;) {
......@@ -264,9 +266,9 @@ static uint8_t scan_col_mbmi(const AV1_COMMON *cm, const MACROBLOCKD *xd,
i += len;
} else {
if (use_step_16)
i += (mi_offset << 1);
i += (mi_row_offset << 1);
else
i += mi_offset;
i += mi_row_offset;
}
}
......
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