Mercurial > libavcodec.hg
comparison h264.c @ 2809:75400dfbe117 libavcodec
fixing colocated mv if colocated block is L1 predicted for the temporal direct case
untested (none of the conformance streams laying around on my disk seems affected by this change)
author | michael |
---|---|
date | Wed, 27 Jul 2005 00:15:55 +0000 |
parents | 932ec96933f5 |
children | 636133fccbdc |
comparison
equal
deleted
inserted
replaced
2808:932ec96933f5 | 2809:75400dfbe117 |
---|---|
1328 fill_rectangle(&h-> mv_cache[1][scan8[0]], 4, 4, 8, 0, 4); | 1328 fill_rectangle(&h-> mv_cache[1][scan8[0]], 4, 4, 8, 0, 4); |
1329 }else{ | 1329 }else{ |
1330 const int ref0 = l1ref0[0] >= 0 ? h->map_col_to_list0[0][l1ref0[0]] | 1330 const int ref0 = l1ref0[0] >= 0 ? h->map_col_to_list0[0][l1ref0[0]] |
1331 : h->map_col_to_list0[1][l1ref1[0]]; | 1331 : h->map_col_to_list0[1][l1ref1[0]]; |
1332 const int dist_scale_factor = h->dist_scale_factor[ref0]; | 1332 const int dist_scale_factor = h->dist_scale_factor[ref0]; |
1333 const int16_t *mv_col = l1mv0[0]; | 1333 const int16_t *mv_col = l1ref0[0] >= 0 ? l1mv0[0] : l1mv1[0]; |
1334 int mv_l0[2]; | 1334 int mv_l0[2]; |
1335 mv_l0[0] = (dist_scale_factor * mv_col[0] + 128) >> 8; | 1335 mv_l0[0] = (dist_scale_factor * mv_col[0] + 128) >> 8; |
1336 mv_l0[1] = (dist_scale_factor * mv_col[1] + 128) >> 8; | 1336 mv_l0[1] = (dist_scale_factor * mv_col[1] + 128) >> 8; |
1337 fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, ref0, 1); | 1337 fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, ref0, 1); |
1338 fill_rectangle(&h-> mv_cache[0][scan8[0]], 4, 4, 8, pack16to32(mv_l0[0],mv_l0[1]), 4); | 1338 fill_rectangle(&h-> mv_cache[0][scan8[0]], 4, 4, 8, pack16to32(mv_l0[0],mv_l0[1]), 4); |
1341 }else{ | 1341 }else{ |
1342 for(i8=0; i8<4; i8++){ | 1342 for(i8=0; i8<4; i8++){ |
1343 const int x8 = i8&1; | 1343 const int x8 = i8&1; |
1344 const int y8 = i8>>1; | 1344 const int y8 = i8>>1; |
1345 int ref0, dist_scale_factor; | 1345 int ref0, dist_scale_factor; |
1346 | 1346 int16_t (*l1mv)[2]= l1mv0; |
1347 | |
1347 if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) | 1348 if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) |
1348 continue; | 1349 continue; |
1349 h->sub_mb_type[i8] = sub_mb_type; | 1350 h->sub_mb_type[i8] = sub_mb_type; |
1350 if(IS_INTRA(mb_type_col)){ | 1351 if(IS_INTRA(mb_type_col)){ |
1351 fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, 0, 1); | 1352 fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, 0, 1); |
1356 } | 1357 } |
1357 | 1358 |
1358 ref0 = l1ref0[x8 + y8*h->b8_stride]; | 1359 ref0 = l1ref0[x8 + y8*h->b8_stride]; |
1359 if(ref0 >= 0) | 1360 if(ref0 >= 0) |
1360 ref0 = h->map_col_to_list0[0][ref0]; | 1361 ref0 = h->map_col_to_list0[0][ref0]; |
1361 else | 1362 else{ |
1362 ref0 = h->map_col_to_list0[1][l1ref1[x8 + y8*h->b8_stride]]; | 1363 ref0 = h->map_col_to_list0[1][l1ref1[x8 + y8*h->b8_stride]]; |
1364 l1mv= l1mv1; | |
1365 } | |
1363 dist_scale_factor = h->dist_scale_factor[ref0]; | 1366 dist_scale_factor = h->dist_scale_factor[ref0]; |
1364 | 1367 |
1365 fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, ref0, 1); | 1368 fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, ref0, 1); |
1366 fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, 0, 1); | 1369 fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, 0, 1); |
1367 for(i4=0; i4<4; i4++){ | 1370 for(i4=0; i4<4; i4++){ |
1368 const int16_t *mv_col = l1mv0[x8*2 + (i4&1) + (y8*2 + (i4>>1))*h->b_stride]; | 1371 const int16_t *mv_col = l1mv[x8*2 + (i4&1) + (y8*2 + (i4>>1))*h->b_stride]; |
1369 int16_t *mv_l0 = h->mv_cache[0][scan8[i8*4+i4]]; | 1372 int16_t *mv_l0 = h->mv_cache[0][scan8[i8*4+i4]]; |
1370 mv_l0[0] = (dist_scale_factor * mv_col[0] + 128) >> 8; | 1373 mv_l0[0] = (dist_scale_factor * mv_col[0] + 128) >> 8; |
1371 mv_l0[1] = (dist_scale_factor * mv_col[1] + 128) >> 8; | 1374 mv_l0[1] = (dist_scale_factor * mv_col[1] + 128) >> 8; |
1372 *(uint32_t*)h->mv_cache[1][scan8[i8*4+i4]] = | 1375 *(uint32_t*)h->mv_cache[1][scan8[i8*4+i4]] = |
1373 pack16to32(mv_l0[0]-mv_col[0],mv_l0[1]-mv_col[1]); | 1376 pack16to32(mv_l0[0]-mv_col[0],mv_l0[1]-mv_col[1]); |