Mercurial > libavcodec.hg
comparison h263.c @ 365:fdeec2834c79 libavcodec
there are divx5? encoded files without a userdata section but with b-frames :(
author | michaelni |
---|---|
date | Mon, 06 May 2002 13:15:05 +0000 |
parents | 6b6332e7008a |
children | fce0a2520551 |
comparison
equal
deleted
inserted
replaced
364:6b6332e7008a | 365:fdeec2834c79 |
---|---|
2745 /* decode mpeg4 VOP header */ | 2745 /* decode mpeg4 VOP header */ |
2746 int mpeg4_decode_picture_header(MpegEncContext * s) | 2746 int mpeg4_decode_picture_header(MpegEncContext * s) |
2747 { | 2747 { |
2748 int time_incr, startcode, state, v; | 2748 int time_incr, startcode, state, v; |
2749 int time_increment; | 2749 int time_increment; |
2750 int vol_control=-1; | |
2751 | 2750 |
2752 redo: | 2751 redo: |
2753 /* search next start code */ | 2752 /* search next start code */ |
2754 align_get_bits(&s->gb); | 2753 align_get_bits(&s->gb); |
2755 state = 0xff; | 2754 state = 0xff; |
2789 if(s->aspect_ratio_info == EXTENDED_PAR){ | 2788 if(s->aspect_ratio_info == EXTENDED_PAR){ |
2790 skip_bits(&s->gb, 8); //par_width | 2789 skip_bits(&s->gb, 8); //par_width |
2791 skip_bits(&s->gb, 8); // par_height | 2790 skip_bits(&s->gb, 8); // par_height |
2792 } | 2791 } |
2793 | 2792 |
2794 if ((vol_control=get_bits1(&s->gb))) { /* vol control parameter */ | 2793 if ((s->vol_control_parameters=get_bits1(&s->gb))) { /* vol control parameter */ |
2795 int chroma_format= get_bits(&s->gb, 2); | 2794 int chroma_format= get_bits(&s->gb, 2); |
2796 if(chroma_format!=1){ | 2795 if(chroma_format!=1){ |
2797 printf("illegal chroma format\n"); | 2796 printf("illegal chroma format\n"); |
2798 } | 2797 } |
2799 s->low_delay= get_bits1(&s->gb); | 2798 s->low_delay= get_bits1(&s->gb); |
2998 } else if (startcode != 0x1b6) { //VOP | 2997 } else if (startcode != 0x1b6) { //VOP |
2999 goto redo; | 2998 goto redo; |
3000 } | 2999 } |
3001 | 3000 |
3002 s->pict_type = get_bits(&s->gb, 2) + I_TYPE; /* pict type: I = 0 , P = 1 */ | 3001 s->pict_type = get_bits(&s->gb, 2) + I_TYPE; /* pict type: I = 0 , P = 1 */ |
3002 if(s->pict_type==B_TYPE && s->low_delay && s->vol_control_parameters==0){ | |
3003 printf("low_delay flag set, but shouldnt, clearing it\n"); | |
3004 s->low_delay=0; | |
3005 } | |
3003 // printf("pic: %d, qpel:%d\n", s->pict_type, s->quarter_sample); | 3006 // printf("pic: %d, qpel:%d\n", s->pict_type, s->quarter_sample); |
3004 time_incr=0; | 3007 time_incr=0; |
3005 while (get_bits1(&s->gb) != 0) | 3008 while (get_bits1(&s->gb) != 0) |
3006 time_incr++; | 3009 time_incr++; |
3007 | 3010 |
3107 } | 3110 } |
3108 } | 3111 } |
3109 } | 3112 } |
3110 /* detect buggy encoders which dont set the low_delay flag (divx4/xvid/opendivx)*/ | 3113 /* detect buggy encoders which dont set the low_delay flag (divx4/xvid/opendivx)*/ |
3111 // note we cannot detect divx5 without b-frames easyly (allthough its buggy too) | 3114 // note we cannot detect divx5 without b-frames easyly (allthough its buggy too) |
3112 if(s->vo_type==0 && vol_control==0 && s->divx_version==0){ | 3115 if(s->vo_type==0 && s->vol_control_parameters==0 && s->divx_version==0 && s->picture_number==0){ |
3113 if(s->picture_number==0) | 3116 printf("looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag\n"); |
3114 printf("looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag\n"); | |
3115 s->low_delay=1; | 3117 s->low_delay=1; |
3116 } | 3118 } |
3117 | 3119 |
3118 s->picture_number++; // better than pic number==0 allways ;) | 3120 s->picture_number++; // better than pic number==0 allways ;) |
3119 //printf("done\n"); | 3121 //printf("done\n"); |