Commit a80bdfd0 authored by Linfeng Zhang's avatar Linfeng Zhang

Change sinpi_{1,2,3,4}_9 from tran_high_t to int16_t

Add "typedef int16_t tran_coef_t;"

BUG=webm:1450

Change-Id: I67866f104898d1dda8989e1abdaf6983fe324154
parent 9d278465
...@@ -14,14 +14,7 @@ ...@@ -14,14 +14,7 @@
#include "./vp9_rtcd.h" #include "./vp9_rtcd.h"
#include "./vpx_config.h" #include "./vpx_config.h"
#include "vp9/common/vp9_common.h" #include "vp9/common/vp9_common.h"
#include "vpx_dsp/txfm_common.h"
static int16_t sinpi_1_9 = 0x14a3;
static int16_t sinpi_2_9 = 0x26c9;
static int16_t sinpi_3_9 = 0x3441;
static int16_t sinpi_4_9 = 0x3b6c;
static int16_t cospi_8_64 = 0x3b21;
static int16_t cospi_16_64 = 0x2d41;
static int16_t cospi_24_64 = 0x187e;
static INLINE void TRANSPOSE4X4(int16x8_t *q8s16, int16x8_t *q9s16) { static INLINE void TRANSPOSE4X4(int16x8_t *q8s16, int16x8_t *q9s16) {
int32x4_t q8s32, q9s32; int32x4_t q8s32, q9s32;
......
...@@ -246,13 +246,14 @@ static void fadst4(const tran_low_t *input, tran_low_t *output) { ...@@ -246,13 +246,14 @@ static void fadst4(const tran_low_t *input, tran_low_t *output) {
return; return;
} }
s0 = sinpi_1_9 * x0; // 32-bit result is enough for the following multiplications.
s1 = sinpi_4_9 * x0; s0 = sinpi_1_9 * input[0];
s2 = sinpi_2_9 * x1; s1 = sinpi_4_9 * input[0];
s3 = sinpi_1_9 * x1; s2 = sinpi_2_9 * input[1];
s4 = sinpi_3_9 * x2; s3 = sinpi_1_9 * input[1];
s5 = sinpi_4_9 * x3; s4 = sinpi_3_9 * input[2];
s6 = sinpi_2_9 * x3; s5 = sinpi_4_9 * input[3];
s6 = sinpi_2_9 * input[3];
s7 = x0 + x1 - x3; s7 = x0 + x1 - x3;
x0 = s0 + s2 + s5; x0 = s0 + s2 + s5;
......
...@@ -105,6 +105,7 @@ void iadst4_c(const tran_low_t *input, tran_low_t *output) { ...@@ -105,6 +105,7 @@ void iadst4_c(const tran_low_t *input, tran_low_t *output) {
return; return;
} }
// 32-bit result is enough for the following multiplications.
s0 = sinpi_1_9 * x0; s0 = sinpi_1_9 * x0;
s1 = sinpi_2_9 * x0; s1 = sinpi_2_9 * x0;
s2 = sinpi_3_9 * x1; s2 = sinpi_3_9 * x1;
...@@ -1390,13 +1391,13 @@ void vpx_highbd_iadst4_c(const tran_low_t *input, tran_low_t *output, int bd) { ...@@ -1390,13 +1391,13 @@ void vpx_highbd_iadst4_c(const tran_low_t *input, tran_low_t *output, int bd) {
return; return;
} }
s0 = sinpi_1_9 * x0; s0 = (tran_high_t)sinpi_1_9 * x0;
s1 = sinpi_2_9 * x0; s1 = (tran_high_t)sinpi_2_9 * x0;
s2 = sinpi_3_9 * x1; s2 = (tran_high_t)sinpi_3_9 * x1;
s3 = sinpi_4_9 * x2; s3 = (tran_high_t)sinpi_4_9 * x2;
s4 = sinpi_1_9 * x2; s4 = (tran_high_t)sinpi_1_9 * x2;
s5 = sinpi_2_9 * x3; s5 = (tran_high_t)sinpi_2_9 * x3;
s6 = sinpi_4_9 * x3; s6 = (tran_high_t)sinpi_4_9 * x3;
s7 = (tran_high_t)HIGHBD_WRAPLOW(x0 - x2 + x3, bd); s7 = (tran_high_t)HIGHBD_WRAPLOW(x0 - x2 + x3, bd);
s0 = s0 + s3 + s5; s0 = s0 + s3 + s5;
......
...@@ -343,6 +343,7 @@ void iadst4_dspr2(const int16_t *input, int16_t *output) { ...@@ -343,6 +343,7 @@ void iadst4_dspr2(const int16_t *input, int16_t *output) {
return; return;
} }
// 32-bit result is enough for the following multiplications.
s0 = sinpi_1_9 * x0; s0 = sinpi_1_9 * x0;
s1 = sinpi_2_9 * x0; s1 = sinpi_2_9 * x0;
s2 = sinpi_3_9 * x1; s2 = sinpi_3_9 * x1;
......
...@@ -58,9 +58,9 @@ static const tran_high_t cospi_30_64 = 1606; ...@@ -58,9 +58,9 @@ static const tran_high_t cospi_30_64 = 1606;
static const tran_high_t cospi_31_64 = 804; static const tran_high_t cospi_31_64 = 804;
// 16384 * sqrt(2) * sin(kPi/9) * 2 / 3 // 16384 * sqrt(2) * sin(kPi/9) * 2 / 3
static const tran_high_t sinpi_1_9 = 5283; static const tran_coef_t sinpi_1_9 = 5283;
static const tran_high_t sinpi_2_9 = 9929; static const tran_coef_t sinpi_2_9 = 9929;
static const tran_high_t sinpi_3_9 = 13377; static const tran_coef_t sinpi_3_9 = 13377;
static const tran_high_t sinpi_4_9 = 15212; static const tran_coef_t sinpi_4_9 = 15212;
#endif // VPX_DSP_TXFM_COMMON_H_ #endif // VPX_DSP_TXFM_COMMON_H_
...@@ -43,6 +43,8 @@ typedef int32_t tran_high_t; ...@@ -43,6 +43,8 @@ typedef int32_t tran_high_t;
typedef int16_t tran_low_t; typedef int16_t tran_low_t;
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
typedef int16_t tran_coef_t;
static INLINE uint8_t clip_pixel(int val) { static INLINE uint8_t clip_pixel(int val) {
return (val > 255) ? 255 : (val < 0) ? 0 : val; return (val > 255) ? 255 : (val < 0) ? 0 : val;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment