diff options
Diffstat (limited to 'src/libffmpeg/libavcodec/h263dec.c')
-rw-r--r-- | src/libffmpeg/libavcodec/h263dec.c | 45 |
1 files changed, 17 insertions, 28 deletions
diff --git a/src/libffmpeg/libavcodec/h263dec.c b/src/libffmpeg/libavcodec/h263dec.c index d0ce51493..98215bf4c 100644 --- a/src/libffmpeg/libavcodec/h263dec.c +++ b/src/libffmpeg/libavcodec/h263dec.c @@ -209,7 +209,7 @@ static int decode_slice(MpegEncContext *s){ MPV_decode_mb(s, s->block); if(ret<0){ - const int xy= s->mb_x + s->mb_y*s->mb_width; + const int xy= s->mb_x + s->mb_y*s->mb_stride; if(ret==SLICE_END){ //printf("%d %d %d %06X\n", s->mb_x, s->mb_y, s->gb.size*8 - get_bits_count(&s->gb), show_bits(&s->gb, 24)); ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)&part_mask); @@ -484,7 +484,7 @@ retry: avctx->has_b_frames= !s->low_delay; if(s->workaround_bugs&FF_BUG_AUTODETECT){ - if(s->padding_bug_score > -2 && !s->data_partitioning) + if(s->padding_bug_score > -2 && !s->data_partitioning && !s->resync_marker) s->workaround_bugs |= FF_BUG_NO_PADDING; else s->workaround_bugs &= ~FF_BUG_NO_PADDING; @@ -643,20 +643,21 @@ retry: ff_er_frame_start(s); + //the second part of the wmv2 header contains the MB skip bits which are stored in current_picture->mb_type + //which isnt available before MPV_frame_start() + if (s->msmpeg4_version==5){ + if(ff_wmv2_decode_secondary_picture_header(s) < 0) + return -1; + } + /* decode each macroblock */ - s->block_wrap[0]= - s->block_wrap[1]= - s->block_wrap[2]= - s->block_wrap[3]= s->mb_width*2 + 2; - s->block_wrap[4]= - s->block_wrap[5]= s->mb_width + 2; s->mb_x=0; s->mb_y=0; decode_slice(s); - while(s->mb_y<s->mb_height && s->gb.size_in_bits - get_bits_count(&s->gb)>16){ + while(s->mb_y<s->mb_height){ if(s->msmpeg4_version){ - if(s->mb_x!=0 || (s->mb_y%s->slice_height)!=0) + if(s->mb_x!=0 || (s->mb_y%s->slice_height)!=0 || get_bits_count(&s->gb) > s->gb.size_in_bits) break; }else{ if(ff_h263_resync(s)<0) @@ -708,8 +709,8 @@ retry: for(mb_y=0; mb_y<s->mb_height; mb_y++){ int mb_x; for(mb_x=0; mb_x<s->mb_width; mb_x++){ - const int mb_index= mb_x + mb_y*s->mb_width; - if(s->co_located_type_table[mb_index] == MV_TYPE_8X8){ + const int mb_index= mb_x + mb_y*s->mb_stride; + if(IS_8X8(s->current_picture.mb_type[mb_index])){ int i; for(i=0; i<4; i++){ int sx= mb_x*16 + 4 + 8*(i&1); @@ -732,24 +733,12 @@ retry: } } - if(s->pict_type==B_TYPE || s->low_delay){ *pict= *(AVFrame*)&s->current_picture; + ff_print_debug_info(s, s->current_picture_ptr); } else { *pict= *(AVFrame*)&s->last_picture; - } - - if(avctx->debug&FF_DEBUG_QP){ - int8_t *qtab= pict->qscale_table; - int x,y; - - for(y=0; y<s->mb_height; y++){ - for(x=0; x<s->mb_width; x++){ - printf("%2d ", qtab[x + y*s->mb_width]); - } - printf("\n"); - } - printf("\n"); + ff_print_debug_info(s, s->last_picture_ptr); } /* Return the Picture timestamp as the frame number */ @@ -781,7 +770,7 @@ AVCodec mpeg4_decoder = { ff_h263_decode_end, ff_h263_decode_frame, CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED, - mpeg4_decoptions, + .options = mpeg4_decoptions, }; AVCodec h263_decoder = { @@ -832,7 +821,7 @@ AVCodec msmpeg4v3_decoder = { ff_h263_decode_end, ff_h263_decode_frame, CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, - mpeg4_decoptions, + .options = mpeg4_decoptions, }; AVCodec wmv1_decoder = { |