Commit 8e689e4b authored by Yue Chen's avatar Yue Chen

supertx: code refactoring + resolve conflicts with baseline

Refactoring: split prediction+extension for each plane, so we can
handle luma/chroma supertx pred in different ways.
Compatibility fix: fix conflicts with cb4x4 and chroma_sub8x8, now
for chroma sub8x8 supertx, only the top-left(basic cb4x4) or the
the bottom-right(cb4x4 + chroma_sub8x8) predictor will be used
without any blending within a 8x8 unit.

Change-Id: I6cf7b12768a82d3c7e01811ada02de84af9bd8ac
parent 67e15578
......@@ -758,6 +758,20 @@ static INLINE int is_chroma_reference(int mi_row, int mi_col, BLOCK_SIZE bsize,
#endif
}
#if CONFIG_SUPERTX
static INLINE int need_handle_chroma_sub8x8(BLOCK_SIZE bsize, int subsampling_x,
int subsampling_y) {
const int bw = mi_size_wide[bsize];
const int bh = mi_size_high[bsize];
if (bsize >= BLOCK_8X8 ||
((!(bh & 0x01) || !subsampling_y) && (!(bw & 0x01) || !subsampling_x)))
return 0;
else
return 1;
}
#endif
static INLINE BLOCK_SIZE scale_chroma_bsize(BLOCK_SIZE bsize, int subsampling_x,
int subsampling_y) {
BLOCK_SIZE bs = bsize;
......
......@@ -1580,19 +1580,19 @@ void av1_build_masked_inter_predictor_complex(
} while (--h_remain);
}
void av1_build_inter_predictors_sb_sub8x8_extend(const AV1_COMMON *cm,
void av1_build_inter_predictor_sb_sub8x8_extend(const AV1_COMMON *cm,
MACROBLOCKD *xd,
#if CONFIG_EXT_INTER
int mi_row_ori, int mi_col_ori,
#endif // CONFIG_EXT_INTER
int mi_row, int mi_col,
BLOCK_SIZE bsize, int block) {
int plane, BLOCK_SIZE bsize,
int block) {
// Prediction function used in supertx:
// Use the mv at current block (which is less than 8x8)
// to get prediction of a block located at (mi_row, mi_col) at size of bsize
// bsize can be larger than 8x8.
// block (0-3): the sub8x8 location of current block
int plane;
const int mi_x = mi_col * MI_SIZE;
const int mi_y = mi_row * MI_SIZE;
#if CONFIG_EXT_INTER
......@@ -1603,10 +1603,9 @@ void av1_build_inter_predictors_sb_sub8x8_extend(const AV1_COMMON *cm,
// For sub8x8 uv:
// Skip uv prediction in supertx except the first block (block = 0)
int max_plane = block ? 1 : MAX_MB_PLANE;
if (plane >= max_plane) return;
for (plane = 0; plane < max_plane; plane++) {
const BLOCK_SIZE plane_bsize =
get_plane_block_size(bsize, &xd->plane[plane]);
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, &xd->plane[plane]);
const int num_4x4_w = num_4x4_blocks_wide_lookup[plane_bsize];
const int num_4x4_h = num_4x4_blocks_high_lookup[plane_bsize];
const int bw = 4 * num_4x4_w;
......@@ -1621,37 +1620,21 @@ void av1_build_inter_predictors_sb_sub8x8_extend(const AV1_COMMON *cm,
wedge_offset_x, wedge_offset_y,
#endif // CONFIG_EXT_INTER
mi_x, mi_y);
}
#if CONFIG_EXT_INTER
if (is_interintra_pred(&xd->mi[0]->mbmi)) {
BUFFER_SET ctx = { { xd->plane[0].dst.buf, xd->plane[1].dst.buf,
xd->plane[2].dst.buf },
{ xd->plane[0].dst.stride, xd->plane[1].dst.stride,
xd->plane[2].dst.stride } };
av1_build_interintra_predictors(
xd, xd->plane[0].dst.buf, xd->plane[1].dst.buf, xd->plane[2].dst.buf,
xd->plane[0].dst.stride, xd->plane[1].dst.stride,
xd->plane[2].dst.stride, &ctx, bsize);
}
#endif // CONFIG_EXT_INTER
}
void av1_build_inter_predictors_sb_extend(const AV1_COMMON *cm, MACROBLOCKD *xd,
void av1_build_inter_predictor_sb_extend(const AV1_COMMON *cm, MACROBLOCKD *xd,
#if CONFIG_EXT_INTER
int mi_row_ori, int mi_col_ori,
#endif // CONFIG_EXT_INTER
int mi_row, int mi_col,
int mi_row, int mi_col, int plane,
BLOCK_SIZE bsize) {
int plane;
const int mi_x = mi_col * MI_SIZE;
const int mi_y = mi_row * MI_SIZE;
#if CONFIG_EXT_INTER
const int wedge_offset_x = (mi_col_ori - mi_col) * MI_SIZE;
const int wedge_offset_y = (mi_row_ori - mi_row) * MI_SIZE;
#endif // CONFIG_EXT_INTER
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
const BLOCK_SIZE plane_bsize =
get_plane_block_size(bsize, &xd->plane[plane]);
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, &xd->plane[plane]);
const int bw = block_size_wide[plane_bsize];
const int bh = block_size_high[plane_bsize];
......@@ -1664,7 +1647,6 @@ void av1_build_inter_predictors_sb_extend(const AV1_COMMON *cm, MACROBLOCKD *xd,
wedge_offset_x, wedge_offset_y,
#endif // CONFIG_EXT_INTER
mi_x, mi_y);
}
}
#endif // CONFIG_SUPERTX
......
......@@ -547,19 +547,20 @@ void av1_build_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCKD *xd,
BLOCK_SIZE bsize);
#if CONFIG_SUPERTX
void av1_build_inter_predictors_sb_sub8x8_extend(const AV1_COMMON *cm,
void av1_build_inter_predictor_sb_sub8x8_extend(const AV1_COMMON *cm,
MACROBLOCKD *xd,
#if CONFIG_EXT_INTER
int mi_row_ori, int mi_col_ori,
#endif // CONFIG_EXT_INTER
int mi_row, int mi_col,
BLOCK_SIZE bsize, int block);
int plane, BLOCK_SIZE bsize,
int block);
void av1_build_inter_predictors_sb_extend(const AV1_COMMON *cm, MACROBLOCKD *xd,
void av1_build_inter_predictor_sb_extend(const AV1_COMMON *cm, MACROBLOCKD *xd,
#if CONFIG_EXT_INTER
int mi_row_ori, int mi_col_ori,
#endif // CONFIG_EXT_INTER
int mi_row, int mi_col,
int mi_row, int mi_col, int plane,
BLOCK_SIZE bsize);
struct macroblockd_plane;
void av1_build_masked_inter_predictor_complex(
......
This diff is collapsed.
This diff is collapsed.
......@@ -1455,7 +1455,9 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
int64_t rd1, rd2, rd;
RD_STATS this_rd_stats;
#if !CONFIG_SUPERTX
assert(tx_size == get_tx_size(plane, xd));
#endif // !CONFIG_SUPERTX
av1_init_rd_stats(&this_rd_stats);
......
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