aacps_tablegen.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 "aacps_tablegen.h"
26 #include "tableprint.h"
27 
28 void write_float_3d_array (const void *p, int b, int c, int d)
29 {
30  int i;
31  const float *f = p;
32  for (i = 0; i < b; i++) {
33  printf("{\n");
34  write_float_2d_array(f, c, d);
35  printf("},\n");
36  f += c * d;
37  }
38 }
39 
40 void write_float_4d_array (const void *p, int a, int b, int c, int d)
41 {
42  int i;
43  const float *f = p;
44  for (i = 0; i < a; i++) {
45  printf("{\n");
46  write_float_3d_array(f, b, c, d);
47  printf("},\n");
48  f += b * c * d;
49  }
50 }
51 
52 int main(void)
53 {
54  ps_tableinit();
55 
57 
58  printf("static const float pd_re_smooth[8*8*8] = {\n");
60  printf("};\n");
61  printf("static const float pd_im_smooth[8*8*8] = {\n");
63  printf("};\n");
64 
65  printf("static const float HA[46][8][4] = {\n");
66  write_float_3d_array(HA, 46, 8, 4);
67  printf("};\n");
68  printf("static const float HB[46][8][4] = {\n");
69  write_float_3d_array(HB, 46, 8, 4);
70  printf("};\n");
71 
72  printf("static const DECLARE_ALIGNED(16, float, f20_0_8)[8][8][2] = {\n");
73  write_float_3d_array(f20_0_8, 8, 8, 2);
74  printf("};\n");
75  printf("static const DECLARE_ALIGNED(16, float, f34_0_12)[12][8][2] = {\n");
76  write_float_3d_array(f34_0_12, 12, 8, 2);
77  printf("};\n");
78  printf("static const DECLARE_ALIGNED(16, float, f34_1_8)[8][8][2] = {\n");
79  write_float_3d_array(f34_1_8, 8, 8, 2);
80  printf("};\n");
81  printf("static const DECLARE_ALIGNED(16, float, f34_2_4)[4][8][2] = {\n");
82  write_float_3d_array(f34_2_4, 4, 8, 2);
83  printf("};\n");
84 
85  printf("static const DECLARE_ALIGNED(16, float, Q_fract_allpass)[2][50][3][2] = {\n");
86  write_float_4d_array(Q_fract_allpass, 2, 50, 3, 2);
87  printf("};\n");
88  printf("static const DECLARE_ALIGNED(16, float, phi_fract)[2][50][2] = {\n");
89  write_float_3d_array(phi_fract, 2, 50, 2);
90  printf("};\n");
91 
92  return 0;
93 }
Sinusoidal phase f
static float pd_im_smooth[8 *8 *8]
set threshold d
void write_float_2d_array(const void *, int, int)
#define b
Definition: input.c:42
void write_float_3d_array(const void *p, int b, int c, int d)
void write_float_4d_array(const void *p, int a, int b, int c, int d)
void write_float_array(const float *, int)
static float HA[46][8][4]
static float pd_re_smooth[8 *8 *8]
write_fileheader() adds some minor things like a"this is a generated file"comment and some standard includes.tablegen.h defines some write functions for one-and two-dimensional arrays for standard types-they print only the"core"parts so they are easier to reuse for multi-dimensional arrays so the outermost
Definition: tablegen.txt:39
int main(void)
synthesis window for stochastic i
static void ps_tableinit(void)
static float HB[46][8][4]
static double c[64]
printf("static const uint8_t my_array[100] = {\n")