public static int Decompress( byte *compressedBuffer, byte *decompressedBuffer, int compressedSize, int maxDecompressedSize) { return(LZ4DecompressorFactory.CreateNew().Decompress(compressedBuffer, decompressedBuffer, compressedSize, maxDecompressedSize)); }
public ScapCapture(bool RecordMic, int NumberofThreads, int FramesPerSecond, ScapVideoFormats VideoFormat, ScapImageFormats ImageFormat, int Xcoord, int Ycoord, int CaptureWidth, int CaptureHeight, string CaptureDirectory, string ImageFilename, string VideoFilename, int Runtime) { IsSoundEnabled = RecordMic; IsMultiThreaded = true; Sw = new Stopwatch(); Compressor = LZ4CompressorFactory.CreateNew(); Decompressor = LZ4DecompressorFactory.CreateNew(); Imgext = ""; Vidext = ""; if (!Directory.Exists(CaptureDirectory)) { Directory.CreateDirectory(CaptureDirectory); Dir = CaptureDirectory + "\\"; } else { Dir = CaptureDirectory + "\\"; } Imgname = ImageFilename; Vidname = VideoFilename; Vidform = VideoFormat; Imgform = ImageFormat; NumThreads = 1; X = Xcoord; Y = Ycoord; W = CaptureWidth; H = CaptureHeight; Rtime = Runtime; Frames = 0; Capture = 0; FPS = FramesPerSecond; FBegin = 0; FEnd = -1; Length = 0; DecompProgress = 0; EncodeProgress = 0; CompressedDataList = new List <Databank>(); MainDataLists = new List <Databank> [NumThreads]; CompressorBools = new bool[NumThreads]; for (int c = 0; c < NumThreads; c++) { MainDataLists[c] = new List <Databank>(); MainDataLists[c].Capacity = 25; CompressorBools[c] = false; } IsInitialized = true; IsDecompressed = false; IsEncoded = false; IsMultiThreaded = false; HasCaptured = false; }
public override ExtendedDataInput Decompress(ExtendedDataInput input, int length, int unitLength, int elementCount, int extra, bool isLittleEndian) { int offset = 8; byte[] output = CreateColumnVector(elementCount, extra, unitLength, isLittleEndian, 0).array(); ILZ4Decompressor t = LZ4DecompressorFactory.CreateNew(); while (length > 0) { int blockSize = input.readInt(); if (blockSize < 0) { blockSize = blockSize & 2147483647; } length -= sizeof(int); blockSize = Math.Min(blockSize, length); if (blockSize == 0) { break; } byte[] src = new byte[blockSize]; int index = 0; while (index < blockSize) { index += ((BinaryReader)input).Read(src, index, blockSize - index); } byte[] ret = t.Decompress(src); if (offset + ret.Length > output.Length) { byte[] tmp = new byte[Math.Max(offset + ret.Length, output.Length) * 2]; Array.Copy(output, tmp, offset); output = tmp; } Buffer.BlockCopy(ret, 0, output, offset, ret.Length); offset += ret.Length; length -= blockSize; } if (isLittleEndian) { return(new LittleEndianDataInputStream(new MemoryStream(output))); } return(new BigEndianDataInputStream(new MemoryStream(output))); }
public ScapCapture(bool RecordMic, int NumberofThreads, int FramesPerSecond, ScapVideoFormats VideoFormat, ScapImageFormats ImageFormat, int Xcoord, int Ycoord, int CaptureWidth, int CaptureHeight) { IsSoundEnabled = RecordMic; IsMultiThreaded = true; Sw = new Stopwatch(); Compressor = LZ4CompressorFactory.CreateNew(); Decompressor = LZ4DecompressorFactory.CreateNew(); Imgext = ".bmp"; Vidext = ".avi"; Dir = Directory.GetCurrentDirectory() + "\\"; Imgname = ""; Vidname = "Vid"; Vidform = VideoFormat; Imgform = ImageFormat; NumThreads = NumberofThreads; X = Xcoord; Y = Ycoord; W = CaptureWidth; H = CaptureHeight; Rtime = -1; Frames = 0; Capture = 0; FPS = FramesPerSecond; FBegin = 0; FEnd = -1; Length = 0; DecompProgress = 0; EncodeProgress = 0; CompressedDataList = new List <Databank>(); MainDataLists = new List <Databank> [NumThreads]; CompressorBools = new bool[NumThreads]; for (int c = 0; c < NumThreads; c++) { MainDataLists[c] = new List <Databank>(); MainDataLists[c].Capacity = 25; CompressorBools[c] = false; } IsInitialized = true; IsDecompressed = false; IsEncoded = false; IsMultiThreaded = false; HasCaptured = false; }
public ScapCapture(bool RecordMic, int NumberofThreads) { IsSoundEnabled = RecordMic; IsMultiThreaded = true; Sw = new Stopwatch(); Compressor = LZ4CompressorFactory.CreateNew(); Decompressor = LZ4DecompressorFactory.CreateNew(); Imgext = ".bmp"; Vidext = ".avi"; Dir = Directory.GetCurrentDirectory() + "\\"; Imgname = ""; Vidname = "Vid"; Vidform = ScapVideoFormats.Default; Imgform = ScapImageFormats.Bmp; NumThreads = NumberofThreads; X = 0; Y = 0; W = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width; H = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height; Rtime = -1; Frames = 0; Capture = 0; FPS = 50; FBegin = 0; FEnd = -1; Length = 0; DecompProgress = 0; EncodeProgress = 0; CompressedDataList = new List <Databank>(); MainDataLists = new List <Databank> [NumThreads]; CompressorBools = new bool[NumThreads]; for (int c = 0; c < NumThreads; c++) { MainDataLists[c] = new List <Databank>(); MainDataLists[c].Capacity = 25; CompressorBools[c] = false; } IsInitialized = true; IsDecompressed = false; IsEncoded = false; IsMultiThreaded = false; HasCaptured = false; }
public LZ4Compressor() { _compressor = LZ4CompressorFactory.CreateNew(); _decompressor = LZ4DecompressorFactory.CreateNew(); }
public static int Decompress(byte[] compressed, byte[] decompressedBuffer) { return(LZ4DecompressorFactory.CreateNew().Decompress(compressed, decompressedBuffer)); }
public static byte[] Decompress(byte[] compressed) { return(LZ4DecompressorFactory.CreateNew().Decompress(compressed)); }
public static int DecompressKnownSize(byte *compressed, byte *decompressedBuffer, int decompressedSize) { return(LZ4DecompressorFactory.CreateNew().DecompressKnownSize(compressed, decompressedBuffer, decompressedSize)); }
public static void DecompressKnownSize(byte[] compressed, byte[] decompressed) { LZ4DecompressorFactory.CreateNew().DecompressKnownSize(compressed, decompressed); }