Redo DST1 in the ext-tx experiment
Moved from nextgenv2 branch to test with other experiments. derflr: +1.629% Change-Id: Ie7c720053ed8b628177679c4351bb31b54716a71
This commit is contained in:
parent
897192be43
commit
4dbaf9a5ab
@ -519,19 +519,34 @@ static INLINE int supertx_enabled(const MB_MODE_INFO *mbmi) {
|
||||
|
||||
static TX_TYPE ext_tx_to_txtype[EXT_TX_TYPES] = {
|
||||
DCT_DCT,
|
||||
ADST_DCT,
|
||||
DCT_ADST,
|
||||
ADST_ADST,
|
||||
FLIPADST_DCT,
|
||||
DCT_FLIPADST,
|
||||
FLIPADST_FLIPADST,
|
||||
ADST_FLIPADST,
|
||||
FLIPADST_ADST,
|
||||
ADST_DCT,
|
||||
DCT_ADST,
|
||||
FLIPADST_DCT,
|
||||
DCT_FLIPADST,
|
||||
#if CONFIG_DST1
|
||||
DST_DST,
|
||||
#endif
|
||||
DST_DCT,
|
||||
DCT_DST,
|
||||
DST_ADST,
|
||||
ADST_DST,
|
||||
DST_FLIPADST,
|
||||
FLIPADST_DST,
|
||||
#endif // CONFIG_DST1
|
||||
};
|
||||
|
||||
#if CONFIG_DST1
|
||||
static INLINE int is_dst_used(TX_TYPE tx_type) {
|
||||
return (tx_type == DST_DST ||
|
||||
tx_type == DST_DCT || tx_type == DCT_DST ||
|
||||
tx_type == DST_ADST || tx_type == ADST_DST ||
|
||||
tx_type == DST_FLIPADST || tx_type == FLIPADST_DST);
|
||||
}
|
||||
#endif // CONFIG_DST1
|
||||
|
||||
#if CONFIG_WAVELETS
|
||||
static TX_TYPE ext_tx_to_txtype_large[EXT_TX_TYPES_LARGE] = {
|
||||
DCT_DCT,
|
||||
|
@ -467,30 +467,36 @@ static const struct tx_probs default_tx_probs = {
|
||||
const vp9_tree_index vp9_ext_tx_tree[TREE_SIZE(EXT_TX_TYPES)] = {
|
||||
-NORM, 2,
|
||||
-ALT9, 4,
|
||||
6, 12,
|
||||
6, 16,
|
||||
8, 10,
|
||||
-ALT10, -ALT11,
|
||||
12, 14,
|
||||
-ALT1, -ALT2,
|
||||
-ALT3, -ALT4,
|
||||
14, 16,
|
||||
-ALT5, -ALT6,
|
||||
-ALT7, -ALT8,
|
||||
-ALT4, -ALT5,
|
||||
18, 24,
|
||||
20, 22,
|
||||
-ALT12, -ALT13,
|
||||
-ALT14, -ALT15,
|
||||
26, 28,
|
||||
-ALT3, -ALT6,
|
||||
-ALT7, -ALT8
|
||||
};
|
||||
|
||||
#if CONFIG_WAVELETS
|
||||
static const vp9_prob default_ext_tx_prob[TX_SIZES][EXT_TX_TYPES - 1] = {
|
||||
{ 224, 28, 128, 128, 128, 128, 128, 128, 128 },
|
||||
{ 200, 28, 128, 128, 128, 128, 128, 128, 128 },
|
||||
{ 176, 28, 128, 128, 128, 128, 128, 128, 128 },
|
||||
{ 160, 28, 128, 128, 128, 128, 128, 128, 128 },
|
||||
{ 216, 20, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
|
||||
{ 192, 20, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
|
||||
{ 168, 20, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
|
||||
{ 160, 20, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
|
||||
#if CONFIG_TX64X64
|
||||
{ 160, 28, 128, 128, 128, 128, 128, 128, 128 },
|
||||
{ 160, 20, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
|
||||
#endif // CONFIG_TX64X64
|
||||
};
|
||||
#else
|
||||
static const vp9_prob default_ext_tx_prob[3][EXT_TX_TYPES - 1] = {
|
||||
{ 224, 28, 128, 128, 128, 128, 128, 128, 128 },
|
||||
{ 200, 28, 128, 128, 128, 128, 128, 128, 128 },
|
||||
{ 176, 28, 128, 128, 128, 128, 128, 128, 128 },
|
||||
{ 144, 12, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
|
||||
{ 128, 12, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
|
||||
{ 112, 12, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
|
||||
};
|
||||
#endif // CONFIG_WAVELETS
|
||||
|
||||
@ -524,7 +530,6 @@ static const vp9_prob default_ext_tx_prob[3][EXT_TX_TYPES - 1] = {
|
||||
{ 176, 128, 128, 128, 128, 128, 128, 128 },
|
||||
};
|
||||
#endif // CONFIG_WAVELETS
|
||||
|
||||
#endif // CONFIG_DST1
|
||||
|
||||
#if CONFIG_WAVELETS
|
||||
|
@ -125,7 +125,13 @@ typedef enum {
|
||||
ADST_FLIPADST = 7,
|
||||
FLIPADST_ADST = 8,
|
||||
#if CONFIG_DST1
|
||||
DST_DST,
|
||||
DST_DST = 9,
|
||||
DST_DCT = 10,
|
||||
DCT_DST = 11,
|
||||
DST_ADST = 12,
|
||||
ADST_DST = 13,
|
||||
DST_FLIPADST = 14,
|
||||
FLIPADST_DST = 15,
|
||||
#endif // CONFIG_DST1
|
||||
#if CONFIG_WAVELETS
|
||||
WAVELET1_DCT_DCT,
|
||||
@ -150,6 +156,12 @@ typedef enum {
|
||||
ALT8 = 8,
|
||||
#if CONFIG_DST1
|
||||
ALT9 = 9,
|
||||
ALT10 = 10,
|
||||
ALT11 = 11,
|
||||
ALT12 = 12,
|
||||
ALT13 = 13,
|
||||
ALT14 = 14,
|
||||
ALT15 = 15,
|
||||
#endif // CONFIG_DST1
|
||||
EXT_TX_TYPES
|
||||
} EXT_TX_TYPE;
|
||||
|
@ -15,139 +15,58 @@
|
||||
#include "vp9/common/vp9_blockd.h"
|
||||
#include "vp9/common/vp9_idct.h"
|
||||
|
||||
#if CONFIG_EXT_TX
|
||||
#if CONFIG_DST1
|
||||
// Integers to represent double.
|
||||
// The sine transform formula is: X{i} = Sum_{0<=j<N}( x_j *
|
||||
// sin((i+1)*(j+1)/(N+1) * PI) ) * sqrt(2/(N+1))
|
||||
// e.g. when N == 4, it is a series of sin(PI*i/5) and sqrt(2/5). Similar for
|
||||
// N = 8 and 16.
|
||||
// For integer calculation, we multiply 2^14.
|
||||
// sin_pi_5 = sin(PI/5)*pow(2,14)
|
||||
// sqrt_2_5 = sqrt(2/5)*pow(2,14)
|
||||
|
||||
// {sin(pi/5), sin(pi*2/5)}
|
||||
int sinvalue_lookup_table_4[2] = { 9630, 15582 };
|
||||
// {sin(pi/9), sin(pi*2/9), ..., sin(pi*4/9)}
|
||||
int sinvalue_lookup_table_8[4] = { 5604, 10531, 14189, 16135 };
|
||||
// {sin(pi/17), ...
|
||||
int sinvalue_lookup_table_16[] = { 3011, 5919, 8625, 11038,
|
||||
13075, 14666, 15759, 16314 };
|
||||
|
||||
void vp9_dst1d_type1(int64_t *in, int64_t *out, int N) {
|
||||
static INLINE void idst_core(const tran_low_t *input, tran_low_t *output,
|
||||
const int N, const int32_t *dst_lookup,
|
||||
int bd) {
|
||||
int i, j;
|
||||
(void) bd;
|
||||
for (i = 0; i < N; i++) {
|
||||
int64_t sum = 0;
|
||||
for (j = 0; j < N; j++) {
|
||||
int64_t sinvalue = 0;
|
||||
int idx = (i + 1) * (j + 1);
|
||||
int sign = 0;
|
||||
if (idx > N + 1) {
|
||||
sign = idx / (N + 1);
|
||||
sign = sign % 2 ? 1 : 0;
|
||||
sign = (idx / (N + 1)) & 1;
|
||||
idx %= (N + 1);
|
||||
}
|
||||
idx = idx > N + 1 - idx ? N + 1 - idx : idx;
|
||||
idx = MIN(idx, N + 1 - idx);
|
||||
if (idx == 0) continue;
|
||||
idx--;
|
||||
|
||||
if (N == 4)
|
||||
sinvalue = sinvalue_lookup_table_4[idx];
|
||||
else if (N == 8)
|
||||
sinvalue = sinvalue_lookup_table_8[idx];
|
||||
else if (N == 16)
|
||||
sinvalue = sinvalue_lookup_table_16[idx];
|
||||
else
|
||||
assert(0 && "Invalid transform size.");
|
||||
if (sign) sinvalue = -sinvalue;
|
||||
|
||||
sum += in[j] * sinvalue;
|
||||
sum += (int64_t)input[j] * dst_lookup[idx - 1] * (sign ? -1 : 1);
|
||||
}
|
||||
out[i] = sum;
|
||||
sum = ROUND_POWER_OF_TWO(sum, (2 * DCT_CONST_BITS));
|
||||
output[i] = WRAPLOW(sum, bd);
|
||||
}
|
||||
}
|
||||
|
||||
static void idstNxN_add(const tran_low_t *input, uint8_t *output,
|
||||
int stride, int N) {
|
||||
const int val_2_5 = 6554;
|
||||
const int val_2_9 = 3641;
|
||||
const int val_2_17 = 1928;
|
||||
int i, j;
|
||||
int64_t *in = (int64_t *) malloc (N * sizeof(int64_t));
|
||||
int64_t *inter = (int64_t *) malloc (N * sizeof(int64_t));
|
||||
int64_t *mat = (int64_t *) malloc (N * N * sizeof(int64_t));
|
||||
int64_t *mat2 = (int64_t *) malloc (N * N * sizeof(int64_t));
|
||||
int64_t val;
|
||||
|
||||
// 1d dst: transform columns
|
||||
for (j = 0; j < N; j++) {
|
||||
for (i = 0; i < N; i++) {
|
||||
in[i] = input[i * N + j];
|
||||
}
|
||||
vp9_dst1d_type1(in, inter, N);
|
||||
for (i = 0; i < N; i++) {
|
||||
mat2[i * N + j] = inter[i];
|
||||
}
|
||||
}
|
||||
|
||||
// transpose
|
||||
for (i = 0; i < N; i++)
|
||||
for (j = 0; j < N; j++)
|
||||
mat[i * N + j] = mat2[i + j * N];
|
||||
|
||||
switch (N) {
|
||||
case 4:
|
||||
val = val_2_5;
|
||||
break;
|
||||
case 8:
|
||||
val = val_2_9;
|
||||
break;
|
||||
case 16:
|
||||
val = val_2_17;
|
||||
break;
|
||||
default:
|
||||
assert(0 && "Invalid transform size.");
|
||||
return;
|
||||
}
|
||||
|
||||
// 1d dst: transform rows
|
||||
for (j = 0; j < N; j++) {
|
||||
for (i = 0; i < N; i++) {
|
||||
in[i] = mat[i * N + j];
|
||||
}
|
||||
vp9_dst1d_type1(in, inter, N);
|
||||
for (i = 0; i < N; i++) {
|
||||
int64_t tmp = inter[i];
|
||||
tmp = tmp >> DCT_CONST_BITS;
|
||||
tmp *= val;
|
||||
mat[i*N + j] = tmp >> (2 * DCT_CONST_BITS);
|
||||
}
|
||||
}
|
||||
for (i = 0; i < N; i++) {
|
||||
for (j = 0; j < N; j++) {
|
||||
tran_high_t tmp = mat[i * N + j];
|
||||
tmp = WRAPLOW(tmp, 8);
|
||||
output[i * stride + j] = clip_pixel_add(output[i * stride + j],
|
||||
ROUND_POWER_OF_TWO(tmp, 3));
|
||||
}
|
||||
}
|
||||
free(in);
|
||||
free(inter);
|
||||
free(mat);
|
||||
free(mat2);
|
||||
void idst4(const tran_low_t *input, tran_low_t *output) {
|
||||
idst_core(input, output, 4, dst_lookup4, 8);
|
||||
}
|
||||
|
||||
void vp9_idst4x4_add(const tran_low_t *input, uint8_t *dest, int stride) {
|
||||
idstNxN_add(input, dest, stride, 4);
|
||||
void idst8(const tran_low_t *input, tran_low_t *output) {
|
||||
idst_core(input, output, 8, dst_lookup8, 8);
|
||||
}
|
||||
|
||||
void vp9_idst8x8_add(const tran_low_t *input, uint8_t *dest, int stride) {
|
||||
idstNxN_add(input, dest, stride, 8);
|
||||
void idst16(const tran_low_t *input, tran_low_t *output) {
|
||||
idst_core(input, output, 16, dst_lookup16, 8);
|
||||
}
|
||||
|
||||
void vp9_idst16x16_add(const tran_low_t *input, uint8_t *dest, int stride) {
|
||||
idstNxN_add(input, dest, stride, 16);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
void highbd_idst4(const tran_low_t *input, tran_low_t *output, int bd) {
|
||||
idst_core(input, output, 4, dst_lookup4, bd);
|
||||
}
|
||||
|
||||
void highbd_idst8(const tran_low_t *input, tran_low_t *output, int bd) {
|
||||
idst_core(input, output, 8, dst_lookup8, bd);
|
||||
}
|
||||
|
||||
void highbd_idst16(const tran_low_t *input, tran_low_t *output, int bd) {
|
||||
idst_core(input, output, 16, dst_lookup16, bd);
|
||||
}
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_DST1
|
||||
#endif // CONFIG_EXT_TX
|
||||
|
||||
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,
|
||||
@ -412,10 +331,26 @@ static void iadst4(const tran_low_t *input, tran_low_t *output) {
|
||||
void vp9_iht4x4_16_add_c(const tran_low_t *input, uint8_t *dest, int stride,
|
||||
int tx_type) {
|
||||
const transform_2d IHT_4[] = {
|
||||
{ idct4, idct4 }, // DCT_DCT = 0
|
||||
{ iadst4, idct4 }, // ADST_DCT = 1
|
||||
{ idct4, iadst4 }, // DCT_ADST = 2
|
||||
{ iadst4, iadst4 } // ADST_ADST = 3
|
||||
{ idct4, idct4 }, // DCT_DCT = 0
|
||||
{ iadst4, idct4 }, // ADST_DCT = 1
|
||||
{ idct4, iadst4 }, // DCT_ADST = 2
|
||||
{ iadst4, iadst4 }, // ADST_ADST = 3
|
||||
#if CONFIG_EXT_TX
|
||||
{ iadst4, idct4 }, // FLIPADST_DCT = 4
|
||||
{ idct4, iadst4 }, // DCT_FLIPADST = 5
|
||||
{ iadst4, iadst4 }, // FLIPADST_FLIPADST = 6
|
||||
{ iadst4, iadst4 }, // ADST_FLIPADST = 7
|
||||
{ iadst4, iadst4 }, // FLIPADST_ADST = 8
|
||||
#if CONFIG_DST1
|
||||
{ idst4, idst4 }, // DST_DST = 9
|
||||
{ idst4, idct4 }, // DST_DCT = 10
|
||||
{ idct4, idst4 }, // DCT_DST = 11
|
||||
{ idst4, iadst4 }, // DST_ADST = 12
|
||||
{ iadst4, idst4 }, // ADST_DST = 13
|
||||
{ idst4, iadst4 }, // DST_FLIPADST = 14
|
||||
{ iadst4, idst4 }, // FLIPADST_DST = 15
|
||||
#endif // CONFIG_DST1
|
||||
#endif // CONFIG_EXT_TX
|
||||
};
|
||||
|
||||
int i, j;
|
||||
@ -523,7 +458,23 @@ static const transform_2d IHT_8[] = {
|
||||
{ idct8, idct8 }, // DCT_DCT = 0
|
||||
{ iadst8, idct8 }, // ADST_DCT = 1
|
||||
{ idct8, iadst8 }, // DCT_ADST = 2
|
||||
{ iadst8, iadst8 } // ADST_ADST = 3
|
||||
{ iadst8, iadst8 }, // ADST_ADST = 3
|
||||
#if CONFIG_EXT_TX
|
||||
{ iadst8, idct8 }, // FLIPADST_DCT = 4
|
||||
{ idct8, iadst8 }, // DCT_FLIPADST = 5
|
||||
{ iadst8, iadst8 }, // FLIPADST_FLIPADST = 6
|
||||
{ iadst8, iadst8 }, // ADST_FLIPADST = 7
|
||||
{ iadst8, iadst8 }, // FLIPADST_ADST = 8
|
||||
#if CONFIG_DST1
|
||||
{ idst8, idst8 }, // DST_DST = 9
|
||||
{ idst8, idct8 }, // DST_DCT = 10
|
||||
{ idct8, idst8 }, // DCT_DST = 11
|
||||
{ idst8, iadst8 }, // DST_ADST = 12
|
||||
{ iadst8, idst8 }, // ADST_DST = 13
|
||||
{ idst8, iadst8 }, // DST_FLIPADST = 14
|
||||
{ iadst8, idst8 }, // FLIPADST_DST = 15
|
||||
#endif // CONFIG_DST1
|
||||
#endif // CONFIG_EXT_TX
|
||||
};
|
||||
|
||||
#if CONFIG_EXT_TX
|
||||
@ -1041,7 +992,23 @@ static const transform_2d IHT_16[] = {
|
||||
{ idct16, idct16 }, // DCT_DCT = 0
|
||||
{ iadst16, idct16 }, // ADST_DCT = 1
|
||||
{ idct16, iadst16 }, // DCT_ADST = 2
|
||||
{ iadst16, iadst16 } // ADST_ADST = 3
|
||||
{ iadst16, iadst16 }, // ADST_ADST = 3
|
||||
#if CONFIG_EXT_TX
|
||||
{ iadst16, idct16 }, // FLIPADST_DCT = 4
|
||||
{ idct16, iadst16 }, // DCT_FLIPADST = 5
|
||||
{ iadst16, iadst16 }, // FLIPADST_FLIPADST = 6
|
||||
{ iadst16, iadst16 }, // ADST_FLIPADST = 7
|
||||
{ iadst16, iadst16 }, // FLIPADST_ADST = 8
|
||||
#if CONFIG_DST1
|
||||
{ idst16, idst16 }, // DST_DST = 9
|
||||
{ idst16, idct16 }, // DST_DCT = 10
|
||||
{ idct16, idst16 }, // DCT_DST = 11
|
||||
{ idst16, iadst16 }, // DST_ADST = 12
|
||||
{ iadst16, idst16 }, // ADST_DST = 13
|
||||
{ idst16, iadst16 }, // DST_FLIPADST = 14
|
||||
{ iadst16, idst16 }, // FLIPADST_DST = 15
|
||||
#endif // CONFIG_DST1
|
||||
#endif // CONFIG_EXT_TX
|
||||
};
|
||||
|
||||
void vp9_iht16x16_256_add_c(const tran_low_t *input, uint8_t *dest, int stride,
|
||||
@ -1666,8 +1633,8 @@ void vp9_iht4x4_add(TX_TYPE tx_type, const tran_low_t *input, uint8_t *dest,
|
||||
vp9_idct4x4_add(input, dest, stride, eob);
|
||||
#if CONFIG_EXT_TX
|
||||
#if CONFIG_DST1
|
||||
} else if (tx_type == DST_DST) {
|
||||
vp9_idst4x4_add(input, dest, stride);
|
||||
} else if (is_dst_used(tx_type)) {
|
||||
vp9_iht4x4_16_add_c(input, dest, stride, tx_type);
|
||||
#endif // CONFIG_DST1
|
||||
} else if (tx_type == FLIPADST_DCT) {
|
||||
flipud(dest, stride, 4);
|
||||
@ -1701,8 +1668,8 @@ void vp9_iht8x8_add(TX_TYPE tx_type, const tran_low_t *input, uint8_t *dest,
|
||||
vp9_idct8x8_add(input, dest, stride, eob);
|
||||
#if CONFIG_EXT_TX
|
||||
#if CONFIG_DST1
|
||||
} else if (tx_type == DST_DST) {
|
||||
vp9_idst8x8_add(input, dest, stride);
|
||||
} else if (is_dst_used(tx_type)) {
|
||||
vp9_iht8x8_64_add_c(input, dest, stride, tx_type);
|
||||
#endif // CONFIG_DST1
|
||||
} else if (tx_type == FLIPADST_DCT) {
|
||||
flipud(dest, stride, 8);
|
||||
@ -1736,8 +1703,8 @@ void vp9_iht16x16_add(TX_TYPE tx_type, const tran_low_t *input, uint8_t *dest,
|
||||
vp9_idct16x16_add(input, dest, stride, eob);
|
||||
#if CONFIG_EXT_TX
|
||||
#if CONFIG_DST1
|
||||
} else if (tx_type == DST_DST) {
|
||||
vp9_idst16x16_add(input, dest, stride);
|
||||
} else if (is_dst_used(tx_type)) {
|
||||
vp9_iht16x16_256_add_c(input, dest, stride, tx_type);
|
||||
#endif // CONFIG_DST1
|
||||
} else if (tx_type == FLIPADST_DCT) {
|
||||
flipud(dest, stride, 16);
|
||||
@ -2541,7 +2508,23 @@ void vp9_highbd_iht4x4_16_add_c(const tran_low_t *input, uint8_t *dest8,
|
||||
{ vp9_highbd_idct4, vp9_highbd_idct4 }, // DCT_DCT = 0
|
||||
{ highbd_iadst4, vp9_highbd_idct4 }, // ADST_DCT = 1
|
||||
{ vp9_highbd_idct4, highbd_iadst4 }, // DCT_ADST = 2
|
||||
{ highbd_iadst4, highbd_iadst4 } // ADST_ADST = 3
|
||||
{ highbd_iadst4, highbd_iadst4 }, // ADST_ADST = 3
|
||||
#if CONFIG_EXT_TX
|
||||
{ highbd_iadst4, vp9_highbd_idct4 }, // FLIPADST_DCT = 4
|
||||
{ vp9_highbd_idct4, highbd_iadst4 }, // DCT_FLIPADST = 5
|
||||
{ highbd_iadst4, highbd_iadst4 }, // FLIPADST_FLIPADST = 6
|
||||
{ highbd_iadst4, highbd_iadst4 }, // ADST_FLIPADST = 7
|
||||
{ highbd_iadst4, highbd_iadst4 }, // FLIPADST_ADST = 8
|
||||
#if CONFIG_DST1
|
||||
{ highbd_idst4, highbd_idst4 }, // DST_DST = 9
|
||||
{ highbd_idst4, vp9_highbd_idct4 }, // DST_DCT = 10
|
||||
{ vp9_highbd_idct4, highbd_idst4 }, // DCT_DST = 11
|
||||
{ highbd_idst4, highbd_iadst4 }, // DST_ADST = 12
|
||||
{ highbd_iadst4, highbd_idst4 }, // ADST_DST = 13
|
||||
{ highbd_idst4, highbd_iadst4 }, // DST_FLIPADST = 14
|
||||
{ highbd_iadst4, highbd_idst4 }, // FLIPADST_DST = 15
|
||||
#endif // CONFIG_DST1
|
||||
#endif // CONFIG_EXT_TX
|
||||
};
|
||||
uint16_t *dest = CONVERT_TO_SHORTPTR(dest8);
|
||||
|
||||
@ -2650,7 +2633,23 @@ static const highbd_transform_2d HIGH_IHT_8[] = {
|
||||
{ vp9_highbd_idct8, vp9_highbd_idct8 }, // DCT_DCT = 0
|
||||
{ highbd_iadst8, vp9_highbd_idct8 }, // ADST_DCT = 1
|
||||
{ vp9_highbd_idct8, highbd_iadst8 }, // DCT_ADST = 2
|
||||
{ highbd_iadst8, highbd_iadst8 } // ADST_ADST = 3
|
||||
{ highbd_iadst8, highbd_iadst8 }, // ADST_ADST = 3
|
||||
#if CONFIG_EXT_TX
|
||||
{ highbd_iadst8, vp9_highbd_idct8 }, // FLIPADST_DCT = 4
|
||||
{ vp9_highbd_idct8, highbd_iadst8 }, // DCT_FLIPADST = 5
|
||||
{ highbd_iadst8, highbd_iadst8 }, // FLIPADST_FLIPADST = 6
|
||||
{ highbd_iadst8, highbd_iadst8 }, // ADST_FLIPADST = 7
|
||||
{ highbd_iadst8, highbd_iadst8 }, // FLIPADST_ADST = 8
|
||||
#if CONFIG_DST1
|
||||
{ highbd_idst8, highbd_idst8 }, // DST_DST = 9
|
||||
{ highbd_idst8, vp9_highbd_idct8 }, // DST_DCT = 10
|
||||
{ vp9_highbd_idct8, highbd_idst8 }, // DCT_DST = 11
|
||||
{ highbd_idst8, highbd_iadst8 }, // DST_ADST = 12
|
||||
{ highbd_iadst8, highbd_idst8 }, // ADST_DST = 13
|
||||
{ highbd_idst8, highbd_iadst8 }, // DST_FLIPADST = 14
|
||||
{ highbd_iadst8, highbd_idst8 }, // FLIPADST_DST = 15
|
||||
#endif // CONFIG_DST1
|
||||
#endif // CONFIG_EXT_TX
|
||||
};
|
||||
|
||||
void vp9_highbd_iht8x8_64_add_c(const tran_low_t *input, uint8_t *dest8,
|
||||
@ -3076,7 +3075,23 @@ static const highbd_transform_2d HIGH_IHT_16[] = {
|
||||
{ vp9_highbd_idct16, vp9_highbd_idct16 }, // DCT_DCT = 0
|
||||
{ highbd_iadst16, vp9_highbd_idct16 }, // ADST_DCT = 1
|
||||
{ vp9_highbd_idct16, highbd_iadst16 }, // DCT_ADST = 2
|
||||
{ highbd_iadst16, highbd_iadst16 } // ADST_ADST = 3
|
||||
{ highbd_iadst16, highbd_iadst16 }, // ADST_ADST = 3
|
||||
#if CONFIG_EXT_TX
|
||||
{ highbd_iadst16, vp9_highbd_idct16 }, // FLIPADST_DCT = 4
|
||||
{ vp9_highbd_idct16, highbd_iadst16 }, // DCT_FLIPADST = 5
|
||||
{ highbd_iadst16, highbd_iadst16 }, // FLIPADST_FLIPADST = 6
|
||||
{ highbd_iadst16, highbd_iadst16 }, // ADST_FLIPADST = 7
|
||||
{ highbd_iadst16, highbd_iadst16 }, // FLIPADST_ADST = 8
|
||||
#if CONFIG_DST1
|
||||
{ highbd_idst16, highbd_idst16 }, // DST_DST = 9
|
||||
{ highbd_idst16, vp9_highbd_idct16 }, // DST_DCT = 10
|
||||
{ vp9_highbd_idct16, highbd_idst16 }, // DCT_DST = 11
|
||||
{ highbd_idst16, highbd_iadst16 }, // DST_ADST = 12
|
||||
{ highbd_iadst16, highbd_idst16 }, // ADST_DST = 13
|
||||
{ highbd_idst16, highbd_iadst16 }, // DST_FLIPADST = 14
|
||||
{ highbd_iadst16, highbd_idst16 }, // FLIPADST_DST = 15
|
||||
#endif // CONFIG_DST1
|
||||
#endif // CONFIG_EXT_TX
|
||||
};
|
||||
|
||||
void vp9_highbd_iht16x16_256_add_c(const tran_low_t *input, uint8_t *dest8,
|
||||
@ -3672,6 +3687,10 @@ void vp9_highbd_iht4x4_add(TX_TYPE tx_type, const tran_low_t *input,
|
||||
if (tx_type == DCT_DCT) {
|
||||
vp9_highbd_idct4x4_add(input, dest, stride, eob, bd);
|
||||
#if CONFIG_EXT_TX
|
||||
#if CONFIG_DST1
|
||||
} else if (is_dst_used(tx_type)) {
|
||||
vp9_highbd_iht4x4_16_add_c(input, dest, stride, tx_type, bd);
|
||||
#endif // CONFIG_DST1
|
||||
} else if (tx_type == FLIPADST_DCT) {
|
||||
flipud16(CONVERT_TO_SHORTPTR(dest), stride, 4);
|
||||
vp9_highbd_iht4x4_16_add(input, dest, stride, ADST_DCT, bd);
|
||||
@ -3703,6 +3722,10 @@ void vp9_highbd_iht8x8_add(TX_TYPE tx_type, const tran_low_t *input,
|
||||
if (tx_type == DCT_DCT) {
|
||||
vp9_highbd_idct8x8_add(input, dest, stride, eob, bd);
|
||||
#if CONFIG_EXT_TX
|
||||
#if CONFIG_DST1
|
||||
} else if (is_dst_used(tx_type)) {
|
||||
vp9_highbd_iht8x8_64_add_c(input, dest, stride, tx_type, bd);
|
||||
#endif // CONFIG_DST1
|
||||
} else if (tx_type == FLIPADST_DCT) {
|
||||
flipud16(CONVERT_TO_SHORTPTR(dest), stride, 8);
|
||||
vp9_highbd_iht8x8_64_add(input, dest, stride, ADST_DCT, bd);
|
||||
@ -3734,6 +3757,10 @@ void vp9_highbd_iht16x16_add(TX_TYPE tx_type, const tran_low_t *input,
|
||||
if (tx_type == DCT_DCT) {
|
||||
vp9_highbd_idct16x16_add(input, dest, stride, eob, bd);
|
||||
#if CONFIG_EXT_TX
|
||||
#if CONFIG_DST1
|
||||
} else if (is_dst_used(tx_type)) {
|
||||
vp9_highbd_iht16x16_256_add_c(input, dest, stride, tx_type, bd);
|
||||
#endif // CONFIG_DST1
|
||||
} else if (tx_type == FLIPADST_DCT) {
|
||||
flipud16(CONVERT_TO_SHORTPTR(dest), stride, 16);
|
||||
vp9_highbd_iht16x16_256_add(input, dest, stride, ADST_DCT, bd);
|
||||
@ -3964,10 +3991,26 @@ void vp9_idct8x8_1_c(const tran_low_t *input, int16_t *dest, int stride) {
|
||||
void vp9_iht4x4_16_c(const tran_low_t *input, int16_t *dest, int stride,
|
||||
int tx_type) {
|
||||
const transform_2d IHT_4[] = {
|
||||
{ idct4, idct4 }, // DCT_DCT = 0
|
||||
{ iadst4, idct4 }, // ADST_DCT = 1
|
||||
{ idct4, iadst4 }, // DCT_ADST = 2
|
||||
{ iadst4, iadst4 } // ADST_ADST = 3
|
||||
{ idct4, idct4 }, // DCT_DCT = 0
|
||||
{ iadst4, idct4 }, // ADST_DCT = 1
|
||||
{ idct4, iadst4 }, // DCT_ADST = 2
|
||||
{ iadst4, iadst4 }, // ADST_ADST = 3
|
||||
#if CONFIG_EXT_TX
|
||||
{ iadst4, idct4 }, // FLIPADST_DCT = 4
|
||||
{ idct4, iadst4 }, // DCT_FLIPADST = 5
|
||||
{ iadst4, iadst4 }, // FLIPADST_FLIPADST = 6
|
||||
{ iadst4, iadst4 }, // ADST_FLIPADST = 7
|
||||
{ iadst4, iadst4 }, // FLIPADST_ADST = 8
|
||||
#if CONFIG_DST1
|
||||
{ idst4, idst4 }, // DST_DST = 9
|
||||
{ idst4, idct4 }, // DST_DCT = 10
|
||||
{ idct4, idst4 }, // DCT_DST = 11
|
||||
{ idst4, iadst4 }, // DST_ADST = 12
|
||||
{ iadst4, idst4 }, // ADST_DST = 13
|
||||
{ idst4, iadst4 }, // DST_FLIPADST = 14
|
||||
{ iadst4, idst4 }, // FLIPADST_DST = 15
|
||||
#endif // CONFIG_DST1
|
||||
#endif // CONFIG_EXT_TX
|
||||
};
|
||||
|
||||
int i, j;
|
||||
@ -4279,6 +4322,10 @@ void vp9_iht4x4(TX_TYPE tx_type, const tran_low_t *input, int16_t *dest,
|
||||
if (tx_type == DCT_DCT) {
|
||||
vp9_idct4x4(input, dest, stride, eob);
|
||||
#if CONFIG_EXT_TX
|
||||
#if CONFIG_DST1
|
||||
} else if (is_dst_used(tx_type)) {
|
||||
vp9_iht4x4_16_c(input, dest, stride, tx_type);
|
||||
#endif // CONFIG_DST1
|
||||
} else if (tx_type == FLIPADST_DCT) {
|
||||
flipud(dest, stride, 4);
|
||||
vp9_iht4x4_16(input, dest, stride, ADST_DCT);
|
||||
@ -4310,6 +4357,10 @@ void vp9_iht8x8(TX_TYPE tx_type, const tran_low_t *input, int16_t *dest,
|
||||
if (tx_type == DCT_DCT) {
|
||||
vp9_idct8x8(input, dest, stride, eob);
|
||||
#if CONFIG_EXT_TX
|
||||
#if CONFIG_DST1
|
||||
} else if (is_dst_used(tx_type)) {
|
||||
vp9_iht8x8_64_c(input, dest, stride, tx_type);
|
||||
#endif // CONFIG_DST1
|
||||
} else if (tx_type == FLIPADST_DCT) {
|
||||
flipud(dest, stride, 8);
|
||||
vp9_iht8x8_64(input, dest, stride, ADST_DCT);
|
||||
@ -4341,6 +4392,10 @@ void vp9_iht16x16(TX_TYPE tx_type, const tran_low_t *input, int16_t *dest,
|
||||
if (tx_type == DCT_DCT) {
|
||||
vp9_idct16x16(input, dest, stride, eob);
|
||||
#if CONFIG_EXT_TX
|
||||
#if CONFIG_DST1
|
||||
} else if (is_dst_used(tx_type)) {
|
||||
vp9_iht16x16_256_c(input, dest, stride, tx_type);
|
||||
#endif // CONFIG_DST1
|
||||
} else if (tx_type == FLIPADST_DCT) {
|
||||
flipud(dest, stride, 16);
|
||||
vp9_iht16x16_256(input, dest, stride, ADST_DCT);
|
||||
|
@ -82,6 +82,29 @@ static const tran_high_t sinpi_2_9 = 9929;
|
||||
static const tran_high_t sinpi_3_9 = 13377;
|
||||
static const tran_high_t sinpi_4_9 = 15212;
|
||||
|
||||
#if CONFIG_EXT_TX
|
||||
#if CONFIG_DST1
|
||||
static const int32_t dst_lookup4[] = {
|
||||
// {sin(pi/5), sin(pi*2/5)} * sqrt(2/5) * sqrt(2)
|
||||
// at precision of 2 * DCT_CONST_BITS bits
|
||||
141124871, 228344838,
|
||||
};
|
||||
|
||||
static const int32_t dst_lookup8[] = {
|
||||
// {sin(pi/9), sin(pi*2/9), ..., sin(pi*4/9)} * sqrt(2/9) * 2
|
||||
// at precision of 2 * DCT_CONST_BITS bits
|
||||
86559612, 162678858, 219176632, 249238470
|
||||
};
|
||||
|
||||
static const int32_t dst_lookup16[] = {
|
||||
// {sin(pi/17), sin(pi*2/17, ..., sin(pi*8/17)} * sqrt(2/17) * 2 * sqrt(2)
|
||||
// at precision of 2 * DCT_CONST_BITS bits
|
||||
47852167, 94074787, 137093803, 175444254,
|
||||
207820161, 233119001, 250479254, 259309736
|
||||
};
|
||||
#endif // CONFIG_DST1
|
||||
#endif // CONFIG_EXT_TX
|
||||
|
||||
static INLINE tran_low_t check_range(tran_high_t input) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
// For valid highbitdepth VP9 streams, intermediate stage coefficients will
|
||||
|
@ -4678,6 +4678,12 @@ const scan_order vp9_inter_scan_orders[TX_SIZES][TOTAL_TX_TYPES] = {
|
||||
{default_scan_4x4, vp9_default_iscan_4x4, default_scan_4x4_neighbors},
|
||||
#if CONFIG_DST1
|
||||
{default_scan_4x4, vp9_default_iscan_4x4, default_scan_4x4_neighbors},
|
||||
{default_scan_4x4, vp9_default_iscan_4x4, default_scan_4x4_neighbors},
|
||||
{default_scan_4x4, vp9_default_iscan_4x4, default_scan_4x4_neighbors},
|
||||
{default_scan_4x4, vp9_default_iscan_4x4, default_scan_4x4_neighbors},
|
||||
{default_scan_4x4, vp9_default_iscan_4x4, default_scan_4x4_neighbors},
|
||||
{default_scan_4x4, vp9_default_iscan_4x4, default_scan_4x4_neighbors},
|
||||
{default_scan_4x4, vp9_default_iscan_4x4, default_scan_4x4_neighbors},
|
||||
#endif // CONFIG_DST1
|
||||
#if CONFIG_WAVELETS
|
||||
{default_scan_4x4, vp9_default_iscan_4x4, default_scan_4x4_neighbors},
|
||||
@ -4694,6 +4700,12 @@ const scan_order vp9_inter_scan_orders[TX_SIZES][TOTAL_TX_TYPES] = {
|
||||
{default_scan_8x8, vp9_default_iscan_8x8, default_scan_8x8_neighbors},
|
||||
#if CONFIG_DST1
|
||||
{default_scan_8x8, vp9_default_iscan_8x8, default_scan_8x8_neighbors},
|
||||
{default_scan_8x8, vp9_default_iscan_8x8, default_scan_8x8_neighbors},
|
||||
{default_scan_8x8, vp9_default_iscan_8x8, default_scan_8x8_neighbors},
|
||||
{default_scan_8x8, vp9_default_iscan_8x8, default_scan_8x8_neighbors},
|
||||
{default_scan_8x8, vp9_default_iscan_8x8, default_scan_8x8_neighbors},
|
||||
{default_scan_8x8, vp9_default_iscan_8x8, default_scan_8x8_neighbors},
|
||||
{default_scan_8x8, vp9_default_iscan_8x8, default_scan_8x8_neighbors},
|
||||
#endif // CONFIG_DST1
|
||||
#if CONFIG_WAVELETS
|
||||
{default_scan_8x8, vp9_default_iscan_8x8, default_scan_8x8_neighbors}
|
||||
@ -4710,6 +4722,12 @@ const scan_order vp9_inter_scan_orders[TX_SIZES][TOTAL_TX_TYPES] = {
|
||||
{default_scan_16x16, vp9_default_iscan_16x16, default_scan_16x16_neighbors},
|
||||
#if CONFIG_DST1
|
||||
{default_scan_16x16, vp9_default_iscan_16x16, default_scan_16x16_neighbors},
|
||||
{default_scan_16x16, vp9_default_iscan_16x16, default_scan_16x16_neighbors},
|
||||
{default_scan_16x16, vp9_default_iscan_16x16, default_scan_16x16_neighbors},
|
||||
{default_scan_16x16, vp9_default_iscan_16x16, default_scan_16x16_neighbors},
|
||||
{default_scan_16x16, vp9_default_iscan_16x16, default_scan_16x16_neighbors},
|
||||
{default_scan_16x16, vp9_default_iscan_16x16, default_scan_16x16_neighbors},
|
||||
{default_scan_16x16, vp9_default_iscan_16x16, default_scan_16x16_neighbors},
|
||||
#endif // CONFIG_DST1
|
||||
#if CONFIG_WAVELETS
|
||||
{default_scan_16x16, vp9_default_iscan_16x16, default_scan_16x16_neighbors}
|
||||
@ -4726,6 +4744,12 @@ const scan_order vp9_inter_scan_orders[TX_SIZES][TOTAL_TX_TYPES] = {
|
||||
{default_scan_32x32, vp9_default_iscan_32x32, default_scan_32x32_neighbors},
|
||||
#if CONFIG_DST1
|
||||
{default_scan_32x32, vp9_default_iscan_32x32, default_scan_32x32_neighbors},
|
||||
{default_scan_32x32, vp9_default_iscan_32x32, default_scan_32x32_neighbors},
|
||||
{default_scan_32x32, vp9_default_iscan_32x32, default_scan_32x32_neighbors},
|
||||
{default_scan_32x32, vp9_default_iscan_32x32, default_scan_32x32_neighbors},
|
||||
{default_scan_32x32, vp9_default_iscan_32x32, default_scan_32x32_neighbors},
|
||||
{default_scan_32x32, vp9_default_iscan_32x32, default_scan_32x32_neighbors},
|
||||
{default_scan_32x32, vp9_default_iscan_32x32, default_scan_32x32_neighbors},
|
||||
#endif // CONFIG_DST1
|
||||
#if CONFIG_WAVELETS
|
||||
{dwtdct_scan_32x32, vp9_dwtdct_iscan_32x32, dwtdct_scan_32x32_neighbors},
|
||||
@ -4743,6 +4767,12 @@ const scan_order vp9_inter_scan_orders[TX_SIZES][TOTAL_TX_TYPES] = {
|
||||
{default_scan_64x64, vp9_default_iscan_64x64, default_scan_64x64_neighbors},
|
||||
#if CONFIG_DST1
|
||||
{default_scan_64x64, vp9_default_iscan_64x64, default_scan_64x64_neighbors},
|
||||
{default_scan_64x64, vp9_default_iscan_64x64, default_scan_64x64_neighbors},
|
||||
{default_scan_64x64, vp9_default_iscan_64x64, default_scan_64x64_neighbors},
|
||||
{default_scan_64x64, vp9_default_iscan_64x64, default_scan_64x64_neighbors},
|
||||
{default_scan_64x64, vp9_default_iscan_64x64, default_scan_64x64_neighbors},
|
||||
{default_scan_64x64, vp9_default_iscan_64x64, default_scan_64x64_neighbors},
|
||||
{default_scan_64x64, vp9_default_iscan_64x64, default_scan_64x64_neighbors},
|
||||
#endif // CONFIG_DST1
|
||||
#if CONFIG_WAVELETS
|
||||
{dwtdct_scan_64x64, vp9_dwtdct_iscan_64x64, dwtdct_scan_64x64_neighbors},
|
||||
|
@ -27,82 +27,42 @@ static INLINE tran_high_t fdct_round_shift(tran_high_t input) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
#if CONFIG_EXT_TX
|
||||
#if CONFIG_DST1
|
||||
static void fdstNxN(const int16_t *input, tran_low_t *output,
|
||||
int stride, int N) {
|
||||
const int val_2_5 = 6554;
|
||||
const int val_2_9 = 3641;
|
||||
const int val_2_17 = 1928;
|
||||
static INLINE void vp9_fdst_core(const tran_low_t *input, tran_low_t *output,
|
||||
const int N, const int32_t* dst_lookup) {
|
||||
int i, j;
|
||||
int64_t *in = (int64_t *) malloc (N * sizeof(int64_t));
|
||||
int64_t *inter = (int64_t *) malloc (N * sizeof(int64_t));
|
||||
int64_t *mat = (int64_t *) malloc (N * N * sizeof(int64_t));
|
||||
int64_t *mat2 = (int64_t *) malloc (N * N * sizeof(int64_t));
|
||||
int64_t val;
|
||||
|
||||
// 1d dst: transform columns
|
||||
for (j = 0; j < N; j++) {
|
||||
for (i = 0; i < N; i++) {
|
||||
in[i] = input[i * stride + j];
|
||||
}
|
||||
vp9_dst1d_type1(in, inter, N);
|
||||
for (i = 0; i < N; i++)
|
||||
mat2[i * N + j] = inter[i];
|
||||
}
|
||||
// transpose
|
||||
for (i = 0; i < N; i++)
|
||||
for (j = 0; j < N; j++)
|
||||
mat[i*N + j] = mat2[i + j*N];
|
||||
|
||||
switch (N) {
|
||||
case 4:
|
||||
val = val_2_5;
|
||||
break;
|
||||
case 8:
|
||||
val = val_2_9;
|
||||
break;
|
||||
case 16:
|
||||
val = val_2_17;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
// 1d dst: transform rows
|
||||
for (j = 0; j < N; j++) {
|
||||
for (i = 0; i < N; i++) {
|
||||
in[i] = mat[i * N + j];
|
||||
}
|
||||
vp9_dst1d_type1(in, inter, N);
|
||||
for (i = 0; i < N; i++) {
|
||||
int64_t tmp = inter[i];
|
||||
tmp = tmp >> DCT_CONST_BITS;
|
||||
tmp *= val;
|
||||
mat[i * N + j] = tmp >> (2 * DCT_CONST_BITS - 3);
|
||||
}
|
||||
}
|
||||
for (i = 0; i < N; i++) {
|
||||
int64_t sum = 0;
|
||||
for (j = 0; j < N; j++) {
|
||||
output[i * N + j] = WRAPLOW(mat[i * N + j], 8);
|
||||
int idx = (i + 1) * (j + 1);
|
||||
int sign = 0;
|
||||
if (idx > N + 1) {
|
||||
sign = (idx / (N + 1)) & 1;
|
||||
idx %= (N + 1);
|
||||
}
|
||||
idx = MIN(idx, N + 1 - idx);
|
||||
if (idx == 0) continue;
|
||||
idx--;
|
||||
sum += (int64_t)input[j] * dst_lookup[idx] * (sign ? -1 : 1);
|
||||
}
|
||||
output[i] = ROUND_POWER_OF_TWO(sum, (2 * DCT_CONST_BITS));
|
||||
}
|
||||
free(in);
|
||||
free(inter);
|
||||
free(mat);
|
||||
free(mat2);
|
||||
}
|
||||
|
||||
void vp9_fdst4x4(const int16_t *input, tran_low_t *output, int stride) {
|
||||
fdstNxN(input, output, stride, 4);
|
||||
void vp9_fdst4(const tran_low_t *input, tran_low_t *output) {
|
||||
vp9_fdst_core(input, output, 4, dst_lookup4);
|
||||
}
|
||||
|
||||
void vp9_fdst8x8(const int16_t *input, tran_low_t *output, int stride) {
|
||||
fdstNxN(input, output, stride, 8);
|
||||
void vp9_fdst8(const tran_low_t *input, tran_low_t *output) {
|
||||
vp9_fdst_core(input, output, 8, dst_lookup8);
|
||||
}
|
||||
|
||||
void vp9_fdst16x16(const int16_t *input, tran_low_t *output, int stride) {
|
||||
fdstNxN(input, output, stride, 16);
|
||||
void vp9_fdst16(const tran_low_t *input, tran_low_t *output) {
|
||||
vp9_fdst_core(input, output, 16, dst_lookup16);
|
||||
}
|
||||
#endif // CONFIG_DST1
|
||||
#endif // CONFIG_EXT_TX
|
||||
|
||||
void vp9_fdct4(const tran_low_t *input, tran_low_t *output) {
|
||||
tran_high_t step[4];
|
||||
|
@ -33,31 +33,81 @@ void vp9_fdct16(const tran_low_t in[16], tran_low_t out[16]);
|
||||
void vp9_fadst16(const tran_low_t *input, tran_low_t *output);
|
||||
void vp9_fdct32(const tran_high_t *input, tran_high_t *output, int round);
|
||||
|
||||
#if CONFIG_EXT_TX
|
||||
#if CONFIG_DST1
|
||||
void vp9_fdst4x4(const int16_t *input, tran_low_t *output, int stride);
|
||||
void vp9_fdst8x8(const int16_t *input, tran_low_t *output, int stride);
|
||||
void vp9_fdst16x16(const int16_t *input, tran_low_t *output, int stride);
|
||||
void vp9_fdst4(const tran_low_t *input, tran_low_t *output);
|
||||
void vp9_fdst8(const tran_low_t *input, tran_low_t *output);
|
||||
void vp9_fdst16(const tran_low_t *input, tran_low_t *output);
|
||||
#endif // CONFIG_DST1
|
||||
#endif // CONFIG_EXT_TX
|
||||
|
||||
static const transform_2d FHT_4[] = {
|
||||
{ vp9_fdct4, vp9_fdct4 }, // DCT_DCT = 0
|
||||
{ vp9_fadst4, vp9_fdct4 }, // ADST_DCT = 1
|
||||
{ vp9_fdct4, vp9_fadst4 }, // DCT_ADST = 2
|
||||
{ vp9_fadst4, vp9_fadst4 } // ADST_ADST = 3
|
||||
{ vp9_fadst4, vp9_fadst4 }, // ADST_ADST = 3
|
||||
#if CONFIG_EXT_TX
|
||||
{ vp9_fadst4, vp9_fdct4 }, // FLIPADST_DCT = 4
|
||||
{ vp9_fdct4, vp9_fadst4 }, // DCT_FLIPADST = 5
|
||||
{ vp9_fadst4, vp9_fadst4 }, // FLIPADST_FLIPADST = 6
|
||||
{ vp9_fadst4, vp9_fadst4 }, // ADST_FLIPADST = 7
|
||||
{ vp9_fadst4, vp9_fadst4 }, // FLIPADST_ADST = 8
|
||||
#if CONFIG_DST1
|
||||
{ vp9_fdst4, vp9_fdst4 }, // DST_DST = 9
|
||||
{ vp9_fdst4, vp9_fdct4 }, // DST_DCT = 10
|
||||
{ vp9_fdct4, vp9_fdst4 }, // DCT_DST = 11
|
||||
{ vp9_fdst4, vp9_fadst4 }, // DST_ADST = 12
|
||||
{ vp9_fadst4, vp9_fdst4 }, // ADST_DST = 13
|
||||
{ vp9_fdst4, vp9_fadst4 }, // DST_FLIPADST = 14
|
||||
{ vp9_fadst4, vp9_fdst4 }, // FLIPADST_DST = 15
|
||||
#endif // CONFIG_DST1
|
||||
#endif // CONFIG_EXT_TX
|
||||
};
|
||||
|
||||
static const transform_2d FHT_8[] = {
|
||||
{ vp9_fdct8, vp9_fdct8 }, // DCT_DCT = 0
|
||||
{ vp9_fadst8, vp9_fdct8 }, // ADST_DCT = 1
|
||||
{ vp9_fdct8, vp9_fadst8 }, // DCT_ADST = 2
|
||||
{ vp9_fadst8, vp9_fadst8 } // ADST_ADST = 3
|
||||
{ vp9_fadst8, vp9_fadst8 }, // ADST_ADST = 3
|
||||
#if CONFIG_EXT_TX
|
||||
{ vp9_fadst8, vp9_fdct8 }, // FLIPADST_DCT = 4
|
||||
{ vp9_fdct8, vp9_fadst8 }, // DCT_FLIPADST = 5
|
||||
{ vp9_fadst8, vp9_fadst8 }, // FLIPADST_FLIPADST = 6
|
||||
{ vp9_fadst8, vp9_fadst8 }, // ADST_FLIPADST = 7
|
||||
{ vp9_fadst8, vp9_fadst8 }, // FLIPADST_ADST = 8
|
||||
#if CONFIG_DST1
|
||||
{ vp9_fdst8, vp9_fdst8 }, // DST_DST = 9
|
||||
{ vp9_fdst8, vp9_fdct8 }, // DST_DCT = 10
|
||||
{ vp9_fdct8, vp9_fdst8 }, // DCT_DST = 11
|
||||
{ vp9_fdst8, vp9_fadst8 }, // DST_ADST = 12
|
||||
{ vp9_fadst8, vp9_fdst8 }, // ADST_DST = 13
|
||||
{ vp9_fdst8, vp9_fadst8 }, // DST_FLIPADST = 14
|
||||
{ vp9_fadst8, vp9_fdst8 }, // FLIPADST_DST = 15
|
||||
#endif // CONFIG_DST1
|
||||
#endif // CONFIG_EXT_TX
|
||||
};
|
||||
|
||||
static const transform_2d FHT_16[] = {
|
||||
{ vp9_fdct16, vp9_fdct16 }, // DCT_DCT = 0
|
||||
{ vp9_fadst16, vp9_fdct16 }, // ADST_DCT = 1
|
||||
{ vp9_fdct16, vp9_fadst16 }, // DCT_ADST = 2
|
||||
{ vp9_fadst16, vp9_fadst16 } // ADST_ADST = 3
|
||||
{ vp9_fadst16, vp9_fadst16 }, // ADST_ADST = 3
|
||||
#if CONFIG_EXT_TX
|
||||
{ vp9_fadst16, vp9_fdct16 }, // FLIPADST_DCT = 4
|
||||
{ vp9_fdct16, vp9_fadst16 }, // DCT_FLIPADST = 5
|
||||
{ vp9_fadst16, vp9_fadst16 }, // FLIPADST_FLIPADST = 6
|
||||
{ vp9_fadst16, vp9_fadst16 }, // ADST_FLIPADST = 7
|
||||
{ vp9_fadst16, vp9_fadst16 }, // FLIPADST_ADST = 8
|
||||
#if CONFIG_DST1
|
||||
{ vp9_fdst16, vp9_fdst16 }, // DST_DST = 9
|
||||
{ vp9_fdst16, vp9_fdct16 }, // DST_DCT = 10
|
||||
{ vp9_fdct16, vp9_fdst16 }, // DCT_DST = 11
|
||||
{ vp9_fdst16, vp9_fadst16 }, // DST_ADST = 12
|
||||
{ vp9_fadst16, vp9_fdst16 }, // ADST_DST = 13
|
||||
{ vp9_fdst16, vp9_fadst16 }, // DST_FLIPADST = 14
|
||||
{ vp9_fadst16, vp9_fdst16 }, // FLIPADST_DST = 15
|
||||
#endif // CONFIG_DST1
|
||||
#endif // CONFIG_EXT_TX
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -654,8 +654,8 @@ static void forw_tx16x16(MACROBLOCK *x, int plane,
|
||||
if (tx_type == DCT_DCT) {
|
||||
vp9_fdct16x16(src_diff, coeff, diff_stride);
|
||||
#if CONFIG_DST1
|
||||
} else if (tx_type == DST_DST) {
|
||||
vp9_fdst16x16(src_diff, coeff, diff_stride);
|
||||
} else if (is_dst_used(tx_type)) {
|
||||
vp9_fht16x16_c(src_diff, coeff, diff_stride, tx_type);
|
||||
#endif // CONFIG_DST1
|
||||
} else if (tx_type == FLIPADST_DCT) {
|
||||
copy_flipud(src_diff, diff_stride, 16, src_diff2, 16);
|
||||
@ -686,8 +686,8 @@ static void forw_tx8x8(MACROBLOCK *x, int plane,
|
||||
if (tx_type == DCT_DCT) {
|
||||
vp9_fdct8x8(src_diff, coeff, diff_stride);
|
||||
#if CONFIG_DST1
|
||||
} else if (tx_type == DST_DST) {
|
||||
vp9_fdst8x8(src_diff, coeff, diff_stride);
|
||||
} else if (is_dst_used(tx_type)) {
|
||||
vp9_fht8x8_c(src_diff, coeff, diff_stride, tx_type);
|
||||
#endif // CONFIG_DST1
|
||||
} else if (tx_type == FLIPADST_DCT) {
|
||||
copy_flipud(src_diff, diff_stride, 8, src_diff2, 8);
|
||||
@ -718,8 +718,8 @@ static void forw_tx4x4(MACROBLOCK *x, int plane, int block,
|
||||
if (tx_type == DCT_DCT) {
|
||||
x->fwd_txm4x4(src_diff, coeff, diff_stride);
|
||||
#if CONFIG_DST1
|
||||
} else if (tx_type == DST_DST) {
|
||||
vp9_fdst4x4(src_diff, coeff, diff_stride);
|
||||
} else if (is_dst_used(tx_type)) {
|
||||
vp9_fht4x4_c(src_diff, coeff, diff_stride, tx_type);
|
||||
#endif // CONFIG_DST1
|
||||
} else if (tx_type == FLIPADST_DCT) {
|
||||
copy_flipud(src_diff, diff_stride, 4, src_diff2, 4);
|
||||
@ -750,6 +750,10 @@ static void highbd_forw_tx16x16(MACROBLOCK *x, int plane,
|
||||
TX_TYPE tx_type = get_tx_type(plane, xd);
|
||||
if (tx_type == DCT_DCT) {
|
||||
vp9_highbd_fdct16x16(src_diff, coeff, diff_stride);
|
||||
#if CONFIG_DST1
|
||||
} else if (is_dst_used(tx_type)) {
|
||||
vp9_highbd_fht16x16_c(src_diff, coeff, diff_stride, tx_type);
|
||||
#endif // CONFIG_DST1
|
||||
} 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);
|
||||
@ -778,6 +782,10 @@ static void highbd_forw_tx8x8(MACROBLOCK *x, int plane,
|
||||
TX_TYPE tx_type = get_tx_type(plane, xd);
|
||||
if (tx_type == DCT_DCT) {
|
||||
vp9_highbd_fdct8x8(src_diff, coeff, diff_stride);
|
||||
#if CONFIG_DST1
|
||||
} else if (is_dst_used(tx_type)) {
|
||||
vp9_highbd_fht8x8_c(src_diff, coeff, diff_stride, tx_type);
|
||||
#endif // CONFIG_DST1
|
||||
} 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);
|
||||
@ -806,6 +814,10 @@ static void highbd_forw_tx4x4(MACROBLOCK *x, int plane, int block,
|
||||
TX_TYPE tx_type = get_tx_type_4x4(plane, xd, block);
|
||||
if (tx_type == DCT_DCT) {
|
||||
x->fwd_txm4x4(src_diff, coeff, diff_stride);
|
||||
#if CONFIG_DST1
|
||||
} else if (is_dst_used(tx_type)) {
|
||||
vp9_highbd_fht4x4_c(src_diff, coeff, diff_stride, tx_type);
|
||||
#endif // CONFIG_DST1
|
||||
} 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);
|
||||
|
@ -75,7 +75,7 @@
|
||||
#define MIN_EARLY_TERM_INDEX 3
|
||||
|
||||
#if CONFIG_EXT_TX
|
||||
const double ext_tx_th = 0.99;
|
||||
const double ext_tx_th = 0.98;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
@ -1217,6 +1217,7 @@ static void choose_tx_size_from_rd(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
} else if (s[n]) {
|
||||
if (is_inter_block(mbmi)) {
|
||||
rd[n][0] = rd[n][1] = RDCOST(x->rdmult, x->rddiv, s1, sse[n]);
|
||||
r[n][1] -= r_tx_size;
|
||||
} else {
|
||||
#if CONFIG_SR_MODE
|
||||
rd[n][0] = RDCOST(x->rdmult, x->rddiv, s1 + sr0, sse[n]);
|
||||
@ -5866,7 +5867,7 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
int64_t distortion_y_tx;
|
||||
int dummy;
|
||||
int64_t best_rdcost_tx = INT64_MAX;
|
||||
int best_ext_tx = NORM;
|
||||
int best_ext_tx = -1;
|
||||
|
||||
for (i = NORM; i < EXT_TX_TYPES; i++) {
|
||||
mbmi->ext_txfrm = i;
|
||||
@ -5877,7 +5878,8 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
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));
|
||||
assert(rdcost_tx >= 0);
|
||||
if (rdcost_tx < best_rdcost_tx * ext_tx_th) {
|
||||
if (rdcost_tx <
|
||||
best_rdcost_tx * (best_ext_tx == NORM ? ext_tx_th : 1)) {
|
||||
best_ext_tx = i;
|
||||
best_rdcost_tx = rdcost_tx;
|
||||
}
|
||||
@ -7695,7 +7697,8 @@ void vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
}
|
||||
#if CONFIG_EXT_TX
|
||||
this_rd = RDCOST(x->rdmult, x->rddiv, rate2, distortion2);
|
||||
if (tx_type == NORM || this_rd < (bestrd_tx * ext_tx_th)) {
|
||||
if (tx_type == NORM ||
|
||||
this_rd < bestrd_tx * (best_tx_type == NORM ? ext_tx_th : 1.0)) {
|
||||
bestrd_tx = this_rd;
|
||||
best_tx_type = tx_type;
|
||||
best_tx_size = mbmi->tx_size;
|
||||
|
Loading…
x
Reference in New Issue
Block a user