aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2010-03-23 02:17:04 +0000
committerMichael Niedermayer <michaelni@gmx.at>2010-03-23 02:17:04 +0000
commitfc4a2d1e8cc06766677d33f4ba4777e256a709fc (patch)
tree8f9367153e7bae75ded7c2ba79bc088167507feb
parent19de452a630f0906ef3ebda4f27ca7b2a4b59f07 (diff)
downloadffmpeg-fc4a2d1e8cc06766677d33f4ba4777e256a709fc.tar.gz
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
-rw-r--r--libavcodec/error_resilience.c5
-rw-r--r--libavcodec/h263.c8
-rw-r--r--libavcodec/motion_est.c8
-rw-r--r--libavcodec/mpeg12.c6
-rw-r--r--libavcodec/mpeg4video.c2
-rw-r--r--libavcodec/mpegvideo.c2
-rw-r--r--libavcodec/mpegvideo_enc.c2
7 files changed, 17 insertions, 16 deletions
diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
index 5dd52ebaf8..fffe19cca3 100644
--- a/libavcodec/error_resilience.c
+++ b/libavcodec/error_resilience.c
@@ -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++){
diff --git a/libavcodec/h263.c b/libavcodec/h263.c
index 2eb1ff5c94..d5d5c38967 100644
--- a/libavcodec/h263.c
+++ b/libavcodec/h263.c
@@ -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 */
diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
index 1f5dbc71e8..75a664b440 100644
--- a/libavcodec/motion_est.c
+++ b/libavcodec/motion_est.c
@@ -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);
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 4ae5b6430a..1cd9acc771 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -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;
}
}
diff --git a/libavcodec/mpeg4video.c b/libavcodec/mpeg4video.c
index a647960a51..dd4dd8ad95 100644
--- a/libavcodec/mpeg4video.c
+++ b/libavcodec/mpeg4video.c
@@ -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){
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 1dbe7eda96..b47ff9adb1 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -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;
}
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 44a0d81e56..aa68becc27 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -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));
}
}
}