comparison smacker.c @ 5518:d2ef80f5fd7e libavcodec

use skip_bits where appropriate
author alex
date Thu, 09 Aug 2007 00:57:36 +0000
parents 9f8219a3b86f
children ca944f1db2b3
comparison
equal deleted inserted replaced
5517:998ed46cfa66 5518:d2ef80f5fd7e
199 memset(&vlc[0], 0, sizeof(VLC)); 199 memset(&vlc[0], 0, sizeof(VLC));
200 memset(&vlc[1], 0, sizeof(VLC)); 200 memset(&vlc[1], 0, sizeof(VLC));
201 201
202 if(get_bits1(gb)) { 202 if(get_bits1(gb)) {
203 smacker_decode_tree(gb, &tmp1, 0, 0); 203 smacker_decode_tree(gb, &tmp1, 0, 0);
204 get_bits1(gb); 204 skip_bits1(gb);
205 res = init_vlc(&vlc[0], SMKTREE_BITS, tmp1.length, 205 res = init_vlc(&vlc[0], SMKTREE_BITS, tmp1.length,
206 tmp1.lengths, sizeof(int), sizeof(int), 206 tmp1.lengths, sizeof(int), sizeof(int),
207 tmp1.bits, sizeof(uint32_t), sizeof(uint32_t), INIT_VLC_LE); 207 tmp1.bits, sizeof(uint32_t), sizeof(uint32_t), INIT_VLC_LE);
208 if(res < 0) { 208 if(res < 0) {
209 av_log(smk->avctx, AV_LOG_ERROR, "Cannot build VLC table\n"); 209 av_log(smk->avctx, AV_LOG_ERROR, "Cannot build VLC table\n");
212 } else { 212 } else {
213 av_log(smk->avctx, AV_LOG_ERROR, "Skipping low bytes tree\n"); 213 av_log(smk->avctx, AV_LOG_ERROR, "Skipping low bytes tree\n");
214 } 214 }
215 if(get_bits1(gb)){ 215 if(get_bits1(gb)){
216 smacker_decode_tree(gb, &tmp2, 0, 0); 216 smacker_decode_tree(gb, &tmp2, 0, 0);
217 get_bits1(gb); 217 skip_bits1(gb);
218 res = init_vlc(&vlc[1], SMKTREE_BITS, tmp2.length, 218 res = init_vlc(&vlc[1], SMKTREE_BITS, tmp2.length,
219 tmp2.lengths, sizeof(int), sizeof(int), 219 tmp2.lengths, sizeof(int), sizeof(int),
220 tmp2.bits, sizeof(uint32_t), sizeof(uint32_t), INIT_VLC_LE); 220 tmp2.bits, sizeof(uint32_t), sizeof(uint32_t), INIT_VLC_LE);
221 if(res < 0) { 221 if(res < 0) {
222 av_log(smk->avctx, AV_LOG_ERROR, "Cannot build VLC table\n"); 222 av_log(smk->avctx, AV_LOG_ERROR, "Cannot build VLC table\n");
248 huff.maxlength = 0; 248 huff.maxlength = 0;
249 huff.current = 0; 249 huff.current = 0;
250 huff.values = av_mallocz(huff.length * sizeof(int)); 250 huff.values = av_mallocz(huff.length * sizeof(int));
251 251
252 smacker_decode_bigtree(gb, &huff, &ctx); 252 smacker_decode_bigtree(gb, &huff, &ctx);
253 get_bits1(gb); 253 skip_bits1(gb);
254 if(ctx.last[0] == -1) ctx.last[0] = huff.current++; 254 if(ctx.last[0] == -1) ctx.last[0] = huff.current++;
255 if(ctx.last[1] == -1) ctx.last[1] = huff.current++; 255 if(ctx.last[1] == -1) ctx.last[1] = huff.current++;
256 if(ctx.last[2] == -1) ctx.last[2] = huff.current++; 256 if(ctx.last[2] == -1) ctx.last[2] = huff.current++;
257 257
258 *recodes = huff.values; 258 *recodes = huff.values;
599 h[i].maxlength = 0; 599 h[i].maxlength = 0;
600 h[i].current = 0; 600 h[i].current = 0;
601 h[i].bits = av_mallocz(256 * 4); 601 h[i].bits = av_mallocz(256 * 4);
602 h[i].lengths = av_mallocz(256 * sizeof(int)); 602 h[i].lengths = av_mallocz(256 * sizeof(int));
603 h[i].values = av_mallocz(256 * sizeof(int)); 603 h[i].values = av_mallocz(256 * sizeof(int));
604 get_bits1(&gb); 604 skip_bits1(&gb);
605 smacker_decode_tree(&gb, &h[i], 0, 0); 605 smacker_decode_tree(&gb, &h[i], 0, 0);
606 get_bits1(&gb); 606 skip_bits1(&gb);
607 if(h[i].current > 1) { 607 if(h[i].current > 1) {
608 res = init_vlc(&vlc[i], SMKTREE_BITS, h[i].length, 608 res = init_vlc(&vlc[i], SMKTREE_BITS, h[i].length,
609 h[i].lengths, sizeof(int), sizeof(int), 609 h[i].lengths, sizeof(int), sizeof(int),
610 h[i].bits, sizeof(uint32_t), sizeof(uint32_t), INIT_VLC_LE); 610 h[i].bits, sizeof(uint32_t), sizeof(uint32_t), INIT_VLC_LE);
611 if(res < 0) { 611 if(res < 0) {