Mehran Toosi · Principal Software Engineer · Copenhagen

2026 · Rust codec and CLI · Swift iPhone scanner

CW Luma 10

problem

QR codes carry one bit per module. Colour codes carry more but lose it in capture: phone sensors and video codecs keep colour at a quarter of the luminance resolution, and camera pipelines shift saturated colours. In my tests a JAB Code photographed from a laptop screen had 31–55% of its module colours wrong.

solution

Put the detail where cameras keep it. Each cell carries four luminance levels, one per quarter, and one colour pair for the whole cell: ten bits. The decoder calibrates against pilot symbols in the code and registers each colour channel separately.

results

20 KiB decoded from 5 of 5 phone photos at 912 px wide, where seven QR codes holding the same data decoded 2 of 5 at 1,142 px. A 1.2 MB file moved from a laptop screen to an iPhone at 1.587 Mbit/s.

Architecture

A file is split into chunks with Reed–Solomon repair chunks, and each chunk becomes one frame. The phone finds the corner patterns, maps the grid, aligns each colour channel, calibrates from the pilots, and decodes until the file’s hash checks out.

screen to phone · decoder stages from the codec · layout illustrative

capture

Designed for 4:2:0

Most capture paths keep one colour sample per 2×2 pixels. A code with a colour per module loses colour at exactly that step. CW keeps colour constant across each cell and puts the fine detail in luminance, so the same subsampling leaves it untouched.

the same 4:2:0 subsampling applied to both, computed live · no camera noise added

encoding

Ten bits per cell

Two bits per quarter choose one of four Gray-coded luminance levels, and two bits choose the sign of the cell’s two colour-difference components. Adjacent levels differ by one bit, and every colour stays between 9 and 247 so nothing clips. Type below to encode your own text.

raw symbols before Reed–Solomon and interleaving · heights ∝ luminance

transfer

A file as a loop of frames

The screen plays 20 KiB frames in a loop at 12 fps. Every 20 source chunks get 4 Reed–Solomon repair chunks, so the phone doesn’t have to catch every frame: missed chunks are rebuilt from the repairs, and the transfer ends when the whole file’s SHA-256 matches.

a 1,228,800-byte transfer from a laptop screen to an iPhone · counts from the recorded run, timing compressed