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
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 *
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
1e39f273ecd6 per file doxy
michaelni
parents: 1064
diff changeset
19 /**
1e39f273ecd6 per file doxy
michaelni
parents: 1064
diff changeset
20 * @file mpegaudio.h
1e39f273ecd6 per file doxy
michaelni
parents: 1064
diff changeset
21 * mpeg audio declarations for both encoder and decoder.
1e39f273ecd6 per file doxy
michaelni
parents: 1064
diff changeset
22 */
84
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 64
diff changeset
23
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 64
diff changeset
24 /* max frame size, in samples */
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2913
diff changeset
25 #define MPA_FRAME_SIZE 1152
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
26
986e461dc072 Initial revision
glantau
parents:
diff changeset
27 /* max compressed frame size */
84
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 64
diff changeset
28 #define MPA_MAX_CODED_FRAME_SIZE 1792
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
29
986e461dc072 Initial revision
glantau
parents:
diff changeset
30 #define MPA_MAX_CHANNELS 2
986e461dc072 Initial revision
glantau
parents:
diff changeset
31
986e461dc072 Initial revision
glantau
parents:
diff changeset
32 #define SBLIMIT 32 /* number of subbands */
84
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 64
diff changeset
33
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 64
diff changeset
34 #define MPA_STEREO 0
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 64
diff changeset
35 #define MPA_JSTEREO 1
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 64
diff changeset
36 #define MPA_DUAL 2
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 64
diff changeset
37 #define MPA_MONO 3
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 64
diff changeset
38
2472
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
39 /* header + layer + bitrate + freq + lsf/mpeg25 */
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
40 #define SAME_HEADER_MASK \
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
41 (0xffe00000 | (3 << 17) | (0xf << 12) | (3 << 10) | (3 << 19))
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
42
2913
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
43 /* define USE_HIGHPRECISION to have a bit exact (but slower) mpeg
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
44 audio decoder */
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
45
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
46 #ifdef USE_HIGHPRECISION
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
47 #define FRAC_BITS 23 /* fractional bits for sb_samples and dct */
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
48 #define WFRAC_BITS 16 /* fractional bits for window */
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
49 #else
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
50 #define FRAC_BITS 15 /* fractional bits for sb_samples and dct */
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
51 #define WFRAC_BITS 14 /* fractional bits for window */
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
52 #endif
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
53
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
54 #if defined(USE_HIGHPRECISION) && defined(CONFIG_AUDIO_NONSHORT)
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
55 typedef int32_t OUT_INT;
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
56 #define OUT_MAX INT32_MAX
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
57 #define OUT_MIN INT32_MIN
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
58 #define OUT_SHIFT (WFRAC_BITS + FRAC_BITS - 31)
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
59 #else
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
60 typedef int16_t OUT_INT;
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
61 #define OUT_MAX INT16_MAX
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
62 #define OUT_MIN INT16_MIN
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
63 #define OUT_SHIFT (WFRAC_BITS + FRAC_BITS - 15)
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
64 #endif
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
65
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
66 #if FRAC_BITS <= 15
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
67 typedef int16_t MPA_INT;
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
68 #else
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
69 typedef int32_t MPA_INT;
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
70 #endif
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
71
84
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 64
diff changeset
72 int l2_select_table(int bitrate, int nb_channels, int freq, int lsf);
1612
0d2b59cf9f45 exported mpa_decode_header for new parser API
bellard
parents: 1106
diff changeset
73 int mpa_decode_header(AVCodecContext *avctx, uint32_t head);
2913
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
74 void ff_mpa_synth_init(MPA_INT *window);
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
75 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
76 MPA_INT *window, int *dither_state,
2913
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
77 OUT_INT *samples, int incr,
cc55bc1f8d92 QDM2 compatible decoder
rtognimp
parents: 2472
diff changeset
78 int32_t sb_samples[SBLIMIT]);
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
79
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 472
diff changeset
80 extern const uint16_t mpa_bitrate_tab[2][3][15];
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 472
diff changeset
81 extern const uint16_t mpa_freq_tab[3];
84
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 64
diff changeset
82 extern const unsigned char *alloc_tables[5];
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 64
diff changeset
83 extern const double enwindow[512];
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 64
diff changeset
84 extern const int sblimit_table[5];
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 64
diff changeset
85 extern const int quant_steps[17];
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 64
diff changeset
86 extern const int quant_bits[17];
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 472
diff changeset
87 extern const int32_t mpa_enwindow[257];
2472
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
88
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
89 /* fast header check for resync */
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
90 static inline int ff_mpa_check_header(uint32_t header){
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
91 /* header */
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
92 if ((header & 0xffe00000) != 0xffe00000)
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
93 return -1;
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
94 /* layer check */
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
95 if ((header & (3<<17)) == 0)
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
96 return -1;
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
97 /* bit rate */
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
98 if ((header & (0xf<<12)) == 0xf<<12)
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
99 return -1;
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
100 /* frequency */
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
101 if ((header & (3<<10)) == 3<<10)
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
102 return -1;
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
103 return 0;
021dc26e760f dithering for the mpeg audio decoder
michael
parents: 1612
diff changeset
104 }