Commit 56ab215d authored by Debargha Mukherjee's avatar Debargha Mukherjee
Browse files

Reduce transform options for ext-tx experiment

Reduces the transform optons for INTRA as well as INTER when
transform size is 16x16 to not use any of the DSTs.
Thus, a total of 10 options are used for 16x16, while 4x4
and 8x8 still uses 17 options.

derflr/hevchd actually improves a little, while hevcmr drops
a little.

About 10% speed improvement.

Change-Id: I920a182231e052cdd622f8bb67085c16c572cb1e
parent c1629ca5
...@@ -280,7 +280,7 @@ static const int num_ext_tx_set_inter[EXT_TX_SETS_INTER] = { ...@@ -280,7 +280,7 @@ static const int num_ext_tx_set_inter[EXT_TX_SETS_INTER] = {
1, 17, 10, 2 1, 17, 10, 2
}; };
static const int num_ext_tx_set_intra[EXT_TX_SETS_INTRA] = { static const int num_ext_tx_set_intra[EXT_TX_SETS_INTRA] = {
1, 17, 1, 17, 10
}; };
#define USE_IDTX_FOR_32X32 0 #define USE_IDTX_FOR_32X32 0
...@@ -293,7 +293,7 @@ static INLINE int get_ext_tx_set(TX_SIZE tx_size, BLOCK_SIZE bs, ...@@ -293,7 +293,7 @@ static INLINE int get_ext_tx_set(TX_SIZE tx_size, BLOCK_SIZE bs,
#else #else
if (tx_size == TX_32X32) return 0; if (tx_size == TX_32X32) return 0;
#endif #endif
return 1; return tx_size == TX_16X16 ? 2 : 1;
} }
static INLINE int get_ext_tx_types(TX_SIZE tx_size, BLOCK_SIZE bs, static INLINE int get_ext_tx_types(TX_SIZE tx_size, BLOCK_SIZE bs,
...@@ -302,23 +302,27 @@ static INLINE int get_ext_tx_types(TX_SIZE tx_size, BLOCK_SIZE bs, ...@@ -302,23 +302,27 @@ static INLINE int get_ext_tx_types(TX_SIZE tx_size, BLOCK_SIZE bs,
return is_inter ? num_ext_tx_set_inter[set] : num_ext_tx_set_intra[set]; 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] = { static const int use_intra_ext_tx_for_txsize[EXT_TX_SETS_INTRA][TX_SIZES] = {
{ 0, 0, 0, 0, }, // unused { 0, 0, 0, 0, }, // unused
{ 1, 1, 1, 0, }, { 1, 1, 0, 0, },
{ 0, 0, 1, 0, },
}; };
static const int use_inter_ext_tx_for_tx[EXT_TX_SETS_INTER][TX_SIZES] = { static const int use_inter_ext_tx_for_txsize[EXT_TX_SETS_INTER][TX_SIZES] = {
{ 0, 0, 0, 0, }, // unused { 0, 0, 0, 0, }, // unused
{ 1, 1, 1, 0, }, { 1, 1, 0, 0, },
{ 0, 0, 0, 0, }, { 0, 0, 1, 0, },
{ 0, 0, 0, USE_IDTX_FOR_32X32, }, { 0, 0, 0, USE_IDTX_FOR_32X32, },
}; };
// Transform types used in each intra set
static const int ext_tx_used_intra[EXT_TX_SETS_INTRA][TX_TYPES] = { 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, 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, 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, },
}; };
// Transform types used in each inter set
static const int ext_tx_used_inter[EXT_TX_SETS_INTER][TX_TYPES] = { 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, 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, 1, 1, 1, 1, 1, 1, 1, 1, },
......
...@@ -818,6 +818,16 @@ const vpx_tree_index vp10_ext_tx_intra_tree[EXT_TX_SETS_INTRA] ...@@ -818,6 +818,16 @@ const vpx_tree_index vp10_ext_tx_intra_tree[EXT_TX_SETS_INTRA]
28, 30, 28, 30,
-ADST_ADST, -FLIPADST_FLIPADST, -ADST_ADST, -FLIPADST_FLIPADST,
-ADST_FLIPADST, -FLIPADST_ADST, -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
} }
}; };
...@@ -1041,7 +1051,95 @@ default_intra_ext_tx_prob[EXT_TX_SETS_INTRA][EXT_TX_SIZES] ...@@ -1041,7 +1051,95 @@ default_intra_ext_tx_prob[EXT_TX_SETS_INTRA][EXT_TX_SIZES]
154, 95, 152, 112, 105, 191, 242, 111, }, 154, 95, 152, 112, 105, 191, 242, 111, },
#endif #endif
}, },
} }, {
{
{ 8, 176, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 10, 28, 176, 192, 208, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 10, 28, 176, 192, 48, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 9, 160, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 8, 28, 96, 128, 128, 128, 160, 192,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 7, 28, 160, 176, 192, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 7, 20, 160, 176, 64, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 10, 23, 160, 176, 64, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 8, 29, 160, 176, 192, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 3, 20, 96, 128, 128, 128, 160, 192,
128, 128, 128, 128, 128, 128, 128, 128, },
}, {
{ 2, 176, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 4, 28, 176, 192, 208, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 4, 28, 176, 192, 48, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 8, 160, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 2, 28, 96, 128, 128, 128, 160, 192,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 3, 28, 160, 176, 192, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 3, 26, 160, 176, 64, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 9, 24, 160, 176, 64, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 5, 24, 160, 176, 192, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 2, 25, 96, 128, 128, 128, 160, 192,
128, 128, 128, 128, 128, 128, 128, 128, },
}, {
{ 2, 176, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 1, 28, 176, 192, 208, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 1, 28, 176, 192, 48, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 4, 160, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 2, 28, 96, 128, 128, 128, 160, 192,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 2, 28, 160, 176, 192, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 3, 29, 160, 176, 64, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 4, 27, 160, 176, 64, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 2, 34, 160, 176, 192, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 1, 25, 96, 128, 128, 128, 160, 192,
128, 128, 128, 128, 128, 128, 128, 128, },
#if EXT_TX_SIZES == 4
}, {
{ 2, 176, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 1, 12, 160, 176, 192, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 1, 17, 160, 176, 64, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 4, 41, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 2, 17, 96, 128, 128, 128, 160, 192,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 2, 14, 160, 176, 192, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 3, 19, 160, 176, 64, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 4, 27, 160, 176, 64, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 2, 34, 160, 176, 192, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, },
{ 1, 15, 96, 128, 128, 128, 160, 192,
128, 128, 128, 128, 128, 128, 128, 128, },
#endif
},
},
}; };
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
...@@ -1179,7 +1277,7 @@ void vp10_adapt_intra_frame_probs(VP10_COMMON *cm) { ...@@ -1179,7 +1277,7 @@ void vp10_adapt_intra_frame_probs(VP10_COMMON *cm) {
for (i = TX_4X4; i < EXT_TX_SIZES; ++i) { for (i = TX_4X4; i < EXT_TX_SIZES; ++i) {
int s; int s;
for (s = 1; s < EXT_TX_SETS_INTER; ++s) { for (s = 1; s < EXT_TX_SETS_INTER; ++s) {
if (use_inter_ext_tx_for_tx[s][i]) { if (use_inter_ext_tx_for_txsize[s][i]) {
vpx_tree_merge_probs(vp10_ext_tx_inter_tree[s], vpx_tree_merge_probs(vp10_ext_tx_inter_tree[s],
pre_fc->inter_ext_tx_prob[s][i], pre_fc->inter_ext_tx_prob[s][i],
counts->inter_ext_tx[s][i], counts->inter_ext_tx[s][i],
...@@ -1187,7 +1285,7 @@ void vp10_adapt_intra_frame_probs(VP10_COMMON *cm) { ...@@ -1187,7 +1285,7 @@ void vp10_adapt_intra_frame_probs(VP10_COMMON *cm) {
} }
} }
for (s = 1; s < EXT_TX_SETS_INTRA; ++s) { for (s = 1; s < EXT_TX_SETS_INTRA; ++s) {
if (use_intra_ext_tx_for_tx[s][i]) { if (use_intra_ext_tx_for_txsize[s][i]) {
int j; int j;
for (j = 0; j < INTRA_MODES; ++j) for (j = 0; j < INTRA_MODES; ++j)
vpx_tree_merge_probs(vp10_ext_tx_intra_tree[s], vpx_tree_merge_probs(vp10_ext_tx_intra_tree[s],
......
...@@ -115,10 +115,7 @@ typedef enum { ...@@ -115,10 +115,7 @@ 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_INTER 4 // Sets of transform selections for INTER
#define EXT_TX_SETS_INTRA 2 // Sets of transform selections for INTRA #define EXT_TX_SETS_INTRA 3 // 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 {
......
...@@ -445,13 +445,13 @@ void vp10_accumulate_frame_counts(VP10_COMMON *cm, FRAME_COUNTS *counts, ...@@ -445,13 +445,13 @@ void vp10_accumulate_frame_counts(VP10_COMMON *cm, FRAME_COUNTS *counts,
for (i = 0; i < EXT_TX_SIZES; i++) { for (i = 0; i < EXT_TX_SIZES; i++) {
int s, k; int s, k;
for (s = 1; s < EXT_TX_SETS_INTER; ++s) { for (s = 1; s < EXT_TX_SETS_INTER; ++s) {
if (use_inter_ext_tx_for_tx[s][i]) { if (use_inter_ext_tx_for_txsize[s][i]) {
for (k = 0; k < TX_TYPES; k++) for (k = 0; k < TX_TYPES; k++)
cm->counts.inter_ext_tx[s][i][k] += counts->inter_ext_tx[s][i][k]; cm->counts.inter_ext_tx[s][i][k] += counts->inter_ext_tx[s][i][k];
} }
} }
for (s = 1; s < EXT_TX_SETS_INTRA; ++s) { for (s = 1; s < EXT_TX_SETS_INTRA; ++s) {
if (use_intra_ext_tx_for_tx[s][i]) { if (use_intra_ext_tx_for_txsize[s][i]) {
int j; int j;
for (j = 0; j < INTRA_MODES; ++j) for (j = 0; j < INTRA_MODES; ++j)
for (k = 0; k < TX_TYPES; k++) for (k = 0; k < TX_TYPES; k++)
......
...@@ -2155,7 +2155,7 @@ static void read_ext_tx_probs(FRAME_CONTEXT *fc, vpx_reader *r) { ...@@ -2155,7 +2155,7 @@ static void read_ext_tx_probs(FRAME_CONTEXT *fc, vpx_reader *r) {
for (s = 1; s < EXT_TX_SETS_INTER; ++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 < EXT_TX_SIZES; ++i) { for (i = TX_4X4; i < EXT_TX_SIZES; ++i) {
if (!use_inter_ext_tx_for_tx[s][i]) continue; if (!use_inter_ext_tx_for_txsize[s][i]) continue;
for (j = 0; j < num_ext_tx_set_inter[s] - 1; ++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]); vp10_diff_update_prob(r, &fc->inter_ext_tx_prob[s][i][j]);
} }
...@@ -2165,7 +2165,7 @@ static void read_ext_tx_probs(FRAME_CONTEXT *fc, vpx_reader *r) { ...@@ -2165,7 +2165,7 @@ static void read_ext_tx_probs(FRAME_CONTEXT *fc, vpx_reader *r) {
for (s = 1; s < EXT_TX_SETS_INTRA; ++s) { 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 < EXT_TX_SIZES; ++i) { for (i = TX_4X4; i < EXT_TX_SIZES; ++i) {
if (!use_intra_ext_tx_for_tx[s][i]) continue; if (!use_intra_ext_tx_for_txsize[s][i]) continue;
for (j = 0; j < INTRA_MODES; ++j) for (j = 0; j < INTRA_MODES; ++j)
for (k = 0; k < num_ext_tx_set_intra[s] - 1; ++k) for (k = 0; k < num_ext_tx_set_intra[s] - 1; ++k)
vp10_diff_update_prob(r, &fc->intra_ext_tx_prob[s][i][j][k]); vp10_diff_update_prob(r, &fc->intra_ext_tx_prob[s][i][j][k]);
......
...@@ -253,7 +253,7 @@ static void update_ext_tx_probs(VP10_COMMON *cm, vpx_writer *w) { ...@@ -253,7 +253,7 @@ static void update_ext_tx_probs(VP10_COMMON *cm, vpx_writer *w) {
int savings = 0; int savings = 0;
int do_update = 0; int do_update = 0;
for (i = TX_4X4; i < EXT_TX_SIZES; ++i) { for (i = TX_4X4; i < EXT_TX_SIZES; ++i) {
if (!use_inter_ext_tx_for_tx[s][i]) continue; if (!use_inter_ext_tx_for_txsize[s][i]) continue;
savings += prob_diff_update_savings( savings += prob_diff_update_savings(
vp10_ext_tx_inter_tree[s], cm->fc->inter_ext_tx_prob[s][i], vp10_ext_tx_inter_tree[s], cm->fc->inter_ext_tx_prob[s][i],
cm->counts.inter_ext_tx[s][i], num_ext_tx_set_inter[s]); cm->counts.inter_ext_tx[s][i], num_ext_tx_set_inter[s]);
...@@ -262,7 +262,7 @@ static void update_ext_tx_probs(VP10_COMMON *cm, vpx_writer *w) { ...@@ -262,7 +262,7 @@ static void update_ext_tx_probs(VP10_COMMON *cm, vpx_writer *w) {
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 < EXT_TX_SIZES; ++i) { for (i = TX_4X4; i < EXT_TX_SIZES; ++i) {
if (!use_inter_ext_tx_for_tx[s][i]) continue; if (!use_inter_ext_tx_for_txsize[s][i]) continue;
prob_diff_update(vp10_ext_tx_inter_tree[s], prob_diff_update(vp10_ext_tx_inter_tree[s],
cm->fc->inter_ext_tx_prob[s][i], cm->fc->inter_ext_tx_prob[s][i],
cm->counts.inter_ext_tx[s][i], cm->counts.inter_ext_tx[s][i],
...@@ -275,7 +275,7 @@ static void update_ext_tx_probs(VP10_COMMON *cm, vpx_writer *w) { ...@@ -275,7 +275,7 @@ static void update_ext_tx_probs(VP10_COMMON *cm, vpx_writer *w) {
int savings = 0; int savings = 0;
int do_update = 0; int do_update = 0;
for (i = TX_4X4; i < EXT_TX_SIZES; ++i) { for (i = TX_4X4; i < EXT_TX_SIZES; ++i) {
if (!use_intra_ext_tx_for_tx[s][i]) continue; if (!use_intra_ext_tx_for_txsize[s][i]) continue;
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_intra_tree[s], cm->fc->intra_ext_tx_prob[s][i][j], vp10_ext_tx_intra_tree[s], cm->fc->intra_ext_tx_prob[s][i][j],
...@@ -285,7 +285,7 @@ static void update_ext_tx_probs(VP10_COMMON *cm, vpx_writer *w) { ...@@ -285,7 +285,7 @@ static void update_ext_tx_probs(VP10_COMMON *cm, vpx_writer *w) {
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 < EXT_TX_SIZES; ++i) { for (i = TX_4X4; i < EXT_TX_SIZES; ++i) {
if (!use_intra_ext_tx_for_tx[s][i]) continue; if (!use_intra_ext_tx_for_txsize[s][i]) continue;
for (j = 0; j < INTRA_MODES; ++j) for (j = 0; j < INTRA_MODES; ++j)
prob_diff_update(vp10_ext_tx_intra_tree[s], prob_diff_update(vp10_ext_tx_intra_tree[s],
cm->fc->intra_ext_tx_prob[s][i][j], cm->fc->intra_ext_tx_prob[s][i][j],
......
...@@ -106,14 +106,14 @@ static void fill_mode_costs(VP10_COMP *cpi) { ...@@ -106,14 +106,14 @@ static void fill_mode_costs(VP10_COMP *cpi) {
for (i = TX_4X4; i < EXT_TX_SIZES; ++i) { for (i = TX_4X4; i < EXT_TX_SIZES; ++i) {
int s; int s;
for (s = 1; s < EXT_TX_SETS_INTER; ++s) { for (s = 1; s < EXT_TX_SETS_INTER; ++s) {
if (use_inter_ext_tx_for_tx[s][i]) { if (use_inter_ext_tx_for_txsize[s][i]) {
vp10_cost_tokens(cpi->inter_tx_type_costs[s][i], vp10_cost_tokens(cpi->inter_tx_type_costs[s][i],
fc->inter_ext_tx_prob[s][i], fc->inter_ext_tx_prob[s][i],
vp10_ext_tx_inter_tree[s]); vp10_ext_tx_inter_tree[s]);
} }
} }
for (s = 1; s < EXT_TX_SETS_INTRA; ++s) { for (s = 1; s < EXT_TX_SETS_INTRA; ++s) {
if (use_intra_ext_tx_for_tx[s][i]) { if (use_intra_ext_tx_for_txsize[s][i]) {
for (j = 0; j < INTRA_MODES; ++j) for (j = 0; j < INTRA_MODES; ++j)
vp10_cost_tokens(cpi->intra_tx_type_costs[s][i][j], vp10_cost_tokens(cpi->intra_tx_type_costs[s][i][j],
fc->intra_ext_tx_prob[s][i][j], fc->intra_ext_tx_prob[s][i][j],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment