comparison h264.c @ 7496:f96c14041e48 libavcodec

Simplify l1mv/l1ref calculation.
author michael
date Tue, 05 Aug 2008 11:33:40 +0000
parents 2090d67bbf16
children 9dbaea2302fd
comparison
equal deleted inserted replaced
7495:2090d67bbf16 7496:f96c14041e48
971 if(!IS_INTERLACED(*mb_type)){ // AFR/FR -> AFL 971 if(!IS_INTERLACED(*mb_type)){ // AFR/FR -> AFL
972 int cur_poc = s->current_picture_ptr->poc; 972 int cur_poc = s->current_picture_ptr->poc;
973 int *col_poc = h->ref_list[1]->field_poc; 973 int *col_poc = h->ref_list[1]->field_poc;
974 int col_parity = FFABS(col_poc[0] - cur_poc) >= FFABS(col_poc[1] - cur_poc); 974 int col_parity = FFABS(col_poc[0] - cur_poc) >= FFABS(col_poc[1] - cur_poc);
975 mb_xy= s->mb_x + ((s->mb_y&~1) + col_parity)*s->mb_stride; 975 mb_xy= s->mb_x + ((s->mb_y&~1) + col_parity)*s->mb_stride;
976 l1mv0 = &h->ref_list[1][0].motion_val[0][h->mb2b_xy [mb_xy]];
977 l1mv1 = &h->ref_list[1][0].motion_val[1][h->mb2b_xy [mb_xy]];
978 l1ref0 = &h->ref_list[1][0].ref_index [0][h->mb2b8_xy[mb_xy]];
979 l1ref1 = &h->ref_list[1][0].ref_index [1][h->mb2b8_xy[mb_xy]];
980 if(s->mb_y&1){
981 l1ref0 += b8_stride;
982 l1ref1 += b8_stride;
983 l1mv0 += 2*b4_stride;
984 l1mv1 += 2*b4_stride;
985 }
986 b8_stride = 0; 976 b8_stride = 0;
987 } 977 }
988 }else if(!(s->picture_structure & h->ref_list[1][0].reference)){// FL -> FL & differ parity 978 }else if(!(s->picture_structure & h->ref_list[1][0].reference)){// FL -> FL & differ parity
989 int fieldoff= 2*(h->ref_list[1][0].reference)-3; 979 int fieldoff= 2*(h->ref_list[1][0].reference)-3;
990 mb_xy += s->mb_stride*fieldoff; 980 mb_xy += s->mb_stride*fieldoff;
1024 *mb_type |= MB_TYPE_8x8|MB_TYPE_L0L1; 1014 *mb_type |= MB_TYPE_8x8|MB_TYPE_L0L1;
1025 } 1015 }
1026 } 1016 }
1027 } 1017 }
1028 1018
1029 if(b8_stride){
1030 l1mv0 = &h->ref_list[1][0].motion_val[0][h->mb2b_xy [mb_xy]]; 1019 l1mv0 = &h->ref_list[1][0].motion_val[0][h->mb2b_xy [mb_xy]];
1031 l1mv1 = &h->ref_list[1][0].motion_val[1][h->mb2b_xy [mb_xy]]; 1020 l1mv1 = &h->ref_list[1][0].motion_val[1][h->mb2b_xy [mb_xy]];
1032 l1ref0 = &h->ref_list[1][0].ref_index [0][h->mb2b8_xy[mb_xy]]; 1021 l1ref0 = &h->ref_list[1][0].ref_index [0][h->mb2b8_xy[mb_xy]];
1033 l1ref1 = &h->ref_list[1][0].ref_index [1][h->mb2b8_xy[mb_xy]]; 1022 l1ref1 = &h->ref_list[1][0].ref_index [1][h->mb2b8_xy[mb_xy]];
1023 if(!b8_stride){
1024 if(s->mb_y&1){
1025 l1ref0 += h->b8_stride;
1026 l1ref1 += h->b8_stride;
1027 l1mv0 += 2*b4_stride;
1028 l1mv1 += 2*b4_stride;
1029 }
1034 } 1030 }
1035 1031
1036 if(h->direct_spatial_mv_pred){ 1032 if(h->direct_spatial_mv_pred){
1037 int ref[2]; 1033 int ref[2];
1038 int mv[2][2]; 1034 int mv[2][2];