Expand description
Colour filter array decorrelation.
A Bayer mosaic interleaves four colour channels on a 2×2 grid, so horizontally adjacent samples measure different colours. Predictive image coders assume neighbouring samples are correlated, and that assumption is violated on every step — which is why compressing a mosaic as if it were a grayscale image leaves a large amount on the table.
Splitting the mosaic into four half-resolution planes, one per CFA position, restores the assumption: within a plane, every neighbour measures the same colour.
Measured on a Hasselblad X1D 3FR (8384×6304, 16-bit, ISO 400), lossless JXL:
| approach | ratio |
|---|---|
| mosaic as one grayscale | 0.613 |
| four CFA sub-planes | 0.534 |
12.8% smaller, and faster — the planes are quarter-size and encode in parallel. General-purpose compressors cannot do this because they do not know the data is a mosaic.
§Why this operates on bytes
The transform is a pure reordering: samples are moved, never read. So it needs
neither the CFA pattern (RGGB vs BGGR vs …) nor the byte order — which keeps it
exactly reversible for any sensor, and avoids materialising the image as u16.
Structs§
- Planes
- Four half-resolution planes decomposed from a mosaic, as raw sample bytes in the source’s own byte order.
Enums§
Constants§
- PLANE_
COUNT - The four CFA positions, in raster order: (0,0), (1,0), (0,1), (1,1).