项目作者: malsbi

项目描述 :
For fast and efficient Remote Desktop
高级语言: C#
项目地址: git://github.com/malsbi/MultiThreadedImageProcessing.git
创建时间: 2021-01-12T11:23:38Z
项目社区:https://github.com/malsbi/MultiThreadedImageProcessing

开源协议:

下载


Multi Threaded Image Processing

About

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.

Algorithm

  1. Split the Screen into Upper and Lower by deviding the height by 2.
  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.
  3. 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.
Block Size Pixel Size (bytes) Pixel Format Internet Speed
120 4 RGBA 120 Mbps +
60 4 RGBA 80 Mbps
30 4 RGBA 60 Mbps
120 3 RGB 100 MBps
60 3 RGB 60 Mbps
30 3 RGB 50 Mbps

Maximum block size can be up to 200, any more than that it would be redundant.

Usage

  1. private Codec.Encoder encoder = new Codec.Encoder();
  2. private Codec.Decoder decoder = new Codec.Decoder();
  3. private void DoStream()
  4. {
  5. PixelFormat BitmapFormat = PixelFormat.Format32bppArgb;
  6. MemoryStream OutStream = new MemoryStream();
  7. while (true)
  8. {
  9. encoder.Encode(OutStream, BitmapExtensions.CaptureScreen(BitmapFormat), BitmapFormat);
  10. StreamBox.Image = decoder.Decode(OutStream);
  11. OutStream.Position = 0;
  12. OutStream.SetLength(0);
  13. }
  14. }