Skip to content

Fidelity

botrx555 edited this page Jul 14, 2026 · 3 revisions

Fidelity

Arvid's tool ships as a closed-source binary - there is no published source to build on - so m8raw2dng2 is an independent clean-room reimplementation: its converter logic was written from observed input/output behaviour, not ported from his code. The binary was later disassembled only to verify and document that behaviour (Binary Internals) - reading out functional facts such as constants, tag numbers and file layout, never source - which is what the fidelity results below are checked against. The DNG is emitted by a small purpose-built little-endian TIFF/DNG writer (not a generic library) so the bytes line up, and the output was byte-diffed against real reference DNGs from the original until everything matched except the one field the original only estimates (FNumber).

How parity was verified

Output was byte-diffed, tag by tag and across the full 21 MB CFA strip, against a corpus of real reference DNGs from the original tool: dark-frame exposures (4 s to 1/8000, with their .BIA sidecars) and dialled aperture series. The darkfield build (-sd) reproduces the original's per-column LevelCorrection at correlation ~0.955 (mean absolute difference ~0.011), with the recorded defect column zeroed. On the plain path, everything matched byte-for-byte except the estimated FNumber; -s is near-exact (within +/-1 DN, see below).

Parity guarantees

Invocation Result
-v (no -A) Byte-identical except the 3 bytes of the estimated FNumber. Full 21 MB CFA strip, all 47 IFD0 + 21 EXIF tags and the verbatim MakerNote match exactly.
-v -A f 100% byte-identical (zero differing bytes).
-l (coded-lens aperture) Byte-identical, including lens EXIF.
-b Pixels byte-identical (the CFA is never edited); writes a BlackLevel tag. The original also writes one under -b (base_black x ISO gain, e.g. 1472 at ISO 2500, tag-only); m8raw2dng2's plain -b is flat 92, so the two agree at base ISO and under -s -b, and diverge under plain -b at high ISO. Neither writes one on a bare -v.
.BIA dark subtraction By-design divergence: subtracts the dark frame and writes BlackLevel=0. The original ignores an adjacent .BIA.
-s Near-exact: within +/-1 DN on 100% of pixels. The per-column LevelCorrection reproduces the original's at correlation ~0.955; darkfield and BlackLevel are gain-scaled together at high ISO. Defect-column repair (--auto-lines) is a by-design divergence - the original leaves stuck columns as raw.

What this means

Plain -v output is byte-for-byte the original's except the estimated FNumber; every refinement is opt-in. -s is near-exact (within +/-1 DN). If you need a provably exact reproduction of the original's output, use -v -A <exact-aperture> for a zero-difference DNG.

The one field that cannot be byte-matched on the default path is FNumber, because the original only ever estimates it for an un-coded lens - there is no "true" value in the file to match. m8raw2dng2's aperture recovery (see The Math) is more accurate than that estimate, which is why the default path differs by exactly those bytes.

Clone this wiki locally