shithub: aacenc

Download patch

ref: c8f26d7e0db0458e158b06ccaef0d79d3f34adb6
parent: a9f67bf89328abbbe7d8f6026f826d812e1165f4
author: Takashi Yoshi <takashi@yoshi.email>
date: Tue Dec 26 08:03:58 EST 2017

Fix compilation with GCC < 4.6

Older versions of GCC (< 4.6) consider calls to log10() and sqrt()
non-constant and as a result compilation fails.

GCC >= 4.6 < 6 will compile but print a warning about the non-constant
initialization.

This switch will use the "constant" expression on older versions of GCC.

--- a/libfaac/quantize.c
+++ b/libfaac/quantize.c
@@ -40,6 +40,12 @@
 # define bit_SSE2 (1 << 26)
 #endif
 
+#ifdef __GNUC__
+#define GCC_VERSION (__GNUC__ * 10000 \
+                     + __GNUC_MINOR__ * 100 \
+                     + __GNUC_PATCHLEVEL__)
+#endif
+
 #define MAGIC_NUMBER  0.4054
 #define NOISEFLOOR 0.4
 
@@ -147,7 +153,7 @@
                   )
 {
     int sb, cnt;
-#ifndef __clang__
+#if !defined(__clang__) && (!defined(__GNUC__) || GCC_VERSION >= 40600)
     /* 2^0.25 (1.50515 dB) step from AAC specs */
     static const double sfstep = 1.0 / log10(sqrt(sqrt(2.0)));
 #else