shithub: aacenc

Download patch

ref: 47142b7155cebdb94195e69782c95bd33c11cfdd
parent: ae01d6dfb986b6bbcc725ebb8f898f818773addc
author: Krzysztof Nikiel <knik@users.sourceforge.net>
date: Thu Aug 17 10:21:29 EDT 2017

quantizer: use standard "MAGIC_NUMBER" for integer conversion

--- a/libfaac/quantize.c
+++ b/libfaac/quantize.c
@@ -21,6 +21,8 @@
 #include <math.h>
 #include "util.h"
 
+#define MAGIC_NUMBER  0.4054
+
 // band sound masking
 static void bmask(CoderInfo *coderInfo, double *xr, double *bandqual,
                   double quality)
@@ -143,7 +145,7 @@
           tmp *= sfacfix;
           tmp = sqrt(tmp * sqrt(tmp));
 
-          xi[cnt] = (int)(tmp + 0.5);
+          xi[cnt] = (int)(tmp + MAGIC_NUMBER);
 
           tmp = pow43[xi[cnt]];
           eout += tmp * tmp;