annotate synth_filter.c @ 11543:965eca23972e libavcodec

libxvid: Clear extradata pointer when freeing it. Fixes crash when avcodec_close() tried freeing it again. Fixes issue 1846.
author ramiro
date Fri, 26 Mar 2010 04:12:28 +0000
parents 4b3da727d832
children 18f17f44de37
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10467
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
1 /*
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
2 * copyright (c) 2008 Michael Niedermayer <michaelni@gmx.at>
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
3 *
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
4 * This file is part of FFmpeg.
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
5 *
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
6 * FFmpeg is free software; you can redistribute it and/or
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
8 * License as published by the Free Software Foundation; either
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
9 * version 2.1 of the License, or (at your option) any later version.
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
10 *
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
11 * FFmpeg is distributed in the hope that it will be useful,
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
14 * Lesser General Public License for more details.
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
15 *
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
17 * License along with FFmpeg; if not, write to the Free Software
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
19 */
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
20
11370
4b3da727d832 Move FFT parts from dsputil.h to fft.h
mru
parents: 10482
diff changeset
21 #include "fft.h"
10467
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
22 #include "synth_filter.h"
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
23
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
24 void ff_synth_filter_float(FFTContext *imdct,
10479
bc20a950f9a7 Vertically align function arguments.
michael
parents: 10467
diff changeset
25 float *synth_buf_ptr, int *synth_buf_offset,
bc20a950f9a7 Vertically align function arguments.
michael
parents: 10467
diff changeset
26 float synth_buf2[32], const float window[512],
bc20a950f9a7 Vertically align function arguments.
michael
parents: 10467
diff changeset
27 float out[32], const float in[32], float scale, float bias)
10467
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
28 {
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
29 float *synth_buf= synth_buf_ptr + *synth_buf_offset;
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
30 int i, j;
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
31
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
32 ff_imdct_half(imdct, synth_buf, in);
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
33
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
34 for (i = 0; i < 16; i++){
10482
90daf9b3083d Change whitespace placement a little to improve readabiliy slightly.
michael
parents: 10479
diff changeset
35 float a= synth_buf2[i ];
90daf9b3083d Change whitespace placement a little to improve readabiliy slightly.
michael
parents: 10479
diff changeset
36 float b= synth_buf2[i + 16];
10467
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
37 float c= 0;
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
38 float d= 0;
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
39 for (j = 0; j < 512 - *synth_buf_offset; j += 64){
10482
90daf9b3083d Change whitespace placement a little to improve readabiliy slightly.
michael
parents: 10479
diff changeset
40 a += window[i + j ]*(-synth_buf[15 - i + j ]);
90daf9b3083d Change whitespace placement a little to improve readabiliy slightly.
michael
parents: 10479
diff changeset
41 b += window[i + j + 16]*( synth_buf[ i + j ]);
90daf9b3083d Change whitespace placement a little to improve readabiliy slightly.
michael
parents: 10479
diff changeset
42 c += window[i + j + 32]*( synth_buf[16 + i + j ]);
90daf9b3083d Change whitespace placement a little to improve readabiliy slightly.
michael
parents: 10479
diff changeset
43 d += window[i + j + 48]*( synth_buf[31 - i + j ]);
10467
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
44 }
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
45 for ( ; j < 512; j += 64){
10482
90daf9b3083d Change whitespace placement a little to improve readabiliy slightly.
michael
parents: 10479
diff changeset
46 a += window[i + j ]*(-synth_buf[15 - i + j - 512]);
90daf9b3083d Change whitespace placement a little to improve readabiliy slightly.
michael
parents: 10479
diff changeset
47 b += window[i + j + 16]*( synth_buf[ i + j - 512]);
90daf9b3083d Change whitespace placement a little to improve readabiliy slightly.
michael
parents: 10479
diff changeset
48 c += window[i + j + 32]*( synth_buf[16 + i + j - 512]);
90daf9b3083d Change whitespace placement a little to improve readabiliy slightly.
michael
parents: 10479
diff changeset
49 d += window[i + j + 48]*( synth_buf[31 - i + j - 512]);
10467
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
50 }
10482
90daf9b3083d Change whitespace placement a little to improve readabiliy slightly.
michael
parents: 10479
diff changeset
51 out[i ] = a*scale + bias;
90daf9b3083d Change whitespace placement a little to improve readabiliy slightly.
michael
parents: 10479
diff changeset
52 out[i + 16] = b*scale + bias;
90daf9b3083d Change whitespace placement a little to improve readabiliy slightly.
michael
parents: 10479
diff changeset
53 synth_buf2[i ] = c;
90daf9b3083d Change whitespace placement a little to improve readabiliy slightly.
michael
parents: 10479
diff changeset
54 synth_buf2[i + 16] = d;
10467
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
55 }
10482
90daf9b3083d Change whitespace placement a little to improve readabiliy slightly.
michael
parents: 10479
diff changeset
56 *synth_buf_offset= (*synth_buf_offset - 32)&511;
10467
212a837ebd27 Split synth filter out of dca.c.
michael
parents:
diff changeset
57 }