Mercurial > libavcodec.hg
comparison mpegaudio.h @ 10494:ead8d96926c4 libavcodec
Reduce stack memory allocation in MP3 decoder
author | vitor |
---|---|
date | Wed, 04 Nov 2009 23:33:08 +0000 |
parents | 899237b1961f |
children | 34a65026fa06 |
comparison
equal
deleted
inserted
replaced
10493:5f2ced30548b | 10494:ead8d96926c4 |
---|---|
86 #endif | 86 #endif |
87 | 87 |
88 #define BACKSTEP_SIZE 512 | 88 #define BACKSTEP_SIZE 512 |
89 #define EXTRABYTES 24 | 89 #define EXTRABYTES 24 |
90 | 90 |
91 struct GranuleDef; | 91 /* layer 3 "granule" */ |
92 typedef struct GranuleDef { | |
93 uint8_t scfsi; | |
94 int part2_3_length; | |
95 int big_values; | |
96 int global_gain; | |
97 int scalefac_compress; | |
98 uint8_t block_type; | |
99 uint8_t switch_point; | |
100 int table_select[3]; | |
101 int subblock_gain[3]; | |
102 uint8_t scalefac_scale; | |
103 uint8_t count1table_select; | |
104 int region_size[3]; /* number of huffman codes in each region */ | |
105 int preflag; | |
106 int short_start, long_end; /* long/short band indexes */ | |
107 uint8_t scale_factors[40]; | |
108 int32_t sb_hybrid[SBLIMIT * 18]; /* 576 samples */ | |
109 } GranuleDef; | |
92 | 110 |
93 #define MPA_DECODE_HEADER \ | 111 #define MPA_DECODE_HEADER \ |
94 int frame_size; \ | 112 int frame_size; \ |
95 int error_protection; \ | 113 int error_protection; \ |
96 int layer; \ | 114 int layer; \ |
116 GetBitContext in_gb; | 134 GetBitContext in_gb; |
117 DECLARE_ALIGNED_16(MPA_INT, synth_buf[MPA_MAX_CHANNELS][512 * 2]); | 135 DECLARE_ALIGNED_16(MPA_INT, synth_buf[MPA_MAX_CHANNELS][512 * 2]); |
118 int synth_buf_offset[MPA_MAX_CHANNELS]; | 136 int synth_buf_offset[MPA_MAX_CHANNELS]; |
119 DECLARE_ALIGNED_16(int32_t, sb_samples[MPA_MAX_CHANNELS][36][SBLIMIT]); | 137 DECLARE_ALIGNED_16(int32_t, sb_samples[MPA_MAX_CHANNELS][36][SBLIMIT]); |
120 int32_t mdct_buf[MPA_MAX_CHANNELS][SBLIMIT * 18]; /* previous samples, for layer 3 MDCT */ | 138 int32_t mdct_buf[MPA_MAX_CHANNELS][SBLIMIT * 18]; /* previous samples, for layer 3 MDCT */ |
139 GranuleDef granules[2][2]; /* Used in Layer 3 */ | |
121 #ifdef DEBUG | 140 #ifdef DEBUG |
122 int frame_count; | 141 int frame_count; |
123 #endif | 142 #endif |
124 void (*compute_antialias)(struct MPADecodeContext *s, struct GranuleDef *g); | 143 void (*compute_antialias)(struct MPADecodeContext *s, struct GranuleDef *g); |
125 int adu_mode; ///< 0 for standard mp3, 1 for adu formatted mp3 | 144 int adu_mode; ///< 0 for standard mp3, 1 for adu formatted mp3 |