Mercurial > libavcodec.hg
annotate mdct_tablegen.c @ 12494:94eaea836bf4 libavcodec
Check avctx width/height more thoroughly (e.g. all values 0 except width would
have been accepted before).
Also do not fail if they are invalid but instead override them to 0.
This allows decoding e.g. MPEG video when only the container values are corrupted.
For encoding a value of 0,0 of course makes no sense, but was allowed
through before and will be caught by an extra check in the encode function.
author | reimar |
---|---|
date | Wed, 15 Sep 2010 04:46:55 +0000 |
parents | e03e3df6fb7d |
children |
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 * Generate a 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 <stdlib.h> |
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
24 #define CONFIG_HARDCODED_TABLES 0 |
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
25 #define SINETABLE_CONST |
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
26 #define SINETABLE(size) \ |
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
27 float ff_sine_##size[size] |
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
28 #define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) |
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
29 #ifndef M_PI |
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
30 #define M_PI 3.14159265358979323846 |
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
31 #endif |
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
32 #include "mdct_tablegen.h" |
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
33 #include "tableprint.h" |
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
34 |
11570 | 35 int main(void) |
10827
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
36 { |
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
37 int i; |
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
38 |
11570 | 39 write_fileheader(); |
10827
3d011a01a6a0
Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff
changeset
|
40 |
11570 | 41 for (i = 5; i <= 12; i++) { |
42 ff_init_ff_sine_windows(i); | |
43 printf("SINETABLE(%4i) = {\n", 1 << i); | |
44 write_float_array(ff_sine_windows[i], 1 << i); | |
45 printf("};\n"); | |
46 } | |
47 | |
48 return 0; | |
49 } |