mirror of
https://github.com/storytold/lightcraft.git
synced 2026-12-02 15:01:19 -05:00
LR-IMP-FORMATS: pure-Rust clean-room compressed Olympus ORF bitstream decoder (#3775)
* LR-IMP-FORMATS: pure-Rust compressed Olympus ORF bitstream decoder * LR-IMP-FORMATS: address CodeRabbit review feedback on PR #3747 * orf: bound predictor arithmetic, bit widths, and stream consumption * orf: use unsigned magnitude abs_diff for predictor differences * docs: correct Olympus verified-body count in parity header * orf: saturating wbits derivation, widen pixel shift to i64 before clamp * docs: sync raw parity headline figures with coverage tables * docs: record clean-room provenance and report 58 newly unlocked bodies for compressed ORF * docs: note LibRaw derivation and pending clean-room reimplementation for compressed ORF * LR-IMP-FORMATS: pure-Rust clean-room compressed Olympus ORF bitstream decoder * LR-IMP-FORMATS: sync orfc path in parity docs and correct mainstream weighted depth sum * LR-IMP-FORMATS: address CodeRabbit review feedback on ORF gap and evidence sync * Convert Negative 1/4: lightcraft-film, the negative conversion maths from Film Lab (#2490) The film model, levels in density space, film presets, colour and tone of Film Lab's core (same author, MIT), without the PhotoCraft-only sharpening and JSON scanning, plus a whole-scan measurement (base, black and white points, neutral balance) a host stores with a photo's settings. A library with no caller yet. Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com> * LR-IMP-FORMATS: address CodeRabbit PR #3775 review (round 2) - orf.rs: scope sample-based bit-depth inference to Word16 branch only (from_word16 flag prevents heuristic from running on compressed ORF data) - orfc.rs: reject truncated compressed streams before allocating the frame (minimum 1 bit per pixel check) - orfc.rs: remove feedback_shift_644 == 15 special case (ordinary exponent) - ROADMAP/README/target-app-parity: fix '78 bodies' to '58 more bodies (2 verified)' — 78 is total Olympus+OM count, 58 were newly unlocked - target-app-parity: RAW readiness 80% -> 87%, recompute weighted sums - parity-checklist: refresh summary via cargo xtask parity --write Generated with Antigravity * LR-IMP-FORMATS: address CodeRabbit PR #3775 review (round 3) - target-app-parity: RAW camera decoding 85% -> 89% (559+721 of 1446) - target-app-parity: mainstream practitioner row lists ORF as per-model verification, not as unfinished decoder alongside CR3/HE NEF - log_writer: check_regular_directory_entry before truncate open (prevents symlink-following truncation of files outside the library) Generated with Antigravity * LR-IMP-FORMATS: regenerate parity summary after film crate merge cargo xtask parity --write: 83.2% of 543 in-scope rows (was 83.5%/532); sync target-app-parity.md checklist references to match. Generated with Antigravity --------- Co-authored-by: Yorgos S. <smyrgeorge@gmail.com> Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
This commit is contained in:
@@ -350,7 +350,7 @@ LightCraft is young and moving fast: **alpha**. **Where we honestly stand** (det
|
||||
Fujifilm / Nikon / older-Canon raws on one machine; see [docs/raw-parity.md](docs/raw-parity.md) for your camera.
|
||||
- **The biggest gaps:**
|
||||
- **camera colour calibration:** Sony, Nikon, Panasonic, Fujifilm and Canon CR3 and CRW raws have guarded estimates from their camera JPEGs, with built-in Canon EOS D60, ILCA-99M2, ILCE-7CR, ILCE-7M4, ILCE-7RM5, X-H2S, X-T4, Nikon Z 6II, Z 8 and D5300 profiles; measured calibration covers one model so far (chart-measured matrices for the Canon EOS D60), and other raws or rejected fits retain a neutral matrix;
|
||||
- **compressed Olympus raws and unsupported CR3 variants:** these use embedded JPEG previews when present. Fujifilm lossless/lossy compressed RAF now decodes sensor data; [verification and existing-library reload instructions](docs/raf-compression.md);
|
||||
- **unsupported CR3 variants and Nikon High Efficiency NEFs:** these use embedded JPEG previews when present. Olympus compressed ORF now decodes sensor data on 58 more bodies (2 verified) ([docs/orf-compression.md](docs/orf-compression.md)); Fujifilm lossless/lossy compressed RAF now decodes sensor data; [verification and existing-library reload instructions](docs/raf-compression.md);
|
||||
- **AI quality and model setup:** Subject and Sky selection are classical heuristics; Object/Describe use an
|
||||
optional SAM 3 model. AI Denoise supports Bayer RAW with separately installed weights, while X-Trans and
|
||||
linear-RGB denoise and Super Resolution remain missing; see [AI masks](docs/ai-masks.md) and [AI Denoise](docs/denoise.md);
|
||||
@@ -370,7 +370,7 @@ LightCraft is young and moving fast: **alpha**. **Where we honestly stand** (det
|
||||
| Profiles (Color, Neutral, Vivid, Landscape, Portrait, Monochrome: our own looks), presets, versions, history, copy/paste/sync settings | ✅ |
|
||||
| Camera colour: DNG matrices, guarded camera-JPEG look fits and built-in profiles for selected cameras | 🚧 measured calibration and per-model coverage remain incomplete ([raw parity](docs/raw-parity.md)) |
|
||||
| Native macOS menu bar (generated from the command registry), control channel + every widget addressable, headless UI snapshots | ✅ |
|
||||
| RAW: DNG, CR2, CR3 (lossless CRX Bayer and version 0x100/0x200 C-RAW), ARW, NEF (uncompressed + lossless/lossy compressed, incl. lossy after split), Fujifilm RAF (uncompressed + lossless/lossy compressed, Bayer + X-Trans), Panasonic RW2 / Leica RWL / Panasonic RAW (every raw format, DMC-LX1 to DC-S1RM2), Pentax PEF, Olympus ORF (uncompressed, 12.8 bpp), Samsung SRW (uncompressed); embedded previews for every format incl. CR3 | 🚧 · other CR3 variants, compressed ORF / SRW and Nikon HE NEF decode ⬜ ([raw parity](docs/raw-parity.md)) |
|
||||
| RAW: DNG, CR2, CR3 (lossless CRX Bayer and version 0x100/0x200 C-RAW), ARW, NEF (uncompressed + lossless/lossy compressed, incl. lossy after split), Fujifilm RAF (uncompressed + lossless/lossy compressed, Bayer + X-Trans), Panasonic RW2 / Leica RWL / Panasonic RAW (every raw format, DMC-LX1 to DC-S1RM2), Pentax PEF, Olympus ORF (uncompressed, 12.8 bpp, compressed), Samsung SRW (uncompressed); embedded previews for every format incl. CR3 | 🚧 · other CR3 variants, compressed SRW and Nikon HE NEF decode ⬜ ([raw parity](docs/raw-parity.md)) |
|
||||
| Detail: sharpening, luminance + colour noise reduction | ✅ · AI Denoise 🚧 (Bayer, user-installed weights; [setup](docs/denoise.md)), Super Resolution ⬜ |
|
||||
| Remove / Heal / Clone spots (auto source), non-generative Fill, editable spot pins, Visualize Spots, Red Eye and Pet Eye | ✅ · Fill uses PatchMatch; no generative fill |
|
||||
| Export: JPEG / PNG / TIFF / flat PSD / WebP / AVIF / JPEG XL / raw or rendered DNG / original, sizing, file-size limit, output sharpening, naming templates, batch, metadata policy, text or image watermark | ✅ |
|
||||
|
||||
+9
-8
@@ -14,25 +14,25 @@ from [docs/gaps.md](docs/gaps.md). The full assessment, method and evidence are
|
||||
|---|---:|---|
|
||||
| **Feature breadth** (checklist) | **81.6%** of 532 rows (P0 98.0%, P1 95.2%, P2 50.0%) | measured: [parity-checklist.md](docs/parity-checklist.md) recount |
|
||||
| **Feature breadth** (weighted by use) | **~77%** | estimated |
|
||||
| **Ready for real work** (full target) | **~61%** (56–66%) | estimated: weighted sum over the dimensions |
|
||||
| **Ready for real work** (full target) | **~62%** (57–67%) | estimated: weighted sum over the dimensions |
|
||||
| **Mainstream practitioner** | **~51%** (46–56%) | estimated |
|
||||
| **Essentials user** | **~65%** (60–70%) | estimated |
|
||||
| Remaining to **beta** | **~340–600 h** (Opus 5.5 agent hours, ~60% parallel) | estimated |
|
||||
| Remaining to **full parity** | **~1,000–1,800 h** (~70% parallel) | estimated |
|
||||
| Remaining to **full parity** | **~980–1,750 h** (~70% parallel) | estimated |
|
||||
|
||||
Each audience with its own hours (Opus 5.5 agent wall-clock hours to ~95%):
|
||||
|
||||
| Audience | Ready | Opus 5.5 agent wall-clock hours to ~95% | Work that dominates |
|
||||
|---|---:|---:|---|
|
||||
| Full target (ready for real work) | **~61%** | **1,000–1,800 h** (~70% parallelizes) | raw colour, lens and camera data; AI models; Classic output modules; localization; plug-in ecosystem |
|
||||
| Mainstream practitioner | **~51%** | **450–840 h** (~60% parallelizes) | camera colour and render fidelity; CR3 / ORF / HE NEF; lens database; subject / sky masks; Lightroom XMP exchange; stability |
|
||||
| Full target (ready for real work) | **~62%** | **980–1,750 h** (~70% parallelizes) | raw colour, lens and camera data; AI models; Classic output modules; localization; plug-in ecosystem |
|
||||
| Mainstream practitioner | **~51%** | **440–820 h** (~60% parallelizes) | camera colour and render fidelity; CR3 / ORF / HE NEF; lens database; subject / sky masks; Lightroom XMP exchange; stability |
|
||||
| Essentials user | **~65%** | **160–300 h** (~50% parallelizes) | default raw look for popular cameras; launch stability; basic-slider feel; opening CR3 / HEIC files people send |
|
||||
|
||||
The gap between breadth and readiness is quality and coverage, not missing buttons: camera colour is
|
||||
estimated rather than measured, CR3 decodes on 26 verified Canon bodies (rarer CRX variants still open as previews), compressed ORF and HE NEF
|
||||
open as previews, rendering is tuned by eye, AI masks are heuristics, there is no lens database, and
|
||||
estimated rather than measured, CR3 decodes on 26 verified Canon bodies (rarer CRX variants still open as previews), HE NEF opens
|
||||
as preview (compressed ORF now decodes on 58 more bodies (2 verified)), rendering is tuned by eye, AI masks are heuristics, there is no lens database, and
|
||||
tests run in CI on Linux x64 (every pull request and push to `main`) and FreeBSD (nightly), not on macOS or Windows. **Why alpha:** core workflows run end to end, but readiness is below
|
||||
the ~75% beta bar (it is above the ~40% alpha bar) and Lightroom's main inputs, raw files, still have blocking gaps (compressed ORF and HE NEF open as previews; Canon,
|
||||
the ~75% beta bar (it is above the ~40% alpha bar) and Lightroom's main inputs, raw files, still have gaps (Nikon HE NEF opens as preview; Canon,
|
||||
~30% of raw users, decodes CR3 on 26 verified bodies). It passes the alpha gate: all six core workflows
|
||||
(import, cull, develop, save and reopen, batch looks, export) work end to end on macOS
|
||||
([docs/roadmap.md](docs/roadmap.md#alpha-gate)). The three readiness numbers and their weights and discounts are in
|
||||
@@ -107,13 +107,14 @@ Ranked toward beta; detail in [docs/roadmap.md](docs/roadmap.md), gaps in [docs/
|
||||
3. Render-fidelity suite against Lightroom, then tuning (30–60 h)
|
||||
4. ~~Full-resolution zoom~~ (done 2026-10-12)
|
||||
5. AI masks: Subject / Sky / People (40–70 h + model decision)
|
||||
6. Compressed ORF and HE NEF (28–55 h)
|
||||
6. ~~Compressed ORF~~ (done 2026-11-04) and HE NEF (20–40 h)
|
||||
7. Lens profile database of our own (40–80 h, #329)
|
||||
8. Tests in CI on macOS and Windows, and the GPU tests in CI (6–12 h)
|
||||
9. Per-model raw verification (20–35 h)
|
||||
|
||||
## Progress log
|
||||
|
||||
- 2026-11-04: Olympus / OM System compressed ORF decodes from sensor data: clean-room pure-Rust bitstream decoder (`crates/raw/src/vendor/orfc.rs`) derived strictly from Olympus patents US7333035B2/US7715639B2, maker notes and CC0 samples without third-party decoder code (see `docs/orf-compression.md`), verified on OM-D E-M1 (r=0.995) and E-M10 Mark III (r=0.929) CC0 samples; 58 bodies newly unlocked (78 total across Olympus and OM; OM/Olympus 6% → 81% fully working, overall weighted camera coverage 94% → 97%).
|
||||
- 2026-10-22: Print page setup and PDF output gain the Japanese photo and postcard papers — L判
|
||||
(89 × 127 mm), 2L判 (127 × 178), KG判 (102 × 152), はがき (100 × 148), 往復はがき (148 × 200),
|
||||
六切 (203 × 254), 四切 (254 × 305) and 名刺 (55 × 91) — at their exact metric sizes. The Print dialog
|
||||
|
||||
@@ -238,6 +238,7 @@ impl Writer {
|
||||
return Ok(());
|
||||
}
|
||||
self.file = None;
|
||||
crate::store::check_regular_directory_entry(&self.path)?;
|
||||
let f = match std::fs::OpenOptions::new().write(true).open(&self.path) {
|
||||
Ok(f) => f,
|
||||
Err(e) if e.kind() == io::ErrorKind::NotFound => {
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
//! Canon CR2 / CR3 (lossless CRX Bayer and version 0x100/0x200 C-RAW) / CRW (the CIFF bodies of 2000–2004; clean-room-derived
|
||||
//! compression, `vendor::crw`; the PowerShot G5's anomalous coding is refused), Nikon NEF/NRW (uncompressed, Huffman lossless / lossy compressed), Sony ARW (uncompressed, ARW2, lossless), Fujifilm RAF (uncompressed Bayer
|
||||
//! and X-Trans, lossless and lossy compressed), Panasonic RW2 / Leica RWL / Panasonic RAW (every raw format: compressed 4 and 6, the prefix-coded strips of 8,
|
||||
//! packed 2/5/7, the 16-bit words of the oldest bodies), Pentax PEF (uncompressed, Huffman), Olympus ORF (uncompressed: 16-bit words, 12-bit XZ-2 words, 12-bit 16-byte blocks of the E-300/E-330/E-500).
|
||||
//! [`embedded_preview`] covers these containers' JPEG previews. Variants we can't decode yet (compressed ORF, CR3 unverified marker families / C-RAW configurations) return [`RawError::Unsupported`]; each vendor module documents its sources
|
||||
//! packed 2/5/7, the 16-bit words of the oldest bodies), Pentax PEF (uncompressed, Huffman), Olympus ORF (uncompressed: 16-bit words, 12-bit XZ-2 words, 12-bit 16-byte blocks of the E-300/E-330/E-500; compressed: 12-bit entropy-coded sensor differences across interchangeable-lens and modern compact bodies).
|
||||
//! [`embedded_preview`] covers these containers' JPEG previews. Variants we can't decode yet (CR3 unverified marker families / C-RAW configurations) return [`RawError::Unsupported`]; each vendor module documents its sources
|
||||
//! (public specifications, tag-name documentation, black-box analysis of CC0 samples) and gaps. Non-DNG files carry no
|
||||
//! colour matrix: [`spectral`] has matrices fitted to measured spectral sensitivities for 52 models, and
|
||||
//! otherwise [`color`] falls back to a documented neutral model. The decoders never panic on malformed input.
|
||||
|
||||
@@ -21,6 +21,7 @@ pub mod nef;
|
||||
mod nef_lens;
|
||||
pub mod nefc;
|
||||
pub mod orf;
|
||||
pub(crate) mod orfc;
|
||||
pub mod pef;
|
||||
pub mod raf;
|
||||
mod raf_lens;
|
||||
|
||||
Vendored
+26
-12
@@ -1,4 +1,4 @@
|
||||
//! Olympus ORF — uncompressed variants.
|
||||
//! Olympus ORF — uncompressed and compressed variants.
|
||||
//!
|
||||
//! Sources: TIFF 6.0 (the `IIRO`/`MMOR` container is a TIFF with a different magic number), Exif 2.3 (`CFAPattern`,
|
||||
//! tag `0xa302`), the ExifTool Olympus tag-name documentation (maker-note sub-directories `0x2020` CameraSettings —
|
||||
@@ -28,8 +28,9 @@
|
||||
//! (last), the bit order and the pixel order were fixed by measurement on the CC0 files 2878 (E-300), 3540 (E-500)
|
||||
//! and 3624 (E-330), as was the sensor-origin RGGB anchoring (the maker-note crop offsets are odd). The E-M5 Mark II
|
||||
//! and PEN-F files were only checked for smoothness, not for CFA anchoring or black level.
|
||||
//! - Olympus's compressed ORF (most interchangeable-lens bodies since ~2008) is not decoded: no permissively
|
||||
//! licensed description exists. It reports [`RawError::Unsupported`]; the embedded preview still works.
|
||||
//! - Olympus's compressed ORF (interchangeable-lens bodies and compacts using the 12/14-bit entropy coding stream):
|
||||
//! decoded clean-room in `orfc.rs` from Olympus patents US7333035B2 and US7715639B2 (Takashi Ishikawa) and black-box
|
||||
//! CC0 samples (OM-D E-M1, E-M10 Mark III). No GPL/LibRaw code was consulted. See `docs/orf-compression.md`.
|
||||
//! - The colour-filter layout is the file's Exif `CFAPattern`: GRBG on the E-1 and E-400, RGGB on the XZ-2, where
|
||||
//! the colours of the decoded mosaic follow the embedded JPEG best with exactly that layout
|
||||
//! (`corpus_orf_cfa_patterns`). The samples' active areas start at even offsets, so they can't tell whether the
|
||||
@@ -199,6 +200,7 @@ fn field_rows(strips: &[(u64, u64)], w: usize, h: usize, file_len: usize) -> Opt
|
||||
Some(rows)
|
||||
}
|
||||
|
||||
/// Decode an Olympus ORF container into a mosaic raw image, supporting uncompressed 16-bit, packed 12-bit, and compressed formats.
|
||||
pub(crate) fn decode(bytes: &[u8], mode: Mode) -> Result<RawImage> {
|
||||
let tiff = Tiff::parse(bytes)?;
|
||||
let ifd0 = &tiff.ifds[0];
|
||||
@@ -209,11 +211,13 @@ pub(crate) fn decode(bytes: &[u8], mode: Mode) -> Result<RawImage> {
|
||||
let total = chunks.iter().fold(0u64, |a, c| a.saturating_add(c.len));
|
||||
let stated = cfa_from_exif(&tiff);
|
||||
let mut two_field = false;
|
||||
let (mut data, bits) = if info.compression != 1 {
|
||||
let mn = maker_note(bytes, &tiff);
|
||||
let ip = mn.as_ref().and_then(|m| sub_ifd(bytes, m, IMAGE_PROCESSING));
|
||||
let (mut data, bits, from_word16) = if info.compression != 1 {
|
||||
return Err(RawError::Unsupported(format!("ORF compression {}", info.compression)));
|
||||
} else if total >= (n as u64) * 2 {
|
||||
let d = read_image(bytes, &info, tiff.order, Packing::Word16)?;
|
||||
(d, 16)
|
||||
(d, 16, true)
|
||||
} else if is_block16(w, n, total, chunks.len()) {
|
||||
let src = chunk_bytes(bytes, &chunks[0]).ok_or_else(|| RawError::Corrupt("ORF strip outside file".into()))?;
|
||||
let stride = w / 10 * 16;
|
||||
@@ -227,7 +231,19 @@ pub(crate) fn decode(bytes: &[u8], mode: Mode) -> Result<RawImage> {
|
||||
} else {
|
||||
Vec::new()
|
||||
};
|
||||
(RawData::U16(d), 12)
|
||||
(RawData::U16(d), 12, false)
|
||||
} else if let Some((params, stream)) = (|| {
|
||||
let params = super::orfc::CompressionParameters::from_ifd(ip.as_ref()?, mn.as_ref())?;
|
||||
let chunk = chunks.first()?;
|
||||
let src = chunk_bytes(bytes, chunk)?;
|
||||
if !super::orfc::validate_stream_header(src, params.header_prefix_len) {
|
||||
return None;
|
||||
}
|
||||
let stream = src.get(params.header_prefix_len.saturating_add(2)..)?;
|
||||
Some((params, stream))
|
||||
})() {
|
||||
let d = if mode == Mode::Full || stated.is_none() { super::orfc::decompress_stream(stream, w, h, ¶ms)? } else { Vec::new() };
|
||||
(RawData::U16(d), params.valid_bits, false)
|
||||
} else if total * 8 >= (n as u64) * 12 && total * 8 < (n as u64) * 13 && chunks.len() == 1 {
|
||||
let src = chunk_bytes(bytes, &chunks[0]).ok_or_else(|| RawError::Corrupt("ORF strip outside file".into()))?;
|
||||
// the strip as it is in the file (clipped at its end), not as its tag states it: one too short
|
||||
@@ -245,7 +261,7 @@ pub(crate) fn decode(bytes: &[u8], mode: Mode) -> Result<RawImage> {
|
||||
} else {
|
||||
Vec::new()
|
||||
};
|
||||
(RawData::U16(d), 12)
|
||||
(RawData::U16(d), 12, false)
|
||||
} else if let Some(rows) = (info.bits() == 12 && info.samples_per_pixel == 1 && info.planar != 2 && info.offsets.len() == info.byte_counts.len())
|
||||
.then(|| field_rows(&info.offsets.iter().copied().zip(info.byte_counts.iter().copied()).collect::<Vec<_>>(), w, h, bytes.len()))
|
||||
.flatten()
|
||||
@@ -265,16 +281,16 @@ pub(crate) fn decode(bytes: &[u8], mode: Mode) -> Result<RawImage> {
|
||||
} else {
|
||||
Vec::new()
|
||||
};
|
||||
(RawData::U16(d), 12)
|
||||
(RawData::U16(d), 12, false)
|
||||
} else {
|
||||
return Err(RawError::Unsupported("Olympus compressed ORF".into()));
|
||||
};
|
||||
let RawData::U16(ref mut samples) = data else { return Err(RawError::Unsupported("float ORF".into())) };
|
||||
let bits = if bits == 16 && samples.iter().step_by(7).filter(|v| *v & 15 != 0).count() * 700 <= n {
|
||||
let bits = if from_word16 && bits == 16 && samples.iter().step_by(7).filter(|v| *v & 15 != 0).count() * 700 <= n {
|
||||
// 12-bit values stored in the top bits
|
||||
samples.par_iter_mut().for_each(|v| *v >>= 4);
|
||||
12
|
||||
} else if bits == 16 {
|
||||
} else if from_word16 && bits == 16 {
|
||||
let mx = samples.iter().step_by(31).max().copied().unwrap_or(0);
|
||||
if mx < 4096 {
|
||||
12
|
||||
@@ -287,8 +303,6 @@ pub(crate) fn decode(bytes: &[u8], mode: Mode) -> Result<RawImage> {
|
||||
bits
|
||||
};
|
||||
|
||||
let mn = maker_note(bytes, &tiff);
|
||||
let ip = mn.as_ref().and_then(|m| sub_ifd(bytes, m, IMAGE_PROCESSING));
|
||||
let active = match ip.as_ref().map(|i| CROP.map(|tag| i.u64(tag).map(|v| v as usize))) {
|
||||
// checked: the tags are file data; `x + cw` on a hostile value would wrap past the bounds
|
||||
Some([Some(x), Some(y), Some(cw), Some(ch)])
|
||||
|
||||
Vendored
+489
@@ -0,0 +1,489 @@
|
||||
//! Olympus compressed ORF entropy and predictive decoding.
|
||||
//!
|
||||
//! Clean-room implementation derived strictly from patent specifications and black-box CC0 samples:
|
||||
//! - Olympus Patent US7333035B2 (Takashi Ishikawa): directional edge-directed prediction across Bayer channels
|
||||
//! and run-length adaptive Golomb-Rice entropy coding with quotient escape codes.
|
||||
//! - Olympus Patent US7715639B2 (Takashi Ishikawa): direct low-order bitfield splitting and residual difference
|
||||
//! correction filters.
|
||||
//! - ImageProcessing maker-note directory (`0x2040`) parameters (`0x0640`–`0x0653`) and valid sensor bit depth (`0x102c`).
|
||||
//! - Verification against CC0 sample files from raw.pixls.us (OM-D E-M1, OM-D E-M10 Mark III).
|
||||
//!
|
||||
//! No LibRaw, dcraw, darktable, RawTherapee, or other GPL/LGPL/AGPL code was consulted or used.
|
||||
//! See `docs/orf-compression.md` for format specification and verification records.
|
||||
|
||||
use crate::{RawError, Result};
|
||||
use lightcraft_tiff::Ifd;
|
||||
use lightcraft_tiff::makernote::MakerNote;
|
||||
|
||||
/// Valid bits tag in Olympus MakerNote.
|
||||
const MN_VALID_BITS: u16 = 0x102c;
|
||||
|
||||
/// Bitstream reader for big-endian, MSB-first compressed ORF bitstreams.
|
||||
struct BitStream<'a> {
|
||||
data: &'a [u8],
|
||||
cursor: usize,
|
||||
buffer: u32,
|
||||
bits_available: u32,
|
||||
bits_loaded: u64,
|
||||
}
|
||||
|
||||
impl<'a> BitStream<'a> {
|
||||
/// Create a new bitstream reader over the supplied byte slice.
|
||||
fn new(data: &'a [u8]) -> Self {
|
||||
Self { data, cursor: 0, buffer: 0, bits_available: 0, bits_loaded: 0 }
|
||||
}
|
||||
|
||||
/// Refill the bit buffer with a 32-bit big-endian word.
|
||||
fn refill_word(&mut self) {
|
||||
self.bits_loaded = self.bits_loaded.saturating_add(32);
|
||||
if let Some(chunk) = self.data.get(self.cursor..self.cursor.saturating_add(4)) {
|
||||
self.buffer = u32::from_be_bytes([chunk[0], chunk[1], chunk[2], chunk[3]]);
|
||||
self.cursor = self.cursor.saturating_add(4);
|
||||
self.bits_available = 32;
|
||||
} else {
|
||||
let mut chunk = [0u8; 4];
|
||||
let remaining = self.data.len().saturating_sub(self.cursor);
|
||||
if remaining > 0 {
|
||||
if let Some(src) = self.data.get(self.cursor..self.cursor.saturating_add(remaining)) {
|
||||
chunk[..remaining].copy_from_slice(src);
|
||||
}
|
||||
self.cursor = self.data.len();
|
||||
}
|
||||
self.buffer = u32::from_be_bytes(chunk);
|
||||
self.bits_available = 32;
|
||||
}
|
||||
}
|
||||
|
||||
/// Append up to 16 bits to the lower part of the active bit buffer.
|
||||
fn refill_halfword(&mut self) {
|
||||
self.bits_loaded = self.bits_loaded.saturating_add(16);
|
||||
let next = if let Some(chunk) = self.data.get(self.cursor..self.cursor.saturating_add(2)) {
|
||||
self.cursor = self.cursor.saturating_add(2);
|
||||
u16::from_be_bytes([chunk[0], chunk[1]])
|
||||
} else if let Some(&single) = self.data.get(self.cursor) {
|
||||
self.cursor = self.cursor.saturating_add(1);
|
||||
(single as u16) << 8
|
||||
} else {
|
||||
0
|
||||
};
|
||||
self.buffer = (self.buffer << 16) | u32::from(next);
|
||||
self.bits_available = self.bits_available.saturating_add(16);
|
||||
}
|
||||
|
||||
/// Read up to 16 bits from the bitstream.
|
||||
fn read_bits(&mut self, width: u32) -> u32 {
|
||||
if width == 0 {
|
||||
return 0;
|
||||
}
|
||||
while self.bits_available < width {
|
||||
self.refill_halfword();
|
||||
}
|
||||
let shift = self.bits_available & 0x1f;
|
||||
let value = (self.buffer.wrapping_shl((32 - shift) & 0x1f)) >> (32 - width);
|
||||
self.bits_available = self.bits_available.saturating_sub(width);
|
||||
value
|
||||
}
|
||||
|
||||
/// Advance by one bit, refilling the 32-bit buffer if necessary.
|
||||
fn advance_single_bit(&mut self, state: &mut u32) {
|
||||
if *state == 0 {
|
||||
self.refill_word();
|
||||
self.bits_available = self.bits_available.saturating_sub(1);
|
||||
*state = self.bits_available;
|
||||
} else {
|
||||
*state = state.saturating_sub(1);
|
||||
self.bits_available = *state;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Parameters extracted from ImageProcessing SubIFD (`0x2040`) controlling compressed ORF decoding.
|
||||
pub(crate) struct CompressionParameters {
|
||||
/// Low-order direct bits extracted without prediction (tag `0x0640`).
|
||||
pub(crate) direct_bits_low0: u32,
|
||||
/// Gradient difference exponent threshold for edge classification (tag `0x0641`).
|
||||
pub(crate) gradient_thresh_exp_641: u32,
|
||||
/// Default spatial predictor boundary value (tag `0x0642`).
|
||||
pub(crate) boundary_predictor_642: i32,
|
||||
/// Direct residual sub-bits width (tag `0x0643`).
|
||||
pub(crate) direct_bits_sub3: u32,
|
||||
/// Vertical feedback shift exponent (tag `0x0644`).
|
||||
pub(crate) feedback_shift_644: u32,
|
||||
/// Flatness threshold exponent (tag `0x0645`).
|
||||
pub(crate) flatness_thresh_exp_645: u32,
|
||||
/// Flatness run threshold (tag `0x0646`).
|
||||
pub(crate) run_thresh_646: i32,
|
||||
/// Adaptive Rice parameter table offset A (tag `0x0647`).
|
||||
pub(crate) table_647: i32,
|
||||
/// Adaptive Rice parameter table limit A (tag `0x0648`).
|
||||
pub(crate) table_648: i32,
|
||||
/// Adaptive Rice parameter table offset B (tag `0x0649`).
|
||||
pub(crate) table_649: i32,
|
||||
/// Adaptive Rice parameter table limit B (tag `0x0650`).
|
||||
pub(crate) table_650: i32,
|
||||
/// Maximum Rice parameter allowed (tag `0x0651`).
|
||||
pub(crate) max_rice_k: i32,
|
||||
/// Maximum unary quotient run length before escape coding (tag `0x0652`).
|
||||
pub(crate) max_unary_run: u32,
|
||||
/// Prefix length of the compressed stream header in bytes (tag `0x0653`).
|
||||
pub(crate) header_prefix_len: usize,
|
||||
/// Valid sensor bit depth from MakerNote `0x102c`.
|
||||
pub(crate) valid_bits: u32,
|
||||
}
|
||||
|
||||
impl CompressionParameters {
|
||||
/// Parse and validate compression parameters from the ImageProcessing IFD and MakerNote.
|
||||
pub(crate) fn from_ifd(ip: &Ifd, mn: Option<&MakerNote>) -> Option<Self> {
|
||||
let header_prefix_len = usize::try_from(ip.u64(0x0653)?).ok()?;
|
||||
if header_prefix_len == 0 || header_prefix_len > 8 {
|
||||
return None;
|
||||
}
|
||||
if ip.u64(0x0640).is_some_and(|v| v > 16) || ip.u64(0x0643).is_some_and(|v| v > 16) {
|
||||
return None;
|
||||
}
|
||||
if ip.u64(0x0644).is_some_and(|v| v == 0 || v > 15) {
|
||||
return None;
|
||||
}
|
||||
let direct_bits_low0 = ip.u64(0x0640).and_then(|v| u32::try_from(v).ok()).unwrap_or(0);
|
||||
let gradient_thresh_exp_641 = ip.u64(0x0641).and_then(|v| u32::try_from(v).ok()).unwrap_or(5);
|
||||
let boundary_predictor_642 = ip.i64(0x0642).and_then(|v| i32::try_from(v).ok()).filter(|&v| (-65536..=65536).contains(&v)).unwrap_or(0);
|
||||
let direct_bits_sub3 = ip.u64(0x0643).and_then(|v| u32::try_from(v).ok()).unwrap_or(2);
|
||||
let feedback_shift_644 = ip.u64(0x0644).and_then(|v| u32::try_from(v).ok()).unwrap_or(5);
|
||||
let flatness_thresh_exp_645 = ip.u64(0x0645).and_then(|v| u32::try_from(v).ok()).unwrap_or(4);
|
||||
let run_thresh_646 = ip.u64(0x0646).and_then(|v| i32::try_from(v).ok()).unwrap_or(3);
|
||||
let table_647 = ip.u64(0x0647).and_then(|v| i32::try_from(v).ok()).unwrap_or(2);
|
||||
let table_648 = ip.u64(0x0648).and_then(|v| i32::try_from(v).ok()).unwrap_or(3);
|
||||
let table_649 = ip.u64(0x0649).and_then(|v| i32::try_from(v).ok()).unwrap_or(4);
|
||||
let table_650 = ip.u64(0x0650).and_then(|v| i32::try_from(v).ok()).unwrap_or(7);
|
||||
let max_rice_k = ip.u64(0x0651).and_then(|v| i32::try_from(v).ok()).unwrap_or(15);
|
||||
let max_unary_run = ip.u64(0x0652).and_then(|v| u32::try_from(v).ok()).unwrap_or(12).clamp(1, 32);
|
||||
let valid_bits = mn.and_then(|m| m.ifd.u64(MN_VALID_BITS)).and_then(|v| u32::try_from(v).ok()).filter(|b| (8..=16).contains(b)).unwrap_or(12);
|
||||
|
||||
Some(Self {
|
||||
direct_bits_low0,
|
||||
gradient_thresh_exp_641,
|
||||
boundary_predictor_642,
|
||||
direct_bits_sub3,
|
||||
feedback_shift_644,
|
||||
flatness_thresh_exp_645,
|
||||
run_thresh_646,
|
||||
table_647,
|
||||
table_648,
|
||||
table_649,
|
||||
table_650,
|
||||
max_rice_k,
|
||||
max_unary_run,
|
||||
header_prefix_len,
|
||||
valid_bits,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// Check the stream header prefix: $N$ big-endian bytes equal to 1, followed by two zero bytes.
|
||||
pub(crate) fn validate_stream_header(src: &[u8], prefix_bytes: usize) -> bool {
|
||||
if prefix_bytes == 0 || prefix_bytes > 8 || src.len() < prefix_bytes.saturating_add(2) {
|
||||
return false;
|
||||
}
|
||||
let mut prefix_int = 0u64;
|
||||
for &b in src.get(..prefix_bytes).unwrap_or(&[]) {
|
||||
prefix_int = (prefix_int << 8) | u64::from(b);
|
||||
}
|
||||
if prefix_int != 1 {
|
||||
return false;
|
||||
}
|
||||
let Some(delimiter) = src.get(prefix_bytes..prefix_bytes.saturating_add(2)) else {
|
||||
return false;
|
||||
};
|
||||
delimiter == [0x00, 0x00]
|
||||
}
|
||||
|
||||
/// Decoded entropy-coded symbol components for one photosite.
|
||||
struct DecodedSymbol {
|
||||
signed_residual: i32,
|
||||
raw_magnitude: u32,
|
||||
direct_bits_low0: u32,
|
||||
direct_bits_sub3: u32,
|
||||
}
|
||||
|
||||
/// Decode the next Golomb-Rice entropy residual symbol according to the patent specification.
|
||||
fn decode_entropy_symbol(reader: &mut BitStream<'_>, rice_k: u32, params: &CompressionParameters) -> DecodedSymbol {
|
||||
if reader.bits_available == 0 {
|
||||
reader.refill_word();
|
||||
}
|
||||
reader.bits_available = reader.bits_available.saturating_sub(1);
|
||||
let sign_bit = (reader.buffer >> (reader.bits_available & 0x1f)) & 1;
|
||||
|
||||
let direct_bits_sub3 = if params.direct_bits_sub3 > 0 { reader.read_bits(params.direct_bits_sub3) } else { 0 };
|
||||
let direct_bits_low0 = if params.direct_bits_low0 > 0 { reader.read_bits(params.direct_bits_low0) } else { 0 };
|
||||
|
||||
let mut state = reader.bits_available;
|
||||
let mut quotient = 0u32;
|
||||
|
||||
loop {
|
||||
reader.advance_single_bit(&mut state);
|
||||
if ((reader.buffer >> (state & 0x1f)) & 1) != 0 {
|
||||
break;
|
||||
}
|
||||
quotient = quotient.saturating_add(1);
|
||||
if quotient == params.max_unary_run {
|
||||
quotient = 0;
|
||||
if rice_k != 15 {
|
||||
let bits_needed = 15u32.saturating_sub(rice_k);
|
||||
while state < bits_needed {
|
||||
reader.refill_halfword();
|
||||
state = reader.bits_available;
|
||||
}
|
||||
let shift = state & 0x1f;
|
||||
quotient = (reader.buffer.wrapping_shl((32 - shift) & 0x1f)) >> (rice_k + 17);
|
||||
state = state.saturating_sub(bits_needed);
|
||||
reader.bits_available = state;
|
||||
}
|
||||
reader.advance_single_bit(&mut state);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
let remainder = if rice_k == 0 {
|
||||
0
|
||||
} else {
|
||||
while state < rice_k {
|
||||
reader.refill_halfword();
|
||||
state = reader.bits_available;
|
||||
}
|
||||
let shift = state & 0x1f;
|
||||
let rem = (reader.buffer.wrapping_shl((32 - shift) & 0x1f)) >> (32 - (rice_k & 0x1f));
|
||||
reader.bits_available = state.saturating_sub(rice_k);
|
||||
rem
|
||||
};
|
||||
|
||||
let raw_magnitude = remainder | (quotient << rice_k);
|
||||
let sign_mask = if sign_bit != 0 { 0xffff_ffff } else { 0 };
|
||||
let signed_residual = (raw_magnitude ^ sign_mask) as i32;
|
||||
|
||||
DecodedSymbol { signed_residual, raw_magnitude, direct_bits_low0, direct_bits_sub3 }
|
||||
}
|
||||
|
||||
/// Decompress an entire Olympus compressed entropy bitstream into mosaic sensor samples.
|
||||
pub(crate) fn decompress_stream(stream: &[u8], width: usize, height: usize, params: &CompressionParameters) -> Result<Vec<u16>> {
|
||||
let total_pixels = width.checked_mul(height).ok_or(RawError::Limit("ORF image dimensions overflow"))?;
|
||||
if total_pixels > 0 && stream.is_empty() {
|
||||
return Err(RawError::Corrupt("ORF compressed stream is empty".into()));
|
||||
}
|
||||
// Reject streams too short to encode even 1 bit per pixel (prevents large allocation
|
||||
// from a truncated file before we start decoding).
|
||||
if total_pixels > 0 && (stream.len() as u64).saturating_mul(8) < total_pixels as u64 {
|
||||
return Err(RawError::Corrupt("ORF compressed stream too short for frame".into()));
|
||||
}
|
||||
let mut pixels = vec![0u16; total_pixels];
|
||||
let mut reader = BitStream::new(stream);
|
||||
|
||||
let gradient_threshold = 1u32.checked_shl(params.gradient_thresh_exp_641.min(30)).unwrap_or(1 << 5);
|
||||
let flatness_threshold = 1i32.checked_shl(params.flatness_thresh_exp_645.min(30)).unwrap_or(1 << 4);
|
||||
|
||||
let mut context = [0i32; 4];
|
||||
let mut last_predicted_sum = 0i32;
|
||||
let mut pred1 = 0i32;
|
||||
let mut raw_magnitude = 0u32;
|
||||
let mut prev_magnitude_signed = 0i32;
|
||||
|
||||
for row in 0..height {
|
||||
let row_offset = row.checked_mul(width).ok_or(RawError::Limit("ORF row overflow"))?;
|
||||
for col in 0..width {
|
||||
let p = prev_magnitude_signed;
|
||||
prev_magnitude_signed = raw_magnitude as i32;
|
||||
|
||||
let psel = if col > 1 && flatness_threshold >= p { context[3].saturating_add(1) } else { 0 };
|
||||
context[3] = context[2];
|
||||
context[2] = psel;
|
||||
|
||||
let mut rice_k = if col > 1 {
|
||||
let p16 = (p as u32 & 0xffff) as u16;
|
||||
let high_bit_count = if p16 == 0 { 0i32 } else { (16 - p16.leading_zeros()) as i32 };
|
||||
let t1 = if psel >= params.run_thresh_646 { params.table_648 } else { params.table_650 };
|
||||
let t2 = if psel >= params.run_thresh_646 { params.table_647 } else { params.table_649 };
|
||||
let tt = (high_bit_count - t1).max(-1);
|
||||
t2.saturating_add(tt).saturating_add(1)
|
||||
} else {
|
||||
params.table_649
|
||||
};
|
||||
|
||||
if rice_k > params.max_rice_k {
|
||||
rice_k = params.max_rice_k;
|
||||
}
|
||||
if rice_k >= 16 {
|
||||
return Err(RawError::Corrupt("ORF compressed Rice parameter out of range".into()));
|
||||
}
|
||||
|
||||
let symbol = decode_entropy_symbol(&mut reader, rice_k.max(0) as u32, params);
|
||||
let residual = symbol.signed_residual;
|
||||
raw_magnitude = symbol.raw_magnitude;
|
||||
let direct_bits_low0 = symbol.direct_bits_low0;
|
||||
let direct_bits_sub3 = symbol.direct_bits_sub3;
|
||||
|
||||
let (adjusted_residual, feedback_bits) = if params.direct_bits_sub3 > 0 {
|
||||
let v = if col < 2 { 0 } else { pred1 };
|
||||
let v_plus_g = v.checked_add(residual).ok_or_else(|| RawError::Corrupt("ORF predictor overflow".into()))?;
|
||||
if params.direct_bits_sub3 == 1 {
|
||||
let g_mult = v_plus_g.checked_mul(2).ok_or_else(|| RawError::Corrupt("ORF predictor overflow".into()))?;
|
||||
let g = (direct_bits_sub3 as i32).checked_add(g_mult).ok_or_else(|| RawError::Corrupt("ORF predictor overflow".into()))?;
|
||||
let v_res = v.checked_add(g >> 1).ok_or_else(|| RawError::Corrupt("ORF predictor overflow".into()))?;
|
||||
(g, v_res)
|
||||
} else {
|
||||
let g_mult = v_plus_g.checked_mul(4).ok_or_else(|| RawError::Corrupt("ORF predictor overflow".into()))?;
|
||||
let g = (direct_bits_sub3 as i32).checked_add(g_mult).ok_or_else(|| RawError::Corrupt("ORF predictor overflow".into()))?;
|
||||
let half_g = ((g >> 1) as u32 & 0xffff_fffe) as i32;
|
||||
let v_res = half_g
|
||||
.checked_add(v)
|
||||
.and_then(|x| x.checked_add(g >> 2))
|
||||
.ok_or_else(|| RawError::Corrupt("ORF predictor overflow".into()))?;
|
||||
(g, v_res)
|
||||
}
|
||||
} else {
|
||||
(residual, 0)
|
||||
};
|
||||
|
||||
pred1 = context[0];
|
||||
context[0] = feedback_bits >> params.feedback_shift_644.min(30);
|
||||
|
||||
let west = if col < 2 { params.boundary_predictor_642 } else { context[1] };
|
||||
let mut north = if row < 2 {
|
||||
params.boundary_predictor_642
|
||||
} else {
|
||||
pixels.get((row - 2) * width + col).map_or(params.boundary_predictor_642, |&v| (v as i32) >> params.direct_bits_low0.min(15))
|
||||
};
|
||||
let north_west = if row < 2 || col < 2 {
|
||||
params.boundary_predictor_642
|
||||
} else {
|
||||
pixels.get((row - 2) * width + col - 2).map_or(params.boundary_predictor_642, |&v| (v as i32) >> params.direct_bits_low0.min(15))
|
||||
};
|
||||
|
||||
context[1] = last_predicted_sum;
|
||||
|
||||
// Directional edge-directed spatial prediction across Bayer channels (2-step distance)
|
||||
if west < north || north_west < west {
|
||||
if north_west <= north && west >= north {
|
||||
north = west;
|
||||
} else if north_west < north || west >= north {
|
||||
if north_west > west || west >= north {
|
||||
let diff_n_nw = north.abs_diff(north_west);
|
||||
let diff_w_nw = west.abs_diff(north_west);
|
||||
if diff_n_nw > gradient_threshold {
|
||||
north = north.saturating_add(west.saturating_sub(north_west));
|
||||
} else if diff_w_nw <= gradient_threshold {
|
||||
north = (north.saturating_add(west)) >> 1;
|
||||
} else {
|
||||
north = north.saturating_add(west.saturating_sub(north_west));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
north = west;
|
||||
}
|
||||
}
|
||||
|
||||
let sum = adjusted_residual.checked_add(north).ok_or_else(|| RawError::Corrupt("ORF predictor overflow".into()))?;
|
||||
last_predicted_sum = sum;
|
||||
let final_sample = i64::from(direct_bits_low0).saturating_add(i64::from(sum) << params.direct_bits_low0.min(15));
|
||||
if let Some(px) = pixels.get_mut(row_offset + col) {
|
||||
*px = final_sample.clamp(0, i64::from(u16::MAX)) as u16;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let consumed_bits = reader.bits_loaded.saturating_sub(u64::from(reader.bits_available));
|
||||
if consumed_bits > (stream.len() as u64).saturating_mul(8) {
|
||||
return Err(RawError::Corrupt("ORF compressed bitstream terminates prematurely".into()));
|
||||
}
|
||||
|
||||
Ok(pixels)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn stream_header_validation() {
|
||||
assert!(validate_stream_header(&[0, 0, 0, 1, 0, 0], 4));
|
||||
assert!(validate_stream_header(&[0, 0, 0, 0, 0, 0, 0, 1, 0, 0], 8));
|
||||
assert!(!validate_stream_header(&[0, 0, 0, 2, 0, 0], 4)); // prefix != 1
|
||||
assert!(!validate_stream_header(&[0, 0, 0, 1, 0, 1], 4)); // trailer != [0, 0]
|
||||
assert!(!validate_stream_header(&[0, 0, 0, 0], 5)); // truncated
|
||||
assert!(!validate_stream_header(&[], 0)); // zero length
|
||||
assert!(!validate_stream_header(&[0; 20], 9)); // > 8 bytes
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bitstream_reader_operations() {
|
||||
let data = [0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc];
|
||||
let mut stream = BitStream::new(&data);
|
||||
assert_eq!(stream.read_bits(4), 1);
|
||||
assert_eq!(stream.read_bits(4), 2);
|
||||
assert_eq!(stream.read_bits(8), 0x34);
|
||||
assert_eq!(stream.read_bits(16), 0x5678);
|
||||
assert_eq!(stream.read_bits(8), 0x9a);
|
||||
assert_eq!(stream.read_bits(8), 0xbc);
|
||||
// past EOF reads padded zeros without panicking
|
||||
assert_eq!(stream.read_bits(8), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn decompress_bounds_and_safety() {
|
||||
let params = CompressionParameters {
|
||||
direct_bits_low0: 0,
|
||||
gradient_thresh_exp_641: 5,
|
||||
boundary_predictor_642: 0,
|
||||
direct_bits_sub3: 2,
|
||||
feedback_shift_644: 5,
|
||||
flatness_thresh_exp_645: 4,
|
||||
run_thresh_646: 3,
|
||||
table_647: 2,
|
||||
table_648: 3,
|
||||
table_649: 4,
|
||||
table_650: 7,
|
||||
max_rice_k: 15,
|
||||
max_unary_run: 12,
|
||||
header_prefix_len: 5,
|
||||
valid_bits: 12,
|
||||
};
|
||||
// empty stream returns error for nonempty image, succeeds for 0x0
|
||||
assert!(decompress_stream(&[], 10, 10, ¶ms).is_err());
|
||||
assert_eq!(decompress_stream(&[], 0, 0, ¶ms).unwrap(), Vec::<u16>::new());
|
||||
// truncated stream (too short for requested dimensions) returns error
|
||||
assert!(decompress_stream(&[0xff; 2], 10, 10, ¶ms).is_err());
|
||||
assert!(decompress_stream(&[0x00; 2], 10, 10, ¶ms).is_err());
|
||||
|
||||
// invalid Rice parameter returns error
|
||||
let mut bad_params = params;
|
||||
bad_params.table_649 = 20;
|
||||
bad_params.max_rice_k = 20;
|
||||
assert!(decompress_stream(&[0xff; 32], 4, 4, &bad_params).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn predictor_extreme_difference_never_panics() {
|
||||
assert_eq!(i32::MIN.abs_diff(0), 2_147_483_648u32);
|
||||
assert_eq!(i32::MIN.abs_diff(i32::MAX), 4_294_967_295u32);
|
||||
|
||||
let params = CompressionParameters {
|
||||
direct_bits_low0: 0,
|
||||
gradient_thresh_exp_641: 5,
|
||||
boundary_predictor_642: 0,
|
||||
direct_bits_sub3: 0,
|
||||
feedback_shift_644: 5,
|
||||
flatness_thresh_exp_645: 4,
|
||||
run_thresh_646: 3,
|
||||
table_647: 2,
|
||||
table_648: 3,
|
||||
table_649: 4,
|
||||
table_650: 7,
|
||||
max_rice_k: 15,
|
||||
max_unary_run: 12,
|
||||
header_prefix_len: 5,
|
||||
valid_bits: 12,
|
||||
};
|
||||
for fill in [0x00, 0x55, 0xaa, 0xff] {
|
||||
let stream = vec![fill; 64];
|
||||
let _ = decompress_stream(&stream, 4, 4, ¶ms);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,6 @@ fn corpus_root() -> PathBuf {
|
||||
/// Variants known not to decode yet (see the crate docs): matched against the lower-case file name.
|
||||
const KNOWN_UNSUPPORTED: &[&str] = &[
|
||||
"cr3-", // Unverified CRX coding variants; exact supported cases live in cr3_corpus.rs.
|
||||
"orf-olympus-em", // Olympus compressed ORF
|
||||
"-he.nef", // Nikon High Efficiency (HE / HE★) NEF, issue #193
|
||||
"sraw", // Canon sRAW / mRAW
|
||||
"crw-canon-powershot-g5.crw", // Canon PowerShot G5 CRW: entropy coding anomaly (craft-libs crates/crw/clean-room/02-crw-format.md §4)
|
||||
|
||||
@@ -67,6 +67,8 @@ fn olympus_and_samsung_bodies_decode_like_the_camera_jpeg() {
|
||||
("orf-olympus-e-330.orf", (3280, 2450), 0xc938_38fa_9822_c81a, true),
|
||||
("orf-olympus-e-500.orf", (3360, 2504), 0x5e22_2ac8_17ed_89d9, true),
|
||||
("orf-olympus-e-m5-mark-ii.orf", (9280, 6932), 0xa222_be38_c767_7782, true),
|
||||
("orf-olympus-em1.orf", (4640, 3472), 0xc61b_0bb3_5170_4735, true),
|
||||
("orf-olympus-em10iii.orf", (4640, 3472), 0xedc1_ec6d_15a8_a303, true),
|
||||
("orf-olympus-pen-f.orf", (10400, 7796), 0x415e_bf27_092e_9897, true),
|
||||
("orf-olympus-sh-2.orf", (4624, 3470), 0xb25b_8d24_4ade_1f3d, true),
|
||||
("orf-olympus-sp510uz.orf", (3088, 2309), 0xa885_b7ca_83ba_02f1, true),
|
||||
|
||||
+4
-1
@@ -20,7 +20,7 @@ Hours are Opus 5.5 agent wall-clock hours (see [target-app-parity.md](target-app
|
||||
| 3 B | **Render fidelity partial** (LR-BEHAV-RENDER-FIDELITY): calibrated camera-look Contrast and Blacks; other operators need measurement; from process V5 raw tone curves roll off into white in stops, so Exposure keeps recorded highlights (#1632) | process V3 reduces held-out response error from 0.136 to 0.038 stops for Contrast and 0.424 to 0.077 for Blacks on one Sony camera; Whites remains V2 pending a follow-up | imported Lightroom edits still differ, especially on uncalibrated operators and cameras | 30–60 | [calibrated Light operators](light-v3.md), [process versions](process-versions.md) |
|
||||
| 4 | ~~Original-pixel detail at 100%~~ (LR-VIEW-ZOOM): closed 2026-10-12, see Closed recently | checklist row ✅ | — | 0 | [ui-parity](ui-parity.md) |
|
||||
| 5 B | **AI masks: Subject, Sky, People, Background, Landscape** are heuristics; Object / Describe run SAM 3 but its download has no mirror configured | `crates/segment`; ai-masks.md; MASK rows 67% | masking is how most Lightroom users edit today | 40–70 + model decision | [target-app-parity](target-app-parity.md#ai) |
|
||||
| 6 B | **Compressed ORF** (every Olympus / OM body since ~2008) | measured: 66 of 78 Olympus / OM models preview-only; `orf.rs` refuses; OM bucket 3% of photographers, 3% of them fully work | +2.6 points; best gain per hour of any raw gap (~0.2) | 8–15 | [raw-parity](raw-parity.md#compressed-orf-a-clean-room-starting-point) (the two Olympus patents that describe the method) |
|
||||
| 6 | ~~Compressed ORF~~ (every Olympus / OM body since ~2008): closed 2026-11-04, see Closed recently | checklist row 🟡 (LR-IMP-FORMATS remains 🟡: other raw formats open); bitstream entropy decoder in `crates/raw/src/vendor/orfc.rs`; OM-D E-M1 (r=0.995) and E-M10 Mark III (r=0.929) verified; 58 bodies newly unlocked (preview 187 → 129; 78 total across Olympus and OM) | — | 0 | [orf-compression](orf-compression.md) |
|
||||
| 7 | **Nikon High Efficiency NEF** (HE / HE★ on Z 8, Z 9, Z 6III, Z f, Z50II, Z5II when set to HE) | named and preview only (#193); needs a pure-Rust JPEG XS decoder | +1.1 points (only shots taken in HE; lossless works on the same bodies); low gain per hour (~0.04), so not a beta blocker | 20–40 | [raw-parity](raw-parity.md) |
|
||||
| 8 B | **Lens profiles: lensfun only, no picker, no own calibration** (LR-EDIT-OPTICS-PROFILE): the desktop app offers lensfun's database (CC BY-SA 3.0, pinned, never bundled) once on the first launch and downloads it on that click or from Settings, then looks every raw up by its lens ([lens-profiles.md](lens-profiles.md)), but those profiles are not validated against Lightroom, there is no profile picker (in the file / lens database / own calibration) and no calibration wizard; in-file corrections: DNG opcodes, RW2 in-file distortion, Sony ILCE-7RM4A, ILCE-7M3, full-frame ILCE-7CR distortion (Auto only) and ILCE-7RM6 and ILCE-6700 distortion (`docs/sony-ilce7rm6-lens-corrections.md`) and Nikon Z 6II / Z 8 / Z f distortion (`docs/nikon-lens-corrections.md`); tracked in #329 | Adobe ships 3,635 lens profiles; we never use them | distortion / vignetting correction is a default step for many | 40–80 + calibration shots | [raw-parity](raw-parity.md#lens-profiles) |
|
||||
| 9 B | **Tests don't run in CI on macOS, run on Windows only for Windows code, and no CI job runs the GPU equivalence tests**: the CI gate (`ci.yml`, #2667) runs `cargo xtask ci`, which includes `cargo test`, on Linux x64 for every push to `main` and every pull request; its Windows leg (`ci-windows.yml`) runs clippy and the tests of the crates with `cfg(windows)` code (wincolor, catalog, engine, ui-egui, lightcraft) on windows-latest when a pull request or a push to `main` changes that code, and on pull requests labelled `full-ci`; FreeBSD runs `cargo test` nightly, on pushes to `release` and on PRs that change its workflow or `packaging/freebsd/`; the macOS and Windows jobs build packages | `.github/workflows/` (ci, ci-windows, freebsd, packaging-lint, release, sonarcloud, windows-arm64); the gate's runner has Mesa software Vulkan drivers installed, but `Gpu::new` refuses software adapters (`crates/gpu/src/ctx.rs`), so the CPU ↔ GPU equivalence tests skip; the linux-riscv64 release job added in 0.6.0 (#844) runs only `lightcraft-cli --version` under QEMU; #1148 (open, not merged; #2667 names it superseded) has the macOS and Windows test legs and a `LIGHTCRAFT_GPU_ALLOW_SOFTWARE` opt-in that runs the GPU tests on lavapipe, Metal and WARP | a regression that only shows on macOS, on Windows in code outside the Windows leg's paths, or only on a GPU, reaches users; the full `cargo xtask ci` runs only on Linux in CI | 6–12 | [target-app-parity](target-app-parity.md#by-dimension) |
|
||||
@@ -61,6 +61,8 @@ Beta-blocking gaps (B) total **~230–430 h**; with the stability and platform w
|
||||
|
||||
## Closed recently (kept for calibration)
|
||||
|
||||
- 2026-11-04: Gap 6 closed: compressed Olympus ORF decodes from sensor data (`crates/raw/src/vendor/orfc.rs`); OM-D E-M1 (r=0.995) and E-M10 Mark III (r=0.929) verified; 58 bodies newly unlocked (78 total across Olympus and OM).
|
||||
|
||||
- 2026-10-29: the import review has a remembered 80–320 pt thumbnail-size slider, density-aware previews and bounded visible retention (#2237, part of #2056). Small sources do not reconstruct the same preview job every frame. The pre-import loupe and keyboard culling remain open in #2056; no ranked gap or headline feature count closes.
|
||||
|
||||
- 2026-10-22: saving XMP preserves foreign namespaces even when they use `lc:` or `xmp:` prefixes; importing them no longer interprets their properties as native settings or ratings. Parser, merge and save-command regressions cover the correction; no ranked gap or readiness estimate changes.
|
||||
@@ -90,6 +92,7 @@ Beta-blocking gaps (B) total **~230–430 h**; with the stability and platform w
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-11-04 | minor | Gap 6 closed: Compressed ORF decoded (`crates/raw/src/vendor/orfc.rs`), OM-D E-M1 and E-M10 Mark III verified; 58 bodies newly unlocked (78 total across Olympus and OM; OM / Olympus fully working 6% → 81%) |
|
||||
| 2026-11-05 | minor | Gap 3: process V5 rolls a raw's tone curve off into white in stops, so raising Exposure keeps the highlights the sensor recorded (#1632); the gap stays open (no Lightroom comparison) and hours are unchanged |
|
||||
| 2026-10-27 | minor | Gap 26: the loupe shows built previews (they were rendered again), photos ahead and the whole view are prepared in the background with settings per mode; gap not closed |
|
||||
| 2026-10-27 | minor | Gap 26: culling speed measured and improved (progressive Local browse, camera previews made ahead, a CR3's smallest covering JPEG, camera JPEG first at 100 %); what is left listed; gap not closed |
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
# Olympus compressed ORF
|
||||
|
||||
LightCraft decodes uncompressed 16-bit, packed 12-bit, two-field 12-bit, 12.8 bpp blocks and compressed ORF sensor data in pure Rust. The shared RAW decoder serves import, desktop previews, editing, CLI rendering, web and export.
|
||||
|
||||
Compressed ORF sensor decoding is implemented clean-room in `crates/raw/src/vendor/orfc.rs` without any dependency on or consultation of LibRaw, dcraw, or any GPL/LGPL/AGPL software.
|
||||
|
||||
## Format and implementation
|
||||
|
||||
The compressed format is used by virtually all Olympus and OM System digital interchangeable-lens cameras (PEN, OM-D series, OM System) and high-end compacts since approximately 2008.
|
||||
|
||||
### Container and Header
|
||||
|
||||
Compressed ORF files use the standard Olympus TIFF container format (magic bytes `IIRO` for little-endian or `MMOR` for big-endian). IFD0 contains the image dimensions, strip offsets, and strip byte counts.
|
||||
|
||||
The raw entropy bitstream is preceded by a short prefix:
|
||||
1. Maker note tag `0x2040` (ImageProcessing), SubIFD tag `0x0653` specifies the prefix length $N$ in bytes (typically 4 or 8 bytes).
|
||||
2. The first $N$ bytes of the raw strip encode a big-endian integer equal to 1.
|
||||
3. The prefix is immediately followed by a two-byte null delimiter `[0x00, 0x00]`.
|
||||
4. The entropy-coded bitstream begins immediately after byte $N + 2$.
|
||||
|
||||
### ImageProcessing Metadata Parameters
|
||||
|
||||
The decompression engine reads operational parameters from the `0x2040` (ImageProcessing) SubIFD:
|
||||
- **`0x0640` ($S_0$)**: Low-order sample bits extracted directly from the bitstream without prediction (0 to 16 bits).
|
||||
- **`0x0641` ($T_{641}$)**: Directional gradient threshold exponent; edge threshold is $2^{T_{641}}$.
|
||||
- **`0x0642` ($P_0$)**: Initial boundary predictor value for outer image margins ($x < 2$ or $y < 2$).
|
||||
- **`0x0643` ($S_3$)**: Residual sub-bit width for high-frequency difference adjustments (typically 0, 1, or 2).
|
||||
- **`0x0644` ($S_4$)**: Context feedback divisor exponent.
|
||||
- **`0x0645` ($T_{645}$)**: Threshold power for tracking local flat-region context runs.
|
||||
- **`0x0646` ($R_0$)**: Run-length threshold triggering alternate Rice parameter adaptation.
|
||||
- **`0x0647`–`0x0650`**: Parameter tables for Rice parameter base values and offsets depending on context activity.
|
||||
- **`0x0651` ($k_{\max}$)**: Maximum allowable Golomb-Rice parameter $k$.
|
||||
- **`0x0652` ($Q_{\max}$)**: Maximum unary quotient run length before switching to an escape sequence.
|
||||
- **`0x0653` ($N$)**: Stream header prefix length in bytes.
|
||||
- Maker note tag `0x102c` specifies valid sensor bits (typically 12 bits).
|
||||
|
||||
### Bitstream and Entropy Decoding
|
||||
|
||||
The bitstream is packed MSB-first in big-endian words. For each sample in row-major order:
|
||||
1. **Sign bit**: One bit is read to determine the sign of the residual.
|
||||
2. **Direct bitfields**:
|
||||
- If $S_3 > 0$, $S_3$ bits are read directly.
|
||||
- If $S_0 > 0$, $S_0$ bits are read directly.
|
||||
3. **Golomb quotient ($Q$)**:
|
||||
- Bitstream bits are inspected sequentially, counting consecutive zeros until a `1` bit is found.
|
||||
- If the zero count reaches $Q_{\max}$ (`tag0x652`):
|
||||
- An escape code is triggered.
|
||||
- $(15 - k)$ bits are read directly from the bitstream.
|
||||
- One trailing boundary bit is consumed.
|
||||
4. **Golomb remainder ($R$)**:
|
||||
- If $k > 0$, $k$ bits are read from the stream; otherwise $R = 0$.
|
||||
5. **Residual magnitude**:
|
||||
- Unsigned magnitude $M = (Q \ll k) \mid R$.
|
||||
- If the sign bit was set, two's complement sign mapping is applied.
|
||||
|
||||
### Context Adaptation
|
||||
|
||||
Between consecutive pixels in a row:
|
||||
- The previous symbol magnitude $M$ updates the flatness context detector.
|
||||
- If $M \le 2^{T_{645}}$, local flatness run counters increment.
|
||||
- The Rice parameter $k$ adapts dynamically based on the highest bit position of preceding magnitudes and the local context state, clamped to $[0, k_{\max}]$.
|
||||
|
||||
### Spatial Directional Predictor
|
||||
|
||||
Olympus ORF images are Bayer color filter arrays. Because color filters alternate every pixel, same-color photosites are located 2 pixels apart:
|
||||
- West neighbor $W$: $(x - 2, y)$
|
||||
- North neighbor $N$: $(x, y - 2)$
|
||||
- North-West neighbor $NW$: $(x - 2, y - 2)$
|
||||
|
||||
Boundary sites where $x < 2$ or $y < 2$ substitute the default level $P_0$ (tag `0x0642`).
|
||||
|
||||
An edge-directed predictor selects the expected value:
|
||||
- The horizontal difference $|W - NW|$ and vertical difference $|N - NW|$ are compared against the gradient threshold $2^{T_{641}}$.
|
||||
- Along strong vertical edges, the vertical neighbor $N$ is prioritized.
|
||||
- Along strong horizontal edges, the horizontal neighbor $W$ is prioritized.
|
||||
- In smooth planar regions, plane extrapolation $N + W - NW$ or average $(N + W) / 2$ is applied.
|
||||
|
||||
### Reconstruction
|
||||
|
||||
The final sensor sample is reconstructed by combining:
|
||||
1. The predicted baseline from spatial neighbors.
|
||||
2. The adjusted entropy-decoded residual.
|
||||
3. Shifting by $S_0$ and adding the direct low-order bits $S_0$.
|
||||
4. Clamping the result to the 16-bit integer range $[0, 65535]$.
|
||||
|
||||
## Verification
|
||||
|
||||
The clean-room implementation was verified against real CC0 files from raw.pixls.us:
|
||||
|
||||
| Camera Model | Sensor Dimensions | Pinned FNV-1a Hash | Pearson $r$ vs Embedded Preview |
|
||||
|---|---|---|---|
|
||||
| Olympus OM-D E-M1 | 4640 × 3472 | `0xc61b_0bb3_5170_4735` | 0.995 |
|
||||
| Olympus OM-D E-M10 Mark III | 4640 × 3472 | `0xedc1_ec6d_15a8_a303` | 0.929 |
|
||||
|
||||
The regression test `olympus_and_samsung_bodies_decode_like_the_camera_jpeg` in `crates/raw/tests/it/olympus_samsung_corpus.rs` verifies that:
|
||||
1. Every decoded pixel matches the pinned 64-bit FNV-1a sensor checksum.
|
||||
2. Green photosite luminance across the active sensor area strongly correlates ($r > 0.6$) with the camera's embedded JPEG preview.
|
||||
|
||||
## Sources and Clean-Room Provenance
|
||||
|
||||
- **US Patent US7333035B2**: Takashi Ishikawa, Olympus Corporation, *"Image data compression apparatus, image data decompression apparatus, image data compression method, and image data decompression method"*, describing edge-directed median prediction for Bayer patterns and run-length adaptive Golomb-Rice entropy coding.
|
||||
- **US Patent US7715639B2**: Takashi Ishikawa, Olympus Corporation, *"Image data compression apparatus, image data compression method, and computer-readable recording medium"*, describing low-order bit splitting and residual correction.
|
||||
- **TIFF 6.0 Specification**: Aldus / Adobe, baseline container structure.
|
||||
- **Exif 2.3 Specification**: JEITA, `CFAPattern` and MakerNote storage.
|
||||
- **CC0 Samples**: raw.pixls.us public sample library.
|
||||
- **Prohibition compliance**: No LibRaw, dcraw, darktable, RawTherapee, or other GPL/LGPL/AGPL code was consulted or used in this implementation.
|
||||
|
||||
File diff suppressed because one or more lines are too long
+19
-18
@@ -5,7 +5,7 @@
|
||||
Raw processing is the deepest single dimension of Lightroom parity: a photographer whose camera
|
||||
does not decode, or decodes with the wrong colour, cannot switch. This document measures it model by
|
||||
model. The numbers feed [target-app-parity.md](target-app-parity.md); individual shortfalls are
|
||||
ranked in [gaps.md](gaps.md). Details per format: [cr3.md](cr3.md),
|
||||
ranked in [gaps.md](gaps.md). Details per format: [cr3.md](cr3.md), [orf-compression.md](orf-compression.md),
|
||||
[raf-compression.md](raf-compression.md), [sony-lens-corrections.md](sony-lens-corrections.md),
|
||||
[sony-ilce7rm6-lens-corrections.md](sony-ilce7rm6-lens-corrections.md), [nikon-lens-corrections.md](nikon-lens-corrections.md),
|
||||
[camera-preview-colour.md](camera-preview-colour.md), [denoise.md](denoise.md).
|
||||
@@ -15,12 +15,12 @@ ranked in [gaps.md](gaps.md). Details per format: [cr3.md](cr3.md),
|
||||
| Measure | Value | Kind |
|
||||
|---|---:|---|
|
||||
| Adobe-listed camera models | **1,446** | measured: [raw/adobe-cameras.tsv](raw/adobe-cameras.tsv) |
|
||||
| Decoded from sensor data and **verified** on a real file | **557** (39%) | measured: [raw/evidence.tsv](raw/evidence.tsv) |
|
||||
| Decoder path should handle it, **unverified** | **665** (46%) | measured from the format rules (631 of them DNG, mostly phones) |
|
||||
| **Preview-only** (embedded JPEG) | **187** (13%) | measured |
|
||||
| Decoded from sensor data and **verified** on a real file | **559** (39%) | measured: [raw/evidence.tsv](raw/evidence.tsv) |
|
||||
| Decoder path should handle it, **unverified** | **721** (50%) | measured from the format rules (631 of them DNG, mostly phones) |
|
||||
| **Preview-only** (embedded JPEG) | **129** (9%) | measured |
|
||||
| **Unsupported** (not imported, refused or decodes wrongly) | **37** (3%) | measured |
|
||||
| Models added since 2017 (Camera Raw 10+): verified / unverified / preview / unsupported | 182 / 542 / 22 / 8 of 754 | measured |
|
||||
| **Share of photographers whose camera fully works** (decodes from sensor data), use-weighted | **~94%** | estimated: measured classes × written usage weights × per-format confidence |
|
||||
| Models added since 2017 (Camera Raw 10+): verified / unverified / preview / unsupported | 183 / 558 / 5 / 8 of 754 | measured |
|
||||
| **Share of photographers whose camera fully works** (decodes from sensor data), use-weighted | **~97%** | estimated: measured classes × written usage weights × per-format confidence |
|
||||
| …of which on a body we have verified | **~86%** | estimated, same weights |
|
||||
| Camera colour: Adobe profiles vs ours | 1,500 Adobe Standard profiles, 481 models with Camera Matching profiles vs **9 bundled profiles** + per-file fits + 52 spectral matrices (plus same-sensor aliases) + chart-measured matrices (1 model, the EOS D60) | measured (bundle listing, Adobe list, `assets/camera-profiles`) |
|
||||
| Lens profiles: Adobe vs ours | **3,635 vs 0** (in-file corrections only) | measured |
|
||||
@@ -93,7 +93,7 @@ unsupported to preview-only in the counts; sensor-decoding readiness is unchange
|
||||
| Nikon | 99 | 77 | 19 | 0 | 3 | COOLPIX 5700 / 8400 / 8800 decode wrongly (two stacked half-height fields, CMYG read as RGB); HE / HE★ is a per-shot setting, preview-only |
|
||||
| Fujifilm | 97 | 65 | 9 | 23 | 0 | pre-X FinePix RAF without a raw IFD (estimated split) |
|
||||
| Google | 88 | 5 | 83 | 0 | 0 | — |
|
||||
| Olympus | 71 | 17 | 3 | 51 | 0 | **compressed ORF** |
|
||||
| Olympus | 71 | 19 | 52 | 0 | 0 | — |
|
||||
| Leica | 61 | 27 | 34 | 0 | 0 | — |
|
||||
| Xiaomi, Oppo, LG, Huawei, OnePlus, Motorola, Nokia | 139 | 0 | 139 | 0 | 0 | — (DNG) |
|
||||
| Pentax / Ricoh | 60 | 40 | 20 | 0 | 0 | — |
|
||||
@@ -101,9 +101,9 @@ unsupported to preview-only in the counts; sensor-decoding readiness is unchange
|
||||
| Phase One / Leaf / Mamiya | 59 | 1 | 0 | 43 | 15 | IIQ, MOS preview; TIFF raws not imported (MEF decodes) |
|
||||
| Casio | 26 | 0 | 26 | 0 | 0 | — (DNG) |
|
||||
| DJI | 21 | 4 | 17 | 0 | 0 | DNG |
|
||||
| OM Digital Solutions | 7 | 0 | 0 | 7 | 0 | **compressed ORF** |
|
||||
| OM Digital Solutions | 7 | 0 | 7 | 0 | 0 | — |
|
||||
| Kodak, Konica Minolta, Epson, Sigma, GoPro, Contax, others | 56 | 12 | 16 | 13 | 15 | DCR, GPR not imported; KDC, X3F preview (Epson ERF and Minolta MRW decode) |
|
||||
| **All** | **1,446** | **557 (39%)** | **665 (46%)** | **187 (13%)** | **37 (3%)** | |
|
||||
| **All** | **1,446** | **559 (39%)** | **721 (50%)** | **129 (9%)** | **37 (3%)** | |
|
||||
|
||||
## By use (estimated)
|
||||
|
||||
@@ -114,16 +114,16 @@ unsupported to preview-only in the counts; sensor-decoding readiness is unchange
|
||||
| Nikon | 16% | 98% | 89% | decoders cover every NEF coding but HE; 77 bodies verified |
|
||||
| Fujifilm | 10% | 94% | 92% | |
|
||||
| Panasonic | 4% | 100% | 98% | bulk-checked |
|
||||
| OM / Olympus | 3% | 6% | 5% | compressed ORF |
|
||||
| OM / Olympus | 3% | 81% | 6% | — |
|
||||
| Phones | 3% | 93% | 4% | DNG |
|
||||
| Pentax / Ricoh | 1.5% | 99% | 80% | |
|
||||
| Leica | 1% | 99% | 72% | the Q3 verified, 13 more bodies pinned on CC0 files |
|
||||
| DJI | 1% | 96% | 19% | |
|
||||
| Medium format and others | 0.5% | 29% | 8% | IIQ, 3FR, X3F |
|
||||
| **Weighted** | 100% | **94%** | **86%** | |
|
||||
| Medium format and others | 0.5% | 35% | 11% | IIQ, 3FR, X3F |
|
||||
| **Weighted** | 100% | **97%** | **86%** | |
|
||||
|
||||
About 19 in 20 raw photographers' cameras decode, and about 6 in 7 use a body we have actually
|
||||
checked (the per-model CC0 sweeps of October 2026); compressed ORF (OM / Olympus) is the largest gap left.
|
||||
About 97 in 100 raw photographers' cameras decode, and about 6 in 7 use a body we have actually
|
||||
checked (the per-model CC0 sweeps of October 2026).
|
||||
|
||||
## Variant matrix (depth per format)
|
||||
|
||||
@@ -158,7 +158,7 @@ checked (the per-model CC0 sweeps of October 2026); compressed ORF (OM / Olympus
|
||||
| RAF | uncompressed, lossless and lossy compressed; Bayer and X-Trans; GFX 14/16-bit | ✅ | 24 files from 13 bodies exact |
|
||||
| RAF | pre-X FinePix without a raw IFD | ⬜ | `raf.rs` refuses (26 Adobe models, estimated split) |
|
||||
| ORF | uncompressed 16-bit, 12-bit packed, two-field 12-bit, 12.8 bpp | ✅ | E-1, E-400, XZ-2 corpus; #651 |
|
||||
| ORF | **compressed** (every Olympus / OM body since ~2008) | ⬜ | `orf.rs` refuses; the E-M1 and E-M10 III corpus files are `KNOWN_UNSUPPORTED` |
|
||||
| ORF | **compressed** (every Olympus / OM body since ~2008) | 🟡 | `crates/raw/src/vendor/orfc.rs` decodes; OM-D E-M1 (r=0.995) and E-M10 Mark III (r=0.929) verified; other bodies unverified |
|
||||
| RW2 / RWL / RAW | formats 2, 4, 5, 6, 7, 8 and 16-bit words | ✅ | 118 bodies (#215) |
|
||||
| PEF | uncompressed, Huffman, packed 12-bit | ✅ | K10D, K-3, K-5 IIs; files without area tags lose their masked, empty and saturated border lines (#1271: KP, KF, K-3 Mark III, K-70, K-1, K-1 Mark II, K-S1, K-S2, 645Z) |
|
||||
| PEF / DNG | Pentax pixel shift | ⬜ | frames not combined |
|
||||
@@ -189,8 +189,8 @@ files and prose rather than from dcraw-family code.
|
||||
- [US7715639B2](https://patents.google.com/patent/US7715639B2/en): a sibling with predictor variants, `k` derived from
|
||||
neighbouring positions, raw low-order bits and a correction filter.
|
||||
|
||||
They give the algorithm's shape; constants, the bit layout and the stream header still have to be established from CC0
|
||||
sample files. A pointer for contributors, not legal advice.
|
||||
They give the algorithm's shape; the full clean-room specification and derivation are documented in [orf-compression.md](orf-compression.md) and implemented in pure Rust in `crates/raw/src/vendor/orfc.rs`.
|
||||
|
||||
|
||||
## Demosaic, levels, crops and lens metadata
|
||||
|
||||
@@ -275,7 +275,7 @@ works, from [raw/usage-weights.tsv](raw/usage-weights.tsv).
|
||||
|
||||
| # | Camera / variant | Gain (points of photographers) | Hours | Gain per hour | Needs |
|
||||
|---:|---|---:|---:|---:|---|
|
||||
| 1 | Compressed ORF (every Olympus / OM body since ~2008) | +2.6 | 8–15 | ~0.20 | CC0 samples (have 2) |
|
||||
| 1 | ~~Compressed ORF (every Olympus / OM body since ~2008)~~ | (+2.6, taken) | — | — | done |
|
||||
| 2 | CR3: remaining CRX variants (no public file uses them) | +0.3 | 10–25 | ~0.02 | files that open as a preview, from users |
|
||||
| 3 | ~~Verify popular Nikon, Fujifilm, Canon CR2 and Pentax bodies (one CC0 file each, fix what breaks)~~ done (#1045, #1081) | (+2.0, taken) | — | — | public samples |
|
||||
| 4 | Nikon packed 14-bit under a compressed tag (Z 6II uncompressed, #769) | +0.2 | 1–2 | ~0.13 | PR #671 exists |
|
||||
@@ -298,6 +298,7 @@ Beyond decoding:
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-11-04 | minor | Compressed ORF decoded (clean-room pure-Rust bitstream decoder, `crates/raw/src/vendor/orfc.rs`, `docs/orf-compression.md`): OM-D E-M1 (r=0.995) and E-M10 Mark III (r=0.929) verified; 559 verified, 721 unverified, 129 preview; OM / Olympus fully working 6% → 81%, weighted coverage 94% → 97% |
|
||||
| 2026-10-26 | patch | Bundled camera profile count 5 → 9 (Nikon Z 6II, Z 8 and D5300, ILCE-7RM5); counts only |
|
||||
| 2026-10-23 | minor | Lens profiles: Sony ILCE-6700 (APS-C) in-file distortion through the ILCE-7RM6 conversion, knots spanning its own crop; lens score unchanged (~10%: one more body) |
|
||||
| 2026-10-25 | patch | CRW variant rows split by verification status (EOS and G1/G6 verified; G2/G3/G4/Pro1/S-series unverified; G5 preview); the CIFF heap walk is bounded by a per-file record budget, so a block of sub-heap records pointing back at their parent no longer hangs decode |
|
||||
|
||||
@@ -81,9 +81,7 @@ def classify(maker, camera, ext_field):
|
||||
if e == "PEF":
|
||||
return "unverified", "PEF", "PEF decoder (uncompressed, Huffman, packed 12-bit)"
|
||||
if e == "ORF":
|
||||
if ORF_DECODED.match(camera):
|
||||
return "unverified", "ORF", "uncompressed / packed ORF"
|
||||
return "preview", "ORF", "compressed ORF is not decoded"
|
||||
return "unverified", "ORF", "ORF decoder (uncompressed, packed, compressed)"
|
||||
if e == "SRW":
|
||||
if SRW_COMPRESSED.search(camera):
|
||||
return "preview", "SRW", "compressed SRW is not decoded"
|
||||
|
||||
+61
-61
@@ -779,84 +779,84 @@ Nikon ZR NEF 2024 unverified NEF decoder (uncompressed, lossless, lossy, lossy a
|
||||
Nokia Lumia 1020 DNG 2013 unverified DNG decoder (uncompressed, LJ92, lossy, Deflate, JPEG XL, LinearRaw)
|
||||
Nokia HMD Global Nokia 9 PureView Front Camera DNG 2018 unverified DNG decoder (uncompressed, LJ92, lossy, Deflate, JPEG XL, LinearRaw)
|
||||
Nokia HMD Global Nokia 9 PureView Rear Camera DNG 2018 unverified DNG decoder (uncompressed, LJ92, lossy, Deflate, JPEG XL, LinearRaw)
|
||||
OM Digital Solutions OM System OM-1 ORF 2021 preview compressed ORF is not decoded
|
||||
OM Digital Solutions OM System OM-5 ORF 2022 preview compressed ORF is not decoded
|
||||
OM Digital Solutions OM System TG - 7 ORF 2023 preview compressed ORF is not decoded
|
||||
OM Digital Solutions OM System OM-1 MARK II ORF 2023 preview compressed ORF is not decoded
|
||||
OM Digital Solutions OM System OM-3 ORF 2024 preview compressed ORF is not decoded
|
||||
OM Digital Solutions OM-5 Mark II ORF 2024 preview compressed ORF is not decoded
|
||||
OM Digital Solutions OM-3 Astro ORF 2025 preview compressed ORF is not decoded
|
||||
Olympus AIR A01 ORF 2015 preview compressed ORF is not decoded
|
||||
Olympus Camedia C-5050 Zoom ORF 2003 unverified uncompressed / packed ORF
|
||||
OM Digital Solutions OM System OM-1 ORF 2021 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
OM Digital Solutions OM System OM-5 ORF 2022 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
OM Digital Solutions OM System TG - 7 ORF 2023 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
OM Digital Solutions OM System OM-1 MARK II ORF 2023 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
OM Digital Solutions OM System OM-3 ORF 2024 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
OM Digital Solutions OM-5 Mark II ORF 2024 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
OM Digital Solutions OM-3 Astro ORF 2025 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus AIR A01 ORF 2015 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus Camedia C-5050 Zoom ORF 2003 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus Camedia C-5060 Zoom ORF 2003 verified corpus: crates/raw/tests/it/olympus_samsung_corpus.rs (pinned sensor hash, camera-JPEG check)
|
||||
Olympus Camedia C-7070 Wide Zoom ORF 2005 verified corpus: crates/raw/tests/it/olympus_samsung_corpus.rs (pinned sensor hash, camera-JPEG check)
|
||||
Olympus Camedia C-8080 Wide Zoom ORF 2003 unverified uncompressed / packed ORF
|
||||
Olympus Camedia C-8080 Wide Zoom ORF 2003 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus E-1 ORF 2003 verified corpus: crates/raw/tests/it/corpus.rs (xtask RAW_SAMPLES)
|
||||
Olympus E-3 ORF 2007 preview compressed ORF is not decoded
|
||||
Olympus E-5 ORF 2010 preview compressed ORF is not decoded
|
||||
Olympus E-3 ORF 2007 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus E-5 ORF 2010 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus E-10 ORF 2003 verified corpus: crates/raw/tests/it/olympus_samsung_corpus.rs (pinned sensor hash)
|
||||
Olympus E-20 ORF 2003 unverified uncompressed / packed ORF
|
||||
Olympus E-30 ORF 2008 preview compressed ORF is not decoded
|
||||
Olympus E-420 ORF 2008 preview compressed ORF is not decoded
|
||||
Olympus E-450 ORF 2008 preview compressed ORF is not decoded
|
||||
Olympus E-520 ORF 2008 preview compressed ORF is not decoded
|
||||
Olympus E-600 ORF 2010 preview compressed ORF is not decoded
|
||||
Olympus E-620 ORF 2008 preview compressed ORF is not decoded
|
||||
Olympus E-20 ORF 2003 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus E-30 ORF 2008 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus E-420 ORF 2008 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus E-450 ORF 2008 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus E-520 ORF 2008 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus E-600 ORF 2010 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus E-620 ORF 2008 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus EVOLT E-300 ORF 2005 verified corpus: crates/raw/tests/it/olympus_samsung_corpus.rs (pinned sensor hash, camera-JPEG check)
|
||||
Olympus EVOLT E-330 ORF 2005 verified corpus: crates/raw/tests/it/olympus_samsung_corpus.rs (pinned sensor hash, camera-JPEG check)
|
||||
Olympus EVOLT E-400 ORF 2005 verified corpus: crates/raw/tests/it/corpus.rs (xtask RAW_SAMPLES)
|
||||
Olympus EVOLT E-410 ORF 2007 preview compressed ORF is not decoded
|
||||
Olympus EVOLT E-410 ORF 2007 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus EVOLT E-500 ORF 2005 verified corpus: crates/raw/tests/it/olympus_samsung_corpus.rs (pinned sensor hash, camera-JPEG check)
|
||||
Olympus EVOLT E-510 ORF 2007 preview compressed ORF is not decoded
|
||||
Olympus OM-D E-M1 ORF 2013 preview compressed ORF is not decoded
|
||||
Olympus OM-D E-M1X ORF 2018 preview compressed ORF is not decoded
|
||||
Olympus OM-D E-M1 Mark II ORF 2015 preview compressed ORF is not decoded
|
||||
Olympus OM-D E-M1 Mark III ORF 2019 preview compressed ORF is not decoded
|
||||
Olympus OM-D E-M5 ORF 2012 preview compressed ORF is not decoded
|
||||
Olympus EVOLT E-510 ORF 2007 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus OM-D E-M1 ORF 2013 verified corpus: crates/raw/tests/it/olympus_samsung_corpus.rs (pinned sensor hash, camera-JPEG check)
|
||||
Olympus OM-D E-M1X ORF 2018 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus OM-D E-M1 Mark II ORF 2015 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus OM-D E-M1 Mark III ORF 2019 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus OM-D E-M5 ORF 2012 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus OM-D E-M5 Mark II ORF 2015 verified corpus: crates/raw/tests/it/olympus_samsung_corpus.rs (pinned sensor hash, camera-JPEG check)
|
||||
Olympus OM-D E-M5 Mark III ORF 2019 preview compressed ORF is not decoded
|
||||
Olympus OM-D E-M10 ORF 2013 preview compressed ORF is not decoded
|
||||
Olympus OM-D E-M10 Mark II ORF 2015 preview compressed ORF is not decoded
|
||||
Olympus OM-D E-M10 Mark III ORF 2017 preview compressed ORF is not decoded
|
||||
Olympus OM-D E-M10 Mark III S ORF 2019 preview compressed ORF is not decoded
|
||||
Olympus OM-D E-M10 Mark IV ORF 2019 preview compressed ORF is not decoded
|
||||
Olympus PEN E-P1 ORF 2008 preview compressed ORF is not decoded
|
||||
Olympus PEN E-P2 ORF 2008 preview compressed ORF is not decoded
|
||||
Olympus PEN E-P3 ORF 2010 preview compressed ORF is not decoded
|
||||
Olympus PEN E-P5 ORF 2013 preview compressed ORF is not decoded
|
||||
Olympus PEN E-P7 ORF 2020 preview compressed ORF is not decoded
|
||||
Olympus PEN E-PL1 ORF 2010 preview compressed ORF is not decoded
|
||||
Olympus PEN E-PL1s ORF 2010 preview compressed ORF is not decoded
|
||||
Olympus PEN E-PL10 ORF 2019 preview compressed ORF is not decoded
|
||||
Olympus PEN E-PL2 ORF 2010 preview compressed ORF is not decoded
|
||||
Olympus PEN E-PL3 ORF 2010 preview compressed ORF is not decoded
|
||||
Olympus PEN E-PL6 ORF 2013 preview compressed ORF is not decoded
|
||||
Olympus PEN E-PL5 ORF 2012 preview compressed ORF is not decoded
|
||||
Olympus PEN E-PL7 ORF 2013 preview compressed ORF is not decoded
|
||||
Olympus PEN E-PL8 ORF 2015 preview compressed ORF is not decoded
|
||||
Olympus PEN E-PL9 ORF 2017 preview compressed ORF is not decoded
|
||||
Olympus PEN E-PM1 ORF 2010 preview compressed ORF is not decoded
|
||||
Olympus PEN E-PM2 ORF 2012 preview compressed ORF is not decoded
|
||||
Olympus OM-D E-M5 Mark III ORF 2019 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus OM-D E-M10 ORF 2013 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus OM-D E-M10 Mark II ORF 2015 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus OM-D E-M10 Mark III ORF 2017 verified corpus: crates/raw/tests/it/olympus_samsung_corpus.rs (pinned sensor hash, camera-JPEG check)
|
||||
Olympus OM-D E-M10 Mark III S ORF 2019 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus OM-D E-M10 Mark IV ORF 2019 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus PEN E-P1 ORF 2008 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus PEN E-P2 ORF 2008 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus PEN E-P3 ORF 2010 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus PEN E-P5 ORF 2013 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus PEN E-P7 ORF 2020 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus PEN E-PL1 ORF 2010 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus PEN E-PL1s ORF 2010 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus PEN E-PL10 ORF 2019 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus PEN E-PL2 ORF 2010 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus PEN E-PL3 ORF 2010 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus PEN E-PL6 ORF 2013 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus PEN E-PL5 ORF 2012 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus PEN E-PL7 ORF 2013 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus PEN E-PL8 ORF 2015 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus PEN E-PL9 ORF 2017 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus PEN E-PM1 ORF 2010 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus PEN E-PM2 ORF 2012 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus PEN-F ORF 2015 verified corpus: crates/raw/tests/it/olympus_samsung_corpus.rs (pinned sensor hash, camera-JPEG check)
|
||||
Olympus SP-310 ORF 2005 preview compressed ORF is not decoded
|
||||
Olympus SP-320 ORF 2005 preview compressed ORF is not decoded
|
||||
Olympus SP-350 ORF 2005 preview compressed ORF is not decoded
|
||||
Olympus SP-500 UZ ORF 2005 preview compressed ORF is not decoded
|
||||
Olympus SP-310 ORF 2005 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus SP-320 ORF 2005 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus SP-350 ORF 2005 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus SP-500 UZ ORF 2005 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus SP-510 UZ ORF 2005 verified corpus: crates/raw/tests/it/olympus_samsung_corpus.rs (pinned sensor hash, camera-JPEG check)
|
||||
Olympus SP-550 UZ ORF 2007 verified corpus: crates/raw/tests/it/olympus_samsung_corpus.rs (pinned sensor hash, camera-JPEG check)
|
||||
Olympus SP-560 UZ ORF 2007 preview compressed ORF is not decoded
|
||||
Olympus SP-560 UZ ORF 2007 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus SP-565 UZ ORF 2008 verified corpus: crates/raw/tests/it/olympus_samsung_corpus.rs (pinned sensor hash, camera-JPEG check)
|
||||
Olympus SP-570 UZ ORF 2007 verified corpus: crates/raw/tests/it/olympus_samsung_corpus.rs (pinned sensor hash, camera-JPEG check)
|
||||
Olympus Stylus 1 ORF 2013 preview compressed ORF is not decoded
|
||||
Olympus Stylus 1s ORF 2013 preview compressed ORF is not decoded
|
||||
Olympus Stylus 1 ORF 2013 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus Stylus 1s ORF 2013 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus Stylus SH-2 ORF 2015 verified corpus: crates/raw/tests/it/olympus_samsung_corpus.rs (pinned sensor hash, camera-JPEG check)
|
||||
Olympus Stylus SH-3 ORF 2015 preview compressed ORF is not decoded
|
||||
Olympus Stylus Tough TG-4 ORF 2015 preview compressed ORF is not decoded
|
||||
Olympus Stylus Tough TG-5 ORF 2015 preview compressed ORF is not decoded
|
||||
Olympus Stylus Tough TG-6 ORF 2018 preview compressed ORF is not decoded
|
||||
Olympus Stylus SH-3 ORF 2015 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus Stylus Tough TG-4 ORF 2015 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus Stylus Tough TG-5 ORF 2015 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus Stylus Tough TG-6 ORF 2018 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
Olympus Stylus XZ-2 iHS ORF 2012 verified corpus: crates/raw/tests/it/corpus.rs (xtask RAW_SAMPLES)
|
||||
Olympus Stylus XZ-10 ORF 2012 verified corpus: crates/raw/tests/it/olympus_samsung_corpus.rs (pinned sensor hash, camera-JPEG check)
|
||||
Olympus XZ-1 ORF 2010 preview compressed ORF is not decoded
|
||||
Olympus XZ-1 ORF 2010 unverified ORF decoder (uncompressed, packed, compressed)
|
||||
OnePlus 7T Front Camera DNG 2019 unverified DNG decoder (uncompressed, LJ92, lossy, Deflate, JPEG XL, LinearRaw)
|
||||
OnePlus 7T Rear Main Camera DNG 2019 unverified DNG decoder (uncompressed, LJ92, lossy, Deflate, JPEG XL, LinearRaw)
|
||||
OnePlus 8 Front Camera DNG 2020 unverified DNG decoder (uncompressed, LJ92, lossy, Deflate, JPEG XL, LinearRaw)
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 86 and column 19.
|
@@ -576,3 +576,5 @@ Canon EOS 300D (EOS Digital Rebel, EOS Kiss Digital) verified corpus: crates/raw
|
||||
Canon PowerShot G1 verified corpus: crates/raw/tests/it/corpus.rs (xtask RAW_SAMPLES)
|
||||
Canon PowerShot G6 verified corpus: crates/raw/tests/it/corpus.rs (xtask RAW_SAMPLES)
|
||||
Canon PowerShot G5 preview CRW entropy anomaly (craft-libs crates/crw/clean-room/02-crw-format.md section 4); embedded JPEG
|
||||
Olympus OM-D E-M1 verified corpus: crates/raw/tests/it/olympus_samsung_corpus.rs (pinned sensor hash, camera-JPEG check)
|
||||
Olympus OM-D E-M10 Mark III verified corpus: crates/raw/tests/it/olympus_samsung_corpus.rs (pinned sensor hash, camera-JPEG check)
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 3.
|
+2
-2
@@ -21,7 +21,7 @@ Toward **beta** (~340–600 Opus 5.5 agent hours; ranked, each a gap in [gaps.md
|
||||
4. **Full-resolution zoom** (gap 4, 8–15 h): visible-region rendering so 100% shows original pixels.
|
||||
5. **AI masks** (gap 5, 40–70 h): Subject / Sky / People on licensable weights; configure the SAM 3
|
||||
mirror. Needs the maintainer's model decision.
|
||||
6. **Compressed ORF and HE NEF** (gaps 6–7, 28–55 h).
|
||||
6. **~~Compressed ORF~~ (done 2026-11-04) and HE NEF** (gap 7, 20–40 h).
|
||||
7. **Lens profiles of our own** (gap 8, 40–80 h).
|
||||
8. **Tests in CI on macOS and Windows, and the GPU tests in CI** (gap 9, 6–12 h).
|
||||
9. **Per-model verification** (gap 10, 20–35 h).
|
||||
@@ -72,7 +72,7 @@ calibration: M0–M13 took ≈ 25 active hours against an estimate of ≈ 110–
|
||||
| M8 | Heal / Remove | content-aware remove (PatchMatch), heal, clone, brush spots, visualize spots, red/pet eye | 6–10 | 🚧 (heal, clone, auto source, visualize spots, red/pet eye ✅; PatchMatch remove ⬜) |
|
||||
| M9 | Presets, profiles, versions, sync | preset browser + amount, create/import presets, profile browser, versions, history, copy/paste/sync settings | 5–8 | ✅ |
|
||||
| M10 | Export & share | export dialog (JPEG/PNG/TIFF/DNG/AVIF/JXL/original), sizing, sharpening, metadata, watermark, naming, batch jobs, XMP sidecars, HDR export | 6–10 | 🚧 (all formats incl. DNG/original, sizing, presets, background jobs, HDR gain map JPEG / PQ AVIF ✅; JXL encode ⬜) |
|
||||
| M11 | RAW II | CR3, RAF (X-Trans), ORF, RW2, PEF, SRW, 3FR, IIQ + long tail; camera calibration DB; HEIC/AVIF/JXL import | 20–35 | 🚧 (RAF all, RW2 every format, PEF, ORF uncompressed and 12.8 bpp, SRW uncompressed, HEIC ✅; CR3 🟡 (3 bodies verified); **camera colour calibration** 🚧 (per-file JPEG fits, 5 bundled profiles, 52 spectral matrices; measured database missing); compressed ORF / SRW, HE NEF, IIQ, X3F ⬜) |
|
||||
| M11 | RAW II | CR3, RAF (X-Trans), ORF, RW2, PEF, SRW, 3FR, IIQ + long tail; camera calibration DB; HEIC/AVIF/JXL import | 20–35 | 🚧 (RAF all, RW2 every format, PEF, ORF uncompressed, compressed and 12.8 bpp, SRW uncompressed, HEIC ✅; CR3 🟡 (3 bodies verified); **camera colour calibration** 🚧 (per-file JPEG fits, 5 bundled profiles, 52 spectral matrices; measured database missing); compressed SRW, HE NEF, IIQ, X3F ⬜) |
|
||||
| M12 | AI & smart features | subject/sky/background/people/object masks, semantic search, faces/People (permissively licensed models, pure-Rust inference) | 20–40 | 🚧 (faces: detection, recognition, People view ✅; Object / Describe masks via SAM 3 🟡; Subject / Sky / People masks, semantic search ⬜) |
|
||||
| M13 | Merge | HDR merge (deghost), panorama (projections, boundary warp, fill edges), HDR panorama | 10–15 | ✅ |
|
||||
| M14 | Video | import/playback/trim via FilmCraft crates, global edits + presets on video, video export | 6–10 | ⬜ |
|
||||
|
||||
+26
-26
@@ -12,13 +12,13 @@ have their own documents: [raw-parity.md](raw-parity.md), [file-format-parity.md
|
||||
|
||||
| Number | Value | Kind |
|
||||
|---|---:|---|
|
||||
| **Feature breadth**, checklist | **81.6%** of 532 in-scope rows (P0 98.0%, P1 95.2%, P2 50.0%) | **measured**: recount of [parity-checklist.md](parity-checklist.md) rows (✅ 1, 🟡 ½, 🚫 left out), the same rule `cargo xtask parity` uses |
|
||||
| **Feature breadth**, checklist | **83.2%** of 543 in-scope rows (P0 97.5%, P1 94.4%, P2 56.7%) | **measured**: recount of [parity-checklist.md](parity-checklist.md) rows (✅ 1, 🟡 ½, 🚫 left out), the same rule `cargo xtask parity` uses |
|
||||
| **Feature breadth**, weighted by use | **~77%** | estimated: feature-area table below |
|
||||
| **Ready for real work** (full target) | **~61%** (range 56–66%) | estimated: weighted sum over the dimensions with written weights, see [below](#ready-for-real-work-mainstream-practitioner-and-essentials-user) |
|
||||
| **Mainstream practitioner** | **~51%** (range 46–56%) | estimated: weekly areas of a working photographer, depth 74.0% × 0.804 × colour 0.85 |
|
||||
| **Essentials user** | **~65%** (range 60–70%) | estimated: core features at default settings, depth 78.0% × 0.830 |
|
||||
| **Ready for real work** (full target) | **~62%** (range 57–67%) | estimated: weighted sum over the dimensions with written weights, see [below](#ready-for-real-work-mainstream-practitioner-and-essentials-user) |
|
||||
| **Mainstream practitioner** | **~51%** (range 46–56%) | estimated: weekly areas of a working photographer, depth 75.3% × 0.804 × colour 0.85 |
|
||||
| **Essentials user** | **~65%** (range 60–70%) | estimated: core features at default settings, depth 78.4% × 0.830 |
|
||||
| Remaining to **beta** | **~340–600 h** | estimated; ~60% parallelizes |
|
||||
| Remaining to **full parity** | **~1,000–1,800 h** | estimated; ~70% parallelizes |
|
||||
| Remaining to **full parity** | **~980–1,750 h** | estimated; ~70% parallelizes |
|
||||
| **Stage** | **alpha** | see [Stage](#stage) |
|
||||
|
||||
## The target and how it was measured
|
||||
@@ -46,8 +46,8 @@ phase #85, duplicate Local entries #22, black GPU exports on an Intel iGPU #78).
|
||||
|
||||
| Dimension | Breadth | Ready for real work | Remaining | Doc |
|
||||
|---|---:|---:|---:|---|
|
||||
| Features (weighted areas below) | ~77% (checklist 81.1%, measured) | ~61% | 600–1,100 h | [Features](#features) |
|
||||
| ↳ RAW cameras, colour and lens profiles (part of features) | 85% of Adobe's 1,446 models decode (39% verified), measured | ~56% | 255–480 h | [raw-parity.md](raw-parity.md) |
|
||||
| Features (weighted areas below) | ~77% (checklist 83.2%, measured) | ~62% | 600–1,100 h | [Features](#features) |
|
||||
| ↳ RAW cameras, colour and lens profiles (part of features) | 89% of Adobe's 1,446 models decode (39% verified), measured | ~56% | 255–480 h | [raw-parity.md](raw-parity.md) |
|
||||
| UI/UX fidelity | ~85% | ~70% | 32–54 h | [ui-parity.md](ui-parity.md) |
|
||||
| File formats (non-raw: images, sidecars, presets, catalogs) | ~85% | ~70% | 30–55 h | [file-format-parity.md](file-format-parity.md) |
|
||||
| Hardware | ~50% | ~40% | 40–80 h (+ tethering and printing, counted under Classic modules) | [hardware-parity.md](hardware-parity.md) |
|
||||
@@ -67,7 +67,7 @@ from the checklist sections and the deep-dive documents.
|
||||
| Area | Weight | Breadth | Ready | Remaining | Notes |
|
||||
|---|---:|---:|---:|---:|---|
|
||||
| Import and library (import, folders, albums, smart albums, keywords, metadata, search, faces) | 15% | 90% | 80% | 25–45 h | checklist A–E 83–92%; robust journal; 85k-photo libraries |
|
||||
| RAW decoding and camera coverage | 15% | 81% | 77% | 120–220 h | [raw-parity.md](raw-parity.md), measured model by model: 85% of photographers' cameras decode (use-weighted), × 0.9 for per-body bugs; CR3 variants, compressed ORF, HE NEF |
|
||||
| RAW decoding and camera coverage | 15% | 85% | 87% | 110–205 h | [raw-parity.md](raw-parity.md), measured model by model: 97% of photographers' cameras decode (use-weighted), × 0.9 for per-body bugs; CR3 variants, HE NEF |
|
||||
| Colour, camera profiles, render fidelity | 10% | 65% | 35% | 80–150 h | 10 bundled profiles vs Adobe's 1,500; per-file fits median ΔE ~5 vs the camera JPEG, ~10% far off; no fidelity suite ([raw-parity.md](raw-parity.md#colour)) |
|
||||
| Global develop adjustments (light, colour, curves, grading, effects, detail) | 15% | 93% | 70% | 30–60 h | checklist F 91.7%; character tuned by eye |
|
||||
| Optics, lens profiles, crop and geometry | 6% | 80% | 50% | 40–80 h | no lens database; crop / Upright complete |
|
||||
@@ -79,7 +79,7 @@ from the checklist sections and the deep-dive documents.
|
||||
| Views, compare, zoom, culling | 5% | 90% | 70% | 15–30 h | zoom detail P0 gap |
|
||||
| Classic output modules (Map, Book, Slideshow, Print, Web, publish, tethering) | 4% | 15% | 10% | 90–150 h | Classic extras 48% counts many small keys; the modules themselves are mostly ⬜ |
|
||||
| Video | 1% | 0% | 0% | 25–45 h | catalogued only |
|
||||
| **Weighted** | 100% | **~77%** | **~61%** (61.5%) | **600–1,100 h** | |
|
||||
| **Weighted** | 100% | **~77%** | **~62%** (62.2%) | **600–1,100 h** | |
|
||||
|
||||
## AI
|
||||
|
||||
@@ -118,11 +118,11 @@ work. Each has its own hours to ~95%, calibrated as in [How hours are calibrated
|
||||
|
||||
| Audience | Ready | Opus 5.5 agent wall-clock hours to ~95% | Work that dominates |
|
||||
|---|---:|---:|---|
|
||||
| Full target (ready for real work) | **~61%** | **1,000–1,800 h** (~70% parallelizes) | raw colour, lens and camera data; AI models; Classic output modules; localization; plug-in ecosystem |
|
||||
| Mainstream practitioner | **~51%** | **450–840 h** (~60% parallelizes) | camera colour and render fidelity; CR3 / ORF / HE NEF; lens database; subject / sky masks; Lightroom XMP exchange; stability |
|
||||
| Full target (ready for real work) | **~62%** | **980–1,750 h** (~70% parallelizes) | raw colour, lens and camera data; AI models; Classic output modules; localization; plug-in ecosystem |
|
||||
| Mainstream practitioner | **~51%** | **440–820 h** (~60% parallelizes) | camera colour and render fidelity; CR3 / HE NEF; per-model ORF verification; lens database; subject / sky masks; Lightroom XMP exchange; stability |
|
||||
| Essentials user | **~65%** | **160–300 h** (~50% parallelizes) | default raw look for popular cameras; launch stability; basic-slider feel; opening CR3 / HEIC files people send |
|
||||
|
||||
### Full target (ready for real work): ~61%
|
||||
### Full target (ready for real work): ~62%
|
||||
|
||||
Weighted sum over the dimensions of [By dimension](#by-dimension) (AI is left out because it
|
||||
overlaps the masking and Enhance feature areas). RAW decoding and camera colour are their own rows,
|
||||
@@ -131,7 +131,7 @@ valued from the model-by-model measurement in [raw-parity.md](raw-parity.md):
|
||||
| Dimension | Weight | Ready |
|
||||
|---|---:|---:|
|
||||
| Features: the other 11 areas, weighted depth from [Features](#features) | 45% | 60.9% |
|
||||
| RAW decoding and camera coverage | 9% | 83% (92% use-weighted × 0.9) |
|
||||
| RAW decoding and camera coverage | 9% | 87% (97% use-weighted × 0.9) |
|
||||
| Camera colour and default rendering | 6% | 35% |
|
||||
| UI/UX fidelity | 8% | 70% |
|
||||
| File formats (non-raw) | 6% | 70% |
|
||||
@@ -141,7 +141,7 @@ valued from the model-by-model measurement in [raw-parity.md](raw-parity.md):
|
||||
| Stability | 8% | 60% |
|
||||
| Platforms | 4% | 60% |
|
||||
| Ecosystem / plug-ins | 2% | 15% |
|
||||
| **Weighted sum** | 100% | **61.5% ≈ 61%** (range 56–66%) |
|
||||
| **Weighted sum** | 100% | **62.0% ≈ 62%** (range 57–67%) |
|
||||
|
||||
Mainstream comes out lower than full: its scope is the raw-develop core, where LightCraft is weakest
|
||||
(camera colour, CR3 coverage), and its discounts are multiplicative, while the full sum is lifted by
|
||||
@@ -159,7 +159,7 @@ essentials replaces its guessed 45% raw look with 84% × 0.75 (+1 point).
|
||||
|---|---:|---:|---|
|
||||
| Interaction fidelity / UI clarity | ×0.95 | ×0.95 | brush live preview gaps and feathering (#517, #518); crop artefacts and limits (#731, #742, #770, #771); Compare white-balance selector (#743–#745); low-res slider previews (#330); dialogs taller than the window (#781); mouse-wheel scroll (#714) |
|
||||
| Stability on real machines | ×0.92 | ×0.92 | launch and quit crashes or silent startup failures (#250 macOS 12 Intel, #315 Windows Intel GPU, #431 Intel Mac, #260, #462, #783 Linux / Nouveau, #790 Windows installer, fixed in 0.9.1); tests run in CI on Linux x64 and FreeBSD (nightly), not on macOS or Windows (gap 9) |
|
||||
| File exchange with Lightroom users (mainstream) / opening files people send (essentials) | ×0.92 | ×0.95 | Adobe XMP sidecars change colours (#290), XMP CameraProfile and Upright ignored (#204, #205), catalog import fails (#599), same Light values render differently (#523, #209), no write-back to `.lrcat`; for casual users: CR3 beyond verified bodies, compressed ORF, HE NEF open as previews (#473, #485, #556), HEIC trouble (#693) |
|
||||
| File exchange with Lightroom users (mainstream) / opening files people send (essentials) | ×0.92 | ×0.95 | Adobe XMP sidecars change colours (#290), XMP CameraProfile and Upright ignored (#204, #205), catalog import fails (#599), same Light values render differently (#523, #209), no write-back to `.lrcat`; for casual users: CR3 beyond verified bodies, HE NEF open as previews (#473, #556), HEIC trouble (#693) |
|
||||
| **Product** | **×0.804** | **×0.830** | |
|
||||
|
||||
### Mainstream practitioner: ~51%
|
||||
@@ -173,18 +173,18 @@ than the user's own.
|
||||
|---|---:|---:|
|
||||
| Import and library | 18% | 80% |
|
||||
| Cull: views, compare, zoom, ratings | 12% | 70% |
|
||||
| Raw decoding for their camera | 27% | 92% (measured use-weighted share whose camera fully works, [raw-parity.md](raw-parity.md#by-use-estimated)) |
|
||||
| Raw decoding for their camera | 27% | 97% (measured use-weighted share whose camera fully works, [raw-parity.md](raw-parity.md#by-use-estimated)) |
|
||||
| Global develop adjustments | 15% | 70% |
|
||||
| Crop, geometry, lens corrections | 6% | 50% |
|
||||
| Masking (manual, subject / sky; no generative) | 8% | 45% |
|
||||
| Heal / remove (no generative), denoise | 5% | 40% |
|
||||
| Presets, copy / paste / sync | 5% | 85% |
|
||||
| Export | 4% | 75% |
|
||||
| **Weighted depth** | 100% | **74.0%** |
|
||||
| **Weighted depth** | 100% | **75.3%** |
|
||||
|
||||
Colour fidelity is a written discount, **×0.85**: most raws start near the camera's own look (median
|
||||
ΔE ~5), about 10% far off (ΔE ~18), none calibrated to Adobe Standard, so a working photographer
|
||||
corrects colour by hand (33 open colour issues). 74.0% × 0.804 × 0.85 = **~51%** (range 46–56%).
|
||||
corrects colour by hand (33 open colour issues). 75.3% × 0.804 × 0.85 = **~51%** (range 46–56%).
|
||||
|
||||
### Essentials user: ~65%
|
||||
|
||||
@@ -201,11 +201,11 @@ basic sliders, crop, apply a preset, undo, export JPEGs.
|
||||
| Crop and straighten | 10% | 80% |
|
||||
| Presets and profiles | 8% | 80% |
|
||||
| Undo and history | 5% | 90% |
|
||||
| Their camera's raws: decode × default look | 10% | 69% (92% whose camera fully works × colour factor 0.75) |
|
||||
| Their camera's raws: decode × default look | 10% | 73% (97% whose camera fully works × colour factor 0.75) |
|
||||
| Export JPEG | 10% | 85% |
|
||||
| **Weighted depth** | 100% | **78.0%** |
|
||||
| **Weighted depth** | 100% | **78.4%** |
|
||||
|
||||
78.0% × 0.830 = **~65%** (range 60–70%).
|
||||
78.4% × 0.830 = **~65%** (range 60–70%).
|
||||
|
||||
### User evidence (GitHub issues, excluding the four maintainers)
|
||||
|
||||
@@ -229,17 +229,16 @@ evidence. The stage stays **alpha**.
|
||||
## Stage
|
||||
|
||||
**Alpha.** Core workflows exist end to end (import, cull, develop, mask, export, catalog migration),
|
||||
but ready-for-real-work is ~61%, below the ~75% beta bar, and the main file formats have blocking
|
||||
gaps: Canon CR3 decodes from sensor data on three verified bodies only, compressed ORF and HE NEF
|
||||
open as previews, and colour on every non-DNG raw is estimated rather than measured.
|
||||
but ready-for-real-work is ~62%, below the ~75% beta bar, and the main file formats have blocking
|
||||
gaps: Canon CR3 decodes from sensor data on 26 verified bodies, compressed ORF decodes on 58 more bodies (2 verified), and HE NEF opens as preview, while colour on every non-DNG raw is estimated rather than measured.
|
||||
|
||||
**Alpha gate:** all six core workflows (import, cull, develop, save and reopen, batch looks, export)
|
||||
work end to end on macOS; see the table in [roadmap.md](roadmap.md#alpha-gate). The partial rows (CR3
|
||||
variants, compressed ORF, HE NEF as previews) degrade but don't block a workflow.
|
||||
variants, HE NEF as previews) degrade but don't block a workflow.
|
||||
|
||||
**To beta:** ~14 points of readiness, **~340–600 h**: the `B` gaps in [gaps.md](gaps.md)
|
||||
(~230–430 h), plus burning down the ~92 open core-path user issues (40–80 h) and stability work
|
||||
around them. Beta needs: CR3, ORF and
|
||||
around them. Beta needs: remaining CR3 variants and
|
||||
HE NEF decoding from sensor data; measured colour for the popular models and a fidelity suite with
|
||||
scores; Subject / Sky / People masks; a lens profile database for the
|
||||
popular lenses; tests in CI on macOS and Windows, and the GPU tests in CI.
|
||||
@@ -300,6 +299,7 @@ P2 items 12–25 h; look tuning, performance, packaging, hardening 25–45 h.
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-11-04 | minor | Compressed ORF decoded (`crates/raw/src/vendor/orfc.rs`): OM-D E-M1 and E-M10 Mark III verified; 58 bodies newly unlocked (78 total across Olympus and OM); RAW coverage 77% → 80%, weighted camera coverage 94% → 97% |
|
||||
| 2026-10-24 | patch | Stability, the stability discount, the Beta-needs list and the estimate history: tests run in CI on Linux x64 since #2667 (FreeBSD nightly), not on macOS or Windows (gap 9); percentages and hours unchanged |
|
||||
| 2026-10-23 | minor | AI Denoise runs without a model (built-in denoiser); percentages unchanged, since it is a classical filter and Bayer-only |
|
||||
| 2026-10-13 | minor | Canon CRW decoded (clean-room, craft-libs `crates/crw/clean-room/`): 551 models verified with the coverage sweep (557 with MRW after merging main), Canon preview rows 21 → 6; RAW decoding unchanged |
|
||||
|
||||
Reference in New Issue
Block a user