comparison mlpdec.c @ 9533:b724134599eb libavcodec

mlpdec: Don't overallocate buffers. Now that max channels and primitive matrices are properly validated, there is no need to be paranoid that random data will be overwritten. As a bonus this makes matrix_coeff 16-byte aligned between matrices.
author ramiro
date Tue, 21 Apr 2009 22:53:46 +0000
parents 2aabf1a58f19
children d98ad4678fb0
comparison
equal deleted inserted replaced
9532:2aabf1a58f19 9533:b724134599eb
91 uint8_t matrix_out_ch[MAX_MATRICES]; 91 uint8_t matrix_out_ch[MAX_MATRICES];
92 92
93 //! Whether the LSBs of the matrix output are encoded in the bitstream. 93 //! Whether the LSBs of the matrix output are encoded in the bitstream.
94 uint8_t lsb_bypass[MAX_MATRICES]; 94 uint8_t lsb_bypass[MAX_MATRICES];
95 //! Matrix coefficients, stored as 2.14 fixed point. 95 //! Matrix coefficients, stored as 2.14 fixed point.
96 int32_t matrix_coeff[MAX_MATRICES][MAX_CHANNELS+2]; 96 int32_t matrix_coeff[MAX_MATRICES][MAX_CHANNELS];
97 //! Left shift to apply to noise values in 0x31eb substreams. 97 //! Left shift to apply to noise values in 0x31eb substreams.
98 uint8_t matrix_noise_shift[MAX_MATRICES]; 98 uint8_t matrix_noise_shift[MAX_MATRICES];
99 //@} 99 //@}
100 100
101 //! Left shift to apply to Huffman-decoded residuals. 101 //! Left shift to apply to Huffman-decoded residuals.
141 int matrix_changed; 141 int matrix_changed;
142 int filter_changed[MAX_CHANNELS][NUM_FILTERS]; 142 int filter_changed[MAX_CHANNELS][NUM_FILTERS];
143 143
144 int8_t noise_buffer[MAX_BLOCKSIZE_POW2]; 144 int8_t noise_buffer[MAX_BLOCKSIZE_POW2];
145 int8_t bypassed_lsbs[MAX_BLOCKSIZE][MAX_CHANNELS]; 145 int8_t bypassed_lsbs[MAX_BLOCKSIZE][MAX_CHANNELS];
146 int32_t sample_buffer[MAX_BLOCKSIZE][MAX_CHANNELS+2]; 146 int32_t sample_buffer[MAX_BLOCKSIZE][MAX_CHANNELS];
147 } MLPDecodeContext; 147 } MLPDecodeContext;
148 148
149 static VLC huff_vlc[3]; 149 static VLC huff_vlc[3];
150 150
151 /** Initialize static data, constant between all invocations of the codec. */ 151 /** Initialize static data, constant between all invocations of the codec. */