Mercurial > libavcodec.hg
annotate mdct_tablegen.h @ 11032:01bd040f8607 libavcodec
Unroll main loop so the edge==0 case is seperate.
This allows many things to be simplified away.
h264 decoder is overall 1% faster with a mbaff sample and
0.1% slower with the cathedral sample, probably because the slow loop
filter code must be loaded into the code cache for each first MB of each
row but isnt used for the following MBs.
| author | michael |
|---|---|
| date | Thu, 28 Jan 2010 01:24:25 +0000 |
| parents | aa3997d8eee7 |
| children | 8bef88bc329d |
| rev | line source |
|---|---|
|
10827
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
1 /* |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
2 * Header file for hardcoded MDCT tables |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
3 * |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
4 * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger@gmx.de> |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
5 * |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
6 * This file is part of FFmpeg. |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
7 * |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
8 * FFmpeg is free software; you can redistribute it and/or |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
10 * License as published by the Free Software Foundation; either |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
11 * version 2.1 of the License, or (at your option) any later version. |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
12 * |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
13 * FFmpeg is distributed in the hope that it will be useful, |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
16 * Lesser General Public License for more details. |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
17 * |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
19 * License along with FFmpeg; if not, write to the Free Software |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
21 */ |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
22 |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
23 #include <assert.h> |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
24 // do not use libavutil/mathematics.h since this is compiled both |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
25 // for the host and the target and config.h is only valid for the target |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
26 #include <math.h> |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
27 |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
28 #if !CONFIG_HARDCODED_TABLES |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
29 SINETABLE( 32); |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
30 SINETABLE( 64); |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
31 SINETABLE( 128); |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
32 SINETABLE( 256); |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
33 SINETABLE( 512); |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
34 SINETABLE(1024); |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
35 SINETABLE(2048); |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
36 SINETABLE(4096); |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
37 #else |
| 10887 | 38 #include "libavcodec/mdct_tables.h" |
|
10827
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
39 #endif |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
40 |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
41 SINETABLE_CONST float * const ff_sine_windows[] = { |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
42 NULL, NULL, NULL, NULL, NULL, // unused |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
43 ff_sine_32 , ff_sine_64 , |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
44 ff_sine_128, ff_sine_256, ff_sine_512, ff_sine_1024, ff_sine_2048, ff_sine_4096 |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
45 }; |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
46 |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
47 // Generate a sine window. |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
48 av_cold void ff_sine_window_init(float *window, int n) { |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
49 int i; |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
50 for(i = 0; i < n; i++) |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
51 window[i] = sinf((i + 0.5) * (M_PI / (2.0 * n))); |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
52 } |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
53 |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
54 av_cold void ff_init_ff_sine_windows(int index) { |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
55 assert(index >= 0 && index < FF_ARRAY_ELEMS(ff_sine_windows)); |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
56 #if !CONFIG_HARDCODED_TABLES |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
57 ff_sine_window_init(ff_sine_windows[index], 1 << index); |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
58 #endif |
|
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
59 } |
