Mercurial > libavcodec.hg
annotate synth_filter.c @ 11229:d53e56a6228b libavcodec
Simplify determing whether fragments are coded
No measurable speed difference
author | conrad |
---|---|
date | Sun, 21 Feb 2010 00:11:01 +0000 |
parents | 90daf9b3083d |
children | 4b3da727d832 |
rev | line source |
---|---|
10467 | 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 "synth_filter.h" | |
22 | |
23 void ff_synth_filter_float(FFTContext *imdct, | |
10479 | 24 float *synth_buf_ptr, int *synth_buf_offset, |
25 float synth_buf2[32], const float window[512], | |
26 float out[32], const float in[32], float scale, float bias) | |
10467 | 27 { |
28 float *synth_buf= synth_buf_ptr + *synth_buf_offset; | |
29 int i, j; | |
30 | |
31 ff_imdct_half(imdct, synth_buf, in); | |
32 | |
33 for (i = 0; i < 16; i++){ | |
10482
90daf9b3083d
Change whitespace placement a little to improve readabiliy slightly.
michael
parents:
10479
diff
changeset
|
34 float a= synth_buf2[i ]; |
90daf9b3083d
Change whitespace placement a little to improve readabiliy slightly.
michael
parents:
10479
diff
changeset
|
35 float b= synth_buf2[i + 16]; |
10467 | 36 float c= 0; |
37 float d= 0; | |
38 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
|
39 a += window[i + j ]*(-synth_buf[15 - i + j ]); |
90daf9b3083d
Change whitespace placement a little to improve readabiliy slightly.
michael
parents:
10479
diff
changeset
|
40 b += window[i + j + 16]*( synth_buf[ i + j ]); |
90daf9b3083d
Change whitespace placement a little to improve readabiliy slightly.
michael
parents:
10479
diff
changeset
|
41 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
|
42 d += window[i + j + 48]*( synth_buf[31 - i + j ]); |
10467 | 43 } |
44 for ( ; j < 512; j += 64){ | |
10482
90daf9b3083d
Change whitespace placement a little to improve readabiliy slightly.
michael
parents:
10479
diff
changeset
|
45 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
|
46 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
|
47 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
|
48 d += window[i + j + 48]*( synth_buf[31 - i + j - 512]); |
10467 | 49 } |
10482
90daf9b3083d
Change whitespace placement a little to improve readabiliy slightly.
michael
parents:
10479
diff
changeset
|
50 out[i ] = a*scale + bias; |
90daf9b3083d
Change whitespace placement a little to improve readabiliy slightly.
michael
parents:
10479
diff
changeset
|
51 out[i + 16] = b*scale + bias; |
90daf9b3083d
Change whitespace placement a little to improve readabiliy slightly.
michael
parents:
10479
diff
changeset
|
52 synth_buf2[i ] = c; |
90daf9b3083d
Change whitespace placement a little to improve readabiliy slightly.
michael
parents:
10479
diff
changeset
|
53 synth_buf2[i + 16] = d; |
10467 | 54 } |
10482
90daf9b3083d
Change whitespace placement a little to improve readabiliy slightly.
michael
parents:
10479
diff
changeset
|
55 *synth_buf_offset= (*synth_buf_offset - 32)&511; |
10467 | 56 } |