# Exact model A 64 × 48 grayscale image supplies 3,072 byte values. Consecutive runs of twelve pixels form 256 independent groups. Each group becomes a sixteen-symbol systematic evaluation Reed–Solomon codeword, for 4,096 stored bytes. The four extra bytes are 33⅓% overhead relative to the picture, or 25% of the stored sheet. The display's tint distinguishes data from parity; it does not change a symbol's byte value. Pale hatched cells mark physical storage erasures; pink is reserved for missing picture pixels. Reconstructing the picture never fills erased storage cells. ## Coding and recovery Arithmetic is in GF(256), with addition/subtraction implemented by XOR and multiplication reduced modulo `x^8 + x^4 + x^3 + x^2 + 1` (`0x11d`). The byte labels 0 through 15 are sixteen distinct field elements. For picture values `d[0] … d[11]`, interpolate the unique polynomial `f` of degree at most eleven with `f(i) = d[i]` for `i = 0 … 11`. Store `f(0) … f(15)`: the original twelve bytes followed by four parity bytes. These are polynomial **values**, not its coefficients. Any twelve surviving evaluations determine the same polynomial, so any four known erasures in a group can be recovered exactly. The browser uses Lagrange interpolation, with precomputed encoding weights and cached decoding weights. With fewer than twelve survivors, it retains known picture bytes and leaves missing ones as `null`. It does not use neighboring pixels, a remembered original or a learned image prior. Indeed, with at most eleven known evaluations, multiplying their linear root factors produces a nonzero degree-at-most-eleven polynomial that vanishes at every survivor. Adding a nonzero multiple changes any erased evaluation while keeping the observations identical. Missing picture bytes then cannot be uniquely inferred without additional assumptions. The original image is retained in the live page to allow changing byte placement. It is not an input to `recover`, which receives only the damaged physical byte array and its placement. The standalone decoder includes that received array (null at erased locations), fixed dimensions/format and placement, plus the codec and rendering code. It omits the original, erased values and editing history. Opening it starts with surviving raw picture values; its repair button performs interpolation. Its PNG is a rendering, with unresolved pixels pink, rather than a source data backup. ## Placement and damage The sheet has 64 × 64 cells, indexed left to right, top to bottom. For group `g = 0 … 255` and symbol `s = 0 … 15`, the physical index is `16g + s` when groups stay together, or `256s + g` when spread apart. Both are permutations of the same encoded bytes. Switching placement keeps the source image, encoded codewords and exact physical erasure mask. It clears the previous repair result so the user can perform the same decoding comparison again. | Preset | Erased physical cells | Together: unresolved / repaired picture bytes | Spread: unresolved / repaired picture bytes | | --- | ---: | ---: | ---: | | Across: rows 24–31 | 512 | 384 / 0 | 0 / 512 | | Wide: rows 20–39 | 1,280 | 960 / 0 | 1,280 / 0 | | Vertical: columns 28–35 | 512 | 0 / 256 | 384 / 0 | The across cut entirely erases 32 consecutive codewords. In spread placement it instead removes symbols 6 and 7 from every group. Widening the cut removes five symbols per spread group, exceeding its allowance. The vertical cut reverses the advantage: this placement is designed for long horizontal bursts, not every possible damage shape. It cannot increase the code's four-erasure limit. The presets replace the mask; Undo scratch restores the previous mask. A drawn stroke erases a three-cell-wide brush and is one undo step; keyboard Space/Enter erases exactly the current cell. Pointer cancellation restores the pre-stroke mask. ## Scope and sources Damage is a **known erasure**, modeled as a missing byte with a known address. A byte that silently changes to another value is outside this decoder's contract; it does not detect, locate or correct such errors. No checksum or authentication layer is implemented. This is an exact educational codec and simplified physical placement, not a full CD/CIRC encoder, optical-media model, compressed-image decoder, production backup product or claim of a new code. The example is generated locally. User pictures are fitted inside 64 × 48 on white, converted with weighted grayscale rounding, and encoded in the browser. They are not uploaded or persisted. Browser decoding support determines accepted image formats. Import failure leaves the current image intact; the latest import or Restore example supersedes a slower earlier import. [Stanford CS144 lecture 13, printed page 2](https://www.scs.stanford.edu/10au-cs144/notes/l13-print.pdf) gives the distinct-evaluation reconstruction idea, GF(256), erasures and interleaving for bursts. [Guruswami and Rudra, section 2](https://www.cs.cmu.edu/~venkatg/cacm09.html) define evaluation Reed–Solomon codes and their distance. [Backblaze's implementation explanation](https://www.backblaze.com/blog/reed-solomon/) describes systematic data-plus-parity encoding and reconstruction from surviving rows. Our choice of 16/12, image, placements, brush and presets is this experiment's design; the cited sources do not evaluate it. ## Reproduce Open `index.html` directly; no build, account or network is needed. Run `python3 -I verify-numerical.py` for the standard-library polynomial-coefficient oracle against a SHA256-bound capture of the shipped JavaScript. Run `python3 -I package.py` to rebuild the ten-file offline ZIP deterministically. The numerical verifier includes every subset of zero through four erasures (2,517 patterns) and eight whole-image placement/preset workflows. Review scripts additionally exercise native Chrome input, image import, downloaded decoders and fresh archive extraction. These are author checks, not independent review, human usability evidence or physical-device testing.