Commit fc4a2d1e authored by Michael Niedermayer's avatar Michael Niedermayer

Change ref_index structure so it matches how its organized in h264.

Also revert the related error concealment hotfix.

Originally committed as revision 22640 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 19de452a
......@@ -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++){
......
......@@ -71,10 +71,10 @@ void ff_h263_update_motion_val(MpegEncContext * s){
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 */
......
......@@ -850,8 +850,8 @@ static inline int check_input_motion(MpegEncContext * s, int mb_x, int mb_y, int
}
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(MpegEncContext * s, int mb_x, int mb_y, int
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);
......
......@@ -1760,6 +1760,7 @@ static int mpeg_decode_slice(Mpeg1Context *s1, int mb_y,
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(Mpeg1Context *s1, int mb_y,
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;
}
}
......
......@@ -137,7 +137,7 @@ int ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my){
} 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){
......
......@@ -296,7 +296,7 @@ int ff_alloc_picture(MpegEncContext *s, Picture *pic, int shared){
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;
}
......
......@@ -197,7 +197,7 @@ static void copy_picture_attributes(MpegEncContext *s, AVFrame *dst, AVFrame *sr
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));
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment