/* early termination
* SSD threshold would probably be better than SATD */
- if( i_ref == 0 && a->b_try_pskip && m.cost-m.cost_mv < 300*a->i_lambda )
+ if( i_ref == 0
+ && a->b_try_pskip
+ && m.cost-m.cost_mv < 300*a->i_lambda
+ && abs(m.mv[0]-h->mb.cache.pskip_mv[0])
+ + abs(m.mv[1]-h->mb.cache.pskip_mv[1]) <= 1
+ && x264_macroblock_probe_pskip( h ) )
{
- int mvskip[2];
- x264_mb_predict_mv_pskip( h, mvskip );
- if( abs(m.mv[0]-mvskip[0]) + abs(m.mv[1]-mvskip[1]) <= 1
- && x264_macroblock_probe_pskip( h ) )
- {
- h->mb.i_type = P_SKIP;
- x264_analyse_update_cache( h, a );
- return;
- }
+ h->mb.i_type = P_SKIP;
+ x264_analyse_update_cache( h, a );
+ return;
}
m.cost += i_ref_cost;
x264_macroblock_cache_ref( h, 0, 0, 4, 4, 0, a->l0.me16x16.i_ref );
h->mb.i_type = P_L0;
- if( a->b_mbrd && a->l0.i_ref == 0 )
+ if( a->b_mbrd && a->l0.i_ref == 0
+ && a->l0.me16x16.mv[0] == h->mb.cache.pskip_mv[0]
+ && a->l0.me16x16.mv[1] == h->mb.cache.pskip_mv[1] )
{
- int mvskip[2];
- x264_mb_predict_mv_pskip( h, mvskip );
- if( a->l0.me16x16.mv[0] == mvskip[0] && a->l0.me16x16.mv[1] == mvskip[1] )
- {
- h->mb.i_partition = D_16x16;
- x264_macroblock_cache_mv( h, 0, 0, 4, 4, 0, a->l0.me16x16.mv[0], a->l0.me16x16.mv[1] );
- a->l0.i_rd16x16 = x264_rd_cost_mb( h, a->i_lambda2 );
- }
+ h->mb.i_partition = D_16x16;
+ x264_macroblock_cache_mv( h, 0, 0, 4, 4, 0, a->l0.me16x16.mv[0], a->l0.me16x16.mv[1] );
+ a->l0.i_rd16x16 = x264_rd_cost_mb( h, a->i_lambda2 );
}
}
case P_SKIP:
{
- int mvp[2];
- x264_mb_predict_mv_pskip( h, mvp );
- /* */
h->mb.i_partition = D_16x16;
x264_macroblock_cache_ref( h, 0, 0, 4, 4, 0, 0 );
- x264_macroblock_cache_mv ( h, 0, 0, 4, 4, 0, mvp[0], mvp[1] );
+ x264_macroblock_cache_mv ( h, 0, 0, 4, 4, 0, h->mb.cache.pskip_mv[0],
+ h->mb.cache.pskip_mv[1] );
break;
}
if( !b_force_no_skip )
{
if( h->mb.i_type == P_L0 && h->mb.i_partition == D_16x16 &&
- h->mb.i_cbp_luma == 0x00 && h->mb.i_cbp_chroma== 0x00 &&
+ h->mb.i_cbp_luma == 0x00 && h->mb.i_cbp_chroma == 0x00 &&
+ h->mb.cache.mv[0][x264_scan8[0]][0] == h->mb.cache.pskip_mv[0] &&
+ h->mb.cache.mv[0][x264_scan8[0]][1] == h->mb.cache.pskip_mv[1] &&
h->mb.cache.ref[0][x264_scan8[0]] == 0 )
{
- int mvp[2];
-
- x264_mb_predict_mv_pskip( h, mvp );
- if( h->mb.cache.mv[0][x264_scan8[0]][0] == mvp[0] &&
- h->mb.cache.mv[0][x264_scan8[0]][1] == mvp[1] )
- {
- h->mb.i_type = P_SKIP;
- }
+ h->mb.i_type = P_SKIP;
}
/* Check for B_SKIP */
if( !b_bidir )
{
/* Get the MV */
- x264_mb_predict_mv_pskip( h, mvp );
- mvp[0] = x264_clip3( mvp[0], h->mb.mv_min[0], h->mb.mv_max[0] );
- mvp[1] = x264_clip3( mvp[1], h->mb.mv_min[1], h->mb.mv_max[1] );
+ mvp[0] = x264_clip3( h->mb.cache.pskip_mv[0], h->mb.mv_min[0], h->mb.mv_max[0] );
+ mvp[1] = x264_clip3( h->mb.cache.pskip_mv[1], h->mb.mv_min[1], h->mb.mv_max[1] );
/* Motion compensation */
h->mc.mc_luma( h->mb.pic.p_fref[0][0], h->mb.pic.i_stride[0],