summaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2006-11-08 18:15:54 +0000
committerMichael Niedermayer <michaelni@gmx.at>2006-11-08 18:15:54 +0000
commitb5ca0c6ff9add05363088bd1944705c8d6b5c4a8 (patch)
treef23c275000cf67102405c3cb9da17036c866b219 /libavcodec
parent171b361e0122499df7faa3f5ed046ab8a19cceb4 (diff)
downloadffmpeg-streaming-b5ca0c6ff9add05363088bd1944705c8d6b5c4a8.zip
ffmpeg-streaming-b5ca0c6ff9add05363088bd1944705c8d6b5c4a8.tar.gz
100l for me, iam being to stupid to read the mpeg4 spec / eat stuffing mbs a the end of the picture
Originally committed as revision 6942 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h263.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/libavcodec/h263.c b/libavcodec/h263.c
index 6a934b5..d86ee8f 100644
--- a/libavcodec/h263.c
+++ b/libavcodec/h263.c
@@ -3188,20 +3188,29 @@ void ff_mpeg4_encode_video_packet_header(MpegEncContext *s)
* @return 0 if not
*/
static inline int mpeg4_is_resync(MpegEncContext *s){
- const int bits_count= get_bits_count(&s->gb);
+ int bits_count= get_bits_count(&s->gb);
+ int v= show_bits(&s->gb, 16);
if(s->workaround_bugs&FF_BUG_NO_PADDING){
return 0;
}
+ while(v<=0xFF){
+ if(s->pict_type==B_TYPE || (v>>(8-s->pict_type)!=1))
+ break;
+ skip_bits(&s->gb, 8+s->pict_type);
+ bits_count+= 8+s->pict_type;
+ v= show_bits(&s->gb, 16);
+ }
+
if(bits_count + 8 >= s->gb.size_in_bits){
- int v= show_bits(&s->gb, 8);
+ v>>=8;
v|= 0x7F >> (7-(bits_count&7));
if(v==0x7F)
return 1;
}else{
- if(show_bits(&s->gb, 16) == ff_mpeg4_resync_prefix[bits_count&7]){
+ if(v == ff_mpeg4_resync_prefix[bits_count&7]){
int len;
GetBitContext gb= s->gb;
@@ -4520,12 +4529,6 @@ end:
/* per-MB end of slice check */
if(s->codec_id==CODEC_ID_MPEG4){
-#if 0 //http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_IEC_14496-4_2004_Conformance_Testing/video_conformance/version_1/simple/ERROR.ZIP/mit025.m4v needs this but its unclear if the mpeg4 standard allows this at all (MN)
- if(s->pict_type != B_TYPE){
- while(show_bits(&s->gb, 9 + (s->pict_type == P_TYPE)) == 1)
- skip_bits(&s->gb, 9 + (s->pict_type == P_TYPE));
- }
-#endif
if(mpeg4_is_resync(s)){
const int delta= s->mb_x + 1 == s->mb_width ? 2 : 1;
if(s->pict_type==B_TYPE && s->next_picture.mbskip_table[xy + delta])
OpenPOWER on IntegriCloud