Expand description
Panasonic / Leica RW2 payload codecs (RawFormat 4–8).
| RawFormat | Bodies | Coding | Parallel unit |
|---|---|---|---|
| 4 | most RW2 bodies up to 2019 | 14 pixels per 16-byte packet, 2-bit shift + 8-bit deltas | packet (row) |
| 5 | GH5S, G9 high-res | 10×12-bit or 9×14-bit LSB-packed per 16 bytes | row |
| 6 | S1/S1R/S1H/S5, GH5 II | 11×14-bit or 14×12-bit, delta coded per 16 bytes | row |
| 7 | S1R/S5 high-res | 9×14-bit LSB-packed per 16 bytes | row |
| 8 | GH6, G9 II, S5 II, S9 … | Huffman-coded 2×2 differences in vertical strips | strip |
Formats 4 and 5 store the stream in 0x4000-byte blocks whose last split bytes
come first on disk (BlockedStream). Format 4 reads every 16-byte packet as a
128-bit little-endian integer from its most significant bit down, and each packet
carries exactly 128 bits for its 14 pixels; that makes every packet independent
even though the format is defined as one sequential stream.
All decoders are bit-exact, including how a short final block is padded with the previous block’s bytes.
Structs§
- Blocked
Stream - A format 4/5 stream: blocks of
BLOCKbytes whose firstsplitbytes (in stream order) are stored after the remainingBLOCK - splitbytes. - V8Decoder
- Format-8 decoder: Huffman-coded differences to a running 2×2 prediction.
- V8Params
- Format-8 parameters (RW2 tags 0x39–0x48).
- V8Strip
- One independently coded vertical strip.
Constants§
Functions§
- decode_
v4 - Decode a format-4 image (
width * heightsamples intoout). Rows are independent whenwidthis a multiple of 14 (always the case in practice); otherwise the stream is decoded sequentially. - decode_
v5 - Format 5: packets run through the blocked stream; every row starts a new packet.
- decode_
v6 - Decode a format-6 image: per row
width / ppbpackets of 16 bytes, each holding 11 (14-bit) or 14 (12-bit) delta-coded pixels. Only whole 16-row bands are decoded. - decode_
v7 - Format 7: rows of
width / ppppackets stored back to back (no block rotation). Only whole 16-row bands are decoded and trailing columns that do not fill a packet stay zero. - decode_
v4_ rows - Decode rows
first_row..first_row + out.len() / widthof a format-4 image whose width is a multiple of 14 (rows are independent). - decode_
v4_ sequential - Bit-exact sequential reader for Panasonic packets (any width).
- decode_
v5_ rows - Decode rows
first_row..first_row + out.len() / widthof a format-5 image. - decode_
v6_ rows - Decode rows
first_row..first_row + out.len() / widthof a format-6 image. - decode_
v7_ rows - Decode rows
first_row..first_row + out.len() / widthof a format-7 image. - packed_
pixels - Pixels per 16-byte packet for formats 5 and 7.
- v4_
packet - Decode one 16-byte format-4 packet into 14 pixels.