[FFmpeg-cvslog] avcodec/mpegaudio: use predefined M_SQRT2

Ganesh Ajjanagadde git at videolan.org
Sat Nov 14 17:06:48 CET 2015


ffmpeg | branch: master | Ganesh Ajjanagadde <gajjanagadde at gmail.com> | Sat Nov 14 10:52:30 2015 -0500| [11f0acf829e26279c5f2a414c6860bd4933f29af] | committer: Ganesh Ajjanagadde

avcodec/mpegaudio: use predefined M_SQRT2

M_SQRT2 is defined in math.h, or in avutil/mathematics.h for
compatibility hacks. This uses this value instead of an ad-hoc define.

Fixed point values produced by FIX() remain identical.

Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=11f0acf829e26279c5f2a414c6860bd4933f29af
---

 libavcodec/mpegaudioenc_template.c |    4 ++--
 libavcodec/mpegaudiotab.h          |    2 --
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mpegaudioenc_template.c b/libavcodec/mpegaudioenc_template.c
index ce93cc7..b91d0a8 100644
--- a/libavcodec/mpegaudioenc_template.c
+++ b/libavcodec/mpegaudioenc_template.c
@@ -244,11 +244,11 @@ static void idct32(int *out, int *tab)
     do {
         int x1, x2, x3, x4;
 
-        x3 = MUL(t[16], FIX(SQRT2*0.5));
+        x3 = MUL(t[16], FIX(M_SQRT2*0.5));
         x4 = t[0] - x3;
         x3 = t[0] + x3;
 
-        x2 = MUL(-(t[24] + t[8]), FIX(SQRT2*0.5));
+        x2 = MUL(-(t[24] + t[8]), FIX(M_SQRT2*0.5));
         x1 = MUL((t[8] - x2), xp[0]);
         x2 = MUL((t[8] + x2), xp[1]);
 
diff --git a/libavcodec/mpegaudiotab.h b/libavcodec/mpegaudiotab.h
index 42d42d8..bb2e5de 100644
--- a/libavcodec/mpegaudiotab.h
+++ b/libavcodec/mpegaudiotab.h
@@ -33,8 +33,6 @@
 #include <stdint.h>
 #include "mpegaudio.h"
 
-#define SQRT2 1.41421356237309514547
-
 static const int costab32[30] = {
     FIX(0.54119610014619701222),
     FIX(1.3065629648763763537),



More information about the ffmpeg-cvslog mailing list