annotate mdct_tablegen.h @ 12530:63edd10ad4bc libavcodec tip

Try to fix crashes introduced by r25218 r25218 made assumptions about the existence of past reference frames that weren't necessarily true.
author darkshikari
date Tue, 28 Sep 2010 09:06:22 +0000
parents 4b2300246240
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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>
11906
a1b4029b2465 mathematics.h no longer needs config.h, so update tablegen code and
reimar
parents: 11552
diff changeset
24 // do not use libavutil/libm.h since this is compiled both
10827
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>
11967
4b2300246240 Remove unnecessary ../ from include directives
mru
parents: 11906
diff changeset
27 #include "libavutil/attributes.h"
10827
3d011a01a6a0 Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff changeset
28
3d011a01a6a0 Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff changeset
29 #if !CONFIG_HARDCODED_TABLES
3d011a01a6a0 Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff changeset
30 SINETABLE( 32);
3d011a01a6a0 Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff changeset
31 SINETABLE( 64);
3d011a01a6a0 Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff changeset
32 SINETABLE( 128);
3d011a01a6a0 Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff changeset
33 SINETABLE( 256);
3d011a01a6a0 Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff changeset
34 SINETABLE( 512);
3d011a01a6a0 Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff changeset
35 SINETABLE(1024);
3d011a01a6a0 Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff changeset
36 SINETABLE(2048);
3d011a01a6a0 Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff changeset
37 SINETABLE(4096);
3d011a01a6a0 Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff changeset
38 #else
10887
aa3997d8eee7 Fix out of tree build with hardcoded tables
mru
parents: 10827
diff changeset
39 #include "libavcodec/mdct_tables.h"
10827
3d011a01a6a0 Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff changeset
40 #endif
3d011a01a6a0 Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff changeset
41
3d011a01a6a0 Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff changeset
42 SINETABLE_CONST float * const ff_sine_windows[] = {
3d011a01a6a0 Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff changeset
43 NULL, NULL, NULL, NULL, NULL, // unused
3d011a01a6a0 Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff changeset
44 ff_sine_32 , ff_sine_64 ,
3d011a01a6a0 Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff changeset
45 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
46 };
3d011a01a6a0 Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff changeset
47
3d011a01a6a0 Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff changeset
48 // Generate a sine window.
3d011a01a6a0 Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff changeset
49 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
50 int i;
3d011a01a6a0 Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff changeset
51 for(i = 0; i < n; i++)
3d011a01a6a0 Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff changeset
52 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
53 }
3d011a01a6a0 Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff changeset
54
3d011a01a6a0 Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff changeset
55 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
56 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
57 #if !CONFIG_HARDCODED_TABLES
3d011a01a6a0 Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff changeset
58 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
59 #endif
3d011a01a6a0 Add support for hard-coded MDCT-related ff_sine_windows tables.
reimar
parents:
diff changeset
60 }