Mercurial > libavcodec.hg
annotate mpegaudio.h @ 5033:3c034e71667f libavcodec
move mp3_header_decompress bitstream filter in its own file
author | aurel |
---|---|
date | Sat, 19 May 2007 00:24:34 +0000 |
parents | 70f194a2ee53 |
children | a5f6fbc9fa66 |
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 | 21 /** |
22 * @file mpegaudio.h | |
23 * mpeg audio declarations for both encoder and decoder. | |
24 */ | |
84 | 25 |
26 /* max frame size, in samples */ | |
2967 | 27 #define MPA_FRAME_SIZE 1152 |
0 | 28 |
29 /* max compressed frame size */ | |
84 | 30 #define MPA_MAX_CODED_FRAME_SIZE 1792 |
0 | 31 |
32 #define MPA_MAX_CHANNELS 2 | |
33 | |
34 #define SBLIMIT 32 /* number of subbands */ | |
84 | 35 |
36 #define MPA_STEREO 0 | |
37 #define MPA_JSTEREO 1 | |
38 #define MPA_DUAL 2 | |
39 #define MPA_MONO 3 | |
40 | |
2472 | 41 /* header + layer + bitrate + freq + lsf/mpeg25 */ |
42 #define SAME_HEADER_MASK \ | |
43 (0xffe00000 | (3 << 17) | (0xf << 12) | (3 << 10) | (3 << 19)) | |
44 | |
5033
3c034e71667f
move mp3_header_decompress bitstream filter in its own file
aurel
parents:
5031
diff
changeset
|
45 #define MP3_MASK 0xFFFE0CCF |
3c034e71667f
move mp3_header_decompress bitstream filter in its own file
aurel
parents:
5031
diff
changeset
|
46 |
2913 | 47 /* define USE_HIGHPRECISION to have a bit exact (but slower) mpeg |
48 audio decoder */ | |
49 | |
50 #ifdef USE_HIGHPRECISION | |
51 #define FRAC_BITS 23 /* fractional bits for sb_samples and dct */ | |
52 #define WFRAC_BITS 16 /* fractional bits for window */ | |
53 #else | |
54 #define FRAC_BITS 15 /* fractional bits for sb_samples and dct */ | |
55 #define WFRAC_BITS 14 /* fractional bits for window */ | |
56 #endif | |
57 | |
58 #if defined(USE_HIGHPRECISION) && defined(CONFIG_AUDIO_NONSHORT) | |
59 typedef int32_t OUT_INT; | |
60 #define OUT_MAX INT32_MAX | |
61 #define OUT_MIN INT32_MIN | |
62 #define OUT_SHIFT (WFRAC_BITS + FRAC_BITS - 31) | |
63 #else | |
64 typedef int16_t OUT_INT; | |
65 #define OUT_MAX INT16_MAX | |
66 #define OUT_MIN INT16_MIN | |
67 #define OUT_SHIFT (WFRAC_BITS + FRAC_BITS - 15) | |
68 #endif | |
69 | |
70 #if FRAC_BITS <= 15 | |
71 typedef int16_t MPA_INT; | |
72 #else | |
73 typedef int32_t MPA_INT; | |
74 #endif | |
75 | |
84 | 76 int l2_select_table(int bitrate, int nb_channels, int freq, int lsf); |
4104
04ff8026d9c0
dont set the sampling rate just because 1 mp3 packet header says so (fixes playback speed on some old mencoder generated avis which where then dumped to mp3)
michael
parents:
3947
diff
changeset
|
77 int mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate); |
2913 | 78 void ff_mpa_synth_init(MPA_INT *window); |
79 void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, | |
2979 | 80 MPA_INT *window, int *dither_state, |
2913 | 81 OUT_INT *samples, int incr, |
82 int32_t sb_samples[SBLIMIT]); | |
0 | 83 |
2472 | 84 /* fast header check for resync */ |
85 static inline int ff_mpa_check_header(uint32_t header){ | |
86 /* header */ | |
87 if ((header & 0xffe00000) != 0xffe00000) | |
88 return -1; | |
89 /* layer check */ | |
90 if ((header & (3<<17)) == 0) | |
91 return -1; | |
92 /* bit rate */ | |
93 if ((header & (0xf<<12)) == 0xf<<12) | |
94 return -1; | |
95 /* frequency */ | |
96 if ((header & (3<<10)) == 3<<10) | |
97 return -1; | |
98 return 0; | |
99 } |