Mercurial > libavcodec.hg
annotate mdct_tablegen.h @ 11300:1f512abdf680 libavcodec
Simplify code to set cbp_*
this seems 1 cpu cycle slower even though we practically just remove code.
Speed loss seems caused by the merge of if(left_type), iam commiting this
anyway as i cant imagine this to be anything but compiler messup.
author | michael |
---|---|
date | Fri, 26 Feb 2010 09:13:40 +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 } |