2003-03-06 12:32:04 +01:00
|
|
|
/**
|
|
|
|
* @file mpegaudio.h
|
|
|
|
* mpeg audio declarations for both encoder and decoder.
|
|
|
|
*/
|
2001-09-16 00:42:25 +02:00
|
|
|
|
|
|
|
/* max frame size, in samples */
|
|
|
|
#define MPA_FRAME_SIZE 1152
|
2001-07-22 16:18:56 +02:00
|
|
|
|
|
|
|
/* max compressed frame size */
|
2001-09-16 00:42:25 +02:00
|
|
|
#define MPA_MAX_CODED_FRAME_SIZE 1792
|
2001-07-22 16:18:56 +02:00
|
|
|
|
|
|
|
#define MPA_MAX_CHANNELS 2
|
|
|
|
|
|
|
|
#define SBLIMIT 32 /* number of subbands */
|
|
|
|
|
2001-09-16 00:42:25 +02:00
|
|
|
#define MPA_STEREO 0
|
|
|
|
#define MPA_JSTEREO 1
|
|
|
|
#define MPA_DUAL 2
|
|
|
|
#define MPA_MONO 3
|
|
|
|
|
2005-01-30 15:04:56 +01:00
|
|
|
/* header + layer + bitrate + freq + lsf/mpeg25 */
|
|
|
|
#define SAME_HEADER_MASK \
|
|
|
|
(0xffe00000 | (3 << 17) | (0xf << 12) | (3 << 10) | (3 << 19))
|
|
|
|
|
2001-09-16 00:42:25 +02:00
|
|
|
int l2_select_table(int bitrate, int nb_channels, int freq, int lsf);
|
2003-11-10 16:21:16 +01:00
|
|
|
int mpa_decode_header(AVCodecContext *avctx, uint32_t head);
|
2001-07-22 16:18:56 +02:00
|
|
|
|
2003-02-11 17:35:48 +01:00
|
|
|
extern const uint16_t mpa_bitrate_tab[2][3][15];
|
|
|
|
extern const uint16_t mpa_freq_tab[3];
|
2001-09-16 00:42:25 +02:00
|
|
|
extern const unsigned char *alloc_tables[5];
|
|
|
|
extern const double enwindow[512];
|
|
|
|
extern const int sblimit_table[5];
|
|
|
|
extern const int quant_steps[17];
|
|
|
|
extern const int quant_bits[17];
|
2003-02-11 17:35:48 +01:00
|
|
|
extern const int32_t mpa_enwindow[257];
|
2005-01-30 15:04:56 +01:00
|
|
|
|
|
|
|
/* fast header check for resync */
|
|
|
|
static inline int ff_mpa_check_header(uint32_t header){
|
|
|
|
/* header */
|
|
|
|
if ((header & 0xffe00000) != 0xffe00000)
|
|
|
|
return -1;
|
|
|
|
/* layer check */
|
|
|
|
if ((header & (3<<17)) == 0)
|
|
|
|
return -1;
|
|
|
|
/* bit rate */
|
|
|
|
if ((header & (0xf<<12)) == 0xf<<12)
|
|
|
|
return -1;
|
|
|
|
/* frequency */
|
|
|
|
if ((header & (3<<10)) == 3<<10)
|
|
|
|
return -1;
|
|
|
|
return 0;
|
|
|
|
}
|