Exemple #1
0
 public void Decompress()
 {
     if (frameState == KinectFrameState.Compressed)
     {
         frameState = KinectFrameState.ProcessingDecompression;
         try
         {
             using (MemoryStream decompressedStream = new MemoryStream())
             {
                 using (MemoryStream compressStream = new MemoryStream(compressedData))
                 {
                     using (DeflateStream deflateStream = new DeflateStream(compressStream, CompressionMode.Decompress))
                     {
                         deflateStream.CopyTo(decompressedStream);
                     }
                 }
                 decompressedData = decompressedStream.ToArray();
                 frameState       = KinectFrameState.Decompressed;
                 compressedData   = null;
             }
         }
         catch (Exception exception)
         {
             frameState = KinectFrameState.Error;
             Debug.Log(exception.ToString());
         }
     }
 }
Exemple #2
0
 public void DecompressLZ4()
 {
     //Debug.Log(frameNumber +" | " + frameState);
     if (frameState == KinectFrameState.Compressed)
     {
         frameState = KinectFrameState.ProcessingDecompression;
         try
         {
             Vector3Int matrix = source.matrixSize;
             decompressedData = new byte[matrix.x * matrix.y * matrix.z * 4 * 4];
             LZ4Codec.Decode(compressedData, 0, compressedData.Length, decompressedData, 0, decompressedData.Length);
             frameState = KinectFrameState.Decompressed;
             //Debug.Log(frameNumber + " | " + frameState);
             compressedData = null;
         }
         catch (Exception exception)
         {
             frameState = KinectFrameState.Error;
             Debug.Log(exception.ToString());
         }
     }
 }