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.

70 lines
2.5KB

  1. /*
  2. * copyright (c) 2008 Michael Niedermayer <michaelni@gmx.at>
  3. *
  4. * This file is part of Libav.
  5. *
  6. * Libav is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * Libav is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with Libav; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #include "fft.h"
  21. #include "synth_filter.h"
  22. static void synth_filter_float(FFTContext *imdct,
  23. float *synth_buf_ptr, int *synth_buf_offset,
  24. float synth_buf2[32], const float window[512],
  25. float out[32], const float in[32], float scale)
  26. {
  27. float *synth_buf= synth_buf_ptr + *synth_buf_offset;
  28. int i, j;
  29. imdct->imdct_half(imdct, synth_buf, in);
  30. for (i = 0; i < 16; i++){
  31. float a= synth_buf2[i ];
  32. float b= synth_buf2[i + 16];
  33. float c= 0;
  34. float d= 0;
  35. for (j = 0; j < 512 - *synth_buf_offset; j += 64){
  36. a += window[i + j ]*(-synth_buf[15 - i + j ]);
  37. b += window[i + j + 16]*( synth_buf[ i + j ]);
  38. c += window[i + j + 32]*( synth_buf[16 + i + j ]);
  39. d += window[i + j + 48]*( synth_buf[31 - i + j ]);
  40. }
  41. for ( ; j < 512; j += 64){
  42. a += window[i + j ]*(-synth_buf[15 - i + j - 512]);
  43. b += window[i + j + 16]*( synth_buf[ i + j - 512]);
  44. c += window[i + j + 32]*( synth_buf[16 + i + j - 512]);
  45. d += window[i + j + 48]*( synth_buf[31 - i + j - 512]);
  46. }
  47. out[i ] = a*scale;
  48. out[i + 16] = b*scale;
  49. synth_buf2[i ] = c;
  50. synth_buf2[i + 16] = d;
  51. }
  52. *synth_buf_offset= (*synth_buf_offset - 32)&511;
  53. }
  54. av_cold void ff_synth_filter_init(SynthFilterContext *c)
  55. {
  56. c->synth_filter_float = synth_filter_float;
  57. if (ARCH_AARCH64)
  58. ff_synth_filter_init_aarch64(c);
  59. if (ARCH_ARM)
  60. ff_synth_filter_init_arm(c);
  61. if (ARCH_X86)
  62. ff_synth_filter_init_x86(c);
  63. }