Fix for ext_interp experiment
Amends previous commit to also handle subsampling correctly.
Change ID of prev commit: I6b07e6cf9b287ba4b5bd6599af4a7412e50b3bdc
Was causing occassional failures for 422 streams due to accessing
elements beyond the extent of the bmi array.
Change-Id: I37ebabf4c01ca84bcd1851428172bdf753805d98
diff --git a/vp10/common/reconinter.c b/vp10/common/reconinter.c
index 5175389..9c0cbab 100644
--- a/vp10/common/reconinter.c
+++ b/vp10/common/reconinter.c
@@ -1098,7 +1098,7 @@
const int bh = 4 * num_4x4_h;
if (xd->mi[0]->mbmi.sb_type < BLOCK_8X8) {
- int i = 0, x, y;
+ int x, y;
assert(bsize == BLOCK_8X8);
for (y = 0; y < num_4x4_h; ++y)
for (x = 0; x < num_4x4_w; ++x)
@@ -1107,7 +1107,7 @@
#if CONFIG_OBMC
0, 0,
#endif // CONFIG_OBMC
- i++, bw, bh, 4 * x, 4 * y, 4, 4,
+ y * 2 + x, bw, bh, 4 * x, 4 * y, 4, 4,
#if CONFIG_EXT_INTER
wedge_offset_x >> (xd->plane[plane].subsampling_x),
wedge_offset_y >> (xd->plane[plane].subsampling_y),
@@ -2067,12 +2067,12 @@
const int bh = 4 * num_4x4_h;
if (xd->mi[0]->mbmi.sb_type < BLOCK_8X8) {
- int i = 0, x, y;
+ int x, y;
assert(bsize == BLOCK_8X8);
for (y = 0; y < num_4x4_h; ++y)
for (x = 0; x < num_4x4_w; ++x)
build_inter_predictors_single_buf(xd, plane,
- i++, bw, bh,
+ y * 2 + x, bw, bh,
4 * x, 4 * y, 4, 4,
mi_x, mi_y, ref,
ext_dst[plane],
diff --git a/vp10/common/reconinter.h b/vp10/common/reconinter.h
index 4dcd203..84ab944 100644
--- a/vp10/common/reconinter.h
+++ b/vp10/common/reconinter.h
@@ -331,7 +331,7 @@
MB_MODE_INFO *const mbmi = &mi->mbmi;
const BLOCK_SIZE bsize = mbmi->sb_type;
const int is_compound = has_second_ref(mbmi);
- int intpel_mv;
+ int intpel_mv = 1;
int plane;
#if SUPPORT_NONINTERPOLATING_FILTERS
@@ -351,65 +351,26 @@
if (is_compound && vp10_is_scaled(&xd->block_refs[1]->sf))
return 1;
- if (bsize == BLOCK_4X4) {
- for (plane = 0; plane < 2; ++plane) {
+ if (bsize < BLOCK_8X8) {
+ for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
+ const PARTITION_TYPE bp = BLOCK_8X8 - bsize;
const struct macroblockd_plane *const pd = &xd->plane[plane];
- MV mv0 = average_split_mvs(pd, mi, 0, 0);
- MV mv1 = average_split_mvs(pd, mi, 0, 1);
- MV mv2 = average_split_mvs(pd, mi, 0, 2);
- MV mv3 = average_split_mvs(pd, mi, 0, 3);
- intpel_mv =
- !mv_has_subpel(&mv0) &&
- !mv_has_subpel(&mv1) &&
- !mv_has_subpel(&mv2) &&
- !mv_has_subpel(&mv3);
- if (is_compound && intpel_mv) {
- mv0 = average_split_mvs(pd, mi, 1, 0);
- mv1 = average_split_mvs(pd, mi, 1, 1);
- mv2 = average_split_mvs(pd, mi, 1, 2);
- mv3 = average_split_mvs(pd, mi, 1, 3);
- intpel_mv =
- !mv_has_subpel(&mv0) &&
- !mv_has_subpel(&mv1) &&
- !mv_has_subpel(&mv2) &&
- !mv_has_subpel(&mv3);
+ const int have_vsplit = bp != PARTITION_HORZ;
+ const int have_hsplit = bp != PARTITION_VERT;
+ const int num_4x4_w = 2 >> ((!have_vsplit) | pd->subsampling_x);
+ const int num_4x4_h = 2 >> ((!have_hsplit) | pd->subsampling_y);
+ int ref;
+ for (ref = 0; ref < 1 + is_compound; ++ref) {
+ int x, y;
+ for (y = 0; y < num_4x4_h; ++y)
+ for (x = 0; x < num_4x4_w; ++x) {
+ const MV mv = average_split_mvs(pd, mi, ref, y * 2 + x);
+ if (mv_has_subpel(&mv))
+ return 1;
+ }
}
- if (!intpel_mv) break;
}
- } else if (bsize == BLOCK_4X8) {
- for (plane = 0; plane < 2; ++plane) {
- const struct macroblockd_plane *const pd = &xd->plane[plane];
- MV mv0 = average_split_mvs(pd, mi, 0, 0);
- MV mv1 = average_split_mvs(pd, mi, 0, 1);
- intpel_mv =
- !mv_has_subpel(&mv0) &&
- !mv_has_subpel(&mv1);
- if (is_compound && intpel_mv) {
- mv0 = average_split_mvs(pd, mi, 1, 0);
- mv1 = average_split_mvs(pd, mi, 1, 1);
- intpel_mv =
- !mv_has_subpel(&mv0) &&
- !mv_has_subpel(&mv1);
- }
- if (!intpel_mv) break;
- }
- } else if (bsize == BLOCK_8X4) {
- for (plane = 0; plane < 2; ++plane) {
- const struct macroblockd_plane *const pd = &xd->plane[plane];
- MV mv0 = average_split_mvs(pd, mi, 0, 0);
- MV mv1 = average_split_mvs(pd, mi, 0, 2);
- intpel_mv =
- !mv_has_subpel(&mv0) &&
- !mv_has_subpel(&mv1);
- if (is_compound && intpel_mv) {
- mv0 = average_split_mvs(pd, mi, 1, 0);
- mv1 = average_split_mvs(pd, mi, 1, 2);
- intpel_mv =
- !mv_has_subpel(&mv0) &&
- !mv_has_subpel(&mv1);
- }
- if (!intpel_mv) break;
- }
+ return 0;
} else {
intpel_mv = !mv_has_subpel(&mbmi->mv[0].as_mv);
if (is_compound && intpel_mv) {