annotate mpegaudio.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 b4888704c11e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3699
c537a97eec66 Add official LGPL license headers to the files that were missing them.
diego
parents: 2979
diff changeset
1 /*
c537a97eec66 Add official LGPL license headers to the files that were missing them.
diego
parents: 2979
diff changeset
2 * copyright (c) 2001 Fabrice Bellard
c537a97eec66 Add official LGPL license headers to the files that were missing them.
diego
parents: 2979
diff changeset
3 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3699
diff changeset
4 * This file is part of FFmpeg.
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3699
diff changeset
5 *
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3699
diff changeset
6 * FFmpeg is free software; you can redistribute it and/or
3699
c537a97eec66 Add official LGPL license headers to the files that were missing them.
diego
parents: 2979
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
c537a97eec66 Add official LGPL license headers to the files that were missing them.
diego
parents: 2979
diff changeset
8 * License as published by the Free Software Foundation; either
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3699
diff changeset
9 * version 2.1 of the License, or (at your option) any later version.
3699
c537a97eec66 Add official LGPL license headers to the files that were missing them.
diego
parents: 2979
diff changeset
10 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3699
diff changeset
11 * FFmpeg is distributed in the hope that it will be useful,
3699
c537a97eec66 Add official LGPL license headers to the files that were missing them.
diego
parents: 2979
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
c537a97eec66 Add official LGPL license headers to the files that were missing them.
diego
parents: 2979
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
c537a97eec66 Add official LGPL license headers to the files that were missing them.
diego
parents: 2979
diff changeset
14 * Lesser General Public License for more details.
c537a97eec66 Add official LGPL license headers to the files that were missing them.
diego
parents: 2979
diff changeset
15 *
c537a97eec66 Add official LGPL license headers to the files that were missing them.
diego
parents: 2979
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3699
diff changeset
17 * License along with FFmpeg; if not, write to the Free Software
3699
c537a97eec66 Add official LGPL license headers to the files that were missing them.
diego
parents: 2979
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
c537a97eec66 Add official LGPL license headers to the files that were missing them.
diego
parents: 2979
diff changeset
19 */
c537a97eec66 Add official LGPL license headers to the files that were missing them.
diego
parents: 2979
diff changeset
20
1106
1e39f273ecd6 per file doxy
michaelni
parents: 1064
diff changeset
21 /**
11644
7dd2a45249a9 Remove explicit filename from Doxygen @file commands.
diego
parents: 11369
diff changeset
22 * @file
1106
1e39f273ecd6 per file doxy
michaelni
parents: 1064
diff changeset
23 * mpeg audio declarations for both encoder and decoder.
1e39f273ecd6 per file doxy
michaelni
parents: 1064
diff changeset
24 */
84
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 64
diff changeset
25
7760
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 5830
diff changeset
26 #ifndef AVCODEC_MPEGAUDIO_H
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 5830
diff changeset
27 #define AVCODEC_MPEGAUDIO_H
5050
a5f6fbc9fa66 loosen dependencies over mpegaudiodec
aurel
parents: 5033
diff changeset
28
11707
eb9e142ea51f float based mp1/mp2/mp3 decoders.
michael
parents: 11644
diff changeset
29 #ifndef CONFIG_FLOAT
eb9e142ea51f float based mp1/mp2/mp3 decoders.
michael
parents: 11644
diff changeset
30 # define CONFIG_FLOAT 0
eb9e142ea51f float based mp1/mp2/mp3 decoders.
michael
parents: 11644
diff changeset
31 #endif
eb9e142ea51f float based mp1/mp2/mp3 decoders.
michael
parents: 11644
diff changeset
32
5052
d981eb275c8f remove dependency of mpeg audio encoder over mpeg audio decoder
aurel
parents: 5051
diff changeset
33 #include "avcodec.h"
9428
0dce4fe6e6f3 Rename bitstream.h to get_bits.h.
stefano
parents: 8718
diff changeset
34 #include "get_bits.h"
5050
a5f6fbc9fa66 loosen dependencies over mpegaudiodec
aurel
parents: 5033
diff changeset
35 #include "dsputil.h"
12026
3f3d08bb5cf8 More mp{1,2,3} 32-point DCT transform to our common DCT framework.
vitor
parents: 11939
diff changeset
36 #include "fft.h"
5050
a5f6fbc9fa66 loosen dependencies over mpegaudiodec
aurel
parents: 5033
diff changeset
37
8600
5b5ac656cb50 explicitly disable CONFIG_AUDIO_NONSHORT
aurel
parents: 8598
diff changeset
38 #define CONFIG_AUDIO_NONSHORT 0
5b5ac656cb50 explicitly disable CONFIG_AUDIO_NONSHORT
aurel
parents: 8598
diff changeset
39
84
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 64
diff changeset
40 /* max frame size, in samples */
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2913
diff changeset
41 #define MPA_FRAME_SIZE 1152
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
42
986e461dc072 Initial revision
glantau
parents:
diff changeset
43 /* max compressed frame size */
84
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 64
diff changeset
44 #define MPA_MAX_CODED_FRAME_SIZE 1792
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
45
986e461dc072 Initial revision
glantau
parents:
diff changeset
46 #define MPA_MAX_CHANNELS 2
986e461dc072 Initial revision
glantau
parents:
diff changeset
47
986e461dc072 Initial revision
glantau
parents:
diff changeset
48 #define SBLIMIT 32 /* number of subbands */
84
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 64
diff changeset
49
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 64
diff changeset
50 #define MPA_STEREO 0
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 64
diff changeset
51 #define MPA_JSTEREO 1
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 64
diff changeset
52 #define MPA_DUAL 2
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 64
diff changeset
53 #define MPA_MONO 3
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 64
diff changeset
54
2472
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
55 /* header + layer + bitrate + freq + lsf/mpeg25 */
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
56 #define SAME_HEADER_MASK \
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
57 (0xffe00000 | (3 << 17) | (0xf << 12) | (3 << 10) | (3 << 19))
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
58
5033
3c034e71667f move mp3_header_decompress bitstream filter in its own file
aurel
parents: 5031
diff changeset
59 #define MP3_MASK 0xFFFE0CCF
3c034e71667f move mp3_header_decompress bitstream filter in its own file
aurel
parents: 5031
diff changeset
60
8594
c5349ca95c08 Replace #ifdef CONFIG_ preprocessor check by #if CONFIG_.
diego
parents: 8592
diff changeset
61 #if CONFIG_MPEGAUDIO_HP
2913
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
62 #define FRAC_BITS 23 /* fractional bits for sb_samples and dct */
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
63 #define WFRAC_BITS 16 /* fractional bits for window */
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
64 #else
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
65 #define FRAC_BITS 15 /* fractional bits for sb_samples and dct */
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
66 #define WFRAC_BITS 14 /* fractional bits for window */
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
67 #endif
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
68
5161
94c3f01c243c move a couple of macros and structs to mpegaudio.h
mru
parents: 5052
diff changeset
69 #define FRAC_ONE (1 << FRAC_BITS)
94c3f01c243c move a couple of macros and structs to mpegaudio.h
mru
parents: 5052
diff changeset
70
94c3f01c243c move a couple of macros and structs to mpegaudio.h
mru
parents: 5052
diff changeset
71 #define FIX(a) ((int)((a) * FRAC_ONE))
94c3f01c243c move a couple of macros and structs to mpegaudio.h
mru
parents: 5052
diff changeset
72
11707
eb9e142ea51f float based mp1/mp2/mp3 decoders.
michael
parents: 11644
diff changeset
73 #if CONFIG_FLOAT
eb9e142ea51f float based mp1/mp2/mp3 decoders.
michael
parents: 11644
diff changeset
74 typedef float OUT_INT;
eb9e142ea51f float based mp1/mp2/mp3 decoders.
michael
parents: 11644
diff changeset
75 #define OUT_FMT SAMPLE_FMT_FLT
eb9e142ea51f float based mp1/mp2/mp3 decoders.
michael
parents: 11644
diff changeset
76 #elif CONFIG_MPEGAUDIO_HP && CONFIG_AUDIO_NONSHORT
2913
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
77 typedef int32_t OUT_INT;
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
78 #define OUT_MAX INT32_MAX
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
79 #define OUT_MIN INT32_MIN
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
80 #define OUT_SHIFT (WFRAC_BITS + FRAC_BITS - 31)
8598
6550218be3b7 simplify: group all the AUDIO_NONSHORT parameters in the same place
aurel
parents: 8594
diff changeset
81 #define OUT_FMT SAMPLE_FMT_S32
2913
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
82 #else
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
83 typedef int16_t OUT_INT;
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
84 #define OUT_MAX INT16_MAX
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
85 #define OUT_MIN INT16_MIN
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
86 #define OUT_SHIFT (WFRAC_BITS + FRAC_BITS - 15)
8598
6550218be3b7 simplify: group all the AUDIO_NONSHORT parameters in the same place
aurel
parents: 8594
diff changeset
87 #define OUT_FMT SAMPLE_FMT_S16
2913
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
88 #endif
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
89
11707
eb9e142ea51f float based mp1/mp2/mp3 decoders.
michael
parents: 11644
diff changeset
90 #if CONFIG_FLOAT
eb9e142ea51f float based mp1/mp2/mp3 decoders.
michael
parents: 11644
diff changeset
91 # define INTFLOAT float
eb9e142ea51f float based mp1/mp2/mp3 decoders.
michael
parents: 11644
diff changeset
92 typedef float MPA_INT;
eb9e142ea51f float based mp1/mp2/mp3 decoders.
michael
parents: 11644
diff changeset
93 #elif FRAC_BITS <= 15
eb9e142ea51f float based mp1/mp2/mp3 decoders.
michael
parents: 11644
diff changeset
94 # define INTFLOAT int
2913
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
95 typedef int16_t MPA_INT;
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
96 #else
11707
eb9e142ea51f float based mp1/mp2/mp3 decoders.
michael
parents: 11644
diff changeset
97 # define INTFLOAT int
2913
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
98 typedef int32_t MPA_INT;
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
99 #endif
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
100
5050
a5f6fbc9fa66 loosen dependencies over mpegaudiodec
aurel
parents: 5033
diff changeset
101 #define BACKSTEP_SIZE 512
a5f6fbc9fa66 loosen dependencies over mpegaudiodec
aurel
parents: 5033
diff changeset
102 #define EXTRABYTES 24
a5f6fbc9fa66 loosen dependencies over mpegaudiodec
aurel
parents: 5033
diff changeset
103
10494
ead8d96926c4 Reduce stack memory allocation in MP3 decoder
vitor
parents: 10440
diff changeset
104 /* layer 3 "granule" */
ead8d96926c4 Reduce stack memory allocation in MP3 decoder
vitor
parents: 10440
diff changeset
105 typedef struct GranuleDef {
ead8d96926c4 Reduce stack memory allocation in MP3 decoder
vitor
parents: 10440
diff changeset
106 uint8_t scfsi;
ead8d96926c4 Reduce stack memory allocation in MP3 decoder
vitor
parents: 10440
diff changeset
107 int part2_3_length;
ead8d96926c4 Reduce stack memory allocation in MP3 decoder
vitor
parents: 10440
diff changeset
108 int big_values;
ead8d96926c4 Reduce stack memory allocation in MP3 decoder
vitor
parents: 10440
diff changeset
109 int global_gain;
ead8d96926c4 Reduce stack memory allocation in MP3 decoder
vitor
parents: 10440
diff changeset
110 int scalefac_compress;
ead8d96926c4 Reduce stack memory allocation in MP3 decoder
vitor
parents: 10440
diff changeset
111 uint8_t block_type;
ead8d96926c4 Reduce stack memory allocation in MP3 decoder
vitor
parents: 10440
diff changeset
112 uint8_t switch_point;
ead8d96926c4 Reduce stack memory allocation in MP3 decoder
vitor
parents: 10440
diff changeset
113 int table_select[3];
ead8d96926c4 Reduce stack memory allocation in MP3 decoder
vitor
parents: 10440
diff changeset
114 int subblock_gain[3];
ead8d96926c4 Reduce stack memory allocation in MP3 decoder
vitor
parents: 10440
diff changeset
115 uint8_t scalefac_scale;
ead8d96926c4 Reduce stack memory allocation in MP3 decoder
vitor
parents: 10440
diff changeset
116 uint8_t count1table_select;
ead8d96926c4 Reduce stack memory allocation in MP3 decoder
vitor
parents: 10440
diff changeset
117 int region_size[3]; /* number of huffman codes in each region */
ead8d96926c4 Reduce stack memory allocation in MP3 decoder
vitor
parents: 10440
diff changeset
118 int preflag;
ead8d96926c4 Reduce stack memory allocation in MP3 decoder
vitor
parents: 10440
diff changeset
119 int short_start, long_end; /* long/short band indexes */
ead8d96926c4 Reduce stack memory allocation in MP3 decoder
vitor
parents: 10440
diff changeset
120 uint8_t scale_factors[40];
11707
eb9e142ea51f float based mp1/mp2/mp3 decoders.
michael
parents: 11644
diff changeset
121 INTFLOAT sb_hybrid[SBLIMIT * 18]; /* 576 samples */
10494
ead8d96926c4 Reduce stack memory allocation in MP3 decoder
vitor
parents: 10440
diff changeset
122 } GranuleDef;
5050
a5f6fbc9fa66 loosen dependencies over mpegaudiodec
aurel
parents: 5033
diff changeset
123
8641
54e2916c25a5 Avoid allocating MPADecodeContext on stack.
andoma
parents: 8600
diff changeset
124 #define MPA_DECODE_HEADER \
54e2916c25a5 Avoid allocating MPADecodeContext on stack.
andoma
parents: 8600
diff changeset
125 int frame_size; \
54e2916c25a5 Avoid allocating MPADecodeContext on stack.
andoma
parents: 8600
diff changeset
126 int error_protection; \
54e2916c25a5 Avoid allocating MPADecodeContext on stack.
andoma
parents: 8600
diff changeset
127 int layer; \
54e2916c25a5 Avoid allocating MPADecodeContext on stack.
andoma
parents: 8600
diff changeset
128 int sample_rate; \
54e2916c25a5 Avoid allocating MPADecodeContext on stack.
andoma
parents: 8600
diff changeset
129 int sample_rate_index; /* between 0 and 8 */ \
54e2916c25a5 Avoid allocating MPADecodeContext on stack.
andoma
parents: 8600
diff changeset
130 int bit_rate; \
54e2916c25a5 Avoid allocating MPADecodeContext on stack.
andoma
parents: 8600
diff changeset
131 int nb_channels; \
54e2916c25a5 Avoid allocating MPADecodeContext on stack.
andoma
parents: 8600
diff changeset
132 int mode; \
54e2916c25a5 Avoid allocating MPADecodeContext on stack.
andoma
parents: 8600
diff changeset
133 int mode_ext; \
54e2916c25a5 Avoid allocating MPADecodeContext on stack.
andoma
parents: 8600
diff changeset
134 int lsf;
54e2916c25a5 Avoid allocating MPADecodeContext on stack.
andoma
parents: 8600
diff changeset
135
54e2916c25a5 Avoid allocating MPADecodeContext on stack.
andoma
parents: 8600
diff changeset
136 typedef struct MPADecodeHeader {
54e2916c25a5 Avoid allocating MPADecodeContext on stack.
andoma
parents: 8600
diff changeset
137 MPA_DECODE_HEADER
54e2916c25a5 Avoid allocating MPADecodeContext on stack.
andoma
parents: 8600
diff changeset
138 } MPADecodeHeader;
54e2916c25a5 Avoid allocating MPADecodeContext on stack.
andoma
parents: 8600
diff changeset
139
5050
a5f6fbc9fa66 loosen dependencies over mpegaudiodec
aurel
parents: 5033
diff changeset
140 typedef struct MPADecodeContext {
8641
54e2916c25a5 Avoid allocating MPADecodeContext on stack.
andoma
parents: 8600
diff changeset
141 MPA_DECODE_HEADER
10093
beb616cf1885 Remove some unnecessary alignment specifiers
mru
parents: 9428
diff changeset
142 uint8_t last_buf[2*BACKSTEP_SIZE + EXTRABYTES];
5050
a5f6fbc9fa66 loosen dependencies over mpegaudiodec
aurel
parents: 5033
diff changeset
143 int last_buf_size;
a5f6fbc9fa66 loosen dependencies over mpegaudiodec
aurel
parents: 5033
diff changeset
144 /* next header (used in free format parsing) */
a5f6fbc9fa66 loosen dependencies over mpegaudiodec
aurel
parents: 5033
diff changeset
145 uint32_t free_format_next_header;
a5f6fbc9fa66 loosen dependencies over mpegaudiodec
aurel
parents: 5033
diff changeset
146 GetBitContext gb;
a5f6fbc9fa66 loosen dependencies over mpegaudiodec
aurel
parents: 5033
diff changeset
147 GetBitContext in_gb;
11369
98970e51365a Remove DECLARE_ALIGNED_{8,16} macros
mru
parents: 10961
diff changeset
148 DECLARE_ALIGNED(16, MPA_INT, synth_buf)[MPA_MAX_CHANNELS][512 * 2];
5050
a5f6fbc9fa66 loosen dependencies over mpegaudiodec
aurel
parents: 5033
diff changeset
149 int synth_buf_offset[MPA_MAX_CHANNELS];
11707
eb9e142ea51f float based mp1/mp2/mp3 decoders.
michael
parents: 11644
diff changeset
150 DECLARE_ALIGNED(16, INTFLOAT, sb_samples)[MPA_MAX_CHANNELS][36][SBLIMIT];
eb9e142ea51f float based mp1/mp2/mp3 decoders.
michael
parents: 11644
diff changeset
151 INTFLOAT mdct_buf[MPA_MAX_CHANNELS][SBLIMIT * 18]; /* previous samples, for layer 3 MDCT */
10494
ead8d96926c4 Reduce stack memory allocation in MP3 decoder
vitor
parents: 10440
diff changeset
152 GranuleDef granules[2][2]; /* Used in Layer 3 */
5050
a5f6fbc9fa66 loosen dependencies over mpegaudiodec
aurel
parents: 5033
diff changeset
153 #ifdef DEBUG
a5f6fbc9fa66 loosen dependencies over mpegaudiodec
aurel
parents: 5033
diff changeset
154 int frame_count;
a5f6fbc9fa66 loosen dependencies over mpegaudiodec
aurel
parents: 5033
diff changeset
155 #endif
a5f6fbc9fa66 loosen dependencies over mpegaudiodec
aurel
parents: 5033
diff changeset
156 int adu_mode; ///< 0 for standard mp3, 1 for adu formatted mp3
a5f6fbc9fa66 loosen dependencies over mpegaudiodec
aurel
parents: 5033
diff changeset
157 int dither_state;
7831
8195c970d077 Rename error_resilience to error_recognition.
michael
parents: 7760
diff changeset
158 int error_recognition;
5050
a5f6fbc9fa66 loosen dependencies over mpegaudiodec
aurel
parents: 5033
diff changeset
159 AVCodecContext* avctx;
12026
3f3d08bb5cf8 More mp{1,2,3} 32-point DCT transform to our common DCT framework.
vitor
parents: 11939
diff changeset
160 #if CONFIG_FLOAT
3f3d08bb5cf8 More mp{1,2,3} 32-point DCT transform to our common DCT framework.
vitor
parents: 11939
diff changeset
161 DCTContext dct;
3f3d08bb5cf8 More mp{1,2,3} 32-point DCT transform to our common DCT framework.
vitor
parents: 11939
diff changeset
162 #endif
11885
0e777af9160a Factorize the mpegaudio windowing code in a function and call it by a
vitor
parents: 11707
diff changeset
163 void (*apply_window_mp3)(MPA_INT *synth_buf, MPA_INT *window,
0e777af9160a Factorize the mpegaudio windowing code in a function and call it by a
vitor
parents: 11707
diff changeset
164 int *dither_state, OUT_INT *samples, int incr);
5050
a5f6fbc9fa66 loosen dependencies over mpegaudiodec
aurel
parents: 5033
diff changeset
165 } MPADecodeContext;
a5f6fbc9fa66 loosen dependencies over mpegaudiodec
aurel
parents: 5033
diff changeset
166
5161
94c3f01c243c move a couple of macros and structs to mpegaudio.h
mru
parents: 5052
diff changeset
167 /* layer 3 huffman tables */
94c3f01c243c move a couple of macros and structs to mpegaudio.h
mru
parents: 5052
diff changeset
168 typedef struct HuffTable {
94c3f01c243c move a couple of macros and structs to mpegaudio.h
mru
parents: 5052
diff changeset
169 int xsize;
94c3f01c243c move a couple of macros and structs to mpegaudio.h
mru
parents: 5052
diff changeset
170 const uint8_t *bits;
94c3f01c243c move a couple of macros and structs to mpegaudio.h
mru
parents: 5052
diff changeset
171 const uint16_t *codes;
94c3f01c243c move a couple of macros and structs to mpegaudio.h
mru
parents: 5052
diff changeset
172 } HuffTable;
94c3f01c243c move a couple of macros and structs to mpegaudio.h
mru
parents: 5052
diff changeset
173
5052
d981eb275c8f remove dependency of mpeg audio encoder over mpeg audio decoder
aurel
parents: 5051
diff changeset
174 int ff_mpa_l2_select_table(int bitrate, int nb_channels, int freq, int lsf);
8420
2b0d01be134f Change mpeg audio parser so it only sets frame_size, channels and bit_rate
michael
parents: 7831
diff changeset
175 int ff_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bitrate);
10440
899237b1961f mpegaudiodec, mpc and qdm2 all use the same mpa_synth window, so make
reimar
parents: 10093
diff changeset
176 extern MPA_INT ff_mpa_synth_window[];
2913
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
177 void ff_mpa_synth_init(MPA_INT *window);
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
178 void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset,
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
179 MPA_INT *window, int *dither_state,
2913
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
180 OUT_INT *samples, int incr,
11707
eb9e142ea51f float based mp1/mp2/mp3 decoders.
michael
parents: 11644
diff changeset
181 INTFLOAT sb_samples[SBLIMIT]);
eb9e142ea51f float based mp1/mp2/mp3 decoders.
michael
parents: 11644
diff changeset
182
eb9e142ea51f float based mp1/mp2/mp3 decoders.
michael
parents: 11644
diff changeset
183 void ff_mpa_synth_init_float(MPA_INT *window);
11885
0e777af9160a Factorize the mpegaudio windowing code in a function and call it by a
vitor
parents: 11707
diff changeset
184 void ff_mpa_synth_filter_float(MPADecodeContext *s,
0e777af9160a Factorize the mpegaudio windowing code in a function and call it by a
vitor
parents: 11707
diff changeset
185 MPA_INT *synth_buf_ptr, int *synth_buf_offset,
11707
eb9e142ea51f float based mp1/mp2/mp3 decoders.
michael
parents: 11644
diff changeset
186 MPA_INT *window, int *dither_state,
eb9e142ea51f float based mp1/mp2/mp3 decoders.
michael
parents: 11644
diff changeset
187 OUT_INT *samples, int incr,
eb9e142ea51f float based mp1/mp2/mp3 decoders.
michael
parents: 11644
diff changeset
188 INTFLOAT sb_samples[SBLIMIT]);
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
189
11939
ef338bd70180 SSE-optimized MP3 floating point windowing functions
vitor
parents: 11885
diff changeset
190 void ff_mpegaudiodec_init_mmx(MPADecodeContext *s);
12040
b4888704c11e Altivec-optimized mp{1,2,3} windowing
vitor
parents: 12026
diff changeset
191 void ff_mpegaudiodec_init_altivec(MPADecodeContext *s);
11939
ef338bd70180 SSE-optimized MP3 floating point windowing functions
vitor
parents: 11885
diff changeset
192
2472
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
193 /* fast header check for resync */
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
194 static inline int ff_mpa_check_header(uint32_t header){
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
195 /* header */
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
196 if ((header & 0xffe00000) != 0xffe00000)
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
197 return -1;
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
198 /* layer check */
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
199 if ((header & (3<<17)) == 0)
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
200 return -1;
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
201 /* bit rate */
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
202 if ((header & (0xf<<12)) == 0xf<<12)
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
203 return -1;
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
204 /* frequency */
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
205 if ((header & (3<<10)) == 3<<10)
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
206 return -1;
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
207 return 0;
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
208 }
5050
a5f6fbc9fa66 loosen dependencies over mpegaudiodec
aurel
parents: 5033
diff changeset
209
7760
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 5830
diff changeset
210 #endif /* AVCODEC_MPEGAUDIO_H */