]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/aacps_tablegen.h
aac_adtstoasc_bsf: Check extradata memory allocation
[ffmpeg] / libavcodec / aacps_tablegen.h
index 3c1b27decdea2843a944f3ffb88780cd36dd9954..a53f9fac1fe2d361e625b9d2f3cefd5ae0eb2483 100644 (file)
@@ -3,47 +3,52 @@
  *
  * Copyright (c) 2010 Alex Converse <alex.converse@gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #ifndef AACPS_TABLEGEN_H
 #define AACPS_TABLEGEN_H
 
+#include <math.h>
 #include <stdint.h>
 
 #if CONFIG_HARDCODED_TABLES
 #define ps_tableinit()
+#define TABLE_CONST const
 #include "libavcodec/aacps_tables.h"
 #else
-#include "../libavutil/common.h"
-#include "../libavutil/mathematics.h"
+#include "libavutil/common.h"
+#include "libavutil/libm.h"
+#include "libavutil/mathematics.h"
+#include "libavutil/mem.h"
 #define NR_ALLPASS_BANDS20 30
 #define NR_ALLPASS_BANDS34 50
 #define PS_AP_LINKS 3
+#define TABLE_CONST
 static float pd_re_smooth[8*8*8];
 static float pd_im_smooth[8*8*8];
 static float HA[46][8][4];
 static float HB[46][8][4];
-static float f20_0_8 [ 8][7][2];
-static float f34_0_12[12][7][2];
-static float f34_1_8 [ 8][7][2];
-static float f34_2_4 [ 4][7][2];
-static float Q_fract_allpass[2][50][3][2];
-static float phi_fract[2][50][2];
+static DECLARE_ALIGNED(16, float, f20_0_8) [ 8][8][2];
+static DECLARE_ALIGNED(16, float, f34_0_12)[12][8][2];
+static DECLARE_ALIGNED(16, float, f34_1_8) [ 8][8][2];
+static DECLARE_ALIGNED(16, float, f34_2_4) [ 4][8][2];
+static TABLE_CONST DECLARE_ALIGNED(16, float, Q_fract_allpass)[2][50][3][2];
+static DECLARE_ALIGNED(16, float, phi_fract)[2][50][2];
 
 static const float g0_Q8[] = {
     0.00746082949812f, 0.02270420949825f, 0.04546865930473f, 0.07266113929591f,
@@ -65,7 +70,7 @@ static const float g2_Q4[] = {
      0.16486303567403f,  0.23279856662996f, 0.25f
 };
 
-static void make_filters_from_proto(float (*filter)[7][2], const float *proto, int bands)
+static void make_filters_from_proto(float (*filter)[8][2], const float *proto, int bands)
 {
     int q, n;
     for (q = 0; q < bands; q++) {
@@ -139,7 +144,7 @@ static void ps_tableinit(void)
     }
 
     for (iid = 0; iid < 46; iid++) {
-        float c = iid_par_dequant[iid]; //<Linear Inter-channel Intensity Difference
+        float c = iid_par_dequant[iid]; ///< Linear Inter-channel Intensity Difference
         float c1 = (float)M_SQRT2 / sqrtf(1.0f + c*c);
         float c2 = c * c1;
         for (icc = 0; icc < 8; icc++) {
@@ -189,7 +194,7 @@ static void ps_tableinit(void)
     for (k = 0; k < NR_ALLPASS_BANDS34; k++) {
         double f_center, theta;
         if (k < FF_ARRAY_ELEMS(f_center_34))
-            f_center = f_center_34[k] / 24.;
+            f_center = f_center_34[k] / 24.0;
         else
             f_center = k - 26.5f;
         for (m = 0; m < PS_AP_LINKS; m++) {