2 * copyright (c) 2001 Fabrice Bellard
4 * This file is part of Libav.
6 * Libav is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * Libav is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with Libav; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 * mpeg audio declarations for both encoder and decoder.
26 #ifndef AVCODEC_MPEGAUDIO_H
27 #define AVCODEC_MPEGAUDIO_H
30 # define CONFIG_FLOAT 0
35 /* max frame size, in samples */
36 #define MPA_FRAME_SIZE 1152
38 /* max compressed frame size */
39 #define MPA_MAX_CODED_FRAME_SIZE 1792
41 #define MPA_MAX_CHANNELS 2
43 #define SBLIMIT 32 /* number of subbands */
50 #define MP3_MASK 0xFFFE0CCF
53 #define FRAC_BITS 23 /* fractional bits for sb_samples and dct */
54 #define WFRAC_BITS 16 /* fractional bits for window */
57 #define FRAC_ONE (1 << FRAC_BITS)
59 #define FIX(a) ((int)((a) * FRAC_ONE))
62 # define INTFLOAT float
63 typedef float MPA_INT;
64 typedef float OUT_INT;
67 typedef int16_t MPA_INT;
68 typedef int16_t OUT_INT;
71 typedef int32_t MPA_INT;
72 typedef int16_t OUT_INT;
75 #define MPA_DECODE_HEADER \
77 int error_protection; \
80 int sample_rate_index; /* between 0 and 8 */ \
87 typedef struct MPADecodeHeader {
91 int ff_mpa_l2_select_table(int bitrate, int nb_channels, int freq, int lsf);
92 int ff_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bitrate);
94 /* fast header check for resync */
95 static inline int ff_mpa_check_header(uint32_t header){
97 if ((header & 0xffe00000) != 0xffe00000)
100 if ((header & (3<<17)) == 0)
103 if ((header & (0xf<<12)) == 0xf<<12)
106 if ((header & (3<<10)) == 3<<10)
111 #endif /* AVCODEC_MPEGAUDIO_H */