a->b_fast_intra = 1;
}
}
- h->mb.b_skip_pbskip_mc = 0;
+ h->mb.b_skip_mc = 0;
}
}
if( a->b_direct_available && a->i_rd16x16direct == COST_MAX )
{
h->mb.i_type = B_DIRECT;
+ /* Assumes direct/skip MC is still in fdec */
+ /* Requires b-rdo to be done before intra analysis */
+ h->mb.b_skip_mc = 1;
x264_analyse_update_cache( h, a );
a->i_rd16x16direct = x264_rd_cost_mb( h, a->i_lambda2 );
+ h->mb.b_skip_mc = 0;
}
//FIXME not all the update_cache calls are needed
if( x264_mb_transform_8x8_allowed( h ) && h->param.analyse.b_transform_8x8 )
{
int i_cost4, i_cost8;
- /* FIXME only luma mc is needed */
+ /* Only luma MC is really needed, but the full MC is re-used in macroblock_encode. */
x264_mb_mc( h );
i_cost8 = h->pixf.sa8d[PIXEL_16x16]( h->mb.pic.p_fenc[0], FENC_STRIDE,
h->mb.pic.p_fdec[0], FDEC_STRIDE );
h->mb.b_transform_8x8 = i_cost8 < i_cost4;
+ h->mb.b_skip_mc = 1;
}
}
{
h->mb.i_type = B_SKIP;
x264_analyse_update_cache( h, &analysis );
- h->mb.b_skip_pbskip_mc = 1;
+ h->mb.b_skip_mc = 1;
return;
}
}
const unsigned int flags = h->param.analyse.inter;
int i_type;
int i_partition;
- h->mb.b_skip_pbskip_mc = 0;
+ int i_satd_inter = 0; // shut up uninitialized warning
+ h->mb.b_skip_mc = 0;
x264_mb_analyse_load_costs( h, &analysis );
}
}
- x264_mb_analyse_intra( h, &analysis, i_cost );
-
if( analysis.b_mbrd )
{
- int i_satd_inter = i_cost;
+ i_satd_inter = i_cost;
x264_mb_analyse_b_rd( h, &analysis, i_satd_inter );
i_type = B_SKIP;
i_cost = i_bskip_cost;
h->mb.i_type = i_type;
h->mb.i_partition = i_partition;
+ }
+
+ x264_mb_analyse_intra( h, &analysis, i_satd_inter );
+
+ if( analysis.b_mbrd )
+ {
x264_mb_analyse_transform_rd( h, &analysis, &i_satd_inter, &i_cost );
x264_intra_rd( h, &analysis, i_satd_inter * 17/16 );
}
h->mb.mv_min[1], h->mb.mv_max[1] );
/* don't do pskip motion compensation if it was already done in macroblock_analyse */
- if( !h->mb.b_skip_pbskip_mc )
+ if( !h->mb.b_skip_mc )
{
h->mc.mc_luma( h->mb.pic.p_fdec[0], FDEC_STRIDE,
h->mb.pic.p_fref[0][0], h->mb.pic.i_stride[0],
if( h->mb.i_type == B_SKIP )
{
/* don't do bskip motion compensation if it was already done in macroblock_analyse */
- if( !h->mb.b_skip_pbskip_mc )
+ if( !h->mb.b_skip_mc )
x264_mb_mc( h );
x264_macroblock_encode_skip( h );
return;
int i8x8, i4x4;
int i_decimate_mb = 0;
- /* Motion compensation */
- x264_mb_mc( h );
+ /* Don't repeat motion compensation if it was already done in non-RD transform analysis */
+ if( !h->mb.b_skip_mc )
+ x264_mb_mc( h );
if( h->mb.b_lossless )
{
}
}
- h->mb.b_skip_pbskip_mc = 1;
+ h->mb.b_skip_mc = 1;
return 1;
}
int i0 = 4 + 3*(m0x-om0x) + (m0y-om0y); \
int i1 = 4 + 3*(m1x-om1x) + (m1y-om1y); \
visited[(m0x)&7][(m0y)&7][(m1x)&7][(m1y)&7] = 1; \
- memcpy( pix, pix0[i0], bs ); \
+ h->mc.memcpy_aligned( pix, pix0[i0], bs ); \
if( i_weight == 32 ) \
h->mc.avg[i_pixel]( pix, bw, pix1[i1], bw ); \
else \