Ejemplo n.º 1
0
        private Bitmap DecompressPFrame(byte[] bs)
        {
            int index = 0;                         // sbytes index

            sbyte[] decoded = RunLengthDecode(bs); // data including paddings

            // read in vectors
            var vectors = new Vector[(int)Math.Ceiling((double)FrameHeight / N) * (int)Math.Ceiling((double)FrameWidth / N)];

            for (int i = 0; i < vectors.Length; ++i)
            {
                vectors[i].x = decoded[index++];
                vectors[i].y = decoded[index++];
            }

            // ycbcr differences
            var data = new sbyte[decoded.Length - index];

            Array.Copy(decoded, index, data, 0, data.Length);

            YCbCrSubSample diffs = SeparateYCbCrFromSbytes(FrameHeight, FrameWidth, data); // pframe diffs

            AddDifferencesToMemoryFrame(diffs, vectors);

            YCbCr[,] yCbCrs = UpSample(frameMemory);
            return(ColorChannel.CreateBitmapFromYCbCr(yCbCrs));
        }
Ejemplo n.º 2
0
 private Bitmap DecompressIFrame(byte[] bs)
 {
     frameMemory     = DecodeCompressedBytes(FrameHeight, FrameWidth, bs);
     YCbCr[,] yCbCrs = UpSample(frameMemory);
     return(ColorChannel.CreateBitmapFromYCbCr(yCbCrs));
 }