From: Linfeng Zhang Date: Tue, 12 Sep 2017 22:24:54 +0000 (-0700) Subject: Change sinpi_{1,2,3,4}_9 from tran_high_t to int16_t X-Git-Tag: v1.7.0~164 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a80bdfd;p=libvpx 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 --- diff --git a/vp9/common/arm/neon/vp9_iht4x4_add_neon.c b/vp9/common/arm/neon/vp9_iht4x4_add_neon.c index dd1ea03b6..025254c3f 100644 --- a/vp9/common/arm/neon/vp9_iht4x4_add_neon.c +++ b/vp9/common/arm/neon/vp9_iht4x4_add_neon.c @@ -14,14 +14,7 @@ #include "./vp9_rtcd.h" #include "./vpx_config.h" #include "vp9/common/vp9_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; +#include "vpx_dsp/txfm_common.h" static INLINE void TRANSPOSE4X4(int16x8_t *q8s16, int16x8_t *q9s16) { int32x4_t q8s32, q9s32; diff --git a/vp9/encoder/vp9_dct.c b/vp9/encoder/vp9_dct.c index 5c66562a5..2b7eec14f 100644 --- a/vp9/encoder/vp9_dct.c +++ b/vp9/encoder/vp9_dct.c @@ -246,13 +246,14 @@ static void fadst4(const tran_low_t *input, tran_low_t *output) { return; } - s0 = sinpi_1_9 * x0; - s1 = sinpi_4_9 * x0; - s2 = sinpi_2_9 * x1; - s3 = sinpi_1_9 * x1; - s4 = sinpi_3_9 * x2; - s5 = sinpi_4_9 * x3; - s6 = sinpi_2_9 * x3; + // 32-bit result is enough for the following multiplications. + s0 = sinpi_1_9 * input[0]; + s1 = sinpi_4_9 * input[0]; + s2 = sinpi_2_9 * input[1]; + s3 = sinpi_1_9 * input[1]; + s4 = sinpi_3_9 * input[2]; + s5 = sinpi_4_9 * input[3]; + s6 = sinpi_2_9 * input[3]; s7 = x0 + x1 - x3; x0 = s0 + s2 + s5; diff --git a/vpx_dsp/inv_txfm.c b/vpx_dsp/inv_txfm.c index 29323d1b8..e0c2a67df 100644 --- a/vpx_dsp/inv_txfm.c +++ b/vpx_dsp/inv_txfm.c @@ -105,6 +105,7 @@ void iadst4_c(const tran_low_t *input, tran_low_t *output) { return; } + // 32-bit result is enough for the following multiplications. s0 = sinpi_1_9 * x0; s1 = sinpi_2_9 * x0; 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) { return; } - s0 = sinpi_1_9 * x0; - s1 = sinpi_2_9 * x0; - s2 = sinpi_3_9 * x1; - s3 = sinpi_4_9 * x2; - s4 = sinpi_1_9 * x2; - s5 = sinpi_2_9 * x3; - s6 = sinpi_4_9 * x3; + s0 = (tran_high_t)sinpi_1_9 * x0; + s1 = (tran_high_t)sinpi_2_9 * x0; + s2 = (tran_high_t)sinpi_3_9 * x1; + s3 = (tran_high_t)sinpi_4_9 * x2; + s4 = (tran_high_t)sinpi_1_9 * x2; + s5 = (tran_high_t)sinpi_2_9 * x3; + s6 = (tran_high_t)sinpi_4_9 * x3; s7 = (tran_high_t)HIGHBD_WRAPLOW(x0 - x2 + x3, bd); s0 = s0 + s3 + s5; diff --git a/vpx_dsp/mips/itrans4_dspr2.c b/vpx_dsp/mips/itrans4_dspr2.c index 3f985b847..e214b538d 100644 --- a/vpx_dsp/mips/itrans4_dspr2.c +++ b/vpx_dsp/mips/itrans4_dspr2.c @@ -343,6 +343,7 @@ void iadst4_dspr2(const int16_t *input, int16_t *output) { return; } + // 32-bit result is enough for the following multiplications. s0 = sinpi_1_9 * x0; s1 = sinpi_2_9 * x0; s2 = sinpi_3_9 * x1; diff --git a/vpx_dsp/txfm_common.h b/vpx_dsp/txfm_common.h index fd27f928e..95e4e4bdc 100644 --- a/vpx_dsp/txfm_common.h +++ b/vpx_dsp/txfm_common.h @@ -58,9 +58,9 @@ static const tran_high_t cospi_30_64 = 1606; static const tran_high_t cospi_31_64 = 804; // 16384 * sqrt(2) * sin(kPi/9) * 2 / 3 -static const tran_high_t sinpi_1_9 = 5283; -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; +static const tran_coef_t sinpi_1_9 = 5283; +static const tran_coef_t sinpi_2_9 = 9929; +static const tran_coef_t sinpi_3_9 = 13377; +static const tran_coef_t sinpi_4_9 = 15212; #endif // VPX_DSP_TXFM_COMMON_H_ diff --git a/vpx_dsp/vpx_dsp_common.h b/vpx_dsp/vpx_dsp_common.h index e4c60fa18..c8c852374 100644 --- a/vpx_dsp/vpx_dsp_common.h +++ b/vpx_dsp/vpx_dsp_common.h @@ -43,6 +43,8 @@ typedef int32_t tran_high_t; typedef int16_t tran_low_t; #endif // CONFIG_VP9_HIGHBITDEPTH +typedef int16_t tran_coef_t; + static INLINE uint8_t clip_pixel(int val) { return (val > 255) ? 255 : (val < 0) ? 0 : val; }