diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2003-12-09 13:47:08 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2003-12-09 13:47:08 +0000 |
commit | 0ed714a7027f9655cab98f2cbf2662a764ec4d82 (patch) | |
tree | 03da7c778a06c8751543342708003f538d363b5e /libavcodec/h263.c | |
parent | 5ea4b18d9ff2c0cf9a268ccafa40e82a90a46932 (diff) | |
download | ffmpeg-0ed714a7027f9655cab98f2cbf2662a764ec4d82.tar.gz |
slice structured fixes
Originally committed as revision 2581 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h263.c')
-rw-r--r-- | libavcodec/h263.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/libavcodec/h263.c b/libavcodec/h263.c index 330d572f51..3bf5f700b1 100644 --- a/libavcodec/h263.c +++ b/libavcodec/h263.c @@ -288,6 +288,15 @@ void h263_encode_picture_header(MpegEncContext * s, int picture_number) put_bits(&s->pb, 1, 0); /* no PEI */ + if(s->h263_slice_structured){ + put_bits(&s->pb, 1, 1); + + assert(s->mb_x == 0 && s->mb_y == 0); + ff_h263_encode_mba(s); + + put_bits(&s->pb, 1, 1); + } + if(s->h263_aic){ s->y_dc_scale_table= s->c_dc_scale_table= ff_aic_dc_scale_table; @@ -2814,7 +2823,7 @@ int ff_h263_decode_mba(MpegEncContext *s) int i, mb_pos; for(i=0; i<6; i++){ - if(s->mb_num < ff_mba_max[i]) break; + if(s->mb_num-1 <= ff_mba_max[i]) break; } mb_pos= get_bits(&s->gb, ff_mba_length[i]); s->mb_x= mb_pos % s->mb_width; @@ -2828,7 +2837,7 @@ void ff_h263_encode_mba(MpegEncContext *s) int i, mb_pos; for(i=0; i<6; i++){ - if(s->mb_num < ff_mba_max[i]) break; + if(s->mb_num-1 <= ff_mba_max[i]) break; } mb_pos= s->mb_x + s->mb_width*s->mb_y; put_bits(&s->pb, ff_mba_length[i], mb_pos); @@ -3135,6 +3144,7 @@ int ff_h263_resync(MpegEncContext *s){ align_get_bits(&s->gb); } +//printf("checking next 16 %X\n", show_bits(&s->gb, 24)); if(show_bits(&s->gb, 16)==0){ if(s->codec_id==CODEC_ID_MPEG4) ret= mpeg4_decode_video_packet_header(s); @@ -3146,6 +3156,7 @@ int ff_h263_resync(MpegEncContext *s){ //ok, its not where its supposed to be ... s->gb= s->last_resync_gb; align_get_bits(&s->gb); +printf("align %X\n", show_bits(&s->gb, 24)); left= s->gb.size_in_bits - get_bits_count(&s->gb); for(;left>16+1+5+5; left-=8){ @@ -3163,7 +3174,7 @@ int ff_h263_resync(MpegEncContext *s){ } skip_bits(&s->gb, 8); } - +printf("no resync\n"); return -1; } @@ -4962,10 +4973,25 @@ int h263_decode_picture_header(MpegEncContext *s) s->qscale = get_bits(&s->gb, 5); } + /* PEI */ while (get_bits1(&s->gb) != 0) { skip_bits(&s->gb, 8); } + + if(s->h263_slice_structured){ + if (get_bits1(&s->gb) != 1) { + av_log(s->avctx, AV_LOG_ERROR, "SEPB1 marker missing\n"); + return -1; + } + + ff_h263_decode_mba(s); + + if (get_bits1(&s->gb) != 1) { + av_log(s->avctx, AV_LOG_ERROR, "SEPB2 marker missing\n"); + return -1; + } + } s->f_code = 1; if(s->h263_aic){ |