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

libavcodec/synth_filter.c

Go to the documentation of this file.
00001 /*
00002  * copyright (c) 2008 Michael Niedermayer <michaelni@gmx.at>
00003  *
00004  * This file is part of FFmpeg.
00005  *
00006  * FFmpeg is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * FFmpeg is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with FFmpeg; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00019  */
00020 
00021 #include "fft.h"
00022 #include "synth_filter.h"
00023 
00024 static void synth_filter_float(FFTContext *imdct,
00025                            float *synth_buf_ptr, int *synth_buf_offset,
00026                            float synth_buf2[32], const float window[512],
00027                            float out[32], const float in[32], float scale, float bias)
00028 {
00029     float *synth_buf= synth_buf_ptr + *synth_buf_offset;
00030     int i, j;
00031 
00032     ff_imdct_half(imdct, synth_buf, in);
00033 
00034     for (i = 0; i < 16; i++){
00035         float a= synth_buf2[i     ];
00036         float b= synth_buf2[i + 16];
00037         float c= 0;
00038         float d= 0;
00039         for (j = 0; j < 512 - *synth_buf_offset; j += 64){
00040             a += window[i + j     ]*(-synth_buf[15 - i + j      ]);
00041             b += window[i + j + 16]*( synth_buf[     i + j      ]);
00042             c += window[i + j + 32]*( synth_buf[16 + i + j      ]);
00043             d += window[i + j + 48]*( synth_buf[31 - i + j      ]);
00044         }
00045         for (     ; j < 512; j += 64){
00046             a += window[i + j     ]*(-synth_buf[15 - i + j - 512]);
00047             b += window[i + j + 16]*( synth_buf[     i + j - 512]);
00048             c += window[i + j + 32]*( synth_buf[16 + i + j - 512]);
00049             d += window[i + j + 48]*( synth_buf[31 - i + j - 512]);
00050         }
00051         out[i     ] = a*scale + bias;
00052         out[i + 16] = b*scale + bias;
00053         synth_buf2[i     ] = c;
00054         synth_buf2[i + 16] = d;
00055     }
00056     *synth_buf_offset= (*synth_buf_offset - 32)&511;
00057 }
00058 
00059 av_cold void ff_synth_filter_init(SynthFilterContext *c)
00060 {
00061     c->synth_filter_float = synth_filter_float;
00062 
00063     if (ARCH_ARM) ff_synth_filter_init_arm(c);
00064 }

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