Mercurial > libavcodec.hg
annotate costablegen.c @ 10406:825c7f57cfac libavcodec
Remove silly casts to the same type as we already have.
author | reimar |
---|---|
date | Thu, 15 Oct 2009 17:19:07 +0000 |
parents | 866dffa620d1 |
children | 57acce8b1380 |
rev | line source |
---|---|
10400
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
1 /* |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
2 * Generate a header file for hardcoded ff_cos_* tables |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
3 * |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
4 * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger@gmx.de> |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
5 * |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
6 * This file is part of FFmpeg. |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
7 * |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
8 * FFmpeg is free software; you can redistribute it and/or |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
10 * License as published by the Free Software Foundation; either |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
11 * version 2.1 of the License, or (at your option) any later version. |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
12 * |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
13 * FFmpeg is distributed in the hope that it will be useful, |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
16 * Lesser General Public License for more details. |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
17 * |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
19 * License along with FFmpeg; if not, write to the Free Software |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
21 */ |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
22 |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
23 #include <stdio.h> |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
24 #include <math.h> |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
25 |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
26 #ifndef M_PI |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
27 #define M_PI 3.14159265358979323846 |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
28 #endif |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
29 #define BITS 16 |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
30 #define FLOATFMT "%.18e" |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
31 |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
32 int main(void) |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
33 { |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
34 int i, j; |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
35 printf("/* This file was generated by libavcodec/costablegen */\n"); |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
36 printf("#include \"dsputil.h\"\n"); |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
37 for (i = 4; i <= BITS; i++) { |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
38 int m = 1 << i; |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
39 double freq = 2*M_PI/m; |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
40 printf("const DECLARE_ALIGNED_16(FFTSample, ff_cos_%i[]) = {\n ", m); |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
41 for (j = 0; j < m/2 - 1; j++) { |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
42 int idx = j > m/4 ? m/2 - j : j; |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
43 printf(" "FLOATFMT",", cos(idx*freq)); |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
44 if ((j & 3) == 3) |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
45 printf("\n "); |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
46 } |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
47 printf(" "FLOATFMT"\n};\n", cos(freq)); |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
48 } |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
49 return 0; |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
50 } |