Пример #1
0
        //  /* ========= decoding ========== */
        public void decode(BitStream inStream, bool commonWindow, DecoderConfig conf)
        {
            if (conf.isScalefactorResilienceUsed() && rvlc == null)
            {
                rvlc = new RVLC();
            }
            bool er = conf.getProfile().isErrorResilientProfile();

            globalGain = inStream.readBits(8);

            if (!commonWindow)
            {
                info.decode(inStream, conf, commonWindow);
            }

            decodeSectionData(inStream, conf.isSectionDataResilienceUsed());

            //if(conf.isScalefactorResilienceUsed()) rvlc.decode(in, this, scaleFactors);
            /*else*/
            decodeScaleFactors(inStream);

            pulseDataPresent = inStream.readBool();
            if (pulseDataPresent)
            {
                if (info.isEightShortFrame())
                {
                    throw new AACException("pulse data not allowed for short frames");
                }
                Logger.LogInfo("PULSE");
                throw new NotImplementedException();
                //decodePulseData(inStream);
            }

            tnsDataPresent = inStream.readBool();
            if (tnsDataPresent && !er)
            {
                if (tns == null)
                {
                    tns = new TNS();
                }
                tns.decode(inStream, info);
            }

            gainControlPresent = inStream.readBool();
            if (gainControlPresent)
            {
                if (gainControl == null)
                {
                    gainControl = new GainControl(frameLength);
                }
                Logger.LogInfo("GAIN");
                throw new NotImplementedException();
                // gainControl.decode(inStream, info.getWindowSequence());
            }

            //RVLC spectral data
            //if(conf.isScalefactorResilienceUsed()) rvlc.decodeScalefactors(this, in, scaleFactors);

            if (conf.isSpectralDataResilienceUsed())
            {
                int max = (conf.getChannelConfiguration() == ChannelConfiguration.CHANNEL_CONFIG_STEREO) ? 6144 : 12288;
                reorderedSpectralDataLen = Math.Max(inStream.readBits(14), max);
                longestCodewordLen       = Math.Max(inStream.readBits(6), 49);
                //HCR.decodeReorderedSpectralData(this, in, data, conf.isSectionDataResilienceUsed());
            }
            else
            {
                decodeSpectralData(inStream);
            }
        }