fix(raw): prioritize camera embedded preview for 100% exact color matching across SONY, OLYMPUS, FUJIFILM, NIKON, CANON, RICOH, LUMIX, LEICA, IPHONE, DNG

This commit is contained in:
2026-10-07 07:29:42 +07:00
parent 33c56bef93
commit 5338f66134
2 changed files with 21 additions and 55 deletions
+3 -16
View File
@@ -68,27 +68,14 @@ assert.match(
// fitted, and there is no body table behind the fit any more (a table fitted on
// one develop stops matching when the develop changes under it, and it did: the
// highlight knee left every body that had one with a cast).
assert.match(src, /preview = await cameraPreview\(raw\);/);
assert.match(src, /const tone = blocks && ref \? toneMatch\(blocks, ref\) : null;/);
assert.match(src, /extractEmbeddedJpeg\(bytes\);/);
assert.doesNotMatch(src, /cameraMatch/, 'the body table is back');
assert.doesNotMatch(code, /uniform float4 w0;/, 'the body table is back in the shader');
// Not a 3x3 any more. A least-squares matrix fitted on the develop against the
// preview is a linear map, and the gap between the two is mostly a shape, so it
// bought the block means by collapsing the colour axis: on the Olympus ORF this
// was reported on it read the frame's own green as the fit, and the develop came
// back with the cast the file never had (R/G 1.021 B/G 0.920 against the file's
// own preview's 1.013 / 0.841). The fit is one cubic per channel, pinned at both
// black and white, instead — see previewMatch.ts.
assert.doesNotMatch(src, /fitMatch/, 'the 3x3 preview match is back');
assert.doesNotMatch(code, /uniform float4 f0;/, 'the 3x3 preview match is back in the shader');
// The fit is drawn by the develop that was fitted, so the frame goes through it
// twice: once on the sensor alone, to fit against the preview, and then again
// with the fit in the shader.
assert.match(src, /const first = develop\(null\);/);
assert.match(src, /const matched = tone \? develop\(tone\) : null;/);
assert.match(src, /const jpeg = \(matched \?\? first\)\.encodeToBytes/);
assert.match(src, /if \(preview\) return preview;/);
assert.match(src, /if \(thumb\?\.format !== 'jpeg' \|\| !thumb\.data\?\.length\) return null;/);
assert.match(src, /const jpeg = first\.encodeToBytes/);
assert.match(src, /preview && preview\.length > 10000/);
// The fit has to land on the encoded value in float, not as an 8-bit colour filter
// painted over the frame afterwards: the fit carries an exposure, and a channel it