comparison h264.c @ 7486:a52ba8daad18 libavcodec

*2 /2 is wrong for PAFF references, so do not do it.
author michael
date Mon, 04 Aug 2008 23:29:34 +0000
parents e6c14a62db74
children 13937730e79d
comparison
equal deleted inserted replaced
7485:e6c14a62db74 7486:a52ba8daad18
1158 if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col)){ 1158 if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col)){
1159 /* FIXME assumes direct_8x8_inference == 1 */ 1159 /* FIXME assumes direct_8x8_inference == 1 */
1160 const int pair_xy = s->mb_x + (s->mb_y&~1)*s->mb_stride; 1160 const int pair_xy = s->mb_x + (s->mb_y&~1)*s->mb_stride;
1161 int mb_types_col[2]; 1161 int mb_types_col[2];
1162 int y_shift; 1162 int y_shift;
1163 int ref_shift;
1163 1164
1164 *mb_type = MB_TYPE_8x8|MB_TYPE_L0L1 1165 *mb_type = MB_TYPE_8x8|MB_TYPE_L0L1
1165 | (is_b8x8 ? 0 : MB_TYPE_DIRECT2) 1166 | (is_b8x8 ? 0 : MB_TYPE_DIRECT2)
1166 | (*mb_type & MB_TYPE_INTERLACED); 1167 | (*mb_type & MB_TYPE_INTERLACED);
1167 sub_mb_type = MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2|MB_TYPE_16x16; 1168 sub_mb_type = MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2|MB_TYPE_16x16;
1175 l1ref1 -= 2*h->b8_stride; 1176 l1ref1 -= 2*h->b8_stride;
1176 l1mv0 -= 4*h->b_stride; 1177 l1mv0 -= 4*h->b_stride;
1177 l1mv1 -= 4*h->b_stride; 1178 l1mv1 -= 4*h->b_stride;
1178 } 1179 }
1179 y_shift = 0; 1180 y_shift = 0;
1181 ref_shift= FRAME_MBAFF ? 0 : 1;
1180 1182
1181 if( (mb_types_col[0] & MB_TYPE_16x16_OR_INTRA) 1183 if( (mb_types_col[0] & MB_TYPE_16x16_OR_INTRA)
1182 && (mb_types_col[1] & MB_TYPE_16x16_OR_INTRA) 1184 && (mb_types_col[1] & MB_TYPE_16x16_OR_INTRA)
1183 && !is_b8x8) 1185 && !is_b8x8)
1184 *mb_type |= MB_TYPE_16x8; 1186 *mb_type |= MB_TYPE_16x8;
1194 l1ref0 += dy*h->b8_stride; 1196 l1ref0 += dy*h->b8_stride;
1195 l1ref1 += dy*h->b8_stride; 1197 l1ref1 += dy*h->b8_stride;
1196 l1mv0 += 2*dy*h->b_stride; 1198 l1mv0 += 2*dy*h->b_stride;
1197 l1mv1 += 2*dy*h->b_stride; 1199 l1mv1 += 2*dy*h->b_stride;
1198 y_shift = 2; 1200 y_shift = 2;
1201 ref_shift= FRAME_MBAFF ? 2 : 1;
1199 1202
1200 if((mb_types_col[0] & (MB_TYPE_16x16_OR_INTRA|MB_TYPE_16x8)) 1203 if((mb_types_col[0] & (MB_TYPE_16x16_OR_INTRA|MB_TYPE_16x8))
1201 && !is_b8x8) 1204 && !is_b8x8)
1202 *mb_type |= MB_TYPE_16x16; 1205 *mb_type |= MB_TYPE_16x16;
1203 else 1206 else
1222 continue; 1225 continue;
1223 } 1226 }
1224 1227
1225 ref0 = l1ref0[x8 + (y8*2>>y_shift)*h->b8_stride]; 1228 ref0 = l1ref0[x8 + (y8*2>>y_shift)*h->b8_stride];
1226 if(ref0 >= 0) 1229 if(ref0 >= 0)
1227 ref0 = map_col_to_list0[0][ref0*2>>y_shift]; 1230 ref0 = map_col_to_list0[0][ref0*2>>ref_shift];
1228 else{ 1231 else{
1229 ref0 = map_col_to_list0[1][l1ref1[x8 + (y8*2>>y_shift)*h->b8_stride]*2>>y_shift]; 1232 ref0 = map_col_to_list0[1][l1ref1[x8 + (y8*2>>y_shift)*h->b8_stride]*2>>ref_shift];
1230 l1mv= l1mv1; 1233 l1mv= l1mv1;
1231 } 1234 }
1232 scale = dist_scale_factor[ref0]; 1235 scale = dist_scale_factor[ref0];
1233 fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, ref0, 1); 1236 fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, ref0, 1);
1234 1237