Mercurial > libavcodec.hg
comparison h264.c @ 2808:932ec96933f5 libavcodec
fixing colocated mv if colocated block is L1 predicted
fixes "H.264 decoding bug in either lavc/JM"
author | michael |
---|---|
date | Tue, 26 Jul 2005 23:40:55 +0000 |
parents | 26970df644f1 |
children | 75400dfbe117 |
comparison
equal
deleted
inserted
replaced
2807:3137aae854c9 | 2808:932ec96933f5 |
---|---|
1203 const int mb_xy = s->mb_x + s->mb_y*s->mb_stride; | 1203 const int mb_xy = s->mb_x + s->mb_y*s->mb_stride; |
1204 const int b8_xy = 2*s->mb_x + 2*s->mb_y*h->b8_stride; | 1204 const int b8_xy = 2*s->mb_x + 2*s->mb_y*h->b8_stride; |
1205 const int b4_xy = 4*s->mb_x + 4*s->mb_y*h->b_stride; | 1205 const int b4_xy = 4*s->mb_x + 4*s->mb_y*h->b_stride; |
1206 const int mb_type_col = h->ref_list[1][0].mb_type[mb_xy]; | 1206 const int mb_type_col = h->ref_list[1][0].mb_type[mb_xy]; |
1207 const int16_t (*l1mv0)[2] = (const int16_t (*)[2]) &h->ref_list[1][0].motion_val[0][b4_xy]; | 1207 const int16_t (*l1mv0)[2] = (const int16_t (*)[2]) &h->ref_list[1][0].motion_val[0][b4_xy]; |
1208 const int16_t (*l1mv1)[2] = (const int16_t (*)[2]) &h->ref_list[1][0].motion_val[1][b4_xy]; | |
1208 const int8_t *l1ref0 = &h->ref_list[1][0].ref_index[0][b8_xy]; | 1209 const int8_t *l1ref0 = &h->ref_list[1][0].ref_index[0][b8_xy]; |
1209 const int8_t *l1ref1 = &h->ref_list[1][0].ref_index[1][b8_xy]; | 1210 const int8_t *l1ref1 = &h->ref_list[1][0].ref_index[1][b8_xy]; |
1210 const int is_b8x8 = IS_8X8(*mb_type); | 1211 const int is_b8x8 = IS_8X8(*mb_type); |
1211 int sub_mb_type; | 1212 int sub_mb_type; |
1212 int i8, i4; | 1213 int i8, i4; |
1271 } | 1272 } |
1272 | 1273 |
1273 if(IS_16X16(*mb_type)){ | 1274 if(IS_16X16(*mb_type)){ |
1274 fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, ref[0], 1); | 1275 fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, ref[0], 1); |
1275 fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, ref[1], 1); | 1276 fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, ref[1], 1); |
1276 if(!IS_INTRA(mb_type_col) && l1ref0[0] == 0 && | 1277 if(!IS_INTRA(mb_type_col) |
1277 ABS(l1mv0[0][0]) <= 1 && ABS(l1mv0[0][1]) <= 1){ | 1278 && ( l1ref0[0] == 0 && ABS(l1mv0[0][0]) <= 1 && ABS(l1mv0[0][1]) <= 1 |
1279 || l1ref0[0] < 0 && l1ref1[0] == 0 && ABS(l1mv1[0][0]) <= 1 && ABS(l1mv1[0][1]) <= 1)){ | |
1278 if(ref[0] > 0) | 1280 if(ref[0] > 0) |
1279 fill_rectangle(&h->mv_cache[0][scan8[0]], 4, 4, 8, pack16to32(mv[0][0],mv[0][1]), 4); | 1281 fill_rectangle(&h->mv_cache[0][scan8[0]], 4, 4, 8, pack16to32(mv[0][0],mv[0][1]), 4); |
1280 else | 1282 else |
1281 fill_rectangle(&h->mv_cache[0][scan8[0]], 4, 4, 8, 0, 4); | 1283 fill_rectangle(&h->mv_cache[0][scan8[0]], 4, 4, 8, 0, 4); |
1282 if(ref[1] > 0) | 1284 if(ref[1] > 0) |
1300 fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mv[1][0],mv[1][1]), 4); | 1302 fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mv[1][0],mv[1][1]), 4); |
1301 fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, ref[0], 1); | 1303 fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, ref[0], 1); |
1302 fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, ref[1], 1); | 1304 fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, ref[1], 1); |
1303 | 1305 |
1304 /* col_zero_flag */ | 1306 /* col_zero_flag */ |
1305 if(!IS_INTRA(mb_type_col) && l1ref0[x8 + y8*h->b8_stride] == 0){ | 1307 if(!IS_INTRA(mb_type_col) && ( l1ref0[x8 + y8*h->b8_stride] == 0 |
1308 || l1ref0[x8 + y8*h->b8_stride] < 0 && l1ref1[x8 + y8*h->b8_stride] == 0)){ | |
1309 const int16_t (*l1mv)[2]= l1ref0[x8 + y8*h->b8_stride] == 0 ? l1mv0 : l1mv1; | |
1306 for(i4=0; i4<4; i4++){ | 1310 for(i4=0; i4<4; i4++){ |
1307 const int16_t *mv_col = l1mv0[x8*2 + (i4&1) + (y8*2 + (i4>>1))*h->b_stride]; | 1311 const int16_t *mv_col = l1mv[x8*2 + (i4&1) + (y8*2 + (i4>>1))*h->b_stride]; |
1308 if(ABS(mv_col[0]) <= 1 && ABS(mv_col[1]) <= 1){ | 1312 if(ABS(mv_col[0]) <= 1 && ABS(mv_col[1]) <= 1){ |
1309 if(ref[0] == 0) | 1313 if(ref[0] == 0) |
1310 *(uint32_t*)h->mv_cache[0][scan8[i8*4+i4]] = 0; | 1314 *(uint32_t*)h->mv_cache[0][scan8[i8*4+i4]] = 0; |
1311 if(ref[1] == 0) | 1315 if(ref[1] == 0) |
1312 *(uint32_t*)h->mv_cache[1][scan8[i8*4+i4]] = 0; | 1316 *(uint32_t*)h->mv_cache[1][scan8[i8*4+i4]] = 0; |