4.1.1.3 Example 3
The following example shows a network dump of an image compressed using ClearCodec. The width of the bitmap is 64, and the height is 24. ClearCodec returned 167 bytes after compressing this image.
-
COMPRESSED BITMAP DATA (167 bytes): 00000000 00 df 0e 00 00 00 8b 00 00 00 00 00 00 00 fe fe ................ 00000010 fe ff 80 05 ff ff ff 40 fe fe fe 40 00 00 3f 00 .......@...@..?. 00000020 03 00 0b 00 fe fe fe c5 d0 c6 d0 c7 d0 68 d4 69 .............h.i 00000030 d4 6a d4 6b d4 6c d4 6d d4 1a d4 1a d4 a6 d0 6e .j.k.l.m.......n 00000040 d4 6f d4 70 d4 71 d4 72 d4 73 d4 74 d4 21 d4 22 .o.p.q.r.s.t.!." 00000050 d4 23 d4 24 d4 25 d4 d9 d0 da d0 db d0 c5 d0 c5 .#.$.%.......... 00000060 d0 dc d0 c2 d0 21 d4 22 d4 23 d4 24 d4 25 d4 c9 .....!.".#.$.%.. 00000070 d0 ca d0 5a d4 2b d1 28 d1 2c d1 75 d4 27 d4 28 ...Z.+.(.,.u.'.( 00000080 d4 29 d4 2a d4 1a d4 1a d4 1a d4 b7 d0 b8 d0 b9 .).*............ 00000090 d0 ba d0 bb d0 bc d0 bd d0 be d0 bf d0 c0 d0 c1 ................ 000000a0 d0 c2 d0 c3 d0 c4 d0 ....... Decoding the CLEARCODEC_BITMAP_STREAM header: 00 -> CLEARCODEC_BITMAP_STREAM::flags = 0 df -> CLEARCODEC_BITMAP_STREAM::seqNumber = 223 Decoding the CLEARCODEC_COMPOSITE_PAYLOAD header: 0e 00 00 00 -> CLEARCODEC_COMPOSITE_PAYLOAD::residualByteCount = 14 8b 00 00 00 -> CLEARCODEC_COMPOSITE_PAYLOAD::bandsByteCount = 139 00 00 00 00 -> CLEARCODEC_COMPOSITE_PAYLOAD::subcodecByteCount = 0 RESIDUAL DATA (14 bytes): 00000000 fe fe fe ff 80 05 ff ff ff 40 fe fe fe 40 .........@...@ Decoding the first residual segment: fe -> CLEARCODEC_RGB_RUN_SEGMENT::blueValue = 254 fe -> CLEARCODEC_RGB_RUN_SEGMENT::greenValue = 254 fe -> CLEARCODEC_RGB_RUN_SEGMENT::redValue = 254 ff -> CLEARCODEC_RGB_RUN_SEGMENT::runLengthFactor1 = 255 CLEARCODEC_RGB_RUN_SEGMENT::runLengthFactor2 is present. 80 05 -> CLEARCODEC_RGB_RUN_SEGMENT::runLengthFactor2 = 1408 CLEARCODEC_RGB_RUN_SEGMENT::runLengthFactor3 is not present.
The white pixel (254, 254, 254) is replicated 1408 times (starting in the top-left corner and progressing from left to right and then top to bottom).
-
Decoding the second residual segment: ff -> CLEARCODEC_RGB_RUN_SEGMENT::blueValue = 255 ff -> CLEARCODEC_RGB_RUN_SEGMENT::greenValue = 255 ff -> CLEARCODEC_RGB_RUN_SEGMENT::redValue = 255 40 -> CLEARCODEC_RGB_RUN_SEGMENT::runLengthFactor1 = 64 CLEARCODEC_RGB_RUN_SEGMENT::runLengthFactor2 is not present. CLEARCODEC_RGB_RUN_SEGMENT::runLengthFactor3 is not present.
The fully white pixel (255, 255, 255) is replicated 64 times starting from the next position where the first residual segment ended.
Repeat the above procedure for the last residual segment (0xfe, 0xfe, 0xfe, 0x40). Because there is no more data left in the residual payload (and all pixels were covered), residual decoding is complete. The pixels decoded will be the first layer drawn on the target image buffer.
-
BANDS DATA (139 bytes): 00000000 00 00 3f 00 03 00 0b 00 fe fe fe c5 d0 c6 d0 c7 ..?............. 00000010 d0 68 d4 69 d4 6a d4 6b d4 6c d4 6d d4 1a d4 1a .h.i.j.k.l.m.... 00000020 d4 a6 d0 6e d4 6f d4 70 d4 71 d4 72 d4 73 d4 74 ...n.o.p.q.r.s.t 00000030 d4 21 d4 22 d4 23 d4 24 d4 25 d4 d9 d0 da d0 db .!.".#.$.%...... 00000040 d0 c5 d0 c5 d0 dc d0 c2 d0 21 d4 22 d4 23 d4 24 .........!.".#.$ 00000050 d4 25 d4 c9 d0 ca d0 5a d4 2b d1 28 d1 2c d1 75 .%.....Z.+.(.,.u 00000060 d4 27 d4 28 d4 29 d4 2a d4 1a d4 1a d4 1a d4 b7 .'.(.).*........ 00000070 d0 b8 d0 b9 d0 ba d0 bb d0 bc d0 bd d0 be d0 bf ................ 00000080 d0 c0 d0 c1 d0 c2 d0 c3 d0 c4 d0 ........... Decoding the first CLEARCODEC_BAND header: 00 00 -> CLEARCODEC_BAND::xStart = 0 3f 00 -> CLEARCODEC_BAND::xEnd = 63 03 00 -> CLEARCODEC_BAND::yStart = 3 0b 00 -> CLEARCODEC_BAND::yEnd = 11 fe -> CLEARCODEC_BAND::blueBkg = 254 fe -> CLEARCODEC_BAND::greenBkg = 254 fe -> CLEARCODEC_BAND::redBkg = 254
This implies that 64 V-Bars (xEnd – xStart + 1) follow after the header. Each V-Bar is either present in the V-Bar Storage (section 3.3.1.10) ADM element or the packet.
-
Decoding the first V-Bar: c5 d0 -> CLEARCODEC_VBAR::vBarHeader = 0xd0c5 CLEARCODEC_VBAR::vBarHeader::x = 0x1 CLEARCODEC_VBAR::vBarHeader::vBarIndex = 0x50c5
Because this is a V-Bar hit, the pixels are not present in the packet. The data for this V-Bar is accessed at V-Bar Storage position 0x50c5 and then placed on the screen starting at position (0, 3) and extending up to and including (0, 11). The V-Bar Storage position 0x50c5 has been initialized by a previous packet with 9 pixels.
All remaining 63 V-Bars in this band are cache hits and are processed in the same fashion.
Since there is no more data remaining in the bands payload, it follows that there are no more bands remaining and that bands decoding is complete.
Since there is no more data in the payload, it follows that decoding is complete.