Export (0) Print
Expand All

4 Protocol Examples

The following example shows a network dump of an image compressed using NSCodec. The image width is 15, and the height is 10.

 COMPRESSED BITMAP DATA (158 bytes):
 00000000 71 00 00 00 07 00 00 00 0b 00 00 00 07 00 00 00 q...............
 00000010 03 01 00 00 63 63 01 64 64 00 63 63 02 64 64 00 ....cc.dd.cc.dd.
 00000020 63 63 00 64 64 01 63 63 01 64 64 01 63 63 01 64 cc.dd.cc.dd.cc.d
 00000030 64 00 63 63 00 64 64 01 63 63 00 64 64 0c 63 63 d.cc.dd.cc.dd.cc
 00000040 00 64 64 0c 63 63 00 64 64 0c 63 63 00 64 64 0c .dd.cc.dd.cc.dd.
 00000050 63 64 64 04 63 64 63 63 00 64 64 03 63 64 64 03 cdd.cdcc.dd.cdd.
 00000060 63 63 00 64 63 63 00 64 64 03 65 63 64 64 01 63 cc.dcc.dd.ecdd.c
 00000070 64 64 00 65 64 64 06 63 64 64 00 63 63 00 64 64 dd.edd.cdd.cc.dd
 00000080 04 64 65 65 65 22 22 22 22 22 22 22 37 37 19 36 .deee"""""""77.6
 00000090 37 37 06 37 37 37 37 ff ff 90 ff ff ff ff       77.7777.......
  
 71 00 00 00 -> LumaPlaneByteCount = 113
 07 00 00 00 -> OrangeChromaPlaneByteCount = 7
 0b 00 00 00 -> GreenChromaPlaneByteCount = 11
 07 00 00 00 -> AlphaPlaneByteCount = 7
 03 -> ColorLossLevel = 3
 01 -> ChromaSubsamplingLevel = 1
 00 00 -> Reserved, ignored
  
 LUMA PLANE DECODING (113 bytes):
  
 00000000 63 63 01 64 64 00 63 63 02 64 64 00 63 63 00 64 cc.dd.cc.dd.cc.d
 00000010 64 01 63 63 01 64 64 01 63 63 01 64 64 00 63 63 d.cc.dd.cc.dd.cc
 00000020 00 64 64 01 63 63 00 64 64 0c 63 63 00 64 64 0c .dd.cc.dd.cc.dd.
 00000030 63 63 00 64 64 0c 63 63 00 64 64 0c 63 64 64 04 cc.dd.cc.dd.cdd.
 00000040 63 64 63 63 00 64 64 03 63 64 64 03 63 63 00 64 cdcc.dd.cdd.cc.d
 00000050 63 63 00 64 64 03 65 63 64 64 01 63 64 64 00 65 cc.dd.ecdd.cdd.e
 00000060 64 64 06 63 64 64 00 63 63 00 64 64 04 64 65 65 dd.cdd.cc.dd.dee
 00000070 65                                              e
  
 LumaPlaneWidth = ROUND_UP_TO_NEAREST_MULTIPLE_OF_8(ImageWidth) = 16
 LumaPlaneHeight = ImageHeight = 10
 Expected LumaPlaneByteCount = LumaPlaneWidth * ImageHeight = 160
 LumaPlaneByteCount < Expected LumaPlaneByteCount which implies that RLE was used.
  
 Run Length decoding of the Luma plane:
 63 63 01 -> Output 0x63 3 times to the luma buffer (NSCODEC_RLE_RUN_SEGMENT)
 64 64 00 -> Output 0x64 2 times to the luma buffer (NSCODEC_RLE_RUN_SEGMENT)
 63 63 02 -> Output 0x63 4 times to the luma buffer (NSCODEC_RLE_RUN_SEGMENT)
 ...
 64 64 00 -> Output 0x64 2 times to the luma buffer (NSCODEC_RLE_RUN_SEGMENT)
 64 65 65 65 -> EndData: Output 0x64 0x65 0x65 0x65 to the luma buffer
  
 ORANGE CHROMA PLANE DECODING (7 bytes):
 00000000 22 22 22 22 22 22 22                            """""""
  
 ChromaPlaneWidth = ROUND_UP_TO_NEAREST_MULTIPLE_OF_8(ImageWidth) / 2 = 8
 ChromaPlaneHeight = ROUND_UP_TO_NEAREST_MULTIPLE_OF_2(ImageHeight) / 2 = 5
 Expected ChromaPlaneByteCount = ChromaPlaneWidth * ChromaPlaneHeight = 40
 OrangeChromaPlaneByteCount < Expected ChromaPlaneByteCount which implies that RLE was used.
  
 Run Length decoding of the Orange Chroma plane:
 22 22 22 -> Output 0x22 36 times to the orange chroma buffer (NSCODEC_RLE_RUN_SEGMENT)
 22 22 22 22 -> EndData: Output 0x22 0x22 0x22 0x22 to the orange chroma buffer
  
 GREEN CHROMA PLANE DECODING (11 bytes):
  
 00000000 37 37 19 36 37 37 06 37 37 37 37                77.677.7777
  
 GreenChromaPlaneByteCount < Expected ChromaPlaneByteCount which implies that RLE was used.
  
 Run Length decoding of the green chroma plane:
 37 37 19 -> Output 0x37 27 times to the green chroma buffer (NSCODEC_RLE_RUN_SEGMENT)
 36 -> Output 0x36 to the green chroma buffer (NSCODEC_RLE_LITERAL_SEGMENT)
 37 37 06 -> Output 0x37 8 times to the green chroma buffer (NSCODEC_RLE_RUN_SEGMENT)
 37 37 37 37 -> EndData: Output 0x37 0x37 0x37 0x37 to the green chroma buffer
  
 ALPHA PLANE DECODING (7 bytes)
 00000000 ff ff 90 ff ff ff ff                            .......
  
 AlphaPlaneWidth = ImageWidth
 AlphaPlaneHeight = ImageHeight
 Expected AlphaPlaneByteCount = ImageWidth * ImageHeight = 150
 AlphaPlaneByteCount < expected AlphaPlaneByteCount which implies that RLE was used.
  
 Run Length decoding of the alpha plane:
 ff ff 90 -> Output 0xff 146 times to the alpha buffer (NSCODEC_RLE_RUN_SEGMENT)
 ff ff ff ff -> EndData: Output 0xff 0xff 0xff 0xff to the alpha buffer
  
 Using chroma recovery ([MS-RDPEGDI] section 3.1.9.1.4), chroma super-sampling ([MS-RDPEGDI] section 3.1.9.1.3), the inverse AYCoCg to ARGB transformation ([MS-RDPEGDI] section 3.1.9.1.2), and color plane combining ([MS-RDPEGDI] section 3.1.9.1.1), obtain the ARGB image from the luma, orange chroma, green chroma, and alpha planes (see Figure 4 for details).
  
 FINAL DECOMPRESSED BITMAP DATA (600 bytes):
  
 00000000 ff 3f 0f ff ff 3f 0f ff ff 3f 0f ff ff 40 10 ff  .?...?...?...@..
 00000010 ff 40 10 ff ff 3f 0f ff ff 3f 0f ff ff 3f 0f ff  .@...?...?...?..
 00000020 ff 3f 0f ff ff 40 10 ff ff 40 10 ff ff 3f 0f ff  .?...@...@...?..
 00000030 ff 3f 0f ff ff 40 10 ff ff 40 10 ff ff 3f 0f ff  .?...@...@...?..
 00000040 ff 3f 0f ff ff 3f 0f ff ff 40 10 ff ff 40 10 ff  .?...?...@...@..
 00000050 ff 40 10 ff ff 3f 0f ff ff 3f 0f ff ff 3f 0f ff  .@...?...?...?..
 00000060 ff 40 10 ff ff 40 10 ff ff 3f 0f ff ff 3f 0f ff  .@...@...?...?..
 00000070 ff 40 10 ff ff 40 10 ff ff 3f 0f ff ff 3f 0f ff  .@...@...?...?..
 00000080 ff 40 10 ff ff 40 10 ff ff 40 10 ff ff 40 10 ff  .@...@...@...@..
 00000090 ff 40 10 ff ff 40 10 ff ff 40 10 ff ff 40 10 ff  .@...@...@...@..
 000000a0 ff 40 10 ff ff 40 10 ff ff 40 10 ff ff 40 10 ff  .@...@...@...@..
 000000b0 ff 40 10 ff ff 3f 0f ff ff 3f 0f ff ff 40 10 ff  .@...?...?...@..
 000000c0 ff 40 10 ff ff 40 10 ff ff 40 10 ff ff 40 10 ff  .@...@...@...@..
 000000d0 ff 40 10 ff ff 40 10 ff ff 40 10 ff ff 40 10 ff  .@...@...@...@..
 000000e0 ff 40 10 ff ff 40 10 ff ff 40 10 ff ff 40 10 ff  .@...@...@...@..
 000000f0 ff 3f 0f ff ff 3f 0f ff ff 40 10 ff ff 40 10 ff  .?...?...@...@..
 00000100 ff 40 10 ff ff 40 10 ff ff 40 10 ff ff 40 10 ff  .@...@...@...@..
 00000110 ff 40 10 ff ff 40 10 ff ff 40 10 ff ff 40 10 ff  .@...@...@...@..
 00000120 ff 40 10 ff ff 40 10 ff ff 40 10 ff ff 3f 0f ff  .@...@...@...?..
 00000130 ff 3f 0f ff ff 40 10 ff ff 40 10 ff ff 40 10 ff  .?...@...@...@..
 00000140 ff 40 10 ff ff 40 10 ff ff 40 10 ff ff 40 10 ff  .@...@...@...@..
 00000150 ff 40 10 ff ff 40 10 ff ff 40 10 ff ff 40 10 ff  .@...@...@...@..
 00000160 ff 40 10 ff ff 40 10 ff ff 3f 0f ff ff 40 10 ff  .@...@...?...@..
 00000170 ff 40 10 ff ff 40 10 ff ff 40 10 ff ff 40 10 ff  .@...@...@...@..
 00000180 ff 3c 14 ff ff 3b 13 ff ff 40 10 ff ff 3f 0f ff  .<...;...@...?..
 00000190 ff 3f 0f ff ff 40 10 ff ff 40 10 ff ff 40 10 ff  .?...@...@...@..
 000001a0 ff 40 10 ff ff 3f 0f ff ff 40 10 ff ff 40 10 ff  .@...?...@...@..
 000001b0 ff 40 10 ff ff 40 10 ff ff 40 10 ff ff 3b 13 ff  .@...@...@...;..
 000001c0 ff 3b 13 ff ff 40 10 ff ff 3f 0f ff ff 3f 0f ff  .;...@...?...?..
 000001d0 ff 40 10 ff ff 40 10 ff ff 40 10 ff ff 40 10 ff  .@...@...@...@..
 000001e0 ff 41 11 ff ff 3f 0f ff ff 40 10 ff ff 40 10 ff  .A...?...@...@..
 000001f0 ff 40 10 ff ff 3f 0f ff ff 40 10 ff ff 40 10 ff  .@...?...@...@..
 00000200 ff 41 11 ff ff 40 10 ff ff 40 10 ff ff 40 10 ff  .A...@...@...@..
 00000210 ff 40 10 ff ff 40 10 ff ff 40 10 ff ff 40 10 ff  .@...@...@...@..
 00000220 ff 3f 0f ff ff 40 10 ff ff 40 10 ff ff 3f 0f ff  .?...@...@...?..
 00000230 ff 3f 0f ff ff 40 10 ff ff 40 10 ff ff 40 10 ff  .?...@...@...@..
 00000240 ff 40 10 ff ff 40 10 ff ff 40 10 ff ff 40 10 ff  .@...@...@...@..
 00000250 ff 41 11 ff ff 41 11 ff                          .A...A..
  
Show:
© 2016 Microsoft