//! Shared rendition size limits. /// The ceiling on the 24 px blur, in bytes of BASE64. /// /// `preview` is a replicated column on `cotton_photos` / `cotton_videos`, so /// every byte of it is carried by the fold and by every first-launch snapshot, /// on every device, for ever. It is worth that because the alternative a /// person sees is a grey square: the blur is in the row, so it arrives with the /// record and a tile always has something to draw. /// /// **1,536 and not the 1,024 the design asked for, because 1,024 is /// unreachable.** A baseline JPEG's four Huffman tables and its quantization /// tables are about 700 bytes before a single pixel is encoded, so the /// SMALLEST 24 px JPEG ImageIO will write — a flat colour at quality 0.1 — /// measures 1,036 bytes of base64, and a pathological one (per-pixel noise at /// the same quality) measures 1,260. A 1,024 cap refuses every photograph this /// repo has; 1,536 clears the worst measured case with room, and an ordinary /// picture lands at 1,040–1,150, so at fifty thousand pictures the real cost /// in the file is about 55 MB rather than the ceiling's 77 MB. **The trigger /// to revisit this is `preview` passing 5% of the file.** /// /// Enforced by the PRODUCER on both sides — the phone's `capture.media` and /// the Mac's tiers worker — and never by a `CHECK` on the column: a `CHECK` /// would turn one fat preview into a rejected op, and the op carries the /// photograph. pub const PREVIEW_MAX_BASE64_BYTES: usize = 1_536; /// The most a 256 px grid thumbnail may weigh — 20 KB, which is ≈600 MB across /// a 50,000-picture library. A thumbnail travels to every phone eagerly, so /// this number is the whole of that promise. pub const THUMB_MAX_BYTES: usize = 20 * 1_024; #[cfg(test)] #[path = "tiers_tests.rs"] mod tests;