Commit e5848dea authored by Debargha Mukherjee's avatar Debargha Mukherjee

Rectangular transforms 4x8 & 8x4

Added a new expt rect-tx to be used in conjunction with ext-tx.
[rect-tx is a temporary config flag and will eventually be
merged into ext-tx once it works correctly with all other
experiments].

Added 4x8 and 8x4 tranforms for use initially with rectangular
sub8x8 y blocks as part of this experiment.

There is about a -0.2% BDRATE improvement on lowres, others pending.

When var-tx is on rectangular transforms are currently not used.
That will be enabled in a subsequent patch.

Change-Id: Iaf3f88ede2740ffe6a0ffb1ef5fc01a16cd0283a
parent 3c13124e
......@@ -267,6 +267,7 @@ EXPERIMENT_LIST="
fp_mb_stats
emulate_hardware
var_tx
rect_tx
ref_mv
dual_filter
ext_tx
......
......@@ -53,7 +53,9 @@ void vp10_foreach_transformed_block_in_plane(
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
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 step = 1 << (tx_size << 1);
const uint8_t num_4x4_tw = num_4x4_blocks_wide_txsize_lookup[tx_size];
const uint8_t num_4x4_th = num_4x4_blocks_high_txsize_lookup[tx_size];
const int step = num_4x4_tw * num_4x4_th;
int i = 0, r, c;
// If mb_to_right_edge is < 0 we are in a situation in which
......@@ -63,13 +65,15 @@ void vp10_foreach_transformed_block_in_plane(
xd->mb_to_right_edge >> (5 + pd->subsampling_x));
const int max_blocks_high = num_4x4_h + (xd->mb_to_bottom_edge >= 0 ? 0 :
xd->mb_to_bottom_edge >> (5 + pd->subsampling_y));
const int extra_step = ((num_4x4_w - max_blocks_wide) >> tx_size) * step;
const int extra_step =
((num_4x4_w - max_blocks_wide) >>
num_4x4_blocks_wide_txsize_log2_lookup[tx_size]) * step;
// Keep track of the row and column of the blocks we use so that we know
// if we are in the unrestricted motion border.
for (r = 0; r < max_blocks_high; r += (1 << tx_size)) {
for (r = 0; r < max_blocks_high; r += num_4x4_th) {
// Skip visiting the sub blocks that are wholly within the UMV.
for (c = 0; c < max_blocks_wide; c += (1 << tx_size)) {
for (c = 0; c < max_blocks_wide; c += num_4x4_tw) {
visit(plane, i, r, c, plane_bsize, tx_size, arg);
i += step;
}
......@@ -82,33 +86,33 @@ void vp10_foreach_transformed_block(const MACROBLOCKD* const xd,
foreach_transformed_block_visitor visit,
void *arg) {
int plane;
for (plane = 0; plane < MAX_MB_PLANE; ++plane)
vp10_foreach_transformed_block_in_plane(xd, bsize, plane, visit, arg);
}
void vp10_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size, int has_eob,
int aoff, int loff) {
BLOCK_SIZE plane_bsize, TX_SIZE tx_size, int has_eob,
int aoff, int loff) {
ENTROPY_CONTEXT *const a = pd->above_context + aoff;
ENTROPY_CONTEXT *const l = pd->left_context + loff;
const int tx_size_in_blocks = 1 << tx_size;
const int tx_w_in_blocks = num_4x4_blocks_wide_txsize_lookup[tx_size];
const int tx_h_in_blocks = num_4x4_blocks_high_txsize_lookup[tx_size];
// above
if (has_eob && xd->mb_to_right_edge < 0) {
int i;
const int blocks_wide = num_4x4_blocks_wide_lookup[plane_bsize] +
(xd->mb_to_right_edge >> (5 + pd->subsampling_x));
int above_contexts = tx_size_in_blocks;
int above_contexts = tx_w_in_blocks;
if (above_contexts + aoff > blocks_wide)
above_contexts = blocks_wide - aoff;
for (i = 0; i < above_contexts; ++i)
a[i] = has_eob;
for (i = above_contexts; i < tx_size_in_blocks; ++i)
for (i = above_contexts; i < tx_w_in_blocks; ++i)
a[i] = 0;
} else {
memset(a, has_eob, sizeof(ENTROPY_CONTEXT) * tx_size_in_blocks);
memset(a, has_eob, sizeof(ENTROPY_CONTEXT) * tx_w_in_blocks);
}
// left
......@@ -116,16 +120,16 @@ void vp10_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd,
int i;
const int blocks_high = num_4x4_blocks_high_lookup[plane_bsize] +
(xd->mb_to_bottom_edge >> (5 + pd->subsampling_y));
int left_contexts = tx_size_in_blocks;
int left_contexts = tx_h_in_blocks;
if (left_contexts + loff > blocks_high)
left_contexts = blocks_high - loff;
for (i = 0; i < left_contexts; ++i)
l[i] = has_eob;
for (i = left_contexts; i < tx_size_in_blocks; ++i)
for (i = left_contexts; i < tx_h_in_blocks; ++i)
l[i] = 0;
} else {
memset(l, has_eob, sizeof(ENTROPY_CONTEXT) * tx_size_in_blocks);
memset(l, has_eob, sizeof(ENTROPY_CONTEXT) * tx_h_in_blocks);
}
}
......
......@@ -422,6 +422,18 @@ static INLINE int supertx_enabled(const MB_MODE_INFO *mbmi) {
}
#endif // CONFIG_SUPERTX
static INLINE int get_tx1d_width(TX_SIZE tx_size) {
return num_4x4_blocks_wide_txsize_lookup[tx_size] << 2;
}
static INLINE int get_tx1d_height(TX_SIZE tx_size) {
return num_4x4_blocks_high_txsize_lookup[tx_size] << 2;
}
static INLINE int get_tx2d_size(TX_SIZE tx_size) {
return num_4x4_blocks_txsize_lookup[tx_size] << 4;
}
#if CONFIG_EXT_TX
#define ALLOW_INTRA_EXT_TX 1
// whether masked transforms are used for 32X32
......@@ -438,6 +450,7 @@ static const int num_ext_tx_set_intra[EXT_TX_SETS_INTRA] = {
#if EXT_TX_SIZES == 4
static INLINE int get_ext_tx_set(TX_SIZE tx_size, BLOCK_SIZE bs,
int is_inter) {
tx_size = txsize_sqr_map[tx_size];
if (tx_size > TX_32X32 || bs < BLOCK_8X8) return 0;
#if USE_REDUCED_TXSET_FOR_16X16
if (tx_size == TX_32X32)
......@@ -468,6 +481,7 @@ static const int use_inter_ext_tx_for_txsize[EXT_TX_SETS_INTER][TX_SIZES] = {
static INLINE int get_ext_tx_set(TX_SIZE tx_size, BLOCK_SIZE bs,
int is_inter) {
(void) is_inter;
tx_size = txsize_sqr_map[tx_size];
if (tx_size > TX_32X32 || bs < BLOCK_8X8) return 0;
if (tx_size == TX_32X32) return 0;
#if USE_REDUCED_TXSET_FOR_16X16
......@@ -622,10 +636,11 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type,
#if CONFIG_EXT_TX
#if EXT_TX_SIZES == 4
if (xd->lossless[mbmi->segment_id] || tx_size > TX_32X32 ||
(tx_size >= TX_32X32 && !is_inter_block(mbmi)))
if (xd->lossless[mbmi->segment_id] ||
txsize_sqr_map[tx_size] > TX_32X32 ||
(txsize_sqr_map[tx_size] >= TX_32X32 && !is_inter_block(mbmi)))
#else
if (xd->lossless[mbmi->segment_id] || tx_size >= TX_32X32)
if (xd->lossless[mbmi->segment_id] || txsize_sqr_map[tx_size] >= TX_32X32)
#endif
return DCT_DCT;
if (mbmi->sb_type >= BLOCK_8X8) {
......@@ -637,8 +652,8 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type,
}
if (is_inter_block(mbmi))
// UV Inter only
return (mbmi->tx_type == IDTX && tx_size == TX_32X32 ?
DCT_DCT : mbmi->tx_type);
return (mbmi->tx_type == IDTX && txsize_sqr_map[tx_size] == TX_32X32) ?
DCT_DCT : mbmi->tx_type;
}
// Sub8x8-Inter/Intra OR UV-Intra
......@@ -647,10 +662,10 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type,
else // Sub8x8 Intra OR UV-Intra
return intra_mode_to_tx_type_context[plane_type == PLANE_TYPE_Y ?
get_y_mode(mi, block_idx) : mbmi->uv_mode];
#else
#else // CONFIG_EXT_TX
(void) block_idx;
if (plane_type != PLANE_TYPE_Y || xd->lossless[mbmi->segment_id] ||
tx_size >= TX_32X32)
txsize_sqr_map[tx_size] >= TX_32X32)
return DCT_DCT;
return mbmi->tx_type;
#endif // CONFIG_EXT_TX
......
......@@ -50,6 +50,46 @@ static const uint8_t num_16x16_blocks_wide_lookup[BLOCK_SIZES] =
static const uint8_t num_16x16_blocks_high_lookup[BLOCK_SIZES] =
{1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 4, 2, 4, IF_EXT_PARTITION(8, 4, 8)};
static const uint8_t num_4x4_blocks_txsize_lookup[TX_SIZES_ALL] = {
1, 4, 16, 64,
#if CONFIG_EXT_TX
2, 2
#endif // CONFIG_EXT_TX
};
static const uint8_t num_4x4_blocks_wide_txsize_lookup[TX_SIZES_ALL] = {
1, 2, 4, 8,
#if CONFIG_EXT_TX
1, 2
#endif // CONFIG_EXT_TX
};
static const uint8_t num_4x4_blocks_high_txsize_lookup[TX_SIZES_ALL] = {
1, 2, 4, 8,
#if CONFIG_EXT_TX
2, 1
#endif // CONFIG_EXT_TX
};
static const uint8_t num_4x4_blocks_txsize_log2_lookup[TX_SIZES_ALL] = {
0, 2, 4, 6,
#if CONFIG_EXT_TX
1, 1
#endif // CONFIG_EXT_TX
};
static const uint8_t num_4x4_blocks_wide_txsize_log2_lookup
[TX_SIZES_ALL] = {
0, 1, 2, 3,
#if CONFIG_EXT_TX
0, 1
#endif // CONFIG_EXT_TX
};
static const uint8_t num_4x4_blocks_high_txsize_log2_lookup
[TX_SIZES_ALL] = {
0, 1, 2, 3,
#if CONFIG_EXT_TX
1, 0
#endif // CONFIG_EXT_TX
};
// VPXMIN(3, VPXMIN(b_width_log2(bsize), b_height_log2(bsize)))
static const uint8_t size_group_lookup[BLOCK_SIZES] =
{0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, IF_EXT_PARTITION(3, 3, 3)};
......@@ -297,13 +337,59 @@ static const TX_SIZE max_txsize_lookup[BLOCK_SIZES] = {
#endif // CONFIG_EXT_PARTITION
};
static const BLOCK_SIZE txsize_to_bsize[TX_SIZES] = {
BLOCK_4X4, // TX_4X4
BLOCK_8X8, // TX_8X8
BLOCK_16X16, // TX_16X16
BLOCK_32X32, // TX_32X32
#if CONFIG_EXT_TX
static const TX_SIZE max_txsize_rect_lookup[BLOCK_SIZES] = {
// 4X4
TX_4X4,
// 4X8, 8X4, 8X8
TX_4X8, TX_8X4, TX_8X8,
// 8X16, 16X8, 16X16
TX_8X8, TX_8X8, TX_16X16,
// 16X32, 32X16, 32X32
TX_16X16, TX_16X16, TX_32X32,
// 32X64, 64X32, 64X64
TX_32X32, TX_32X32, TX_32X32,
#if CONFIG_EXT_PARTITION
// 64x128, 128x64, 128x128
TX_32X32, TX_32X32, TX_32X32,
#endif // CONFIG_EXT_PARTITION
};
#endif // CONFIG_EXT_TX
static const BLOCK_SIZE txsize_to_bsize[TX_SIZES_ALL] = {
BLOCK_4X4, // TX_4X4
BLOCK_8X8, // TX_8X8
BLOCK_16X16, // TX_16X16
BLOCK_32X32, // TX_32X32
#if CONFIG_EXT_TX
BLOCK_4X8, // TX_4X8
BLOCK_8X4, // TX_8X4
#endif // CONFIG_EXT_TX
};
static const TX_SIZE txsize_sqr_map[TX_SIZES_ALL] = {
TX_4X4, // TX_4X4
TX_8X8, // TX_8X8
TX_16X16, // TX_16X16
TX_32X32, // TX_32X32
#if CONFIG_EXT_TX
TX_4X4, // TX_4X8
TX_4X4, // TX_8X4
#endif // CONFIG_EXT_TX
};
static const TX_SIZE txsize_sqr_up_map[TX_SIZES_ALL] = {
TX_4X4, // TX_4X4
TX_8X8, // TX_8X8
TX_16X16, // TX_16X16
TX_32X32, // TX_32X32
#if CONFIG_EXT_TX
TX_8X8, // TX_4X8
TX_8X8, // TX_8X4
#endif // CONFIG_EXT_TX
};
static const TX_SIZE tx_mode_to_biggest_tx_size[TX_MODES] = {
TX_4X4, // ONLY_4X4
TX_8X8, // ALLOW_8X8
......
......@@ -56,11 +56,33 @@ const vpx_prob vp10_cat6_prob_high12[] = {
};
#endif
const uint16_t band_count_table[TX_SIZES_ALL][8] = {
{ 1, 2, 3, 4, 3, 16 - 13, 0 },
{ 1, 2, 3, 4, 11, 64 - 21, 0 },
{ 1, 2, 3, 4, 11, 256 - 21, 0 },
{ 1, 2, 3, 4, 11, 1024 - 21, 0 },
#if CONFIG_EXT_TX
{ 1, 2, 3, 4, 8, 32 - 18, 0 },
{ 1, 2, 3, 4, 8, 32 - 18, 0 },
#endif // CONFIG_EXT_TX
};
const uint16_t band_cum_count_table[TX_SIZES_ALL][8] = {
{ 0, 1, 3, 6, 10, 13, 16, 0 },
{ 0, 1, 3, 6, 10, 21, 64, 0 },
{ 0, 1, 3, 6, 10, 21, 256, 0 },
{ 0, 1, 3, 6, 10, 21, 1024, 0 },
#if CONFIG_EXT_TX
{ 0, 1, 3, 6, 10, 18, 32, 0 },
{ 0, 1, 3, 6, 10, 18, 32, 0 },
#endif // CONFIG_EXT_TX
};
const uint8_t vp10_coefband_trans_8x8plus[1024] = {
0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 5,
// beyond MAXBAND_INDEX+1 all values are filled as 5
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
......@@ -125,6 +147,13 @@ const uint8_t vp10_coefband_trans_8x8plus[1024] = {
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
};
#if CONFIG_EXT_TX
const uint8_t vp10_coefband_trans_8x4_4x8[32] = {
0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4,
4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
};
#endif // CONFIG_EXT_TX
const uint8_t vp10_coefband_trans_4x4[16] = {
0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5,
};
......
......@@ -155,11 +155,28 @@ void vp10_partial_adapt_probs(struct VP10Common *cm, int mi_row, int mi_col);
#define MAXBAND_INDEX 21
DECLARE_ALIGNED(16, extern const uint8_t, vp10_coefband_trans_8x8plus[1024]);
#if CONFIG_EXT_TX
DECLARE_ALIGNED(16, extern const uint8_t, vp10_coefband_trans_8x4_4x8[32]);
#endif // CONFIG_EXT_TX
DECLARE_ALIGNED(16, extern const uint8_t, vp10_coefband_trans_4x4[16]);
DECLARE_ALIGNED(16, extern const uint16_t,
band_count_table[TX_SIZES_ALL][8]);
DECLARE_ALIGNED(16, extern const uint16_t,
band_cum_count_table[TX_SIZES_ALL][8]);
static INLINE const uint8_t *get_band_translate(TX_SIZE tx_size) {
return tx_size == TX_4X4 ? vp10_coefband_trans_4x4
: vp10_coefband_trans_8x8plus;
switch (tx_size) {
case TX_4X4:
return vp10_coefband_trans_4x4;
#if CONFIG_EXT_TX
case TX_4X8:
case TX_8X4:
return vp10_coefband_trans_8x4_4x8;
#endif // CONFIG_EXT_TX
default:
return vp10_coefband_trans_8x8plus;
}
}
// 128 lists of probabilities are stored for the following ONE node probs:
......@@ -198,7 +215,8 @@ static INLINE int combine_entropy_contexts(ENTROPY_CONTEXT a,
return (a != 0) + (b != 0);
}
static INLINE int get_entropy_context(TX_SIZE tx_size, const ENTROPY_CONTEXT *a,
static INLINE int get_entropy_context(TX_SIZE tx_size,
const ENTROPY_CONTEXT *a,
const ENTROPY_CONTEXT *l) {
ENTROPY_CONTEXT above_ec = 0, left_ec = 0;
......@@ -207,6 +225,16 @@ static INLINE int get_entropy_context(TX_SIZE tx_size, const ENTROPY_CONTEXT *a,
above_ec = a[0] != 0;
left_ec = l[0] != 0;
break;
#if CONFIG_EXT_TX
case TX_4X8:
above_ec = a[0] != 0;
left_ec = !!*(const uint16_t *)l;
break;
case TX_8X4:
above_ec = !!*(const uint16_t *)a;
left_ec = l[0] != 0;
break;
#endif // CONFIG_EXT_TX
case TX_8X8:
above_ec = !!*(const uint16_t *)a;
left_ec = !!*(const uint16_t *)l;
......@@ -223,7 +251,6 @@ static INLINE int get_entropy_context(TX_SIZE tx_size, const ENTROPY_CONTEXT *a,
assert(0 && "Invalid transform size.");
break;
}
return combine_entropy_contexts(above_ec, left_ec);
}
......
......@@ -137,6 +137,14 @@ typedef uint8_t TX_SIZE;
#define TX_32X32 ((TX_SIZE)3) // 32x32 transform
#define TX_SIZES ((TX_SIZE)4)
#if CONFIG_EXT_TX
#define TX_4X8 ((TX_SIZE)4) // 4x8 transform
#define TX_8X4 ((TX_SIZE)5) // 8x4 transform
#define TX_SIZES_ALL ((TX_SIZE)6) // Includes rectangular transforms
#else
#define TX_SIZES_ALL ((TX_SIZE)4)
#endif // CONFIG_EXT_TX
#define MAX_TX_SIZE_LOG2 5
#define MAX_TX_SIZE (1 << MAX_TX_SIZE_LOG2)
#define MIN_TX_SIZE_LOG2 2
......@@ -170,10 +178,10 @@ typedef enum {
} TX_TYPE_1D;
typedef enum {
DCT_DCT = 0, // DCT in both horizontal and vertical
ADST_DCT = 1, // ADST in vertical, DCT in horizontal
DCT_ADST = 2, // DCT in vertical, ADST in horizontal
ADST_ADST = 3, // ADST in both directions
DCT_DCT = 0, // DCT in both horizontal and vertical
ADST_DCT = 1, // ADST in vertical, DCT in horizontal
DCT_ADST = 2, // DCT in vertical, ADST in horizontal
ADST_ADST = 3, // ADST in both directions
#if CONFIG_EXT_TX
FLIPADST_DCT = 4,
DCT_FLIPADST = 5,
......
This diff is collapsed.
......@@ -66,6 +66,12 @@ void vp10_idct32x32_add(const tran_low_t *input, uint8_t *dest, int stride,
void vp10_inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest,
int stride, int eob, TX_TYPE tx_type, int lossless);
#if CONFIG_EXT_TX
void vp10_inv_txfm_add_8x4(const tran_low_t *input, uint8_t *dest,
int stride, int eob, TX_TYPE tx_type);
void vp10_inv_txfm_add_4x8(const tran_low_t *input, uint8_t *dest,
int stride, int eob, TX_TYPE tx_type);
#endif // CONFIG_EXT_TX
void vp10_inv_txfm_add_8x8(const tran_low_t *input, uint8_t *dest,
int stride, int eob, TX_TYPE tx_type);
void vp10_inv_txfm_add_16x16(const tran_low_t *input, uint8_t *dest,
......@@ -88,6 +94,12 @@ void vp10_highbd_idct32x32_add(const tran_low_t *input, uint8_t *dest,
void vp10_highbd_inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest,
int stride, int eob, int bd, TX_TYPE tx_type,
int lossless);
#if CONFIG_EXT_TX
void vp10_highbd_inv_txfm_add_4x8(const tran_low_t *input, uint8_t *dest,
int stride, int eob, int bd, TX_TYPE tx_type);
void vp10_highbd_inv_txfm_add_8x4(const tran_low_t *input, uint8_t *dest,
int stride, int eob, int bd, TX_TYPE tx_type);
#endif // CONFIG_EXT_TX
void vp10_highbd_inv_txfm_add_8x8(const tran_low_t *input, uint8_t *dest,
int stride, int eob, int bd, TX_TYPE tx_type);
void vp10_highbd_inv_txfm_add_16x16(const tran_low_t *input, uint8_t *dest,
......
......@@ -722,8 +722,11 @@ static void build_masks(const loop_filter_info_n *const lfi_n,
LOOP_FILTER_MASK *lfm) {
const MB_MODE_INFO *mbmi = &mi->mbmi;
const BLOCK_SIZE block_size = mbmi->sb_type;
const TX_SIZE tx_size_y = mbmi->tx_size;
const TX_SIZE tx_size_uv = get_uv_tx_size_impl(tx_size_y, block_size, 1, 1);
// TODO(debargha): Check if masks can be setup correctly when
// rectangular transfroms are used with the EXT_TX expt.
const TX_SIZE tx_size_y = txsize_sqr_map[mbmi->tx_size];
const TX_SIZE tx_size_uv =
get_uv_tx_size_impl(mbmi->tx_size, block_size, 1, 1);
const int filter_level = get_filter_level(lfi_n, mbmi);
uint64_t *const left_y = &lfm->left_y[tx_size_y];
uint64_t *const above_y = &lfm->above_y[tx_size_y];
......@@ -803,7 +806,7 @@ static void build_y_mask(const loop_filter_info_n *const lfi_n,
#endif // CONFIG_SUPERTX
LOOP_FILTER_MASK *lfm) {
const MB_MODE_INFO *mbmi = &mi->mbmi;
const TX_SIZE tx_size_y = mbmi->tx_size;
const TX_SIZE tx_size_y = txsize_sqr_map[mbmi->tx_size];
#if CONFIG_SUPERTX
const BLOCK_SIZE block_size =
supertx_enabled ? (BLOCK_SIZE)(3 * tx_size_y) : mbmi->sb_type;
......@@ -1267,8 +1270,8 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm,
const int skip_border_4x4_c = ss_x && mi_col + c == cm->mi_cols - 1;
const int skip_border_4x4_r = ss_y && mi_row + r == cm->mi_rows - 1;
TX_SIZE tx_size_c = tx_size;
TX_SIZE tx_size_r = tx_size;
TX_SIZE tx_size_c = num_4x4_blocks_wide_txsize_log2_lookup[tx_size];
TX_SIZE tx_size_r = num_4x4_blocks_high_txsize_log2_lookup[tx_size];
int tx_size_mask = 0;
// Filter level can vary per MI
......
......@@ -177,10 +177,11 @@ static INLINE int get_tx_size_context(const MACROBLOCKD *xd) {
const MB_MODE_INFO *const left_mbmi = xd->left_mbmi;
const int has_above = xd->up_available;
const int has_left = xd->left_available;
int above_ctx = (has_above && !above_mbmi->skip) ? (int)above_mbmi->tx_size
: max_tx_size;
int left_ctx = (has_left && !left_mbmi->skip) ? (int)left_mbmi->tx_size
: max_tx_size;
int above_ctx = (has_above && !above_mbmi->skip) ?
(int)txsize_sqr_map[above_mbmi->tx_size] : max_tx_size;
int left_ctx = (has_left && !left_mbmi->skip) ?
(int)txsize_sqr_map[left_mbmi->tx_size] : max_tx_size;
assert(xd->mi[0]->mbmi.sb_type >= BLOCK_8X8);
if (!has_left)
left_ctx = above_ctx;
......
......@@ -673,7 +673,7 @@ static void dr_predictor(uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size,
INTRA_FILTER filter_type) {
const int dx = (int)dr_intra_derivative[angle][0];
const int dy = (int)dr_intra_derivative[angle][1];
const int bs = 4 << tx_size;
const int bs = 4 * num_4x4_blocks_wide_txsize_lookup[tx_size];
assert(angle > 0 && angle < 270);
if (angle > 0 && angle < 90) {
......@@ -1159,7 +1159,7 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd,
DECLARE_ALIGNED(16, uint16_t, above_data[MAX_SB_SIZE + 16]);
uint16_t *above_row = above_data + 16;
const uint16_t *const_above_row = above_row;
const int bs = 4 << tx_size;
const int bs = 4 * num_4x4_blocks_wide_txsize_lookup[tx_size];
int need_left = extend_modes[mode] & NEED_LEFT;
int need_above = extend_modes[mode] & NEED_ABOVE;
const uint16_t *above_ref = ref - ref_stride;
......@@ -1331,7 +1331,7 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
DECLARE_ALIGNED(16, uint8_t, above_data[MAX_SB_SIZE + 16]);
uint8_t *above_row = above_data + 16;
const uint8_t *const_above_row = above_row;
const int bs = 4 << tx_size;
const int bs = 4 * num_4x4_blocks_wide_txsize_lookup[tx_size];
int need_left = extend_modes[mode] & NEED_LEFT;
int need_above = extend_modes[mode] & NEED_ABOVE;
#if CONFIG_EXT_INTRA
......@@ -1491,7 +1491,7 @@ void vp10_predict_intra_block(const MACROBLOCKD *xd, int bwl_in, int bhl_in,
const uint8_t *ref, int ref_stride,
uint8_t *dst, int dst_stride,
int col_off, int row_off, int plane) {
const int txw = (1 << tx_size);
const int txw = num_4x4_blocks_wide_txsize_lookup[tx_size];
const int have_top = row_off || xd->up_available;
const int have_left = col_off || xd->left_available;
const int x = col_off * 4;
......@@ -1531,7 +1531,7 @@ void vp10_predict_intra_block(const MACROBLOCKD *xd, int bwl_in, int bhl_in,
(hpx - y - txpx);
if (xd->mi[0]->mbmi.palette_mode_info.palette_size[plane != 0] > 0) {
const int bs = 4 * (1 << tx_size);
const int bs = 4 * num_4x4_blocks_wide_txsize_lookup[tx_size];
const int stride = 4 * (1 << bwl_in);
int r, c;
uint8_t *map = NULL;
......
......@@ -49,6 +49,50 @@ DECLARE_ALIGNED(16, static const int16_t, row_scan_4x4[16]) = {
13, 11, 14, 15,
};
#if CONFIG_EXT_TX
DECLARE_ALIGNED(16, static const int16_t, default_scan_4x8[32]) = {
0, 1, 4, 5, 2, 8, 6, 9,
10, 3, 12, 7, 13, 11, 14, 16,
17, 15, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31,
};
DECLARE_ALIGNED(16, static const int16_t, mcol_scan_4x8[32]) = {
0, 4, 8, 12, 16, 20, 24, 28,
1, 5, 9, 13, 17, 21, 25, 29,
2, 6, 10, 14, 18, 22, 26, 30,
3, 7, 11, 15, 19, 23, 27, 31,
};
DECLARE_ALIGNED(16, static const int16_t, mrow_scan_4x8[32]) = {
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31,
};
DECLARE_ALIGNED(16, static const int16_t, default_scan_8x4[32]) = {
0, 1, 8, 9, 2, 16, 10, 17,
18, 3, 24, 11, 25, 19, 26, 4,
12, 27, 20, 5, 28, 13, 21, 29,
6, 14, 22, 30, 7, 15, 23, 31,
};
DECLARE_ALIGNED(16, static const int16_t, mcol_scan_8x4[32]) = {
0, 8, 16, 24, 1, 9, 17, 25,
2, 10, 18, 26, 3, 11, 19, 27,
4, 12, 20, 28, 5, 13, 21, 29,
6, 14, 22, 30, 7, 15, 23, 31,
};
DECLARE_ALIGNED(16, static const int16_t, mrow_scan_8x4[32]) = {
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31,
};
#endif // CONFIG_EXT_TX
DECLARE_ALIGNED(16, static const int16_t, default_scan_8x8[64]) = {
0, 8, 1, 16, 9, 2, 17, 24,
10, 3, 18, 25, 32, 11, 4, 26,
......@@ -824,6 +868,86 @@ DECLARE_ALIGNED(16, static const int16_t,
9, 12, 7, 10, 10, 13, 11, 14, 0, 0,
};
#if CONFIG_EXT_TX
DECLARE_ALIGNED(16, static const int16_t,
default_scan_4x8_neighbors[33 * MAX_NEIGHBORS]) = {
0, 0, 0, 0, 0, 0, 1, 4,
1, 1, 4, 4, 2, 5, 5, 8,
6, 9, 2, 2, 8, 8, 3, 6,
9, 12, 7, 10, 10, 13, 12, 12,
13, 16, 11, 14, 14, 17, 15, 18,
16, 16, 17, 20, 18, 21, 19, 22,
20, 20, 21, 24, 22, 25, 23, 26,
24, 24, 25, 28, 26, 29, 27, 30,
0, 0
};
DECLARE_ALIGNED(16, static const int16_t,
mcol_scan_4x8_neighbors[33 * MAX_NEIGHBORS]) = {