Precalculate a few variables for direct mv prediction for interlaced MBs.

Originally committed as revision 21677 to svn://svn.ffmpeg.org/ffmpeg/trunk
release/0.6
Michael Niedermayer 15 years ago
parent e6406939a8
commit 0a8dca8765
  1. 22
      libavcodec/h264_direct.c

@ -120,15 +120,19 @@ void ff_h264_direct_ref_list_init(H264Context * const h){
cur->mbaff= FRAME_MBAFF; cur->mbaff= FRAME_MBAFF;
if(cur->pict_type != FF_B_TYPE || h->direct_spatial_mv_pred) h->col_fieldoff= 0;
return;
if(s->picture_structure == PICT_FRAME){ if(s->picture_structure == PICT_FRAME){
int cur_poc = s->current_picture_ptr->poc; int cur_poc = s->current_picture_ptr->poc;
int *col_poc = h->ref_list[1]->field_poc; int *col_poc = h->ref_list[1]->field_poc;
ref1sidx=sidx= (FFABS(col_poc[0] - cur_poc) >= FFABS(col_poc[1] - cur_poc)); h->col_parity= (FFABS(col_poc[0] - cur_poc) >= FFABS(col_poc[1] - cur_poc));
ref1sidx=sidx= h->col_parity;
}else if(!(s->picture_structure & h->ref_list[1][0].reference) && !h->ref_list[1][0].mbaff){ // FL -> FL & differ parity
h->col_fieldoff= s->mb_stride*(2*(h->ref_list[1][0].reference) - 3);
} }
if(cur->pict_type != FF_B_TYPE || h->direct_spatial_mv_pred)
return;
for(list=0; list<2; list++){ for(list=0; list<2; list++){
fill_colmap(h, h->map_col_to_list0, list, sidx, ref1sidx, 0); fill_colmap(h, h->map_col_to_list0, list, sidx, ref1sidx, 0);
if(FRAME_MBAFF) if(FRAME_MBAFF)
@ -155,14 +159,10 @@ void ff_h264_pred_direct_motion(H264Context * const h, int *mb_type){
if(IS_INTERLACED(h->ref_list[1][0].mb_type[mb_xy])){ // AFL/AFR/FR/FL -> AFL/FL if(IS_INTERLACED(h->ref_list[1][0].mb_type[mb_xy])){ // AFL/AFR/FR/FL -> AFL/FL
if(!IS_INTERLACED(*mb_type)){ // AFR/FR -> AFL/FL if(!IS_INTERLACED(*mb_type)){ // AFR/FR -> AFL/FL
int cur_poc = s->current_picture_ptr->poc; mb_xy= s->mb_x + ((s->mb_y&~1) + h->col_parity)*s->mb_stride;
int *col_poc = h->ref_list[1]->field_poc;
int col_parity = FFABS(col_poc[0] - cur_poc) >= FFABS(col_poc[1] - cur_poc);
mb_xy= s->mb_x + ((s->mb_y&~1) + col_parity)*s->mb_stride;
b8_stride = 0; b8_stride = 0;
}else if(!(s->picture_structure & h->ref_list[1][0].reference) && !h->ref_list[1][0].mbaff){// FL -> FL & differ parity }else{
int fieldoff= 2*(h->ref_list[1][0].reference)-3; mb_xy += h->col_fieldoff; // non zero for FL -> FL & differ parity
mb_xy += s->mb_stride*fieldoff;
} }
goto single_col; goto single_col;
}else{ // AFL/AFR/FR/FL -> AFR/FR }else{ // AFL/AFR/FR/FL -> AFR/FR

Loading…
Cancel
Save