diff options
author | Wolfgang Hesseler <qv@multimediaware.com> | 2003-12-09 01:49:56 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2003-12-09 01:49:56 +0000 |
commit | 8d7ec294c4460e8a8c657f2423983b728d7903d4 (patch) | |
tree | e95c23fce6df8351048503aa6e17dc66305c1ca9 /libavcodec/error_resilience.c | |
parent | a0b8f70c2958ccf96b57f3d07af90545800f5b35 (diff) | |
download | ffmpeg-8d7ec294c4460e8a8c657f2423983b728d7903d4.tar.gz |
move motion_val & mb_type to AVFrame patch by (Wolfgang Hesseler <qv at multimediaware dot com>)
cleanups & fixes by me
Originally committed as revision 2579 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/error_resilience.c')
-rw-r--r-- | libavcodec/error_resilience.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c index e41a2cfffc..adec943122 100644 --- a/libavcodec/error_resilience.c +++ b/libavcodec/error_resilience.c @@ -209,8 +209,8 @@ static void h_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int st int left_damage = left_status&(DC_ERROR|AC_ERROR|MV_ERROR); int right_damage= right_status&(DC_ERROR|AC_ERROR|MV_ERROR); int offset= b_x*8 + b_y*stride*8; - int16_t *left_mv= s->motion_val[s->block_wrap[0]*((b_y<<(1-is_luma)) + 1) + ( b_x <<(1-is_luma))]; - int16_t *right_mv= s->motion_val[s->block_wrap[0]*((b_y<<(1-is_luma)) + 1) + ((b_x+1)<<(1-is_luma))]; + int16_t *left_mv= s->current_picture.motion_val[0][s->block_wrap[0]*((b_y<<(1-is_luma)) + 1) + ( b_x <<(1-is_luma))]; + int16_t *right_mv= s->current_picture.motion_val[0][s->block_wrap[0]*((b_y<<(1-is_luma)) + 1) + ((b_x+1)<<(1-is_luma))]; if(!(left_damage||right_damage)) continue; // both undamaged @@ -269,8 +269,8 @@ static void v_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int st int top_damage = top_status&(DC_ERROR|AC_ERROR|MV_ERROR); int bottom_damage= bottom_status&(DC_ERROR|AC_ERROR|MV_ERROR); int offset= b_x*8 + b_y*stride*8; - int16_t *top_mv= s->motion_val[s->block_wrap[0]*(( b_y <<(1-is_luma)) + 1) + (b_x<<(1-is_luma))]; - int16_t *bottom_mv= s->motion_val[s->block_wrap[0]*(((b_y+1)<<(1-is_luma)) + 1) + (b_x<<(1-is_luma))]; + int16_t *top_mv= s->current_picture.motion_val[0][s->block_wrap[0]*(( b_y <<(1-is_luma)) + 1) + (b_x<<(1-is_luma))]; + int16_t *bottom_mv= s->current_picture.motion_val[0][s->block_wrap[0]*(((b_y+1)<<(1-is_luma)) + 1) + (b_x<<(1-is_luma))]; if(!(top_damage||bottom_damage)) continue; // both undamaged @@ -380,8 +380,8 @@ int score_sum=0; int best_pred=0; const int mot_stride= mb_width*2+2; const int mot_index= mb_x*2 + 1 + (mb_y*2+1)*mot_stride; - int prev_x= s->motion_val[mot_index][0]; - int prev_y= s->motion_val[mot_index][1]; + int prev_x= s->current_picture.motion_val[0][mot_index][0]; + int prev_y= s->current_picture.motion_val[0][mot_index][1]; if((mb_x^mb_y^pass)&1) continue; @@ -406,23 +406,23 @@ int score_sum=0; none_left=0; if(mb_x>0 && fixed[mb_xy-1]){ - mv_predictor[pred_count][0]= s->motion_val[mot_index - 2][0]; - mv_predictor[pred_count][1]= s->motion_val[mot_index - 2][1]; + mv_predictor[pred_count][0]= s->current_picture.motion_val[0][mot_index - 2][0]; + mv_predictor[pred_count][1]= s->current_picture.motion_val[0][mot_index - 2][1]; pred_count++; } if(mb_x+1<mb_width && fixed[mb_xy+1]){ - mv_predictor[pred_count][0]= s->motion_val[mot_index + 2][0]; - mv_predictor[pred_count][1]= s->motion_val[mot_index + 2][1]; + mv_predictor[pred_count][0]= s->current_picture.motion_val[0][mot_index + 2][0]; + mv_predictor[pred_count][1]= s->current_picture.motion_val[0][mot_index + 2][1]; pred_count++; } if(mb_y>0 && fixed[mb_xy-mb_stride]){ - mv_predictor[pred_count][0]= s->motion_val[mot_index - mot_stride*2][0]; - mv_predictor[pred_count][1]= s->motion_val[mot_index - mot_stride*2][1]; + mv_predictor[pred_count][0]= s->current_picture.motion_val[0][mot_index - mot_stride*2][0]; + mv_predictor[pred_count][1]= s->current_picture.motion_val[0][mot_index - mot_stride*2][1]; pred_count++; } if(mb_y+1<mb_height && fixed[mb_xy+mb_stride]){ - mv_predictor[pred_count][0]= s->motion_val[mot_index + mot_stride*2][0]; - mv_predictor[pred_count][1]= s->motion_val[mot_index + mot_stride*2][1]; + mv_predictor[pred_count][0]= s->current_picture.motion_val[0][mot_index + mot_stride*2][0]; + mv_predictor[pred_count][1]= s->current_picture.motion_val[0][mot_index + mot_stride*2][1]; pred_count++; } if(pred_count==0) continue; @@ -467,8 +467,8 @@ int score_sum=0; pred_count++; /* last MV */ - mv_predictor[pred_count][0]= s->motion_val[mot_index][0]; - mv_predictor[pred_count][1]= s->motion_val[mot_index][1]; + mv_predictor[pred_count][0]= s->current_picture.motion_val[0][mot_index][0]; + mv_predictor[pred_count][1]= s->current_picture.motion_val[0][mot_index][1]; pred_count++; s->mv_dir = MV_DIR_FORWARD; @@ -485,8 +485,8 @@ int score_sum=0; int score=0; uint8_t *src= s->current_picture.data[0] + mb_x*16 + mb_y*16*s->linesize; - s->motion_val[mot_index][0]= s->mv[0][0][0]= mv_predictor[j][0]; - s->motion_val[mot_index][1]= s->mv[0][0][1]= mv_predictor[j][1]; + s->current_picture.motion_val[0][mot_index][0]= s->mv[0][0][0]= mv_predictor[j][0]; + s->current_picture.motion_val[0][mot_index][1]= s->mv[0][0][1]= mv_predictor[j][1]; decode_mb(s); @@ -517,9 +517,9 @@ int score_sum=0; } } score_sum+= best_score; -//FIXME no need to set s->motion_val[mot_index][0] explicit - s->motion_val[mot_index][0]= s->mv[0][0][0]= mv_predictor[best_pred][0]; - s->motion_val[mot_index][1]= s->mv[0][0][1]= mv_predictor[best_pred][1]; +//FIXME no need to set s->current_picture.motion_val[0][mot_index][0] explicit + s->current_picture.motion_val[0][mot_index][0]= s->mv[0][0][0]= mv_predictor[best_pred][0]; + s->current_picture.motion_val[0][mot_index][1]= s->mv[0][0][1]= mv_predictor[best_pred][1]; decode_mb(s); @@ -671,12 +671,12 @@ void ff_er_frame_end(MpegEncContext *s){ av_log(s->avctx, AV_LOG_INFO, "concealing errors\n"); - if(s->motion_val == NULL){ + if(s->current_picture.motion_val[0] == NULL){ int size = (2 * s->mb_width + 2) * (2 * s->mb_height + 2); av_log(s->avctx, AV_LOG_ERROR, "Warning MVs not available\n"); - s->motion_val= av_mallocz(size * 2 * sizeof(int16_t)); + s->current_picture.motion_val[0]= av_mallocz(size * 2 * sizeof(int16_t)); //FIXME } if(s->avctx->debug&FF_DEBUG_ER){ @@ -843,13 +843,13 @@ void ff_er_frame_end(MpegEncContext *s){ int j; s->mv_type = MV_TYPE_8X8; for(j=0; j<4; j++){ - s->mv[0][j][0] = s->motion_val[ mb_index + (j&1) + (j>>1)*s->block_wrap[0] ][0]; - s->mv[0][j][1] = s->motion_val[ mb_index + (j&1) + (j>>1)*s->block_wrap[0] ][1]; + s->mv[0][j][0] = s->current_picture.motion_val[0][ mb_index + (j&1) + (j>>1)*s->block_wrap[0] ][0]; + s->mv[0][j][1] = s->current_picture.motion_val[0][ mb_index + (j&1) + (j>>1)*s->block_wrap[0] ][1]; } }else{ s->mv_type = MV_TYPE_16X16; - s->mv[0][0][0] = s->motion_val[ mb_x*2+1 + (mb_y*2+1)*s->block_wrap[0] ][0]; - s->mv[0][0][1] = s->motion_val[ mb_x*2+1 + (mb_y*2+1)*s->block_wrap[0] ][1]; + s->mv[0][0][0] = s->current_picture.motion_val[0][ mb_x*2+1 + (mb_y*2+1)*s->block_wrap[0] ][0]; + s->mv[0][0][1] = s->current_picture.motion_val[0][ mb_x*2+1 + (mb_y*2+1)*s->block_wrap[0] ][1]; } s->dsp.clear_blocks(s->block[0]); @@ -882,10 +882,10 @@ void ff_er_frame_end(MpegEncContext *s){ int time_pp= s->pp_time; int time_pb= s->pb_time; - s->mv[0][0][0] = s->motion_val[xy][0]*time_pb/time_pp; - s->mv[0][0][1] = s->motion_val[xy][1]*time_pb/time_pp; - s->mv[1][0][0] = s->motion_val[xy][0]*(time_pb - time_pp)/time_pp; - s->mv[1][0][1] = s->motion_val[xy][1]*(time_pb - time_pp)/time_pp; + s->mv[0][0][0] = s->next_picture.motion_val[0][xy][0]*time_pb/time_pp; + s->mv[0][0][1] = s->next_picture.motion_val[0][xy][1]*time_pb/time_pp; + s->mv[1][0][0] = s->next_picture.motion_val[0][xy][0]*(time_pb - time_pp)/time_pp; + s->mv[1][0][1] = s->next_picture.motion_val[0][xy][1]*(time_pb - time_pp)/time_pp; }else{ s->mv[0][0][0]= 0; s->mv[0][0][1]= 0; |