[FFmpeg-cvslog] r22640 - in trunk/libavcodec: error_resilience.c h263.c motion_est.c mpeg12.c mpeg4video.c mpegvideo.c mpegvideo_enc.c
michael
subversion
Tue Mar 23 03:17:04 CET 2010
Author: michael
Date: Tue Mar 23 03:17:04 2010
New Revision: 22640
Log:
Change ref_index structure so it matches how its organized in h264.
Also revert the related error concealment hotfix.
Modified:
trunk/libavcodec/error_resilience.c
trunk/libavcodec/h263.c
trunk/libavcodec/motion_est.c
trunk/libavcodec/mpeg12.c
trunk/libavcodec/mpeg4video.c
trunk/libavcodec/mpegvideo.c
trunk/libavcodec/mpegvideo_enc.c
Modified: trunk/libavcodec/error_resilience.c
==============================================================================
--- trunk/libavcodec/error_resilience.c Mon Mar 22 22:58:38 2010 (r22639)
+++ trunk/libavcodec/error_resilience.c Tue Mar 23 03:17:04 2010 (r22640)
@@ -486,7 +486,7 @@ int score_sum=0;
sum_x+= mv_predictor[j][0];
sum_y+= mv_predictor[j][1];
sum_r+= ref[j];
- if(j && ref[j] != ref[j-1] && s->codec_id == CODEC_ID_H264)
+ if(j && ref[j] != ref[j-1])
goto skip_mean_and_median;
}
@@ -549,7 +549,7 @@ skip_mean_and_median:
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];
- if(ref[j]<0 && s->codec_id == CODEC_ID_H264) //predictor intra or otherwise not available
+ if(ref[j]<0) //predictor intra or otherwise not available
continue;
decode_mb(s, ref[j]);
@@ -767,7 +767,6 @@ void ff_er_frame_end(MpegEncContext *s){
pic->motion_subsample_log2= 3;
s->current_picture= *s->current_picture_ptr;
}
- pic->ref_index[0]= av_realloc(pic->ref_index[0], s->mb_stride * s->mb_height * 4 * sizeof(uint8_t));
if(s->avctx->debug&FF_DEBUG_ER){
for(mb_y=0; mb_y<s->mb_height; mb_y++){
Modified: trunk/libavcodec/h263.c
==============================================================================
--- trunk/libavcodec/h263.c Mon Mar 22 22:58:38 2010 (r22639)
+++ trunk/libavcodec/h263.c Tue Mar 23 03:17:04 2010 (r22640)
@@ -71,10 +71,10 @@ void ff_h263_update_motion_val(MpegEncCo
s->p_field_mv_table[i][0][mb_xy][0]= s->mv[0][i][0];
s->p_field_mv_table[i][0][mb_xy][1]= s->mv[0][i][1];
}
- s->current_picture.ref_index[0][xy ]=
- s->current_picture.ref_index[0][xy + 1]= s->field_select[0][0];
- s->current_picture.ref_index[0][xy + wrap ]=
- s->current_picture.ref_index[0][xy + wrap + 1]= s->field_select[0][1];
+ s->current_picture.ref_index[0][4*mb_xy ]=
+ s->current_picture.ref_index[0][4*mb_xy + 1]= s->field_select[0][0];
+ s->current_picture.ref_index[0][4*mb_xy + 2]=
+ s->current_picture.ref_index[0][4*mb_xy + 3]= s->field_select[0][1];
}
/* no update if 8X8 because it has been done during parsing */
Modified: trunk/libavcodec/motion_est.c
==============================================================================
--- trunk/libavcodec/motion_est.c Mon Mar 22 22:58:38 2010 (r22639)
+++ trunk/libavcodec/motion_est.c Tue Mar 23 03:17:04 2010 (r22640)
@@ -850,8 +850,8 @@ static inline int check_input_motion(Mpe
}
if(USES_LIST(mb_type, 0)){
- int field_select0= p->ref_index[0][xy ];
- int field_select1= p->ref_index[0][xy2];
+ int field_select0= p->ref_index[0][4*mb_xy ];
+ int field_select1= p->ref_index[0][4*mb_xy+2];
assert(field_select0==0 ||field_select0==1);
assert(field_select1==0 ||field_select1==1);
init_interlaced_ref(s, 0);
@@ -878,8 +878,8 @@ static inline int check_input_motion(Mpe
d+= cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 8, field_select1, 1, cmpf, chroma_cmpf, flags);
}
if(USES_LIST(mb_type, 1)){
- int field_select0= p->ref_index[1][xy ];
- int field_select1= p->ref_index[1][xy2];
+ int field_select0= p->ref_index[1][4*mb_xy ];
+ int field_select1= p->ref_index[1][4*mb_xy+2];
assert(field_select0==0 ||field_select0==1);
assert(field_select1==0 ||field_select1==1);
init_interlaced_ref(s, 2);
Modified: trunk/libavcodec/mpeg12.c
==============================================================================
--- trunk/libavcodec/mpeg12.c Mon Mar 22 22:58:38 2010 (r22639)
+++ trunk/libavcodec/mpeg12.c Tue Mar 23 03:17:04 2010 (r22640)
@@ -1760,6 +1760,7 @@ static int mpeg_decode_slice(Mpeg1Contex
if(s->current_picture.motion_val[0] && !s->encoding){ //note motion_val is normally NULL unless we want to extract the MVs
const int wrap = s->b8_stride;
int xy = s->mb_x*2 + s->mb_y*2*wrap;
+ int b8_xy= 4*(s->mb_x + s->mb_y*s->mb_stride);
int motion_x, motion_y, dir, i;
for(i=0; i<2; i++){
@@ -1778,11 +1779,12 @@ static int mpeg_decode_slice(Mpeg1Contex
s->current_picture.motion_val[dir][xy ][1] = motion_y;
s->current_picture.motion_val[dir][xy + 1][0] = motion_x;
s->current_picture.motion_val[dir][xy + 1][1] = motion_y;
- s->current_picture.ref_index [dir][xy ]=
- s->current_picture.ref_index [dir][xy + 1]= s->field_select[dir][i];
+ s->current_picture.ref_index [dir][b8_xy ]=
+ s->current_picture.ref_index [dir][b8_xy + 1]= s->field_select[dir][i];
assert(s->field_select[dir][i]==0 || s->field_select[dir][i]==1);
}
xy += wrap;
+ b8_xy +=2;
}
}
Modified: trunk/libavcodec/mpeg4video.c
==============================================================================
--- trunk/libavcodec/mpeg4video.c Mon Mar 22 22:58:38 2010 (r22639)
+++ trunk/libavcodec/mpeg4video.c Tue Mar 23 03:17:04 2010 (r22640)
@@ -137,7 +137,7 @@ int ff_mpeg4_set_direct_mv(MpegEncContex
} else if(IS_INTERLACED(colocated_mb_type)){
s->mv_type = MV_TYPE_FIELD;
for(i=0; i<2; i++){
- int field_select= s->next_picture.ref_index[0][s->block_index[2*i]];
+ int field_select= s->next_picture.ref_index[0][4*mb_index + 2*i];
s->field_select[0][i]= field_select;
s->field_select[1][i]= i;
if(s->top_field_first){
Modified: trunk/libavcodec/mpegvideo.c
==============================================================================
--- trunk/libavcodec/mpegvideo.c Mon Mar 22 22:58:38 2010 (r22639)
+++ trunk/libavcodec/mpegvideo.c Tue Mar 23 03:17:04 2010 (r22640)
@@ -296,7 +296,7 @@ int ff_alloc_picture(MpegEncContext *s,
for(i=0; i<2; i++){
FF_ALLOCZ_OR_GOTO(s->avctx, pic->motion_val_base[i], 2 * (b8_array_size+4) * sizeof(int16_t), fail)
pic->motion_val[i]= pic->motion_val_base[i]+4;
- FF_ALLOCZ_OR_GOTO(s->avctx, pic->ref_index[i], b8_array_size * sizeof(uint8_t), fail)
+ FF_ALLOCZ_OR_GOTO(s->avctx, pic->ref_index[i], 4*mb_array_size * sizeof(uint8_t), fail)
}
pic->motion_subsample_log2= 3;
}
Modified: trunk/libavcodec/mpegvideo_enc.c
==============================================================================
--- trunk/libavcodec/mpegvideo_enc.c Mon Mar 22 22:58:38 2010 (r22639)
+++ trunk/libavcodec/mpegvideo_enc.c Tue Mar 23 03:17:04 2010 (r22640)
@@ -197,7 +197,7 @@ static void copy_picture_attributes(Mpeg
memcpy(dst->motion_val[i], src->motion_val[i], 2*stride*height*sizeof(int16_t));
}
if(src->ref_index[i] && src->ref_index[i] != dst->ref_index[i]){
- memcpy(dst->ref_index[i], src->ref_index[i], s->b8_stride*2*s->mb_height*sizeof(int8_t));
+ memcpy(dst->ref_index[i], src->ref_index[i], s->mb_stride*4*s->mb_height*sizeof(int8_t));
}
}
}
More information about the ffmpeg-cvslog
mailing list