예제 #1
0
        public void Read(FlacStream stream, FrameHeader frameHeader, int order, int bitsPerSample)
        {
            bitsPerSample_ = bitsPerSample;
            lpcOrder_ = order;

            uint [] warmupSamples = Warmup.ReadSamples(stream, order, bitsPerSample_);

            quantitizedLpcPrecisionInBitsMinusOne_ = stream.Reader.ReadBitsAsSByte(QLPC_PRECISION_BITS_COUNT);
            quantitizedLpcShiftInBits_ = stream.Reader.ReadBitsAsSByte(QLPC_PRECISION_SHIFT_COUNT);

            predictorCoefficients_ = new uint[order];
            int i  = 0;
            while (i < predictorCoefficients_.Length)
            {
                predictorCoefficients_[i] = stream.Reader.ReadBits(quantitizedLpcPrecisionInBitsMinusOne_ + 1);
                i++;
            }

            samples_ = new uint[frameHeader.BlockSize];

            i = 0;
            foreach (uint w in warmupSamples)
            {
                samples_[i] = w;
                i++;
            }

            residual_ = new Residual();
            residual_.Read(stream, frameHeader.BlockSize, order, ref samples_);
        }
예제 #2
0
        public void Read(FlacStream stream, FrameHeader frameHeader, int predictorOrder, int bitsPerSample)
        {
            bitsPerSample_ = bitsPerSample;
            predictorOrder_ = predictorOrder;

            uint [] warmupSamples = Warmup.ReadSamples(stream, predictorOrder, bitsPerSample_);

            int sampleCount = frameHeader.BlockSize;
            samples_ = new uint[sampleCount];

            int i = 0;
            foreach (uint w in warmupSamples)
            {
                samples_[i] = w;
                i++;
            }

            residual_ = new Residual();
            residual_.Read(stream, frameHeader.BlockSize, predictorOrder, ref samples_);
        }