Mercurial > libavcodec.hg
comparison dv.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 | fb6cbb8a04a3 |
children | c7922c5becf6 |
comparison
equal
deleted
inserted
replaced
1024:9cc1031e1864 | 1025:1f9afd8b9131 |
---|---|
193 #ifdef VLC_DEBUG | 193 #ifdef VLC_DEBUG |
194 printf("v=%04x cnt=%d %04x\n", | 194 printf("v=%04x cnt=%d %04x\n", |
195 v, partial_bit_count, (mb->partial_bit_buffer << l)); | 195 v, partial_bit_count, (mb->partial_bit_buffer << l)); |
196 #endif | 196 #endif |
197 /* try to read the codeword */ | 197 /* try to read the codeword */ |
198 init_get_bits(&gb1, buf, 4); | 198 init_get_bits(&gb1, buf, 4*8); |
199 { | 199 { |
200 OPEN_READER(re1, &gb1); | 200 OPEN_READER(re1, &gb1); |
201 UPDATE_CACHE(re1, &gb1); | 201 UPDATE_CACHE(re1, &gb1); |
202 GET_RL_VLC(level, run, re1, &gb1, dv_rl_vlc[0], | 202 GET_RL_VLC(level, run, re1, &gb1, dv_rl_vlc[0], |
203 TEX_VLC_BITS, 2); | 203 TEX_VLC_BITS, 2); |
331 mb_bit_count = 0; | 331 mb_bit_count = 0; |
332 mb = mb1; | 332 mb = mb1; |
333 block = block1; | 333 block = block1; |
334 for(j = 0;j < 6; j++) { | 334 for(j = 0;j < 6; j++) { |
335 /* NOTE: size is not important here */ | 335 /* NOTE: size is not important here */ |
336 init_get_bits(&s->gb, buf_ptr, 14); | 336 init_get_bits(&s->gb, buf_ptr, 14*8); |
337 | 337 |
338 /* get the dc */ | 338 /* get the dc */ |
339 dc = get_bits(&s->gb, 9); | 339 dc = get_bits(&s->gb, 9); |
340 dc = (dc << (32 - 9)) >> (32 - 9); | 340 dc = (dc << (32 - 9)) >> (32 - 9); |
341 dct_mode = get_bits1(&s->gb); | 341 dct_mode = get_bits1(&s->gb); |
380 #ifdef VLC_DEBUG | 380 #ifdef VLC_DEBUG |
381 printf("***pass 2 size=%d\n", mb_bit_count); | 381 printf("***pass 2 size=%d\n", mb_bit_count); |
382 #endif | 382 #endif |
383 block = block1; | 383 block = block1; |
384 mb = mb1; | 384 mb = mb1; |
385 init_get_bits(&s->gb, mb_bit_buffer, 80); | 385 init_get_bits(&s->gb, mb_bit_buffer, 80*8); |
386 for(j = 0;j < 6; j++) { | 386 for(j = 0;j < 6; j++) { |
387 if (!mb->eob_reached && s->gb.index < mb_bit_count) { | 387 if (!mb->eob_reached && s->gb.index < mb_bit_count) { |
388 dv_decode_ac(s, mb, block, mb_bit_count); | 388 dv_decode_ac(s, mb, block, mb_bit_count); |
389 /* if still not finished, no need to parse other blocks */ | 389 /* if still not finished, no need to parse other blocks */ |
390 if (!mb->eob_reached) { | 390 if (!mb->eob_reached) { |
419 #ifdef VLC_DEBUG | 419 #ifdef VLC_DEBUG |
420 printf("***pass 3 size=%d\n", vs_bit_count); | 420 printf("***pass 3 size=%d\n", vs_bit_count); |
421 #endif | 421 #endif |
422 block = &s->block[0][0]; | 422 block = &s->block[0][0]; |
423 mb = mb_data; | 423 mb = mb_data; |
424 init_get_bits(&s->gb, vs_bit_buffer, 5 * 80); | 424 init_get_bits(&s->gb, vs_bit_buffer, 5 * 80*8); |
425 for(mb_index = 0; mb_index < 5; mb_index++) { | 425 for(mb_index = 0; mb_index < 5; mb_index++) { |
426 for(j = 0;j < 6; j++) { | 426 for(j = 0;j < 6; j++) { |
427 if (!mb->eob_reached) { | 427 if (!mb->eob_reached) { |
428 #ifdef VLC_DEBUG | 428 #ifdef VLC_DEBUG |
429 printf("start %d:%d\n", mb_index, j); | 429 printf("start %d:%d\n", mb_index, j); |
499 int sct, dsf, apt, ds, nb_dif_segs, vs, width, height, i, packet_size; | 499 int sct, dsf, apt, ds, nb_dif_segs, vs, width, height, i, packet_size; |
500 UINT8 *buf_ptr; | 500 UINT8 *buf_ptr; |
501 const UINT16 *mb_pos_ptr; | 501 const UINT16 *mb_pos_ptr; |
502 | 502 |
503 /* parse id */ | 503 /* parse id */ |
504 init_get_bits(&s->gb, buf, buf_size); | 504 init_get_bits(&s->gb, buf, buf_size*8); |
505 sct = get_bits(&s->gb, 3); | 505 sct = get_bits(&s->gb, 3); |
506 if (sct != 0) | 506 if (sct != 0) |
507 return -1; | 507 return -1; |
508 skip_bits(&s->gb, 5); | 508 skip_bits(&s->gb, 5); |
509 get_bits(&s->gb, 4); /* dsn (sequence number */ | 509 get_bits(&s->gb, 4); /* dsn (sequence number */ |