Mercurial > libavcodec.hg
comparison mlpdec.c @ 10415:e16322231312 libavcodec
mlp: Only initialize VLC tables once. This caused a crash when multiple
instances of the decoder were started at different times.
Bug reported by Maxim Anisiutkin.
author | ramiro |
---|---|
date | Fri, 16 Oct 2009 16:10:00 +0000 |
parents | d0fe5dc427f0 |
children | 1052fe7823e8 |
comparison
equal
deleted
inserted
replaced
10414:41bd795ae40b | 10415:e16322231312 |
---|---|
153 | 153 |
154 /** Initialize static data, constant between all invocations of the codec. */ | 154 /** Initialize static data, constant between all invocations of the codec. */ |
155 | 155 |
156 static av_cold void init_static(void) | 156 static av_cold void init_static(void) |
157 { | 157 { |
158 if (!huff_vlc[0].bits) { | |
158 INIT_VLC_STATIC(&huff_vlc[0], VLC_BITS, 18, | 159 INIT_VLC_STATIC(&huff_vlc[0], VLC_BITS, 18, |
159 &ff_mlp_huffman_tables[0][0][1], 2, 1, | 160 &ff_mlp_huffman_tables[0][0][1], 2, 1, |
160 &ff_mlp_huffman_tables[0][0][0], 2, 1, 512); | 161 &ff_mlp_huffman_tables[0][0][0], 2, 1, 512); |
161 INIT_VLC_STATIC(&huff_vlc[1], VLC_BITS, 16, | 162 INIT_VLC_STATIC(&huff_vlc[1], VLC_BITS, 16, |
162 &ff_mlp_huffman_tables[1][0][1], 2, 1, | 163 &ff_mlp_huffman_tables[1][0][1], 2, 1, |
163 &ff_mlp_huffman_tables[1][0][0], 2, 1, 512); | 164 &ff_mlp_huffman_tables[1][0][0], 2, 1, 512); |
164 INIT_VLC_STATIC(&huff_vlc[2], VLC_BITS, 15, | 165 INIT_VLC_STATIC(&huff_vlc[2], VLC_BITS, 15, |
165 &ff_mlp_huffman_tables[2][0][1], 2, 1, | 166 &ff_mlp_huffman_tables[2][0][1], 2, 1, |
166 &ff_mlp_huffman_tables[2][0][0], 2, 1, 512); | 167 &ff_mlp_huffman_tables[2][0][0], 2, 1, 512); |
168 } | |
167 | 169 |
168 ff_mlp_init_crc(); | 170 ff_mlp_init_crc(); |
169 } | 171 } |
170 | 172 |
171 static inline int32_t calculate_sign_huff(MLPDecodeContext *m, | 173 static inline int32_t calculate_sign_huff(MLPDecodeContext *m, |