unsafe void estimate_frame(FlacFrame frame, bool do_midside)
{
int subframes = do_midside ? channels * 2 : channels;
switch (eparams.stereo_method)
{
case StereoMethod.Estimate:
for (int ch = 0; ch < subframes; ch++)
{
LpcContext lpc_ctx = frame.subframes[ch].lpc_ctx[0];
lpc_ctx.GetReflection(4, frame.subframes[ch].samples, frame.blocksize, frame.window_buffer);
lpc_ctx.SortOrdersAkaike(frame.blocksize, 1, 4, 4.5, 0.0);
frame.subframes[ch].best.size = (uint)Math.Max(0, lpc_ctx.Akaike(frame.blocksize, lpc_ctx.best_orders[0], 4.5, 0.0) + 7.1 * frame.subframes[ch].obits * eparams.max_prediction_order);
}
break;
case StereoMethod.Evaluate:
for (int ch = 0; ch < subframes; ch++)
encode_residual_pass1(frame, ch, 0);
break;
case StereoMethod.Search:
for (int ch = 0; ch < subframes; ch++)
encode_residual_pass2(frame, ch);
break;
}
}