Commit bdaa2576 authored by Debargha Mukherjee's avatar Debargha Mukherjee Committed by Gerrit Code Review

Merge "Refactoring tx-types to add more flexibility" into nextgenv2

parents fff67045 8a429244
...@@ -32,11 +32,6 @@ extern "C" { ...@@ -32,11 +32,6 @@ 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,
...@@ -250,6 +245,58 @@ static const TX_TYPE intra_mode_to_tx_type_lookup[INTRA_MODES] = { ...@@ -250,6 +245,58 @@ static const TX_TYPE intra_mode_to_tx_type_lookup[INTRA_MODES] = {
ADST_ADST, // TM ADST_ADST, // TM
}; };
#if CONFIG_EXT_TX
static const int num_ext_tx_set_inter[EXT_TX_SETS_INTER] = {
1, 17, 10, 2
};
static const int num_ext_tx_set_intra[EXT_TX_SETS_INTRA] = {
1, 17,
};
#define USE_IDTX_FOR_32X32 0
static INLINE int get_ext_tx_set(TX_SIZE tx_size, BLOCK_SIZE bs,
int is_inter) {
(void) is_inter;
if (tx_size > TX_32X32 || bs < BLOCK_8X8) return 0;
#if USE_IDTX_FOR_32X32
if (tx_size == TX_32X32) return is_inter ? 3 : 0;
#else
if (tx_size == TX_32X32) return 0;
#endif
return 1;
}
static INLINE int get_ext_tx_types(TX_SIZE tx_size, BLOCK_SIZE bs,
int is_inter) {
const int set = get_ext_tx_set(tx_size, bs, is_inter);
return is_inter ? num_ext_tx_set_inter[set] : num_ext_tx_set_intra[set];
}
static const int use_intra_ext_tx_for_tx[EXT_TX_SETS_INTRA][TX_SIZES] = {
{ 0, 0, 0, 0, }, // unused
{ 1, 1, 1, 0, },
};
static const int use_inter_ext_tx_for_tx[EXT_TX_SETS_INTER][TX_SIZES] = {
{ 0, 0, 0, 0, }, // unused
{ 1, 1, 1, 0, },
{ 0, 0, 0, 0, },
{ 0, 0, 0, USE_IDTX_FOR_32X32, },
};
static const int ext_tx_used_intra[EXT_TX_SETS_INTRA][TX_TYPES] = {
{ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, },
};
static const int ext_tx_used_inter[EXT_TX_SETS_INTER][TX_TYPES] = {
{ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, },
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, },
{ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, },
};
#endif // CONFIG_EXT_TX
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) {
...@@ -257,16 +304,27 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type, ...@@ -257,16 +304,27 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type,
const MB_MODE_INFO *const mbmi = &mi->mbmi; const MB_MODE_INFO *const mbmi = &mi->mbmi;
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
if ( xd->lossless[mbmi->segment_id] || tx_size >= TX_32X32) #if USE_IDTX_FOR_32X32
if (xd->lossless[mbmi->segment_id] || tx_size > TX_32X32 ||
(tx_size >= TX_32X32 && !is_inter_block(mbmi)))
#else
if (xd->lossless[mbmi->segment_id] || tx_size >= TX_32X32)
#endif
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)
return mbmi->tx_type; return mbmi->tx_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;
} }
if (is_inter_block(mbmi)) // Sub8x8-Inter/Intra OR UV-Intra
if (is_inter_block(mbmi)) // Sub8x8-Inter
return DCT_DCT; return DCT_DCT;
else else // Sub8x8 Intra OR UV-Intra
return intra_mode_to_tx_type_lookup[plane_type == PLANE_TYPE_Y ? return intra_mode_to_tx_type_lookup[plane_type == PLANE_TYPE_Y ?
get_y_mode(mi, block_idx) : mbmi->uv_mode]; get_y_mode(mi, block_idx) : mbmi->uv_mode];
#else #else
......
...@@ -755,7 +755,10 @@ static const vpx_prob default_switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS] ...@@ -755,7 +755,10 @@ static const vpx_prob default_switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS]
}; };
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
const vpx_tree_index vp10_tx_type_tree[TREE_SIZE(TX_TYPES)] = { const vpx_tree_index vp10_ext_tx_inter_tree[EXT_TX_SETS_INTER]
[TREE_SIZE(TX_TYPES)] = {
{
}, {
-IDTX, 2, -IDTX, 2,
-DCT_DCT, 4, -DCT_DCT, 4,
-DST_DST, 6, -DST_DST, 6,
...@@ -771,21 +774,83 @@ const vpx_tree_index vp10_tx_type_tree[TREE_SIZE(TX_TYPES)] = { ...@@ -771,21 +774,83 @@ const vpx_tree_index vp10_tx_type_tree[TREE_SIZE(TX_TYPES)] = {
-DST_FLIPADST, -FLIPADST_DST, -DST_FLIPADST, -FLIPADST_DST,
28, 30, 28, 30,
-ADST_ADST, -FLIPADST_FLIPADST, -ADST_ADST, -FLIPADST_FLIPADST,
-ADST_FLIPADST, -FLIPADST_ADST,
}, {
-IDTX, 2,
-DCT_DCT, 4,
6, 12,
8, 10,
-ADST_DCT, -DCT_ADST,
-FLIPADST_DCT, -DCT_FLIPADST,
14, 16,
-ADST_ADST, -FLIPADST_FLIPADST,
-ADST_FLIPADST, -FLIPADST_ADST -ADST_FLIPADST, -FLIPADST_ADST
}, {
-IDTX, -DCT_DCT,
}
};
const vpx_tree_index vp10_ext_tx_intra_tree[EXT_TX_SETS_INTRA]
[TREE_SIZE(TX_TYPES)] = {
{
}, {
-IDTX, 2,
-DCT_DCT, 4,
-DST_DST, 6,
8, 18,
10, 12,
-DST_DCT, -DCT_DST,
14, 16,
-ADST_DCT, -DCT_ADST,
-FLIPADST_DCT, -DCT_FLIPADST,
20, 26,
22, 24,
-DST_ADST, -ADST_DST,
-DST_FLIPADST, -FLIPADST_DST,
28, 30,
-ADST_ADST, -FLIPADST_FLIPADST,
-ADST_FLIPADST, -FLIPADST_ADST,
}
}; };
static const vpx_prob static const vpx_prob
default_inter_tx_type_prob[EXT_TX_SIZES][TX_TYPES - 1] = { default_inter_ext_tx_prob[EXT_TX_SETS_INTER][EXT_TX_SIZES][TX_TYPES - 1] = {
{
// unused
}, {
{ 12, 112, 16, 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,
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,
128 }, 128 },
#if EXT_TX_SIZES == 4
{ 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 },
#endif
}, {
{ 12, 112, 128, 128, 128, 128, 128, 128, 128 },
{ 12, 112, 128, 128, 128, 128, 128, 128, 128 },
{ 12, 112, 128, 128, 128, 128, 128, 128, 128 },
#if EXT_TX_SIZES == 4
{ 12, 112, 128, 128, 128, 128, 128, 128, 128 },
#endif
}, {
{ 12, },
{ 12, },
{ 12, },
#if EXT_TX_SIZES == 4
{ 12, },
#endif
}
}; };
static const vpx_prob static const vpx_prob
default_intra_tx_type_prob[EXT_TX_SIZES][INTRA_MODES][TX_TYPES - 1] = { default_intra_ext_tx_prob[EXT_TX_SETS_INTRA][EXT_TX_SIZES]
[INTRA_MODES][TX_TYPES - 1] = {
{
// unused
}, {
{ {
{ 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, },
...@@ -807,8 +872,7 @@ default_intra_tx_type_prob[EXT_TX_SIZES][INTRA_MODES][TX_TYPES - 1] = { ...@@ -807,8 +872,7 @@ default_intra_tx_type_prob[EXT_TX_SIZES][INTRA_MODES][TX_TYPES - 1] = {
77, 60, 125, 125, 128, 126, 198, 220, }, 77, 60, 125, 125, 128, 126, 198, 220, },
{ 3, 10, 29, 111, 69, 141, 204, 141, { 3, 10, 29, 111, 69, 141, 204, 141,
139, 93, 120, 75, 77, 163, 242, 124, }, 139, 93, 120, 75, 77, 163, 242, 124, },
}, }, {
{
{ 2, 53, 18, 147, 96, 98, 136, 133, { 2, 53, 18, 147, 96, 98, 136, 133,
131, 120, 153, 163, 169, 137, 173, 124, }, 131, 120, 153, 163, 169, 137, 173, 124, },
{ 4, 18, 34, 133, 54, 130, 179, 228, { 4, 18, 34, 133, 54, 130, 179, 228,
...@@ -829,8 +893,7 @@ default_intra_tx_type_prob[EXT_TX_SIZES][INTRA_MODES][TX_TYPES - 1] = { ...@@ -829,8 +893,7 @@ default_intra_tx_type_prob[EXT_TX_SIZES][INTRA_MODES][TX_TYPES - 1] = {
82, 76, 147, 149, 128, 132, 191, 225, }, 82, 76, 147, 149, 128, 132, 191, 225, },
{ 2, 15, 29, 111, 77, 126, 200, 135, { 2, 15, 29, 111, 77, 126, 200, 135,
117, 93, 152, 96, 84, 191, 245, 135, }, 117, 93, 152, 96, 84, 191, 245, 135, },
}, }, {
{
{ 2, 69, 13, 173, 111, 69, 137, 159, { 2, 69, 13, 173, 111, 69, 137, 159,
159, 146, 151, 193, 203, 131, 180, 123, }, 159, 146, 151, 193, 203, 131, 180, 123, },
{ 1, 12, 33, 164, 32, 98, 204, 242, { 1, 12, 33, 164, 32, 98, 204, 242,
...@@ -851,7 +914,31 @@ default_intra_tx_type_prob[EXT_TX_SIZES][INTRA_MODES][TX_TYPES - 1] = { ...@@ -851,7 +914,31 @@ default_intra_tx_type_prob[EXT_TX_SIZES][INTRA_MODES][TX_TYPES - 1] = {
113, 107, 136, 184, 188, 121, 210, 234, }, 113, 107, 136, 184, 188, 121, 210, 234, },
{ 1, 15, 22, 141, 59, 94, 208, 133, { 1, 15, 22, 141, 59, 94, 208, 133,
154, 95, 152, 112, 105, 191, 242, 111, }, 154, 95, 152, 112, 105, 191, 242, 111, },
#if EXT_TX_SIZES == 4
}, {
{ 2, 69, 13, 173, 111, 69, 137, 159,
159, 146, 151, 193, 203, 131, 180, 123, },
{ 1, 12, 33, 164, 32, 98, 204, 242,
23, 99, 149, 215, 232, 110, 239, 245, },
{ 1, 17, 9, 136, 82, 83, 171, 28,
231, 128, 135, 76, 64, 118, 235, 17, },
{ 4, 41, 17, 195, 131, 58, 161, 237,
141, 97, 153, 189, 191, 117, 182, 202, },
{ 2, 17, 36, 104, 149, 137, 217, 139,
191, 119, 125, 107, 115, 223, 249, 110, },
{ 2, 14, 24, 127, 91, 135, 219, 198,
113, 91, 164, 125, 173, 211, 250, 116, },
{ 3, 19, 24, 120, 102, 130, 209, 81,
187, 95, 143, 102, 50, 190, 244, 56, },
{ 4, 27, 10, 128, 91, 157, 181, 33,
181, 150, 141, 141, 166, 114, 215, 25, },
{ 2, 34, 27, 187, 102, 77, 210, 245,
113, 107, 136, 184, 188, 121, 210, 234, },
{ 1, 15, 22, 141, 59, 94, 208, 133,
154, 95, 152, 112, 105, 191, 242, 111, },
#endif
}, },
}
}; };
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
#if CONFIG_MISC_FIXES #if CONFIG_MISC_FIXES
...@@ -875,8 +962,8 @@ static void init_mode_probs(FRAME_CONTEXT *fc) { ...@@ -875,8 +962,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_tx_type_prob, default_inter_tx_type_prob); vp10_copy(fc->inter_ext_tx_prob, default_inter_ext_tx_prob);
vp10_copy(fc->intra_tx_type_prob, default_intra_tx_type_prob); vp10_copy(fc->intra_ext_tx_prob, default_intra_ext_tx_prob);
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
#if CONFIG_MISC_FIXES #if CONFIG_MISC_FIXES
vp10_copy(fc->seg.tree_probs, default_seg_probs.tree_probs); vp10_copy(fc->seg.tree_probs, default_seg_probs.tree_probs);
...@@ -885,7 +972,7 @@ static void init_mode_probs(FRAME_CONTEXT *fc) { ...@@ -885,7 +972,7 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
} }
const vpx_tree_index vp10_switchable_interp_tree const vpx_tree_index vp10_switchable_interp_tree
[TREE_SIZE(SWITCHABLE_FILTERS)] = { [TREE_SIZE(SWITCHABLE_FILTERS)] = {
-EIGHTTAP, 2, -EIGHTTAP, 2,
-EIGHTTAP_SMOOTH, -EIGHTTAP_SHARP -EIGHTTAP_SMOOTH, -EIGHTTAP_SHARP
}; };
...@@ -972,15 +1059,26 @@ void vp10_adapt_intra_frame_probs(VP10_COMMON *cm) { ...@@ -972,15 +1059,26 @@ void vp10_adapt_intra_frame_probs(VP10_COMMON *cm) {
pre_fc->skip_probs[i], counts->skip[i]); pre_fc->skip_probs[i], counts->skip[i]);
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
for (i = TX_4X4; i <= TX_16X16; ++i) { for (i = TX_4X4; i < EXT_TX_SIZES; ++i) {
int s;
for (s = 1; s < EXT_TX_SETS_INTER; ++s) {
if (use_inter_ext_tx_for_tx[s][i]) {
vpx_tree_merge_probs(vp10_ext_tx_inter_tree[s],
pre_fc->inter_ext_tx_prob[s][i],
counts->inter_ext_tx[s][i],
fc->inter_ext_tx_prob[s][i]);
}
}
for (s = 1; s < EXT_TX_SETS_INTRA; ++s) {
if (use_intra_ext_tx_for_tx[s][i]) {
int j; int j;
vpx_tree_merge_probs(vp10_tx_type_tree, pre_fc->inter_tx_type_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_tx_type_tree, pre_fc->intra_tx_type_prob[i][j], vpx_tree_merge_probs(vp10_ext_tx_intra_tree[s],
counts->intra_tx_type[i][j], pre_fc->intra_ext_tx_prob[s][i][j],
fc->intra_tx_type_prob[i][j]); counts->intra_ext_tx[s][i][j],
fc->intra_ext_tx_prob[s][i][j]);
}
}
} }
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
#if CONFIG_MISC_FIXES #if CONFIG_MISC_FIXES
......
...@@ -70,8 +70,9 @@ typedef struct frame_contexts { ...@@ -70,8 +70,9 @@ 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_tx_type_prob[EXT_TX_SIZES][TX_TYPES - 1]; vpx_prob inter_ext_tx_prob[EXT_TX_SETS_INTER][EXT_TX_SIZES][TX_TYPES - 1];
vpx_prob intra_tx_type_prob[EXT_TX_SIZES][INTRA_MODES][TX_TYPES - 1]; vpx_prob intra_ext_tx_prob[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES]
[TX_TYPES - 1];
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
#if CONFIG_MISC_FIXES #if CONFIG_MISC_FIXES
struct segmentation_probs seg; struct segmentation_probs seg;
...@@ -98,8 +99,9 @@ typedef struct FRAME_COUNTS { ...@@ -98,8 +99,9 @@ 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_tx_type[EXT_TX_SIZES][TX_TYPES]; unsigned int inter_ext_tx[EXT_TX_SETS_INTER][EXT_TX_SIZES][TX_TYPES];
unsigned int intra_tx_type[EXT_TX_SIZES][INTRA_MODES][TX_TYPES]; unsigned int intra_ext_tx[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES]
[TX_TYPES];
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
#if CONFIG_MISC_FIXES #if CONFIG_MISC_FIXES
struct seg_counts seg; struct seg_counts seg;
...@@ -147,7 +149,10 @@ void vp10_tx_counts_to_branch_counts_8x8(const unsigned int *tx_count_8x8p, ...@@ -147,7 +149,10 @@ 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_tx_type_tree[TREE_SIZE(TX_TYPES)]; extern const vpx_tree_index
vp10_ext_tx_inter_tree[EXT_TX_SETS_INTER][TREE_SIZE(TX_TYPES)];
extern const vpx_tree_index
vp10_ext_tx_intra_tree[EXT_TX_SETS_INTRA][TREE_SIZE(TX_TYPES)];
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
static INLINE int vp10_ceil_log2(int n) { static INLINE int vp10_ceil_log2(int n) {
......
...@@ -114,6 +114,11 @@ typedef enum { ...@@ -114,6 +114,11 @@ 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
#define EXT_TX_SETS_INTER 4 // Sets of transform selections for INTER
#define EXT_TX_SETS_INTRA 2 // Sets of transform selections for INTRA
#define TX_TYPES_10 10
#define TX_TYPES_2 2
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
typedef enum { typedef enum {
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "./vp10_rtcd.h" #include "./vp10_rtcd.h"
#include "./vpx_dsp_rtcd.h" #include "./vpx_dsp_rtcd.h"
#include "vp10/common/blockd.h" #include "vp10/common/blockd.h"
#include "vp10/common/enums.h"
#include "vp10/common/idct.h" #include "vp10/common/idct.h"
#include "vpx_dsp/inv_txfm.h" #include "vpx_dsp/inv_txfm.h"
#include "vpx_ports/mem.h" #include "vpx_ports/mem.h"
...@@ -864,6 +865,11 @@ void vp10_inv_txfm_add_32x32(const tran_low_t *input, uint8_t *dest, ...@@ -864,6 +865,11 @@ void vp10_inv_txfm_add_32x32(const tran_low_t *input, uint8_t *dest,
case DCT_DCT: case DCT_DCT:
vp10_idct32x32_add(input, dest, stride, eob); vp10_idct32x32_add(input, dest, stride, eob);
break; break;
#if CONFIG_EXT_TX
case IDTX:
inv_idtx_add_c(input, dest, stride, 32);
break;
#endif // CONFIG_EXT_TX
case ADST_DCT: case ADST_DCT:
case DCT_ADST: case DCT_ADST:
case ADST_ADST: case ADST_ADST:
...@@ -1295,6 +1301,11 @@ void vp10_highbd_inv_txfm_add_32x32(const tran_low_t *input, uint8_t *dest, ...@@ -1295,6 +1301,11 @@ void vp10_highbd_inv_txfm_add_32x32(const tran_low_t *input, uint8_t *dest,
case DCT_DCT: case DCT_DCT:
vp10_highbd_idct32x32_add(input, dest, stride, eob, bd); vp10_highbd_idct32x32_add(input, dest, stride, eob, bd);
break; break;
#if CONFIG_EXT_TX
case IDTX:
highbd_inv_idtx_add_c(input, dest, stride, 32, bd);
break;
#endif // CONFIG_EXT_TX
case ADST_DCT: case ADST_DCT:
case DCT_ADST: case DCT_ADST:
case ADST_ADST: case ADST_ADST:
......
...@@ -436,15 +436,25 @@ void vp10_accumulate_frame_counts(VP10_COMMON *cm, FRAME_COUNTS *counts, ...@@ -436,15 +436,25 @@ void vp10_accumulate_frame_counts(VP10_COMMON *cm, FRAME_COUNTS *counts,
} }
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
for (i = 0; i < EXT_TX_SIZES; i++) for (i = 0; i < EXT_TX_SIZES; i++) {
for (j = 0; j < TX_TYPES; j++) int s, k;
cm->counts.inter_tx_type[i][j] += counts->inter_tx_type[i][j]; for (s = 1; s < EXT_TX_SETS_INTER; ++s) {
if (use_inter_ext_tx_for_tx[s][i]) {
for (i = 0; i < EXT_TX_SIZES; i++)
for (j = 0; j < INTRA_MODES; j++)
for (k = 0; k < TX_TYPES; k++) for (k = 0; k < TX_TYPES; k++)
cm->counts.intra_tx_type[i][j][k] += counts->intra_tx_type[i][j][k]; cm->counts.inter_ext_tx[s][i][k] += counts->inter_ext_tx[s][i][k];
#endif }
}
for (s = 1; s < EXT_TX_SETS_INTRA; ++s) {
if (use_intra_ext_tx_for_tx[s][i]) {
int j;
for (j = 0; j < INTRA_MODES; ++j)
for (k = 0; k < TX_TYPES; k++)
cm->counts.intra_ext_tx[s][i][j][k] +=
counts->intra_ext_tx[s][i][j][k];
}
}
}
#endif // CONFIG_EXT_TX
#if CONFIG_MISC_FIXES #if CONFIG_MISC_FIXES
for (i = 0; i < PREDICTION_PROBS; i++) for (i = 0; i < PREDICTION_PROBS; i++)
......
...@@ -2224,17 +2224,26 @@ static size_t read_uncompressed_header(VP10Decoder *pbi, ...@@ -2224,17 +2224,26 @@ static size_t read_uncompressed_header(VP10Decoder *pbi,
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
static void read_ext_tx_probs(FRAME_CONTEXT *fc, vpx_reader *r) { static void read_ext_tx_probs(FRAME_CONTEXT *fc, vpx_reader *r) {
int i, j, k; int i, j, k;
int s;
for (s = 1; s < EXT_TX_SETS_INTER; ++s) {
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 < EXT_TX_SIZES; ++i) {
for (j = 0; j < TX_TYPES - 1; ++j) if (!use_inter_ext_tx_for_tx[s][i]) continue;
vp10_diff_update_prob(r, &fc->inter_tx_type_prob[i][j]); for (j = 0; j < num_ext_tx_set_inter[s] - 1; ++j)
vp10_diff_update_prob(r, &fc->inter_ext_tx_prob[s][i][j]);
}
}
} }
for (s = 1; s < EXT_TX_SETS_INTRA; ++s) {
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 < EXT_TX_SIZES; ++i) {
if (!use_intra_ext_tx_for_tx[s][i]) continue;
for (j = 0; j < INTRA_MODES; ++j) for (j = 0; j < INTRA_MODES; ++j)
for (k = 0; k < TX_TYPES - 1; ++k) for (k = 0; k < num_ext_tx_set_intra[s] - 1; ++k)
vp10_diff_update_prob(r, &fc->intra_tx_type_prob[i][j][k]); vp10_diff_update_prob(r, &fc->intra_ext_tx_prob[s][i][j][k]);
}
}
} }
} }
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
...@@ -2365,11 +2374,11 @@ static void debug_check_frame_counts(const VP10_COMMON *const cm) { ...@@ -2365,11 +2374,11 @@ static void debug_check_frame_counts(const VP10_COMMON *const cm) {
assert(!memcmp(&cm->counts.mv, &zero_counts.mv, sizeof(cm->counts.mv))); assert(!memcmp(&cm->counts.mv, &zero_counts.mv, sizeof(cm->counts.mv)));
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
assert(!memcmp(cm->counts.inter_tx_type, assert(!memcmp(cm->counts.inter_ext_tx, zero_counts.inter_ext_tx,
zero_counts.inter_tx_type, sizeof(cm->counts.inter_tx_type))); sizeof(cm->counts.inter_ext_tx)));
assert(!memcmp(cm->counts.intra_tx_type, assert(!memcmp(cm->counts.intra_ext_tx, zero_counts.intra_ext_tx,
zero_counts.intra_tx_type, sizeof(cm->counts.intra_tx_type))); sizeof(cm->counts.intra_ext_tx)));
#endif #endif // CONFIG_EXT_TX
} }
#endif // NDEBUG #endif // NDEBUG
......
...@@ -381,15 +381,19 @@ static void read_intra_frame_mode_info(VP10_COMMON *const cm, ...@@ -381,15 +381,19 @@ static void read_intra_frame_mode_info(VP10_COMMON *const cm,
read_palette_mode_info(cm, xd, r); read_palette_mode_info(cm, xd, r);
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
if (mbmi->tx_size <= TX_16X16 && cm->base_qindex > 0 && if (get_ext_tx_types(mbmi->tx_size, mbmi->sb_type, 0) > 1 &&
mbmi->sb_type >= BLOCK_8X8 && !mbmi->skip && cm->base_qindex > 0 && !mbmi->skip &&
!segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) { !segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
FRAME_COUNTS *counts = xd->counts; FRAME_COUNTS *counts = xd->counts;
mbmi->tx_type = int eset = get_ext_tx_set(mbmi->tx_size, mbmi->sb_type, 0);
vpx_read_tree(r, vp10_tx_type_tree, if (eset > 0) {
cm->fc->intra_tx_type_prob[mbmi->tx_size][mbmi->mode]); mbmi->tx_type = vpx_read_tree(
r, vp10_ext_tx_intra_tree[eset],
cm->fc->intra_ext_tx_prob[eset][mbmi->tx_size][mbmi->mode]);
if (counts) if (counts)
++counts->intra_tx_type[mbmi->tx_size][mbmi->mode][mbmi->tx_type]; ++counts->intra_ext_tx[eset][mbmi->tx_size][mbmi->mode]
[mbmi->tx_type];
}
} else { } else {
mbmi->tx_type = DCT_DCT; mbmi->tx_type = DCT_DCT;
} }
...@@ -790,25 +794,30 @@ static void read_inter_frame_mode_info(VP10Decoder *const pbi, ...@@ -790,25 +794,30 @@ static void read_inter_frame_mode_info(VP10Decoder *const pbi,
read_intra_block_mode_info(cm, xd, mi, r); read_intra_block_mode_info(cm, xd, mi, r);
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
if (mbmi->tx_size <= TX_16X16 && cm->base_qindex > 0 && if (get_ext_tx_types(mbmi->tx_size, mbmi->sb_type, inter_block) > 1 &&
mbmi->sb_type >= BLOCK_8X8 && !mbmi->skip && cm->base_qindex > 0 && !mbmi->skip &&
!segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) { !segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
int eset = get_ext_tx_set(mbmi->tx_size, mbmi->sb_type,
inter_block);
FRAME_COUNTS *counts = xd->counts; FRAME_COUNTS *counts = xd->counts;
if (inter_block) if (inter_block) {
if (eset > 0) {
mbmi->tx_type = mbmi->tx_type =
vpx_read_tree(r, vp10_tx_type_tree, vpx_read_tree(r, vp10_ext_tx_inter_tree[eset],
cm->fc->inter_tx_type_prob[mbmi->tx_size]); cm->fc->inter_ext_tx_prob[eset][mbmi->tx_size]);
else if (counts)
mbmi->tx_type = vpx_read_tree(r, vp10_tx_type_tree, ++counts->inter_ext_tx[eset][mbmi->tx_size][mbmi->tx_type];
cm->fc->intra_tx_type_prob }
} else {
if (eset > 0) {
mbmi->tx_type = vpx_read_tree(r, vp10_ext_tx_intra_tree[eset],
cm->fc->intra_ext_tx_prob[eset]
[mbmi->tx_size][mbmi->mode]); [mbmi->tx_size][mbmi->mode]);
if (counts)
if (counts) { ++counts->intra_ext_tx[eset][mbmi->tx_size]
if (inter_block) [mbmi->mode][mbmi->tx_type];
++counts->inter_tx_type[mbmi->tx_size][mbmi->tx_type]; }
else
++counts->intra_tx_type[mbmi->tx_size][mbmi->mode][mbmi->tx_type];
} }
} else { } else {
mbmi->tx_type = DCT_DCT; mbmi->tx_type = DCT_DCT;
......
...@@ -73,12 +73,19 @@ static INLINE void write_uniform(vpx_writer *w, int n, int v) { ...@@ -73,12 +73,19 @@ static INLINE void write_uniform(vpx_writer *w, int n, int v) {
} }
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
static struct vp10_token tx_type_encodings[TX_TYPES]; static struct vp10_token ext_tx_inter_encodings[EXT_TX_SETS_INTER][TX_TYPES];
static struct vp10_token ext_tx_intra_encodings[EXT_TX_SETS_INTRA][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(tx_type_encodings, vp10_tx_type_tree); int s;
for (s = 1; s < EXT_TX_SETS_INTER; ++s) {
vp10_tokens_from_tree(ext_tx_inter_encodings[s], vp10_ext_tx_inter_tree[s]);
}
for (s = 1; s < EXT_TX_SETS_INTRA; ++s) {
vp10_tokens_from_tree(ext_tx_intra_encodings[s], vp10_ext_tx_intra_tree[s]);
}
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
} }
...@@ -231,37 +238,51 @@ static void update_ext_tx_probs(VP10_COMMON *cm, vpx_writer *w) { ...@@ -231,37 +238,51 @@ static void update_ext_tx_probs(VP10_COMMON *cm, vpx_writer *w) {
const int savings_thresh = vp10_cost_one(GROUP_DIFF_UPDATE_PROB) - const int savings_thresh = vp10_cost_one(GROUP_DIFF_UPDATE_PROB) -
vp10_cost_zero(GROUP_DIFF_UPDATE_PROB); vp10_cost_zero(GROUP_DIFF_UPDATE_PROB);
int i, j; int i, j;
int s;