Пример #1
0
        public void WriteFromStream(IInBitStream inBitStream, int bitCount)
        {
            const int ChunkBitSize = AccumulatorSize;
            var       restBitCount = bitCount % ChunkBitSize;
            var       chunkCount   = bitCount / ChunkBitSize;

            for (var i = 0; i < chunkCount; ++i)
            {
                var data = inBitStream.ReadRawBits(ChunkBitSize);
                WriteRawBits(data, ChunkBitSize);
            }

            if (restBitCount > 0)
            {
                var restData = inBitStream.ReadRawBits(restBitCount);
                WriteRawBits(restData, restBitCount);
            }
        }