comparison mpegaudio.h @ 8641:54e2916c25a5 libavcodec

Avoid allocating MPADecodeContext on stack. Instead move relevant fields into MPADecodeHeader and use it where appropriate.
author andoma
date Fri, 23 Jan 2009 12:09:32 +0000
parents 5b5ac656cb50
children e9d9d946f213
comparison
equal deleted inserted replaced
8640:ad979489c6e7 8641:54e2916c25a5
88 #define BACKSTEP_SIZE 512 88 #define BACKSTEP_SIZE 512
89 #define EXTRABYTES 24 89 #define EXTRABYTES 24
90 90
91 struct GranuleDef; 91 struct GranuleDef;
92 92
93 #define MPA_DECODE_HEADER \
94 int frame_size; \
95 int error_protection; \
96 int layer; \
97 int sample_rate; \
98 int sample_rate_index; /* between 0 and 8 */ \
99 int bit_rate; \
100 int nb_channels; \
101 int mode; \
102 int mode_ext; \
103 int lsf;
104
105 typedef struct MPADecodeHeader {
106 MPA_DECODE_HEADER
107 } MPADecodeHeader;
108
93 typedef struct MPADecodeContext { 109 typedef struct MPADecodeContext {
110 MPA_DECODE_HEADER
94 DECLARE_ALIGNED_8(uint8_t, last_buf[2*BACKSTEP_SIZE + EXTRABYTES]); 111 DECLARE_ALIGNED_8(uint8_t, last_buf[2*BACKSTEP_SIZE + EXTRABYTES]);
95 int last_buf_size; 112 int last_buf_size;
96 int frame_size;
97 /* next header (used in free format parsing) */ 113 /* next header (used in free format parsing) */
98 uint32_t free_format_next_header; 114 uint32_t free_format_next_header;
99 int error_protection;
100 int layer;
101 int sample_rate;
102 int sample_rate_index; /* between 0 and 8 */
103 int bit_rate;
104 GetBitContext gb; 115 GetBitContext gb;
105 GetBitContext in_gb; 116 GetBitContext in_gb;
106 int nb_channels;
107 int mode;
108 int mode_ext;
109 int lsf;
110 DECLARE_ALIGNED_16(MPA_INT, synth_buf[MPA_MAX_CHANNELS][512 * 2]); 117 DECLARE_ALIGNED_16(MPA_INT, synth_buf[MPA_MAX_CHANNELS][512 * 2]);
111 int synth_buf_offset[MPA_MAX_CHANNELS]; 118 int synth_buf_offset[MPA_MAX_CHANNELS];
112 DECLARE_ALIGNED_16(int32_t, sb_samples[MPA_MAX_CHANNELS][36][SBLIMIT]); 119 DECLARE_ALIGNED_16(int32_t, sb_samples[MPA_MAX_CHANNELS][36][SBLIMIT]);
113 int32_t mdct_buf[MPA_MAX_CHANNELS][SBLIMIT * 18]; /* previous samples, for layer 3 MDCT */ 120 int32_t mdct_buf[MPA_MAX_CHANNELS][SBLIMIT * 18]; /* previous samples, for layer 3 MDCT */
114 #ifdef DEBUG 121 #ifdef DEBUG