FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
aacps_tablegen_template.c
Go to the documentation of this file.
1 /*
2  * Generate a header file for hardcoded Parametric Stereo tables
3  *
4  * Copyright (c) 2010 Alex Converse <alex.converse@gmail.com>
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 #include <stdlib.h>
24 #define CONFIG_HARDCODED_TABLES 0
25 #include "aac_defines.h"
26 
27 #if USE_FIXED
28 #define TYPE_NAME "int32_t"
29 typedef int32_t INT32FLOAT;
30 #define ARRAY_RENAME(x) write_int32_t_ ## x
31 #define ARRAY_URENAME(x) write_uint32_t_ ## x
32 #include "aacps_fixed_tablegen.h"
33 #else
34 #define TYPE_NAME "float"
35 typedef float INT32FLOAT;
36 #define ARRAY_RENAME(x) write_float_ ## x
37 #define ARRAY_URENAME(x) write_float_ ## x
38 #include "aacps_tablegen.h"
39 #endif /* USE_FIXED */
40 #include "tableprint.h"
41 
42 void ARRAY_RENAME(3d_array) (const void *p, int b, int c, int d)
43 {
44  int i;
45  const INT32FLOAT *f = p;
46  for (i = 0; i < b; i++) {
47  printf("{\n");
48  ARRAY_URENAME(2d_array)(f, c, d);
49  printf("},\n");
50  f += c * d;
51  }
52 }
53 
54 void ARRAY_RENAME(4d_array) (const void *p, int a, int b, int c, int d)
55 {
56  int i;
57  const INT32FLOAT *f = p;
58  for (i = 0; i < a; i++) {
59  printf("{\n");
60  ARRAY_RENAME(3d_array)(f, b, c, d);
61  printf("},\n");
62  f += b * c * d;
63  }
64 }
65 
66 int main(void)
67 {
68  ps_tableinit();
69 
71 
72  printf("static const %s pd_re_smooth[8*8*8] = {\n", TYPE_NAME);
73  ARRAY_RENAME(array)(pd_re_smooth, 8*8*8);
74  printf("};\n");
75  printf("static const %s pd_im_smooth[8*8*8] = {\n", TYPE_NAME);
76  ARRAY_RENAME(array)(pd_im_smooth, 8*8*8);
77  printf("};\n");
78 
79  printf("static const %s HA[46][8][4] = {\n", TYPE_NAME);
80  ARRAY_RENAME(3d_array)(HA, 46, 8, 4);
81  printf("};\n");
82  printf("static const %s HB[46][8][4] = {\n", TYPE_NAME);
83  ARRAY_RENAME(3d_array)(HB, 46, 8, 4);
84  printf("};\n");
85 
86  printf("static const DECLARE_ALIGNED(16, %s, f20_0_8)[8][8][2] = {\n", TYPE_NAME);
87  ARRAY_RENAME(3d_array)(f20_0_8, 8, 8, 2);
88  printf("};\n");
89  printf("static const DECLARE_ALIGNED(16, %s, f34_0_12)[12][8][2] = {\n", TYPE_NAME);
90  ARRAY_RENAME(3d_array)(f34_0_12, 12, 8, 2);
91  printf("};\n");
92  printf("static const DECLARE_ALIGNED(16, %s, f34_1_8)[8][8][2] = {\n", TYPE_NAME);
93  ARRAY_RENAME(3d_array)(f34_1_8, 8, 8, 2);
94  printf("};\n");
95  printf("static const DECLARE_ALIGNED(16, %s, f34_2_4)[4][8][2] = {\n", TYPE_NAME);
96  ARRAY_RENAME(3d_array)(f34_2_4, 4, 8, 2);
97  printf("};\n");
98 
99  printf("static const DECLARE_ALIGNED(16, %s, Q_fract_allpass)[2][50][3][2] = {\n", TYPE_NAME);
100  ARRAY_RENAME(4d_array)(Q_fract_allpass, 2, 50, 3, 2);
101  printf("};\n");
102  printf("static const DECLARE_ALIGNED(16, %s, phi_fract)[2][50][2] = {\n", TYPE_NAME);
103  ARRAY_RENAME(3d_array)(phi_fract, 2, 50, 2);
104  printf("};\n");
105 
106  return 0;
107 }
static int HA[46][8][4]
static TABLE_CONST int Q_fract_allpass[2][50][3][2]
const char * b
Definition: vf_curves.c:109
static int pd_im_smooth[8 *8 *8]
#define TYPE_NAME
#define ARRAY_RENAME(x)
static int f34_0_12[12][8][2]
static int phi_fract[2][50][2]
static int f34_1_8[8][8][2]
float INT32FLOAT
int32_t
static int HB[46][8][4]
static void ps_tableinit(void)
#define ARRAY_URENAME(x)
static double c[64]
int main(void)
static int pd_re_smooth[8 *8 *8]
static int f34_2_4[4][8][2]
static int f20_0_8[8][8][2]
static void write_fileheader(void)
Definition: tableprint.h:128