Commit 9fa96234 authored by Hui Su's avatar Hui Su
Browse files

Remove experimental flag of chroma_sub8x8

Change-Id: I32c5015bedef07f58413c679b4aaf30651a357b9
parent 6e6b6974
......@@ -385,11 +385,9 @@ static const uint64_t above_64x64_txform_mask[TX_SIZES] = {
// 00000000
// 00000000
static const uint64_t left_prediction_mask[BLOCK_SIZES_ALL] = {
#if CONFIG_CHROMA_SUB8X8
0x0000000000000001ULL, // BLOCK_2X2,
0x0000000000000001ULL, // BLOCK_2X4,
0x0000000000000001ULL, // BLOCK_4X2,
#endif
0x0000000000000001ULL, // BLOCK_4X4,
0x0000000000000001ULL, // BLOCK_4X8,
0x0000000000000001ULL, // BLOCK_8X4,
......@@ -413,11 +411,9 @@ static const uint64_t left_prediction_mask[BLOCK_SIZES_ALL] = {
// 64 bit mask to shift and set for each prediction size.
static const uint64_t above_prediction_mask[BLOCK_SIZES_ALL] = {
#if CONFIG_CHROMA_SUB8X8
0x0000000000000001ULL, // BLOCK_2X2
0x0000000000000001ULL, // BLOCK_2X4
0x0000000000000001ULL, // BLOCK_4X2
#endif
0x0000000000000001ULL, // BLOCK_4X4
0x0000000000000001ULL, // BLOCK_4X8
0x0000000000000001ULL, // BLOCK_8X4
......@@ -442,11 +438,9 @@ static const uint64_t above_prediction_mask[BLOCK_SIZES_ALL] = {
// each 8x8 block that would be in the top left most block of the given block
// size in the 64x64 block.
static const uint64_t size_mask[BLOCK_SIZES_ALL] = {
#if CONFIG_CHROMA_SUB8X8
0x0000000000000001ULL, // BLOCK_2X2
0x0000000000000001ULL, // BLOCK_2X4
0x0000000000000001ULL, // BLOCK_4X2
#endif
0x0000000000000001ULL, // BLOCK_4X4
0x0000000000000001ULL, // BLOCK_4X8
0x0000000000000001ULL, // BLOCK_8X4
......@@ -495,11 +489,9 @@ static const uint16_t above_64x64_txform_mask_uv[TX_SIZES] = {
// 16 bit left mask to shift and set for each uv prediction size.
static const uint16_t left_prediction_mask_uv[BLOCK_SIZES_ALL] = {
#if CONFIG_CHROMA_SUB8X8
0x0001, // BLOCK_2X2,
0x0001, // BLOCK_2X4,
0x0001, // BLOCK_4X2,
#endif
0x0001, // BLOCK_4X4,
0x0001, // BLOCK_4X8,
0x0001, // BLOCK_8X4,
......@@ -523,11 +515,9 @@ static const uint16_t left_prediction_mask_uv[BLOCK_SIZES_ALL] = {
// 16 bit above mask to shift and set for uv each prediction size.
static const uint16_t above_prediction_mask_uv[BLOCK_SIZES_ALL] = {
#if CONFIG_CHROMA_SUB8X8
0x0001, // BLOCK_2X2
0x0001, // BLOCK_2X4
0x0001, // BLOCK_4X2
#endif
0x0001, // BLOCK_4X4
0x0001, // BLOCK_4X8
0x0001, // BLOCK_8X4
......@@ -551,11 +541,9 @@ static const uint16_t above_prediction_mask_uv[BLOCK_SIZES_ALL] = {
// 64 bit mask to shift and set for each uv prediction size
static const uint16_t size_mask_uv[BLOCK_SIZES_ALL] = {
#if CONFIG_CHROMA_SUB8X8
0x0001, // BLOCK_2X2
0x0001, // BLOCK_2X4
0x0001, // BLOCK_4X2
#endif
0x0001, // BLOCK_4X4
0x0001, // BLOCK_4X8
0x0001, // BLOCK_8X4
......@@ -2144,12 +2132,8 @@ static void get_filter_level_and_masks_non420(
(blk_row * mi_size_high[BLOCK_8X8] << TX_UNIT_HIGH_LOG2) >> 1;
const int tx_col_idx =
(blk_col * mi_size_wide[BLOCK_8X8] << TX_UNIT_WIDE_LOG2) >> 1;
#if CONFIG_CHROMA_SUB8X8
const BLOCK_SIZE bsize =
AOMMAX(BLOCK_4X4, get_plane_block_size(mbmi->sb_type, plane));
#else
const BLOCK_SIZE bsize = get_plane_block_size(mbmi->sb_type, plane);
#endif
const TX_SIZE mb_tx_size = mbmi->inter_tx_size[tx_row_idx][tx_col_idx];
tx_size = (plane->plane_type == PLANE_TYPE_UV)
? uv_txsize_lookup[bsize][mb_tx_size][0][0]
......@@ -2628,11 +2612,9 @@ typedef enum EDGE_DIR { VERT_EDGE = 0, HORZ_EDGE = 1, NUM_EDGE_DIRS } EDGE_DIR;
static const uint32_t av1_prediction_masks[NUM_EDGE_DIRS][BLOCK_SIZES_ALL] = {
// mask for vertical edges filtering
{
#if CONFIG_CHROMA_SUB8X8
2 - 1, // BLOCK_2X2
2 - 1, // BLOCK_2X4
4 - 1, // BLOCK_4X2
#endif // CONFIG_CHROMA_SUB8X8
4 - 1, // BLOCK_4X4
4 - 1, // BLOCK_4X8
8 - 1, // BLOCK_8X4
......@@ -2664,11 +2646,9 @@ static const uint32_t av1_prediction_masks[NUM_EDGE_DIRS][BLOCK_SIZES_ALL] = {
},
// mask for horizontal edges filtering
{
#if CONFIG_CHROMA_SUB8X8
2 - 1, // BLOCK_2X2
4 - 1, // BLOCK_2X4
2 - 1, // BLOCK_4X2
#endif // CONFIG_CHROMA_SUB8X8
4 - 1, // BLOCK_4X4
8 - 1, // BLOCK_4X8
4 - 1, // BLOCK_8X4
......@@ -2779,13 +2759,8 @@ static TX_SIZE av1_get_transform_size(const MODE_INFO *const mi,
(blk_row * mi_size_high[BLOCK_8X8] << TX_UNIT_HIGH_LOG2) >> 1;
const int tx_col_idx =
(blk_col * mi_size_wide[BLOCK_8X8] << TX_UNIT_WIDE_LOG2) >> 1;
#if CONFIG_CHROMA_SUB8X8
const BLOCK_SIZE bsize =
AOMMAX(BLOCK_4X4, ss_size_lookup[sb_type][scale_horz][scale_vert]);
#else
const BLOCK_SIZE bsize = ss_size_lookup[sb_type][scale_horz][scale_vert];
#endif
const TX_SIZE mb_tx_size = mbmi->inter_tx_size[tx_row_idx][tx_col_idx];
assert(mb_tx_size < TX_SIZES_ALL);
......
......@@ -128,12 +128,8 @@ void av1_foreach_transformed_block_in_plane(
// 4x4=0, 8x8=2, 16x16=4, 32x32=6, 64x64=8
// transform size varies per plane, look it up in a common way.
const TX_SIZE tx_size = av1_get_tx_size(plane, xd);
#if CONFIG_CHROMA_SUB8X8
const BLOCK_SIZE plane_bsize =
AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd));
#else
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
#endif
const uint8_t txw_unit = tx_size_wide_unit[tx_size];
const uint8_t txh_unit = tx_size_high_unit[tx_size];
const int step = txw_unit * txh_unit;
......@@ -235,12 +231,8 @@ void av1_reset_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col,
nplanes = 1 + (MAX_MB_PLANE - 1) * chroma_ref;
for (i = 0; i < nplanes; i++) {
struct macroblockd_plane *const pd = &xd->plane[i];
#if CONFIG_CHROMA_SUB8X8
const BLOCK_SIZE plane_bsize =
AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd));
#else
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
#endif
const int txs_wide = block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
const int txs_high = block_size_high[plane_bsize] >> tx_size_high_log2[0];
memset(pd->above_context, 0, sizeof(ENTROPY_CONTEXT) * txs_wide);
......
......@@ -31,12 +31,6 @@
extern "C" {
#endif
#if (CONFIG_CHROMA_SUB8X8)
#define SUB8X8_COMP_REF 0
#else
#define SUB8X8_COMP_REF 1
#endif
#define MAX_MB_PLANE 3
#if CONFIG_COMPOUND_SEGMENT
......@@ -72,11 +66,7 @@ typedef enum {
static INLINE int is_comp_ref_allowed(BLOCK_SIZE bsize) {
(void)bsize;
#if SUB8X8_COMP_REF
return 1;
#else
return AOMMIN(block_size_wide[bsize], block_size_high[bsize]) >= 8;
#endif // SUB8X8_COMP_REF
}
static INLINE int is_inter_mode(PREDICTION_MODE mode) {
......@@ -611,11 +601,11 @@ typedef struct {
#endif // CONFIG_LOOP_RESTORATION
#if CONFIG_CFL
#if CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG
#if CONFIG_DEBUG
#define CFL_SUB8X8_VAL_MI_SIZE (4)
#define CFL_SUB8X8_VAL_MI_SQUARE \
(CFL_SUB8X8_VAL_MI_SIZE * CFL_SUB8X8_VAL_MI_SIZE)
#endif // CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG
#endif // CONFIG_DEBUG
typedef struct cfl_ctx {
// The CfL prediction buffer is used in two steps:
// 1. Stores Q3 reconstructed luma pixels
......@@ -644,12 +634,12 @@ typedef struct cfl_ctx {
int store_y;
int is_chroma_reference;
#if CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG
#if CONFIG_DEBUG
// The prediction used for sub8x8 blocks originates from multiple luma blocks,
// this array is used to validate that cfl_store() is called only once for
// each luma block
uint8_t sub8x8_val[CFL_SUB8X8_VAL_MI_SQUARE];
#endif // CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG
#endif // CONFIG_DEBUG
} CFL_CTX;
#endif // CONFIG_CFL
......@@ -671,10 +661,8 @@ typedef struct macroblockd {
int up_available;
int left_available;
#if CONFIG_CHROMA_SUB8X8
int chroma_up_available;
int chroma_left_available;
#endif
const aom_prob (*partition_probs)[PARTITION_TYPES - 1];
......@@ -1027,11 +1015,9 @@ static INLINE int is_lgt_allowed(PREDICTION_MODE mode, TX_SIZE tx_size) {
#if CONFIG_RECT_TX
static INLINE int is_rect_tx_allowed_bsize(BLOCK_SIZE bsize) {
static const char LUT[BLOCK_SIZES_ALL] = {
#if CONFIG_CHROMA_SUB8X8
0, // BLOCK_2X2
0, // BLOCK_2X4
0, // BLOCK_4X2
#endif
0, // BLOCK_4X4
1, // BLOCK_4X8
1, // BLOCK_8X4
......@@ -1076,11 +1062,9 @@ static INLINE int is_rect_tx_allowed(const MACROBLOCKD *xd,
#if CONFIG_RECT_TX_EXT
static INLINE int is_quarter_tx_allowed_bsize(BLOCK_SIZE bsize) {
static const char LUT_QTTX[BLOCK_SIZES_ALL] = {
#if CONFIG_CHROMA_SUB8X8
0, // BLOCK_2X2
0, // BLOCK_2X4
0, // BLOCK_4X2
#endif
0, // BLOCK_4X4
0, // BLOCK_4X8
0, // BLOCK_8X4
......
......@@ -24,9 +24,9 @@ void cfl_init(CFL_CTX *cfl, AV1_COMMON *cm) {
cfl->subsampling_y = cm->subsampling_y;
cfl->are_parameters_computed = 0;
cfl->store_y = 0;
#if CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG
#if CONFIG_DEBUG
cfl_clear_sub8x8_val(cfl);
#endif // CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG
#endif // CONFIG_DEBUG
}
// Due to frame boundary issues, it is possible that the total area covered by
......@@ -169,20 +169,16 @@ static void cfl_dc_pred(MACROBLOCKD *xd, BLOCK_SIZE plane_bsize) {
int sum_u = 0;
int sum_v = 0;
// Match behavior of build_intra_predictors_high (reconintra.c) at superblock
// boundaries:
// base-1 base-1 base-1 .. base-1 base-1 base-1 base-1 base-1 base-1
// base+1 A B .. Y Z
// base+1 C D .. W X
// base+1 E F .. U V
// base+1 G H .. S T T T T T
// ..
// Match behavior of build_intra_predictors_high (reconintra.c) at superblock
// boundaries:
// base-1 base-1 base-1 .. base-1 base-1 base-1 base-1 base-1 base-1
// base+1 A B .. Y Z
// base+1 C D .. W X
// base+1 E F .. U V
// base+1 G H .. S T T T T T
// ..
#if CONFIG_CHROMA_SUB8X8
if (xd->chroma_up_available && xd->mb_to_right_edge >= 0) {
#else
if (xd->up_available && xd->mb_to_right_edge >= 0) {
#endif
sum_above_row(xd, width, &sum_u, &sum_v);
} else {
const int base = 128 << (xd->bd - 8);
......@@ -190,11 +186,7 @@ static void cfl_dc_pred(MACROBLOCKD *xd, BLOCK_SIZE plane_bsize) {
sum_v = width * (base - 1);
}
#if CONFIG_CHROMA_SUB8X8
if (xd->chroma_left_available && xd->mb_to_bottom_edge >= 0) {
#else
if (xd->left_available && xd->mb_to_bottom_edge >= 0) {
#endif
sum_left_col(xd, height, &sum_u, &sum_v);
} else {
const int base = 128 << (xd->bd - 8);
......@@ -454,7 +446,6 @@ static INLINE void cfl_store(CFL_CTX *cfl, const uint8_t *input,
}
}
#if CONFIG_CHROMA_SUB8X8
// Adjust the row and column of blocks smaller than 8X8, as chroma-referenced
// and non-chroma-referenced blocks are stored together in the CfL buffer.
static INLINE void sub8x8_adjust_offset(const CFL_CTX *cfl, int *row_out,
......@@ -485,7 +476,6 @@ static INLINE void sub8x8_set_val(CFL_CTX *cfl, int row, int col, int val_high,
}
}
#endif // CONFIG_DEBUG
#endif // CONFIG_CHROMA_SUB8X8
void cfl_store_tx(MACROBLOCKD *const xd, int row, int col, TX_SIZE tx_size,
BLOCK_SIZE bsize) {
......@@ -494,8 +484,6 @@ void cfl_store_tx(MACROBLOCKD *const xd, int row, int col, TX_SIZE tx_size,
uint8_t *dst =
&pd->dst.buf[(row * pd->dst.stride + col) << tx_size_wide_log2[0]];
(void)bsize;
#if CONFIG_CHROMA_SUB8X8
if (block_size_high[bsize] == 4 || block_size_wide[bsize] == 4) {
// Only dimensions of size 4 can have an odd offset.
assert(!((col & 1) && tx_size_wide[tx_size] != 4));
......@@ -506,7 +494,6 @@ void cfl_store_tx(MACROBLOCKD *const xd, int row, int col, TX_SIZE tx_size,
tx_size_wide_unit[tx_size]);
#endif // CONFIG_DEBUG
}
#endif
cfl_store(cfl, dst, pd->dst.stride, row, col, tx_size_wide[tx_size],
tx_size_high[tx_size], get_bitdepth_data_path_index(xd));
}
......@@ -516,7 +503,6 @@ void cfl_store_block(MACROBLOCKD *const xd, BLOCK_SIZE bsize, TX_SIZE tx_size) {
struct macroblockd_plane *const pd = &xd->plane[AOM_PLANE_Y];
int row = 0;
int col = 0;
#if CONFIG_CHROMA_SUB8X8
bsize = AOMMAX(BLOCK_4X4, bsize);
if (block_size_high[bsize] == 4 || block_size_wide[bsize] == 4) {
sub8x8_adjust_offset(cfl, &row, &col);
......@@ -524,7 +510,6 @@ void cfl_store_block(MACROBLOCKD *const xd, BLOCK_SIZE bsize, TX_SIZE tx_size) {
sub8x8_set_val(cfl, row, col, mi_size_high[bsize], mi_size_wide[bsize]);
#endif // CONFIG_DEBUG
}
#endif // CONFIG_CHROMA_SUB8X8
const int width = max_intra_block_width(xd, bsize, AOM_PLANE_Y, tx_size);
const int height = max_intra_block_height(xd, bsize, AOM_PLANE_Y, tx_size);
cfl_store(cfl, pd->dst.buf, pd->dst.stride, row, col, width, height,
......@@ -538,7 +523,6 @@ void cfl_compute_parameters(MACROBLOCKD *const xd, TX_SIZE tx_size) {
// Do not call cfl_compute_parameters multiple time on the same values.
assert(cfl->are_parameters_computed == 0);
#if CONFIG_CHROMA_SUB8X8
const BLOCK_SIZE plane_bsize = AOMMAX(
BLOCK_4X4, get_plane_block_size(mbmi->sb_type, &xd->plane[AOM_PLANE_U]));
#if CONFIG_DEBUG
......@@ -551,10 +535,6 @@ void cfl_compute_parameters(MACROBLOCKD *const xd, TX_SIZE tx_size) {
cfl_clear_sub8x8_val(cfl);
}
#endif // CONFIG_DEBUG
#else
const BLOCK_SIZE plane_bsize =
get_plane_block_size(mbmi->sb_type, &xd->plane[AOM_PLANE_U]);
#endif
// AOM_PLANE_U is used, but both planes will have the same sizes.
cfl->uv_width = max_intra_block_width(xd, plane_bsize, AOM_PLANE_U, tx_size);
cfl->uv_height =
......
......@@ -28,253 +28,373 @@ extern "C" {
// Log 2 conversion lookup tables for block width and height
static const uint8_t b_width_log2_lookup[BLOCK_SIZES_ALL] = {
#if CONFIG_CHROMA_SUB8X8
0, 0,
0,
#endif
0, 0,
1, 1,
1, 2,
2, 2,
3, 3,
3, 4,
4, IF_EXT_PARTITION(4, 5, 5) 0,
2, 1,
3, 2,
4, IF_EXT_PARTITION(3, 5)
0,
0,
0,
0,
1,
1,
1,
2,
2,
2,
3,
3,
3,
4,
4,
IF_EXT_PARTITION(4, 5, 5) 0,
2,
1,
3,
2,
4,
IF_EXT_PARTITION(3, 5)
};
static const uint8_t b_height_log2_lookup[BLOCK_SIZES_ALL] = {
#if CONFIG_CHROMA_SUB8X8
0, 0,
0,
#endif
0, 1,
0, 1,
2, 1,
2, 3,
2, 3,
4, 3,
4, IF_EXT_PARTITION(5, 4, 5) 2,
0, 3,
1, 4,
2, IF_EXT_PARTITION(5, 3)
0,
0,
0,
1,
0,
1,
2,
1,
2,
3,
2,
3,
4,
3,
4,
IF_EXT_PARTITION(5, 4, 5) 2,
0,
3,
1,
4,
2,
IF_EXT_PARTITION(5, 3)
};
// Log 2 conversion lookup tables for modeinfo width and height
static const uint8_t mi_width_log2_lookup[BLOCK_SIZES_ALL] = {
#if CONFIG_CHROMA_SUB8X8
0, 0,
0,
#endif
0, 0,
1, 1,
1, 2,
2, 2,
3, 3,
3, 4,
4, IF_EXT_PARTITION(4, 5, 5) 0,
2, 1,
3, 2,
4, IF_EXT_PARTITION(3, 5)
0,
0,
0,
0,
1,
1,
1,
2,
2,
2,
3,
3,
3,
4,
4,
IF_EXT_PARTITION(4, 5, 5) 0,
2,
1,
3,
2,
4,
IF_EXT_PARTITION(3, 5)
};
static const uint8_t mi_height_log2_lookup[BLOCK_SIZES_ALL] = {
#if CONFIG_CHROMA_SUB8X8
0, 0,
0,
#endif
0, 1,
0, 1,
2, 1,
2, 3,
2, 3,
4, 3,
4, IF_EXT_PARTITION(5, 4, 5) 2,
0, 3,
1, 4,
2, IF_EXT_PARTITION(5, 3)
0,
0,
0,
1,
0,
1,
2,
1,
2,
3,
2,
3,
4,
3,
4,
IF_EXT_PARTITION(5, 4, 5) 2,
0,
3,
1,
4,
2,
IF_EXT_PARTITION(5, 3)
};
/* clang-format off */
static const uint8_t mi_size_wide[BLOCK_SIZES_ALL] = {
#if CONFIG_CHROMA_SUB8X8
1, 1, 1,
#endif
1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16,
1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16,
IF_EXT_PARTITION(16, 32, 32) 1, 4, 2, 8, 4, 16, IF_EXT_PARTITION(8, 32)
};
static const uint8_t mi_size_high[BLOCK_SIZES_ALL] = {
#if CONFIG_CHROMA_SUB8X8
1, 1, 1,
#endif
1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16,
1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16,
IF_EXT_PARTITION(32, 16, 32) 4, 1, 8, 2, 16, 4, IF_EXT_PARTITION(32, 8)
};
/* clang-format on */
// Width/height lookup tables in units of various block sizes
static const uint8_t block_size_wide[BLOCK_SIZES_ALL] = {
#if CONFIG_CHROMA_SUB8X8
2, 2,
2,
2,
4,
#endif
4, 4,
8, 8,
8, 16,
16, 16,
32, 32,
32, 64,
64, IF_EXT_PARTITION(64, 128, 128) 4,
16, 8,
32, 16,
64, IF_EXT_PARTITION(32, 128)
4,
4,
8,
8,
8,
16,
16,
16,
32,
32,
32,
64,
64,
IF_EXT_PARTITION(64, 128, 128) 4,
16,
8,
32,
16,
64,
IF_EXT_PARTITION(32, 128)
};
static const uint8_t block_size_high[BLOCK_SIZES_ALL] = {
#if CONFIG_CHROMA_SUB8X8
2, 4,
2,
#endif
4, 8,
4, 8,
16, 8,
16, 32,
16, 32,
64, 32,
64, IF_EXT_PARTITION(128, 64, 128) 16,
4, 32,
8, 64,
16, IF_EXT_PARTITION(128, 32)
4,
2,
4,
8,
4,
8,
16,
8,
16,
32,
16,
32,
64,
32,
64,
IF_EXT_PARTITION(128, 64, 128) 16,
4,
32,
8,
64,
16,
IF_EXT_PARTITION(128, 32)
};
static const uint8_t num_4x4_blocks_wide_lookup[BLOCK_SIZES_ALL] = {
#if CONFIG_CHROMA_SUB8X8
1, 1,
1,
#endif
1, 1,
2, 2,
2, 4,
4, 4,
8, 8,
8, 16,
16, IF_EXT_PARTITION(16, 32, 32) 1,
4, 2,
8, 4,
16, IF_EXT_PARTITION(8, 32)
1,
1,
1,
1,
2,
2,
2,
4,
4,