Extract the format portion of LightCraft cc3eb1c8 (lossy DNG export) preserving tile/quality clamps and RGB edge replication. Application rendering/resize/transfer policy stays in the consumer. Callback ownership and fallible allocation integration by Dylan M. Taylor.
Reuse existing writer and image layout validation rather than cloning RawImage samples or importing another wire writer. Metadata matrices are value copies; profile/opcode tables and pixel data remain borrowed.
Port reusable DCP wire parsing/writing and synthetic tests from LightCraft e87f92fe crates/raw/src/dcp.rs, originally introduced by OneSlip in 8972565249b496ccdf3a7f23321c84622615a353. Reuse existing craft-raw DNG color/profile tag reader and craft-tiff writer instead of copying helpers. App applied_to policy stays in LightCraft.
DNG chapter 7 runs OpcodeList1 on the stored codes, then the
LinearizationTable maps them to sensor values. decode was applying the
table first, so a develop pipeline that later applied list 1 saw already
linearized samples.
When list 1 is present the table is now carried on RawImage and left
unapplied (`linearized` stays false). apply_linearization maps it after
the list. Files without list 1 are unchanged.
The dng-only build already compiles on main (d16ee792 gated
cr3::orientation). A comment at that gate records the E0433 failure
mode.
Part of #778.
A tile's QP map error is reported by its first plane job, so a later tile's
corrupt map no longer wins over an earlier tile's plane error. Equivalence
tests also compare error texts; the corpus test fails when the folder holds
none of the pinned files; docs/cr3.md says when the sensor buffer is allocated.
Part of #1654
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The vertical lifting combined strided columns one at a time; it now lifts
whole rows, per pair of output rows in parallel, with the same integer
equations and edge rules (i64 floor shifts equal the div_euclid it replaces).
The horizontal pass runs its rows in parallel and drops the Result per sample;
overflow is still an error. Differential tests compare both passes with the
previous implementation for every size 1..=17 and every edge combination.
Part of #1654
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every plane of every tile is one parallel task that ends in sensor samples;
the mosaic is then filled per output row pair in parallel, without a modulo,
division, bounds check or Result per sample. The first error in tile and
plane order is still the one reported, and the sensor buffer is allocated
only after every plane has decoded. The CC0 corpus test also pins the four
EOS R5 Mark II files and skips files that are not present.
Part of #1654
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The ten subbands of a plane are separate entropy streams; the first error in
band order is still the one reported. The step is looked up once per band, or
once per QP cell for adaptive gains, instead of once per coefficient.
Part of #1654
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One 8-byte load per ~56 bits instead of a checked 5-byte window per read;
the Rice prefix and its low bits come from one cached word. Escapes and the
end of the stream keep the bit-by-bit path, so results and errors match.
Part of #1654
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
k from leading_zeros, neighbour reads from row slices of one reused
colour-vector buffer, per-quantizer coding parameters computed once,
placement through a precomputed map. Output unchanged; adds a
differential test against the previous decoder and an optional corpus test.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Ported from storytold/lightcraft#3796. The Z 6 and Z 7 join the bodies whose
NikonNEFInfo distortion becomes an OpcodeList3 warp. Three Z 6 and three Z 7
CC0 raw.pixls.us files (NIKKOR Z 24-70mm f/4 S) were matched against the
camera's embedded JPEG: the corrected radial median error is 0.88-0.96 px on
the Z 6 and 1.37-1.46 px on the Z 7, from 83-84 px and 124-125 px uncorrected.
The method and results are in crates/raw/docs/nikon-lens-corrections.md.
DistortionInfo's mode byte must now be 1 (On, optional) or 3 (On, required).
Mode 2 (Off) and unknown modes give no warp, where before only 0 was skipped,
so mode-2 files from the Z 6II, Z 8 and Z f no longer get a warp.