private int decodeIcs(SingleChannelElement sce,boolean commonWindow,boolean scaleFlag){
  int ret;
  Pulse pulse=new Pulse();
  TemporalNoiseShaping tns=sce.tns;
  IndividualChannelStream ics=sce.ics;
  float out[]=sce.coeffs;
  boolean eldSyntax=ac.oc[1].m4ac.objectType == AOT_ER_AAC_ELD;
  boolean erSyntax=ac.oc[1].m4ac.objectType == AOT_ER_AAC_LC || ac.oc[1].m4ac.objectType == AOT_ER_AAC_LTP || ac.oc[1].m4ac.objectType == AOT_ER_AAC_LD || ac.oc[1].m4ac.objectType == AOT_ER_AAC_ELD;
  int globalGain=br.read(8);
  if (!commonWindow && !scaleFlag) {
    if (decodeIcsInfo(ics) < 0) {
      return AAC_ERROR;
    }
  }
  ret=decodeBandTypes(sce.bandType,sce.bandTypeRunEnd,ics);
  if (ret < 0) {
    return ret;
  }
  ret=decodeScalefactors(sce.sf,globalGain,ics,sce.bandType,sce.bandTypeRunEnd);
  if (ret < 0) {
    return ret;
  }
  boolean pulsePresent=false;
  if (!scaleFlag) {
    if (!eldSyntax && (pulsePresent=br.readBool())) {
      if (ics.windowSequence[0] == EIGHT_SHORT_SEQUENCE) {
        log.error(String.format("Pulse tool not allowed in eight short sequence"));
        return AAC_ERROR;
      }
      if (decodePulses(pulse,ics.swbOffset,ics.numSwb) != 0) {
        log.error(String.format("Pulse data corrupt or invalid"));
        return AAC_ERROR;
      }
    }
    tns.present=br.readBool();
    if (tns.present && !erSyntax) {
      if (decodeTns(tns,ics) < 0) {
        return AAC_ERROR;
      }
    }
    if (!eldSyntax && br.readBool()) {
      return AAC_ERROR;
    }
    if (tns.present && erSyntax) {
      if (decodeTns(tns,ics) < 0) {
        return AAC_ERROR;
      }
    }
  }
  if (decodeSpectrumAndDequant(out,sce.sf,pulsePresent,pulse,ics,sce.bandType) < 0) {
    return AAC_ERROR;
  }
  if (ac.oc[1].m4ac.objectType == AOT_AAC_MAIN && !commonWindow) {
    applyPrediction(sce);
  }
  return 0;
}

private int decodeIcs ( SingleChannelElement sce , boolean commonWindow , boolean scaleFlag ) { int ret ; Pulse pulse = new Pulse ( ) ; TemporalNoiseShaping tns = sce . tns ; IndividualChannelStream ics = sce . ics ; float out [ ] = sce . coeffs ; boolean eldSyntax = ac . oc [ 1 ] . m4ac . objectType == AOT_ER_AAC_ELD ; boolean erSyntax = ac . oc [ 1 ] . m4ac . objectType == AOT_ER_AAC_LC || ac . oc [ 1 ] . m4ac . objectType == AOT_ER_AAC_LTP || ac . oc [ 1 ] . m4ac . objectType == AOT_ER_AAC_LD || ac . oc [ 1 ] . m4ac . objectType == AOT_ER_AAC_ELD ; int globalGain = br . read ( 8 ) ; if ( ! commonWindow && ! scaleFlag ) { if ( decodeIcsInfo ( ics ) < 0 ) { return AAC_ERROR ; } } ret = decodeBandTypes ( sce . bandType , sce . bandTypeRunEnd , ics ) ; if ( ret < 0 ) { return ret ; } ret = decodeScalefactors ( sce . sf , globalGain , ics , sce . bandType , sce . bandTypeRunEnd ) ; if ( ret < 0 ) { return ret ; } boolean pulsePresent = false ; if ( ! scaleFlag ) { if ( ! eldSyntax && ( pulsePresent = br . readBool ( ) ) ) { if ( ics . windowSequence [ 0 ] == EIGHT_SHORT_SEQUENCE ) { log . error ( String . format ( "Pulse tool not allowed in eight short sequence" ) ) ; return AAC_ERROR ; } if ( decodePulses ( pulse , ics . swbOffset , ics . numSwb ) != 0 ) { log . error ( String . format ( "Pulse data corrupt or invalid" ) ) ; return AAC_ERROR ; } } tns . present = br . readBool ( ) ; if ( tns . present && ! erSyntax ) { if ( decodeTns ( tns , ics ) < 0 ) { return AAC_ERROR ; } } if ( ! eldSyntax && br . readBool ( ) ) { return AAC_ERROR ; } if ( tns . present && erSyntax ) { if ( decodeTns ( tns , ics ) < 0 ) { return AAC_ERROR ; } } } if ( decodeSpectrumAndDequant ( out , sce . sf , pulsePresent , pulse , ics , sce . bandType ) < 0 ) { return AAC_ERROR ; } if ( ac . oc [ 1 ] . m4ac . objectType == AOT_AAC_MAIN && ! commonWindow ) { applyPrediction ( sce ) ; } return 0 ; }
decode an individual_channel_stream payload ; reference : table 4 . 44 .
