Mercurial > libavcodec.hg
annotate mpegaudio.h @ 3798:6e7b9a44800c libavcodec
vorbis.h -> vorbis_data.c
move tables from vorbis.h to a C file so they can be used later in
vorbis_enc.c
author | ods15 |
---|---|
date | Sat, 30 Sep 2006 18:47:15 +0000 |
parents | c537a97eec66 |
children | c8c591fe26f8 |
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 * |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
2979
diff
changeset
|
4 * This library is free software; you can redistribute it and/or |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
2979
diff
changeset
|
5 * 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
|
6 * License as published by the Free Software Foundation; either |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
2979
diff
changeset
|
7 * version 2 of the License, or (at your option) any later version. |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
2979
diff
changeset
|
8 * |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
2979
diff
changeset
|
9 * This library is distributed in the hope that it will be useful, |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
2979
diff
changeset
|
10 * 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
|
11 * 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
|
12 * 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
|
13 * |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
2979
diff
changeset
|
14 * You should have received a copy of the GNU Lesser General Public |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
2979
diff
changeset
|
15 * License along with this library; if not, write to the Free Software |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
2979
diff
changeset
|
16 * 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
|
17 */ |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
2979
diff
changeset
|
18 |
1106 | 19 /** |
20 * @file mpegaudio.h | |
21 * mpeg audio declarations for both encoder and decoder. | |
22 */ | |
84 | 23 |
24 /* max frame size, in samples */ | |
2967 | 25 #define MPA_FRAME_SIZE 1152 |
0 | 26 |
27 /* max compressed frame size */ | |
84 | 28 #define MPA_MAX_CODED_FRAME_SIZE 1792 |
0 | 29 |
30 #define MPA_MAX_CHANNELS 2 | |
31 | |
32 #define SBLIMIT 32 /* number of subbands */ | |
84 | 33 |
34 #define MPA_STEREO 0 | |
35 #define MPA_JSTEREO 1 | |
36 #define MPA_DUAL 2 | |
37 #define MPA_MONO 3 | |
38 | |
2472 | 39 /* header + layer + bitrate + freq + lsf/mpeg25 */ |
40 #define SAME_HEADER_MASK \ | |
41 (0xffe00000 | (3 << 17) | (0xf << 12) | (3 << 10) | (3 << 19)) | |
42 | |
2913 | 43 /* define USE_HIGHPRECISION to have a bit exact (but slower) mpeg |
44 audio decoder */ | |
45 | |
46 #ifdef USE_HIGHPRECISION | |
47 #define FRAC_BITS 23 /* fractional bits for sb_samples and dct */ | |
48 #define WFRAC_BITS 16 /* fractional bits for window */ | |
49 #else | |
50 #define FRAC_BITS 15 /* fractional bits for sb_samples and dct */ | |
51 #define WFRAC_BITS 14 /* fractional bits for window */ | |
52 #endif | |
53 | |
54 #if defined(USE_HIGHPRECISION) && defined(CONFIG_AUDIO_NONSHORT) | |
55 typedef int32_t OUT_INT; | |
56 #define OUT_MAX INT32_MAX | |
57 #define OUT_MIN INT32_MIN | |
58 #define OUT_SHIFT (WFRAC_BITS + FRAC_BITS - 31) | |
59 #else | |
60 typedef int16_t OUT_INT; | |
61 #define OUT_MAX INT16_MAX | |
62 #define OUT_MIN INT16_MIN | |
63 #define OUT_SHIFT (WFRAC_BITS + FRAC_BITS - 15) | |
64 #endif | |
65 | |
66 #if FRAC_BITS <= 15 | |
67 typedef int16_t MPA_INT; | |
68 #else | |
69 typedef int32_t MPA_INT; | |
70 #endif | |
71 | |
84 | 72 int l2_select_table(int bitrate, int nb_channels, int freq, int lsf); |
1612 | 73 int mpa_decode_header(AVCodecContext *avctx, uint32_t head); |
2913 | 74 void ff_mpa_synth_init(MPA_INT *window); |
75 void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, | |
2979 | 76 MPA_INT *window, int *dither_state, |
2913 | 77 OUT_INT *samples, int incr, |
78 int32_t sb_samples[SBLIMIT]); | |
0 | 79 |
1064 | 80 extern const uint16_t mpa_bitrate_tab[2][3][15]; |
81 extern const uint16_t mpa_freq_tab[3]; | |
84 | 82 extern const unsigned char *alloc_tables[5]; |
83 extern const double enwindow[512]; | |
84 extern const int sblimit_table[5]; | |
85 extern const int quant_steps[17]; | |
86 extern const int quant_bits[17]; | |
1064 | 87 extern const int32_t mpa_enwindow[257]; |
2472 | 88 |
89 /* fast header check for resync */ | |
90 static inline int ff_mpa_check_header(uint32_t header){ | |
91 /* header */ | |
92 if ((header & 0xffe00000) != 0xffe00000) | |
93 return -1; | |
94 /* layer check */ | |
95 if ((header & (3<<17)) == 0) | |
96 return -1; | |
97 /* bit rate */ | |
98 if ((header & (0xf<<12)) == 0xf<<12) | |
99 return -1; | |
100 /* frequency */ | |
101 if ((header & (3<<10)) == 3<<10) | |
102 return -1; | |
103 return 0; | |
104 } |