You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
2.9KB

  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 Libav.
  7. *
  8. * Libav 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. * Libav 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 Libav; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. */
  22. #include <stdlib.h>
  23. #define CONFIG_HARDCODED_TABLES 0
  24. #include "aacps_tablegen.h"
  25. #include "tableprint.h"
  26. void write_float_3d_array (const void *p, int b, int c, int d)
  27. {
  28. int i;
  29. const float *f = p;
  30. for (i = 0; i < b; i++) {
  31. printf("{\n");
  32. write_float_2d_array(f, c, d);
  33. printf("},\n");
  34. f += c * d;
  35. }
  36. }
  37. void write_float_4d_array (const void *p, int a, int b, int c, int d)
  38. {
  39. int i;
  40. const float *f = p;
  41. for (i = 0; i < a; i++) {
  42. printf("{\n");
  43. write_float_3d_array(f, b, c, d);
  44. printf("},\n");
  45. f += b * c * d;
  46. }
  47. }
  48. int main(void)
  49. {
  50. ps_tableinit();
  51. write_fileheader();
  52. printf("static const float pd_re_smooth[8*8*8] = {\n");
  53. write_float_array(pd_re_smooth, 8*8*8);
  54. printf("};\n");
  55. printf("static const float pd_im_smooth[8*8*8] = {\n");
  56. write_float_array(pd_im_smooth, 8*8*8);
  57. printf("};\n");
  58. printf("static const float HA[46][8][4] = {\n");
  59. write_float_3d_array(HA, 46, 8, 4);
  60. printf("};\n");
  61. printf("static const float HB[46][8][4] = {\n");
  62. write_float_3d_array(HB, 46, 8, 4);
  63. printf("};\n");
  64. printf("static const DECLARE_ALIGNED(16, float, f20_0_8)[8][8][2] = {\n");
  65. write_float_3d_array(f20_0_8, 8, 8, 2);
  66. printf("};\n");
  67. printf("static const DECLARE_ALIGNED(16, float, f34_0_12)[12][8][2] = {\n");
  68. write_float_3d_array(f34_0_12, 12, 8, 2);
  69. printf("};\n");
  70. printf("static const DECLARE_ALIGNED(16, float, f34_1_8)[8][8][2] = {\n");
  71. write_float_3d_array(f34_1_8, 8, 8, 2);
  72. printf("};\n");
  73. printf("static const DECLARE_ALIGNED(16, float, f34_2_4)[4][8][2] = {\n");
  74. write_float_3d_array(f34_2_4, 4, 8, 2);
  75. printf("};\n");
  76. printf("static TABLE_CONST DECLARE_ALIGNED(16, float, Q_fract_allpass)[2][50][3][2] = {\n");
  77. write_float_4d_array(Q_fract_allpass, 2, 50, 3, 2);
  78. printf("};\n");
  79. printf("static const DECLARE_ALIGNED(16, float, phi_fract)[2][50][2] = {\n");
  80. write_float_3d_array(phi_fract, 2, 50, 2);
  81. printf("};\n");
  82. return 0;
  83. }