diff options
author | Jingning Han <jingning@google.com> | 2013-02-22 16:29:28 -0800 |
---|---|---|
committer | Jingning Han <jingning@google.com> | 2013-02-25 09:16:12 -0800 |
commit | 77a3becf92b6385ce7e2ffcf636c9cc373d8760c (patch) | |
tree | 6c8da72ff10aa4552e26d9967494cccae42cdd9f /vp9/common | |
parent | 499fe05dc030b31d15c2ad9717e6bcee839f7d12 (diff) | |
download | libvpx-77a3becf92b6385ce7e2ffcf636c9cc373d8760c.tar libvpx-77a3becf92b6385ce7e2ffcf636c9cc373d8760c.tar.gz libvpx-77a3becf92b6385ce7e2ffcf636c9cc373d8760c.tar.bz2 libvpx-77a3becf92b6385ce7e2ffcf636c9cc373d8760c.zip |
clean up forward and inverse hybrid transform
Rebased.
Remove the old matrix multiplication transform computation. The 16x16
ADST/DCT can be switched on/off and evaluated by setting ACTIVE_HT16
300/0 in vp9/common/vp9_blockd.h.
Change-Id: Icab2dbd18538987e1dc4e88c45abfc4cfc6e133f
Diffstat (limited to 'vp9/common')
-rw-r--r-- | vp9/common/vp9_idct.h | 2 | ||||
-rw-r--r-- | vp9/common/vp9_idctllm.c | 277 | ||||
-rw-r--r-- | vp9/common/vp9_invtrans.c | 19 | ||||
-rw-r--r-- | vp9/common/vp9_rtcd_defs.sh | 19 |
4 files changed, 0 insertions, 317 deletions
diff --git a/vp9/common/vp9_idct.h b/vp9/common/vp9_idct.h index ac9574847..430cec083 100644 --- a/vp9/common/vp9_idct.h +++ b/vp9/common/vp9_idct.h @@ -50,13 +50,11 @@ static const int cospi_29_64 = 2404; static const int cospi_30_64 = 1606; static const int cospi_31_64 = 804; -#if CONFIG_INTHT4X4 // 16384 * sqrt(2) * sin(kPi/9) * 2 / 3 static const int sinpi_1_9 = 5283; static const int sinpi_2_9 = 9929; static const int sinpi_3_9 = 13377; static const int sinpi_4_9 = 15212; -#endif static INLINE int dct_const_round_shift(int input) { int rv = (input + DCT_CONST_ROUNDING) >> DCT_CONST_BITS; diff --git a/vp9/common/vp9_idctllm.c b/vp9/common/vp9_idctllm.c index f8ac28819..36857bc4a 100644 --- a/vp9/common/vp9_idctllm.c +++ b/vp9/common/vp9_idctllm.c @@ -30,274 +30,6 @@ #include "vp9/common/vp9_common.h" #include "vp9/common/vp9_idct.h" - - -static const int16_t idct_i4[16] = { - 8192, 10703, 8192, 4433, - 8192, 4433, -8192, -10703, - 8192, -4433, -8192, 10703, - 8192, -10703, 8192, -4433 -}; - -static const int16_t iadst_i4[16] = { - 3736, 9459, 10757, 7021, - 7021, 9459, -3736, -10757, - 9459, 0, -9459, 9459, - 10757, -9459, 7021, -3736 -}; - -static const int16_t idct_i8[64] = { - 5793, 8035, 7568, 6811, - 5793, 4551, 3135, 1598, - 5793, 6811, 3135, -1598, - -5793, -8035, -7568, -4551, - 5793, 4551, -3135, -8035, - -5793, 1598, 7568, 6811, - 5793, 1598, -7568, -4551, - 5793, 6811, -3135, -8035, - 5793, -1598, -7568, 4551, - 5793, -6811, -3135, 8035, - 5793, -4551, -3135, 8035, - -5793, -1598, 7568, -6811, - 5793, -6811, 3135, 1598, - -5793, 8035, -7568, 4551, - 5793, -8035, 7568, -6811, - 5793, -4551, 3135, -1598 -}; - -static const int16_t iadst_i8[64] = { - 1460, 4184, 6342, 7644, - 7914, 7114, 5354, 2871, - 2871, 7114, 7644, 4184, - -1460, -6342, -7914, -5354, - 4184, 7914, 2871, -5354, - -7644, -1460, 6342, 7114, - 5354, 6342, -4184, -7114, - 2871, 7644, -1460, -7914, - 6342, 2871, -7914, 1460, - 7114, -5354, -4184, 7644, - 7114, -1460, -5354, 7914, - -4184, -2871, 7644, -6342, - 7644, -5354, 1460, 2871, - -6342, 7914, -7114, 4184, - 7914, -7644, 7114, -6342, - 5354, -4184, 2871, -1460 -}; - - - -static const int16_t idct_i16[256] = { - 4096, 5765, 5681, 5543, 5352, 5109, 4816, 4478, - 4096, 3675, 3218, 2731, 2217, 1682, 1130, 568, - 4096, 5543, 4816, 3675, 2217, 568, -1130, -2731, - -4096, -5109, -5681, -5765, -5352, -4478, -3218, -1682, - 4096, 5109, 3218, 568, -2217, -4478, -5681, -5543, - -4096, -1682, 1130, 3675, 5352, 5765, 4816, 2731, - 4096, 4478, 1130, -2731, -5352, -5543, -3218, 568, - 4096, 5765, 4816, 1682, -2217, -5109, -5681, -3675, - 4096, 3675, -1130, -5109, -5352, -1682, 3218, 5765, - 4096, -568, -4816, -5543, -2217, 2731, 5681, 4478, - 4096, 2731, -3218, -5765, -2217, 3675, 5681, 1682, - -4096, -5543, -1130, 4478, 5352, 568, -4816, -5109, - 4096, 1682, -4816, -4478, 2217, 5765, 1130, -5109, - -4096, 2731, 5681, 568, -5352, -3675, 3218, 5543, - 4096, 568, -5681, -1682, 5352, 2731, -4816, -3675, - 4096, 4478, -3218, -5109, 2217, 5543, -1130, -5765, - 4096, -568, -5681, 1682, 5352, -2731, -4816, 3675, - 4096, -4478, -3218, 5109, 2217, -5543, -1130, 5765, - 4096, -1682, -4816, 4478, 2217, -5765, 1130, 5109, - -4096, -2731, 5681, -568, -5352, 3675, 3218, -5543, - 4096, -2731, -3218, 5765, -2217, -3675, 5681, -1682, - -4096, 5543, -1130, -4478, 5352, -568, -4816, 5109, - 4096, -3675, -1130, 5109, -5352, 1682, 3218, -5765, - 4096, 568, -4816, 5543, -2217, -2731, 5681, -4478, - 4096, -4478, 1130, 2731, -5352, 5543, -3218, -568, - 4096, -5765, 4816, -1682, -2217, 5109, -5681, 3675, - 4096, -5109, 3218, -568, -2217, 4478, -5681, 5543, - -4096, 1682, 1130, -3675, 5352, -5765, 4816, -2731, - 4096, -5543, 4816, -3675, 2217, -568, -1130, 2731, - -4096, 5109, -5681, 5765, -5352, 4478, -3218, 1682, - 4096, -5765, 5681, -5543, 5352, -5109, 4816, -4478, - 4096, -3675, 3218, -2731, 2217, -1682, 1130, -568 -}; - -#if CONFIG_INTHT -static const int16_t iadst_i16[256] = { - 284, 850, 1407, 1951, 2476, 2977, 3450, 3889, - 4291, 4652, 4967, 5235, 5453, 5618, 5729, 5784, - 850, 2476, 3889, 4967, 5618, 5784, 5453, 4652, - 3450, 1951, 284, -1407, -2977, -4291, -5235, -5729, - 1407, 3889, 5453, 5729, 4652, 2476, -284, -2977, - -4967, -5784, -5235, -3450, -850, 1951, 4291, 5618, - 1951, 4967, 5729, 3889, 284, -3450, -5618, -5235, - -2476, 1407, 4652, 5784, 4291, 850, -2977, -5453, - 2476, 5618, 4652, 284, -4291, -5729, -2977, 1951, - 5453, 4967, 850, -3889, -5784, -3450, 1407, 5235, - 2977, 5784, 2476, -3450, -5729, -1951, 3889, 5618, - 1407, -4291, -5453, -850, 4652, 5235, 284, -4967, - 3450, 5453, -284, -5618, -2977, 3889, 5235, -850, - -5729, -2476, 4291, 4967, -1407, -5784, -1951, 4652, - 3889, 4652, -2977, -5235, 1951, 5618, -850, -5784, - -284, 5729, 1407, -5453, -2476, 4967, 3450, -4291, - 4291, 3450, -4967, -2476, 5453, 1407, -5729, -284, - 5784, -850, -5618, 1951, 5235, -2977, -4652, 3889, - 4652, 1951, -5784, 1407, 4967, -4291, -2476, 5729, - -850, -5235, 3889, 2977, -5618, 284, 5453, -3450, - 4967, 284, -5235, 4652, 850, -5453, 4291, 1407, - -5618, 3889, 1951, -5729, 3450, 2476, -5784, 2977, - 5235, -1407, -3450, 5784, -3889, -850, 4967, -5453, - 1951, 2977, -5729, 4291, 284, -4652, 5618, -2476, - 5453, -2977, -850, 4291, -5784, 4652, -1407, -2476, - 5235, -5618, 3450, 284, -3889, 5729, -4967, 1951, - 5618, -4291, 1951, 850, -3450, 5235, -5784, 4967, - -2977, 284, 2476, -4652, 5729, -5453, 3889, -1407, - 5729, -5235, 4291, -2977, 1407, 284, -1951, 3450, - -4652, 5453, -5784, 5618, -4967, 3889, -2476, 850, - 5784, -5729, 5618, -5453, 5235, -4967, 4652, -4291, - 3889, -3450, 2977, -2476, 1951, -1407, 850, -284 -}; -#else -static const int16_t iadst_i16[256] = { - 542, 1607, 2614, 3526, 4311, 4940, 5390, 5646, - 5698, 5543, 5189, 4646, 3936, 3084, 2120, 1080, - 1080, 3084, 4646, 5543, 5646, 4940, 3526, 1607, - -542, -2614, -4311, -5390, -5698, -5189, -3936, -2120, - 1607, 4311, 5646, 5189, 3084, 0, -3084, -5189, - -5646, -4311, -1607, 1607, 4311, 5646, 5189, 3084, - 2120, 5189, 5390, 2614, -1607, -4940, -5543, -3084, - 1080, 4646, 5646, 3526, -542, -4311, -5698, -3936, - 2614, 5646, 3936, -1080, -5189, -4940, -542, 4311, - 5543, 2120, -3084, -5698, -3526, 1607, 5390, 4646, - 3084, 5646, 1607, -4311, -5189, 0, 5189, 4311, - -1607, -5646, -3084, 3084, 5646, 1607, -4311, -5189, - 3526, 5189, -1080, -5698, -1607, 4940, 3936, -3084, - -5390, 542, 5646, 2120, -4646, -4311, 2614, 5543, - 3936, 4311, -3526, -4646, 3084, 4940, -2614, -5189, - 2120, 5390, -1607, -5543, 1080, 5646, -542, -5698, - 4311, 3084, -5189, -1607, 5646, 0, -5646, 1607, - 5189, -3084, -4311, 4311, 3084, -5189, -1607, 5646, - 4646, 1607, -5698, 2120, 4311, -4940, -1080, 5646, - -2614, -3936, 5189, 542, -5543, 3084, 3526, -5390, - 4940, 0, -4940, 4940, 0, -4940, 4940, 0, - -4940, 4940, 0, -4940, 4940, 0, -4940, 4940, - 5189, -1607, -3084, 5646, -4311, 0, 4311, -5646, - 3084, 1607, -5189, 5189, -1607, -3084, 5646, -4311, - 5390, -3084, -542, 3936, -5646, 4940, -2120, -1607, - 4646, -5698, 4311, -1080, -2614, 5189, -5543, 3526, - 5543, -4311, 2120, 542, -3084, 4940, -5698, 5189, - -3526, 1080, 1607, -3936, 5390, -5646, 4646, -2614, - 5646, -5189, 4311, -3084, 1607, 0, -1607, 3084, - -4311, 5189, -5646, 5646, -5189, 4311, -3084, 1607, - 5698, -5646, 5543, -5390, 5189, -4940, 4646, -4311, - 3936, -3526, 3084, -2614, 2120, -1607, 1080, -542 -}; -#endif - -/* Converted the transforms to integer form. */ -#define HORIZONTAL_SHIFT 14 // 16 -#define HORIZONTAL_ROUNDING ((1 << (HORIZONTAL_SHIFT - 1)) - 1) -#define VERTICAL_SHIFT 17 // 15 -#define VERTICAL_ROUNDING ((1 << (VERTICAL_SHIFT - 1)) - 1) -void vp9_ihtllm_c(const int16_t *input, int16_t *output, int pitch, - TX_TYPE tx_type, int tx_dim, uint16_t eobs) { - int i, j, k; - int nz_dim; - int16_t imbuf[256]; - - const int16_t *ip = input; - int16_t *op = output; - int16_t *im = &imbuf[0]; - - /* pointers to vertical and horizontal transforms. */ - const int16_t *ptv = NULL, *pth = NULL; - int shortpitch = pitch >> 1; - - switch (tx_type) { - case ADST_ADST : - ptv = pth = (tx_dim == 4) ? &iadst_i4[0] - : ((tx_dim == 8) ? &iadst_i8[0] - : &iadst_i16[0]); - break; - case ADST_DCT : - ptv = (tx_dim == 4) ? &iadst_i4[0] - : ((tx_dim == 8) ? &iadst_i8[0] : &iadst_i16[0]); - pth = (tx_dim == 4) ? &idct_i4[0] - : ((tx_dim == 8) ? &idct_i8[0] : &idct_i16[0]); - break; - case DCT_ADST : - ptv = (tx_dim == 4) ? &idct_i4[0] - : ((tx_dim == 8) ? &idct_i8[0] : &idct_i16[0]); - pth = (tx_dim == 4) ? &iadst_i4[0] - : ((tx_dim == 8) ? &iadst_i8[0] : &iadst_i16[0]); - break; - case DCT_DCT : - ptv = pth = (tx_dim == 4) ? &idct_i4[0] - : ((tx_dim == 8) ? &idct_i8[0] - : &idct_i16[0]); - break; - default: - assert(0); - break; - } - - nz_dim = tx_dim; - if(tx_dim > 4) { - if(eobs < 36) { - vpx_memset(im, 0, 512); - nz_dim = 8; - if(eobs < 3) { - nz_dim = 2; - } else if(eobs < 10) { - nz_dim = 4; - } - } - } - - /* 2-D inverse transform X = M1*Z*Transposed_M2 is calculated in 2 steps - * from right to left: - * 1. horizontal transform: Y= Z*Transposed_M2 - * 2. vertical transform: X = M1*Y - * In SIMD, doing this way could eliminate the transpose needed if it is - * calculated from left to right. - */ - /* Horizontal transformation */ - for (j = 0; j < tx_dim; j++) { - for (i = 0; i < nz_dim; i++) { - int temp = 0; - - for (k = 0; k < nz_dim; k++) { - temp += ip[k] * pth[k]; - } - - /* Calculate im and store it in its transposed position. */ - im[i] = (int16_t)((temp + HORIZONTAL_ROUNDING) >> HORIZONTAL_SHIFT); - ip += tx_dim; - } - im += tx_dim; - pth += tx_dim; - ip = input; - } - - /* Vertical transformation */ - im = &imbuf[0]; - - for (i = 0; i < tx_dim; i++) { - for (j = 0; j < tx_dim; j++) { - int temp = 0; - - for (k = 0; k < nz_dim; k++) { - temp += ptv[k] * im[k]; - } - - op[j] = (int16_t)((temp + VERTICAL_ROUNDING) >> VERTICAL_SHIFT); - im += tx_dim; - } - im = &imbuf[0]; - ptv += tx_dim; - op += shortpitch; - } -} - void vp9_short_inv_walsh4x4_x8_c(int16_t *input, int16_t *output, int pitch) { int i; int a1, b1, c1, d1; @@ -534,7 +266,6 @@ void vp9_short_idct8x8_c(int16_t *input, int16_t *output, int pitch) { } } -#if CONFIG_INTHT4X4 static void iadst4_1d(int16_t *input, int16_t *output) { int x0, x1, x2, x3; int s0, s1, s2, s3, s4, s5, s6, s7; @@ -626,9 +357,7 @@ void vp9_short_iht4x4_c(int16_t *input, int16_t *output, output[j * short_pitch + i] = (temp_out[j] + 8) >> 4; } } -#endif -#if CONFIG_INTHT static void iadst8_1d(int16_t *input, int16_t *output) { int x0, x1, x2, x3, x4, x5, x6, x7; int s0, s1, s2, s3, s4, s5, s6, s7; @@ -757,8 +486,6 @@ void vp9_short_iht8x8_c(int16_t *input, int16_t *output, output[j * short_pitch + i] = (temp_out[j] + 16) >> 5; } } -#endif - void vp9_short_idct10_8x8_c(int16_t *input, int16_t *output, int pitch) { int16_t out[8 * 8]; @@ -980,7 +707,6 @@ void vp9_short_idct16x16_c(int16_t *input, int16_t *output, int pitch) { } } -#if CONFIG_INTHT16X16 void iadst16_1d(int16_t *input, int16_t *output) { int x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15; int s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15; @@ -1201,9 +927,6 @@ void vp9_short_iht16x16_c(int16_t *input, int16_t *output, output[j * 16 + i] = (temp_out[j] + 32) >> 6; } } -#endif - - void vp9_short_idct10_16x16_c(int16_t *input, int16_t *output, int pitch) { int16_t out[16 * 16]; diff --git a/vp9/common/vp9_invtrans.c b/vp9/common/vp9_invtrans.c index 25b59cc5d..c6b961894 100644 --- a/vp9/common/vp9_invtrans.c +++ b/vp9/common/vp9_invtrans.c @@ -25,13 +25,8 @@ void vp9_inverse_transform_mby_4x4(MACROBLOCKD *xd) { for (i = 0; i < 16; i++) { TX_TYPE tx_type = get_tx_type_4x4(xd, &xd->block[i]); if (tx_type != DCT_DCT) { -#if CONFIG_INTHT4X4 vp9_short_iht4x4(xd->block[i].dqcoeff, xd->block[i].diff, 32, tx_type); -#else - vp9_ihtllm(xd->block[i].dqcoeff, xd->block[i].diff, 32, - tx_type, 4, xd->block[i].eob); -#endif } else { vp9_inverse_transform_b_4x4(xd, i, 32); } @@ -63,13 +58,8 @@ void vp9_inverse_transform_mby_8x8(MACROBLOCKD *xd) { for (i = 0; i < 9; i += 8) { TX_TYPE tx_type = get_tx_type_8x8(xd, &xd->block[i]); if (tx_type != DCT_DCT) { -#if CONFIG_INTHT vp9_short_iht8x8(xd->block[i].dqcoeff, xd->block[i].diff, 32, tx_type); -#else - vp9_ihtllm(xd->block[i].dqcoeff, xd->block[i].diff, 32, tx_type, 8, - xd->block[i].eob); -#endif } else { vp9_inverse_transform_b_8x8(&blockd[i].dqcoeff[0], &blockd[i].diff[0], 32); @@ -78,13 +68,8 @@ void vp9_inverse_transform_mby_8x8(MACROBLOCKD *xd) { for (i = 2; i < 11; i += 8) { TX_TYPE tx_type = get_tx_type_8x8(xd, &xd->block[i]); if (tx_type != DCT_DCT) { -#if CONFIG_INTHT vp9_short_iht8x8(xd->block[i + 2].dqcoeff, xd->block[i].diff, 32, tx_type); -#else - vp9_ihtllm(xd->block[i + 2].dqcoeff, xd->block[i].diff, 32, tx_type, 8, - xd->block[i + 2].eob); -#endif } else { vp9_inverse_transform_b_8x8(&blockd[i + 2].dqcoeff[0], &blockd[i].diff[0], 32); @@ -116,11 +101,7 @@ void vp9_inverse_transform_mby_16x16(MACROBLOCKD *xd) { BLOCKD *bd = &xd->block[0]; TX_TYPE tx_type = get_tx_type_16x16(xd, bd); if (tx_type != DCT_DCT) { -#if CONFIG_INTHT16X16 vp9_short_iht16x16(bd->dqcoeff, bd->diff, 32, tx_type); -#else - vp9_ihtllm(bd->dqcoeff, bd->diff, 32, tx_type, 16, bd->eob); -#endif } else { vp9_inverse_transform_b_16x16(&xd->block[0].dqcoeff[0], &xd->block[0].diff[0], 32); diff --git a/vp9/common/vp9_rtcd_defs.sh b/vp9/common/vp9_rtcd_defs.sh index 5a7484d81..700af7fa7 100644 --- a/vp9/common/vp9_rtcd_defs.sh +++ b/vp9/common/vp9_rtcd_defs.sh @@ -284,24 +284,14 @@ specialize vp9_short_idct32x32 prototype void vp9_short_idct1_32x32 "int16_t *input, int16_t *output" specialize vp9_short_idct1_32x32 -#if CONFIG_INTHT prototype void vp9_short_iht8x8 "int16_t *input, int16_t *output, int pitch, int tx_type" specialize vp9_short_iht8x8 -#endif -#if CONFIG_INTHT4X4 prototype void vp9_short_iht4x4 "int16_t *input, int16_t *output, int pitch, int tx_type" specialize vp9_short_iht4x4 -#endif -#if CONFIG_INTHT16X16 prototype void vp9_short_iht16x16 "int16_t *input, int16_t *output, int pitch, int tx_type" specialize vp9_short_iht16x16 -#endif - -prototype void vp9_ihtllm "const int16_t *input, int16_t *output, int pitch, int tx_type, int tx_dim, int eob" -specialize vp9_ihtllm - # dct and add @@ -565,23 +555,14 @@ if [ "$CONFIG_INTERNAL_STATS" = "yes" ]; then fi # fdct functions -prototype void vp9_fht "const int16_t *input, int pitch, int16_t *output, int tx_type, int tx_dim" -specialize vp9_fht - -#if CONFIG_INTHT4X4 prototype void vp9_short_fht4x4 "int16_t *InputData, int16_t *OutputData, int pitch, int tx_type" specialize vp9_short_fht4x4 -#endif -#if CONFIG_INTHT prototype void vp9_short_fht8x8 "int16_t *InputData, int16_t *OutputData, int pitch, int tx_type" specialize vp9_short_fht8x8 -#endif -#if CONFIG_INTHT16X16 prototype void vp9_short_fht16x16 "int16_t *InputData, int16_t *OutputData, int pitch, int tx_type" specialize vp9_short_fht16x16 -#endif prototype void vp9_short_fdct8x8 "int16_t *InputData, int16_t *OutputData, int pitch" specialize vp9_short_fdct8x8 |