Commit cd7c7a9d authored by Hui Su's avatar Hui Su Committed by Gerrit Code Review

Merge "Refactor ext-tx experiment" into nextgenv2

parents 6a9f0db9 4f16f119
...@@ -32,6 +32,11 @@ extern "C" { ...@@ -32,6 +32,11 @@ extern "C" {
#define MAX_MB_PLANE 3 #define MAX_MB_PLANE 3
#if CONFIG_EXT_TX
#define GET_TX_TYPES(tx_size) \
((tx_size) >= TX_32X32 ? 1 : TX_TYPES)
#endif // CONFIG_EXT_TX
typedef enum { typedef enum {
KEY_FRAME = 0, KEY_FRAME = 0,
INTER_FRAME = 1, INTER_FRAME = 1,
...@@ -83,8 +88,8 @@ typedef struct { ...@@ -83,8 +88,8 @@ typedef struct {
INTERP_FILTER interp_filter; INTERP_FILTER interp_filter;
MV_REFERENCE_FRAME ref_frame[2]; MV_REFERENCE_FRAME ref_frame[2];
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
EXT_TX_TYPE ext_txfrm; TX_TYPE tx_type;
#endif #endif // CONFIG_EXT_TX
// TODO(slavarnway): Delete and use bmi[3].as_mv[] instead. // TODO(slavarnway): Delete and use bmi[3].as_mv[] instead.
int_mv mv[2]; int_mv mv[2];
...@@ -224,42 +229,6 @@ static const TX_TYPE intra_mode_to_tx_type_lookup[INTRA_MODES] = { ...@@ -224,42 +229,6 @@ static const TX_TYPE intra_mode_to_tx_type_lookup[INTRA_MODES] = {
ADST_ADST, // TM ADST_ADST, // TM
}; };
#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_DCT,
DCT_ADST,
ADST_ADST,
FLIPADST_DCT,
DCT_FLIPADST,
FLIPADST_FLIPADST,
ADST_FLIPADST,
FLIPADST_ADST,
DST_DCT,
DCT_DST,
DST_ADST,
ADST_DST,
DST_FLIPADST,
FLIPADST_DST,
DST_DST,
IDTX,
};
#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, static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type,
const MACROBLOCKD *xd, const MACROBLOCKD *xd,
int block_idx, TX_SIZE tx_size) { int block_idx, TX_SIZE tx_size) {
...@@ -271,7 +240,7 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type, ...@@ -271,7 +240,7 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type,
return DCT_DCT; return DCT_DCT;
if (mbmi->sb_type >= BLOCK_8X8) { if (mbmi->sb_type >= BLOCK_8X8) {
if (plane_type == PLANE_TYPE_Y || is_inter_block(mbmi)) if (plane_type == PLANE_TYPE_Y || is_inter_block(mbmi))
return ext_tx_to_txtype[mbmi->ext_txfrm]; return mbmi->tx_type;
} }
if (is_inter_block(mbmi)) if (is_inter_block(mbmi))
......
...@@ -315,27 +315,27 @@ static const vpx_prob default_switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS] ...@@ -315,27 +315,27 @@ static const vpx_prob default_switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS]
}; };
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
const vpx_tree_index vp10_ext_tx_tree[TREE_SIZE(EXT_TX_TYPES)] = { const vpx_tree_index vp10_tx_type_tree[TREE_SIZE(TX_TYPES)] = {
-ALT16, 2, -IDTX, 2,
-NORM, 4, -DCT_DCT, 4,
-ALT15, 6, -DST_DST, 6,
8, 18, 8, 18,
10, 12, 10, 12,
-ALT9, -ALT10, -DST_DCT, -DCT_DST,
14, 16, 14, 16,
-ALT1, -ALT2, -ADST_DCT, -DCT_ADST,
-ALT4, -ALT5, -FLIPADST_DCT, -DCT_FLIPADST,
20, 26, 20, 26,
22, 24, 22, 24,
-ALT11, -ALT12, -DST_ADST, -ADST_DST,
-ALT13, -ALT14, -DST_FLIPADST, -FLIPADST_DST,
28, 30, 28, 30,
-ALT3, -ALT6, -ADST_ADST, -FLIPADST_FLIPADST,
-ALT7, -ALT8 -ADST_FLIPADST, -FLIPADST_ADST
}; };
static const vpx_prob static const vpx_prob
default_inter_ext_tx_prob[EXT_TX_SIZES][EXT_TX_TYPES - 1] = { default_inter_tx_type_prob[EXT_TX_SIZES][TX_TYPES - 1] = {
{ 12, 112, 16, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, { 12, 112, 16, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128 }, 128 },
{ 12, 112, 16, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, { 12, 112, 16, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
...@@ -345,7 +345,7 @@ default_inter_ext_tx_prob[EXT_TX_SIZES][EXT_TX_TYPES - 1] = { ...@@ -345,7 +345,7 @@ default_inter_ext_tx_prob[EXT_TX_SIZES][EXT_TX_TYPES - 1] = {
}; };
static const vpx_prob static const vpx_prob
default_intra_ext_tx_prob[EXT_TX_SIZES][INTRA_MODES][EXT_TX_TYPES - 1] = { default_intra_tx_type_prob[EXT_TX_SIZES][INTRA_MODES][TX_TYPES - 1] = {
{ {
{ 8, 11, 24, 112, 87, 137, 127, 134, { 8, 11, 24, 112, 87, 137, 127, 134,
128, 86, 128, 124, 125, 133, 176, 123, }, 128, 86, 128, 124, 125, 133, 176, 123, },
...@@ -428,8 +428,8 @@ static void init_mode_probs(FRAME_CONTEXT *fc) { ...@@ -428,8 +428,8 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
vp10_copy(fc->skip_probs, default_skip_probs); vp10_copy(fc->skip_probs, default_skip_probs);
vp10_copy(fc->inter_mode_probs, default_inter_mode_probs); vp10_copy(fc->inter_mode_probs, default_inter_mode_probs);
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
vp10_copy(fc->inter_ext_tx_prob, default_inter_ext_tx_prob); vp10_copy(fc->inter_tx_type_prob, default_inter_tx_type_prob);
vp10_copy(fc->intra_ext_tx_prob, default_intra_ext_tx_prob); vp10_copy(fc->intra_tx_type_prob, default_intra_tx_type_prob);
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
} }
...@@ -513,13 +513,13 @@ void vp10_adapt_mode_probs(VP10_COMMON *cm) { ...@@ -513,13 +513,13 @@ void vp10_adapt_mode_probs(VP10_COMMON *cm) {
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
for (i = TX_4X4; i <= TX_16X16; ++i) { for (i = TX_4X4; i <= TX_16X16; ++i) {
vpx_tree_merge_probs(vp10_ext_tx_tree, pre_fc->inter_ext_tx_prob[i], vpx_tree_merge_probs(vp10_tx_type_tree, pre_fc->inter_tx_type_prob[i],
counts->inter_ext_tx[i], fc->inter_ext_tx_prob[i]); counts->inter_tx_type[i], fc->inter_tx_type_prob[i]);
for (j = 0; j < INTRA_MODES; ++j) for (j = 0; j < INTRA_MODES; ++j)
vpx_tree_merge_probs(vp10_ext_tx_tree, pre_fc->intra_ext_tx_prob[i][j], vpx_tree_merge_probs(vp10_tx_type_tree, pre_fc->intra_tx_type_prob[i][j],
counts->intra_ext_tx[i][j], counts->intra_tx_type[i][j],
fc->intra_ext_tx_prob[i][j]); fc->intra_tx_type_prob[i][j]);
} }
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
} }
......
...@@ -57,8 +57,8 @@ typedef struct frame_contexts { ...@@ -57,8 +57,8 @@ typedef struct frame_contexts {
vpx_prob skip_probs[SKIP_CONTEXTS]; vpx_prob skip_probs[SKIP_CONTEXTS];
nmv_context nmvc; nmv_context nmvc;
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
vpx_prob inter_ext_tx_prob[EXT_TX_SIZES][EXT_TX_TYPES - 1]; vpx_prob inter_tx_type_prob[EXT_TX_SIZES][TX_TYPES - 1];
vpx_prob intra_ext_tx_prob[EXT_TX_SIZES][INTRA_MODES][EXT_TX_TYPES - 1]; vpx_prob intra_tx_type_prob[EXT_TX_SIZES][INTRA_MODES][TX_TYPES - 1];
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
int initialized; int initialized;
} FRAME_CONTEXT; } FRAME_CONTEXT;
...@@ -81,8 +81,8 @@ typedef struct FRAME_COUNTS { ...@@ -81,8 +81,8 @@ typedef struct FRAME_COUNTS {
unsigned int skip[SKIP_CONTEXTS][2]; unsigned int skip[SKIP_CONTEXTS][2];
nmv_context_counts mv; nmv_context_counts mv;
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
unsigned int inter_ext_tx[EXT_TX_SIZES][EXT_TX_TYPES]; unsigned int inter_tx_type[EXT_TX_SIZES][TX_TYPES];
unsigned int intra_ext_tx[EXT_TX_SIZES][INTRA_MODES][EXT_TX_TYPES]; unsigned int intra_tx_type[EXT_TX_SIZES][INTRA_MODES][TX_TYPES];
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
} FRAME_COUNTS; } FRAME_COUNTS;
...@@ -109,7 +109,7 @@ void vp10_tx_counts_to_branch_counts_8x8(const unsigned int *tx_count_8x8p, ...@@ -109,7 +109,7 @@ void vp10_tx_counts_to_branch_counts_8x8(const unsigned int *tx_count_8x8p,
unsigned int (*ct_8x8p)[2]); unsigned int (*ct_8x8p)[2]);
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
extern const vpx_tree_index vp10_ext_tx_tree[TREE_SIZE(EXT_TX_TYPES)]; extern const vpx_tree_index vp10_tx_type_tree[TREE_SIZE(TX_TYPES)];
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -114,26 +114,6 @@ typedef enum { ...@@ -114,26 +114,6 @@ typedef enum {
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
#define EXT_TX_SIZES 3 // number of sizes that use extended transforms #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,
ALT9 = 9,
ALT10 = 10,
ALT11 = 11,
ALT12 = 12,
ALT13 = 13,
ALT14 = 14,
ALT15 = 15,
ALT16 = 16,
EXT_TX_TYPES
} EXT_TX_TYPE;
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
typedef enum { typedef enum {
......
...@@ -2073,15 +2073,15 @@ static void read_ext_tx_probs(FRAME_CONTEXT *fc, vpx_reader *r) { ...@@ -2073,15 +2073,15 @@ static void read_ext_tx_probs(FRAME_CONTEXT *fc, vpx_reader *r) {
int i, j, k; int i, j, k;
if (vpx_read(r, GROUP_DIFF_UPDATE_PROB)) { if (vpx_read(r, GROUP_DIFF_UPDATE_PROB)) {
for (i = TX_4X4; i <= TX_16X16; ++i) for (i = TX_4X4; i <= TX_16X16; ++i)
for (j = 0; j < EXT_TX_TYPES - 1; ++j) for (j = 0; j < TX_TYPES - 1; ++j)
vp10_diff_update_prob(r, &fc->inter_ext_tx_prob[i][j]); vp10_diff_update_prob(r, &fc->inter_tx_type_prob[i][j]);
} }
if (vpx_read(r, GROUP_DIFF_UPDATE_PROB)) { if (vpx_read(r, GROUP_DIFF_UPDATE_PROB)) {
for (i = TX_4X4; i <= TX_16X16; ++i) for (i = TX_4X4; i <= TX_16X16; ++i)
for (j = 0; j < INTRA_MODES; ++j) for (j = 0; j < INTRA_MODES; ++j)
for (k = 0; k < EXT_TX_TYPES - 1; ++k) for (k = 0; k < TX_TYPES - 1; ++k)
vp10_diff_update_prob(r, &fc->intra_ext_tx_prob[i][j][k]); vp10_diff_update_prob(r, &fc->intra_tx_type_prob[i][j][k]);
} }
} }
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
......
...@@ -249,11 +249,11 @@ static void read_intra_frame_mode_info(VP10_COMMON *const cm, ...@@ -249,11 +249,11 @@ static void read_intra_frame_mode_info(VP10_COMMON *const cm,
if (mbmi->tx_size <= TX_16X16 && cm->base_qindex > 0 && if (mbmi->tx_size <= TX_16X16 && cm->base_qindex > 0 &&
mbmi->sb_type >= BLOCK_8X8 && !mbmi->skip && mbmi->sb_type >= BLOCK_8X8 && !mbmi->skip &&
!segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) { !segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
mbmi->ext_txfrm = mbmi->tx_type =
vpx_read_tree(r, vp10_ext_tx_tree, vpx_read_tree(r, vp10_tx_type_tree,
cm->fc->intra_ext_tx_prob[mbmi->tx_size][mbmi->mode]); cm->fc->intra_tx_type_prob[mbmi->tx_size][mbmi->mode]);
} else { } else {
mbmi->ext_txfrm = NORM; mbmi->tx_type = DCT_DCT;
} }
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
} }
...@@ -620,22 +620,22 @@ static void read_inter_frame_mode_info(VP10Decoder *const pbi, ...@@ -620,22 +620,22 @@ static void read_inter_frame_mode_info(VP10Decoder *const pbi,
FRAME_COUNTS *counts = xd->counts; FRAME_COUNTS *counts = xd->counts;
if (inter_block) if (inter_block)
mbmi->ext_txfrm = mbmi->tx_type =
vpx_read_tree(r, vp10_ext_tx_tree, vpx_read_tree(r, vp10_tx_type_tree,
cm->fc->inter_ext_tx_prob[mbmi->tx_size]); cm->fc->inter_tx_type_prob[mbmi->tx_size]);
else else
mbmi->ext_txfrm = mbmi->tx_type = vpx_read_tree(r, vp10_tx_type_tree,
vpx_read_tree(r, vp10_ext_tx_tree, cm->fc->intra_tx_type_prob
cm->fc->intra_ext_tx_prob[mbmi->tx_size][mbmi->mode]); [mbmi->tx_size][mbmi->mode]);
if (counts) { if (counts) {
if (inter_block) if (inter_block)
++counts->inter_ext_tx[mbmi->tx_size][mbmi->ext_txfrm]; ++counts->inter_tx_type[mbmi->tx_size][mbmi->tx_type];
else else
++counts->intra_ext_tx[mbmi->tx_size][mbmi->mode][mbmi->ext_txfrm]; ++counts->intra_tx_type[mbmi->tx_size][mbmi->mode][mbmi->tx_type];
} }
} else { } else {
mbmi->ext_txfrm = NORM; mbmi->tx_type = DCT_DCT;
} }
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
} }
......
...@@ -46,12 +46,12 @@ static const struct vp10_token inter_mode_encodings[INTER_MODES] = ...@@ -46,12 +46,12 @@ static const struct vp10_token inter_mode_encodings[INTER_MODES] =
{{2, 2}, {6, 3}, {0, 1}, {7, 3}}; {{2, 2}, {6, 3}, {0, 1}, {7, 3}};
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
static struct vp10_token ext_tx_encodings[EXT_TX_TYPES]; static struct vp10_token tx_type_encodings[TX_TYPES];
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
void vp10_encode_token_init() { void vp10_encode_token_init() {
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
vp10_tokens_from_tree(ext_tx_encodings, vp10_ext_tx_tree); vp10_tokens_from_tree(tx_type_encodings, vp10_tx_type_tree);
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
} }
...@@ -169,15 +169,15 @@ static void update_ext_tx_probs(VP10_COMMON *cm, vpx_writer *w) { ...@@ -169,15 +169,15 @@ static void update_ext_tx_probs(VP10_COMMON *cm, vpx_writer *w) {
int do_update = 0; int do_update = 0;
for (i = TX_4X4; i <= TX_16X16; ++i) { for (i = TX_4X4; i <= TX_16X16; ++i) {
savings += prob_diff_update_savings( savings += prob_diff_update_savings(
vp10_ext_tx_tree, cm->fc->inter_ext_tx_prob[i], vp10_tx_type_tree, cm->fc->inter_tx_type_prob[i],
cm->counts.inter_ext_tx[i], EXT_TX_TYPES); cm->counts.inter_tx_type[i], TX_TYPES);
} }
do_update = savings > savings_thresh; do_update = savings > savings_thresh;
vpx_write(w, do_update, GROUP_DIFF_UPDATE_PROB); vpx_write(w, do_update, GROUP_DIFF_UPDATE_PROB);
if (do_update) { if (do_update) {
for (i = TX_4X4; i <= TX_16X16; ++i) { for (i = TX_4X4; i <= TX_16X16; ++i) {
prob_diff_update(vp10_ext_tx_tree, cm->fc->inter_ext_tx_prob[i], prob_diff_update(vp10_tx_type_tree, cm->fc->inter_tx_type_prob[i],
cm->counts.inter_ext_tx[i], EXT_TX_TYPES, w); cm->counts.inter_tx_type[i], TX_TYPES, w);
} }
} }
...@@ -187,15 +187,15 @@ static void update_ext_tx_probs(VP10_COMMON *cm, vpx_writer *w) { ...@@ -187,15 +187,15 @@ static void update_ext_tx_probs(VP10_COMMON *cm, vpx_writer *w) {
for (i = TX_4X4; i <= TX_16X16; ++i) for (i = TX_4X4; i <= TX_16X16; ++i)
for (j = 0; j < INTRA_MODES; ++j) for (j = 0; j < INTRA_MODES; ++j)
savings += prob_diff_update_savings( savings += prob_diff_update_savings(
vp10_ext_tx_tree, cm->fc->intra_ext_tx_prob[i][j], vp10_tx_type_tree, cm->fc->intra_tx_type_prob[i][j],
cm->counts.intra_ext_tx[i][j], EXT_TX_TYPES); cm->counts.intra_tx_type[i][j], TX_TYPES);
do_update = savings > savings_thresh; do_update = savings > savings_thresh;
vpx_write(w, do_update, GROUP_DIFF_UPDATE_PROB); vpx_write(w, do_update, GROUP_DIFF_UPDATE_PROB);
if (do_update) { if (do_update) {
for (i = TX_4X4; i <= TX_16X16; ++i) for (i = TX_4X4; i <= TX_16X16; ++i)
for (j = 0; j < INTRA_MODES; ++j) for (j = 0; j < INTRA_MODES; ++j)
prob_diff_update(vp10_ext_tx_tree, cm->fc->intra_ext_tx_prob[i][j], prob_diff_update(vp10_tx_type_tree, cm->fc->intra_tx_type_prob[i][j],
cm->counts.intra_ext_tx[i][j], EXT_TX_TYPES, w); cm->counts.intra_tx_type[i][j], TX_TYPES, w);
} }
} }
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
...@@ -423,13 +423,13 @@ static void pack_inter_mode_mvs(VP10_COMP *cpi, const MODE_INFO *mi, ...@@ -423,13 +423,13 @@ static void pack_inter_mode_mvs(VP10_COMP *cpi, const MODE_INFO *mi,
bsize >= BLOCK_8X8 && !mbmi->skip && bsize >= BLOCK_8X8 && !mbmi->skip &&
!segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) { !segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
if (is_inter) if (is_inter)
vp10_write_token(w, vp10_ext_tx_tree, vp10_write_token(w, vp10_tx_type_tree,
cm->fc->inter_ext_tx_prob[mbmi->tx_size], cm->fc->inter_tx_type_prob[mbmi->tx_size],
&ext_tx_encodings[mbmi->ext_txfrm]); &tx_type_encodings[mbmi->tx_type]);
else else
vp10_write_token(w, vp10_ext_tx_tree, vp10_write_token(w, vp10_tx_type_tree,
cm->fc->intra_ext_tx_prob[mbmi->tx_size][mbmi->mode], cm->fc->intra_tx_type_prob[mbmi->tx_size][mbmi->mode],
&ext_tx_encodings[mbmi->ext_txfrm]); &tx_type_encodings[mbmi->tx_type]);
} }
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
} }
...@@ -473,9 +473,9 @@ static void write_mb_modes_kf(const VP10_COMMON *cm, const MACROBLOCKD *xd, ...@@ -473,9 +473,9 @@ static void write_mb_modes_kf(const VP10_COMMON *cm, const MACROBLOCKD *xd,
if (mbmi->tx_size <= TX_16X16 && cm->base_qindex > 0 && if (mbmi->tx_size <= TX_16X16 && cm->base_qindex > 0 &&
bsize >= BLOCK_8X8 && !mbmi->skip && bsize >= BLOCK_8X8 && !mbmi->skip &&
!segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) { !segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
vp10_write_token(w, vp10_ext_tx_tree, vp10_write_token(w, vp10_tx_type_tree,
cm->fc->intra_ext_tx_prob[mbmi->tx_size][mbmi->mode], cm->fc->intra_tx_type_prob[mbmi->tx_size][mbmi->mode],
&ext_tx_encodings[mbmi->ext_txfrm]); &tx_type_encodings[mbmi->tx_type]);
} }
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
} }
......
...@@ -2993,9 +2993,9 @@ static void encode_superblock(VP10_COMP *cpi, ThreadData *td, ...@@ -2993,9 +2993,9 @@ static void encode_superblock(VP10_COMP *cpi, ThreadData *td,
bsize >= BLOCK_8X8 && !mbmi->skip && bsize >= BLOCK_8X8 && !mbmi->skip &&
!segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) { !segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
if (is_inter_block(mbmi)) if (is_inter_block(mbmi))
++td->counts->inter_ext_tx[mbmi->tx_size][mbmi->ext_txfrm]; ++td->counts->inter_tx_type[mbmi->tx_size][mbmi->tx_type];
else else
++td->counts->intra_ext_tx[mbmi->tx_size][mbmi->mode][mbmi->ext_txfrm]; ++td->counts->intra_tx_type[mbmi->tx_size][mbmi->mode][mbmi->tx_type];
} }
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
} }
......
...@@ -459,8 +459,8 @@ typedef struct VP10_COMP { ...@@ -459,8 +459,8 @@ typedef struct VP10_COMP {
int switchable_interp_costs[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS]; int switchable_interp_costs[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS];
int partition_cost[PARTITION_CONTEXTS][PARTITION_TYPES]; int partition_cost[PARTITION_CONTEXTS][PARTITION_TYPES];
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
int inter_ext_tx_costs[EXT_TX_SIZES][EXT_TX_TYPES]; int inter_tx_type_costs[EXT_TX_SIZES][TX_TYPES];
int intra_ext_tx_costs[EXT_TX_SIZES][INTRA_MODES][EXT_TX_TYPES]; int intra_tx_type_costs[EXT_TX_SIZES][INTRA_MODES][TX_TYPES];
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
int multi_arf_allowed; int multi_arf_allowed;
......
...@@ -86,11 +86,11 @@ static void fill_mode_costs(VP10_COMP *cpi) { ...@@ -86,11 +86,11 @@ static void fill_mode_costs(VP10_COMP *cpi) {
fc->switchable_interp_prob[i], vp10_switchable_interp_tree); fc->switchable_interp_prob[i], vp10_switchable_interp_tree);
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
for (i = TX_4X4; i <= TX_16X16; ++i) { for (i = TX_4X4; i <= TX_16X16; ++i) {
vp10_cost_tokens(cpi->inter_ext_tx_costs[i], fc->inter_ext_tx_prob[i], vp10_cost_tokens(cpi->inter_tx_type_costs[i], fc->inter_tx_type_prob[i],
vp10_ext_tx_tree); vp10_tx_type_tree);
for (j = 0; j < INTRA_MODES; ++j) for (j = 0; j < INTRA_MODES; ++j)
vp10_cost_tokens(cpi->intra_ext_tx_costs[i][j], vp10_cost_tokens(cpi->intra_tx_type_costs[i][j],
fc->intra_ext_tx_prob[i][j], vp10_ext_tx_tree); fc->intra_tx_type_prob[i][j], vp10_tx_type_tree);
} }
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
} }
......
...@@ -591,7 +591,7 @@ static void choose_largest_tx_size(VP10_COMP *cpi, MACROBLOCK *x, ...@@ -591,7 +591,7 @@ static void choose_largest_tx_size(VP10_COMP *cpi, MACROBLOCK *x,
MACROBLOCKD *const xd = &x->e_mbd; MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
int tx_type, best_tx_type = NORM; int tx_type, best_tx_type = DCT_DCT;
int r, s; int r, s;
int64_t d, psse, this_rd, best_rd = INT64_MAX; int64_t d, psse, this_rd, best_rd = INT64_MAX;
vpx_prob skip_prob = vp10_get_skip_prob(cm, xd); vpx_prob skip_prob = vp10_get_skip_prob(cm, xd);
...@@ -602,16 +602,16 @@ static void choose_largest_tx_size(VP10_COMP *cpi, MACROBLOCK *x, ...@@ -602,16 +602,16 @@ static void choose_largest_tx_size(VP10_COMP *cpi, MACROBLOCK *x,
mbmi->tx_size = VPXMIN(max_tx_size, largest_tx_size); mbmi->tx_size = VPXMIN(max_tx_size, largest_tx_size);
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
if (is_inter_block(mbmi) && bs >= BLOCK_8X8 && !xd->lossless) { if (is_inter_block(mbmi) && bs >= BLOCK_8X8 && !xd->lossless) {
for (tx_type = NORM; tx_type < EXT_TX_TYPES - 1; ++tx_type) { for (tx_type = DCT_DCT; tx_type < TX_TYPES - 1; ++tx_type) {
if (mbmi->ext_txfrm >= ALT11 && mbmi->ext_txfrm < ALT16 && if (mbmi->tx_type >= DST_ADST && mbmi->tx_type < IDTX &&
best_tx_type == NORM) { best_tx_type == DCT_DCT) {
tx_type = ALT16 - 1; tx_type = IDTX - 1;
continue; continue;
} }
if (tx_type >= GET_EXT_TX_TYPES(mbmi->tx_size)) if (tx_type >= GET_TX_TYPES(mbmi->tx_size))
continue; continue;
mbmi->ext_txfrm = tx_type; mbmi->tx_type = tx_type;
txfm_rd_in_plane(x, &r, &d, &s, txfm_rd_in_plane(x, &r, &d, &s,
&psse, ref_best_rd, 0, bs, mbmi->tx_size, &psse, ref_best_rd, 0, bs, mbmi->tx_size,
cpi->sf.use_fast_coef_costing); cpi->sf.use_fast_coef_costing);
...@@ -620,10 +620,10 @@ static void choose_largest_tx_size(VP10_COMP *cpi, MACROBLOCK *x, ...@@ -620,10 +620,10 @@ static void choose_largest_tx_size(VP10_COMP *cpi, MACROBLOCK *x,
continue; continue;
if (mbmi->tx_size <= TX_16X16) { if (mbmi->tx_size <= TX_16X16) {
if (is_inter_block(mbmi)) if (is_inter_block(mbmi))
r += cpi->inter_ext_tx_costs[mbmi->tx_size][mbmi->ext_txfrm]; r += cpi->inter_tx_type_costs[mbmi->tx_size][mbmi->tx_type];
else else
r += cpi->intra_ext_tx_costs[mbmi->tx_size] r += cpi->intra_tx_type_costs[mbmi->tx_size]
[mbmi->mode][mbmi->ext_txfrm]; [mbmi->mode][mbmi->tx_type];
} }
if (s) if (s)
...@@ -633,14 +633,14 @@ static void choose_largest_tx_size(VP10_COMP *cpi, MACROBLOCK *x, ...@@ -633,14 +633,14 @@ static void choose_largest_tx_size(VP10_COMP *cpi, MACROBLOCK *x,
if (is_inter_block(mbmi) && !xd->lossless && !s) if (is_inter_block(mbmi) && !xd->lossless && !s)
this_rd = VPXMIN(this_rd, RDCOST(x->rdmult, x->rddiv, s1, psse)); this_rd = VPXMIN(this_rd, RDCOST(x->rdmult, x->rddiv, s1, psse));
if (this_rd < ((best_tx_type == NORM) ? ext_tx_th : 1) * best_rd) { if (this_rd < ((best_tx_type == DCT_DCT) ? ext_tx_th : 1) * best_rd) {
best_rd = this_rd; best_rd = this_rd;
best_tx_type = mbmi->ext_txfrm; best_tx_type = mbmi->tx_type;
} }
} }
} }
mbmi->ext_txfrm = best_tx_type; mbmi->tx_type = best_tx_type;
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
txfm_rd_in_plane(x, rate, distortion, skip, txfm_rd_in_plane(x, rate, distortion, skip,
...@@ -651,10 +651,10 @@ static void choose_largest_tx_size(VP10_COMP *cpi, MACROBLOCK *x, ...@@ -651,10 +651,10 @@ static void choose_largest_tx_size(VP10_COMP *cpi, MACROBLOCK *x,
if (bs >= BLOCK_8X8 && mbmi->tx_size <= TX_16X16 && if (bs >= BLOCK_8X8 && mbmi->tx_size <= TX_16X16 &&
!xd->lossless && *rate != INT_MAX) { !xd->lossless && *rate != INT_MAX) {
if (is_inter_block(mbmi)) if (is_inter_block(mbmi))
*rate += cpi->inter_ext_tx_costs[mbmi->tx_size][mbmi->ext_txfrm]; *rate += cpi->inter_tx_type_costs[mbmi->tx_size][mbmi->tx_type];
else else
*rate += cpi->intra_ext_tx_costs[mbmi->tx_size] *rate += cpi->intra_tx_type_costs[mbmi->tx_size]
[mbmi->mode][mbmi->ext_txfrm]; [mbmi->mode][mbmi->tx_type];
} }
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
} }
...@@ -681,7 +681,7 @@ static void choose_tx_size_from_rd(VP10_COMP *cpi, MACROBLOCK *x, ...@@ -681,7 +681,7 @@ static void choose_tx_size_from_rd(VP10_COMP *cpi, MACROBLOCK *x,
int start_tx, end_tx; int start_tx, end_tx;
const int tx_select = cm->tx_mode == TX_MODE_SELECT; const int tx_select = cm->tx_mode == TX_MODE_SELECT;
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
int tx_type, best_tx_type = NORM; int tx_type, best_tx_type = DCT_DCT;
int start_tx_type, end_tx_type; int start_tx_type, end_tx_type;
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
...@@ -706,18 +706,18 @@ static void choose_tx_size_from_rd(VP10_COMP *cpi, MACROBLOCK *x, ...@@ -706,18 +706,18 @@ static void choose_tx_size_from_rd(VP10_COMP *cpi, MACROBLOCK *x,
*psse = INT64_MAX; *psse = INT64_MAX;
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
start_tx_type = NORM; start_tx_type = DCT_DCT;
if (bs >= BLOCK_8X8 && !xd->lossless) if (bs >= BLOCK_8X8 && !xd->lossless)
end_tx_type = EXT_TX_TYPES - 1; end_tx_type = TX_TYPES - 1;
else else
end_tx_type = NORM; end_tx_type = DCT_DCT;
for (tx_type = start_tx_type; tx_type <= end_tx_type; ++tx_type) { for (tx_type = start_tx_type; tx_type <= end_tx_type; ++tx_type) {
mbmi->ext_txfrm = tx_type; mbmi->tx_type = tx_type;
// TODO(huisu): clean up the logic. // TODO(huisu): clean up the logic.
if (mbmi->ext_txfrm >= ALT11 && mbmi->ext_txfrm < ALT16 && if (mbmi->tx_type >= DST_ADST && mbmi->tx_type < IDTX &&
best_tx_type == NORM) { best_tx_type == DCT_DCT) {
tx_type = ALT16 - 1; tx_type = IDTX - 1;
continue; continue;
} }
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
...@@ -725,7 +725,7 @@ static void choose_tx_size_from_rd(VP10_COMP *cpi, MACROBLOCK *x, ...@@ -725,7 +725,7 @@ static void choose_tx_size_from_rd(VP10_COMP *cpi, MACROBLOCK *x,
int r_tx_size = 0; int r_tx_size = 0;
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
if (mbmi->ext_txfrm >= GET_EXT_TX_TYPES(n)) if (mbmi->tx_type >= GET_TX_TYPES(n))
continue; continue;
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
...@@ -742,9 +742,9 @@ static void choose_tx_size_from_rd(VP10_COMP *cpi, MACROBLOCK *x, ...@@ -742,9 +742,9 @@ static void choose_tx_size_from_rd(VP10_COMP *cpi, MACROBLOCK *x,
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
if (bs >= BLOCK_8X8 && !xd->lossless && r != INT_MAX && n < TX_32X32) { if (bs >= BLOCK_8X8 && !xd<