Mercurial > libavcodec.hg
comparison error_resilience.c @ 1389:da0b3a50d209 libavcodec
rate distortion mb decision support
fix decoding of old %16!=0 divx
fix assertion failure in motion_est.c
author | michaelni |
---|---|
date | Tue, 29 Jul 2003 02:09:12 +0000 |
parents | f07e17427140 |
children | 89dacc2b9bf0 |
comparison
equal
deleted
inserted
replaced
1388:b5c65adac96a | 1389:da0b3a50d209 |
---|---|
28 #include "avcodec.h" | 28 #include "avcodec.h" |
29 #include "dsputil.h" | 29 #include "dsputil.h" |
30 #include "mpegvideo.h" | 30 #include "mpegvideo.h" |
31 #include "common.h" | 31 #include "common.h" |
32 | 32 |
33 static void decode_mb(MpegEncContext *s){ | |
34 s->dest[0] = s->current_picture.data[0] + (s->mb_y * 16* s->linesize ) + s->mb_x * 16; | |
35 s->dest[1] = s->current_picture.data[1] + (s->mb_y * 8 * s->uvlinesize) + s->mb_x * 8; | |
36 s->dest[2] = s->current_picture.data[2] + (s->mb_y * 8 * s->uvlinesize) + s->mb_x * 8; | |
37 | |
38 MPV_decode_mb(s, s->block); | |
39 } | |
40 | |
33 /** | 41 /** |
34 * replaces the current MB with a flat dc only version. | 42 * replaces the current MB with a flat dc only version. |
35 */ | 43 */ |
36 static void put_dc(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int mb_x, int mb_y) | 44 static void put_dc(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int mb_x, int mb_y) |
37 { | 45 { |
344 | 352 |
345 s->mb_x= mb_x; | 353 s->mb_x= mb_x; |
346 s->mb_y= mb_y; | 354 s->mb_y= mb_y; |
347 s->mv[0][0][0]= 0; | 355 s->mv[0][0][0]= 0; |
348 s->mv[0][0][1]= 0; | 356 s->mv[0][0][1]= 0; |
349 MPV_decode_mb(s, s->block); | 357 decode_mb(s); |
350 } | 358 } |
351 } | 359 } |
352 return; | 360 return; |
353 } | 361 } |
354 | 362 |
478 uint8_t *src= s->current_picture.data[0] + mb_x*16 + mb_y*16*s->linesize; | 486 uint8_t *src= s->current_picture.data[0] + mb_x*16 + mb_y*16*s->linesize; |
479 | 487 |
480 s->motion_val[mot_index][0]= s->mv[0][0][0]= mv_predictor[j][0]; | 488 s->motion_val[mot_index][0]= s->mv[0][0][0]= mv_predictor[j][0]; |
481 s->motion_val[mot_index][1]= s->mv[0][0][1]= mv_predictor[j][1]; | 489 s->motion_val[mot_index][1]= s->mv[0][0][1]= mv_predictor[j][1]; |
482 | 490 |
483 MPV_decode_mb(s, s->block); | 491 decode_mb(s); |
484 | 492 |
485 if(mb_x>0 && fixed[mb_xy-1]){ | 493 if(mb_x>0 && fixed[mb_xy-1]){ |
486 int k; | 494 int k; |
487 for(k=0; k<16; k++) | 495 for(k=0; k<16; k++) |
488 score += ABS(src[k*s->linesize-1 ]-src[k*s->linesize ]); | 496 score += ABS(src[k*s->linesize-1 ]-src[k*s->linesize ]); |
511 score_sum+= best_score; | 519 score_sum+= best_score; |
512 //FIXME no need to set s->motion_val[mot_index][0] explicit | 520 //FIXME no need to set s->motion_val[mot_index][0] explicit |
513 s->motion_val[mot_index][0]= s->mv[0][0][0]= mv_predictor[best_pred][0]; | 521 s->motion_val[mot_index][0]= s->mv[0][0][0]= mv_predictor[best_pred][0]; |
514 s->motion_val[mot_index][1]= s->mv[0][0][1]= mv_predictor[best_pred][1]; | 522 s->motion_val[mot_index][1]= s->mv[0][0][1]= mv_predictor[best_pred][1]; |
515 | 523 |
516 MPV_decode_mb(s, s->block); | 524 decode_mb(s); |
517 | 525 |
518 | 526 |
519 if(s->mv[0][0][0] != prev_x || s->mv[0][0][1] != prev_y){ | 527 if(s->mv[0][0][0] != prev_x || s->mv[0][0][1] != prev_y){ |
520 fixed[mb_xy]=MV_CHANGED; | 528 fixed[mb_xy]=MV_CHANGED; |
521 changed++; | 529 changed++; |
846 | 854 |
847 s->dsp.clear_blocks(s->block[0]); | 855 s->dsp.clear_blocks(s->block[0]); |
848 | 856 |
849 s->mb_x= mb_x; | 857 s->mb_x= mb_x; |
850 s->mb_y= mb_y; | 858 s->mb_y= mb_y; |
851 MPV_decode_mb(s, s->block); | 859 decode_mb(s); |
852 } | 860 } |
853 } | 861 } |
854 | 862 |
855 /* guess MVs */ | 863 /* guess MVs */ |
856 if(s->pict_type==B_TYPE){ | 864 if(s->pict_type==B_TYPE){ |
886 } | 894 } |
887 | 895 |
888 s->dsp.clear_blocks(s->block[0]); | 896 s->dsp.clear_blocks(s->block[0]); |
889 s->mb_x= mb_x; | 897 s->mb_x= mb_x; |
890 s->mb_y= mb_y; | 898 s->mb_y= mb_y; |
891 MPV_decode_mb(s, s->block); | 899 decode_mb(s); |
892 } | 900 } |
893 } | 901 } |
894 }else | 902 }else |
895 guess_mv(s); | 903 guess_mv(s); |
896 | 904 |