# HG changeset patch # User michael # Date 1269310624 0 # Node ID 31033caa5344116a2c737128b7f0070526bcf0c6 # Parent 86e4be64519ea2f5daf0e64d2106893250bce260 Change ref_index structure so it matches how its organized in h264. Also revert the related error concealment hotfix. diff -r 86e4be64519e -r 31033caa5344 error_resilience.c --- a/error_resilience.c Mon Mar 22 21:12:31 2010 +0000 +++ b/error_resilience.c Tue Mar 23 02:17:04 2010 +0000 @@ -486,7 +486,7 @@ 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 @@ 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 @@ 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_ymb_height; mb_y++){ diff -r 86e4be64519e -r 31033caa5344 h263.c --- a/h263.c Mon Mar 22 21:12:31 2010 +0000 +++ b/h263.c Tue Mar 23 02:17:04 2010 +0000 @@ -71,10 +71,10 @@ 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 */ diff -r 86e4be64519e -r 31033caa5344 motion_est.c --- a/motion_est.c Mon Mar 22 21:12:31 2010 +0000 +++ b/motion_est.c Tue Mar 23 02:17:04 2010 +0000 @@ -850,8 +850,8 @@ } 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 @@ 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); diff -r 86e4be64519e -r 31033caa5344 mpeg12.c --- a/mpeg12.c Mon Mar 22 21:12:31 2010 +0000 +++ b/mpeg12.c Tue Mar 23 02:17:04 2010 +0000 @@ -1760,6 +1760,7 @@ 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 @@ 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; } } diff -r 86e4be64519e -r 31033caa5344 mpeg4video.c --- a/mpeg4video.c Mon Mar 22 21:12:31 2010 +0000 +++ b/mpeg4video.c Tue Mar 23 02:17:04 2010 +0000 @@ -137,7 +137,7 @@ } 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){ diff -r 86e4be64519e -r 31033caa5344 mpegvideo.c --- a/mpegvideo.c Mon Mar 22 21:12:31 2010 +0000 +++ b/mpegvideo.c Tue Mar 23 02:17:04 2010 +0000 @@ -296,7 +296,7 @@ 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; } diff -r 86e4be64519e -r 31033caa5344 mpegvideo_enc.c --- a/mpegvideo_enc.c Mon Mar 22 21:12:31 2010 +0000 +++ b/mpegvideo_enc.c Tue Mar 23 02:17:04 2010 +0000 @@ -197,7 +197,7 @@ 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)); } } }