Add extended transforms for 32x32 and 64x64

Framework for alternate transforms for inter 32x32 and larger based
on dwt-dct hybrid is implemented.
Further experiments are to be condcuted with different
variations of hybrid dct/dwt or plain dwt, as well as super-resolution
mode.

Change-Id: I9a2bf49ba317e7668002cf1499211d7da6fa14ad
This commit is contained in:
Debargha Mukherjee 2015-07-16 22:13:40 -07:00
parent 7959dd012c
commit 4b57a8b356
24 changed files with 2409 additions and 102 deletions

View File

@ -95,7 +95,7 @@ TEST_P(QuantizeTest, OperationCheck) {
int skip_block = i == 0;
TX_SIZE sz = (TX_SIZE)(i % 3); // TX_4X4, TX_8X8 TX_16X16
TX_TYPE tx_type = (TX_TYPE)((i >> 2) % 3);
const scan_order *scan_order = &vp9_scan_orders[sz][tx_type];
const scan_order *scan_order = &vp9_intra_scan_orders[sz][tx_type];
int count = (4 << sz) * (4 << sz); // 16, 64, 256
int err_count = 0;
*eob_ptr = rnd.Rand16();
@ -154,7 +154,7 @@ TEST_P(Quantize32Test, OperationCheck) {
TX_SIZE sz = TX_32X32;
TX_TYPE tx_type = (TX_TYPE)(i % 4);
const scan_order *scan_order = &vp9_scan_orders[sz][tx_type];
const scan_order *scan_order = &vp9_intra_scan_orders[sz][tx_type];
int count = (4 << sz) * (4 << sz); // 1024
int err_count = 0;
*eob_ptr = rnd.Rand16();
@ -212,7 +212,7 @@ TEST_P(QuantizeTest, EOBCheck) {
int skip_block = i == 0;
TX_SIZE sz = (TX_SIZE)(i % 3); // TX_4X4, TX_8X8 TX_16X16
TX_TYPE tx_type = (TX_TYPE)((i >> 2) % 3);
const scan_order *scan_order = &vp9_scan_orders[sz][tx_type];
const scan_order *scan_order = &vp9_intra_scan_orders[sz][tx_type];
int count = (4 << sz) * (4 << sz); // 16, 64, 256
int err_count = 0;
*eob_ptr = rnd.Rand16();
@ -275,7 +275,7 @@ TEST_P(Quantize32Test, EOBCheck) {
int skip_block = i == 0;
TX_SIZE sz = TX_32X32;
TX_TYPE tx_type = (TX_TYPE)(i % 4);
const scan_order *scan_order = &vp9_scan_orders[sz][tx_type];
const scan_order *scan_order = &vp9_intra_scan_orders[sz][tx_type];
int count = (4 << sz) * (4 << sz); // 1024
int err_count = 0;
*eob_ptr = rnd.Rand16();

View File

@ -474,6 +474,22 @@ static INLINE int supertx_enabled(const MB_MODE_INFO *mbmi) {
#endif // CONFIG_SUPERTX
#if CONFIG_EXT_TX
#if CONFIG_WAVELETS
#define GET_EXT_TX_TYPES(tx_size) \
((tx_size) >= TX_32X32 ? EXT_TX_TYPES_LARGE : EXT_TX_TYPES)
#define GET_EXT_TX_TREE(tx_size) \
((tx_size) >= TX_32X32 ? vp9_ext_tx_large_tree : vp9_ext_tx_tree)
#define GET_EXT_TX_ENCODINGS(tx_size) \
((tx_size) >= TX_32X32 ? ext_tx_large_encodings : ext_tx_encodings)
#else
#define GET_EXT_TX_TYPES(tx_size) \
((tx_size) >= TX_32X32 ? 1 : EXT_TX_TYPES)
#define GET_EXT_TX_TREE(tx_size) \
((tx_size) >= TX_32X32 ? NULL : vp9_ext_tx_tree)
#define GET_EXT_TX_ENCODINGS(tx_size) \
((tx_size) >= TX_32X32 ? NULL : ext_tx_encodings)
#endif // CONFIG_WAVELETS
static TX_TYPE ext_tx_to_txtype[EXT_TX_TYPES] = {
DCT_DCT,
ADST_ADST,
@ -485,8 +501,31 @@ static TX_TYPE ext_tx_to_txtype[EXT_TX_TYPES] = {
FLIPADST_DCT,
DCT_FLIPADST,
};
#if CONFIG_WAVELETS
static TX_TYPE ext_tx_to_txtype_large[EXT_TX_TYPES_LARGE] = {
DCT_DCT,
WAVELET1_DCT_DCT
};
#endif // CONFIG_WAVELETS
#endif // CONFIG_EXT_TX
static INLINE TX_TYPE get_tx_type_large(PLANE_TYPE plane_type,
const MACROBLOCKD *xd) {
#if CONFIG_EXT_TX && CONFIG_WAVELETS
const MB_MODE_INFO *const mbmi = &xd->mi[0].src_mi->mbmi;
if (plane_type != PLANE_TYPE_Y || xd->lossless)
return DCT_DCT;
if (is_inter_block(mbmi)) {
return ext_tx_to_txtype_large[mbmi->ext_txfrm];
}
#endif // CONFIG_EXT_TX && CONFIG_WAVELETS
(void) plane_type;
(void) xd;
return DCT_DCT;
}
static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type,
const MACROBLOCKD *xd) {
const MB_MODE_INFO *const mbmi = &xd->mi[0].src_mi->mbmi;
@ -501,7 +540,7 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type,
#else
if (plane_type != PLANE_TYPE_Y || xd->lossless || is_inter_block(mbmi))
return DCT_DCT;
#endif
#endif // CONFIG_EXT_TX
#if CONFIG_INTRABC
if (is_intrabc_mode(mbmi->mode))
return DCT_DCT;

View File

@ -273,15 +273,23 @@ static INLINE const scan_order *get_scan(const MACROBLOCKD *xd, TX_SIZE tx_size,
return &vp9_default_scan_orders_pxd[tx_size];
#endif // CONFIG_TX_SKIP
if (is_inter_block(&mi->mbmi) || type != PLANE_TYPE_Y || xd->lossless
if (type != PLANE_TYPE_Y || xd->lossless
#if CONFIG_INTRABC
|| is_intrabc_mode(mi->mbmi.mode)
#endif
) {
return &vp9_default_scan_orders[tx_size];
} else if (is_inter_block(&mi->mbmi)) {
#if CONFIG_EXT_TX
TX_TYPE tx_type = (tx_size <= TX_16X16) ?
get_tx_type_4x4(type, xd, block_idx) : get_tx_type_large(type, xd);
return &vp9_inter_scan_orders[tx_size][tx_type];
#else
return &vp9_default_scan_orders[tx_size];
#endif
} else {
const PREDICTION_MODE mode = get_y_mode(mi, block_idx);
return &vp9_scan_orders[tx_size][intra_mode_to_tx_type_lookup[mode]];
return &vp9_intra_scan_orders[tx_size][intra_mode_to_tx_type_lookup[mode]];
}
}

View File

@ -434,11 +434,27 @@ const vp9_tree_index vp9_ext_tx_tree[TREE_SIZE(EXT_TX_TYPES)] = {
-ALT7, -ALT8,
};
#if CONFIG_WAVELETS
static const vp9_prob default_ext_tx_prob[TX_SIZES][EXT_TX_TYPES - 1] = {
{ 240, 128, 128, 128, 128, 128, 128, 128 },
{ 208, 128, 128, 128, 128, 128, 128, 128 },
{ 176, 128, 128, 128, 128, 128, 128, 128 },
{ 160, 128, 128, 128, 128, 128, 128, 128 },
#if CONFIG_TX64X64
{ 160, 128, 128, 128, 128, 128, 128, 128 },
#endif
};
const vp9_tree_index vp9_ext_tx_large_tree[TREE_SIZE(EXT_TX_TYPES_LARGE)] = {
-NORM, -ALT1,
};
#else // CONFIG_WAVELETS
static const vp9_prob default_ext_tx_prob[3][EXT_TX_TYPES - 1] = {
{ 240, 128, 128, 128, 128, 128, 128, 128 },
{ 208, 128, 128, 128, 128, 128, 128, 128 },
{ 176, 128, 128, 128, 128, 128, 128, 128 },
};
#endif // CONFIG_WAVELETS
#endif // CONFIG_EXT_TX
#if CONFIG_PALETTE
@ -1041,6 +1057,12 @@ void vp9_adapt_mode_probs(VP9_COMMON *cm) {
adapt_probs(vp9_ext_tx_tree, pre_fc->ext_tx_prob[i], counts->ext_tx[i],
fc->ext_tx_prob[i]);
}
#if CONFIG_WAVELETS
for (; i < TX_SIZES; ++i) {
adapt_probs(vp9_ext_tx_large_tree, pre_fc->ext_tx_prob[i],
counts->ext_tx[i], fc->ext_tx_prob[i]);
}
#endif
#endif // CONFIG_EXT_TX
#if CONFIG_SUPERTX

View File

@ -75,7 +75,11 @@ typedef struct frame_contexts {
vp9_prob filterintra_prob[TX_SIZES][INTRA_MODES];
#endif // CONFIG_FILTERINTRA
#if CONFIG_EXT_TX
#if CONFIG_WAVELETS
vp9_prob ext_tx_prob[TX_SIZES][EXT_TX_TYPES - 1];
#else
vp9_prob ext_tx_prob[3][EXT_TX_TYPES - 1];
#endif // CONFIG_WAVELETS
#endif // CONFIG_EXT_TX
#if CONFIG_PALETTE
vp9_prob palette_enabled_prob[10][3];
@ -145,7 +149,11 @@ typedef struct {
unsigned int filterintra[TX_SIZES][INTRA_MODES][2];
#endif // CONFIG_FILTERINTRA
#if CONFIG_EXT_TX
#if CONFIG_WAVELETS
unsigned int ext_tx[TX_SIZES][EXT_TX_TYPES];
#else
unsigned int ext_tx[3][EXT_TX_TYPES];
#endif // CONFIG_WAVELETS
#endif // CONFIG_EXT_TX
#if CONFIG_SUPERTX
unsigned int supertx[PARTITION_SUPERTX_CONTEXTS][TX_SIZES][2];
@ -203,6 +211,10 @@ 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)];
#if CONFIG_WAVELETS
extern const
vp9_tree_index vp9_ext_tx_large_tree[TREE_SIZE(EXT_TX_TYPES_LARGE)];
#endif // CONFIG_WAVELETS
#endif // CONFIG_EXT_TX
#if CONFIG_PALETTE
extern const vp9_tree_index vp9_palette_size_tree[TREE_SIZE(PALETTE_SIZES)];

View File

@ -124,14 +124,20 @@ typedef enum {
FLIPADST_FLIPADST = 6,
ADST_FLIPADST = 7,
FLIPADST_ADST = 8,
TOTAL_TX_TYPES
#endif
#if CONFIG_WAVELETS
WAVELET1_DCT_DCT = 9,
#endif // CONFIG_WAVELETS
TOTAL_TX_TYPES,
#endif // CONFIG_EXT_TX
} TX_TYPE;
#if CONFIG_EXT_TX
typedef enum {
NORM = 0,
ALT1 = 1,
#if CONFIG_WAVELETS
EXT_TX_TYPES_LARGE = 2,
#endif // CONFIG_WAVELETS
ALT2 = 2,
ALT3 = 3,
ALT4 = 4,
@ -141,7 +147,7 @@ typedef enum {
ALT8 = 8,
EXT_TX_TYPES
} EXT_TX_TYPE;
#endif
#endif // CONFIG_EXT_TX
#if CONFIG_PALETTE
typedef enum {

View File

@ -15,11 +15,6 @@
#include "vp9/common/vp9_blockd.h"
#include "vp9/common/vp9_idct.h"
static INLINE uint8_t clip_pixel_add(uint8_t dest, tran_high_t trans) {
trans = WRAPLOW(trans, 8);
return clip_pixel(WRAPLOW(dest + trans, 8));
}
void vp9_iwht4x4_16_add_c(const tran_low_t *input, uint8_t *dest, int stride) {
/* 4-point reversible, orthonormal inverse Walsh-Hadamard in 3.5 adds,
0.5 shifts per pixel. */

View File

@ -143,6 +143,11 @@ typedef struct {
#define WRAPLOW(x, bd) (x)
#endif // CONFIG_EMULATE_HARDWARE
static INLINE uint8_t clip_pixel_add(uint8_t dest, tran_high_t trans) {
trans = WRAPLOW(trans, 8);
return clip_pixel(WRAPLOW(dest + trans, 8));
}
void vp9_iwht4x4_add(const tran_low_t *input, uint8_t *dest, int stride,
int eob);
void vp9_idct4x4_add(const tran_low_t *input, uint8_t *dest, int stride,

View File

@ -15,7 +15,6 @@
#include "vp9/common/vp9_blockd.h"
#include "vp9/common/vp9_idwt.h"
// Note: block length must be even for this implementation
static void synthesis_53_row(int length,
tran_low_t *lowpass, tran_low_t *highpass,
@ -286,17 +285,20 @@ static void dyadic_synthesize_97(int levels, int width, int height,
(1 << dwt_scale_bits));
}
void vp9_idwt32x32_c(tran_low_t *input, tran_low_t *output, int stride) {
void vp9_idwt32x32_c(const tran_low_t *input, tran_low_t *output, int stride) {
tran_low_t in[32 * 32];
vpx_memcpy(in, input, sizeof(in));
#if DWT_TYPE == 26
dyadic_synthesize_26(4, 32, 32, input, 32, output, stride, 2);
dyadic_synthesize_26(4, 32, 32, in, 32, output, stride, 2);
#elif DWT_TYPE == 97
dyadic_synthesize_97(4, 32, 32, input, 32, output, stride, 2);
dyadic_synthesize_97(4, 32, 32, in, 32, output, stride, 2);
#elif DWT_TYPE == 53
dyadic_synthesize_53(4, 32, 32, input, 32, output, stride, 2);
dyadic_synthesize_53(4, 32, 32, in, 32, output, stride, 2);
#endif
}
void vp9_idwtdct32x32_c(tran_low_t *input, tran_low_t *output, int stride) {
void vp9_idwtdct32x32_c(const tran_low_t *input, tran_low_t *output,
int stride) {
const int dwt_levels = 1;
tran_low_t buffer[16 * 16];
tran_low_t buffer2[32 * 32];
@ -318,18 +320,46 @@ void vp9_idwtdct32x32_c(tran_low_t *input, tran_low_t *output, int stride) {
#endif
}
void vp9_idwt32x32_add_c(const tran_low_t *input, uint8_t *dest, int stride) {
int i, j;
tran_low_t output[32 * 32];
vp9_idwt32x32_c(input, output, 32);
for (i = 0; i < 32; ++i) {
for (j = 0; j < 32; ++j) {
dest[j * stride + i] =
clip_pixel_add(dest[j * stride + i], output[j * 32 + i]);
}
}
}
void vp9_idwtdct32x32_add_c(const tran_low_t *input, uint8_t *dest,
int stride) {
int i, j;
tran_low_t output[32 * 32];
vp9_idwtdct32x32_c(input, output, 32);
for (i = 0; i < 32; ++i) {
for (j = 0; j < 32; ++j) {
dest[j * stride + i] =
clip_pixel_add(dest[j * stride + i], output[j * 32 + i]);
}
}
}
#if CONFIG_TX64X64
void vp9_idwt64x64_c(tran_low_t *input, tran_low_t *output, int stride) {
void vp9_idwt64x64_c(const tran_low_t *input, tran_low_t *output, int stride) {
tran_low_t in[64 * 64];
vpx_memcpy(in, input, sizeof(in));
#if DWT_TYPE == 26
dyadic_synthesize_26(4, 64, 64, input, 64, output, stride, 1);
dyadic_synthesize_26(4, 64, 64, in, 64, output, stride, 1);
#elif DWT_TYPE == 97
dyadic_synthesize_97(4, 64, 64, input, 64, output, stride, 1);
dyadic_synthesize_97(4, 64, 64, in, 64, output, stride, 1);
#elif DWT_TYPE == 53
dyadic_synthesize_53(4, 64, 64, input, 64, output, stride, 1);
dyadic_synthesize_53(4, 64, 64, in, 64, output, stride, 1);
#endif
}
void vp9_idwtdct64x64_c(tran_low_t *input, tran_low_t *output, int stride) {
void vp9_idwtdct64x64_c(const tran_low_t *input, tran_low_t *output,
int stride) {
const int dwt_levels = 1;
tran_low_t buffer[32 * 32];
tran_low_t buffer2[64 * 64];
@ -349,4 +379,29 @@ void vp9_idwtdct64x64_c(tran_low_t *input, tran_low_t *output, int stride) {
dyadic_synthesize_53(dwt_levels, 64, 64, buffer2, 64, output, stride, 1);
#endif
}
void vp9_idwt64x64_add_c(const tran_low_t *input, uint8_t *dest, int stride) {
int i, j;
tran_low_t output[64 * 64];
vp9_idwt64x64_c(input, output, 64);
for (i = 0; i < 64; ++i) {
for (j = 0; j < 64; ++j) {
dest[j * stride + i] =
clip_pixel_add(dest[j * stride + i], output[j * 64 + i]);
}
}
}
void vp9_idwtdct64x64_add_c(const tran_low_t *input, uint8_t *dest,
int stride) {
int i, j;
tran_low_t output[64 * 64];
vp9_idwtdct64x64_c(input, output, 64);
for (i = 0; i < 64; ++i) {
for (j = 0; j < 64; ++j) {
dest[j * stride + i] =
clip_pixel_add(dest[j * stride + i], output[j * 64 + i]);
}
}
}
#endif // CONFIG_TX64X64

View File

@ -19,7 +19,7 @@
#include "vp9/common/vp9_idct.h"
#define DWT_MAX_LENGTH 64
#define DWT_TYPE 26 // 26/53/97
#define DWT_TYPE 53 // 26/53/97
#ifdef __cplusplus
extern "C" {

View File

@ -413,6 +413,14 @@ if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
add_proto qw/void vp9_idct32x32_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vp9_idct32x32_1_add/;
if (vpx_config("CONFIG_WAVELETS") eq "yes") {
add_proto qw/void vp9_idwtdct32x32_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vp9_idwtdct32x32_add/;
add_proto qw/void vp9_idwt32x32_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vp9_idwt32x32_add/;
}
if (vpx_config("CONFIG_TX64X64") eq "yes") {
add_proto qw/void vp9_idct64x64_4096_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vp9_idct64x64_4096_add/;
@ -420,6 +428,12 @@ if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
if (vpx_config("CONFIG_WAVELETS") eq "yes") {
add_proto qw/void vp9_idct32x32_noscale/, "const tran_low_t *input, int16_t *dest, int dest_stride";
specialize qw/vp9_idct32x32_noscale/;
add_proto qw/void vp9_idwtdct64x64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vp9_idwtdct64x64_add/;
add_proto qw/void vp9_idwt64x64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vp9_idwt64x64_add/;
}
}
@ -481,6 +495,14 @@ if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
add_proto qw/void vp9_idct32x32_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vp9_idct32x32_1_add/;
if (vpx_config("CONFIG_WAVELETS") eq "yes") {
add_proto qw/void vp9_idwtdct32x32_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vp9_idwtdct32x32_add/;
add_proto qw/void vp9_idwt32x32_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vp9_idwt32x32_add/;
}
if (vpx_config("CONFIG_TX64X64") eq "yes") {
add_proto qw/void vp9_idct64x64_4096_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vp9_idct64x64_4096_add/;
@ -488,6 +510,12 @@ if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
if (vpx_config("CONFIG_WAVELETS") eq "yes") {
add_proto qw/void vp9_idct32x32_noscale/, "const tran_low_t *input, int16_t *dest, int dest_stride";
specialize qw/vp9_idct32x32_noscale/;
add_proto qw/void vp9_idwtdct64x64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vp9_idwtdct64x64_add/;
add_proto qw/void vp9_idwt64x64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vp9_idwt64x64_add/;
}
}
@ -557,6 +585,14 @@ if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
specialize qw/vp9_idct32x32_1_add sse2 neon_asm dspr2/;
$vp9_idct32x32_1_add_neon_asm=vp9_idct32x32_1_add_neon;
if (vpx_config("CONFIG_WAVELETS") eq "yes") {
add_proto qw/void vp9_idwtdct32x32_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vp9_idwtdct32x32_add/;
add_proto qw/void vp9_idwt32x32_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vp9_idwt32x32_add/;
}
if (vpx_config("CONFIG_TX64X64") eq "yes") {
add_proto qw/void vp9_idct64x64_4096_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vp9_idct64x64_4096_add/;
@ -564,6 +600,12 @@ if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
if (vpx_config("CONFIG_WAVELETS") eq "yes") {
add_proto qw/void vp9_idct32x32_noscale/, "const tran_low_t *input, int16_t *dest, int dest_stride";
specialize qw/vp9_idct32x32_noscale/;
add_proto qw/void vp9_idwtdct64x64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vp9_idwtdct64x64_add/;
add_proto qw/void vp9_idwt64x64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vp9_idwt64x64_add/;
}
}
@ -1589,6 +1631,12 @@ if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
if (vpx_config("CONFIG_WAVELETS") eq "yes") {
add_proto qw/void vp9_fdct16x16_noscale/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vp9_fdct16x16_noscale/;
add_proto qw/void vp9_fdwtdct32x32/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vp9_fdwtdct32x32/;
add_proto qw/void vp9_fdwt32x32/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vp9_fdwt32x32/;
}
if (vpx_config("CONFIG_TX64X64") eq "yes") {
@ -1601,6 +1649,12 @@ if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
if (vpx_config("CONFIG_WAVELETS") eq "yes") {
add_proto qw/void vp9_fdct32x32_noscale/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vp9_fdct32x32_noscale/;
add_proto qw/void vp9_fdwtdct64x64/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vp9_fdwtdct64x64/;
add_proto qw/void vp9_fdwt64x64/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vp9_fdwt64x64/;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,10 @@ typedef struct {
} scan_order;
extern const scan_order vp9_default_scan_orders[TX_SIZES];
extern const scan_order vp9_scan_orders[TX_SIZES][TX_TYPES];
extern const scan_order vp9_intra_scan_orders[TX_SIZES][TX_TYPES];
#if CONFIG_EXT_TX
extern const scan_order vp9_inter_scan_orders[TX_SIZES][TOTAL_TX_TYPES];
#endif // CONFIG_EXT_TX
#if CONFIG_TX_SKIP
// pixel domain default scan orders

View File

@ -495,12 +495,22 @@ static void inverse_transform_block(MACROBLOCKD* xd, int plane, int block,
vp9_iht16x16_add(tx_type, dqcoeff, dst, stride, eob);
break;
case TX_32X32:
tx_type = DCT_DCT;
vp9_idct32x32_add(dqcoeff, dst, stride, eob);
tx_type = get_tx_type_large(plane_type, xd);
#if CONFIG_EXT_TX && CONFIG_WAVELETS
if (tx_type == WAVELET1_DCT_DCT)
vp9_idwtdct32x32_add(dqcoeff, dst, stride);
else
#endif // CONFIG_EXT_TX && CONFIG_WAVELETS
vp9_idct32x32_add(dqcoeff, dst, stride, eob);
break;
#if CONFIG_TX64X64
case TX_64X64:
tx_type = DCT_DCT;
tx_type = get_tx_type_large(plane_type, xd);
#if CONFIG_EXT_TX && CONFIG_WAVELETS
if (tx_type == WAVELET1_DCT_DCT)
vp9_idwtdct64x64_add(dqcoeff, dst, stride);
else
#endif // CONFIG_EXT_TX && CONFIG_WAVELETS
vp9_idct64x64_add(dqcoeff, dst, stride, eob);
break;
#endif // CONFIG_TX64X64
@ -525,7 +535,6 @@ static void inverse_transform_block(MACROBLOCKD* xd, int plane, int block,
vp9_iwht4x4_add(dqcoeff, dst, stride, eob);
} else {
const PLANE_TYPE plane_type = pd->plane_type;
#if CONFIG_TX_SKIP
if (mbmi->tx_skip[plane != 0]) {
int bs = 4 << tx_size;
@ -555,12 +564,22 @@ static void inverse_transform_block(MACROBLOCKD* xd, int plane, int block,
vp9_iht16x16_add(tx_type, dqcoeff, dst, stride, eob);
break;
case TX_32X32:
tx_type = DCT_DCT;
vp9_idct32x32_add(dqcoeff, dst, stride, eob);
tx_type = get_tx_type_large(plane_type, xd);
#if CONFIG_EXT_TX && CONFIG_WAVELETS
if (tx_type == WAVELET1_DCT_DCT)
vp9_idwtdct32x32_add(dqcoeff, dst, stride);
else
#endif // CONFIG_EXT_TX && CONFIG_WAVELETS
vp9_idct32x32_add(dqcoeff, dst, stride, eob);
break;
#if CONFIG_TX64X64
case TX_64X64:
tx_type = DCT_DCT;
tx_type = get_tx_type_large(plane_type, xd);
#if CONFIG_EXT_TX && CONFIG_WAVELETS
if (tx_type == WAVELET1_DCT_DCT)
vp9_idwtdct64x64_add(dqcoeff, dst, stride);
else
#endif // CONFIG_EXT_TX && CONFIG_WAVELETS
vp9_idct64x64_add(dqcoeff, dst, stride, eob);
break;
#endif // CONFIG_TX64X64
@ -1769,18 +1788,28 @@ static void decode_partition(VP9_COMMON *const cm, MACROBLOCKD *const xd,
if (skip)
reset_skip_context(xd, bsize);
#if CONFIG_EXT_TX
if (bsize <= BLOCK_16X16 && !skip) {
txfm = vp9_read_tree(r, vp9_ext_tx_tree,
cm->fc.ext_tx_prob[supertx_size]);
if (!cm->frame_parallel_decoding_mode)
++cm->counts.ext_tx[supertx_size][txfm];
if (!skip) {
if (supertx_size <= TX_16X16) {
txfm = vp9_read_tree(r, vp9_ext_tx_tree,
cm->fc.ext_tx_prob[supertx_size]);
if (!cm->frame_parallel_decoding_mode)
++cm->counts.ext_tx[supertx_size][txfm];
#if CONFIG_WAVELETS
} else {
txfm = vp9_read_tree(r, vp9_ext_tx_large_tree,
cm->fc.ext_tx_prob[supertx_size]);
if (!cm->frame_parallel_decoding_mode)
++cm->counts.ext_tx[supertx_size][txfm];
#endif // CONFIG_WAVELETS
}
}
#endif
#endif // CONFIG_EXT_TX
}
#endif // CONFIG_SUPERTX
if (subsize < BLOCK_8X8) {
decode_block(cm, xd, tile,
#if CONFIG_SUPERTX
supertx_enabled,
#endif
#if CONFIG_COPY_MODE
@ -3210,6 +3239,11 @@ static void read_ext_tx_probs(FRAME_CONTEXT *fc, vp9_reader *r) {
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]);
#if CONFIG_WAVELETS
for (; j < TX_SIZES; ++j)
for (i = 0; i < EXT_TX_TYPES_LARGE - 1; ++i)
vp9_diff_update_prob(r, &fc->ext_tx_prob[j][i]);
#endif
}
}
#endif // CONFIG_EXT_TX
@ -3494,7 +3528,7 @@ static void debug_check_frame_counts(const VP9_COMMON *const cm) {
#if CONFIG_EXT_TX
assert(!memcmp(cm->counts.ext_tx, zero_counts.ext_tx,
sizeof(cm->counts.ext_tx)));
#endif
#endif // CONFIG_EXT_TX
#if CONFIG_NEW_INTER
assert(!memcmp(cm->counts.inter_compound_mode,
zero_counts.inter_compound_mode,

View File

@ -1522,15 +1522,22 @@ static void read_inter_frame_mode_info(VP9_COMMON *const cm,
#if CONFIG_EXT_TX
if (inter_block &&
#if !CONFIG_WAVELETS
mbmi->tx_size <= TX_16X16 &&
#endif
cm->base_qindex > 0 &&
mbmi->sb_type >= BLOCK_8X8 &&
#if CONFIG_SUPERTX
!supertx_enabled &&
!supertx_enabled &&
#endif
!vp9_segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP) &&
!mbmi->skip) {
mbmi->ext_txfrm = vp9_read_tree(r,
#if CONFIG_WAVELETS
GET_EXT_TX_TREE(mbmi->tx_size),
#else
vp9_ext_tx_tree,
#endif
!vp9_segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP) &&
!mbmi->skip) {
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->tx_size][mbmi->ext_txfrm];

View File

@ -46,7 +46,10 @@ 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
#if CONFIG_WAVELETS
static struct vp9_token ext_tx_large_encodings[EXT_TX_TYPES_LARGE];
#endif // CONFIG_WAVELETS
#endif // CONFIG_EXT_TX
#if CONFIG_PALETTE
static struct vp9_token palette_size_encodings[PALETTE_SIZES];
static struct vp9_token palette_color_encodings[PALETTE_COLORS];
@ -84,7 +87,10 @@ void vp9_entropy_mode_init() {
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);
#if CONFIG_WAVELETS
vp9_tokens_from_tree(ext_tx_large_encodings, vp9_ext_tx_large_tree);
#endif
#endif // CONFIG_EXT_TX
#if CONFIG_PALETTE
vp9_tokens_from_tree(palette_size_encodings, vp9_palette_size_tree);
vp9_tokens_from_tree(palette_color_encodings, vp9_palette_color_tree);
@ -245,6 +251,13 @@ static void update_ext_tx_probs(VP9_COMMON *cm, vp9_writer *w) {
savings += prob_diff_update_savings(vp9_ext_tx_tree, cm->fc.ext_tx_prob[i],
cm->counts.ext_tx[i], EXT_TX_TYPES);
}
#if CONFIG_WAVELETS
for (; i < TX_SIZES; ++i) {
savings += prob_diff_update_savings(
vp9_ext_tx_large_tree, cm->fc.ext_tx_prob[i], cm->counts.ext_tx[i],
EXT_TX_TYPES_LARGE);
}
#endif
do_update = savings > savings_thresh;
vp9_write(w, do_update, GROUP_DIFF_UPDATE_PROB);
if (do_update) {
@ -252,6 +265,12 @@ static void update_ext_tx_probs(VP9_COMMON *cm, vp9_writer *w) {
prob_diff_update(vp9_ext_tx_tree, cm->fc.ext_tx_prob[i],
cm->counts.ext_tx[i], EXT_TX_TYPES, w);
}
#if CONFIG_WAVELETS
for (; i < TX_SIZES; ++i) {
prob_diff_update(vp9_ext_tx_large_tree, cm->fc.ext_tx_prob[i],
cm->counts.ext_tx[i], EXT_TX_TYPES_LARGE, w);
}
#endif // CONFIG_WAVELETS
}
}
#endif // CONFIG_EXT_TX
@ -607,7 +626,9 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi,
}
#if CONFIG_EXT_TX
if (is_inter &&
mbmi->tx_size < TX_32X32 &&
#if !CONFIG_WAVELETS
mbmi->tx_size <= TX_16X16 &&
#endif
cm->base_qindex > 0 &&
bsize >= BLOCK_8X8 &&
#if CONFIG_SUPERTX
@ -615,8 +636,14 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi,
#endif
!mbmi->skip &&
!vp9_segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
#if CONFIG_WAVELETS
vp9_write_token(w, GET_EXT_TX_TREE(mbmi->tx_size),
cm->fc.ext_tx_prob[mbmi->tx_size],
&((GET_EXT_TX_ENCODINGS(mbmi->tx_size))[mbmi->ext_txfrm]));
#else
vp9_write_token(w, vp9_ext_tx_tree, cm->fc.ext_tx_prob[mbmi->tx_size],
&ext_tx_encodings[mbmi->ext_txfrm]);
#endif // CONFIG_WAVELETS
}
#endif // CONFIG_EXT_TX
@ -1211,10 +1238,18 @@ static void write_modes_sb(VP9_COMP *cpi,
if (supertx_enabled) {
vp9_write(w, xd->mi[0].mbmi.skip, vp9_get_skip_prob(cm, xd));
#if CONFIG_EXT_TX
#if CONFIG_WAVELETS
if (!xd->mi[0].mbmi.skip)
vp9_write_token(w, GET_EXT_TX_TREE(supertx_size),
cm->fc.ext_tx_prob[supertx_size],
&GET_EXT_TX_ENCODINGS(supertx_size)
[xd->mi[0].mbmi.ext_txfrm]);
#else
if (supertx_size <= TX_16X16 && !xd->mi[0].mbmi.skip)
vp9_write_token(w, vp9_ext_tx_tree, cm->fc.ext_tx_prob[supertx_size],
&ext_tx_encodings[xd->mi[0].mbmi.ext_txfrm]);
#endif
#endif // CONFIG_WAVELETS
#endif // CONFIG_EXT_TX
}
}
#endif // CONFIG_SUPERTX

View File

@ -71,7 +71,7 @@ static void analysis_53_col(int length, tran_low_t *x,
}
static void dyadic_analyze_53(int levels, int width, int height,
int16_t *x, int pitch_x,
const int16_t *x, int pitch_x,
tran_low_t *c, int pitch_c,
int dwt_scale_bits) {
int lv, i, j, nh, nw, hh = height, hw = width;
@ -152,7 +152,7 @@ static void analysis_26_col(int length, tran_low_t *x,
}
static void dyadic_analyze_26(int levels, int width, int height,
int16_t *x, int pitch_x,
const int16_t *x, int pitch_x,
tran_low_t *c, int pitch_c,
int dwt_scale_bits) {
int lv, i, j, nh, nw, hh = height, hw = width;
@ -221,7 +221,7 @@ static void analysis_97(int length, double *x,
}
static void dyadic_analyze_97(int levels, int width, int height,
int16_t *x, int pitch_x,
const int16_t *x, int pitch_x,
tran_low_t *c, int pitch_c,
int dwt_scale_bits) {
int lv, i, j, nh, nw, hh = height, hw = width;
@ -258,7 +258,7 @@ static void dyadic_analyze_97(int levels, int width, int height,
}
}
void vp9_fdwt32x32_c(tran_low_t *input, tran_low_t *output, int stride) {
void vp9_fdwt32x32_c(const int16_t *input, tran_low_t *output, int stride) {
#if DWT_TYPE == 26
dyadic_analyze_26(4, 32, 32, input, stride, output, 32, 2);
#elif DWT_TYPE == 97
@ -268,11 +268,11 @@ void vp9_fdwt32x32_c(tran_low_t *input, tran_low_t *output, int stride) {
#endif
}
void vp9_fdwtdct32x32_c(tran_low_t *input, tran_low_t *output,
void vp9_fdwtdct32x32_c(const int16_t *input, tran_low_t *output,
int stride) {
const int dwt_levels = 1;
tran_low_t buffer[16 * 16];
int i, j;
int i;
// Scales up by 2-bit from unitary
#if DWT_TYPE == 26
dyadic_analyze_26(dwt_levels, 32, 32, input, stride, output, 32, 2);
@ -290,7 +290,7 @@ void vp9_fdwtdct32x32_c(tran_low_t *input, tran_low_t *output,
}
#if CONFIG_TX64X64
void vp9_fdwt64x64_c(tran_low_t *input, tran_low_t *output, int stride) {
void vp9_fdwt64x64_c(const int16_t *input, tran_low_t *output, int stride) {
#if DWT_TYPE == 26
dyadic_analyze_26(4, 64, 64, input, stride, output, 64, 1);
#elif DWT_TYPE == 97
@ -300,8 +300,7 @@ void vp9_fdwt64x64_c(tran_low_t *input, tran_low_t *output, int stride) {
#endif
}
void vp9_fdwtdct64x64_c(tran_low_t *input, tran_low_t *output,
int stride) {
void vp9_fdwtdct64x64_c(const int16_t *input, tran_low_t *output, int stride) {
const int dwt_levels = 1;
tran_low_t buffer[32 * 32];
int i;

View File

@ -18,13 +18,6 @@
extern "C" {
#endif
#if CONFIG_TX64X64
void vp9_fdwt64x64(tran_low_t *input, tran_low_t *output, int stride);
void vp9_fdwtdct64x64(tran_low_t *input, tran_low_t *output, int stride);
#endif // CONFIG_TX64X64
void vp9_fdwt32x32(tran_low_t *input, tran_low_t *output, int stride);
void vp9_fdwtdct32x32(tran_low_t *input, tran_low_t *output, int stride);
#ifdef __cplusplus
} // extern "C"
#endif

View File

@ -1764,9 +1764,16 @@ static void encode_sb(VP9_COMP *cpi, const TileInfo *const tile,
[partition_supertx_context_lookup[partition]][supertx_size][1]++;
cm->counts.supertx_size[supertx_size]++;
#if CONFIG_EXT_TX
if (supertx_size < TX_32X32 && !xd->mi[0].mbmi.skip)
++cm->counts.ext_tx[xd->mi[0].mbmi.tx_size][xd->mi[0].mbmi.ext_txfrm];
#endif
#if CONFIG_WAVELETS
if (!xd->mi[0].mbmi.skip)
++cm->counts.ext_tx[xd->mi[0].mbmi.tx_size]
[xd->mi[0].mbmi.ext_txfrm];
#else
if (supertx_size <= TX_16X16 && !xd->mi[0].mbmi.skip)
++cm->counts.ext_tx[xd->mi[0].mbmi.tx_size]
[xd->mi[0].mbmi.ext_txfrm];
#endif // CONFIG_WAVELETS
#endif // CONFIG_EXT_TX
(*tp)->token = EOSB_TOKEN;
(*tp)++;
}
@ -4638,8 +4645,10 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
mi_8x8[mis * y + x].src_mi->mbmi.tx_size = tx_size;
}
#if CONFIG_EXT_TX
if (mbmi->tx_size < TX_32X32 &&
is_inter_block(mbmi) &&
if (is_inter_block(mbmi) &&
#if !CONFIG_WAVELETS
mbmi->tx_size <= TX_16X16 &&
#endif
cm->base_qindex > 0 &&
bsize >= BLOCK_8X8 &&
!mbmi->skip &&
@ -5789,10 +5798,7 @@ static void rd_supertx_sb(VP9_COMP *cpi, const TileInfo *const tile,
tx_size = bsize_to_tx_size(bsize);
vp9_subtract_plane(x, bsize, 0);
#if CONFIG_EXT_TX
for (txfm = NORM; txfm < EXT_TX_TYPES; txfm++) {
if (tx_size > TX_16X16 && txfm != NORM)
continue;
for (txfm = NORM; txfm < GET_EXT_TX_TYPES(tx_size); txfm++) {
xd->mi[0].mbmi.ext_txfrm = txfm;
#endif // CONFIG_EXT_TX
txfm_rd_in_plane_supertx(x, &this_rate, &this_dist, &pnskip, &pnsse,
@ -5807,7 +5813,9 @@ static void rd_supertx_sb(VP9_COMP *cpi, const TileInfo *const tile,
x->skip = 1;
} else {
#if CONFIG_EXT_TX
if (tx_size < TX_32X32)
#if !CONFIG_WAVELETS
if (tx_size <= TX_16X16)
#endif
*tmp_rate += cpi->ext_tx_costs[tx_size][txfm];
#endif // CONFIG_EXT_TX
if (RDCOST(x->rdmult, x->rddiv, *tmp_rate, *tmp_dist)

View File

@ -23,6 +23,9 @@
#include "vp9/encoder/vp9_quantize.h"
#include "vp9/encoder/vp9_rd.h"
#include "vp9/encoder/vp9_tokenize.h"
#if CONFIG_WAVELETS
#include "vp9/encoder/vp9_dwt.h"
#endif
struct optimize_ctx {
ENTROPY_CONTEXT ta[MAX_MB_PLANE][16];
@ -573,6 +576,34 @@ static void copy_fliplrud(const int16_t *src, int src_stride, int l,
fliplrud(dest, dest_stride, l);
}
#if CONFIG_WAVELETS
static void forw_tx32x32(MACROBLOCK *x, int plane,
const int16_t *src_diff, int diff_stride,
tran_low_t *const coeff) {
MACROBLOCKD *const xd = &x->e_mbd;
TX_TYPE tx_type = get_tx_type_large(plane, xd);
if (tx_type == WAVELET1_DCT_DCT) {
vp9_fdwtdct32x32(src_diff, coeff, diff_stride);
} else {
fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride);
}
}
#if CONFIG_TX64X64
static void forw_tx64x64(MACROBLOCK *x, int plane,
const int16_t *src_diff, int diff_stride,
tran_low_t *const coeff) {
MACROBLOCKD *const xd = &x->e_mbd;
TX_TYPE tx_type = get_tx_type_large(plane, xd);
if (tx_type == WAVELET1_DCT_DCT) {
vp9_fdwtdct64x64(src_diff, coeff, diff_stride);
} else {
vp9_fdct64x64(src_diff, coeff, diff_stride);
}
}
#endif // CONFIG_TX64X64
#endif // CONFIG_WAVELETS
static void forw_tx16x16(MACROBLOCK *x, int plane,
const int16_t *src_diff, int diff_stride,
tran_low_t *const coeff) {
@ -925,7 +956,11 @@ void vp9_xform_quant_nuq(MACROBLOCK *x, int plane, int block,
switch (tx_size) {
#if CONFIG_TX64X64
case TX_64X64:
#if CONFIG_EXT_TX && CONFIG_WAVELETS
forw_tx64x64(x, plane, src_diff, diff_stride, coeff);
#else
vp9_fdct64x64(src_diff, coeff, diff_stride);
#endif
vp9_quantize_64x64_nuq(coeff, 4096, x->skip_block,
p->quant, p->quant_shift, pd->dequant,
(const cumbins_type_nuq *)p->cumbins_nuq,
@ -935,7 +970,11 @@ void vp9_xform_quant_nuq(MACROBLOCK *x, int plane, int block,
break;
#endif // CONFIG_TX64X64
case TX_32X32:
#if CONFIG_EXT_TX && CONFIG_WAVELETS
forw_tx32x32(x, plane, src_diff, diff_stride, coeff);
#else
fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride);
#endif
vp9_quantize_32x32_nuq(coeff, 1024, x->skip_block,
p->quant, p->quant_shift, pd->dequant,
(const cumbins_type_nuq *)p->cumbins_nuq,
@ -1165,7 +1204,11 @@ void vp9_xform_quant_fp_nuq(MACROBLOCK *x, int plane, int block,
switch (tx_size) {
#if CONFIG_TX64X64
case TX_64X64:
#if CONFIG_EXT_TX && CONFIG_WAVELETS
forw_tx64x64(x, plane, src_diff, diff_stride, coeff);
#else
vp9_fdct64x64(src_diff, coeff, diff_stride);
#endif
vp9_quantize_64x64_fp_nuq(coeff, 4096, x->skip_block,
p->quant_fp, pd->dequant,
(const cumbins_type_nuq *)p->cumbins_nuq,
@ -1176,7 +1219,11 @@ void vp9_xform_quant_fp_nuq(MACROBLOCK *x, int plane, int block,
break;
#endif // CONFIG_TX64X64
case TX_32X32:
#if CONFIG_EXT_TX && CONFIG_WAVELETS
forw_tx32x32(x, plane, src_diff, diff_stride, coeff);
#else
fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride);
#endif
vp9_quantize_32x32_fp_nuq(coeff, 1024, x->skip_block,
p->quant_fp, pd->dequant,
(const cumbins_type_nuq *)p->cumbins_nuq,
@ -1384,7 +1431,11 @@ void vp9_xform_quant_dc_nuq(MACROBLOCK *x, int plane, int block,
switch (tx_size) {
#if CONFIG_TX64X64
case TX_64X64:
#if CONFIG_EXT_TX && CONFIG_WAVELETS
forw_tx64x64(x, plane, src_diff, diff_stride, coeff);
#else
vp9_fdct64x64_1(src_diff, coeff, diff_stride);
#endif
vp9_quantize_dc_64x64_nuq(coeff, x->skip_block,
p->quant[0], p->quant_shift[0], pd->dequant[0],
p->cumbins_nuq[0], pd->dequant_val_nuq[0],
@ -1392,7 +1443,11 @@ void vp9_xform_quant_dc_nuq(MACROBLOCK *x, int plane, int block,
break;
#endif // CONFIG_TX64X64
case TX_32X32:
#if CONFIG_EXT_TX && CONFIG_WAVELETS
forw_tx32x32(x, plane, src_diff, diff_stride, coeff);
#else
vp9_fdct32x32_1(src_diff, coeff, diff_stride);
#endif
vp9_quantize_dc_32x32_nuq(coeff, x->skip_block,
p->quant[0], p->quant_shift[0], pd->dequant[0],
p->cumbins_nuq[0], pd->dequant_val_nuq[0],
@ -1584,7 +1639,11 @@ void vp9_xform_quant_dc_fp_nuq(MACROBLOCK *x, int plane, int block,
switch (tx_size) {
#if CONFIG_TX64X64
case TX_64X64:
#if CONFIG_EXT_TX && CONFIG_WAVELETS
forw_tx64x64(x, plane, src_diff, diff_stride, coeff);
#else
vp9_fdct64x64_1(src_diff, coeff, diff_stride);
#endif
vp9_quantize_dc_64x64_fp_nuq(coeff, x->skip_block,
p->quant_fp[0], pd->dequant[0],
p->cumbins_nuq[0], pd->dequant_val_nuq[0],
@ -1592,7 +1651,11 @@ void vp9_xform_quant_dc_fp_nuq(MACROBLOCK *x, int plane, int block,
break;
#endif // CONFIG_TX64X64
case TX_32X32:
#if CONFIG_EXT_TX && CONFIG_WAVELETS
forw_tx32x32(x, plane, src_diff, diff_stride, coeff);
#else
vp9_fdct32x32_1(src_diff, coeff, diff_stride);
#endif
vp9_quantize_dc_32x32_fp_nuq(coeff, x->skip_block,
p->quant_fp[0], pd->dequant[0],
p->cumbins_nuq[0], pd->dequant_val_nuq[0],
@ -1784,7 +1847,11 @@ void vp9_xform_quant_fp(MACROBLOCK *x, int plane, int block,
switch (tx_size) {
#if CONFIG_TX64X64
case TX_64X64:
#if CONFIG_EXT_TX && CONFIG_WAVELETS
forw_tx64x64(x, plane, src_diff, diff_stride, coeff);
#else
vp9_fdct64x64(src_diff, coeff, diff_stride);
#endif
vp9_quantize_fp_64x64(coeff, 4096, x->skip_block, p->zbin, p->round_fp,
p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, scan_order->scan,
@ -1792,7 +1859,11 @@ void vp9_xform_quant_fp(MACROBLOCK *x, int plane, int block,
break;
#endif // CONFIG_TX64X64
case TX_32X32:
#if CONFIG_EXT_TX && CONFIG_WAVELETS
forw_tx32x32(x, plane, src_diff, diff_stride, coeff);
#else
fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride);
#endif
vp9_quantize_fp_32x32(coeff, 1024, x->skip_block, p->zbin,
p->round_fp, p->quant_fp, p->quant_shift,
qcoeff, dqcoeff, pd->dequant, eob,
@ -1963,14 +2034,22 @@ void vp9_xform_quant_dc(MACROBLOCK *x, int plane, int block,
switch (tx_size) {
#if CONFIG_TX64X64
case TX_64X64:
#if CONFIG_EXT_TX && CONFIG_WAVELETS
forw_tx64x64(x, plane, src_diff, diff_stride, coeff);
#else
vp9_fdct64x64_1(src_diff, coeff, diff_stride);
#endif
vp9_quantize_dc_64x64(coeff, x->skip_block, p->round,
p->quant_fp[0], qcoeff, dqcoeff,
pd->dequant[0], eob);
break;
#endif // CONFIG_TX64X64
case TX_32X32:
#if CONFIG_EXT_TX && CONFIG_WAVELETS
forw_tx32x32(x, plane, src_diff, diff_stride, coeff);
#else
vp9_fdct32x32_1(src_diff, coeff, diff_stride);
#endif
vp9_quantize_dc_32x32(coeff, x->skip_block, p->round,
p->quant_fp[0], qcoeff, dqcoeff,
pd->dequant[0], eob);
@ -2154,7 +2233,11 @@ void vp9_xform_quant(MACROBLOCK *x, int plane, int block,
switch (tx_size) {
#if CONFIG_TX64X64
case TX_64X64:
#if CONFIG_EXT_TX && CONFIG_WAVELETS
forw_tx64x64(x, plane, src_diff, diff_stride, coeff);
#else
vp9_fdct64x64(src_diff, coeff, diff_stride);
#endif
vp9_quantize_b_64x64(coeff, 4096, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, scan_order->scan,
@ -2162,7 +2245,11 @@ void vp9_xform_quant(MACROBLOCK *x, int plane, int block,
break;
#endif // CONFIG_TX64X64
case TX_32X32:
#if CONFIG_EXT_TX && CONFIG_WAVELETS
forw_tx32x32(x, plane, src_diff, diff_stride, coeff);
#else
fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride);
#endif
vp9_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, scan_order->scan,
@ -2380,10 +2467,22 @@ static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize,
switch (tx_size) {
#if CONFIG_TX64X64
case TX_64X64:
#if CONFIG_EXT_TX && CONFIG_WAVELETS
tx_type = get_tx_type_large(plane, xd);
if (tx_type == WAVELET1_DCT_DCT)
vp9_idwtdct64x64_add(dqcoeff, dst, pd->dst.stride);
else
#endif // CONFIG_EXT_TX && CONFIG_WAVELETS
vp9_idct64x64_add(dqcoeff, dst, pd->dst.stride, p->eobs[block]);
break;
#endif
#endif // CONFIG_TX64X64
case TX_32X32:
#if CONFIG_EXT_TX && CONFIG_WAVELETS
tx_type = get_tx_type_large(plane, xd);
if (tx_type == WAVELET1_DCT_DCT)
vp9_idwtdct32x32_add(dqcoeff, dst, pd->dst.stride);
else
#endif // CONFIG_EXT_TX && CONFIG_WAVELETS
vp9_idct32x32_add(dqcoeff, dst, pd->dst.stride, p->eobs[block]);
break;
case TX_16X16:
@ -3194,7 +3293,7 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
break;
case TX_16X16:
tx_type = get_tx_type(pd->plane_type, xd);
scan_order = &vp9_scan_orders[TX_16X16][tx_type];
scan_order = &vp9_intra_scan_orders[TX_16X16][tx_type];
mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;
vp9_predict_intra_block(xd, block >> 4, bwl, TX_16X16, mode,
#if CONFIG_FILTERINTRA
@ -3238,7 +3337,7 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
break;
case TX_8X8:
tx_type = get_tx_type(pd->plane_type, xd);
scan_order = &vp9_scan_orders[TX_8X8][tx_type];
scan_order = &vp9_intra_scan_orders[TX_8X8][tx_type];
mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;
vp9_predict_intra_block(xd, block >> 2, bwl, TX_8X8, mode,
#if CONFIG_FILTERINTRA
@ -3282,7 +3381,7 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
break;
case TX_4X4:
tx_type = get_tx_type_4x4(pd->plane_type, xd, block);
scan_order = &vp9_scan_orders[TX_4X4][tx_type];
scan_order = &vp9_intra_scan_orders[TX_4X4][tx_type];
mode = plane == 0 ? get_y_mode(xd->mi[0].src_mi, block) : mbmi->uv_mode;
vp9_predict_intra_block(xd, block, bwl, TX_4X4, mode,
#if CONFIG_FILTERINTRA
@ -3433,7 +3532,7 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
break;
case TX_16X16:
tx_type = get_tx_type(pd->plane_type, xd);
scan_order = &vp9_scan_orders[TX_16X16][tx_type];
scan_order = &vp9_intra_scan_orders[TX_16X16][tx_type];
mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;
vp9_predict_intra_block(xd, block >> 4, bwl, TX_16X16, mode,
#if CONFIG_FILTERINTRA
@ -3473,7 +3572,7 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
break;
case TX_8X8:
tx_type = get_tx_type(pd->plane_type, xd);
scan_order = &vp9_scan_orders[TX_8X8][tx_type];
scan_order = &vp9_intra_scan_orders[TX_8X8][tx_type];
mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;
vp9_predict_intra_block(xd, block >> 2, bwl, TX_8X8, mode,
#if CONFIG_FILTERINTRA
@ -3513,7 +3612,7 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
break;
case TX_4X4:
tx_type = get_tx_type_4x4(pd->plane_type, xd, block);
scan_order = &vp9_scan_orders[TX_4X4][tx_type];
scan_order = &vp9_intra_scan_orders[TX_4X4][tx_type];
mode = plane == 0 ? get_y_mode(xd->mi[0].src_mi, block) : mbmi->uv_mode;
vp9_predict_intra_block(xd, block, bwl, TX_4X4, mode,
#if CONFIG_FILTERINTRA

View File

@ -519,7 +519,6 @@ void vp9_alloc_compressor_data(VP9_COMP *cpi) {
unsigned int tokens = get_token_alloc(cm->mb_rows, cm->mb_cols);
CHECK_MEM_ERROR(cm, cpi->tok, vpx_calloc(tokens, sizeof(*cpi->tok)));
}
vp9_setup_pc_tree(&cpi->common, cpi);
}

View File

@ -393,7 +393,11 @@ typedef struct VP9_COMP {
int y_mode_costs[INTRA_MODES][INTRA_MODES][INTRA_MODES];
int switchable_interp_costs[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS];
#if CONFIG_EXT_TX
#if CONFIG_WAVELETS
int ext_tx_costs[TX_SIZES][EXT_TX_TYPES];
#else
int ext_tx_costs[3][EXT_TX_TYPES];
#endif // CONFIG_WAVELETS
#endif // CONFIG_EXT_TX
#if CONFIG_COPY_MODE
int copy_mode_cost_l2[COPY_MODE_CONTEXTS][2];

View File

@ -85,6 +85,11 @@ static void fill_mode_costs(VP9_COMP *cpi) {
#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);
#if CONFIG_WAVELETS
for (; i < TX_SIZES; ++i)
vp9_cost_tokens(cpi->ext_tx_costs[i], fc->ext_tx_prob[i],
vp9_ext_tx_large_tree);
#endif // CONFIG_WAVELETS
#endif // CONFIG_EXT_TX
#if CONFIG_PALETTE
for (i = 0; i < PALETTE_MAX_SIZE - 1; ++i)

View File

@ -875,11 +875,24 @@ static void choose_largest_tx_size(VP9_COMP *cpi, MACROBLOCK *x,
mbmi->tx_size = MIN(max_tx_size, largest_tx_size);
#if CONFIG_EXT_TX
if (mbmi->ext_txfrm >= GET_EXT_TX_TYPES(mbmi->tx_size)) {
*rate = INT_MAX;
*distortion = INT64_MAX;
*sse = INT64_MAX;
*skip = 0;
return;
}
#endif // CONFIG_EXT_TX
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 &&
if (is_inter_block(mbmi) && bs >= BLOCK_8X8 &&
#if !CONFIG_WAVELETS
mbmi->tx_size <= TX_16X16 &&
#endif
!xd->lossless && *rate != INT_MAX)
*rate += cpi->ext_tx_costs[mbmi->tx_size][mbmi->ext_txfrm];
#endif
@ -921,14 +934,24 @@ static void choose_tx_size_from_rd(VP9_COMP *cpi, MACROBLOCK *x,
s1 = vp9_cost_bit(skip_prob, 1);
for (n = max_tx_size; n >= 0; n--) {
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 &&
if (mbmi->ext_txfrm >= GET_EXT_TX_TYPES(n)) {
r[n][0] = r[n][1] = INT_MAX;
d[n] = INT64_MAX;
} else {
#endif // CONFIG_EXT_TX
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) && bs >= BLOCK_8X8 &&
#if !CONFIG_WAVELETS
n <= TX_16X16 &&
#endif
!xd->lossless && r[n][0] != INT_MAX)
r[n][0] += cpi->ext_tx_costs[n][mbmi->ext_txfrm];
#endif
#endif // CONFIG_EXT_TX
r[n][1] = r[n][0];
if (r[n][0] < INT_MAX) {
for (m = 0; m <= n - (n == (int) max_tx_size); m++) {
@ -1172,7 +1195,7 @@ static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib,
} else {
int64_t unused;
const TX_TYPE tx_type = get_tx_type_4x4(PLANE_TYPE_Y, xd, block);
const scan_order *so = &vp9_scan_orders[TX_4X4][tx_type];
const scan_order *so = &vp9_intra_scan_orders[TX_4X4][tx_type];
vp9_highbd_fht4x4(src_diff, coeff, 8, tx_type);
vp9_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan);
ratey += cost_coeffs(x, 0, block, tempa + idx, templ + idy, TX_4X4,
@ -1305,7 +1328,7 @@ static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib,
} else {
int64_t unused;
const TX_TYPE tx_type = get_tx_type_4x4(PLANE_TYPE_Y, xd, block);
const scan_order *so = &vp9_scan_orders[TX_4X4][tx_type];
const scan_order *so = &vp9_intra_scan_orders[TX_4X4][tx_type];
vp9_fht4x4(src_diff, coeff, 8, tx_type);
vp9_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan);
ratey += cost_coeffs(x, 0, block, tempa + idx, templ + idy, TX_4X4,
@ -5429,7 +5452,7 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
int64_t best_rdcost_tx = INT64_MAX;
int best_ext_tx = NORM;
for (i = 0; i < EXT_TX_TYPES; i++) {
for (i = NORM; i < EXT_TX_TYPES; i++) {
mbmi->ext_txfrm = i;
super_block_yrd(cpi, x, &rate_y_tx, &distortion_y_tx, &dummy, psse,
bsize, txfm_cache, INT64_MAX);
@ -5443,12 +5466,13 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
best_rdcost_tx = rdcost_tx;
}
}
if (mbmi->tx_size >= TX_32X32)
mbmi->ext_txfrm = NORM;
else
mbmi->ext_txfrm = best_ext_tx;
#if !CONFIG_WAVELETS
if (mbmi->tx_size > TX_16X16)
assert(best_ext_tx == NORM);
#endif // !CONFIG_WAVELETS
mbmi->ext_txfrm = best_ext_tx;
}
#endif
#endif // CONFIG_EXT_TX
// Y cost and distortion
super_block_yrd(cpi, x, rate_y, &distortion_y, &skippable_y, psse,
@ -7236,9 +7260,11 @@ void vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
if (bestrd_tx == INT64_MAX)
continue;
#if !CONFIG_WAVELETS
if (best_tx_size < TX_32X32)
mbmi->ext_txfrm = best_tx_type;
else
#endif // !CONFIG_WAVELETS
mbmi->ext_txfrm = NORM;
mbmi->tx_size = best_tx_size;
vpx_memcpy(x->zcoeff_blk[mbmi->tx_size], tmp_zcoeff_blk,