[FFmpeg-devel] [PATCHv2 1/2] avcodec/aactab: do not use floats for constants

Marton Balint cus at passwd.hu
Sun Mar 6 13:10:48 CET 2016


This may improve the precision of the fixed point decoder for some compilers
and architectures.

Signed-off-by: Marton Balint <cus at passwd.hu>
---
 libavcodec/aac_defines.h |  6 +++---
 libavcodec/aactab.h      | 22 +++++++++++-----------
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/libavcodec/aac_defines.h b/libavcodec/aac_defines.h
index eff63b3..c12dc2f 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 b48e7da..a0d44a2 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] = {
-- 
2.6.2



More information about the ffmpeg-devel mailing list