Mixed Module

Description

Mixed compression module provides composite compressor using other real compressors to compress RGB and alpha parts of the image.

Those two parts are compressed in parallel whenever possible. Resulting images are placed in a simple graphic container.

Container Format (Version 2)

Fields are stored in LSB order. Types used in following table are described below.

FieldTypeLengthOffsetExampleBinary
Magic stringshort string 4 0 "rgba" 72 67 62 61
Version numberintegral 4 4 2 02 00 00 00
RGB nameshort string 4 8 "jpeg" 6A 70 65 67
Alpha nameshort string 4 12 "png" 70 6E 67 00
Image sizepoint 8 16 [1920, 1080] 80 07 00 00 38 04 00 00
Bound offsetpoint 8 24 [100, 200] 64 00 00 00 C8 00 00 00
Bound sizepoint 8 32 [400, 500] 90 01 00 00 F4 01 00 00
Channelschannels 4 40 8, 8, 8, 1 08 08 08 01
RGB length (LRGB)integral 4 44 55493 C5 D8 00 00
Alpha length (LA)integral 4 48 3755 AB 0E 00 00
RGB datafile LRGB 52 jpeg image
Alpha datafile LA 52 + LRGB png image

Total size of file equals: 52 + LRGB + LA.

In typical situations (when format of RGB and Alpha parts are a common graphic format), fields Bound size and Channels are redundant with the info contained in headers of encapsulated files.

Server may optimize resulting file by detecting that actual content (i.e. place where alpha is non-zero) can be bounded with rectangle smaller than the nominal picture size. If so, Bound offset will contain the left-upper corner of that bounding rectangle, and Bound size it's size. The sum of Bound offset and Bound size is always smaller than or equal Image size in both dimensions. In the simplest situation, Bound offset equals [0, 0] and Bound size equals Image size.

Types Definition

integral
32-bit unsigned integer
point
2 following integrals meaning X and Y coordinates
short string
4 following 8-bit characters (not used chars are null characters, although it is not a null-terminated string as is)
channels
4 following 8-bit unsigned integers
file
contents of the file, as if file was normally written