Mercurial > libavcodec.hg
comparison msmpeg4.c @ 311:ac677a84d5df libavcodec
wmv1 header parser (unfinished)
author | michaelni |
---|---|
date | Sat, 06 Apr 2002 22:29:37 +0000 |
parents | 49e73229a5e6 |
children | 3c5266cda02d |
comparison
equal
deleted
inserted
replaced
310:49e73229a5e6 | 311:ac677a84d5df |
---|---|
800 return get_bits1(gb) + 1; | 800 return get_bits1(gb) + 1; |
801 } | 801 } |
802 | 802 |
803 int msmpeg4_decode_picture_header(MpegEncContext * s) | 803 int msmpeg4_decode_picture_header(MpegEncContext * s) |
804 { | 804 { |
805 int code; | 805 int code, code2; |
806 | 806 |
807 #if 0 | |
808 { | |
809 int i; | |
810 for(i=0; i<s->gb.size*8; i++) | |
811 printf("%d", get_bits1(&s->gb)); | |
812 // get_bits1(&s->gb); | |
813 printf("END\n"); | |
814 return -1; | |
815 } | |
816 #endif | |
807 s->pict_type = get_bits(&s->gb, 2) + 1; | 817 s->pict_type = get_bits(&s->gb, 2) + 1; |
808 if (s->pict_type != I_TYPE && | 818 if (s->pict_type != I_TYPE && |
809 s->pict_type != P_TYPE) | 819 s->pict_type != P_TYPE) |
810 return -1; | 820 return -1; |
811 | 821 |
815 code = get_bits(&s->gb, 5); | 825 code = get_bits(&s->gb, 5); |
816 /* 0x17: one slice, 0x18: two slices */ | 826 /* 0x17: one slice, 0x18: two slices */ |
817 if (code < 0x17) | 827 if (code < 0x17) |
818 return -1; | 828 return -1; |
819 s->slice_height = s->mb_height / (code - 0x16); | 829 s->slice_height = s->mb_height / (code - 0x16); |
820 if(s->msmpeg4_version==2){ | 830 |
831 switch(s->msmpeg4_version){ | |
832 case 2: | |
821 s->rl_chroma_table_index = 2; | 833 s->rl_chroma_table_index = 2; |
822 s->rl_table_index = 2; | 834 s->rl_table_index = 2; |
823 | 835 |
824 s->dc_table_index = 0; //not used | 836 s->dc_table_index = 0; //not used |
825 }else{ | 837 break; |
838 case 3: | |
826 s->rl_chroma_table_index = decode012(&s->gb); | 839 s->rl_chroma_table_index = decode012(&s->gb); |
827 s->rl_table_index = decode012(&s->gb); | 840 s->rl_table_index = decode012(&s->gb); |
828 | 841 |
829 s->dc_table_index = get_bits1(&s->gb); | 842 s->dc_table_index = get_bits1(&s->gb); |
843 break; | |
844 case 4: | |
845 msmpeg4_decode_ext_header(s, 999 /* bufer size (useless here) */); | |
846 printf("%X\n", show_bits(&s->gb, 24)); | |
847 code= get_bits(&s->gb, 2); | |
848 if(code==1){ | |
849 code2= get_bits(&s->gb, 3); | |
850 if(code2==7) skip_bits(&s->gb, 1); | |
851 } | |
852 printf("%X\n", show_bits(&s->gb, 24)); | |
853 s->rl_chroma_table_index = 2; | |
854 s->rl_table_index = 2; | |
855 | |
856 s->dc_table_index = 0; | |
857 break; | |
830 } | 858 } |
831 s->no_rounding = 1; | 859 s->no_rounding = 1; |
832 /* printf(" %d %d %d %d \n", | 860 /* printf(" %d %d %d %d \n", |
833 s->qscale, | 861 s->qscale, |
834 s->rl_chroma_table_index, | 862 s->rl_chroma_table_index, |
862 s->no_rounding ^= 1; | 890 s->no_rounding ^= 1; |
863 }else{ | 891 }else{ |
864 s->no_rounding = 0; | 892 s->no_rounding = 0; |
865 } | 893 } |
866 // printf("%d", s->no_rounding); | 894 // printf("%d", s->no_rounding); |
895 //return -1; | |
867 } | 896 } |
868 | 897 |
869 #if 0 | 898 #if 0 |
870 if(s->msmpeg4_version==2) | 899 if(s->msmpeg4_version==2) |
871 { | 900 { |
1248 level = -level; | 1277 level = -level; |
1249 } | 1278 } |
1250 i += run; | 1279 i += run; |
1251 if (i >= 64) | 1280 if (i >= 64) |
1252 return -1; | 1281 return -1; |
1282 //printf("RL:%d %d %d ", run, level, last); | |
1253 j = scan_table[i]; | 1283 j = scan_table[i]; |
1254 block[j] = level; | 1284 block[j] = level; |
1255 i++; | 1285 i++; |
1256 if (last) | 1286 if (last) |
1257 break; | 1287 break; |