Egami.Formats.Extended: camera RAW stage B (maker formats) #220
All Vouch review confidence checks passed
Residual risk 0.30 = Change Risk (0.57) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.57 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #220"
general
weight: 0.35
claude[bot]
<!-- claude-projects-attribution: {"github_login":"inexin"} -->
_Requested by Lars_
What this changes
RAW Build Plan stage B (tasks 6 to 10): the maker RAW formats in Egami.Formats.Extended. Nothing is released; RAW ships later with stages C and D.
RawFormatnow also reads Canon CR2 (with sRAW and mRAW), Nikon NEF and NRW, Pentax PEF, Sony ARW and SR2, Olympus ORF, Panasonic RW2 (RawFormat 4 to 8) and Fujifilm RAF (uncompressed 16-bit and 12-bit, and the compressed codec: lossless and lossy, X-Trans and Bayer, 12 to 16 bits). Each maker's white balance, black levels and crops come from the file and its maker note (ExifTool's public tag pages read as facts). Sony's SR2 private IFD is decrypted for levels and white balance.tools/make-raw-camera-table.pyfrom Adobe DNG Converter's output on one CC0 raw.pixls.us sample each (black box). It gives colour matrices, BaselineExposure, and the levels and crops a file does not give. It also records each RAF sample's exposure bias (so a Fuji DR setting moves the baseline exposure as in Adobe's DNGs) and each Canon body's sRAW white level. The tool now measures full-resolution samples only; 16 Canon bodies had been measured from sRAW files before, so their lines changed.RawReaderOptions.LensProfiles(plus system Lensfun folders); no profile data ships; the CC BY-SA status of Lensfun's data is in the docs.RawDetails.LensProfilenames what was applied. An automatic lateral CA correction for files nothing covers is behind the newRawReaderOptions.AutoChromaticAberration(off by default, because it costs about as much as the demosaic).Public API added (for API review)
RawReaderOptions.LensProfiles(IReadOnlyList<string>),RawReaderOptions.AutoChromaticAberration(bool),RawDetails.LensProfile(string?).RawFormat.Infogains the extensions and MIME types of the maker formats.Decoders against Adobe DNG Converter (black box)
I converted each CC0 sample with
Adobe DNG Converter -uand compared Egami'sRawOutput.Mosaicwith the DNG's raw data, sample by sample, over the DNG's area:| Files | Result |
| --- | --- |
| RAF: X-T3 (lossless and uncompressed), X-T4 lossless, X-T5, X-H2S and X-E5 lossy X-Trans, GFX 50S lossless Bayer, GFX100 II lossy 14-bit, GFX100S lossless 16-bit, X-M1 12-bit packed, X-E2 uncompressed | bit-exact (11 files, up to 102 M samples each) |
| Canon 350D; Nikon D850, Z 7; Olympus E-M10; Panasonic GH5, GH6 (RawFormat 8), S1, S1H (RawFormat 6); Pentax K-3, K-5; Sony A6000 | bit-exact (11 files) |
| Panasonic GH4 | 47 of 12 M differ by at most 21: the camera's zeroed defective pixels, which Adobe fills its own way |
| Sony A7 IV lossless | 4,070 saturated samples above 16383, which Adobe clips to the white level (the develop clips them too) |
| Canon sRAW and mRAW: 40D, 5D Mark II, 5D Mark III, 6D, 70D, 80D | within 1 code value (rounding of the chroma interpolation) |
| Canon 7D mRAW (set A) | within about 2 %. [L]'s hue offset for this body; Adobe matches a hue of
f × 2instead (open point below) || Nikon D90 | not comparable this way: Adobe stores the pre-curve values plus a linearization table |
The Nikon D850 and Z 7 results check the [L] initial-predictor order on real files, and GH6 checks the RawFormat 8 green mapping. The synthetic test
NikonInitialPredictorsFollowTheSpecOrderfails loudly if the order is swapped.With baseline exposure and the profile look off, Egami's develop of each RAF matches Egami's develop of Adobe's DNG of it within 0.05 % mean absolute difference. White balance, matrices, levels and crop all agree. With them on, the per-file exposure bias makes the X-T5 file match as well.
Against LibRaw (Magick.NET 14.17.2, camera WB, AHD, no auto-bright), mean ΔE76
| File | ΔE76 | | File | ΔE76 |
| --- | --- | --- | --- | --- |
| Sony A6000 | 1.01 | | Fuji X-E5 lossy | 1.31 |
| Nikon D90 | 1.58 | | Fuji X-M1 12-bit | 1.61 |
| Canon 40D sRAW | 1.89 | | Canon 5D II sRAW | 0.80 |
| Canon 350D | 2.79 | | Panasonic GH5 | 2.95 |
| Fuji X-H2S lossy | 3.31 | | Nikon Z 7 | 3.88 |
| Fuji X-T5 | 4.09 | | Fuji GFX 50S | 4.14 |
| Olympus E-M10 | 4.32 | | Nikon D850 | 4.61 |
| Panasonic S1H | 4.76 | | Panasonic GH4 | 5.53 |
| Pentax K-3 | 5.70 | | Panasonic GH6 | 5.96 |
| Fuji X-T4 | 6.27 | | Sony A7 IV | 6.53 |
| Panasonic S1 | 8.95 | | Fuji X-T3 | 12.0 |
| Pentax K-5 | 23.9 | | Canon 7D mRAW | 16.2 |
Where these are large, Egami agrees with Adobe and LibRaw differs:
The formal gates are stage D in egami-compare.
Open points (no decision needed for this PR)
1. Sony A100: the ARW1 data at its SubIFD offset decodes as noise with every layout I tried, so it is refused with
NotSupportedException. The study spec also lists it as unconfirmed.2. Canon 7D mRAW: [L]'s hue rule gives
(f + 1) × 4for this body; Adobe's values matchf × 2. I kept the spec's rule.3. Fujifilm GFX 100 files (100 MP) need
MaxTotalBytesabove the 2 GB default for a full develop; previews, half size and mosaic fit. This is already true for 100 MP DNGs in stage A, and the docs say so.4. Not read, as planned: CR3 (stage C), SRF, sNEF, Nikon HE, pre-2012 non-TIFF RAFs and 14-bit packed RAFs (no sample).
Provenance (required)
src/beyond the approved ones indocs/references.md.Sources used:
- Fujifilm compressed RAF, sections 2 to 10
- NEF, sections 3 to 6
- PEF
- ARW, sections 3 to 7
- ORF, sections 4 to 6
- RW2, RawFormat 4 to 8
- CR2, sections 3 to 6
A separate, study-only session wrote those specs after reading LibRaw and rawspeed for structure only, under Lars's 2026-10-24 study-only rule. The implementing session (this one) never opened LibRaw, rawspeed, dcraw, darktable, RawTherapee or ExifTool source. Nothing was copied, ported or paraphrased from them. docs/references.md now says this in the camera RAW paragraph.
- Adobe DNG Converter: the camera table, bit-exact comparisons, the Fuji bias and sRAW white facts
- LibRaw through Magick.NET: ΔE comparisons
- Fuji 12-bit uncompressed packing: least significant bits first, found from image smoothness
- Panasonic zero pixels: found by comparing with Adobe's DNGs
Nothing was translated from a permissive library, so THIRD-PARTY-NOTICES.md is unchanged.
Testing
- Fujifilm compressed round trip through a test-only encoder (spec section 10) for X-Trans and Bayer, 12, 14 and 16 bits, including a narrow last strip
- the RAF container
- refusal of a compressed RAF with a different X-Trans phase
- Nikon initial-predictor order
- the header-arithmetic fuzz regression
- lens profile and auto CA tests
Egami.Formats.Extended.Tests: 216 passed, 4 skipped.Egami.DocSamples: 630 passed;Text.InstalledFontsfails on this PC on main too (installed fonts).dotnet format Egami.slnx --verify-no-changes: clean.python tools/check-docs.py src/Egami.Formats.Extended: 0 problems.- first run: 3 crashes, all the header overflow, fixed
- rerun after the fix: 0 crashes, 0 hangs
RawBenchmarks, 3000 × 2000 14-bit, one thread, BenchmarkDotNet medium job):| Develop | main | this PR |
| --- | --- | --- |
| Mosaic | 90.3 ms ± 2.4 | 85.3 ms ± 2.9 |
| HalfSize | 160.0 ms ± 15.1 | 138.3 ms ± 5.9 |
| Bilinear | 253.8 ms ± 14.0 | 248.0 ms ± 12.5 |
| Malvar | 264.3 ms ± 11.6 | 230.6 ms ± 4.2 |
| Ahd | 793.1 ms ± 14.2 | 823.6 ms ± 36.6 |
| Default | 1,261.8 ms ± 49.0 | 1,155.1 ms ± 44.4 |
AHD is within its error bars; the AHD code is unchanged. Before
AutoChromaticAberrationbecame opt-in, every develop was about 0.9 s slower; that is why it is off by default.Maker files (
RawMakerBenchmarks, new; one thread; main has no maker decoders, so there is no before):| File | Codec | Mosaic (decode) | Default develop |
| --- | --- | --- | --- |
| Canon 350D (8 MP) | CR2 lossless JPEG | 139 ms | 2.27 s |
| Canon 80D sRAW2 (6 MP) | CR2 sRAW | 247 ms | 1.00 s |
| Nikon D850 (46 MP) | NEF Huffman | 420 ms | 6.98 s |
| Olympus E-M10 (16 MP) | ORF | 798 ms | 4.64 s |
| Panasonic GH6 (25 MP) | RW2 RawFormat 8 | 831 ms | 6.74 s |
| Pentax K-3 (24 MP) | PEF Huffman | 317 ms | 6.30 s |
| Sony A6000 (24 MP) | ARW2 | 139 ms | 6.11 s |
| Fuji X-T3 (26 MP) | RAF compressed lossless, X-Trans | 1.55 s | 8.08 s |
| Fuji X-E5 (40 MP) | RAF compressed lossy, X-Trans | 2.73 s | 12.06 s |
| Fuji GFX 50S (51 MP) | RAF compressed lossless, Bayer | 2.84 s | 19.48 s |
BenchmarkDotNet short job, one thread (
MaxParallelism = 1), so these are CPU totals; with the default parallelism a 26 MP develop takes about 0.7 to 1 s on this PC. The Fuji rows were rerun after the table fix; before it, the lossy X-E5 mosaic allocated 167 MB and now 0.9 MB.Checklist
git commit -s)PublicAPI.Unshipped.txt🤖 Generated with Claude Code