comparison mpegaudio.h @ 84:608c7f964bca libavcodec

merged code and tables between encoder and decoder
author glantau
date Sat, 15 Sep 2001 22:42:25 +0000
parents 5aa6292a1660
children e2fdb793069c
comparison
equal deleted inserted replaced
83:2969a96650e5 84:608c7f964bca
1 /* mpeg audio declarations for both encoder and decoder */
2
3 /* max frame size, in samples */
4 #define MPA_FRAME_SIZE 1152
1 5
2 /* max compressed frame size */ 6 /* max compressed frame size */
3 #define MPA_MAX_CODED_FRAME_SIZE 1200 7 #define MPA_MAX_CODED_FRAME_SIZE 1792
4 8
5 #define MPA_FRAME_SIZE 1152
6 #define MPA_MAX_CHANNELS 2 9 #define MPA_MAX_CHANNELS 2
7 10
8 #define SAMPLES_BUF_SIZE 4096
9 #define SBLIMIT 32 /* number of subbands */ 11 #define SBLIMIT 32 /* number of subbands */
10 #define DCT_BITS 14 /* number of bits for the DCT */
11 #define MUL(a,b) (((a) * (b)) >> DCT_BITS)
12 #define FIX(a) ((int)((a) * (1 << DCT_BITS)))
13 12
14 typedef struct MpegAudioContext { 13 #define MPA_STEREO 0
15 PutBitContext pb; 14 #define MPA_JSTEREO 1
16 int nb_channels; 15 #define MPA_DUAL 2
17 int freq, bit_rate; 16 #define MPA_MONO 3
18 int lsf; /* 1 if mpeg2 low bitrate selected */
19 int bitrate_index; /* bit rate */
20 int freq_index;
21 int frame_size; /* frame size, in bits, without padding */
22 INT64 nb_samples; /* total number of samples encoded */
23 /* padding computation */
24 int frame_frac, frame_frac_incr, do_padding;
25 short samples_buf[MPA_MAX_CHANNELS][SAMPLES_BUF_SIZE]; /* buffer for filter */
26 int samples_offset[MPA_MAX_CHANNELS]; /* offset in samples_buf */
27 int sb_samples[MPA_MAX_CHANNELS][3][12][SBLIMIT];
28 unsigned char scale_factors[MPA_MAX_CHANNELS][SBLIMIT][3]; /* scale factors */
29 /* code to group 3 scale factors */
30 unsigned char scale_code[MPA_MAX_CHANNELS][SBLIMIT];
31 int sblimit; /* number of used subbands */
32 const unsigned char *alloc_table;
33 } MpegAudioContext;
34 17
18 int l2_select_table(int bitrate, int nb_channels, int freq, int lsf);
19
20 const UINT16 mpa_bitrate_tab[2][3][15];
21 const UINT16 mpa_freq_tab[3];
22 extern const unsigned char *alloc_tables[5];
23 extern const double enwindow[512];
24 extern const int sblimit_table[5];
25 extern const int quant_steps[17];
26 extern const int quant_bits[17];
27 extern const INT32 mpa_enwindow[257];