Mercurial > libavcodec.hg
annotate costablegen.c @ 12043:f9a0bd0888a4 libavcodec
mpegaudio: call ff_mpegaudiodec_init_mmx() only from float decoder
The mmx code is floating-point only, and this function does not know
from which decoder it is called. Without this change, the integer
decoder only "works" because the size of the context struct is smaller
in this case, and the mmx init function writes the function pointer
outside the allocated context.
author | mru |
---|---|
date | Thu, 01 Jul 2010 23:21:17 +0000 |
parents | 351d1c11195b |
children |
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> |
10408 | 24 #include <string.h> |
10400
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
25 #include <math.h> |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
26 |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
27 #ifndef M_PI |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
28 #define M_PI 3.14159265358979323846 |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
29 #endif |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
30 #define BITS 16 |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
31 #define FLOATFMT "%.18e" |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
32 |
10408 | 33 int main(int argc, char *argv[]) |
10400
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
34 { |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
35 int i, j; |
10408 | 36 int do_sin = argc == 2 && !strcmp(argv[1], "sin"); |
37 double (*func)(double) = do_sin ? sin : cos; | |
38 | |
10400
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
39 printf("/* This file was generated by libavcodec/costablegen */\n"); |
11385
351d1c11195b
Fix --enable-hardcoded-tables compilation: the generate table files now
reimar
parents:
10473
diff
changeset
|
40 printf("#include \"libavcodec/fft.h\"\n"); |
10400
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
41 for (i = 4; i <= BITS; i++) { |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
42 int m = 1 << i; |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
43 double freq = 2*M_PI/m; |
10408 | 44 printf("%s(%i) = {\n ", do_sin ? "SINTABLE" : "COSTABLE", m); |
10400
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
45 for (j = 0; j < m/2 - 1; j++) { |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
46 int idx = j > m/4 ? m/2 - j : j; |
10408 | 47 if (do_sin && j >= m/4) |
48 idx = m/4 - j; | |
49 printf(" "FLOATFMT",", func(idx*freq)); | |
10400
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
50 if ((j & 3) == 3) |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
51 printf("\n "); |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
52 } |
10408 | 53 printf(" "FLOATFMT"\n};\n", func(do_sin ? -(m/4 - 1)*freq : freq)); |
10400
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
54 } |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
55 return 0; |
866dffa620d1
Use hardcoded instead of runtime-calculated ff_cos_* tables if
reimar
parents:
diff
changeset
|
56 } |