Commit dee6dde6 authored by Michael Niedermayer's avatar Michael Niedermayer

avoid unneeded clear_blocks()

Originally committed as revision 4157 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent f9e0f2a2
...@@ -531,7 +531,6 @@ static int h261_decode_mb_skipped(H261Context *h, int mba1, int mba2 ) ...@@ -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; xy = s->mb_x + s->mb_y * s->mb_stride;
ff_init_block_index(s); ff_init_block_index(s);
ff_update_block_index(s); ff_update_block_index(s);
s->dsp.clear_blocks(s->block[0]);
for(j=0;j<6;j++) for(j=0;j<6;j++)
s->block_last_index[j] = -1; s->block_last_index[j] = -1;
...@@ -606,7 +605,6 @@ static int h261_decode_mb(H261Context *h){ ...@@ -606,7 +605,6 @@ static int h261_decode_mb(H261Context *h){
xy = s->mb_x + s->mb_y * s->mb_stride; xy = s->mb_x + s->mb_y * s->mb_stride;
ff_init_block_index(s); ff_init_block_index(s);
ff_update_block_index(s); ff_update_block_index(s);
s->dsp.clear_blocks(s->block[0]);
// Read mtype // Read mtype
h->mtype = get_vlc2(&s->gb, h261_mtype_vlc.table, H261_MTYPE_VLC_BITS, 2); 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){ ...@@ -661,12 +659,16 @@ static int h261_decode_mb(H261Context *h){
intra: intra:
/* decode each block */ /* decode each block */
if(s->mb_intra || HAS_CBP(h->mtype)){ if(s->mb_intra || HAS_CBP(h->mtype)){
s->dsp.clear_blocks(s->block[0]);
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
if (h261_decode_block(h, s->block[i], i, cbp&32) < 0){ if (h261_decode_block(h, s->block[i], i, cbp&32) < 0){
return SLICE_ERROR; return SLICE_ERROR;
} }
cbp+=cbp; cbp+=cbp;
} }
}else{
for (i = 0; i < 6; i++)
s->block_last_index[i]= -1;
} }
MPV_decode_mb(s, s->block); MPV_decode_mb(s, s->block);
......
...@@ -3753,6 +3753,7 @@ static int mpeg4_decode_partitioned_mb(MpegEncContext *s, DCTELEM block[6][64]) ...@@ -3753,6 +3753,7 @@ static int mpeg4_decode_partitioned_mb(MpegEncContext *s, DCTELEM block[6][64])
if (!IS_SKIP(mb_type)) { if (!IS_SKIP(mb_type)) {
int i; int i;
s->dsp.clear_blocks(s->block[0]);
/* decode each block */ /* decode each block */
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
if(mpeg4_decode_block(s, block[i], i, cbp&32, s->mb_intra, s->rvlc) < 0){ 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, ...@@ -3921,6 +3922,8 @@ int ff_h263_decode_mb(MpegEncContext *s,
} }
}while(cbpc == 20); }while(cbpc == 20);
s->dsp.clear_blocks(s->block[0]);
dquant = cbpc & 8; dquant = cbpc & 8;
s->mb_intra = ((cbpc & 4) != 0); s->mb_intra = ((cbpc & 4) != 0);
if (s->mb_intra) goto intra; if (s->mb_intra) goto intra;
...@@ -4024,6 +4027,7 @@ int ff_h263_decode_mb(MpegEncContext *s, ...@@ -4024,6 +4027,7 @@ int ff_h263_decode_mb(MpegEncContext *s,
s->mb_intra = IS_INTRA(mb_type); s->mb_intra = IS_INTRA(mb_type);
if(HAS_CBP(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); cbpc = get_vlc2(&s->gb, cbpc_b_vlc.table, CBPC_B_VLC_BITS, 1);
if(s->mb_intra){ if(s->mb_intra){
dquant = IS_QUANT(mb_type); dquant = IS_QUANT(mb_type);
...@@ -4102,6 +4106,8 @@ int ff_h263_decode_mb(MpegEncContext *s, ...@@ -4102,6 +4106,8 @@ int ff_h263_decode_mb(MpegEncContext *s,
} }
}while(cbpc == 8); }while(cbpc == 8);
s->dsp.clear_blocks(s->block[0]);
dquant = cbpc & 4; dquant = cbpc & 4;
s->mb_intra = 1; s->mb_intra = 1;
intra: intra:
...@@ -4193,6 +4199,7 @@ int ff_mpeg4_decode_mb(MpegEncContext *s, ...@@ -4193,6 +4199,7 @@ int ff_mpeg4_decode_mb(MpegEncContext *s,
} }
}while(cbpc == 20); }while(cbpc == 20);
s->dsp.clear_blocks(s->block[0]);
dquant = cbpc & 8; dquant = cbpc & 8;
s->mb_intra = ((cbpc & 4) != 0); s->mb_intra = ((cbpc & 4) != 0);
if (s->mb_intra) goto intra; if (s->mb_intra) goto intra;
...@@ -4324,7 +4331,10 @@ int ff_mpeg4_decode_mb(MpegEncContext *s, ...@@ -4324,7 +4331,10 @@ int ff_mpeg4_decode_mb(MpegEncContext *s,
} }
mb_type= mb_type_b_map[ mb_type ]; mb_type= mb_type_b_map[ mb_type ];
if(modb2) cbp= 0; 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 ((!IS_DIRECT(mb_type)) && cbp) {
if(get_bits1(&s->gb)){ if(get_bits1(&s->gb)){
...@@ -4442,6 +4452,7 @@ intra: ...@@ -4442,6 +4452,7 @@ intra:
if(!s->progressive_sequence) if(!s->progressive_sequence)
s->interlaced_dct= get_bits1(&s->gb); s->interlaced_dct= get_bits1(&s->gb);
s->dsp.clear_blocks(s->block[0]);
/* decode each block */ /* decode each block */
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
if (mpeg4_decode_block(s, block[i], i, cbp&32, 1, 0) < 0) if (mpeg4_decode_block(s, block[i], i, cbp&32, 1, 0) < 0)
......
...@@ -195,8 +195,7 @@ static int decode_slice(MpegEncContext *s){ ...@@ -195,8 +195,7 @@ static int decode_slice(MpegEncContext *s){
} }
/* DCT & quantize */ /* DCT & quantize */
s->dsp.clear_blocks(s->block[0]);
s->mv_dir = MV_DIR_FORWARD; s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_16X16; s->mv_type = MV_TYPE_16X16;
// s->mb_skipped = 0; // s->mb_skipped = 0;
......
...@@ -1552,6 +1552,7 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) ...@@ -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++) { for (i = 0; i < 6; i++) {
if (msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0) 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]) ...@@ -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++) { for (i = 0; i < 6; i++) {
if (msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0) if (msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0)
{ {
......
...@@ -669,7 +669,6 @@ static int rv10_decode_packet(AVCodecContext *avctx, ...@@ -669,7 +669,6 @@ static int rv10_decode_packet(AVCodecContext *avctx,
printf("**mb x=%d y=%d\n", s->mb_x, s->mb_y); printf("**mb x=%d y=%d\n", s->mb_x, s->mb_y);
#endif #endif
s->dsp.clear_blocks(s->block[0]);
s->mv_dir = MV_DIR_FORWARD; s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_16X16; s->mv_type = MV_TYPE_16X16;
ret=ff_h263_decode_mb(s, s->block); ret=ff_h263_decode_mb(s, s->block);
......
...@@ -760,6 +760,7 @@ static int wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) ...@@ -760,6 +760,7 @@ static int wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
wmv2_pred_motion(w, &mx, &my); wmv2_pred_motion(w, &mx, &my);
if(cbp){ if(cbp){
s->dsp.clear_blocks(s->block[0]);
if(s->per_mb_rl_table){ if(s->per_mb_rl_table){
s->rl_table_index = decode012(&s->gb); s->rl_table_index = decode012(&s->gb);
s->rl_chroma_table_index = s->rl_table_index; s->rl_chroma_table_index = s->rl_table_index;
...@@ -802,6 +803,7 @@ static int wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) ...@@ -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->rl_chroma_table_index = s->rl_table_index;
} }
s->dsp.clear_blocks(s->block[0]);
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
if (msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0) if (msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment