annotate aacps_tablegen.c @ 12212:bc13f76ecfbf libavcodec

sync yasm macros from x264
author lorenm
date Wed, 21 Jul 2010 22:45:16 +0000
parents 8c657be75c11
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11922
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
1 /*
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
2 * Generate a header file for hardcoded Parametric Stereo tables
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
3 *
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
4 * Copyright (c) 2010 Alex Converse <alex.converse@gmail.com>
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
5 *
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
6 * This file is part of FFmpeg.
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
7 *
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
8 * FFmpeg is free software; you can redistribute it and/or
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
9 * modify it under the terms of the GNU Lesser General Public
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
10 * License as published by the Free Software Foundation; either
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
11 * version 2.1 of the License, or (at your option) any later version.
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
12 *
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
13 * FFmpeg is distributed in the hope that it will be useful,
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
16 * Lesser General Public License for more details.
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
17 *
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
19 * License along with FFmpeg; if not, write to the Free Software
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
21 */
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
22
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
23 #include <stdlib.h>
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
24 #define CONFIG_HARDCODED_TABLES 0
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
25 #include "aacps_tablegen.h"
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
26 #include "tableprint.h"
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
27
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
28 void write_float_3d_array (const void *p, int b, int c, int d)
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
29 {
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
30 int i;
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
31 const float *f = p;
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
32 for (i = 0; i < b; i++) {
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
33 printf("{\n");
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
34 write_float_2d_array(f, c, d);
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
35 printf("},\n");
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
36 f += c * d;
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
37 }
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
38 }
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
39
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
40 void write_float_4d_array (const void *p, int a, int b, int c, int d)
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
41 {
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
42 int i;
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
43 const float *f = p;
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
44 for (i = 0; i < a; i++) {
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
45 printf("{\n");
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
46 write_float_3d_array(f, b, c, d);
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
47 printf("},\n");
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
48 f += b * c * d;
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
49 }
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
50 }
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
51
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
52 int main(void)
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
53 {
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
54 ps_tableinit();
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
55
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
56 write_fileheader();
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
57
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
58 printf("static const float pd_re_smooth[8*8*8] = {\n");
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
59 write_float_array(pd_re_smooth, 8*8*8);
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
60 printf("};\n");
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
61 printf("static const float pd_im_smooth[8*8*8] = {\n");
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
62 write_float_array(pd_im_smooth, 8*8*8);
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
63 printf("};\n");
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
64
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
65 printf("static const float HA[46][8][4] = {\n");
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
66 write_float_3d_array(HA, 46, 8, 4);
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
67 printf("};\n");
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
68 printf("static const float HB[46][8][4] = {\n");
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
69 write_float_3d_array(HB, 46, 8, 4);
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
70 printf("};\n");
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
71
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
72 printf("static const float f20_0_8[8][7][2] = {\n");
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
73 write_float_3d_array(f20_0_8, 8, 7, 2);
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
74 printf("};\n");
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
75 printf("static const float f34_0_12[12][7][2] = {\n");
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
76 write_float_3d_array(f34_0_12, 12, 7, 2);
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
77 printf("};\n");
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
78 printf("static const float f34_1_8[8][7][2] = {\n");
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
79 write_float_3d_array(f34_1_8, 8, 7, 2);
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
80 printf("};\n");
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
81 printf("static const float f34_2_4[4][7][2] = {\n");
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
82 write_float_3d_array(f34_2_4, 4, 7, 2);
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
83 printf("};\n");
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
84
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
85 printf("static const float Q_fract_allpass[2][50][3][2] = {\n");
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
86 write_float_4d_array(Q_fract_allpass, 2, 50, 3, 2);
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
87 printf("};\n");
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
88 printf("static const float phi_fract[2][50][2] = {\n");
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
89 write_float_3d_array(phi_fract, 2, 50, 2);
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
90 printf("};\n");
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
91
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
92 return 0;
8c657be75c11 Move Parametric Stereo related ps* files to aacps*.
alexc
parents:
diff changeset
93 }