Commit 9fc691ef authored by Debargha Mukherjee's avatar Debargha Mukherjee

Backport EXT_TX experiment from nextgen

Does not include DST1 yet.

derflr: +1.437 (8-bit internal), +7.243 (12-bit internal)
with --enable-ext-tx

Change-Id: I91f1759fd2de794755eb6384cda52e80e979cb7d
parent b3cc3a07
......@@ -78,6 +78,9 @@ typedef struct {
// Only for INTER blocks
INTERP_FILTER interp_filter;
MV_REFERENCE_FRAME ref_frame[2];
#if CONFIG_EXT_TX
EXT_TX_TYPE ext_txfrm;
#endif
// TODO(slavarnway): Delete and use bmi[3].as_mv[] instead.
int_mv mv[2];
......@@ -218,14 +221,50 @@ static const TX_TYPE intra_mode_to_tx_type_lookup[INTRA_MODES] = {
ADST_ADST, // TM
};
static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type, const MACROBLOCKD *xd,
#if CONFIG_EXT_TX
#define GET_EXT_TX_TYPES(tx_size) \
((tx_size) >= TX_32X32 ? 1 : EXT_TX_TYPES)
#define GET_EXT_TX_TREE(tx_size) \
((tx_size) >= TX_32X32 ? NULL : vp10_ext_tx_tree)
#define GET_EXT_TX_ENCODINGS(tx_size) \
((tx_size) >= TX_32X32 ? NULL : ext_tx_encodings)
static TX_TYPE ext_tx_to_txtype[EXT_TX_TYPES] = {
DCT_DCT,
ADST_ADST,
FLIPADST_FLIPADST,
ADST_FLIPADST,
FLIPADST_ADST,
ADST_DCT,
DCT_ADST,
FLIPADST_DCT,
DCT_FLIPADST,
};
#endif // CONFIG_EXT_TX
static INLINE TX_TYPE get_tx_type_large(PLANE_TYPE plane_type,
const MACROBLOCKD *xd) {
(void) plane_type;
(void) xd;
return DCT_DCT;
}
static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type,
const MACROBLOCKD *xd,
int block_idx, TX_SIZE tx_size) {
const MODE_INFO *const mi = xd->mi[0];
const MB_MODE_INFO *const mbmi = &mi->mbmi;
#if CONFIG_EXT_TX
if (xd->lossless || is_inter_block(mbmi) || tx_size >= TX_32X32)
if (xd->lossless || tx_size >= TX_32X32)
return DCT_DCT;
if (is_inter_block(&mi->mbmi)) {
if (plane_type == PLANE_TYPE_Y) {
return ext_tx_to_txtype[mi->mbmi.ext_txfrm];
} else {
return DCT_DCT;
}
}
return intra_mode_to_tx_type_lookup[plane_type == PLANE_TYPE_Y ?
get_y_mode(mi, block_idx) : mbmi->uv_mode];
#else
......
......@@ -22,6 +22,7 @@ extern "C" {
#endif
#define DIFF_UPDATE_PROB 252
#define GROUP_DIFF_UPDATE_PROB 252
// Coefficient token alphabet
#define ZERO_TOKEN 0 // 0 Extra Bits 0+0
......
......@@ -314,6 +314,25 @@ static const vpx_prob default_switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS]
{ 149, 144, },
};
#if CONFIG_EXT_TX
const vpx_tree_index vp10_ext_tx_tree[TREE_SIZE(EXT_TX_TYPES)] = {
-NORM, 2,
4, 10,
6, 8,
-ALT1, -ALT2,
-ALT3, -ALT4,
12, 14,
-ALT5, -ALT6,
-ALT7, -ALT8,
};
static const vpx_prob default_ext_tx_prob[EXT_TX_SIZES][EXT_TX_TYPES - 1] = {
{ 240, 128, 128, 128, 128, 128, 128, 128 },
{ 208, 128, 128, 128, 128, 128, 128, 128 },
{ 176, 128, 128, 128, 128, 128, 128, 128 },
};
#endif // CONFIG_EXT_TX
static void init_mode_probs(FRAME_CONTEXT *fc) {
vp10_copy(fc->uv_mode_prob, default_if_uv_probs);
vp10_copy(fc->y_mode_prob, default_if_y_probs);
......@@ -326,6 +345,9 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
fc->tx_probs = default_tx_probs;
vp10_copy(fc->skip_probs, default_skip_probs);
vp10_copy(fc->inter_mode_probs, default_inter_mode_probs);
#if CONFIG_EXT_TX
vp10_copy(fc->ext_tx_prob, default_ext_tx_prob);
#endif // CONFIG_EXT_TX
}
const vpx_tree_index vp10_switchable_interp_tree
......@@ -405,6 +427,13 @@ void vp10_adapt_mode_probs(VP10_COMMON *cm) {
for (i = 0; i < SKIP_CONTEXTS; ++i)
fc->skip_probs[i] = mode_mv_merge_probs(
pre_fc->skip_probs[i], counts->skip[i]);
#if CONFIG_EXT_TX
for (i = TX_4X4; i <= TX_16X16; ++i) {
vpx_tree_merge_probs(vp10_ext_tx_tree, pre_fc->ext_tx_prob[i],
counts->ext_tx[i], fc->ext_tx_prob[i]);
}
#endif // CONFIG_EXT_TX
}
static void set_default_lf_deltas(struct loopfilter *lf) {
......
......@@ -56,6 +56,9 @@ typedef struct frame_contexts {
struct tx_probs tx_probs;
vpx_prob skip_probs[SKIP_CONTEXTS];
nmv_context nmvc;
#if CONFIG_EXT_TX
vpx_prob ext_tx_prob[EXT_TX_SIZES][EXT_TX_TYPES - 1];
#endif // CONFIG_EXT_TX
int initialized;
} FRAME_CONTEXT;
......@@ -76,6 +79,9 @@ typedef struct FRAME_COUNTS {
struct tx_counts tx;
unsigned int skip[SKIP_CONTEXTS][2];
nmv_context_counts mv;
#if CONFIG_EXT_TX
unsigned int ext_tx[EXT_TX_SIZES][EXT_TX_TYPES];
#endif // CONFIG_EXT_TX
} FRAME_COUNTS;
extern const vpx_prob vp10_kf_uv_mode_prob[INTRA_MODES][INTRA_MODES - 1];
......@@ -100,6 +106,10 @@ void vp10_tx_counts_to_branch_counts_16x16(const unsigned int *tx_count_16x16p,
void vp10_tx_counts_to_branch_counts_8x8(const unsigned int *tx_count_8x8p,
unsigned int (*ct_8x8p)[2]);
#if CONFIG_EXT_TX
extern const vpx_tree_index vp10_ext_tx_tree[TREE_SIZE(EXT_TX_TYPES)];
#endif // CONFIG_EXT_TX
#ifdef __cplusplus
} // extern "C"
#endif
......
......@@ -94,9 +94,33 @@ typedef enum {
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
TX_TYPES = 4
TX_TYPES,
#if CONFIG_EXT_TX
FLIPADST_DCT = 4,
DCT_FLIPADST = 5,
FLIPADST_FLIPADST = 6,
ADST_FLIPADST = 7,
FLIPADST_ADST = 8,
TOTAL_TX_TYPES,
#endif // CONFIG_EXT_TX
} TX_TYPE;
#if CONFIG_EXT_TX
#define EXT_TX_SIZES 3 // number of sizes that use extended transforms
typedef enum {
NORM = 0,
ALT1 = 1,
ALT2 = 2,
ALT3 = 3,
ALT4 = 4,
ALT5 = 5,
ALT6 = 6,
ALT7 = 7,
ALT8 = 8,
EXT_TX_TYPES
} EXT_TX_TYPE;
#endif // CONFIG_EXT_TX
typedef enum {
VP9_LAST_FLAG = 1 << 0,
VP9_GOLD_FLAG = 1 << 1,
......
......@@ -57,6 +57,74 @@ static const transform_2d IHT_8[] = {
{ iadst8_c, iadst8_c } // ADST_ADST = 3
};
#if CONFIG_EXT_TX
void fliplr(uint8_t *dest, int stride, int l) {
int i, j;
for (i = 0; i < l; ++i) {
for (j = 0; j < l / 2; ++j) {
const uint8_t tmp = dest[i * stride + j];
dest[i * stride + j] = dest[i * stride + l - 1 - j];
dest[i * stride + l - 1 - j] = tmp;
}
}
}
void flipud(uint8_t *dest, int stride, int l) {
int i, j;
for (j = 0; j < l; ++j) {
for (i = 0; i < l / 2; ++i) {
const uint8_t tmp = dest[i * stride + j];
dest[i * stride + j] = dest[(l - 1 - i) * stride + j];
dest[(l - 1 - i) * stride + j] = tmp;
}
}
}
void fliplrud(uint8_t *dest, int stride, int l) {
int i, j;
for (i = 0; i < l / 2; ++i) {
for (j = 0; j < l; ++j) {
const uint8_t tmp = dest[i * stride + j];
dest[i * stride + j] = dest[(l - 1 - i) * stride + l - 1 - j];
dest[(l - 1 - i) * stride + l - 1 - j] = tmp;
}
}
}
void fliplr16(uint16_t *dest, int stride, int l) {
int i, j;
for (i = 0; i < l; ++i) {
for (j = 0; j < l / 2; ++j) {
const uint16_t tmp = dest[i * stride + j];
dest[i * stride + j] = dest[i * stride + l - 1 - j];
dest[i * stride + l - 1 - j] = tmp;
}
}
}
void flipud16(uint16_t *dest, int stride, int l) {
int i, j;
for (j = 0; j < l; ++j) {
for (i = 0; i < l / 2; ++i) {
const uint16_t tmp = dest[i * stride + j];
dest[i * stride + j] = dest[(l - 1 - i) * stride + j];
dest[(l - 1 - i) * stride + j] = tmp;
}
}
}
void fliplrud16(uint16_t *dest, int stride, int l) {
int i, j;
for (i = 0; i < l / 2; ++i) {
for (j = 0; j < l; ++j) {
const uint16_t tmp = dest[i * stride + j];
dest[i * stride + j] = dest[(l - 1 - i) * stride + l - 1 - j];
dest[(l - 1 - i) * stride + l - 1 - j] = tmp;
}
}
}
#endif // CONFIG_EXT_TX
void vp10_iht8x8_64_add_c(const tran_low_t *input, uint8_t *dest, int stride,
int tx_type) {
int i, j;
......@@ -178,10 +246,11 @@ void vp10_idct32x32_add(const tran_low_t *input, uint8_t *dest, int stride,
vpx_idct32x32_1024_add(input, dest, stride);
}
void vp10_inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest,
int stride, int eob, TX_TYPE tx_type,
void (*itxm_add_4x4)(const tran_low_t *input,
uint8_t *dest, int stride, int eob)) {
void vp10_inv_txfm_add_4x4(
const tran_low_t *input, uint8_t *dest,
int stride, int eob, TX_TYPE tx_type,
void (*itxm_add_4x4)(const tran_low_t *input,
uint8_t *dest, int stride, int eob)) {
switch (tx_type) {
case DCT_DCT:
itxm_add_4x4(input, dest, stride, eob);
......@@ -191,6 +260,33 @@ void vp10_inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest,
case ADST_ADST:
vp10_iht4x4_16_add(input, dest, stride, tx_type);
break;
#if CONFIG_EXT_TX
case FLIPADST_DCT:
flipud(dest, stride, 4);
vp10_iht4x4_16_add(input, dest, stride, ADST_DCT);
flipud(dest, stride, 4);
break;
case DCT_FLIPADST:
fliplr(dest, stride, 4);
vp10_iht4x4_16_add(input, dest, stride, DCT_ADST);
fliplr(dest, stride, 4);
break;
case FLIPADST_FLIPADST:
fliplrud(dest, stride, 4);
vp10_iht4x4_16_add(input, dest, stride, ADST_ADST);
fliplrud(dest, stride, 4);
break;
case ADST_FLIPADST:
fliplr(dest, stride, 4);
vp10_iht4x4_16_add(input, dest, stride, ADST_ADST);
fliplr(dest, stride, 4);
break;
case FLIPADST_ADST:
flipud(dest, stride, 4);
vp10_iht4x4_16_add(input, dest, stride, ADST_ADST);
flipud(dest, stride, 4);
break;
#endif // CONFIG_EXT_TX
default:
assert(0);
break;
......@@ -208,6 +304,33 @@ void vp10_inv_txfm_add_8x8(const tran_low_t *input, uint8_t *dest,
case ADST_ADST:
vp10_iht8x8_64_add(input, dest, stride, tx_type);
break;
#if CONFIG_EXT_TX
case FLIPADST_DCT:
flipud(dest, stride, 8);
vp10_iht8x8_64_add(input, dest, stride, ADST_DCT);
flipud(dest, stride, 8);
break;
case DCT_FLIPADST:
fliplr(dest, stride, 8);
vp10_iht8x8_64_add(input, dest, stride, DCT_ADST);
fliplr(dest, stride, 8);
break;
case FLIPADST_FLIPADST:
fliplrud(dest, stride, 8);
vp10_iht8x8_64_add(input, dest, stride, ADST_ADST);
fliplrud(dest, stride, 8);
break;
case ADST_FLIPADST:
fliplr(dest, stride, 8);
vp10_iht8x8_64_add(input, dest, stride, ADST_ADST);
fliplr(dest, stride, 8);
break;
case FLIPADST_ADST:
flipud(dest, stride, 8);
vp10_iht8x8_64_add(input, dest, stride, ADST_ADST);
flipud(dest, stride, 8);
break;
#endif // CONFIG_EXT_TX
default:
assert(0);
break;
......@@ -225,6 +348,33 @@ void vp10_inv_txfm_add_16x16(const tran_low_t *input, uint8_t *dest,
case ADST_ADST:
vp10_iht16x16_256_add(input, dest, stride, tx_type);
break;
#if CONFIG_EXT_TX
case FLIPADST_DCT:
flipud(dest, stride, 16);
vp10_iht16x16_256_add(input, dest, stride, ADST_DCT);
flipud(dest, stride, 16);
break;
case DCT_FLIPADST:
fliplr(dest, stride, 16);
vp10_iht16x16_256_add(input, dest, stride, DCT_ADST);
fliplr(dest, stride, 16);
break;
case FLIPADST_FLIPADST:
fliplrud(dest, stride, 16);
vp10_iht16x16_256_add(input, dest, stride, ADST_ADST);
fliplrud(dest, stride, 16);
break;
case ADST_FLIPADST:
fliplr(dest, stride, 16);
vp10_iht16x16_256_add(input, dest, stride, ADST_ADST);
fliplr(dest, stride, 16);
break;
case FLIPADST_ADST:
flipud(dest, stride, 16);
vp10_iht16x16_256_add(input, dest, stride, ADST_ADST);
flipud(dest, stride, 16);
break;
#endif // CONFIG_EXT_TX
default:
assert(0);
break;
......@@ -430,6 +580,33 @@ void vp10_highbd_inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest,
case ADST_ADST:
vp10_highbd_iht4x4_16_add(input, dest, stride, tx_type, bd);
break;
#if CONFIG_EXT_TX
case FLIPADST_DCT:
flipud16(CONVERT_TO_SHORTPTR(dest), stride, 4);
vp10_highbd_iht4x4_16_add(input, dest, stride, ADST_DCT, bd);
flipud16(CONVERT_TO_SHORTPTR(dest), stride, 4);
break;
case DCT_FLIPADST:
fliplr16(CONVERT_TO_SHORTPTR(dest), stride, 4);
vp10_highbd_iht4x4_16_add(input, dest, stride, DCT_ADST, bd);
fliplr16(CONVERT_TO_SHORTPTR(dest), stride, 4);
break;
case FLIPADST_FLIPADST:
fliplrud16(CONVERT_TO_SHORTPTR(dest), stride, 4);
vp10_highbd_iht4x4_16_add(input, dest, stride, ADST_ADST, bd);
fliplrud16(CONVERT_TO_SHORTPTR(dest), stride, 4);
break;
case ADST_FLIPADST:
fliplr16(CONVERT_TO_SHORTPTR(dest), stride, 4);
vp10_highbd_iht4x4_16_add(input, dest, stride, ADST_ADST, bd);
fliplr16(CONVERT_TO_SHORTPTR(dest), stride, 4);
break;
case FLIPADST_ADST:
flipud16(CONVERT_TO_SHORTPTR(dest), stride, 4);
vp10_highbd_iht4x4_16_add(input, dest, stride, ADST_ADST, bd);
flipud16(CONVERT_TO_SHORTPTR(dest), stride, 4);
break;
#endif // CONFIG_EXT_TX
default:
assert(0);
break;
......@@ -448,6 +625,33 @@ void vp10_highbd_inv_txfm_add_8x8(const tran_low_t *input, uint8_t *dest,
case ADST_ADST:
vp10_highbd_iht8x8_64_add(input, dest, stride, tx_type, bd);
break;
#if CONFIG_EXT_TX
case FLIPADST_DCT:
flipud16(CONVERT_TO_SHORTPTR(dest), stride, 8);
vp10_highbd_iht8x8_64_add(input, dest, stride, ADST_DCT, bd);
flipud16(CONVERT_TO_SHORTPTR(dest), stride, 8);
break;
case DCT_FLIPADST:
fliplr16(CONVERT_TO_SHORTPTR(dest), stride, 8);
vp10_highbd_iht8x8_64_add(input, dest, stride, DCT_ADST, bd);
fliplr16(CONVERT_TO_SHORTPTR(dest), stride, 8);
break;
case FLIPADST_FLIPADST:
fliplrud16(CONVERT_TO_SHORTPTR(dest), stride, 8);
vp10_highbd_iht8x8_64_add(input, dest, stride, ADST_ADST, bd);
fliplrud16(CONVERT_TO_SHORTPTR(dest), stride, 8);
break;
case ADST_FLIPADST:
fliplr16(CONVERT_TO_SHORTPTR(dest), stride, 8);
vp10_highbd_iht8x8_64_add(input, dest, stride, ADST_ADST, bd);
fliplr16(CONVERT_TO_SHORTPTR(dest), stride, 8);
break;
case FLIPADST_ADST:
flipud16(CONVERT_TO_SHORTPTR(dest), stride, 8);
vp10_highbd_iht8x8_64_add(input, dest, stride, ADST_ADST, bd);
flipud16(CONVERT_TO_SHORTPTR(dest), stride, 8);
break;
#endif // CONFIG_EXT_TX
default:
assert(0);
break;
......@@ -466,6 +670,33 @@ void vp10_highbd_inv_txfm_add_16x16(const tran_low_t *input, uint8_t *dest,
case ADST_ADST:
vp10_highbd_iht16x16_256_add(input, dest, stride, tx_type, bd);
break;
#if CONFIG_EXT_TX
case FLIPADST_DCT:
flipud16(CONVERT_TO_SHORTPTR(dest), stride, 16);
vp10_highbd_iht16x16_256_add(input, dest, stride, ADST_DCT, bd);
flipud16(CONVERT_TO_SHORTPTR(dest), stride, 16);
break;
case DCT_FLIPADST:
fliplr16(CONVERT_TO_SHORTPTR(dest), stride, 16);
vp10_highbd_iht16x16_256_add(input, dest, stride, DCT_ADST, bd);
fliplr16(CONVERT_TO_SHORTPTR(dest), stride, 16);
break;
case FLIPADST_FLIPADST:
fliplrud16(CONVERT_TO_SHORTPTR(dest), stride, 16);
vp10_highbd_iht16x16_256_add(input, dest, stride, ADST_ADST, bd);
fliplrud16(CONVERT_TO_SHORTPTR(dest), stride, 16);
break;
case ADST_FLIPADST:
fliplr16(CONVERT_TO_SHORTPTR(dest), stride, 16);
vp10_highbd_iht16x16_256_add(input, dest, stride, ADST_ADST, bd);
fliplr16(CONVERT_TO_SHORTPTR(dest), stride, 16);
break;
case FLIPADST_ADST:
flipud16(CONVERT_TO_SHORTPTR(dest), stride, 16);
vp10_highbd_iht16x16_256_add(input, dest, stride, ADST_ADST, bd);
flipud16(CONVERT_TO_SHORTPTR(dest), stride, 16);
break;
#endif // CONFIG_EXT_TX
default:
assert(0);
break;
......
......@@ -702,7 +702,7 @@ const scan_order vp10_default_scan_orders[TX_SIZES] = {
{default_scan_32x32, vp10_default_iscan_32x32, default_scan_32x32_neighbors},
};
const scan_order vp10_scan_orders[TX_SIZES][TX_TYPES] = {
const scan_order vp10_intra_scan_orders[TX_SIZES][TX_TYPES] = {
{ // TX_4X4
{default_scan_4x4, vp10_default_iscan_4x4, default_scan_4x4_neighbors},
{row_scan_4x4, vp10_row_iscan_4x4, row_scan_4x4_neighbors},
......@@ -725,3 +725,49 @@ const scan_order vp10_scan_orders[TX_SIZES][TX_TYPES] = {
{default_scan_32x32, vp10_default_iscan_32x32, default_scan_32x32_neighbors},
}
};
#if CONFIG_EXT_TX
const scan_order vp10_inter_scan_orders[TX_SIZES][TOTAL_TX_TYPES] = {
{ // TX_4X4
{default_scan_4x4, vp10_default_iscan_4x4, default_scan_4x4_neighbors},
{default_scan_4x4, vp10_default_iscan_4x4, default_scan_4x4_neighbors},
{default_scan_4x4, vp10_default_iscan_4x4, default_scan_4x4_neighbors},
{default_scan_4x4, vp10_default_iscan_4x4, default_scan_4x4_neighbors},
{default_scan_4x4, vp10_default_iscan_4x4, default_scan_4x4_neighbors},
{default_scan_4x4, vp10_default_iscan_4x4, default_scan_4x4_neighbors},
{default_scan_4x4, vp10_default_iscan_4x4, default_scan_4x4_neighbors},
{default_scan_4x4, vp10_default_iscan_4x4, default_scan_4x4_neighbors},
{default_scan_4x4, vp10_default_iscan_4x4, default_scan_4x4_neighbors},
}, { // TX_8X8
{default_scan_8x8, vp10_default_iscan_8x8, default_scan_8x8_neighbors},
{default_scan_8x8, vp10_default_iscan_8x8, default_scan_8x8_neighbors},
{default_scan_8x8, vp10_default_iscan_8x8, default_scan_8x8_neighbors},
{default_scan_8x8, vp10_default_iscan_8x8, default_scan_8x8_neighbors},
{default_scan_8x8, vp10_default_iscan_8x8, default_scan_8x8_neighbors},
{default_scan_8x8, vp10_default_iscan_8x8, default_scan_8x8_neighbors},
{default_scan_8x8, vp10_default_iscan_8x8, default_scan_8x8_neighbors},
{default_scan_8x8, vp10_default_iscan_8x8, default_scan_8x8_neighbors},
{default_scan_8x8, vp10_default_iscan_8x8, default_scan_8x8_neighbors},
}, { // TX_16X16
{default_scan_16x16, vp10_default_iscan_16x16, default_scan_16x16_neighbors},
{default_scan_16x16, vp10_default_iscan_16x16, default_scan_16x16_neighbors},
{default_scan_16x16, vp10_default_iscan_16x16, default_scan_16x16_neighbors},
{default_scan_16x16, vp10_default_iscan_16x16, default_scan_16x16_neighbors},
{default_scan_16x16, vp10_default_iscan_16x16, default_scan_16x16_neighbors},
{default_scan_16x16, vp10_default_iscan_16x16, default_scan_16x16_neighbors},
{default_scan_16x16, vp10_default_iscan_16x16, default_scan_16x16_neighbors},
{default_scan_16x16, vp10_default_iscan_16x16, default_scan_16x16_neighbors},
{default_scan_16x16, vp10_default_iscan_16x16, default_scan_16x16_neighbors},
}, { // TX_32X32
{default_scan_32x32, vp10_default_iscan_32x32, default_scan_32x32_neighbors},
{default_scan_32x32, vp10_default_iscan_32x32, default_scan_32x32_neighbors},
{default_scan_32x32, vp10_default_iscan_32x32, default_scan_32x32_neighbors},
{default_scan_32x32, vp10_default_iscan_32x32, default_scan_32x32_neighbors},
{default_scan_32x32, vp10_default_iscan_32x32, default_scan_32x32_neighbors},
{default_scan_32x32, vp10_default_iscan_32x32, default_scan_32x32_neighbors},
{default_scan_32x32, vp10_default_iscan_32x32, default_scan_32x32_neighbors},
{default_scan_32x32, vp10_default_iscan_32x32, default_scan_32x32_neighbors},
{default_scan_32x32, vp10_default_iscan_32x32, default_scan_32x32_neighbors},
}
};
#endif // CONFIG_EXT_TX
......@@ -30,7 +30,7 @@ typedef struct {
} scan_order;
extern const scan_order vp10_default_scan_orders[TX_SIZES];
extern const scan_order vp10_scan_orders[TX_SIZES][TX_TYPES];
extern const scan_order vp10_intra_scan_orders[TX_SIZES][TX_TYPES];
static INLINE int get_coef_context(const int16_t *neighbors,
const uint8_t *token_cache, int c) {
......@@ -38,8 +38,31 @@ static INLINE int get_coef_context(const int16_t *neighbors,
token_cache[neighbors[MAX_NEIGHBORS * c + 1]]) >> 1;
}
static INLINE const scan_order *get_scan(TX_SIZE tx_size, TX_TYPE tx_type) {
return &vp10_scan_orders[tx_size][tx_type];
static INLINE const scan_order *get_intra_scan(TX_SIZE tx_size,
TX_TYPE tx_type) {
return &vp10_intra_scan_orders[tx_size][tx_type];
}
#if CONFIG_EXT_TX
extern const scan_order vp10_inter_scan_orders[TX_SIZES][TOTAL_TX_TYPES];
static INLINE const scan_order *get_inter_scan(TX_SIZE tx_size,
TX_TYPE tx_type) {
return &vp10_inter_scan_orders[tx_size][tx_type];
}
#endif // CONFIG_EXT_TX
static INLINE const scan_order *get_scan(TX_SIZE tx_size,
TX_TYPE tx_type,
int is_inter) {
#if CONFIG_EXT_TX
return
is_inter ? &vp10_inter_scan_orders[tx_size][tx_type] :
&vp10_intra_scan_orders[tx_size][tx_type];
#else
(void) is_inter;
return &vp10_intra_scan_orders[tx_size][tx_type];
#endif // CONFIG_EXT_TX
}
#ifdef __cplusplus
......
......@@ -348,7 +348,7 @@ static void predict_and_reconstruct_intra_block(MACROBLOCKD *const xd,
if (!mbmi->skip) {
TX_TYPE tx_type = get_tx_type(plane_type, xd, block_idx, tx_size);
const scan_order *sc = get_scan(tx_size, tx_type);
const scan_order *sc = get_scan(tx_size, tx_type, 0);
const int eob = vp10_decode_block_tokens(xd, plane, sc, col, row, tx_size,
r, mbmi->segment_id);
inverse_transform_block_intra(xd, plane, tx_type, tx_size,
......@@ -363,7 +363,7 @@ static int reconstruct_inter_block(MACROBLOCKD *const xd, vpx_reader *r,
PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV;
int block_idx = (row << 1) + col;
TX_TYPE tx_type = get_tx_type(plane_type, xd, block_idx, tx_size);
const scan_order *sc = get_scan(tx_size, tx_type);
const scan_order *sc = get_scan(tx_size, tx_type, 1);
const int eob = vp10_decode_block_tokens(xd, plane, sc, col, row, tx_size, r,
mbmi->segment_id);
......@@ -1970,6 +1970,17 @@ static size_t read_uncompressed_header(VP10Decoder *pbi,
return sz;
}
#if CONFIG_EXT_TX