comparison msmpeg4.c @ 300:d874359e58f1 libavcodec

msmpeg4v2 header parser & some dump bits code behind #if 0
author michaelni
date Fri, 29 Mar 2002 02:07:25 +0000
parents fb9e77674bd4
children 764aeec1320e
comparison
equal deleted inserted replaced
299:fb9e77674bd4 300:d874359e58f1
668 return 0; 668 return 0;
669 else 669 else
670 return get_bits1(gb) + 1; 670 return get_bits1(gb) + 1;
671 } 671 }
672 672
673 int msmpeg4v2_decode_picture_header(MpegEncContext * s)
674 {
675 int code;
676
677 s->pict_type = get_bits(&s->gb, 2) + 1;
678 if (s->pict_type != I_TYPE &&
679 s->pict_type != P_TYPE)
680 return -1;
681
682 s->qscale = get_bits(&s->gb, 5);
683
684 if (s->pict_type == I_TYPE) {
685 code = get_bits(&s->gb, 5);
686 /* 0x17: one slice, 0x18: three slices */
687 /* XXX: implement it */
688 //printf("%d %d %d\n", code, s->slice_height, s->first_slice_line);
689 if (code < 0x17)
690 return -1;
691 s->slice_height = s->mb_height / (code - 0x16);
692 /* s->rl_chroma_table_index = decode012(&s->gb);
693 s->rl_table_index = decode012(&s->gb);
694
695 s->dc_table_index = get_bits1(&s->gb);*/
696 s->no_rounding = 1;
697 } else {
698 s->use_skip_mb_code = get_bits1(&s->gb);
699
700 /* s->rl_table_index = decode012(&s->gb);
701 s->rl_chroma_table_index = s->rl_table_index;
702
703 s->dc_table_index = get_bits1(&s->gb);
704
705 s->mv_table_index = get_bits1(&s->gb);*/
706 if(s->flipflop_rounding){
707 s->no_rounding ^= 1;
708 }else{
709 s->no_rounding = 0;
710 }
711 // printf("%d", s->no_rounding);
712 }
713
714 printf("%s q:%d s:%X ", s->pict_type == I_TYPE ? "I" : "P" , s->qscale,
715 s->pict_type == I_TYPE ? code : s->use_skip_mb_code);
716
717 return 0;
718 }
719
673 int msmpeg4_decode_picture_header(MpegEncContext * s) 720 int msmpeg4_decode_picture_header(MpegEncContext * s)
674 { 721 {
675 int code; 722 int code;
676 723 #if 0
724 {
725 int i;
726 msmpeg4v2_decode_picture_header(s);
727 for(i=0; i<s->gb.size*8; i++)
728 printf("%d", get_bits1(&s->gb));
729 printf("END\n");
730 return -1;
731 }
732 #endif
677 s->pict_type = get_bits(&s->gb, 2) + 1; 733 s->pict_type = get_bits(&s->gb, 2) + 1;
678 if (s->pict_type != I_TYPE && 734 if (s->pict_type != I_TYPE &&
679 s->pict_type != P_TYPE) 735 s->pict_type != P_TYPE)
680 return -1; 736 return -1;
681 737