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" {
#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 {
KEY_FRAME = 0,
INTER_FRAME = 1,
......@@ -250,6 +245,58 @@ static const TX_TYPE intra_mode_to_tx_type_lookup[INTRA_MODES] = {
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,
const MACROBLOCKD *xd,
int block_idx, TX_SIZE tx_size) {
......@@ -257,16 +304,27 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type,
const MB_MODE_INFO *const mbmi = &mi->mbmi;
#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;
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;
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;
else
else // Sub8x8 Intra OR UV-Intra
return intra_mode_to_tx_type_lookup[plane_type == PLANE_TYPE_Y ?
get_y_mode(mi, block_idx) : mbmi->uv_mode];
#else
......
This diff is collapsed.
......@@ -70,8 +70,9 @@ typedef struct frame_contexts {
vpx_prob skip_probs[SKIP_CONTEXTS];
nmv_context nmvc;
#if CONFIG_EXT_TX
vpx_prob inter_tx_type_prob[EXT_TX_SIZES][TX_TYPES - 1];
vpx_prob intra_tx_type_prob[EXT_TX_SIZES][INTRA_MODES][TX_TYPES - 1];
vpx_prob inter_ext_tx_prob[EXT_TX_SETS_INTER][EXT_TX_SIZES][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
#if CONFIG_MISC_FIXES
struct segmentation_probs seg;
......@@ -98,8 +99,9 @@ typedef struct FRAME_COUNTS {
unsigned int skip[SKIP_CONTEXTS][2];
nmv_context_counts mv;
#if CONFIG_EXT_TX
unsigned int inter_tx_type[EXT_TX_SIZES][TX_TYPES];
unsigned int intra_tx_type[EXT_TX_SIZES][INTRA_MODES][TX_TYPES];
unsigned int inter_ext_tx[EXT_TX_SETS_INTER][EXT_TX_SIZES][TX_TYPES];
unsigned int intra_ext_tx[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES]
[TX_TYPES];
#endif // CONFIG_EXT_TX
#if CONFIG_MISC_FIXES
struct seg_counts seg;
......@@ -147,7 +149,10 @@ 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_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
static INLINE int vp10_ceil_log2(int n) {
......
......@@ -113,7 +113,12 @@ typedef enum {
} TX_TYPE;
#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
typedef enum {
......
......@@ -13,6 +13,7 @@
#include "./vp10_rtcd.h"
#include "./vpx_dsp_rtcd.h"
#include "vp10/common/blockd.h"
#include "vp10/common/enums.h"
#include "vp10/common/idct.h"
#include "vpx_dsp/inv_txfm.h"
#include "vpx_ports/mem.h"
......@@ -864,6 +865,11 @@ void vp10_inv_txfm_add_32x32(const tran_low_t *input, uint8_t *dest,
case DCT_DCT:
vp10_idct32x32_add(input, dest, stride, eob);
break;
#if CONFIG_EXT_TX
case IDTX:
inv_idtx_add_c(input, dest, stride, 32);
break;
#endif // CONFIG_EXT_TX
case ADST_DCT:
case DCT_ADST:
case ADST_ADST:
......@@ -1295,6 +1301,11 @@ void vp10_highbd_inv_txfm_add_32x32(const tran_low_t *input, uint8_t *dest,
case DCT_DCT:
vp10_highbd_idct32x32_add(input, dest, stride, eob, bd);
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 DCT_ADST:
case ADST_ADST:
......
......@@ -436,15 +436,25 @@ void vp10_accumulate_frame_counts(VP10_COMMON *cm, FRAME_COUNTS *counts,
}
#if CONFIG_EXT_TX
for (i = 0; i < EXT_TX_SIZES; i++)
for (j = 0; j < TX_TYPES; j++)
cm->counts.inter_tx_type[i][j] += counts->inter_tx_type[i][j];
for (i = 0; i < EXT_TX_SIZES; i++)
for (j = 0; j < INTRA_MODES; j++)
for (k = 0; k < TX_TYPES; k++)
cm->counts.intra_tx_type[i][j][k] += counts->intra_tx_type[i][j][k];
#endif
for (i = 0; i < EXT_TX_SIZES; i++) {
int s, k;
for (s = 1; s < EXT_TX_SETS_INTER; ++s) {
if (use_inter_ext_tx_for_tx[s][i]) {
for (k = 0; k < TX_TYPES; 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) {
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
for (i = 0; i < PREDICTION_PROBS; i++)
......
......@@ -2224,17 +2224,26 @@ static size_t read_uncompressed_header(VP10Decoder *pbi,
#if CONFIG_EXT_TX
static void read_ext_tx_probs(FRAME_CONTEXT *fc, vpx_reader *r) {
int i, j, k;
if (vpx_read(r, GROUP_DIFF_UPDATE_PROB)) {
for (i = TX_4X4; i <= TX_16X16; ++i)
for (j = 0; j < TX_TYPES - 1; ++j)
vp10_diff_update_prob(r, &fc->inter_tx_type_prob[i][j]);
int s;
for (s = 1; s < EXT_TX_SETS_INTER; ++s) {
if (vpx_read(r, GROUP_DIFF_UPDATE_PROB)) {
for (i = TX_4X4; i < EXT_TX_SIZES; ++i) {
if (!use_inter_ext_tx_for_tx[s][i]) continue;
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]);
}
}
}
if (vpx_read(r, GROUP_DIFF_UPDATE_PROB)) {
for (i = TX_4X4; i <= TX_16X16; ++i)
for (j = 0; j < INTRA_MODES; ++j)
for (k = 0; k < TX_TYPES - 1; ++k)
vp10_diff_update_prob(r, &fc->intra_tx_type_prob[i][j][k]);
for (s = 1; s < EXT_TX_SETS_INTRA; ++s) {
if (vpx_read(r, GROUP_DIFF_UPDATE_PROB)) {
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 (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]);
}
}
}
}
#endif // CONFIG_EXT_TX
......@@ -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)));
#if CONFIG_EXT_TX
assert(!memcmp(cm->counts.inter_tx_type,
zero_counts.inter_tx_type, sizeof(cm->counts.inter_tx_type)));
assert(!memcmp(cm->counts.intra_tx_type,
zero_counts.intra_tx_type, sizeof(cm->counts.intra_tx_type)));
#endif
assert(!memcmp(cm->counts.inter_ext_tx, zero_counts.inter_ext_tx,
sizeof(cm->counts.inter_ext_tx)));
assert(!memcmp(cm->counts.intra_ext_tx, zero_counts.intra_ext_tx,
sizeof(cm->counts.intra_ext_tx)));
#endif // CONFIG_EXT_TX
}
#endif // NDEBUG
......
......@@ -381,15 +381,19 @@ static void read_intra_frame_mode_info(VP10_COMMON *const cm,
read_palette_mode_info(cm, xd, r);
#if CONFIG_EXT_TX
if (mbmi->tx_size <= TX_16X16 && cm->base_qindex > 0 &&
mbmi->sb_type >= BLOCK_8X8 && !mbmi->skip &&
if (get_ext_tx_types(mbmi->tx_size, mbmi->sb_type, 0) > 1 &&
cm->base_qindex > 0 && !mbmi->skip &&
!segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
FRAME_COUNTS *counts = xd->counts;
mbmi->tx_type =
vpx_read_tree(r, vp10_tx_type_tree,
cm->fc->intra_tx_type_prob[mbmi->tx_size][mbmi->mode]);
if (counts)
++counts->intra_tx_type[mbmi->tx_size][mbmi->mode][mbmi->tx_type];
int eset = get_ext_tx_set(mbmi->tx_size, mbmi->sb_type, 0);
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]);
if (counts)
++counts->intra_ext_tx[eset][mbmi->tx_size][mbmi->mode]
[mbmi->tx_type];
}
} else {
mbmi->tx_type = DCT_DCT;
}
......@@ -790,25 +794,30 @@ static void read_inter_frame_mode_info(VP10Decoder *const pbi,
read_intra_block_mode_info(cm, xd, mi, r);
#if CONFIG_EXT_TX
if (mbmi->tx_size <= TX_16X16 && cm->base_qindex > 0 &&
mbmi->sb_type >= BLOCK_8X8 && !mbmi->skip &&
if (get_ext_tx_types(mbmi->tx_size, mbmi->sb_type, inter_block) > 1 &&
cm->base_qindex > 0 && !mbmi->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;
if (inter_block)
mbmi->tx_type =
vpx_read_tree(r, vp10_tx_type_tree,
cm->fc->inter_tx_type_prob[mbmi->tx_size]);
else
mbmi->tx_type = vpx_read_tree(r, vp10_tx_type_tree,
cm->fc->intra_tx_type_prob
[mbmi->tx_size][mbmi->mode]);
if (counts) {
if (inter_block)
++counts->inter_tx_type[mbmi->tx_size][mbmi->tx_type];
else
++counts->intra_tx_type[mbmi->tx_size][mbmi->mode][mbmi->tx_type];
if (inter_block) {
if (eset > 0) {
mbmi->tx_type =
vpx_read_tree(r, vp10_ext_tx_inter_tree[eset],
cm->fc->inter_ext_tx_prob[eset][mbmi->tx_size]);
if (counts)
++counts->inter_ext_tx[eset][mbmi->tx_size][mbmi->tx_type];
}
} 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]);
if (counts)
++counts->intra_ext_tx[eset][mbmi->tx_size]
[mbmi->mode][mbmi->tx_type];
}
}
} else {
mbmi->tx_type = DCT_DCT;
......
......@@ -73,12 +73,19 @@ static INLINE void write_uniform(vpx_writer *w, int n, int v) {
}
#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
void vp10_encode_token_init() {
#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
}
......@@ -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) -
vp10_cost_zero(GROUP_DIFF_UPDATE_PROB);
int i, j;
int savings = 0;
int do_update = 0;
for (i = TX_4X4; i <= TX_16X16; ++i) {
savings += prob_diff_update_savings(
vp10_tx_type_tree, cm->fc->inter_tx_type_prob[i],
cm->counts.inter_tx_type[i], TX_TYPES);
}
do_update = savings > savings_thresh;
vpx_write(w, do_update, GROUP_DIFF_UPDATE_PROB);
if (do_update) {
for (i = TX_4X4; i <= TX_16X16; ++i) {
prob_diff_update(vp10_tx_type_tree, cm->fc->inter_tx_type_prob[i],
cm->counts.inter_tx_type[i], TX_TYPES, w);
int s;
for (s = 1; s < EXT_TX_SETS_INTER; ++s) {
int savings = 0;
int do_update = 0;
for (i = TX_4X4; i < EXT_TX_SIZES; ++i) {
if (!use_inter_ext_tx_for_tx[s][i]) continue;
savings += prob_diff_update_savings(
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]);
}
do_update = savings > savings_thresh;
vpx_write(w, do_update, GROUP_DIFF_UPDATE_PROB);
if (do_update) {
for (i = TX_4X4; i < EXT_TX_SIZES; ++i) {
if (!use_inter_ext_tx_for_tx[s][i]) continue;
prob_diff_update(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], w);
}
}
}
savings = 0;
do_update = 0;
for (i = TX_4X4; i <= TX_16X16; ++i)
for (j = 0; j < INTRA_MODES; ++j)
savings += prob_diff_update_savings(
vp10_tx_type_tree, cm->fc->intra_tx_type_prob[i][j],
cm->counts.intra_tx_type[i][j], TX_TYPES);
do_update = savings > savings_thresh;
vpx_write(w, do_update, GROUP_DIFF_UPDATE_PROB);
if (do_update) {
for (i = TX_4X4; i <= TX_16X16; ++i)
for (s = 1; s < EXT_TX_SETS_INTRA; ++s) {
int savings = 0;
int do_update = 0;
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)
prob_diff_update(vp10_tx_type_tree, cm->fc->intra_tx_type_prob[i][j],
cm->counts.intra_tx_type[i][j], TX_TYPES, w);
savings += prob_diff_update_savings(
vp10_ext_tx_intra_tree[s], cm->fc->intra_ext_tx_prob[s][i][j],
cm->counts.intra_ext_tx[s][i][j], num_ext_tx_set_intra[s]);
}
do_update = savings > savings_thresh;
vpx_write(w, do_update, GROUP_DIFF_UPDATE_PROB);
if (do_update) {
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)
prob_diff_update(vp10_ext_tx_intra_tree[s],
cm->fc->intra_ext_tx_prob[s][i][j],
cm->counts.intra_ext_tx[s][i][j],
num_ext_tx_set_intra[s], w);
}
}
}
}
#endif // CONFIG_EXT_TX
......@@ -598,17 +619,22 @@ static void pack_inter_mode_mvs(VP10_COMP *cpi, const MODE_INFO *mi,
}
#if CONFIG_EXT_TX
if (mbmi->tx_size <= TX_16X16 && cm->base_qindex > 0 &&
bsize >= BLOCK_8X8 && !mbmi->skip &&
if (get_ext_tx_types(mbmi->tx_size, bsize, is_inter) > 1 &&
cm->base_qindex > 0 && !mbmi->skip &&
!segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
if (is_inter)
vp10_write_token(w, vp10_tx_type_tree,
cm->fc->inter_tx_type_prob[mbmi->tx_size],
&tx_type_encodings[mbmi->tx_type]);
else
vp10_write_token(w, vp10_tx_type_tree,
cm->fc->intra_tx_type_prob[mbmi->tx_size][mbmi->mode],
&tx_type_encodings[mbmi->tx_type]);
int eset = get_ext_tx_set(mbmi->tx_size, bsize, is_inter);
if (is_inter) {
if (eset > 0)
vp10_write_token(w, vp10_ext_tx_inter_tree[eset],
cm->fc->inter_ext_tx_prob[eset][mbmi->tx_size],
&ext_tx_inter_encodings[eset][mbmi->tx_type]);
} else {
if (eset > 0)
vp10_write_token(
w, vp10_ext_tx_intra_tree[eset],
cm->fc->intra_ext_tx_prob[eset][mbmi->tx_size][mbmi->mode],
&ext_tx_intra_encodings[eset][mbmi->tx_type]);
}
}
#endif // CONFIG_EXT_TX
}
......@@ -690,12 +716,15 @@ static void write_mb_modes_kf(const VP10_COMMON *cm, const MACROBLOCKD *xd,
#if CONFIG_EXT_TX
if (mbmi->tx_size <= TX_16X16 && cm->base_qindex > 0 &&
bsize >= BLOCK_8X8 && !mbmi->skip &&
if (get_ext_tx_types(mbmi->tx_size, bsize, 0) > 1 &&
cm->base_qindex > 0 && !mbmi->skip &&
!segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
vp10_write_token(w, vp10_tx_type_tree,
cm->fc->intra_tx_type_prob[mbmi->tx_size][mbmi->mode],
&tx_type_encodings[mbmi->tx_type]);
int eset = get_ext_tx_set(mbmi->tx_size, bsize, 0);
if (eset > 0)
vp10_write_token(
w, vp10_ext_tx_intra_tree[eset],
cm->fc->intra_ext_tx_prob[eset][mbmi->tx_size][mbmi->mode],
&ext_tx_intra_encodings[eset][mbmi->tx_type]);
}
#endif // CONFIG_EXT_TX
}
......
......@@ -2430,7 +2430,6 @@ static void rd_pick_partition(VP10_COMP *cpi, ThreadData *td,
(void) best_rd;
*rd_cost = best_rdc;
if (best_rdc.rate < INT_MAX && best_rdc.dist < INT64_MAX &&
pc_tree->index != 3) {
int output_enabled = (bsize == BLOCK_64X64);
......@@ -3057,13 +3056,19 @@ static void encode_superblock(VP10_COMP *cpi, ThreadData *td,
++td->counts->tx.tx_totals[mbmi->tx_size];
++td->counts->tx.tx_totals[get_uv_tx_size(mbmi, &xd->plane[1])];
#if CONFIG_EXT_TX
if (mbmi->tx_size <= TX_16X16 && cm->base_qindex > 0 &&
bsize >= BLOCK_8X8 && !mbmi->skip &&
if (get_ext_tx_types(mbmi->tx_size, bsize, is_inter_block(mbmi)) > 1 &&
cm->base_qindex > 0 && !mbmi->skip &&
!segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
if (is_inter_block(mbmi))
++td->counts->inter_tx_type[mbmi->tx_size][mbmi->tx_type];
else
++td->counts->intra_tx_type[mbmi->tx_size][mbmi->mode][mbmi->tx_type];
int eset = get_ext_tx_set(mbmi->tx_size, bsize,
is_inter_block(mbmi));
if (eset > 0) {
if (is_inter_block(mbmi)) {
++td->counts->inter_ext_tx[eset][mbmi->tx_size][mbmi->tx_type];
} else {
++td->counts->intra_ext_tx[eset][mbmi->tx_size][mbmi->mode]
[mbmi->tx_type];
}
}
}
#endif // CONFIG_EXT_TX
}
......
......@@ -709,6 +709,11 @@ static void fwd_txfm_32x32(int rd_transform, const int16_t *src_diff,
case DCT_DCT:
fdct32x32(rd_transform, src_diff, coeff, diff_stride);
break;
#if CONFIG_EXT_TX
case IDTX:
fwd_idtx_c(src_diff, coeff, diff_stride, 32);
break;
#endif // CONFIG_EXT_TX
case ADST_DCT:
case DCT_ADST:
case ADST_ADST:
......@@ -727,6 +732,11 @@ static void fwd_txfm_32x32_1(const int16_t *src_diff,
case DCT_DCT:
vpx_fdct32x32_1(src_diff, coeff, diff_stride);
break;
#if CONFIG_EXT_TX
case IDTX:
fwd_idtx_c(src_diff, coeff, diff_stride, 32);
break;
#endif // CONFIG_EXT_TX
case ADST_DCT:
case DCT_ADST:
case ADST_ADST:
......@@ -1056,6 +1066,11 @@ static void highbd_fwd_txfm_32x32(int rd_transform, const int16_t *src_diff,
case DCT_DCT:
highbd_fdct32x32(rd_transform, src_diff, coeff, diff_stride);
break;
#if CONFIG_EXT_TX
case IDTX:
fwd_idtx_c(src_diff, coeff, diff_stride, 32);
break;
#endif // CONFIG_EXT_TX
case ADST_DCT:
case DCT_ADST:
case ADST_ADST:
......@@ -1074,6 +1089,11 @@ static void highbd_fwd_txfm_32x32_1(const int16_t *src_diff,
case DCT_DCT:
vpx_highbd_fdct32x32_1(src_diff, coeff, diff_stride);
break;
#if CONFIG_EXT_TX
case IDTX:
fwd_idtx_c(src_diff, coeff, diff_stride, 32);
break;
#endif // CONFIG_EXT_TX
case ADST_DCT:
case DCT_ADST:
case ADST_ADST:
......
......@@ -467,8 +467,9 @@ typedef struct VP10_COMP {
int palette_uv_color_cost[PALETTE_MAX_SIZE - 1][PALETTE_COLOR_CONTEXTS]
[PALETTE_COLORS];
#if CONFIG_EXT_TX
int inter_tx_type_costs[EXT_TX_SIZES][TX_TYPES];
int intra_tx_type_costs[EXT_TX_SIZES][INTRA_MODES][TX_TYPES];
int inter_tx_type_costs[EXT_TX_SETS_INTER][EXT_TX_SIZES][TX_TYPES];
int intra_tx_type_costs[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES]
[TX_TYPES];
#endif // CONFIG_EXT_TX
int multi_arf_allowed;
......
......@@ -102,12 +102,23 @@ static void fill_mode_costs(VP10_COMP *cpi) {
vp10_palette_color_tree[i]);
}
#if CONFIG_EXT_TX
for (i = TX_4X4; i <= TX_16X16; ++i) {
vp10_cost_tokens(cpi->inter_tx_type_costs[i], fc->inter_tx_type_prob[i],
vp10_tx_type_tree);
for (j = 0; j < INTRA_MODES; ++j)
vp10_cost_tokens(cpi->intra_tx_type_costs[i][j],
fc->intra_tx_type_prob[i][j], vp10_tx_type_tree);
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]) {
vp10_cost_tokens(cpi->inter_tx_type_costs[s][i],
fc->inter_ext_tx_prob[s][i],
vp10_ext_tx_inter_tree[s]);
}
}
for (s = 1; s < EXT_TX_SETS_INTRA; ++s) {
if (use_intra_ext_tx_for_tx[s][i]) {
for (j = 0; j < INTRA_MODES; ++j)
vp10_cost_tokens(cpi->intra_tx_type_costs[s][i][j],
fc->intra_ext_tx_prob[s][i][j],
vp10_ext_tx_intra_tree[s]);
}
}
}
#endif // CONFIG_EXT_TX
}
......
This diff is collapsed.
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