Example #1
0
        /// <summary>Creates new instance of <see cref="LZ4ChainDecoder"/>.</summary>
        /// <param name="blockSize">Block size.</param>
        /// <param name="extraBlocks">Number of extra blocks.</param>
        public LZ4ChainDecoder(int blockSize, int extraBlocks)
        {
            blockSize   = Mem.RoundUp(Math.Max(blockSize, Mem.K1), Mem.K1);
            extraBlocks = Math.Max(extraBlocks, 0);

            _blockSize    = blockSize;
            _outputLength = Mem.K64 + (1 + extraBlocks) * _blockSize + 8;
            _outputIndex  = 0;
            _outputBuffer = (byte *)Mem.Alloc(_outputLength + 8);
            _context      = (LZ4Context *)Mem.AllocZero(sizeof(LZ4Context));
        }
Example #2
0
 /// <summary>Creates new instance of <see cref="LZ4HighChainEncoder"/></summary>
 /// <param name="level">Compression level.</param>
 /// <param name="blockSize">Block size.</param>
 /// <param name="extraBlocks">Number of extra blocks.</param>
 public LZ4HighChainEncoder(LZ4Level level, int blockSize, int extraBlocks = 0) :
     base(true, blockSize, extraBlocks)
 {
     if (level < LZ4Level.L03_HC)
     {
         level = LZ4Level.L03_HC;
     }
     if (level > LZ4Level.L12_MAX)
     {
         level = LZ4Level.L12_MAX;
     }
     _context = (LZ4Context *)Mem.AllocZero(sizeof(LZ4Context));
     LZ4_64_HC.LZ4_resetStreamHC(_context, (int)level);
 }
Example #3
0
 /// <summary>Creates new instance of <see cref="LZ4FastChainEncoder"/></summary>
 /// <param name="blockSize">Block size.</param>
 /// <param name="extraBlocks">Number of extra blocks.</param>
 public LZ4FastChainEncoder(int blockSize, int extraBlocks = 0) :
     base(true, blockSize, extraBlocks)
 {
     _context = (LZ4Context *)Mem.AllocZero(sizeof(LZ4Context));
 }