Mercurial > libavcodec.hg
diff wmv2.c @ 1177:fea03d2c4946 libavcodec
simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
more direct use of the new mb_type stuff instead of codec specific stuff
runtime mb_type debug output h264/h263 variants/mpeg1/2/4
error concealment /resilience for mpeg1/2
various minor optimizations
author | michaelni |
---|---|
date | Thu, 10 Apr 2003 13:18:38 +0000 |
parents | 0951691c4225 |
children | 03b97d87dcdd |
line wrap: on
line diff
--- a/wmv2.c Thu Apr 10 08:47:08 2003 +0000 +++ b/wmv2.c Thu Apr 10 13:18:38 2003 +0000 @@ -267,20 +267,21 @@ static void parse_mb_skip(Wmv2Context * w){ int mb_x, mb_y; MpegEncContext * const s= &w->s; + uint32_t * const mb_type= s->current_picture_ptr->mb_type; w->skip_type= get_bits(&s->gb, 2); switch(w->skip_type){ case SKIP_TYPE_NONE: for(mb_y=0; mb_y<s->mb_height; mb_y++){ for(mb_x=0; mb_x<s->mb_width; mb_x++){ - s->mb_type[mb_y*s->mb_width + mb_x]= 0; + mb_type[mb_y*s->mb_stride + mb_x]= MB_TYPE_16x16 | MB_TYPE_L0; } } break; case SKIP_TYPE_MPEG: for(mb_y=0; mb_y<s->mb_height; mb_y++){ for(mb_x=0; mb_x<s->mb_width; mb_x++){ - s->mb_type[mb_y*s->mb_width + mb_x]= get_bits1(&s->gb) ? MB_TYPE_SKIPED : 0; + mb_type[mb_y*s->mb_stride + mb_x]= (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0; } } break; @@ -288,11 +289,11 @@ for(mb_y=0; mb_y<s->mb_height; mb_y++){ if(get_bits1(&s->gb)){ for(mb_x=0; mb_x<s->mb_width; mb_x++){ - s->mb_type[mb_y*s->mb_width + mb_x]= MB_TYPE_SKIPED; + mb_type[mb_y*s->mb_stride + mb_x]= MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0; } }else{ for(mb_x=0; mb_x<s->mb_width; mb_x++){ - s->mb_type[mb_y*s->mb_width + mb_x]= get_bits1(&s->gb) ? MB_TYPE_SKIPED : 0; + mb_type[mb_y*s->mb_stride + mb_x]= (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0; } } } @@ -301,11 +302,11 @@ for(mb_x=0; mb_x<s->mb_width; mb_x++){ if(get_bits1(&s->gb)){ for(mb_y=0; mb_y<s->mb_height; mb_y++){ - s->mb_type[mb_y*s->mb_width + mb_x]= MB_TYPE_SKIPED; + mb_type[mb_y*s->mb_stride + mb_x]= MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0; } }else{ for(mb_y=0; mb_y<s->mb_height; mb_y++){ - s->mb_type[mb_y*s->mb_width + mb_x]= get_bits1(&s->gb) ? MB_TYPE_SKIPED : 0; + mb_type[mb_y*s->mb_stride + mb_x]= (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0; } } } @@ -455,12 +456,6 @@ s->esc3_level_length= 0; s->esc3_run_length= 0; - if(s->avctx->debug&FF_DEBUG_SKIP){ - for(i=0; i<s->mb_num; i++){ - if(i%s->mb_width==0) printf("\n"); - printf("%d", s->mb_type[i]); - } - } s->picture_number++; //FIXME ? @@ -712,7 +707,7 @@ if(w->j_type) return 0; if (s->pict_type == P_TYPE) { - if(s->mb_type[s->mb_y * s->mb_width + s->mb_x]&MB_TYPE_SKIPED){ + if(IS_SKIP(s->current_picture.mb_type[s->mb_y * s->mb_stride + s->mb_x])){ /* skip mb */ s->mb_intra = 0; for(i=0;i<6;i++)