• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

libavcodec/aacps_tablegen.c

Go to the documentation of this file.
00001 /*
00002  * Generate a header file for hardcoded Parametric Stereo tables
00003  *
00004  * Copyright (c) 2010 Alex Converse <alex.converse@gmail.com>
00005  *
00006  * This file is part of FFmpeg.
00007  *
00008  * FFmpeg is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Lesser General Public
00010  * License as published by the Free Software Foundation; either
00011  * version 2.1 of the License, or (at your option) any later version.
00012  *
00013  * FFmpeg is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  * Lesser General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with FFmpeg; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00021  */
00022 
00023 #include <stdlib.h>
00024 #define CONFIG_HARDCODED_TABLES 0
00025 #include "aacps_tablegen.h"
00026 #include "tableprint.h"
00027 
00028 void write_float_3d_array (const void *p, int b, int c, int d)
00029 {
00030     int i;
00031     const float *f = p;
00032     for (i = 0; i < b; i++) {
00033         printf("{\n");
00034         write_float_2d_array(f, c, d);
00035         printf("},\n");
00036         f += c * d;
00037     }
00038 }
00039 
00040 void write_float_4d_array (const void *p, int a, int b, int c, int d)
00041 {
00042     int i;
00043     const float *f = p;
00044     for (i = 0; i < a; i++) {
00045         printf("{\n");
00046         write_float_3d_array(f, b, c, d);
00047         printf("},\n");
00048         f += b * c * d;
00049     }
00050 }
00051 
00052 int main(void)
00053 {
00054     ps_tableinit();
00055 
00056     write_fileheader();
00057 
00058     printf("static const float pd_re_smooth[8*8*8] = {\n");
00059     write_float_array(pd_re_smooth, 8*8*8);
00060     printf("};\n");
00061     printf("static const float pd_im_smooth[8*8*8] = {\n");
00062     write_float_array(pd_im_smooth, 8*8*8);
00063     printf("};\n");
00064 
00065     printf("static const float HA[46][8][4] = {\n");
00066     write_float_3d_array(HA, 46, 8, 4);
00067     printf("};\n");
00068     printf("static const float HB[46][8][4] = {\n");
00069     write_float_3d_array(HB, 46, 8, 4);
00070     printf("};\n");
00071 
00072     printf("static const float f20_0_8[8][7][2] = {\n");
00073     write_float_3d_array(f20_0_8, 8, 7, 2);
00074     printf("};\n");
00075     printf("static const float f34_0_12[12][7][2] = {\n");
00076     write_float_3d_array(f34_0_12, 12, 7, 2);
00077     printf("};\n");
00078     printf("static const float f34_1_8[8][7][2] = {\n");
00079     write_float_3d_array(f34_1_8, 8, 7, 2);
00080     printf("};\n");
00081     printf("static const float f34_2_4[4][7][2] = {\n");
00082     write_float_3d_array(f34_2_4, 4, 7, 2);
00083     printf("};\n");
00084 
00085     printf("static const float Q_fract_allpass[2][50][3][2] = {\n");
00086     write_float_4d_array(Q_fract_allpass, 2, 50, 3, 2);
00087     printf("};\n");
00088     printf("static const float phi_fract[2][50][2] = {\n");
00089     write_float_3d_array(phi_fract, 2, 50, 2);
00090     printf("};\n");
00091 
00092     return 0;
00093 }

Generated on Fri Sep 16 2011 17:17:33 for FFmpeg by  doxygen 1.7.1