From 67bef4cffa69f834e2220e20fc4993a569328b1c Mon Sep 17 00:00:00 2001 From: Marton Balint Date: Sat, 5 Mar 2016 04:24:45 +0100 Subject: avcodec/aactab: do not use floats for constants This may improve the precision of the fixed point encoder/decoder for some compilers and architectures. Reviewed-by: Michael Niedermayer Signed-off-by: Marton Balint --- libavcodec/aac_defines.h | 6 +++--- libavcodec/aactab.h | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/aac_defines.h b/libavcodec/aac_defines.h index eff63b347c..c12dc2fab7 100644 --- a/libavcodec/aac_defines.h +++ b/libavcodec/aac_defines.h @@ -89,9 +89,9 @@ typedef float AAC_FLOAT; typedef unsigned AAC_SIGNE; #define FIXR(x) ((float)(x)) #define FIXR10(x) ((float)(x)) -#define Q23(x) x -#define Q30(x) x -#define Q31(x) x +#define Q23(x) ((float)(x)) +#define Q30(x) ((float)(x)) +#define Q31(x) ((float)(x)) #define RANGE15(x) (32768.0 * (x)) #define GET_GAIN(x, y) powf((x), -(y)) #define AAC_MUL16(x, y) ((x) * (y)) diff --git a/libavcodec/aactab.h b/libavcodec/aactab.h index b48e7da6ed..a0d44a2dad 100644 --- a/libavcodec/aactab.h +++ b/libavcodec/aactab.h @@ -92,8 +92,8 @@ static inline void ff_aac_tableinit(void) * Table of the LTP coefficients */ static const INTFLOAT ltp_coef[8] = { - Q30(0.570829f), Q30(0.696616f), Q30(0.813004f), Q30(0.911304f), - Q30(0.984900f), Q30(1.067894f), Q30(1.194601f), Q30(1.369533f), + Q30(0.570829), Q30(0.696616), Q30(0.813004), Q30(0.911304), + Q30(0.984900), Q30(1.067894), Q30(1.194601), Q30(1.369533), }; /* @name tns_tmp2_map @@ -103,24 +103,24 @@ static const INTFLOAT ltp_coef[8] = { * @{ */ static const INTFLOAT tns_tmp2_map_1_3[4] = { - Q31(0.00000000f), Q31(-0.43388373f), Q31(0.64278758f), Q31(0.34202015f), + Q31(0.00000000), Q31(-0.43388373), Q31(0.64278758), Q31(0.34202015), }; static const INTFLOAT tns_tmp2_map_0_3[8] = { - Q31(0.00000000f), Q31(-0.43388373f), Q31(-0.78183150f), Q31(-0.97492790f), - Q31(0.98480773f), Q31( 0.86602539f), Q31( 0.64278758f), Q31( 0.34202015f), + Q31(0.00000000), Q31(-0.43388373), Q31(-0.78183150), Q31(-0.97492790), + Q31(0.98480773), Q31( 0.86602539), Q31( 0.64278758), Q31( 0.34202015), }; static const INTFLOAT tns_tmp2_map_1_4[8] = { - Q31(0.00000000f), Q31(-0.20791170f), Q31(-0.40673664f), Q31(-0.58778524f), - Q31(0.67369562f), Q31( 0.52643216f), Q31( 0.36124167f), Q31( 0.18374951f), + Q31(0.00000000), Q31(-0.20791170), Q31(-0.40673664), Q31(-0.58778524), + Q31(0.67369562), Q31( 0.52643216), Q31( 0.36124167), Q31( 0.18374951), }; static const INTFLOAT tns_tmp2_map_0_4[16] = { - Q31( 0.00000000f), Q31(-0.20791170f), Q31(-0.40673664f), Q31(-0.58778524f), - Q31(-0.74314481f), Q31(-0.86602539f), Q31(-0.95105654f), Q31(-0.99452192f), - Q31( 0.99573416f), Q31( 0.96182561f), Q31( 0.89516330f), Q31( 0.79801720f), - Q31( 0.67369562f), Q31( 0.52643216f), Q31( 0.36124167f), Q31( 0.18374951f), + Q31( 0.00000000), Q31(-0.20791170), Q31(-0.40673664), Q31(-0.58778524), + Q31(-0.74314481), Q31(-0.86602539), Q31(-0.95105654), Q31(-0.99452192), + Q31( 0.99573416), Q31( 0.96182561), Q31( 0.89516330), Q31( 0.79801720), + Q31( 0.67369562), Q31( 0.52643216), Q31( 0.36124167), Q31( 0.18374951), }; static const INTFLOAT * const tns_tmp2_map[4] = { -- cgit v1.2.3