comparison cavsdec.c @ 5519:b790f8c0ee24 libavcodec

use skip_bits where appropriate
author alex
date Thu, 09 Aug 2007 01:08:28 +0000
parents cb5d5d2ee6fd
children 33718fb21437
comparison
equal deleted inserted replaced
5518:d2ef80f5fd7e 5519:b790f8c0ee24
430 static inline void check_for_slice(AVSContext *h) { 430 static inline void check_for_slice(AVSContext *h) {
431 GetBitContext *gb = &h->s.gb; 431 GetBitContext *gb = &h->s.gb;
432 int align; 432 int align;
433 align = (-get_bits_count(gb)) & 7; 433 align = (-get_bits_count(gb)) & 7;
434 if((show_bits_long(gb,24+align) & 0xFFFFFF) == 0x000001) { 434 if((show_bits_long(gb,24+align) & 0xFFFFFF) == 0x000001) {
435 get_bits_long(gb,24+align); 435 skip_bits_long(gb,24+align);
436 h->stc = get_bits(gb,8); 436 h->stc = get_bits(gb,8);
437 decode_slice_header(h,gb); 437 decode_slice_header(h,gb);
438 } 438 }
439 } 439 }
440 440
453 s->avctx->idct_algo = FF_IDCT_CAVS; 453 s->avctx->idct_algo = FF_IDCT_CAVS;
454 if (MPV_common_init(s) < 0) 454 if (MPV_common_init(s) < 0)
455 return -1; 455 return -1;
456 ff_init_scantable(s->dsp.idct_permutation,&h->scantable,ff_zigzag_direct); 456 ff_init_scantable(s->dsp.idct_permutation,&h->scantable,ff_zigzag_direct);
457 } 457 }
458 get_bits(&s->gb,16);//bbv_dwlay 458 skip_bits(&s->gb,16);//bbv_dwlay
459 if(h->stc == PIC_PB_START_CODE) { 459 if(h->stc == PIC_PB_START_CODE) {
460 h->pic_type = get_bits(&s->gb,2) + FF_I_TYPE; 460 h->pic_type = get_bits(&s->gb,2) + FF_I_TYPE;
461 if(h->pic_type > FF_B_TYPE) { 461 if(h->pic_type > FF_B_TYPE) {
462 av_log(s->avctx, AV_LOG_ERROR, "illegal picture type\n"); 462 av_log(s->avctx, AV_LOG_ERROR, "illegal picture type\n");
463 return -1; 463 return -1;
467 (!h->DPB[1].data[0] && h->pic_type == FF_B_TYPE)) 467 (!h->DPB[1].data[0] && h->pic_type == FF_B_TYPE))
468 return -1; 468 return -1;
469 } else { 469 } else {
470 h->pic_type = FF_I_TYPE; 470 h->pic_type = FF_I_TYPE;
471 if(get_bits1(&s->gb)) 471 if(get_bits1(&s->gb))
472 get_bits(&s->gb,16);//time_code 472 skip_bits(&s->gb,16);//time_code
473 } 473 }
474 /* release last B frame */ 474 /* release last B frame */
475 if(h->picture.data[0]) 475 if(h->picture.data[0])
476 s->avctx->release_buffer(s->avctx, (AVFrame *)&h->picture); 476 s->avctx->release_buffer(s->avctx, (AVFrame *)&h->picture);
477 477
499 get_ue_golomb(&s->gb); //bbv_check_times 499 get_ue_golomb(&s->gb); //bbv_check_times
500 h->progressive = get_bits1(&s->gb); 500 h->progressive = get_bits1(&s->gb);
501 if(h->progressive) 501 if(h->progressive)
502 h->pic_structure = 1; 502 h->pic_structure = 1;
503 else if(!(h->pic_structure = get_bits1(&s->gb) && (h->stc == PIC_PB_START_CODE)) ) 503 else if(!(h->pic_structure = get_bits1(&s->gb) && (h->stc == PIC_PB_START_CODE)) )
504 get_bits1(&s->gb); //advanced_pred_mode_disable 504 skip_bits1(&s->gb); //advanced_pred_mode_disable
505 skip_bits1(&s->gb); //top_field_first 505 skip_bits1(&s->gb); //top_field_first
506 skip_bits1(&s->gb); //repeat_first_field 506 skip_bits1(&s->gb); //repeat_first_field
507 h->qp_fixed = get_bits1(&s->gb); 507 h->qp_fixed = get_bits1(&s->gb);
508 h->qp = get_bits(&s->gb,6); 508 h->qp = get_bits(&s->gb,6);
509 if(h->pic_type == FF_I_TYPE) { 509 if(h->pic_type == FF_I_TYPE) {