Mercurial > libavcodec.hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
1176:a39d55237445 | 1177:fea03d2c4946 |
---|---|
265 #endif //CONFIG_ENCODERS | 265 #endif //CONFIG_ENCODERS |
266 | 266 |
267 static void parse_mb_skip(Wmv2Context * w){ | 267 static void parse_mb_skip(Wmv2Context * w){ |
268 int mb_x, mb_y; | 268 int mb_x, mb_y; |
269 MpegEncContext * const s= &w->s; | 269 MpegEncContext * const s= &w->s; |
270 uint32_t * const mb_type= s->current_picture_ptr->mb_type; | |
270 | 271 |
271 w->skip_type= get_bits(&s->gb, 2); | 272 w->skip_type= get_bits(&s->gb, 2); |
272 switch(w->skip_type){ | 273 switch(w->skip_type){ |
273 case SKIP_TYPE_NONE: | 274 case SKIP_TYPE_NONE: |
274 for(mb_y=0; mb_y<s->mb_height; mb_y++){ | 275 for(mb_y=0; mb_y<s->mb_height; mb_y++){ |
275 for(mb_x=0; mb_x<s->mb_width; mb_x++){ | 276 for(mb_x=0; mb_x<s->mb_width; mb_x++){ |
276 s->mb_type[mb_y*s->mb_width + mb_x]= 0; | 277 mb_type[mb_y*s->mb_stride + mb_x]= MB_TYPE_16x16 | MB_TYPE_L0; |
277 } | 278 } |
278 } | 279 } |
279 break; | 280 break; |
280 case SKIP_TYPE_MPEG: | 281 case SKIP_TYPE_MPEG: |
281 for(mb_y=0; mb_y<s->mb_height; mb_y++){ | 282 for(mb_y=0; mb_y<s->mb_height; mb_y++){ |
282 for(mb_x=0; mb_x<s->mb_width; mb_x++){ | 283 for(mb_x=0; mb_x<s->mb_width; mb_x++){ |
283 s->mb_type[mb_y*s->mb_width + mb_x]= get_bits1(&s->gb) ? MB_TYPE_SKIPED : 0; | 284 mb_type[mb_y*s->mb_stride + mb_x]= (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0; |
284 } | 285 } |
285 } | 286 } |
286 break; | 287 break; |
287 case SKIP_TYPE_ROW: | 288 case SKIP_TYPE_ROW: |
288 for(mb_y=0; mb_y<s->mb_height; mb_y++){ | 289 for(mb_y=0; mb_y<s->mb_height; mb_y++){ |
289 if(get_bits1(&s->gb)){ | 290 if(get_bits1(&s->gb)){ |
290 for(mb_x=0; mb_x<s->mb_width; mb_x++){ | 291 for(mb_x=0; mb_x<s->mb_width; mb_x++){ |
291 s->mb_type[mb_y*s->mb_width + mb_x]= MB_TYPE_SKIPED; | 292 mb_type[mb_y*s->mb_stride + mb_x]= MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0; |
292 } | 293 } |
293 }else{ | 294 }else{ |
294 for(mb_x=0; mb_x<s->mb_width; mb_x++){ | 295 for(mb_x=0; mb_x<s->mb_width; mb_x++){ |
295 s->mb_type[mb_y*s->mb_width + mb_x]= get_bits1(&s->gb) ? MB_TYPE_SKIPED : 0; | 296 mb_type[mb_y*s->mb_stride + mb_x]= (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0; |
296 } | 297 } |
297 } | 298 } |
298 } | 299 } |
299 break; | 300 break; |
300 case SKIP_TYPE_COL: | 301 case SKIP_TYPE_COL: |
301 for(mb_x=0; mb_x<s->mb_width; mb_x++){ | 302 for(mb_x=0; mb_x<s->mb_width; mb_x++){ |
302 if(get_bits1(&s->gb)){ | 303 if(get_bits1(&s->gb)){ |
303 for(mb_y=0; mb_y<s->mb_height; mb_y++){ | 304 for(mb_y=0; mb_y<s->mb_height; mb_y++){ |
304 s->mb_type[mb_y*s->mb_width + mb_x]= MB_TYPE_SKIPED; | 305 mb_type[mb_y*s->mb_stride + mb_x]= MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0; |
305 } | 306 } |
306 }else{ | 307 }else{ |
307 for(mb_y=0; mb_y<s->mb_height; mb_y++){ | 308 for(mb_y=0; mb_y<s->mb_height; mb_y++){ |
308 s->mb_type[mb_y*s->mb_width + mb_x]= get_bits1(&s->gb) ? MB_TYPE_SKIPED : 0; | 309 mb_type[mb_y*s->mb_stride + mb_x]= (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0; |
309 } | 310 } |
310 } | 311 } |
311 } | 312 } |
312 break; | 313 break; |
313 } | 314 } |
453 } | 454 } |
454 } | 455 } |
455 s->esc3_level_length= 0; | 456 s->esc3_level_length= 0; |
456 s->esc3_run_length= 0; | 457 s->esc3_run_length= 0; |
457 | 458 |
458 if(s->avctx->debug&FF_DEBUG_SKIP){ | |
459 for(i=0; i<s->mb_num; i++){ | |
460 if(i%s->mb_width==0) printf("\n"); | |
461 printf("%d", s->mb_type[i]); | |
462 } | |
463 } | |
464 s->picture_number++; //FIXME ? | 459 s->picture_number++; //FIXME ? |
465 | 460 |
466 | 461 |
467 // if(w->j_type) | 462 // if(w->j_type) |
468 // return wmv2_decode_j_picture(w); //FIXME | 463 // return wmv2_decode_j_picture(w); //FIXME |
710 uint8_t *coded_val; | 705 uint8_t *coded_val; |
711 | 706 |
712 if(w->j_type) return 0; | 707 if(w->j_type) return 0; |
713 | 708 |
714 if (s->pict_type == P_TYPE) { | 709 if (s->pict_type == P_TYPE) { |
715 if(s->mb_type[s->mb_y * s->mb_width + s->mb_x]&MB_TYPE_SKIPED){ | 710 if(IS_SKIP(s->current_picture.mb_type[s->mb_y * s->mb_stride + s->mb_x])){ |
716 /* skip mb */ | 711 /* skip mb */ |
717 s->mb_intra = 0; | 712 s->mb_intra = 0; |
718 for(i=0;i<6;i++) | 713 for(i=0;i<6;i++) |
719 s->block_last_index[i] = -1; | 714 s->block_last_index[i] = -1; |
720 s->mv_dir = MV_DIR_FORWARD; | 715 s->mv_dir = MV_DIR_FORWARD; |