diff --git a/libavcodec/h261.c b/libavcodec/h261.c index cc6d34fdc7..630cf8f580 100644 --- a/libavcodec/h261.c +++ b/libavcodec/h261.c @@ -531,7 +531,6 @@ static int h261_decode_mb_skipped(H261Context *h, int mba1, int mba2 ) xy = s->mb_x + s->mb_y * s->mb_stride; ff_init_block_index(s); ff_update_block_index(s); - s->dsp.clear_blocks(s->block[0]); for(j=0;j<6;j++) s->block_last_index[j] = -1; @@ -606,7 +605,6 @@ static int h261_decode_mb(H261Context *h){ xy = s->mb_x + s->mb_y * s->mb_stride; ff_init_block_index(s); ff_update_block_index(s); - s->dsp.clear_blocks(s->block[0]); // Read mtype h->mtype = get_vlc2(&s->gb, h261_mtype_vlc.table, H261_MTYPE_VLC_BITS, 2); @@ -661,12 +659,16 @@ static int h261_decode_mb(H261Context *h){ intra: /* decode each block */ if(s->mb_intra || HAS_CBP(h->mtype)){ + s->dsp.clear_blocks(s->block[0]); for (i = 0; i < 6; i++) { if (h261_decode_block(h, s->block[i], i, cbp&32) < 0){ return SLICE_ERROR; } cbp+=cbp; } + }else{ + for (i = 0; i < 6; i++) + s->block_last_index[i]= -1; } MPV_decode_mb(s, s->block); diff --git a/libavcodec/h263.c b/libavcodec/h263.c index 4cd2204b29..7561c518e1 100644 --- a/libavcodec/h263.c +++ b/libavcodec/h263.c @@ -3753,6 +3753,7 @@ static int mpeg4_decode_partitioned_mb(MpegEncContext *s, DCTELEM block[6][64]) if (!IS_SKIP(mb_type)) { int i; + s->dsp.clear_blocks(s->block[0]); /* decode each block */ for (i = 0; i < 6; i++) { if(mpeg4_decode_block(s, block[i], i, cbp&32, s->mb_intra, s->rvlc) < 0){ @@ -3921,6 +3922,8 @@ int ff_h263_decode_mb(MpegEncContext *s, } }while(cbpc == 20); + s->dsp.clear_blocks(s->block[0]); + dquant = cbpc & 8; s->mb_intra = ((cbpc & 4) != 0); if (s->mb_intra) goto intra; @@ -4024,6 +4027,7 @@ int ff_h263_decode_mb(MpegEncContext *s, s->mb_intra = IS_INTRA(mb_type); if(HAS_CBP(mb_type)){ + s->dsp.clear_blocks(s->block[0]); cbpc = get_vlc2(&s->gb, cbpc_b_vlc.table, CBPC_B_VLC_BITS, 1); if(s->mb_intra){ dquant = IS_QUANT(mb_type); @@ -4102,6 +4106,8 @@ int ff_h263_decode_mb(MpegEncContext *s, } }while(cbpc == 8); + s->dsp.clear_blocks(s->block[0]); + dquant = cbpc & 4; s->mb_intra = 1; intra: @@ -4193,6 +4199,7 @@ int ff_mpeg4_decode_mb(MpegEncContext *s, } }while(cbpc == 20); + s->dsp.clear_blocks(s->block[0]); dquant = cbpc & 8; s->mb_intra = ((cbpc & 4) != 0); if (s->mb_intra) goto intra; @@ -4324,7 +4331,10 @@ int ff_mpeg4_decode_mb(MpegEncContext *s, } mb_type= mb_type_b_map[ mb_type ]; if(modb2) cbp= 0; - else cbp= get_bits(&s->gb, 6); + else{ + s->dsp.clear_blocks(s->block[0]); + cbp= get_bits(&s->gb, 6); + } if ((!IS_DIRECT(mb_type)) && cbp) { if(get_bits1(&s->gb)){ @@ -4442,6 +4452,7 @@ intra: if(!s->progressive_sequence) s->interlaced_dct= get_bits1(&s->gb); + s->dsp.clear_blocks(s->block[0]); /* decode each block */ for (i = 0; i < 6; i++) { if (mpeg4_decode_block(s, block[i], i, cbp&32, 1, 0) < 0) diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 6111f170a5..04c1e2726a 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -195,8 +195,7 @@ static int decode_slice(MpegEncContext *s){ } /* DCT & quantize */ - s->dsp.clear_blocks(s->block[0]); - + s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; // s->mb_skipped = 0; diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c index 23e4c1ec8b..468e07d2a8 100644 --- a/libavcodec/msmpeg4.c +++ b/libavcodec/msmpeg4.c @@ -1552,6 +1552,7 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) } } + s->dsp.clear_blocks(s->block[0]); for (i = 0; i < 6; i++) { if (msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0) { @@ -1644,6 +1645,7 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) } } + s->dsp.clear_blocks(s->block[0]); for (i = 0; i < 6; i++) { if (msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0) { diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index e2f37c6c59..c5068c5685 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -669,7 +669,6 @@ static int rv10_decode_packet(AVCodecContext *avctx, printf("**mb x=%d y=%d\n", s->mb_x, s->mb_y); #endif - s->dsp.clear_blocks(s->block[0]); s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; ret=ff_h263_decode_mb(s, s->block); diff --git a/libavcodec/wmv2.c b/libavcodec/wmv2.c index e14ee08481..b3e31a4d0f 100644 --- a/libavcodec/wmv2.c +++ b/libavcodec/wmv2.c @@ -760,6 +760,7 @@ static int wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) wmv2_pred_motion(w, &mx, &my); if(cbp){ + s->dsp.clear_blocks(s->block[0]); if(s->per_mb_rl_table){ s->rl_table_index = decode012(&s->gb); s->rl_chroma_table_index = s->rl_table_index; @@ -802,6 +803,7 @@ static int wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) s->rl_chroma_table_index = s->rl_table_index; } + s->dsp.clear_blocks(s->block[0]); for (i = 0; i < 6; i++) { if (msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0) {