Mercurial > libavcodec.hg
comparison h264.c @ 7488:a5bc797cbc49 libavcodec
Port b4/b8_stride code from spatial direct mode to temporal.
Fixes at least:
CAMANL3_Sand_E.264
camp_mot_picaff0_full.26l
CAPA1_TOSHIBA_B.264
CVPA1_TOSHIBA_B.264
author | michael |
---|---|
date | Tue, 05 Aug 2008 00:15:15 +0000 |
parents | 13937730e79d |
children | e5b93d01b472 |
comparison
equal
deleted
inserted
replaced
7487:13937730e79d | 7488:a5bc797cbc49 |
---|---|
1159 } | 1159 } |
1160 if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col)){ | 1160 if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col)){ |
1161 /* FIXME assumes direct_8x8_inference == 1 */ | 1161 /* FIXME assumes direct_8x8_inference == 1 */ |
1162 const int pair_xy = s->mb_x + (s->mb_y&~1)*s->mb_stride; | 1162 const int pair_xy = s->mb_x + (s->mb_y&~1)*s->mb_stride; |
1163 int mb_types_col[2]; | 1163 int mb_types_col[2]; |
1164 int b8_stride = h->b8_stride; | |
1165 int b4_stride = h->b_stride; | |
1164 int y_shift; | 1166 int y_shift; |
1165 int ref_shift; | 1167 int ref_shift; |
1166 | 1168 |
1167 *mb_type = MB_TYPE_8x8|MB_TYPE_L0L1 | 1169 *mb_type = MB_TYPE_8x8|MB_TYPE_L0L1 |
1168 | (is_b8x8 ? 0 : MB_TYPE_DIRECT2) | 1170 | (is_b8x8 ? 0 : MB_TYPE_DIRECT2) |
1186 && (mb_types_col[1] & MB_TYPE_16x16_OR_INTRA) | 1188 && (mb_types_col[1] & MB_TYPE_16x16_OR_INTRA) |
1187 && !is_b8x8) | 1189 && !is_b8x8) |
1188 *mb_type |= MB_TYPE_16x8; | 1190 *mb_type |= MB_TYPE_16x8; |
1189 else | 1191 else |
1190 *mb_type |= MB_TYPE_8x8; | 1192 *mb_type |= MB_TYPE_8x8; |
1193 b8_stride *= 3; | |
1194 b4_stride *= 6; | |
1191 }else{ | 1195 }else{ |
1192 int cur_poc = s->current_picture_ptr->poc; | 1196 int cur_poc = s->current_picture_ptr->poc; |
1193 int *col_poc = h->ref_list[1]->field_poc; | 1197 int *col_poc = h->ref_list[1]->field_poc; |
1194 int col_parity = FFABS(col_poc[0] - cur_poc) >= FFABS(col_poc[1] - cur_poc); | 1198 int col_parity = FFABS(col_poc[0] - cur_poc) >= FFABS(col_poc[1] - cur_poc); |
1195 int dy = 2*col_parity - (s->mb_y&1); | 1199 int dy = 2*col_parity - (s->mb_y&1); |
1205 if((mb_types_col[0] & (MB_TYPE_16x16_OR_INTRA|MB_TYPE_16x8)) | 1209 if((mb_types_col[0] & (MB_TYPE_16x16_OR_INTRA|MB_TYPE_16x8)) |
1206 && !is_b8x8) | 1210 && !is_b8x8) |
1207 *mb_type |= MB_TYPE_16x16; | 1211 *mb_type |= MB_TYPE_16x16; |
1208 else | 1212 else |
1209 *mb_type |= MB_TYPE_8x8; | 1213 *mb_type |= MB_TYPE_8x8; |
1214 b8_stride = 0; | |
1210 } | 1215 } |
1211 | 1216 |
1212 for(i8=0; i8<4; i8++){ | 1217 for(i8=0; i8<4; i8++){ |
1213 const int x8 = i8&1; | 1218 const int x8 = i8&1; |
1214 const int y8 = i8>>1; | 1219 const int y8 = i8>>1; |
1225 fill_rectangle(&h-> mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4); | 1230 fill_rectangle(&h-> mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4); |
1226 fill_rectangle(&h-> mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4); | 1231 fill_rectangle(&h-> mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4); |
1227 continue; | 1232 continue; |
1228 } | 1233 } |
1229 | 1234 |
1230 ref0 = l1ref0[x8 + (y8*2>>y_shift)*h->b8_stride]; | 1235 ref0 = l1ref0[x8 + y8*b8_stride]; |
1231 if(ref0 >= 0) | 1236 if(ref0 >= 0) |
1232 ref0 = map_col_to_list0[0][ref0*2>>ref_shift]; | 1237 ref0 = map_col_to_list0[0][ref0*2>>ref_shift]; |
1233 else{ | 1238 else{ |
1234 ref0 = map_col_to_list0[1][l1ref1[x8 + (y8*2>>y_shift)*h->b8_stride]*2>>ref_shift]; | 1239 ref0 = map_col_to_list0[1][l1ref1[x8 + y8*b8_stride]*2>>ref_shift]; |
1235 l1mv= l1mv1; | 1240 l1mv= l1mv1; |
1236 } | 1241 } |
1237 scale = dist_scale_factor[ref0]; | 1242 scale = dist_scale_factor[ref0]; |
1238 fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, ref0, 1); | 1243 fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, ref0, 1); |
1239 | 1244 |
1240 { | 1245 { |
1241 const int16_t *mv_col = l1mv[x8*3 + (y8*6>>y_shift)*h->b_stride]; | 1246 const int16_t *mv_col = l1mv[x8*3 + y8*b4_stride]; |
1242 int my_col = (mv_col[1]<<y_shift)/2; | 1247 int my_col = (mv_col[1]<<y_shift)/2; |
1243 int mx = (scale * mv_col[0] + 128) >> 8; | 1248 int mx = (scale * mv_col[0] + 128) >> 8; |
1244 int my = (scale * my_col + 128) >> 8; | 1249 int my = (scale * my_col + 128) >> 8; |
1245 fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mx,my), 4); | 1250 fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mx,my), 4); |
1246 fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mx-mv_col[0],my-my_col), 4); | 1251 fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mx-mv_col[0],my-my_col), 4); |