Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * copyright (c) 2008 Michael Niedermayer <michaelni@gmx.at>
  3.  *
  4.  * This file is part of FFmpeg.
  5.  *
  6.  * FFmpeg 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.  * FFmpeg 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 FFmpeg; if not, write to the Free Software
  18.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19.  */
  20.  
  21. #include "fft.h"
  22. #include "synth_filter.h"
  23.  
  24. static void synth_filter_float(FFTContext *imdct,
  25.                            float *synth_buf_ptr, int *synth_buf_offset,
  26.                            float synth_buf2[32], const float window[512],
  27.                            float out[32], const float in[32], float scale)
  28. {
  29.     float *synth_buf= synth_buf_ptr + *synth_buf_offset;
  30.     int i, j;
  31.  
  32.     imdct->imdct_half(imdct, synth_buf, in);
  33.  
  34.     for (i = 0; i < 16; i++){
  35.         float a= synth_buf2[i     ];
  36.         float b= synth_buf2[i + 16];
  37.         float c= 0;
  38.         float d= 0;
  39.         for (j = 0; j < 512 - *synth_buf_offset; j += 64){
  40.             a += window[i + j     ]*(-synth_buf[15 - i + j      ]);
  41.             b += window[i + j + 16]*( synth_buf[     i + j      ]);
  42.             c += window[i + j + 32]*( synth_buf[16 + i + j      ]);
  43.             d += window[i + j + 48]*( synth_buf[31 - i + j      ]);
  44.         }
  45.         for (     ; j < 512; j += 64){
  46.             a += window[i + j     ]*(-synth_buf[15 - i + j - 512]);
  47.             b += window[i + j + 16]*( synth_buf[     i + j - 512]);
  48.             c += window[i + j + 32]*( synth_buf[16 + i + j - 512]);
  49.             d += window[i + j + 48]*( synth_buf[31 - i + j - 512]);
  50.         }
  51.         out[i     ] = a*scale;
  52.         out[i + 16] = b*scale;
  53.         synth_buf2[i     ] = c;
  54.         synth_buf2[i + 16] = d;
  55.     }
  56.     *synth_buf_offset= (*synth_buf_offset - 32)&511;
  57. }
  58.  
  59. av_cold void ff_synth_filter_init(SynthFilterContext *c)
  60. {
  61.     c->synth_filter_float = synth_filter_float;
  62.  
  63.     if (ARCH_ARM) ff_synth_filter_init_arm(c);
  64. }
  65.