141
143
/* lambda2 = pow(lambda,2) * .9 * 256 */
142
static const int i_qp0_cost2_table[52] = {
144
const int x264_lambda2_tab[52] = {
143
145
14, 18, 22, 28, 36, 45, 57, 72, /* 0 - 7 */
144
146
91, 115, 145, 182, 230, 290, 365, 460, /* 8 - 15 */
145
147
580, 731, 921, 1161, 1462, 1843, 2322, 2925, /* 16 - 23 */
203
205
static void x264_mb_analyse_init( x264_t *h, x264_mb_analysis_t *a, int i_qp )
207
int i = h->param.analyse.i_subpel_refine - (h->sh.i_type == SLICE_TYPE_B);
208
/* mbrd == 1 -> RD mode decision */
209
/* mbrd == 2 -> RD refinement */
210
a->i_mbrd = (i>=6) + (i>=8);
205
211
/* conduct the analysis using this lamda and QP */
206
212
a->i_qp = h->mb.i_qp = i_qp;
207
h->mb.i_chroma_qp = i_chroma_qp_table[x264_clip3( i_qp + h->pps->i_chroma_qp_index_offset, 0, 51 )];
208
a->i_lambda = i_qp0_cost_table[i_qp];
209
a->i_lambda2 = i_qp0_cost2_table[i_qp];
210
a->b_mbrd = h->param.analyse.i_subpel_refine >= 6 &&
211
( h->sh.i_type != SLICE_TYPE_B || h->param.analyse.b_bframe_rdo );
213
h->mb.i_chroma_qp = h->chroma_qp_table[i_qp];
214
a->i_lambda = x264_lambda_tab[i_qp];
215
a->i_lambda2 = x264_lambda2_tab[i_qp];
213
216
h->mb.i_me_method = h->param.analyse.i_me_method;
214
217
h->mb.i_subpel_refine = h->param.analyse.i_subpel_refine;
215
218
h->mb.b_chroma_me = h->param.analyse.b_chroma_me && h->sh.i_type == SLICE_TYPE_P
216
219
&& h->mb.i_subpel_refine >= 5;
217
h->mb.b_trellis = h->param.analyse.i_trellis > 1 && a->b_mbrd;
220
h->mb.b_trellis = h->param.analyse.i_trellis > 1 && a->i_mbrd;
218
221
h->mb.b_transform_8x8 = 0;
219
222
h->mb.b_noise_reduction = 0;
472
/* For trellis=2, we need to do this for both sizes of DCT, for trellis=1 we only need to use it on the chosen mode. */
473
static void inline x264_psy_trellis_init( x264_t *h, int do_both_dct )
475
DECLARE_ALIGNED_16( int16_t dct8x8[4][8][8] );
476
DECLARE_ALIGNED_16( int16_t dct4x4[16][4][4] );
477
DECLARE_ALIGNED_16( uint8_t zero[16*FDEC_STRIDE] ) = {0};
480
if( do_both_dct || h->mb.b_transform_8x8 )
482
h->dctf.sub16x16_dct8( dct8x8, h->mb.pic.p_fenc[0], zero );
483
for( i = 0; i < 4; i++ )
484
h->zigzagf.scan_8x8( h->mb.pic.fenc_dct8[i], dct8x8[i] );
486
if( do_both_dct || !h->mb.b_transform_8x8 )
488
h->dctf.sub16x16_dct( dct4x4, h->mb.pic.p_fenc[0], zero );
489
for( i = 0; i < 16; i++ )
490
h->zigzagf.scan_4x4( h->mb.pic.fenc_dct4[i], dct4x4[i] );
494
/* Pre-calculate fenc satd scores for psy RD, minus DC coefficients */
495
static inline void x264_mb_cache_fenc_satd( x264_t *h )
497
DECLARE_ALIGNED_16(uint8_t zero[16]) = {0};
499
int x, y, satd_sum = 0, sa8d_sum = 0;
500
if( h->param.analyse.i_trellis == 2 && h->mb.i_psy_trellis )
501
x264_psy_trellis_init( h, h->param.analyse.b_transform_8x8 );
502
if( !h->mb.i_psy_rd )
504
for( y = 0; y < 4; y++ )
505
for( x = 0; x < 4; x++ )
507
fenc = h->mb.pic.p_fenc[0]+x*4+y*4*FENC_STRIDE;
508
h->mb.pic.fenc_satd[y][x] = h->pixf.satd[PIXEL_4x4]( zero, 0, fenc, FENC_STRIDE )
509
- (h->pixf.sad[PIXEL_4x4]( zero, 0, fenc, FENC_STRIDE )>>1);
510
satd_sum += h->mb.pic.fenc_satd[y][x];
512
for( y = 0; y < 2; y++ )
513
for( x = 0; x < 2; x++ )
515
fenc = h->mb.pic.p_fenc[0]+x*8+y*8*FENC_STRIDE;
516
h->mb.pic.fenc_sa8d[y][x] = h->pixf.sa8d[PIXEL_8x8]( zero, 0, fenc, FENC_STRIDE )
517
- (h->pixf.sad[PIXEL_8x8]( zero, 0, fenc, FENC_STRIDE )>>2);
518
sa8d_sum += h->mb.pic.fenc_sa8d[y][x];
520
h->mb.pic.fenc_satd_sum = satd_sum;
521
h->mb.pic.fenc_sa8d_sum = sa8d_sum;
465
524
static void x264_mb_analyse_intra_chroma( x264_t *h, x264_mb_analysis_t *a )
1009
1085
i_halfpel_thresh += i_ref_cost;
1011
1087
if( m.cost < a->l0.me16x16.cost )
1088
h->mc.memcpy_aligned( &a->l0.me16x16, &m, sizeof(x264_me_t) );
1014
1090
/* save mv for predicting neighbors */
1015
a->l0.mvc[i_ref][0][0] =
1016
h->mb.mvr[0][i_ref][h->mb.i_mb_xy][0] = m.mv[0];
1017
a->l0.mvc[i_ref][0][1] =
1018
h->mb.mvr[0][i_ref][h->mb.i_mb_xy][1] = m.mv[1];
1091
*(uint32_t*)a->l0.mvc[i_ref][0] =
1092
*(uint32_t*)h->mb.mvr[0][i_ref][h->mb.i_mb_xy] = *(uint32_t*)m.mv;
1021
1095
x264_macroblock_cache_ref( h, 0, 0, 4, 4, 0, a->l0.me16x16.i_ref );
1022
1096
assert( a->l0.me16x16.mv[1] <= h->mb.mv_max_spel[1] || h->param.i_threads == 1 );
1024
1098
h->mb.i_type = P_L0;
1025
if( a->b_mbrd && a->l0.me16x16.i_ref == 0
1026
&& a->l0.me16x16.mv[0] == h->mb.cache.pskip_mv[0]
1027
&& a->l0.me16x16.mv[1] == h->mb.cache.pskip_mv[1] )
1029
h->mb.i_partition = D_16x16;
1030
x264_macroblock_cache_mv( h, 0, 0, 4, 4, 0, a->l0.me16x16.mv[0], a->l0.me16x16.mv[1] );
1031
a->l0.i_rd16x16 = x264_rd_cost_mb( h, a->i_lambda2 );
1101
x264_mb_cache_fenc_satd( h );
1102
if( a->l0.me16x16.i_ref == 0 && *(uint32_t*)a->l0.me16x16.mv == *(uint32_t*)h->mb.cache.pskip_mv )
1104
h->mb.i_partition = D_16x16;
1105
x264_macroblock_cache_mv_ptr( h, 0, 0, 4, 4, 0, a->l0.me16x16.mv );
1106
a->l0.i_rd16x16 = x264_rd_cost_mb( h, a->i_lambda2 );
1077
1150
l0m->cost = INT_MAX;
1078
1151
for( i_ref = 0; i_ref <= i_maxref; i_ref++ )
1080
const int i_ref_cost = REF_COST( 0, i_ref );
1081
i_halfpel_thresh -= i_ref_cost;
1082
m.i_ref_cost = i_ref_cost;
1085
LOAD_HPELS( &m, h->mb.pic.p_fref[0][i_ref], 0, i_ref, 8*x8, 8*y8 );
1086
x264_macroblock_cache_ref( h, 2*x8, 2*y8, 2, 2, 0, i_ref );
1087
x264_mb_predict_mv( h, 0, 4*i, 2, m.mvp );
1088
x264_me_search_ref( h, &m, a->l0.mvc[i_ref], i+1, p_halfpel_thresh );
1090
m.cost += i_ref_cost;
1091
i_halfpel_thresh += i_ref_cost;
1092
*(uint64_t*)a->l0.mvc[i_ref][i+1] = *(uint64_t*)m.mv;
1094
if( m.cost < l0m->cost )
1153
const int i_ref_cost = REF_COST( 0, i_ref );
1154
i_halfpel_thresh -= i_ref_cost;
1155
m.i_ref_cost = i_ref_cost;
1158
LOAD_HPELS( &m, h->mb.pic.p_fref[0][i_ref], 0, i_ref, 8*x8, 8*y8 );
1159
x264_macroblock_cache_ref( h, 2*x8, 2*y8, 2, 2, 0, i_ref );
1160
x264_mb_predict_mv( h, 0, 4*i, 2, m.mvp );
1161
x264_me_search_ref( h, &m, a->l0.mvc[i_ref], i+1, p_halfpel_thresh );
1163
m.cost += i_ref_cost;
1164
i_halfpel_thresh += i_ref_cost;
1165
*(uint32_t*)a->l0.mvc[i_ref][i+1] = *(uint32_t*)m.mv;
1167
if( m.cost < l0m->cost )
1168
h->mc.memcpy_aligned( l0m, &m, sizeof(x264_me_t) );
1097
x264_macroblock_cache_mv( h, 2*x8, 2*y8, 2, 2, 0, l0m->mv[0], l0m->mv[1] );
1170
x264_macroblock_cache_mv_ptr( h, 2*x8, 2*y8, 2, 2, 0, l0m->mv );
1098
1171
x264_macroblock_cache_ref( h, 2*x8, 2*y8, 2, 2, 0, l0m->i_ref );
1100
1173
/* mb type cost */
1139
1216
x264_mb_predict_mv( h, 0, 4*i, 2, m->mvp );
1140
1217
x264_me_search( h, m, mvc, i_mvc );
1142
x264_macroblock_cache_mv( h, 2*x8, 2*y8, 2, 2, 0, m->mv[0], m->mv[1] );
1219
x264_macroblock_cache_mv_ptr( h, 2*x8, 2*y8, 2, 2, 0, m->mv );
1144
*(uint64_t*)mvc[i_mvc] = *(uint64_t*)m->mv;
1221
*(uint32_t*)mvc[i_mvc] = *(uint32_t*)m->mv;
1147
1224
/* mb type cost */
1181
1259
l0m->cost = INT_MAX;
1182
1260
for( j = 0; j < i_ref8s; j++ )
1184
const int i_ref = ref8[j];
1185
const int i_ref_cost = REF_COST( 0, i_ref );
1186
m.i_ref_cost = i_ref_cost;
1189
/* if we skipped the 16x16 predictor, we wouldn't have to copy anything... */
1190
*(uint64_t*)mvc[0] = *(uint64_t*)a->l0.mvc[i_ref][0];
1191
*(uint64_t*)mvc[1] = *(uint64_t*)a->l0.mvc[i_ref][2*i+1];
1192
*(uint64_t*)mvc[2] = *(uint64_t*)a->l0.mvc[i_ref][2*i+2];
1194
LOAD_HPELS( &m, h->mb.pic.p_fref[0][i_ref], 0, i_ref, 0, 8*i );
1195
x264_macroblock_cache_ref( h, 0, 2*i, 4, 2, 0, i_ref );
1196
x264_mb_predict_mv( h, 0, 8*i, 4, m.mvp );
1197
x264_me_search( h, &m, mvc, 3 );
1199
m.cost += i_ref_cost;
1201
if( m.cost < l0m->cost )
1262
const int i_ref = ref8[j];
1263
const int i_ref_cost = REF_COST( 0, i_ref );
1264
m.i_ref_cost = i_ref_cost;
1267
/* if we skipped the 16x16 predictor, we wouldn't have to copy anything... */
1268
*(uint32_t*)mvc[0] = *(uint32_t*)a->l0.mvc[i_ref][0];
1269
*(uint32_t*)mvc[1] = *(uint32_t*)a->l0.mvc[i_ref][2*i+1];
1270
*(uint32_t*)mvc[2] = *(uint32_t*)a->l0.mvc[i_ref][2*i+2];
1272
LOAD_HPELS( &m, h->mb.pic.p_fref[0][i_ref], 0, i_ref, 0, 8*i );
1273
x264_macroblock_cache_ref( h, 0, 2*i, 4, 2, 0, i_ref );
1274
x264_mb_predict_mv( h, 0, 8*i, 4, m.mvp );
1275
x264_me_search( h, &m, mvc, 3 );
1277
m.cost += i_ref_cost;
1279
if( m.cost < l0m->cost )
1280
h->mc.memcpy_aligned( l0m, &m, sizeof(x264_me_t) );
1204
x264_macroblock_cache_mv( h, 0, 2*i, 4, 2, 0, l0m->mv[0], l0m->mv[1] );
1282
x264_macroblock_cache_mv_ptr( h, 0, 2*i, 4, 2, 0, l0m->mv );
1205
1283
x264_macroblock_cache_ref( h, 0, 2*i, 4, 2, 0, l0m->i_ref );
1231
1309
l0m->cost = INT_MAX;
1232
1310
for( j = 0; j < i_ref8s; j++ )
1234
const int i_ref = ref8[j];
1235
const int i_ref_cost = REF_COST( 0, i_ref );
1236
m.i_ref_cost = i_ref_cost;
1239
*(uint64_t*)mvc[0] = *(uint64_t*)a->l0.mvc[i_ref][0];
1240
*(uint64_t*)mvc[1] = *(uint64_t*)a->l0.mvc[i_ref][i+1];
1241
*(uint64_t*)mvc[2] = *(uint64_t*)a->l0.mvc[i_ref][i+3];
1243
LOAD_HPELS( &m, h->mb.pic.p_fref[0][i_ref], 0, i_ref, 8*i, 0 );
1244
x264_macroblock_cache_ref( h, 2*i, 0, 2, 4, 0, i_ref );
1245
x264_mb_predict_mv( h, 0, 4*i, 2, m.mvp );
1246
x264_me_search( h, &m, mvc, 3 );
1248
m.cost += i_ref_cost;
1250
if( m.cost < l0m->cost )
1312
const int i_ref = ref8[j];
1313
const int i_ref_cost = REF_COST( 0, i_ref );
1314
m.i_ref_cost = i_ref_cost;
1317
*(uint32_t*)mvc[0] = *(uint32_t*)a->l0.mvc[i_ref][0];
1318
*(uint32_t*)mvc[1] = *(uint32_t*)a->l0.mvc[i_ref][i+1];
1319
*(uint32_t*)mvc[2] = *(uint32_t*)a->l0.mvc[i_ref][i+3];
1321
LOAD_HPELS( &m, h->mb.pic.p_fref[0][i_ref], 0, i_ref, 8*i, 0 );
1322
x264_macroblock_cache_ref( h, 2*i, 0, 2, 4, 0, i_ref );
1323
x264_mb_predict_mv( h, 0, 4*i, 2, m.mvp );
1324
x264_me_search( h, &m, mvc, 3 );
1326
m.cost += i_ref_cost;
1328
if( m.cost < l0m->cost )
1329
h->mc.memcpy_aligned( l0m, &m, sizeof(x264_me_t) );
1253
x264_macroblock_cache_mv( h, 2*i, 0, 2, 4, 0, l0m->mv[0], l0m->mv[1] );
1331
x264_macroblock_cache_mv_ptr( h, 2*i, 0, 2, 4, 0, l0m->mv );
1254
1332
x264_macroblock_cache_ref( h, 2*i, 0, 2, 4, 0, l0m->i_ref );
1319
1397
x264_mb_predict_mv( h, 0, idx, 1, m->mvp );
1320
1398
x264_me_search( h, m, &a->l0.me8x8[i8x8].mv, i_mvc );
1322
x264_macroblock_cache_mv( h, x4, y4, 1, 1, 0, m->mv[0], m->mv[1] );
1400
x264_macroblock_cache_mv_ptr( h, x4, y4, 1, 1, 0, m->mv );
1324
1402
a->l0.i_cost4x4[i8x8] = a->l0.me4x4[i8x8][0].cost +
1325
1403
a->l0.me4x4[i8x8][1].cost +
1431
#define WEIGHTED_AVG( size, pix1, stride1, src2, stride2 ) \
1433
if( h->param.analyse.b_weighted_bipred ) \
1434
h->mc.avg_weight[size]( pix1, stride1, src2, stride2, \
1435
h->mb.bipred_weight[a->l0.i_ref][a->l1.i_ref] ); \
1437
h->mc.avg[size]( pix1, stride1, src2, stride2 ); \
1509
#define WEIGHTED_AVG( size, pix, stride, src1, stride1, src2, stride2 ) \
1511
h->mc.avg[size]( pix, stride, src1, stride1, src2, stride2, h->mb.bipred_weight[a->l0.i_ref][a->l1.i_ref] ); \
1440
1514
static void x264_mb_analyse_inter_b16x16( x264_t *h, x264_mb_analysis_t *a )
1516
DECLARE_ALIGNED_16( uint8_t pix0[16*16] );
1442
1517
DECLARE_ALIGNED_16( uint8_t pix1[16*16] );
1443
DECLARE_ALIGNED_16( uint8_t pix2[16*16] );
1518
uint8_t *src0, *src1;
1519
int stride0 = 16, stride1 = 16;
1450
int mvc[8][2], i_mvc;
1523
DECLARE_ALIGNED_4( int16_t mvc[9][2] );
1451
1524
int i_halfpel_thresh = INT_MAX;
1452
1525
int *p_halfpel_thresh = h->mb.pic.i_fref[0]>1 ? &i_halfpel_thresh : NULL;
1515
1586
x264_macroblock_cache_ref( h, 0, 0, 4, 4, 1, a->l1.i_ref );
1517
1588
/* get cost of BI mode */
1518
weight = h->mb.bipred_weight[a->l0.i_ref][a->l1.i_ref];
1519
if ( ((a->l0.me16x16.mv[0] | a->l0.me16x16.mv[1]) & 1) == 0 )
1521
/* l0 reference is halfpel, so get_ref on it will make it faster */
1523
h->mc.get_ref( pix2, &stride2,
1524
h->mb.pic.p_fref[0][a->l0.i_ref], h->mb.pic.i_stride[0],
1525
a->l0.me16x16.mv[0], a->l0.me16x16.mv[1],
1527
h->mc.mc_luma( pix1, 16,
1528
h->mb.pic.p_fref[1][a->l1.i_ref], h->mb.pic.i_stride[0],
1529
a->l1.me16x16.mv[0], a->l1.me16x16.mv[1],
1531
weight = 64 - weight;
1535
/* if l0 was qpel, we'll use get_ref on l1 instead */
1536
h->mc.mc_luma( pix1, 16,
1537
h->mb.pic.p_fref[0][a->l0.i_ref], h->mb.pic.i_stride[0],
1538
a->l0.me16x16.mv[0], a->l0.me16x16.mv[1],
1541
h->mc.get_ref( pix2, &stride2,
1542
h->mb.pic.p_fref[1][a->l1.i_ref], h->mb.pic.i_stride[0],
1543
a->l1.me16x16.mv[0], a->l1.me16x16.mv[1],
1547
if( h->param.analyse.b_weighted_bipred )
1548
h->mc.avg_weight[PIXEL_16x16]( pix1, 16, src2, stride2, weight );
1550
h->mc.avg[PIXEL_16x16]( pix1, 16, src2, stride2 );
1552
a->i_cost16x16bi = h->pixf.mbcmp[PIXEL_16x16]( h->mb.pic.p_fenc[0], FENC_STRIDE, pix1, 16 )
1589
src0 = h->mc.get_ref( pix0, &stride0,
1590
h->mb.pic.p_fref[0][a->l0.i_ref], h->mb.pic.i_stride[0],
1591
a->l0.me16x16.mv[0], a->l0.me16x16.mv[1], 16, 16 );
1592
src1 = h->mc.get_ref( pix1, &stride1,
1593
h->mb.pic.p_fref[1][a->l1.i_ref], h->mb.pic.i_stride[0],
1594
a->l1.me16x16.mv[0], a->l1.me16x16.mv[1], 16, 16 );
1596
h->mc.avg[PIXEL_16x16]( pix0, 16, src0, stride0, src1, stride1, h->mb.bipred_weight[a->l0.i_ref][a->l1.i_ref] );
1598
a->i_cost16x16bi = h->pixf.mbcmp[PIXEL_16x16]( h->mb.pic.p_fenc[0], FENC_STRIDE, pix0, 16 )
1553
1599
+ REF_COST( 0, a->l0.i_ref )
1554
1600
+ REF_COST( 1, a->l1.i_ref )
1555
1601
+ a->l0.me16x16.cost_mv
1569
1615
switch( h->mb.i_sub_partition[i] )
1572
x264_macroblock_cache_mv( h, x, y, 2, 2, 0, a->l0.me8x8[i].mv[0], a->l0.me8x8[i].mv[1] );
1618
x264_macroblock_cache_mv_ptr( h, x, y, 2, 2, 0, a->l0.me8x8[i].mv );
1575
x264_macroblock_cache_mv( h, x, y+0, 2, 1, 0, a->l0.me8x4[i][0].mv[0], a->l0.me8x4[i][0].mv[1] );
1576
x264_macroblock_cache_mv( h, x, y+1, 2, 1, 0, a->l0.me8x4[i][1].mv[0], a->l0.me8x4[i][1].mv[1] );
1621
x264_macroblock_cache_mv_ptr( h, x, y+0, 2, 1, 0, a->l0.me8x4[i][0].mv );
1622
x264_macroblock_cache_mv_ptr( h, x, y+1, 2, 1, 0, a->l0.me8x4[i][1].mv );
1579
x264_macroblock_cache_mv( h, x+0, y, 1, 2, 0, a->l0.me4x8[i][0].mv[0], a->l0.me4x8[i][0].mv[1] );
1580
x264_macroblock_cache_mv( h, x+1, y, 1, 2, 0, a->l0.me4x8[i][1].mv[0], a->l0.me4x8[i][1].mv[1] );
1625
x264_macroblock_cache_mv_ptr( h, x+0, y, 1, 2, 0, a->l0.me4x8[i][0].mv );
1626
x264_macroblock_cache_mv_ptr( h, x+1, y, 1, 2, 0, a->l0.me4x8[i][1].mv );
1583
x264_macroblock_cache_mv( h, x+0, y+0, 1, 1, 0, a->l0.me4x4[i][0].mv[0], a->l0.me4x4[i][0].mv[1] );
1584
x264_macroblock_cache_mv( h, x+1, y+0, 1, 1, 0, a->l0.me4x4[i][1].mv[0], a->l0.me4x4[i][1].mv[1] );
1585
x264_macroblock_cache_mv( h, x+0, y+1, 1, 1, 0, a->l0.me4x4[i][2].mv[0], a->l0.me4x4[i][2].mv[1] );
1586
x264_macroblock_cache_mv( h, x+1, y+1, 1, 1, 0, a->l0.me4x4[i][3].mv[0], a->l0.me4x4[i][3].mv[1] );
1629
x264_macroblock_cache_mv_ptr( h, x+0, y+0, 1, 1, 0, a->l0.me4x4[i][0].mv );
1630
x264_macroblock_cache_mv_ptr( h, x+1, y+0, 1, 1, 0, a->l0.me4x4[i][1].mv );
1631
x264_macroblock_cache_mv_ptr( h, x+0, y+1, 1, 1, 0, a->l0.me4x4[i][2].mv );
1632
x264_macroblock_cache_mv_ptr( h, x+1, y+1, 1, 1, 0, a->l0.me4x4[i][3].mv );
1589
1635
x264_log( h, X264_LOG_ERROR, "internal error\n" );
1595
1641
if( x264_mb_partition_listX_table[0][part] ) \
1597
1643
x264_macroblock_cache_ref( h, x,y,dx,dy, 0, a->l0.i_ref ); \
1598
x264_macroblock_cache_mv( h, x,y,dx,dy, 0, me0.mv[0], me0.mv[1] ); \
1644
x264_macroblock_cache_mv_ptr( h, x,y,dx,dy, 0, me0.mv ); \
1602
1648
x264_macroblock_cache_ref( h, x,y,dx,dy, 0, -1 ); \
1603
x264_macroblock_cache_mv( h, x,y,dx,dy, 0, 0, 0 ); \
1649
x264_macroblock_cache_mv( h, x,y,dx,dy, 0, 0 ); \
1605
x264_macroblock_cache_mvd( h, x,y,dx,dy, 0, 0, 0 ); \
1651
x264_macroblock_cache_mvd( h, x,y,dx,dy, 0, 0 ); \
1607
1653
if( x264_mb_partition_listX_table[1][part] ) \
1609
1655
x264_macroblock_cache_ref( h, x,y,dx,dy, 1, a->l1.i_ref ); \
1610
x264_macroblock_cache_mv( h, x,y,dx,dy, 1, me1.mv[0], me1.mv[1] ); \
1656
x264_macroblock_cache_mv_ptr( h, x,y,dx,dy, 1, me1.mv ); \
1614
1660
x264_macroblock_cache_ref( h, x,y,dx,dy, 1, -1 ); \
1615
x264_macroblock_cache_mv( h, x,y,dx,dy, 1, 0, 0 ); \
1661
x264_macroblock_cache_mv( h, x,y,dx,dy, 1, 0 ); \
1617
x264_macroblock_cache_mvd( h, x,y,dx,dy, 1, 0, 0 ); \
1663
x264_macroblock_cache_mvd( h, x,y,dx,dy, 1, 0 ); \
1620
1666
static inline void x264_mb_cache_mv_b8x8( x264_t *h, x264_mb_analysis_t *a, int i, int b_mvd )
1626
1672
x264_mb_load_mv_direct8x8( h, i );
1629
x264_macroblock_cache_mvd( h, x, y, 2, 2, 0, 0, 0 );
1630
x264_macroblock_cache_mvd( h, x, y, 2, 2, 1, 0, 0 );
1675
x264_macroblock_cache_mvd( h, x, y, 2, 2, 0, 0 );
1676
x264_macroblock_cache_mvd( h, x, y, 2, 2, 1, 0 );
1631
1677
x264_macroblock_cache_skip( h, x, y, 2, 2, 1 );
1680
1728
x264_mb_predict_mv( h, l, 4*i, 2, m->mvp );
1681
1729
x264_me_search( h, m, &lX->me16x16.mv, 1 );
1683
x264_macroblock_cache_mv( h, 2*x8, 2*y8, 2, 2, l, m->mv[0], m->mv[1] );
1731
x264_macroblock_cache_mv_ptr( h, 2*x8, 2*y8, 2, 2, l, m->mv );
1686
h->mc.mc_luma( pix[l], 8, m->p_fref, m->i_stride[0],
1687
m->mv[0], m->mv[1], 8, 8 );
1734
src[l] = h->mc.get_ref( pix[l], &stride[l], m->p_fref, m->i_stride[0],
1735
m->mv[0], m->mv[1], 8, 8 );
1688
1736
i_part_cost_bi += m->cost_mv;
1689
1737
/* FIXME: ref cost */
1692
WEIGHTED_AVG( PIXEL_8x8, pix[0], 8, pix[1], 8 );
1739
h->mc.avg[PIXEL_8x8]( pix[0], 8, src[0], stride[0], src[1], stride[1], h->mb.bipred_weight[a->l0.i_ref][a->l1.i_ref] );
1693
1740
i_part_cost_bi += h->pixf.mbcmp[PIXEL_8x8]( a->l0.me8x8[i].p_fenc[0], FENC_STRIDE, pix[0], 8 )
1694
1741
+ a->i_lambda * i_sub_mb_b_cost_table[D_BI_8x8];
1695
1742
a->l0.me8x8[i].cost += a->i_lambda * i_sub_mb_b_cost_table[D_L0_8x8];
1739
1788
LOAD_FENC( m, h->mb.pic.p_fenc, 0, 8*i );
1740
1789
LOAD_HPELS( m, p_fref[l], l, lX->i_ref, 0, 8*i );
1742
*(uint64_t*)mvc[0] = *(uint64_t*)lX->me8x8[2*i].mv;
1743
*(uint64_t*)mvc[1] = *(uint64_t*)lX->me8x8[2*i+1].mv;
1791
*(uint32_t*)mvc[0] = *(uint32_t*)lX->me8x8[2*i].mv;
1792
*(uint32_t*)mvc[1] = *(uint32_t*)lX->me8x8[2*i+1].mv;
1745
1794
x264_mb_predict_mv( h, l, 8*i, 2, m->mvp );
1746
1795
x264_me_search( h, m, mvc, 2 );
1749
h->mc.mc_luma( pix[l], 16, m->p_fref, m->i_stride[0],
1750
m->mv[0], m->mv[1], 16, 8 );
1798
src[l] = h->mc.get_ref( pix[l], &stride[l], m->p_fref, m->i_stride[0],
1799
m->mv[0], m->mv[1], 16, 8 );
1751
1800
/* FIXME: ref cost */
1752
1801
i_part_cost_bi += m->cost_mv;
1755
WEIGHTED_AVG( PIXEL_16x8, pix[0], 16, pix[1], 16 );
1803
h->mc.avg[PIXEL_16x8]( pix[0], 16, src[0], stride[0], src[1], stride[1], h->mb.bipred_weight[a->l0.i_ref][a->l1.i_ref] );
1756
1804
i_part_cost_bi += h->pixf.mbcmp[PIXEL_16x8]( a->l0.me16x8[i].p_fenc[0], FENC_STRIDE, pix[0], 16 );
1758
1806
i_part_cost = a->l0.me16x8[i].cost;
1807
1857
LOAD_FENC( m, h->mb.pic.p_fenc, 8*i, 0 );
1808
1858
LOAD_HPELS( m, p_fref[l], l, lX->i_ref, 8*i, 0 );
1810
*(uint64_t*)mvc[0] = *(uint64_t*)lX->me8x8[i].mv;
1811
*(uint64_t*)mvc[1] = *(uint64_t*)lX->me8x8[i+2].mv;
1860
*(uint32_t*)mvc[0] = *(uint32_t*)lX->me8x8[i].mv;
1861
*(uint32_t*)mvc[1] = *(uint32_t*)lX->me8x8[i+2].mv;
1813
1863
x264_mb_predict_mv( h, l, 4*i, 2, m->mvp );
1814
1864
x264_me_search( h, m, mvc, 2 );
1817
h->mc.mc_luma( pix[l], 8, m->p_fref, m->i_stride[0],
1818
m->mv[0], m->mv[1], 8, 16 );
1867
src[l] = h->mc.get_ref( pix[l], &stride[l], m->p_fref, m->i_stride[0],
1868
m->mv[0], m->mv[1], 8, 16 );
1819
1869
/* FIXME: ref cost */
1820
1870
i_part_cost_bi += m->cost_mv;
1823
WEIGHTED_AVG( PIXEL_8x16, pix[0], 8, pix[1], 8 );
1873
h->mc.avg[PIXEL_8x16]( pix[0], 8, src[0], stride[0], src[1], stride[1], h->mb.bipred_weight[a->l0.i_ref][a->l1.i_ref] );
1824
1874
i_part_cost_bi += h->pixf.mbcmp[PIXEL_8x16]( a->l0.me8x16[i].p_fenc[0], FENC_STRIDE, pix[0], 8 );
1826
1876
i_part_cost = a->l0.me8x16[i].cost;
1881
1931
if( a->l0.i_cost8x8 <= thresh )
1883
1933
h->mb.i_type = P_8x8;
1884
x264_analyse_update_cache( h, a );
1934
h->mb.i_partition = D_8x8;
1935
if( h->param.analyse.inter & X264_ANALYSE_PSUB8x8 )
1938
x264_macroblock_cache_ref( h, 0, 0, 2, 2, 0, a->l0.me8x8[0].i_ref );
1939
x264_macroblock_cache_ref( h, 2, 0, 2, 2, 0, a->l0.me8x8[1].i_ref );
1940
x264_macroblock_cache_ref( h, 0, 2, 2, 2, 0, a->l0.me8x8[2].i_ref );
1941
x264_macroblock_cache_ref( h, 2, 2, 2, 2, 0, a->l0.me8x8[3].i_ref );
1942
for( i = 0; i < 4; i++ )
1944
int costs[4] = {a->l0.i_cost4x4[i], a->l0.i_cost8x4[i], a->l0.i_cost4x8[i], a->l0.me8x8[i].cost};
1945
int thresh = X264_MIN4( costs[0], costs[1], costs[2], costs[3] ) * 5 / 4;
1946
int subtype, btype = D_L0_8x8;
1947
uint64_t bcost = COST_MAX64;
1948
for( subtype = D_L0_4x4; subtype <= D_L0_8x8; subtype++ )
1951
if( costs[subtype] > thresh || (subtype == D_L0_8x8 && bcost == COST_MAX64) )
1953
h->mb.i_sub_partition[i] = subtype;
1954
x264_mb_cache_mv_p8x8( h, a, i );
1955
cost = x264_rd_cost_part( h, a->i_lambda2, i<<2, PIXEL_8x8 );
1956
COPY2_IF_LT( bcost, cost, btype, subtype );
1958
h->mb.i_sub_partition[i] = btype;
1959
x264_mb_cache_mv_p8x8( h, a, i );
1963
x264_analyse_update_cache( h, a );
1885
1964
a->l0.i_cost8x8 = x264_rd_cost_mb( h, a->i_lambda2 );
1887
if( h->param.analyse.inter & X264_ANALYSE_PSUB8x8 )
1889
/* FIXME: RD per subpartition */
1893
for( i=0; i<4; i++ )
1895
part_bak[i] = h->mb.i_sub_partition[i];
1896
b_sub8x8 |= (part_bak[i] != D_L0_8x8);
1900
h->mb.i_sub_partition[0] = h->mb.i_sub_partition[1] =
1901
h->mb.i_sub_partition[2] = h->mb.i_sub_partition[3] = D_L0_8x8;
1902
i_cost = x264_rd_cost_mb( h, a->i_lambda2 );
1903
if( a->l0.i_cost8x8 < i_cost )
1905
for( i=0; i<4; i++ )
1906
h->mb.i_sub_partition[i] = part_bak[i];
1909
a->l0.i_cost8x8 = i_cost;
1914
1967
a->l0.i_cost8x8 = COST_MAX;
1983
static void refine_bidir( x264_t *h, x264_mb_analysis_t *a )
2040
static void x264_refine_bidir( x264_t *h, x264_mb_analysis_t *a )
1985
2042
const int i_biweight = h->mb.bipred_weight[a->l0.i_ref][a->l1.i_ref];
2045
if( IS_INTRA(h->mb.i_type) )
1988
2048
switch( h->mb.i_partition )
1991
2051
if( h->mb.i_type == B_BI_BI )
1992
x264_me_refine_bidir( h, &a->l0.me16x16, &a->l1.me16x16, i_biweight );
2052
x264_me_refine_bidir_satd( h, &a->l0.me16x16, &a->l1.me16x16, i_biweight );
1995
2055
for( i=0; i<2; i++ )
1996
2056
if( a->i_mb_partition16x8[i] == D_BI_8x8 )
1997
x264_me_refine_bidir( h, &a->l0.me16x8[i], &a->l1.me16x8[i], i_biweight );
2057
x264_me_refine_bidir_satd( h, &a->l0.me16x8[i], &a->l1.me16x8[i], i_biweight );
2000
2060
for( i=0; i<2; i++ )
2001
2061
if( a->i_mb_partition8x16[i] == D_BI_8x8 )
2002
x264_me_refine_bidir( h, &a->l0.me8x16[i], &a->l1.me8x16[i], i_biweight );
2062
x264_me_refine_bidir_satd( h, &a->l0.me8x16[i], &a->l1.me8x16[i], i_biweight );
2005
2065
for( i=0; i<4; i++ )
2006
2066
if( h->mb.i_sub_partition[i] == D_BI_8x8 )
2007
x264_me_refine_bidir( h, &a->l0.me8x8[i], &a->l1.me8x8[i], i_biweight );
2067
x264_me_refine_bidir_satd( h, &a->l0.me8x8[i], &a->l1.me8x8[i], i_biweight );
2012
2072
static inline void x264_mb_analyse_transform( x264_t *h )
2014
if( x264_mb_transform_8x8_allowed( h ) && h->param.analyse.b_transform_8x8 )
2074
if( x264_mb_transform_8x8_allowed( h ) && h->param.analyse.b_transform_8x8 && !h->mb.b_lossless )
2016
2076
int i_cost4, i_cost8;
2017
/* FIXME only luma mc is needed */
2077
/* Only luma MC is really needed, but the full MC is re-used in macroblock_encode. */
2018
2078
x264_mb_mc( h );
2020
2080
i_cost8 = h->pixf.sa8d[PIXEL_16x16]( h->mb.pic.p_fenc[0], FENC_STRIDE,
2070
2131
/*--------------------------- Do the analysis ---------------------------*/
2071
2132
if( h->sh.i_type == SLICE_TYPE_I )
2134
if( analysis.i_mbrd )
2135
x264_mb_cache_fenc_satd( h );
2073
2136
x264_mb_analyse_intra( h, &analysis, COST_MAX );
2074
if( analysis.b_mbrd )
2137
if( analysis.i_mbrd )
2075
2138
x264_intra_rd( h, &analysis, COST_MAX );
2077
2140
i_cost = analysis.i_satd_i16x16;
2078
2141
h->mb.i_type = I_16x16;
2079
if( analysis.i_satd_i4x4 < i_cost )
2081
i_cost = analysis.i_satd_i4x4;
2082
h->mb.i_type = I_4x4;
2084
if( analysis.i_satd_i8x8 < i_cost )
2085
h->mb.i_type = I_8x8;
2142
COPY2_IF_LT( i_cost, analysis.i_satd_i4x4, h->mb.i_type, I_4x4 );
2143
COPY2_IF_LT( i_cost, analysis.i_satd_i8x8, h->mb.i_type, I_8x8 );
2144
if( analysis.i_satd_pcm < i_cost )
2145
h->mb.i_type = I_PCM;
2087
if( h->mb.i_subpel_refine >= 7 )
2147
else if( analysis.i_mbrd >= 2 )
2088
2148
x264_intra_rd_refine( h, &analysis );
2090
2150
else if( h->sh.i_type == SLICE_TYPE_P )
2314
2375
else if( i_partition == D_16x16 )
2316
2377
x264_macroblock_cache_ref( h, 0, 0, 4, 4, 0, analysis.l0.me16x16.i_ref );
2317
x264_me_refine_qpel_rd( h, &analysis.l0.me16x16, analysis.i_lambda2, 0 );
2378
x264_me_refine_qpel_rd( h, &analysis.l0.me16x16, analysis.i_lambda2, 0, 0 );
2319
2380
else if( i_partition == D_16x8 )
2382
h->mb.i_sub_partition[0] = h->mb.i_sub_partition[1] =
2383
h->mb.i_sub_partition[2] = h->mb.i_sub_partition[3] = D_L0_8x8;
2321
2384
x264_macroblock_cache_ref( h, 0, 0, 4, 2, 0, analysis.l0.me16x8[0].i_ref );
2322
2385
x264_macroblock_cache_ref( h, 0, 2, 4, 2, 0, analysis.l0.me16x8[1].i_ref );
2323
x264_me_refine_qpel_rd( h, &analysis.l0.me16x8[0], analysis.i_lambda2, 0 );
2324
x264_me_refine_qpel_rd( h, &analysis.l0.me16x8[1], analysis.i_lambda2, 2 );
2386
x264_me_refine_qpel_rd( h, &analysis.l0.me16x8[0], analysis.i_lambda2, 0, 0 );
2387
x264_me_refine_qpel_rd( h, &analysis.l0.me16x8[1], analysis.i_lambda2, 8, 0 );
2326
2389
else if( i_partition == D_8x16 )
2391
h->mb.i_sub_partition[0] = h->mb.i_sub_partition[1] =
2392
h->mb.i_sub_partition[2] = h->mb.i_sub_partition[3] = D_L0_8x8;
2328
2393
x264_macroblock_cache_ref( h, 0, 0, 2, 4, 0, analysis.l0.me8x16[0].i_ref );
2329
2394
x264_macroblock_cache_ref( h, 2, 0, 2, 4, 0, analysis.l0.me8x16[1].i_ref );
2330
x264_me_refine_qpel_rd( h, &analysis.l0.me8x16[0], analysis.i_lambda2, 0 );
2331
x264_me_refine_qpel_rd( h, &analysis.l0.me8x16[1], analysis.i_lambda2, 1 );
2395
x264_me_refine_qpel_rd( h, &analysis.l0.me8x16[0], analysis.i_lambda2, 0, 0 );
2396
x264_me_refine_qpel_rd( h, &analysis.l0.me8x16[1], analysis.i_lambda2, 4, 0 );
2333
2398
else if( i_partition == D_8x8 )
2336
2401
x264_analyse_update_cache( h, &analysis );
2337
2402
for( i8x8 = 0; i8x8 < 4; i8x8++ )
2338
if( h->mb.i_sub_partition[i8x8] == D_L0_8x8 )
2339
x264_me_refine_qpel_rd( h, &analysis.l0.me8x8[i8x8], analysis.i_lambda2, i8x8 );
2404
if( h->mb.i_sub_partition[i8x8] == D_L0_8x8 )
2406
x264_me_refine_qpel_rd( h, &analysis.l0.me8x8[i8x8], analysis.i_lambda2, i8x8*4, 0 );
2408
else if( h->mb.i_sub_partition[i8x8] == D_L0_8x4 )
2410
x264_me_refine_qpel_rd( h, &analysis.l0.me8x4[i8x8][0], analysis.i_lambda2, i8x8*4+0, 0 );
2411
x264_me_refine_qpel_rd( h, &analysis.l0.me8x4[i8x8][1], analysis.i_lambda2, i8x8*4+2, 0 );
2413
else if( h->mb.i_sub_partition[i8x8] == D_L0_4x8 )
2415
x264_me_refine_qpel_rd( h, &analysis.l0.me4x8[i8x8][0], analysis.i_lambda2, i8x8*4+0, 0 );
2416
x264_me_refine_qpel_rd( h, &analysis.l0.me4x8[i8x8][1], analysis.i_lambda2, i8x8*4+1, 0 );
2418
else if( h->mb.i_sub_partition[i8x8] == D_L0_4x4 )
2420
x264_me_refine_qpel_rd( h, &analysis.l0.me4x4[i8x8][0], analysis.i_lambda2, i8x8*4+0, 0 );
2421
x264_me_refine_qpel_rd( h, &analysis.l0.me4x4[i8x8][1], analysis.i_lambda2, i8x8*4+1, 0 );
2422
x264_me_refine_qpel_rd( h, &analysis.l0.me4x4[i8x8][2], analysis.i_lambda2, i8x8*4+2, 0 );
2423
x264_me_refine_qpel_rd( h, &analysis.l0.me4x4[i8x8][3], analysis.i_lambda2, i8x8*4+3, 0 );
2572
2661
COPY2_IF_LT( i_cost, analysis.i_satd_i16x16, i_type, I_16x16 );
2573
2662
COPY2_IF_LT( i_cost, analysis.i_satd_i8x8, i_type, I_8x8 );
2574
2663
COPY2_IF_LT( i_cost, analysis.i_satd_i4x4, i_type, I_4x4 );
2664
COPY2_IF_LT( i_cost, analysis.i_satd_pcm, i_type, I_PCM );
2576
2666
h->mb.i_type = i_type;
2577
2667
h->mb.i_partition = i_partition;
2579
if( h->mb.i_subpel_refine >= 7 && IS_INTRA( i_type ) )
2669
if( analysis.i_mbrd >= 2 && IS_INTRA( i_type ) && i_type != I_PCM )
2580
2670
x264_intra_rd_refine( h, &analysis );
2581
else if( h->param.analyse.b_bidir_me )
2582
refine_bidir( h, &analysis );
2671
if( h->mb.i_subpel_refine >= 5 )
2672
x264_refine_bidir( h, &analysis );
2674
if( analysis.i_mbrd >= 2 && i_type > B_DIRECT && i_type < B_SKIP )
2676
const int i_biweight = h->mb.bipred_weight[analysis.l0.i_ref][analysis.l1.i_ref];
2677
x264_analyse_update_cache( h, &analysis );
2679
if( i_partition == D_16x16 )
2681
if( i_type == B_L0_L0 )
2682
x264_me_refine_qpel_rd( h, &analysis.l0.me16x16, analysis.i_lambda2, 0, 0 );
2683
else if( i_type == B_L1_L1 )
2684
x264_me_refine_qpel_rd( h, &analysis.l1.me16x16, analysis.i_lambda2, 0, 1 );
2685
else if( i_type == B_BI_BI )
2686
x264_me_refine_bidir_rd( h, &analysis.l0.me16x16, &analysis.l1.me16x16, i_biweight, 0, analysis.i_lambda2 );
2688
else if( i_partition == D_16x8 )
2690
for( i = 0; i < 2; i++ )
2692
h->mb.i_sub_partition[i*2] = h->mb.i_sub_partition[i*2+1] = analysis.i_mb_partition16x8[i];
2693
if( analysis.i_mb_partition16x8[i] == D_L0_8x8 )
2694
x264_me_refine_qpel_rd( h, &analysis.l0.me16x8[i], analysis.i_lambda2, i*8, 0 );
2695
else if( analysis.i_mb_partition16x8[i] == D_L1_8x8 )
2696
x264_me_refine_qpel_rd( h, &analysis.l1.me16x8[i], analysis.i_lambda2, i*8, 1 );
2697
else if( analysis.i_mb_partition16x8[i] == D_BI_8x8 )
2698
x264_me_refine_bidir_rd( h, &analysis.l0.me16x8[i], &analysis.l1.me16x8[i], i_biweight, i*2, analysis.i_lambda2 );
2701
else if( i_partition == D_8x16 )
2703
for( i = 0; i < 2; i++ )
2705
h->mb.i_sub_partition[i] = h->mb.i_sub_partition[i+2] = analysis.i_mb_partition8x16[i];
2706
if( analysis.i_mb_partition8x16[i] == D_L0_8x8 )
2707
x264_me_refine_qpel_rd( h, &analysis.l0.me8x16[i], analysis.i_lambda2, i*4, 0 );
2708
else if( analysis.i_mb_partition8x16[i] == D_L1_8x8 )
2709
x264_me_refine_qpel_rd( h, &analysis.l1.me8x16[i], analysis.i_lambda2, i*4, 1 );
2710
else if( analysis.i_mb_partition8x16[i] == D_BI_8x8 )
2711
x264_me_refine_bidir_rd( h, &analysis.l0.me8x16[i], &analysis.l1.me8x16[i], i_biweight, i, analysis.i_lambda2 );
2714
else if( i_partition == D_8x8 )
2716
for( i = 0; i < 4; i++ )
2718
if( h->mb.i_sub_partition[i] == D_L0_8x8 )
2719
x264_me_refine_qpel_rd( h, &analysis.l0.me8x8[i], analysis.i_lambda2, i*4, 0 );
2720
else if( h->mb.i_sub_partition[i] == D_L1_8x8 )
2721
x264_me_refine_qpel_rd( h, &analysis.l1.me8x8[i], analysis.i_lambda2, i*4, 1 );
2722
else if( h->mb.i_sub_partition[i] == D_BI_8x8 )
2723
x264_me_refine_bidir_rd( h, &analysis.l0.me8x8[i], &analysis.l1.me8x8[i], i_biweight, i, analysis.i_lambda2 );
2586
2730
x264_analyse_update_cache( h, &analysis );
2588
if( !analysis.b_mbrd )
2732
if( !analysis.i_mbrd )
2589
2733
x264_mb_analyse_transform( h );
2591
2735
h->mb.b_trellis = h->param.analyse.i_trellis;
2592
h->mb.b_noise_reduction = h->param.analyse.i_noise_reduction;
2736
h->mb.b_noise_reduction = !!h->param.analyse.i_noise_reduction;
2737
if( !IS_SKIP(h->mb.i_type) && h->mb.i_psy_trellis && h->param.analyse.i_trellis == 1 )
2738
x264_psy_trellis_init( h, 0 );
2593
2739
if( h->mb.b_trellis == 1 || h->mb.b_noise_reduction )
2594
2740
h->mb.i_skip_intra = 0;
2618
2764
x264_mb_analyse_intra_chroma( h, a );
2622
2771
switch( h->mb.i_partition )
2625
2774
x264_macroblock_cache_ref( h, 0, 0, 4, 4, 0, a->l0.me16x16.i_ref );
2626
x264_macroblock_cache_mv ( h, 0, 0, 4, 4, 0, a->l0.me16x16.mv[0], a->l0.me16x16.mv[1] );
2775
x264_macroblock_cache_mv_ptr( h, 0, 0, 4, 4, 0, a->l0.me16x16.mv );
2630
2779
x264_macroblock_cache_ref( h, 0, 0, 4, 2, 0, a->l0.me16x8[0].i_ref );
2631
2780
x264_macroblock_cache_ref( h, 0, 2, 4, 2, 0, a->l0.me16x8[1].i_ref );
2632
x264_macroblock_cache_mv ( h, 0, 0, 4, 2, 0, a->l0.me16x8[0].mv[0], a->l0.me16x8[0].mv[1] );
2633
x264_macroblock_cache_mv ( h, 0, 2, 4, 2, 0, a->l0.me16x8[1].mv[0], a->l0.me16x8[1].mv[1] );
2781
x264_macroblock_cache_mv_ptr( h, 0, 0, 4, 2, 0, a->l0.me16x8[0].mv );
2782
x264_macroblock_cache_mv_ptr( h, 0, 2, 4, 2, 0, a->l0.me16x8[1].mv );
2637
2786
x264_macroblock_cache_ref( h, 0, 0, 2, 4, 0, a->l0.me8x16[0].i_ref );
2638
2787
x264_macroblock_cache_ref( h, 2, 0, 2, 4, 0, a->l0.me8x16[1].i_ref );
2639
x264_macroblock_cache_mv ( h, 0, 0, 2, 4, 0, a->l0.me8x16[0].mv[0], a->l0.me8x16[0].mv[1] );
2640
x264_macroblock_cache_mv ( h, 2, 0, 2, 4, 0, a->l0.me8x16[1].mv[0], a->l0.me8x16[1].mv[1] );
2788
x264_macroblock_cache_mv_ptr( h, 0, 0, 2, 4, 0, a->l0.me8x16[0].mv );
2789
x264_macroblock_cache_mv_ptr( h, 2, 0, 2, 4, 0, a->l0.me8x16[1].mv );
2688
2836
x264_macroblock_cache_ref( h, 0, 0, 4, 4, 0, a->l0.i_ref );
2689
x264_macroblock_cache_mv ( h, 0, 0, 4, 4, 0, a->l0.me16x16.mv[0], a->l0.me16x16.mv[1] );
2837
x264_macroblock_cache_mv_ptr( h, 0, 0, 4, 4, 0, a->l0.me16x16.mv );
2691
2839
x264_macroblock_cache_ref( h, 0, 0, 4, 4, 1, -1 );
2692
x264_macroblock_cache_mv ( h, 0, 0, 4, 4, 1, 0, 0 );
2693
x264_macroblock_cache_mvd( h, 0, 0, 4, 4, 1, 0, 0 );
2840
x264_macroblock_cache_mv ( h, 0, 0, 4, 4, 1, 0 );
2841
x264_macroblock_cache_mvd( h, 0, 0, 4, 4, 1, 0 );
2696
2844
x264_macroblock_cache_ref( h, 0, 0, 4, 4, 0, -1 );
2697
x264_macroblock_cache_mv ( h, 0, 0, 4, 4, 0, 0, 0 );
2698
x264_macroblock_cache_mvd( h, 0, 0, 4, 4, 0, 0, 0 );
2845
x264_macroblock_cache_mv ( h, 0, 0, 4, 4, 0, 0 );
2846
x264_macroblock_cache_mvd( h, 0, 0, 4, 4, 0, 0 );
2700
2848
x264_macroblock_cache_ref( h, 0, 0, 4, 4, 1, a->l1.i_ref );
2701
x264_macroblock_cache_mv ( h, 0, 0, 4, 4, 1, a->l1.me16x16.mv[0], a->l1.me16x16.mv[1] );
2849
x264_macroblock_cache_mv_ptr( h, 0, 0, 4, 4, 1, a->l1.me16x16.mv );
2704
2852
x264_macroblock_cache_ref( h, 0, 0, 4, 4, 0, a->l0.i_ref );
2705
x264_macroblock_cache_mv ( h, 0, 0, 4, 4, 0, a->l0.me16x16.mv[0], a->l0.me16x16.mv[1] );
2853
x264_macroblock_cache_mv_ptr( h, 0, 0, 4, 4, 0, a->l0.me16x16.mv );
2707
2855
x264_macroblock_cache_ref( h, 0, 0, 4, 4, 1, a->l1.i_ref );
2708
x264_macroblock_cache_mv ( h, 0, 0, 4, 4, 1, a->l1.me16x16.mv[0], a->l1.me16x16.mv[1] );
2856
x264_macroblock_cache_mv_ptr( h, 0, 0, 4, 4, 1, a->l1.me16x16.mv );