private void processPair(CPE cpe, FilterBank filterBank, int channel, Profile profile, SampleFrequency sf) throws AACException {
final ICStream ics1 = cpe.getLeftChannel();
final ICStream ics2 = cpe.getRightChannel();
final ICSInfo info1 = ics1.getInfo();
final ICSInfo info2 = ics2.getInfo();
final LTPrediction ltp1 = info1.getLTPrediction1();
final LTPrediction ltp2 = cpe.isCommonWindow() ? info1.getLTPrediction2() : info2.getLTPrediction1();
final int elementID = cpe.getElementInstanceTag();
//inverse quantization
final float[] iqData1 = ics1.getInvQuantData();
final float[] iqData2 = ics2.getInvQuantData();
//MS
if(cpe.isCommonWindow()&&cpe.isMSMaskPresent()) MS.process(cpe, iqData1, iqData2);
//main prediction
if(profile.equals(Profile.AAC_MAIN)) {
if(info1.isICPredictionPresent()) info1.getICPrediction().process(ics1, iqData1, sf);
if(info2.isICPredictionPresent()) info2.getICPrediction().process(ics2, iqData2, sf);
}
//IS
IS.process(cpe, iqData1, iqData2);
//LTP
if(LTPrediction.isLTPProfile(profile)) {
if(info1.isLTPrediction1Present()) ltp1.process(ics1, iqData1, filterBank, sf);
if(cpe.isCommonWindow()&&info1.isLTPrediction2Present()) ltp2.process(ics2, iqData2, filterBank, sf);
else if(info2.isLTPrediction1Present()) ltp2.process(ics2, iqData2, filterBank, sf);
}
//dependent coupling
processDependentCoupling(true, elementID, CCE.BEFORE_TNS, iqData1, iqData2);
//TNS
if(ics1.isTNSDataPresent()) ics1.getTNS().process(ics1, iqData1, sf, false);
if(ics2.isTNSDataPresent()) ics2.getTNS().process(ics2, iqData2, sf, false);
//dependent coupling
processDependentCoupling(true, elementID, CCE.AFTER_TNS, iqData1, iqData2);
//filterbank
filterBank.process(info1.getWindowSequence(), info1.getWindowShape(ICSInfo.CURRENT), info1.getWindowShape(ICSInfo.PREVIOUS), iqData1, data[channel], channel);
filterBank.process(info2.getWindowSequence(), info2.getWindowShape(ICSInfo.CURRENT), info2.getWindowShape(ICSInfo.PREVIOUS), iqData2, data[channel+1], channel+1);
if(LTPrediction.isLTPProfile(profile)) {
ltp1.updateState(data[channel], filterBank.getOverlap(channel), profile);
ltp2.updateState(data[channel+1], filterBank.getOverlap(channel+1), profile);
}
//independent coupling
processIndependentCoupling(true, elementID, data[channel], data[channel+1]);