Used for Remote Desktop streaming purposes to acheive 60 FPS and above by sending the changed regions (delta's) that can be represented in a blocks, the block size can be determined by the user.
- Split the Screen into Upper and Lower by deviding the height by 2.
- Process the Upper and Lower parallel by adding them into a thread pool and wait for them to be finished to sum the results.
- The Upper process, contains two different phases for scanning.
- Scan row by row and add the changed row into the list.
- Scan each row by a specific block size and add the block into the final list that will be returned back to the main caller.
Maximum block size can be up to 200, any more than that it would be redundant.
private Codec.Encoder encoder = new Codec.Encoder();
private Codec.Decoder decoder = new Codec.Decoder();
private void DoStream()
{
PixelFormat BitmapFormat = PixelFormat.Format32bppArgb;
MemoryStream OutStream = new MemoryStream();
while (true)
{
encoder.Encode(OutStream, BitmapExtensions.CaptureScreen(BitmapFormat), BitmapFormat);
StreamBox.Image = decoder.Decode(OutStream);
OutStream.Position = 0;
OutStream.SetLength(0);
}
}