//early termination
if( fabs( ref_mean - fenc_mean ) < 0.5 && fabsf( 1 - (float)fenc_var / ref_var ) < epsilon )
+ {
+ SET_WEIGHT( weights[0], 0, 1, 0, 0 );
return;
+ }
guess_scale = ref_var ? (float)fenc_var/ref_var : 0;
get_h264_weight( round( guess_scale * 128 ), 0, &weights[0] );
origscore = minscore = x264_weight_cost( h, fenc, mcbuf, 0 );
if( !minscore )
+ {
+ SET_WEIGHT( weights[0], 0, 1, 0, 0 );
return;
+ }
// This gives a slight improvement due to rounding errors but only tests
// one offset on lookahead.