Extending ext_tx expt to include dst variants

Extends the ext-tx experiment to include regular and flipped
DST variants. A total of 9 transforms are thus possible for
each inter block with transform size <= 16x16.

In this patch currently only the four ADST_ADST variants
(flipped or non-flipped in both dimensions) are enabled
for inter blocks.

The gain with the ext-tx experiment grows to +1.12 on derflr.
Further experiments are underway.

Change-Id: Ia2ed19a334face6135b064748f727fdc9db278ec
This commit is contained in:
Deb Mukherjee 2014-11-14 17:11:45 -08:00
parent d97fd3eef6
commit c82de3bede
13 changed files with 545 additions and 162 deletions

View File

@ -261,15 +261,13 @@ static INLINE BLOCK_SIZE get_subsize(BLOCK_SIZE bsize,
extern const TX_TYPE intra_mode_to_tx_type_lookup[INTRA_MODES];
#if CONFIG_EXT_TX
static TX_TYPE ext_tx_to_txtype(EXT_TX_TYPE ext_tx) {
switch (ext_tx) {
case NORM:
default:
return DCT_DCT;
case ALT:
return ADST_ADST;
}
}
static TX_TYPE ext_tx_to_txtype[EXT_TX_TYPES] = {
DCT_DCT,
ADST_ADST,
FLIPADST_FLIPADST,
ADST_FLIPADST,
FLIPADST_ADST
};
#endif
static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type,
@ -281,7 +279,7 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type,
return DCT_DCT;
if (is_inter_block(mbmi)) {
return ext_tx_to_txtype(mbmi->ext_txfrm);
return ext_tx_to_txtype[mbmi->ext_txfrm];
}
#else
if (plane_type != PLANE_TYPE_Y || xd->lossless || is_inter_block(mbmi))
@ -299,7 +297,7 @@ static INLINE TX_TYPE get_tx_type_4x4(PLANE_TYPE plane_type,
return DCT_DCT;
if (is_inter_block(&mi->mbmi)) {
return ext_tx_to_txtype(mi->mbmi.ext_txfrm);
return ext_tx_to_txtype[mi->mbmi.ext_txfrm];
}
#else
if (plane_type != PLANE_TYPE_Y || xd->lossless || is_inter_block(&mi->mbmi))

View File

@ -13,10 +13,6 @@
#include "vp9/common/vp9_onyxc_int.h"
#include "vp9/common/vp9_seg_common.h"
#if CONFIG_EXT_TX
static const vp9_prob default_ext_tx_prob = 216;
#endif
const vp9_prob vp9_kf_y_mode_prob[INTRA_MODES][INTRA_MODES][INTRA_MODES - 1] = {
{ // above = dc
{ 137, 30, 42, 148, 151, 207, 70, 52, 91 }, // left = dc
@ -294,6 +290,21 @@ static const struct tx_probs default_tx_probs = {
{ 66 } }
};
#if CONFIG_EXT_TX
const vp9_tree_index vp9_ext_tx_tree[TREE_SIZE(EXT_TX_TYPES)] = {
-NORM, 2,
4, 6,
-ALT1, -ALT2,
-ALT3, -ALT4,
};
static const vp9_prob default_ext_tx_prob[3][EXT_TX_TYPES - 1] = {
{ 224, 128, 128, 128 },
{ 208, 128, 128, 128 },
{ 192, 128, 128, 128 },
};
#endif // CONFIG_EXT_TX
#if CONFIG_TX64X64
void tx_counts_to_branch_counts_64x64(const unsigned int *tx_count_64x64p,
unsigned int (*ct_64x64p)[2]) {
@ -369,7 +380,7 @@ void vp9_init_mode_probs(FRAME_CONTEXT *fc) {
vp9_copy(fc->filterintra_prob, default_filterintra_prob);
#endif
#if CONFIG_EXT_TX
fc->ext_tx_prob = default_ext_tx_prob;
vp9_copy(fc->ext_tx_prob, default_ext_tx_prob);
#endif
}
@ -390,7 +401,7 @@ static void adapt_probs(const vp9_tree_index *tree,
const vp9_prob *pre_probs, const unsigned int *counts,
vp9_prob *probs) {
vp9_tree_merge_probs(tree, pre_probs, counts, COUNT_SAT, MAX_UPDATE_FACTOR,
probs);
probs);
}
void vp9_adapt_mode_probs(VP9_COMMON *cm) {
@ -472,14 +483,17 @@ void vp9_adapt_mode_probs(VP9_COMMON *cm) {
for (i = 0; i < TX_SIZES; ++i)
for (j = 0; j < INTRA_MODES; ++j)
fc->filterintra_prob[i][j] = adapt_prob(pre_fc->filterintra_prob[i][j],
counts->filterintra[i][j]);
counts->filterintra[i][j]);
#endif
for (i = 0; i < SKIP_CONTEXTS; ++i)
fc->skip_probs[i] = adapt_prob(pre_fc->skip_probs[i], counts->skip[i]);
#if CONFIG_EXT_TX
fc->ext_tx_prob = adapt_prob(pre_fc->ext_tx_prob, counts->ext_tx);
for (i = TX_4X4; i <= TX_16X16; ++i) {
adapt_probs(vp9_ext_tx_tree, pre_fc->ext_tx_prob[i], counts->ext_tx[i],
fc->ext_tx_prob[i]);
}
#endif
}

View File

@ -60,7 +60,7 @@ typedef struct frame_contexts {
vp9_prob filterintra_prob[TX_SIZES][INTRA_MODES];
#endif
#if CONFIG_EXT_TX
vp9_prob ext_tx_prob;
vp9_prob ext_tx_prob[3][EXT_TX_TYPES - 1];
#endif
} FRAME_CONTEXT;
@ -85,7 +85,7 @@ typedef struct {
unsigned int filterintra[TX_SIZES][INTRA_MODES][2];
#endif
#if CONFIG_EXT_TX
unsigned int ext_tx[2];
unsigned int ext_tx[3][EXT_TX_TYPES];
#endif
} FRAME_COUNTS;
@ -99,6 +99,9 @@ extern const vp9_tree_index vp9_inter_mode_tree[TREE_SIZE(INTER_MODES)];
extern const vp9_tree_index vp9_partition_tree[TREE_SIZE(PARTITION_TYPES)];
extern const vp9_tree_index vp9_switchable_interp_tree
[TREE_SIZE(SWITCHABLE_FILTERS)];
#if CONFIG_EXT_TX
extern const vp9_tree_index vp9_ext_tx_tree[TREE_SIZE(EXT_TX_TYPES)];
#endif
void vp9_setup_past_independence(struct VP9Common *cm);

View File

@ -101,14 +101,25 @@ 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
} TX_TYPE;
#if CONFIG_EXT_TX
typedef enum {
NORM = 0,
ALT = 1,
EXT_TX_TYPES = 2
ALT1 = 1,
ALT2 = 2,
ALT3 = 3,
ALT4 = 4,
EXT_TX_TYPES
} EXT_TX_TYPE;
#endif

View File

@ -432,6 +432,74 @@ static const transform_2d IHT_8[] = {
{ iadst8, iadst8 } // 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 vp9_iht8x8_64_add_c(const tran_low_t *input, uint8_t *dest, int stride,
int tx_type) {
int i, j;
@ -1433,16 +1501,61 @@ void vp9_idct32x32_add(const tran_low_t *input, uint8_t *dest, int stride,
// iht
void vp9_iht4x4_add(TX_TYPE tx_type, const tran_low_t *input, uint8_t *dest,
int stride, int eob) {
if (tx_type == DCT_DCT)
if (tx_type == DCT_DCT) {
vp9_idct4x4_add(input, dest, stride, eob);
else
#if CONFIG_EXT_TX
} else if (tx_type == FLIPADST_DCT) {
flipud(dest, stride, 4);
vp9_iht4x4_16_add(input, dest, stride, ADST_DCT);
flipud(dest, stride, 4);
} else if (tx_type == DCT_FLIPADST) {
fliplr(dest, stride, 4);
vp9_iht4x4_16_add(input, dest, stride, DCT_ADST);
fliplr(dest, stride, 4);
} else if (tx_type == FLIPADST_FLIPADST) {
fliplrud(dest, stride, 4);
vp9_iht4x4_16_add(input, dest, stride, ADST_ADST);
fliplrud(dest, stride, 4);
} else if (tx_type == ADST_FLIPADST) {
fliplr(dest, stride, 4);
vp9_iht4x4_16_add(input, dest, stride, ADST_ADST);
fliplr(dest, stride, 4);
} else if (tx_type == FLIPADST_ADST) {
flipud(dest, stride, 4);
vp9_iht4x4_16_add(input, dest, stride, ADST_ADST);
flipud(dest, stride, 4);
#endif // CONFIG_EXT_TX
} else {
vp9_iht4x4_16_add(input, dest, stride, tx_type);
}
}
void vp9_iht8x8_add(TX_TYPE tx_type, const tran_low_t *input, uint8_t *dest,
int stride, int eob) {
if (tx_type == DCT_DCT) {
vp9_idct8x8_add(input, dest, stride, eob);
#if CONFIG_EXT_TX
} else if (tx_type == FLIPADST_DCT) {
flipud(dest, stride, 8);
vp9_iht8x8_64_add(input, dest, stride, ADST_DCT);
flipud(dest, stride, 8);
} else if (tx_type == DCT_FLIPADST) {
fliplr(dest, stride, 8);
vp9_iht8x8_64_add(input, dest, stride, DCT_ADST);
fliplr(dest, stride, 8);
} else if (tx_type == FLIPADST_FLIPADST) {
fliplrud(dest, stride, 8);
vp9_iht8x8_64_add(input, dest, stride, ADST_ADST);
fliplrud(dest, stride, 8);
} else if (tx_type == ADST_FLIPADST) {
fliplr(dest, stride, 8);
vp9_iht8x8_64_add(input, dest, stride, ADST_ADST);
fliplr(dest, stride, 8);
} else if (tx_type == FLIPADST_ADST) {
flipud(dest, stride, 8);
vp9_iht8x8_64_add(input, dest, stride, ADST_ADST);
flipud(dest, stride, 8);
#endif // CONFIG_EXT_TX
} else {
vp9_iht8x8_64_add(input, dest, stride, tx_type);
}
@ -1452,6 +1565,28 @@ void vp9_iht16x16_add(TX_TYPE tx_type, const tran_low_t *input, uint8_t *dest,
int stride, int eob) {
if (tx_type == DCT_DCT) {
vp9_idct16x16_add(input, dest, stride, eob);
#if CONFIG_EXT_TX
} else if (tx_type == FLIPADST_DCT) {
flipud(dest, stride, 16);
vp9_iht16x16_256_add(input, dest, stride, ADST_DCT);
flipud(dest, stride, 16);
} else if (tx_type == DCT_FLIPADST) {
fliplr(dest, stride, 16);
vp9_iht16x16_256_add(input, dest, stride, DCT_ADST);
fliplr(dest, stride, 16);
} else if (tx_type == FLIPADST_FLIPADST) {
fliplrud(dest, stride, 16);
vp9_iht16x16_256_add(input, dest, stride, ADST_ADST);
fliplrud(dest, stride, 16);
} else if (tx_type == ADST_FLIPADST) {
fliplr(dest, stride, 16);
vp9_iht16x16_256_add(input, dest, stride, ADST_ADST);
fliplr(dest, stride, 16);
} else if (tx_type == FLIPADST_ADST) {
flipud(dest, stride, 16);
vp9_iht16x16_256_add(input, dest, stride, ADST_ADST);
flipud(dest, stride, 16);
#endif // CONFIG_EXT_TX
} else {
vp9_iht16x16_256_add(input, dest, stride, tx_type);
}
@ -3340,16 +3475,61 @@ void vp9_highbd_idct32x32_add(const tran_low_t *input, uint8_t *dest,
// iht
void vp9_highbd_iht4x4_add(TX_TYPE tx_type, const tran_low_t *input,
uint8_t *dest, int stride, int eob, int bd) {
if (tx_type == DCT_DCT)
if (tx_type == DCT_DCT) {
vp9_highbd_idct4x4_add(input, dest, stride, eob, bd);
else
#if CONFIG_EXT_TX
} else if (tx_type == FLIPADST_DCT) {
flipud16(CONVERT_TO_SHORTPTR(dest), stride, 4);
vp9_highbd_iht4x4_16_add(input, dest, stride, ADST_DCT, bd);
flipud16(CONVERT_TO_SHORTPTR(dest), stride, 4);
} else if (tx_type == DCT_FLIPADST) {
fliplr16(CONVERT_TO_SHORTPTR(dest), stride, 4);
vp9_highbd_iht4x4_16_add(input, dest, stride, DCT_ADST, bd);
fliplr16(CONVERT_TO_SHORTPTR(dest), stride, 4);
} else if (tx_type == FLIPADST_FLIPADST) {
fliplrud16(CONVERT_TO_SHORTPTR(dest), stride, 4);
vp9_highbd_iht4x4_16_add(input, dest, stride, ADST_ADST, bd);
fliplrud16(CONVERT_TO_SHORTPTR(dest), stride, 4);
} else if (tx_type == ADST_FLIPADST) {
fliplr16(CONVERT_TO_SHORTPTR(dest), stride, 4);
vp9_highbd_iht4x4_16_add(input, dest, stride, ADST_ADST, bd);
fliplr16(CONVERT_TO_SHORTPTR(dest), stride, 4);
} else if (tx_type == FLIPADST_ADST) {
flipud16(CONVERT_TO_SHORTPTR(dest), stride, 4);
vp9_highbd_iht4x4_16_add(input, dest, stride, ADST_ADST, bd);
flipud16(CONVERT_TO_SHORTPTR(dest), stride, 4);
#endif // CONFIG_EXT_TX
} else {
vp9_highbd_iht4x4_16_add(input, dest, stride, tx_type, bd);
}
}
void vp9_highbd_iht8x8_add(TX_TYPE tx_type, const tran_low_t *input,
uint8_t *dest, int stride, int eob, int bd) {
if (tx_type == DCT_DCT) {
vp9_highbd_idct8x8_add(input, dest, stride, eob, bd);
#if CONFIG_EXT_TX
} else if (tx_type == FLIPADST_DCT) {
flipud16(CONVERT_TO_SHORTPTR(dest), stride, 8);
vp9_highbd_iht8x8_64_add(input, dest, stride, ADST_DCT, bd);
flipud16(CONVERT_TO_SHORTPTR(dest), stride, 8);
} else if (tx_type == DCT_FLIPADST) {
fliplr16(CONVERT_TO_SHORTPTR(dest), stride, 8);
vp9_highbd_iht8x8_64_add(input, dest, stride, DCT_ADST, bd);
fliplr16(CONVERT_TO_SHORTPTR(dest), stride, 8);
} else if (tx_type == FLIPADST_FLIPADST) {
fliplrud16(CONVERT_TO_SHORTPTR(dest), stride, 8);
vp9_highbd_iht8x8_64_add(input, dest, stride, ADST_ADST, bd);
fliplrud16(CONVERT_TO_SHORTPTR(dest), stride, 8);
} else if (tx_type == ADST_FLIPADST) {
fliplr16(CONVERT_TO_SHORTPTR(dest), stride, 8);
vp9_highbd_iht8x8_64_add(input, dest, stride, ADST_ADST, bd);
fliplr16(CONVERT_TO_SHORTPTR(dest), stride, 8);
} else if (tx_type == FLIPADST_ADST) {
flipud16(CONVERT_TO_SHORTPTR(dest), stride, 8);
vp9_highbd_iht8x8_64_add(input, dest, stride, ADST_ADST, bd);
flipud16(CONVERT_TO_SHORTPTR(dest), stride, 8);
#endif // CONFIG_EXT_TX
} else {
vp9_highbd_iht8x8_64_add(input, dest, stride, tx_type, bd);
}
@ -3359,6 +3539,28 @@ void vp9_highbd_iht16x16_add(TX_TYPE tx_type, const tran_low_t *input,
uint8_t *dest, int stride, int eob, int bd) {
if (tx_type == DCT_DCT) {
vp9_highbd_idct16x16_add(input, dest, stride, eob, bd);
#if CONFIG_EXT_TX
} else if (tx_type == FLIPADST_DCT) {
flipud16(CONVERT_TO_SHORTPTR(dest), stride, 16);
vp9_highbd_iht16x16_256_add(input, dest, stride, ADST_DCT, bd);
flipud16(CONVERT_TO_SHORTPTR(dest), stride, 16);
} else if (tx_type == DCT_FLIPADST) {
fliplr16(CONVERT_TO_SHORTPTR(dest), stride, 16);
vp9_highbd_iht16x16_256_add(input, dest, stride, DCT_ADST, bd);
fliplr16(CONVERT_TO_SHORTPTR(dest), stride, 16);
} else if (tx_type == FLIPADST_FLIPADST) {
fliplrud16(CONVERT_TO_SHORTPTR(dest), stride, 16);
vp9_highbd_iht16x16_256_add(input, dest, stride, ADST_ADST, bd);
fliplrud16(CONVERT_TO_SHORTPTR(dest), stride, 16);
} else if (tx_type == ADST_FLIPADST) {
fliplr16(CONVERT_TO_SHORTPTR(dest), stride, 16);
vp9_highbd_iht16x16_256_add(input, dest, stride, ADST_ADST, bd);
fliplr16(CONVERT_TO_SHORTPTR(dest), stride, 16);
} else if (tx_type == FLIPADST_ADST) {
flipud16(CONVERT_TO_SHORTPTR(dest), stride, 16);
vp9_highbd_iht16x16_256_add(input, dest, stride, ADST_ADST, bd);
flipud16(CONVERT_TO_SHORTPTR(dest), stride, 16);
#endif // CONFIG_EXT_TX
} else {
vp9_highbd_iht16x16_256_add(input, dest, stride, tx_type, bd);
}

View File

@ -1609,7 +1609,9 @@ static int read_compressed_header(VP9Decoder *pbi, const uint8_t *data,
read_mv_probs(nmvc, cm->allow_high_precision_mv, &r);
#if CONFIG_EXT_TX
vp9_diff_update_prob(&r, &fc->ext_tx_prob);
for (j = TX_4X4; j <= TX_16X16; ++j)
for (i = 0; i < EXT_TX_TYPES - 1; ++i)
vp9_diff_update_prob(&r, &fc->ext_tx_prob[j][i]);
#endif
}

View File

@ -687,9 +687,10 @@ static void read_inter_frame_mode_info(VP9_COMMON *const cm,
mbmi->sb_type >= BLOCK_8X8 &&
!vp9_segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP) &&
!mbmi->skip) {
mbmi->ext_txfrm = vp9_read(r, cm->fc.ext_tx_prob);
mbmi->ext_txfrm = vp9_read_tree(r, vp9_ext_tx_tree,
cm->fc.ext_tx_prob[mbmi->tx_size]);
if (!cm->frame_parallel_decoding_mode)
++cm->counts.ext_tx[mbmi->ext_txfrm];
++cm->counts.ext_tx[mbmi->tx_size][mbmi->ext_txfrm];
} else {
mbmi->ext_txfrm = NORM;
}

View File

@ -38,12 +38,18 @@ static struct vp9_token intra_mode_encodings[INTRA_MODES];
static struct vp9_token switchable_interp_encodings[SWITCHABLE_FILTERS];
static struct vp9_token partition_encodings[PARTITION_TYPES];
static struct vp9_token inter_mode_encodings[INTER_MODES];
#if CONFIG_EXT_TX
static struct vp9_token ext_tx_encodings[EXT_TX_TYPES];
#endif
void vp9_entropy_mode_init() {
vp9_tokens_from_tree(intra_mode_encodings, vp9_intra_mode_tree);
vp9_tokens_from_tree(switchable_interp_encodings, vp9_switchable_interp_tree);
vp9_tokens_from_tree(partition_encodings, vp9_partition_tree);
vp9_tokens_from_tree(inter_mode_encodings, vp9_inter_mode_tree);
#if CONFIG_EXT_TX
vp9_tokens_from_tree(ext_tx_encodings, vp9_ext_tx_tree);
#endif
}
static void write_intra_mode(vp9_writer *w, PREDICTION_MODE mode,
@ -288,7 +294,8 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi,
bsize >= BLOCK_8X8 &&
!mbmi->skip &&
!vp9_segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
vp9_write(w, mbmi->ext_txfrm, cm->fc.ext_tx_prob);
vp9_write_token(w, vp9_ext_tx_tree, cm->fc.ext_tx_prob[mbmi->tx_size],
&ext_tx_encodings[mbmi->ext_txfrm]);
}
#endif
@ -1310,7 +1317,10 @@ static size_t write_compressed_header(VP9_COMP *cpi, uint8_t *data) {
vp9_write_nmv_probs(cm, cm->allow_high_precision_mv, &header_bc);
#if CONFIG_EXT_TX
vp9_cond_prob_diff_update(&header_bc, &fc->ext_tx_prob, cm->counts.ext_tx);
for (i = TX_4X4; i <= TX_16X16; ++i) {
prob_diff_update(vp9_ext_tx_tree, cm->fc.ext_tx_prob[i],
cm->counts.ext_tx[i], EXT_TX_TYPES, &header_bc);
}
#endif
}

View File

@ -3835,7 +3835,7 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
bsize >= BLOCK_8X8 &&
!mbmi->skip &&
!vp9_segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
++cm->counts.ext_tx[mbmi->ext_txfrm];
++cm->counts.ext_tx[mbmi->tx_size][mbmi->ext_txfrm];
}
#endif
}

View File

@ -373,6 +373,238 @@ static INLINE void highbd_fdct32x32(int rd_transform, const int16_t *src,
}
#endif // CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_EXT_TX
static void copy_block(const int16_t *src, int src_stride, int l,
int16_t *dest, int dest_stride) {
int i;
for (i = 0; i < l; ++i) {
vpx_memcpy(dest + dest_stride * i, src + src_stride * i,
l * sizeof(int16_t));
}
}
static void fliplr(int16_t *dest, int stride, int l) {
int i, j;
for (i = 0; i < l; ++i) {
for (j = 0; j < l / 2; ++j) {
const int16_t tmp = dest[i * stride + j];
dest[i * stride + j] = dest[i * stride + l - 1 - j];
dest[i * stride + l - 1 - j] = tmp;
}
}
}
static void flipud(int16_t *dest, int stride, int l) {
int i, j;
for (j = 0; j < l; ++j) {
for (i = 0; i < l / 2; ++i) {
const int16_t tmp = dest[i * stride + j];
dest[i * stride + j] = dest[(l - 1 - i) * stride + j];
dest[(l - 1 - i) * stride + j] = tmp;
}
}
}
static void fliplrud(int16_t *dest, int stride, int l) {
int i, j;
for (i = 0; i < l / 2; ++i) {
for (j = 0; j < l; ++j) {
const int16_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;
}
}
}
static void copy_fliplr(const int16_t *src, int src_stride, int l,
int16_t *dest, int dest_stride) {
copy_block(src, src_stride, l, dest, dest_stride);
fliplr(dest, dest_stride, l);
}
static void copy_flipud(const int16_t *src, int src_stride, int l,
int16_t *dest, int dest_stride) {
copy_block(src, src_stride, l, dest, dest_stride);
flipud(dest, dest_stride, l);
}
static void copy_fliplrud(const int16_t *src, int src_stride, int l,
int16_t *dest, int dest_stride) {
copy_block(src, src_stride, l, dest, dest_stride);
fliplrud(dest, dest_stride, l);
}
static void forw_tx16x16(MACROBLOCK *x, int plane,
const int16_t *src_diff, int diff_stride,
tran_low_t *const coeff) {
MACROBLOCKD *const xd = &x->e_mbd;
int16_t src_diff2[256];
TX_TYPE tx_type = get_tx_type(plane, xd);
if (tx_type == DCT_DCT) {
vp9_fdct16x16(src_diff, coeff, diff_stride);
} else if (tx_type == FLIPADST_DCT) {
copy_flipud(src_diff, diff_stride, 16, src_diff2, 16);
vp9_fht16x16(src_diff2, coeff, 16, ADST_DCT);
} else if (tx_type == DCT_FLIPADST) {
copy_fliplr(src_diff, diff_stride, 16, src_diff2, 16);
vp9_fht16x16(src_diff2, coeff, 16, DCT_ADST);
} else if (tx_type == FLIPADST_FLIPADST) {
copy_fliplrud(src_diff, diff_stride, 16, src_diff2, 16);
vp9_fht16x16(src_diff2, coeff, 16, ADST_ADST);
} else if (tx_type == ADST_FLIPADST) {
copy_fliplr(src_diff, diff_stride, 16, src_diff2, 16);
vp9_fht16x16(src_diff2, coeff, 16, ADST_ADST);
} else if (tx_type == FLIPADST_ADST) {
copy_flipud(src_diff, diff_stride, 16, src_diff2, 16);
vp9_fht16x16(src_diff2, coeff, 16, ADST_ADST);
} else {
vp9_fht16x16(src_diff, coeff, diff_stride, tx_type);
}
}
static void forw_tx8x8(MACROBLOCK *x, int plane,
const int16_t *src_diff, int diff_stride,
tran_low_t *const coeff) {
MACROBLOCKD *const xd = &x->e_mbd;
int16_t src_diff2[64];
TX_TYPE tx_type = get_tx_type(plane, xd);
if (tx_type == DCT_DCT) {
vp9_fdct8x8(src_diff, coeff, diff_stride);
} else if (tx_type == FLIPADST_DCT) {
copy_flipud(src_diff, diff_stride, 8, src_diff2, 8);
vp9_fht8x8(src_diff2, coeff, 8, ADST_DCT);
} else if (tx_type == DCT_FLIPADST) {
copy_fliplr(src_diff, diff_stride, 8, src_diff2, 8);
vp9_fht8x8(src_diff2, coeff, 8, DCT_ADST);
} else if (tx_type == FLIPADST_FLIPADST) {
copy_fliplrud(src_diff, diff_stride, 8, src_diff2, 8);
vp9_fht8x8(src_diff2, coeff, 8, ADST_ADST);
} else if (tx_type == ADST_FLIPADST) {
copy_fliplr(src_diff, diff_stride, 8, src_diff2, 8);
vp9_fht8x8(src_diff2, coeff, 8, ADST_ADST);
} else if (tx_type == FLIPADST_ADST) {
copy_flipud(src_diff, diff_stride, 8, src_diff2, 8);
vp9_fht8x8(src_diff2, coeff, 8, ADST_ADST);
} else {
vp9_fht8x8(src_diff, coeff, diff_stride, tx_type);
}
}
static void forw_tx4x4(MACROBLOCK *x, int plane, int block,
const int16_t *src_diff, int diff_stride,
tran_low_t *const coeff) {
MACROBLOCKD *const xd = &x->e_mbd;
int16_t src_diff2[16];
TX_TYPE tx_type = get_tx_type_4x4(plane, xd, block);
if (tx_type == DCT_DCT) {
x->fwd_txm4x4(src_diff, coeff, diff_stride);
} else if (tx_type == FLIPADST_DCT) {
copy_flipud(src_diff, diff_stride, 4, src_diff2, 4);
vp9_fht4x4(src_diff2, coeff, 4, ADST_DCT);
} else if (tx_type == DCT_FLIPADST) {
copy_fliplr(src_diff, diff_stride, 4, src_diff2, 4);
vp9_fht4x4(src_diff2, coeff, 4, DCT_ADST);
} else if (tx_type == FLIPADST_FLIPADST) {
copy_fliplrud(src_diff, diff_stride, 4, src_diff2, 4);
vp9_fht4x4(src_diff2, coeff, 4, ADST_ADST);
} else if (tx_type == ADST_FLIPADST) {
copy_fliplr(src_diff, diff_stride, 4, src_diff2, 4);
vp9_fht4x4(src_diff2, coeff, 4, ADST_ADST);
} else if (tx_type == FLIPADST_ADST) {
copy_flipud(src_diff, diff_stride, 4, src_diff2, 4);
vp9_fht4x4(src_diff2, coeff, 4, ADST_ADST);
} else {
vp9_fht4x4(src_diff, coeff, diff_stride, tx_type);
}
}
#if CONFIG_VP9_HIGHBITDEPTH
static void highbd_forw_tx16x16(MACROBLOCK *x, int plane,
const int16_t *src_diff, int diff_stride,
tran_low_t *const coeff) {
MACROBLOCKD *const xd = &x->e_mbd;
int16_t src_diff2[256];
TX_TYPE tx_type = get_tx_type(plane, xd);
if (tx_type == DCT_DCT) {
vp9_highbd_fdct16x16(src_diff, coeff, diff_stride);
} else if (tx_type == FLIPADST_DCT) {
copy_flipud(src_diff, diff_stride, 16, src_diff2, 16);
vp9_highbd_fht16x16(src_diff2, coeff, 16, ADST_DCT);
} else if (tx_type == DCT_FLIPADST) {
copy_fliplr(src_diff, diff_stride, 16, src_diff2, 16);
vp9_highbd_fht16x16(src_diff2, coeff, 16, DCT_ADST);
} else if (tx_type == FLIPADST_FLIPADST) {
copy_fliplrud(src_diff, diff_stride, 16, src_diff2, 16);
vp9_highbd_fht16x16(src_diff2, coeff, 16, ADST_ADST);
} else if (tx_type == ADST_FLIPADST) {
copy_fliplr(src_diff, diff_stride, 16, src_diff2, 16);
vp9_highbd_fht16x16(src_diff2, coeff, 16, ADST_ADST);
} else if (tx_type == FLIPADST_ADST) {
copy_flipud(src_diff, diff_stride, 16, src_diff2, 16);
vp9_highbd_fht16x16(src_diff2, coeff, 16, ADST_ADST);
} else {
vp9_fht16x16(src_diff, coeff, diff_stride, tx_type);
}
}
static void highbd_forw_tx8x8(MACROBLOCK *x, int plane,
const int16_t *src_diff, int diff_stride,
tran_low_t *const coeff) {
MACROBLOCKD *const xd = &x->e_mbd;
int16_t src_diff2[64];
TX_TYPE tx_type = get_tx_type(plane, xd);
if (tx_type == DCT_DCT) {
vp9_highbd_fdct8x8(src_diff, coeff, diff_stride);
} else if (tx_type == FLIPADST_DCT) {
copy_flipud(src_diff, diff_stride, 8, src_diff2, 8);
vp9_highbd_fht8x8(src_diff2, coeff, 8, ADST_DCT);
} else if (tx_type == DCT_FLIPADST) {
copy_fliplr(src_diff, diff_stride, 8, src_diff2, 8);
vp9_highbd_fht8x8(src_diff2, coeff, 8, DCT_ADST);
} else if (tx_type == FLIPADST_FLIPADST) {
copy_fliplrud(src_diff, diff_stride, 8, src_diff2, 8);
vp9_highbd_fht8x8(src_diff2, coeff, 8, ADST_ADST);
} else if (tx_type == ADST_FLIPADST) {
copy_fliplr(src_diff, diff_stride, 8, src_diff2, 8);
vp9_highbd_fht8x8(src_diff2, coeff, 8, ADST_ADST);
} else if (tx_type == FLIPADST_ADST) {
copy_flipud(src_diff, diff_stride, 8, src_diff2, 8);
vp9_highbd_fht8x8(src_diff2, coeff, 8, ADST_ADST);
} else {
vp9_highbd_fht8x8(src_diff, coeff, diff_stride, tx_type);
}
}
static void highbd_forw_tx4x4(MACROBLOCK *x, int plane, int block,
const int16_t *src_diff, int diff_stride,
tran_low_t *const coeff) {
MACROBLOCKD *const xd = &x->e_mbd;
int16_t src_diff2[16];
TX_TYPE tx_type = get_tx_type_4x4(plane, xd, block);
if (tx_type == DCT_DCT) {
x->fwd_txm4x4(src_diff, coeff, diff_stride);
} else if (tx_type == FLIPADST_DCT) {
copy_flipud(src_diff, diff_stride, 4, src_diff2, 4);
vp9_highbd_fht4x4(src_diff2, coeff, 4, ADST_DCT);
} else if (tx_type == DCT_FLIPADST) {
copy_fliplr(src_diff, diff_stride, 4, src_diff2, 4);
vp9_highbd_fht4x4(src_diff2, coeff, 4, DCT_ADST);
} else if (tx_type == FLIPADST_FLIPADST) {
copy_fliplrud(src_diff, diff_stride, 4, src_diff2, 4);
vp9_highbd_fht4x4(src_diff2, coeff, 4, ADST_ADST);
} else if (tx_type == ADST_FLIPADST) {
copy_fliplr(src_diff, diff_stride, 4, src_diff2, 4);
vp9_highbd_fht4x4(src_diff2, coeff, 4, ADST_ADST);
} else if (tx_type == FLIPADST_ADST) {
copy_flipud(src_diff, diff_stride, 4, src_diff2, 4);
vp9_highbd_fht4x4(src_diff2, coeff, 4, ADST_ADST);
} else {
vp9_highbd_fht4x4(src_diff, coeff, diff_stride, tx_type);
}
}
#endif // CONFIG_VP9_HIGHBITDEPTH
#endif // CONFIG_EXT_TX
void vp9_xform_quant_fp(MACROBLOCK *x, int plane, int block,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
MACROBLOCKD *const xd = &x->e_mbd;
@ -386,9 +618,6 @@ void vp9_xform_quant_fp(MACROBLOCK *x, int plane, int block,
const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
int i, j;
const int16_t *src_diff;
#if CONFIG_EXT_TX
TX_TYPE tx_type;
#endif
#if CONFIG_TX_SKIP
MB_MODE_INFO *mbmi = &xd->mi[0].src_mi->mbmi;
#endif
@ -467,12 +696,7 @@ void vp9_xform_quant_fp(MACROBLOCK *x, int plane, int block,
break;
case TX_16X16:
#if CONFIG_EXT_TX
tx_type = get_tx_type(plane, xd);
if (tx_type == DCT_DCT) {
vp9_highbd_fdct16x16(src_diff, coeff, diff_stride);
} else {
vp9_highbd_fht16x16(src_diff, coeff, diff_stride, tx_type);
}
highbd_forw_tx16x16(x, plane, src_diff, diff_stride, coeff);
#else
vp9_highbd_fdct16x16(src_diff, coeff, diff_stride);
#endif
@ -483,12 +707,7 @@ void vp9_xform_quant_fp(MACROBLOCK *x, int plane, int block,
break;
case TX_8X8:
#if CONFIG_EXT_TX
tx_type = get_tx_type(plane, xd);
if (tx_type == DCT_DCT) {
vp9_highbd_fdct8x8(src_diff, coeff, diff_stride);
} else {
vp9_highbd_fht8x8(src_diff, coeff, diff_stride, tx_type);
}
highbd_forw_tx8x8(x, plane, src_diff, diff_stride, coeff);
#else
vp9_highbd_fdct8x8(src_diff, coeff, diff_stride);
#endif
@ -499,12 +718,7 @@ void vp9_xform_quant_fp(MACROBLOCK *x, int plane, int block,
break;
case TX_4X4:
#if CONFIG_EXT_TX
tx_type = get_tx_type_4x4(plane, xd, block);
if (tx_type == DCT_DCT) {
x->fwd_txm4x4(src_diff, coeff, diff_stride);
} else {
vp9_highbd_fht4x4(src_diff, coeff, diff_stride, tx_type);
}
highbd_forw_tx4x4(x, plane, block, src_diff, diff_stride, coeff);
#else
x->fwd_txm4x4(src_diff, coeff, diff_stride);
#endif
@ -539,12 +753,7 @@ void vp9_xform_quant_fp(MACROBLOCK *x, int plane, int block,
break;
case TX_16X16:
#if CONFIG_EXT_TX
tx_type = get_tx_type(plane, xd);
if (tx_type == DCT_DCT) {
vp9_fdct16x16(src_diff, coeff, diff_stride);
} else {
vp9_fht16x16(src_diff, coeff, diff_stride, tx_type);
}
forw_tx16x16(x, plane, src_diff, diff_stride, coeff);
#else
vp9_fdct16x16(src_diff, coeff, diff_stride);
#endif
@ -555,12 +764,7 @@ void vp9_xform_quant_fp(MACROBLOCK *x, int plane, int block,
break;
case TX_8X8:
#if CONFIG_EXT_TX
tx_type = get_tx_type(plane, xd);
if (tx_type == DCT_DCT) {
vp9_fdct8x8(src_diff, coeff, diff_stride);
} else {
vp9_fht8x8(src_diff, coeff, diff_stride, tx_type);
}
forw_tx8x8(x, plane, src_diff, diff_stride, coeff);
#else
vp9_fdct8x8(src_diff, coeff, diff_stride);
#endif
@ -571,12 +775,7 @@ void vp9_xform_quant_fp(MACROBLOCK *x, int plane, int block,
break;
case TX_4X4:
#if CONFIG_EXT_TX
tx_type = get_tx_type_4x4(plane, xd, block);
if (tx_type == DCT_DCT) {
x->fwd_txm4x4(src_diff, coeff, diff_stride);
} else {
vp9_fht4x4(src_diff, coeff, diff_stride, tx_type);
}
forw_tx4x4(x, plane, block, src_diff, diff_stride, coeff);
#else
x->fwd_txm4x4(src_diff, coeff, diff_stride);
#endif
@ -603,9 +802,6 @@ void vp9_xform_quant_dc(MACROBLOCK *x, int plane, int block,
const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
int i, j;
const int16_t *src_diff;
#if CONFIG_EXT_TX
TX_TYPE tx_type;
#endif
#if CONFIG_TX_SKIP
MB_MODE_INFO *mbmi = &xd->mi[0].src_mi->mbmi;
#endif
@ -675,12 +871,7 @@ void vp9_xform_quant_dc(MACROBLOCK *x, int plane, int block,
break;
case TX_16X16:
#if CONFIG_EXT_TX
tx_type = get_tx_type(plane, xd);
if (tx_type == DCT_DCT) {
vp9_highbd_fdct16x16_1(src_diff, coeff, diff_stride);
} else {
vp9_highbd_fht16x16(src_diff, coeff, diff_stride, tx_type);
}
highbd_forw_tx16x16(x, plane, src_diff, diff_stride, coeff);
#else
vp9_highbd_fdct16x16_1(src_diff, coeff, diff_stride);
#endif
@ -690,12 +881,7 @@ void vp9_xform_quant_dc(MACROBLOCK *x, int plane, int block,
break;
case TX_8X8:
#if CONFIG_EXT_TX
tx_type = get_tx_type(plane, xd);
if (tx_type == DCT_DCT) {
vp9_highbd_fdct8x8_1(src_diff, coeff, diff_stride);
} else {
vp9_highbd_fht8x8(src_diff, coeff, diff_stride, tx_type);
}
highbd_forw_tx8x8(x, plane, src_diff, diff_stride, coeff);
#else
vp9_highbd_fdct8x8_1(src_diff, coeff, diff_stride);
#endif
@ -705,12 +891,7 @@ void vp9_xform_quant_dc(MACROBLOCK *x, int plane, int block,
break;
case TX_4X4:
#if CONFIG_EXT_TX
tx_type = get_tx_type_4x4(plane, xd, block);
if (tx_type == DCT_DCT) {
x->fwd_txm4x4(src_diff, coeff, diff_stride);
} else {
vp9_highbd_fht4x4(src_diff, coeff, diff_stride, tx_type);
}
highbd_forw_tx4x4(x, plane, block, src_diff, diff_stride, coeff);
#else
x->fwd_txm4x4(src_diff, coeff, diff_stride);
#endif
@ -742,12 +923,7 @@ void vp9_xform_quant_dc(MACROBLOCK *x, int plane, int block,
break;
case TX_16X16:
#if CONFIG_EXT_TX
tx_type = get_tx_type(plane, xd);
if (tx_type == DCT_DCT) {
vp9_fdct16x16_1(src_diff, coeff, diff_stride);
} else {
vp9_fht16x16(src_diff, coeff, diff_stride, tx_type);
}
forw_tx16x16(x, plane, src_diff, diff_stride, coeff);
#else
vp9_fdct16x16_1(src_diff, coeff, diff_stride);
#endif
@ -757,12 +933,7 @@ void vp9_xform_quant_dc(MACROBLOCK *x, int plane, int block,
break;
case TX_8X8:
#if CONFIG_EXT_TX
tx_type = get_tx_type(plane, xd);
if (tx_type == DCT_DCT) {
vp9_fdct8x8_1(src_diff, coeff, diff_stride);
} else {
vp9_fht8x8(src_diff, coeff, diff_stride, tx_type);
}
forw_tx8x8(x, plane, src_diff, diff_stride, coeff);
#else
vp9_fdct8x8_1(src_diff, coeff, diff_stride);
#endif
@ -772,12 +943,7 @@ void vp9_xform_quant_dc(MACROBLOCK *x, int plane, int block,
break;
case TX_4X4:
#if CONFIG_EXT_TX
tx_type = get_tx_type_4x4(plane, xd, block);
if (tx_type == DCT_DCT) {
x->fwd_txm4x4(src_diff, coeff, diff_stride);
} else {
vp9_fht4x4(src_diff, coeff, diff_stride, tx_type);
}
forw_tx4x4(x, plane, block, src_diff, diff_stride, coeff);
#else
x->fwd_txm4x4(src_diff, coeff, diff_stride);
#endif
@ -804,9 +970,6 @@ void vp9_xform_quant(MACROBLOCK *x, int plane, int block,
const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
int i, j;
const int16_t *src_diff;
#if CONFIG_EXT_TX
TX_TYPE tx_type;
#endif
#if CONFIG_TX_SKIP
MB_MODE_INFO *mbmi = &xd->mi[0].src_mi->mbmi;
#endif
@ -882,12 +1045,7 @@ void vp9_xform_quant(MACROBLOCK *x, int plane, int block,
break;
case TX_16X16:
#if CONFIG_EXT_TX
tx_type = get_tx_type(plane, xd);
if (tx_type == DCT_DCT) {
vp9_highbd_fdct16x16(src_diff, coeff, diff_stride);
} else {
vp9_highbd_fht16x16(src_diff, coeff, diff_stride, tx_type);
}
highbd_forw_tx16x16(x, plane, src_diff, diff_stride, coeff);
#else
vp9_highbd_fdct16x16(src_diff, coeff, diff_stride);
#endif
@ -898,12 +1056,7 @@ void vp9_xform_quant(MACROBLOCK *x, int plane, int block,
break;
case TX_8X8:
#if CONFIG_EXT_TX
tx_type = get_tx_type(plane, xd);
if (tx_type == DCT_DCT) {
vp9_highbd_fdct8x8(src_diff, coeff, diff_stride);
} else {
vp9_highbd_fht8x8(src_diff, coeff, diff_stride, tx_type);
}
highbd_forw_tx8x8(x, plane, src_diff, diff_stride, coeff);
#else
vp9_highbd_fdct8x8(src_diff, coeff, diff_stride);
#endif
@ -914,12 +1067,7 @@ void vp9_xform_quant(MACROBLOCK *x, int plane, int block,
break;
case TX_4X4:
#if CONFIG_EXT_TX
tx_type = get_tx_type_4x4(plane, xd, block);
if (tx_type == DCT_DCT) {
x->fwd_txm4x4(src_diff, coeff, diff_stride);
} else {
vp9_highbd_fht4x4(src_diff, coeff, diff_stride, tx_type);
}
highbd_forw_tx4x4(x, plane, block, src_diff, diff_stride, coeff);
#else
x->fwd_txm4x4(src_diff, coeff, diff_stride);
#endif
@ -954,12 +1102,7 @@ void vp9_xform_quant(MACROBLOCK *x, int plane, int block,
break;
case TX_16X16:
#if CONFIG_EXT_TX
tx_type = get_tx_type(plane, xd);
if (tx_type == DCT_DCT) {
vp9_fdct16x16(src_diff, coeff, diff_stride);
} else {
vp9_fht16x16(src_diff, coeff, diff_stride, tx_type);
}
forw_tx16x16(x, plane, src_diff, diff_stride, coeff);
#else
vp9_fdct16x16(src_diff, coeff, diff_stride);
#endif
@ -970,12 +1113,7 @@ void vp9_xform_quant(MACROBLOCK *x, int plane, int block,
break;
case TX_8X8:
#if CONFIG_EXT_TX
tx_type = get_tx_type(plane, xd);
if (tx_type == DCT_DCT) {
vp9_fdct8x8(src_diff, coeff, diff_stride);
} else {
vp9_fht8x8(src_diff, coeff, diff_stride, tx_type);
}
forw_tx8x8(x, plane, src_diff, diff_stride, coeff);
#else
vp9_fdct8x8(src_diff, coeff, diff_stride);
#endif
@ -986,12 +1124,7 @@ void vp9_xform_quant(MACROBLOCK *x, int plane, int block,
break;
case TX_4X4:
#if CONFIG_EXT_TX
tx_type = get_tx_type_4x4(plane, xd, block);
if (tx_type == DCT_DCT) {
x->fwd_txm4x4(src_diff, coeff, diff_stride);
} else {
vp9_fht4x4(src_diff, coeff, diff_stride, tx_type);
}
forw_tx4x4(x, plane, block, src_diff, diff_stride, coeff);
#else
x->fwd_txm4x4(src_diff, coeff, diff_stride);
#endif
@ -1019,7 +1152,6 @@ static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize,
uint8_t *dst;
ENTROPY_CONTEXT *a, *l;
#if CONFIG_EXT_TX
MB_MODE_INFO *mbmi = &xd->mi[0].src_mi->mbmi;
TX_TYPE tx_type;
#elif CONFIG_TX_SKIP
MB_MODE_INFO *mbmi = &xd->mi[0].src_mi->mbmi;
@ -1484,7 +1616,7 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;
vp9_predict_intra_block(xd, block >> 8, bwl, TX_64X64, mode,
#if CONFIG_FILTERINTRA
fbit,
fbit,
#endif
x->skip_encode ? src : dst,
x->skip_encode ? src_stride : dst_stride,
@ -1509,7 +1641,7 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;
vp9_predict_intra_block(xd, block >> 6, bwl, TX_32X32, mode,
#if CONFIG_FILTERINTRA
fbit,
fbit,
#endif
x->skip_encode ? src : dst,
x->skip_encode ? src_stride : dst_stride,

View File

@ -394,6 +394,9 @@ typedef struct VP9_COMP {
int intra_uv_mode_cost[FRAME_TYPES][INTRA_MODES];
int y_mode_costs[INTRA_MODES][INTRA_MODES][INTRA_MODES];
int switchable_interp_costs[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS];
#if CONFIG_EXT_TX
int ext_tx_costs[3][EXT_TX_TYPES];
#endif
PICK_MODE_CONTEXT *leaf_tree;
PC_TREE *pc_tree;

View File

@ -82,6 +82,10 @@ static void fill_mode_costs(VP9_COMP *cpi) {
for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; ++i)
vp9_cost_tokens(cpi->switchable_interp_costs[i],
fc->switchable_interp_prob[i], vp9_switchable_interp_tree);
#if CONFIG_EXT_TX
for (i = TX_4X4; i <= TX_16X16; ++i)
vp9_cost_tokens(cpi->ext_tx_costs[i], fc->ext_tx_prob[i], vp9_ext_tx_tree);
#endif
}
static void fill_token_costs(vp9_coeff_cost *c,
@ -638,4 +642,3 @@ int vp9_get_intra_cost_penalty(int qindex, int qdelta,
return 20 * q;
#endif // CONFIG_VP9_HIGHBITDEPTH
}

View File

@ -626,6 +626,11 @@ static void choose_largest_tx_size(VP9_COMP *cpi, MACROBLOCK *x,
txfm_rd_in_plane(x, rate, distortion, skip,
sse, ref_best_rd, 0, bs,
mbmi->tx_size, cpi->sf.use_fast_coef_costing);
#if CONFIG_EXT_TX
if (is_inter_block(mbmi) && mbmi->tx_size < TX_32X32 && bs >= BLOCK_8X8 &&
!xd->lossless && *rate != INT_MAX)
*rate += cpi->ext_tx_costs[mbmi->tx_size][mbmi->ext_txfrm];
#endif
}
static void choose_tx_size_from_rd(VP9_COMP *cpi, MACROBLOCK *x,
@ -667,6 +672,11 @@ static void choose_tx_size_from_rd(VP9_COMP *cpi, MACROBLOCK *x,
txfm_rd_in_plane(x, &r[n][0], &d[n], &s[n],
&sse[n], ref_best_rd, 0, bs, n,
cpi->sf.use_fast_coef_costing);
#if CONFIG_EXT_TX
if (is_inter_block(mbmi) && n < TX_32X32 && bs >= BLOCK_8X8 &&
!xd->lossless && r[n][0] != INT_MAX)
r[n][0] += cpi->ext_tx_costs[n][mbmi->ext_txfrm];
#endif
r[n][1] = r[n][0];
if (r[n][0] < INT_MAX) {
for (m = 0; m <= n - (n == (int) max_tx_size); m++) {
@ -1185,7 +1195,7 @@ static int64_t rd_pick_intra_sby_mode(VP9_COMP *cpi, MACROBLOCK *x,
#endif
super_block_yrd(cpi, x, &this_rate_tokenonly, &this_distortion,
&s, NULL, bsize, local_tx_cache, best_rd);
&s, NULL, bsize, local_tx_cache, best_rd);
if (this_rate_tokenonly == INT_MAX)
continue;
@ -2965,8 +2975,6 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
super_block_yrd(cpi, x, &rate_y_tx, &distortion_y_tx, &dummy, psse,
bsize, txfm_cache, INT64_MAX);
assert(rate_y_tx != INT_MAX);
if (mbmi->tx_size < TX_32X32)
rate_y_tx += vp9_cost_bit(cm->fc.ext_tx_prob, i);
assert(rate_y_tx >= 0);
rdcost_tx = RDCOST(x->rdmult, x->rddiv, rate_y_tx, distortion_y_tx);
rdcost_tx = MIN(rdcost_tx, RDCOST(x->rdmult, x->rddiv, 0, *psse));
@ -3021,10 +3029,6 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
}
*rate2 += *rate_y;
#if CONFIG_EXT_TX
if (mbmi->tx_size < TX_32X32 && !xd->lossless)
*rate2 += vp9_cost_bit(cm->fc.ext_tx_prob, mbmi->ext_txfrm);
#endif
*distortion += distortion_y;
rdcosty = RDCOST(x->rdmult, x->rddiv, *rate2, *distortion);