Mercurial > libavcodec.hg
comparison huffyuv.c @ 1025:1f9afd8b9131 libavcodec
GetBitContext.size is allways multiplied by 8 -> use size_in_bits to avoid useless *8 in a few inner loops
author | michaelni |
---|---|
date | Tue, 21 Jan 2003 17:34:12 +0000 |
parents | a32feda30b01 |
children | b32afefe7d33 |
comparison
equal
deleted
inserted
replaced
1024:9cc1031e1864 | 1025:1f9afd8b9131 |
---|---|
269 | 269 |
270 static int read_huffman_tables(HYuvContext *s, uint8_t *src, int length){ | 270 static int read_huffman_tables(HYuvContext *s, uint8_t *src, int length){ |
271 GetBitContext gb; | 271 GetBitContext gb; |
272 int i; | 272 int i; |
273 | 273 |
274 init_get_bits(&gb, src, length); | 274 init_get_bits(&gb, src, length*8); |
275 | 275 |
276 for(i=0; i<3; i++){ | 276 for(i=0; i<3; i++){ |
277 read_len_table(s->len[i], &gb); | 277 read_len_table(s->len[i], &gb); |
278 | 278 |
279 if(generate_bits_table(s->bits[i], s->len[i])<0){ | 279 if(generate_bits_table(s->bits[i], s->len[i])<0){ |
293 static int read_old_huffman_tables(HYuvContext *s){ | 293 static int read_old_huffman_tables(HYuvContext *s){ |
294 #if 0 | 294 #if 0 |
295 GetBitContext gb; | 295 GetBitContext gb; |
296 int i; | 296 int i; |
297 | 297 |
298 init_get_bits(&gb, classic_shift_luma, sizeof(classic_shift_luma)); | 298 init_get_bits(&gb, classic_shift_luma, sizeof(classic_shift_luma)*8); |
299 read_len_table(s->len[0], &gb); | 299 read_len_table(s->len[0], &gb); |
300 init_get_bits(&gb, classic_shift_chroma, sizeof(classic_shift_chroma)); | 300 init_get_bits(&gb, classic_shift_chroma, sizeof(classic_shift_chroma)*8); |
301 read_len_table(s->len[1], &gb); | 301 read_len_table(s->len[1], &gb); |
302 | 302 |
303 for(i=0; i<256; i++) s->bits[0][i] = classic_add_luma [i]; | 303 for(i=0; i<256; i++) s->bits[0][i] = classic_add_luma [i]; |
304 for(i=0; i<256; i++) s->bits[1][i] = classic_add_chroma[i]; | 304 for(i=0; i<256; i++) s->bits[1][i] = classic_add_chroma[i]; |
305 | 305 |
678 if (buf_size == 0) | 678 if (buf_size == 0) |
679 return 0; | 679 return 0; |
680 | 680 |
681 bswap_buf((uint32_t*)s->bitstream_buffer, (uint32_t*)buf, buf_size/4); | 681 bswap_buf((uint32_t*)s->bitstream_buffer, (uint32_t*)buf, buf_size/4); |
682 | 682 |
683 init_get_bits(&s->gb, s->bitstream_buffer, buf_size); | 683 init_get_bits(&s->gb, s->bitstream_buffer, buf_size*8); |
684 | 684 |
685 p->reference= 0; | 685 p->reference= 0; |
686 if(avctx->get_buffer(avctx, p) < 0){ | 686 if(avctx->get_buffer(avctx, p) < 0){ |
687 fprintf(stderr, "get_buffer() failed\n"); | 687 fprintf(stderr, "get_buffer() failed\n"); |
688 return -1; | 688 return -1; |