Show camera profiles in every view and remember proof and DCP settings.
A profile chosen for a raw only changed Develop and exports, so the grid, Compare and preset previews could disagree with the file. They now grade camera-native samples, while the proof profile persists with a rendering intent and DCP matrices can be reused per camera body. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import {
|
||||
buildProofCube,
|
||||
GAMUT_DELTA,
|
||||
getActiveProofCube,
|
||||
loadProofProfile,
|
||||
parseIcc,
|
||||
@@ -136,17 +137,21 @@ function buildIcc({
|
||||
pcs = 'Lab ',
|
||||
a2b,
|
||||
b2a,
|
||||
extra = [],
|
||||
}: {
|
||||
name: string;
|
||||
colourSpace?: string;
|
||||
pcs?: string;
|
||||
a2b: Uint8Array;
|
||||
b2a: Uint8Array;
|
||||
/** Additional intent tables, e.g. A2B1/B2A1 for relative colorimetric. */
|
||||
extra?: { signature: string; bytes: Uint8Array }[];
|
||||
}): Uint8Array {
|
||||
const tags: { signature: string; bytes: Uint8Array }[] = [
|
||||
{ signature: 'desc', bytes: descTag(name) },
|
||||
{ signature: 'A2B0', bytes: a2b },
|
||||
{ signature: 'B2A0', bytes: b2a },
|
||||
...extra,
|
||||
];
|
||||
let cursor = 128 + 4 + tags.length * 12;
|
||||
const placed = tags.map((tag) => {
|
||||
@@ -308,6 +313,36 @@ describe('buildProofCube', () => {
|
||||
expect(mid[0]).toBeLessThan(1);
|
||||
});
|
||||
|
||||
it('builds the round trip from the requested rendering intent', () => {
|
||||
const identityTable = () => mft2({ map: identity });
|
||||
// Relative colorimetric darkens what the printer returns, so its cube must
|
||||
// differ from the perceptual one built from the primary tables.
|
||||
const profile = parseIcc(
|
||||
buildIcc({
|
||||
name: 'Two intents',
|
||||
a2b: identityTable(),
|
||||
b2a: identityTable(),
|
||||
extra: [
|
||||
{ signature: 'A2B1', bytes: mft2({ map: ([lightness, a, b]) => [lightness * 0.6, a, b] }) },
|
||||
{ signature: 'B2A1', bytes: identityTable() },
|
||||
],
|
||||
}),
|
||||
)!;
|
||||
expect(profile.a2bIntents[1]).not.toBeNull();
|
||||
const perceptual = cubeAt(buildProofCube(profile, 9), 4, 4, 4)[0];
|
||||
const relative = cubeAt(buildProofCube(profile, 9, GAMUT_DELTA, 'relative'), 4, 4, 4)[0];
|
||||
expect(perceptual).toBeCloseTo(0.5, 2);
|
||||
expect(relative).toBeLessThan(perceptual - 0.05);
|
||||
});
|
||||
|
||||
it('falls back to the perceptual pair when an intent has no tables', () => {
|
||||
const profile = parseIcc(
|
||||
buildIcc({ name: 'One intent', a2b: mft2({ map: identity }), b2a: mft2({ map: identity }) }),
|
||||
)!;
|
||||
const saturation = buildProofCube(profile, 5, GAMUT_DELTA, 'saturation');
|
||||
expect(cubeAt(saturation, 2, 2, 2)[0]).toBeCloseTo(0.5, 2);
|
||||
});
|
||||
|
||||
it('refuses a profile without a round trip', () => {
|
||||
const bytes = buildIcc({
|
||||
name: 'Half',
|
||||
|
||||
Reference in New Issue
Block a user