comparison mpegaudio.h @ 5050:a5f6fbc9fa66 libavcodec

loosen dependencies over mpegaudiodec
author aurel
date Sun, 20 May 2007 13:40:07 +0000
parents 3c034e71667f
children b908c67063c8
comparison
equal deleted inserted replaced
5049:668249bc4c16 5050:a5f6fbc9fa66
20 20
21 /** 21 /**
22 * @file mpegaudio.h 22 * @file mpegaudio.h
23 * mpeg audio declarations for both encoder and decoder. 23 * mpeg audio declarations for both encoder and decoder.
24 */ 24 */
25
26 #ifndef MPEGAUDIO_H
27 #define MPEGAUDIO_H
28
29 #include "bitstream.h"
30 #include "dsputil.h"
25 31
26 /* max frame size, in samples */ 32 /* max frame size, in samples */
27 #define MPA_FRAME_SIZE 1152 33 #define MPA_FRAME_SIZE 1152
28 34
29 /* max compressed frame size */ 35 /* max compressed frame size */
71 typedef int16_t MPA_INT; 77 typedef int16_t MPA_INT;
72 #else 78 #else
73 typedef int32_t MPA_INT; 79 typedef int32_t MPA_INT;
74 #endif 80 #endif
75 81
82 #define BACKSTEP_SIZE 512
83 #define EXTRABYTES 24
84
85 struct GranuleDef;
86
87 typedef struct MPADecodeContext {
88 DECLARE_ALIGNED_8(uint8_t, last_buf[2*BACKSTEP_SIZE + EXTRABYTES]);
89 int last_buf_size;
90 int frame_size;
91 /* next header (used in free format parsing) */
92 uint32_t free_format_next_header;
93 int error_protection;
94 int layer;
95 int sample_rate;
96 int sample_rate_index; /* between 0 and 8 */
97 int bit_rate;
98 GetBitContext gb;
99 GetBitContext in_gb;
100 int nb_channels;
101 int mode;
102 int mode_ext;
103 int lsf;
104 DECLARE_ALIGNED_16(MPA_INT, synth_buf[MPA_MAX_CHANNELS][512 * 2]);
105 int synth_buf_offset[MPA_MAX_CHANNELS];
106 DECLARE_ALIGNED_16(int32_t, sb_samples[MPA_MAX_CHANNELS][36][SBLIMIT]);
107 int32_t mdct_buf[MPA_MAX_CHANNELS][SBLIMIT * 18]; /* previous samples, for layer 3 MDCT */
108 #ifdef DEBUG
109 int frame_count;
110 #endif
111 void (*compute_antialias)(struct MPADecodeContext *s, struct GranuleDef *g);
112 int adu_mode; ///< 0 for standard mp3, 1 for adu formatted mp3
113 int dither_state;
114 int error_resilience;
115 AVCodecContext* avctx;
116 } MPADecodeContext;
117
76 int l2_select_table(int bitrate, int nb_channels, int freq, int lsf); 118 int l2_select_table(int bitrate, int nb_channels, int freq, int lsf);
77 int mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate); 119 int mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate);
78 void ff_mpa_synth_init(MPA_INT *window); 120 void ff_mpa_synth_init(MPA_INT *window);
79 void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, 121 void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset,
80 MPA_INT *window, int *dither_state, 122 MPA_INT *window, int *dither_state,
95 /* frequency */ 137 /* frequency */
96 if ((header & (3<<10)) == 3<<10) 138 if ((header & (3<<10)) == 3<<10)
97 return -1; 139 return -1;
98 return 0; 140 return 0;
99 } 141 }
142
143 #endif /* MPEGAUDIO_H */