@photivra/engine 2.9.0 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/CHANGELOG.md +85 -1
  2. package/CITATION.cff +1 -1
  3. package/README.md +6 -6
  4. package/SECURITY.md +1 -1
  5. package/THIRD_PARTY.md +2 -0
  6. package/dist/capture/native-environment-lean.js +89 -5
  7. package/dist/capture/native-environment-lean.js.map +1 -1
  8. package/dist/capture/native-environment-tabulated.d.ts +37 -0
  9. package/dist/capture/native-environment-tabulated.js +42 -6
  10. package/dist/capture/native-environment-tabulated.js.map +1 -1
  11. package/dist/core/portable-math.d.ts +13 -0
  12. package/dist/core/portable-math.js +43 -0
  13. package/dist/core/portable-math.js.map +1 -1
  14. package/dist/core/version.d.ts +1 -1
  15. package/dist/core/version.js +1 -1
  16. package/dist/core/version.js.map +1 -1
  17. package/dist/facade/channel-response.d.ts +15 -0
  18. package/dist/facade/channel-response.js +33 -0
  19. package/dist/facade/channel-response.js.map +1 -0
  20. package/dist/facade/diffraction-provider.js +50 -15
  21. package/dist/facade/diffraction-provider.js.map +1 -1
  22. package/dist/facade/display-view.d.ts +75 -0
  23. package/dist/facade/display-view.js +471 -109
  24. package/dist/facade/display-view.js.map +1 -1
  25. package/dist/facade/expected-signal-setup.js +2 -1
  26. package/dist/facade/expected-signal-setup.js.map +1 -1
  27. package/dist/facade/expected-signal.d.ts +32 -3
  28. package/dist/facade/expected-signal.js +192 -24
  29. package/dist/facade/expected-signal.js.map +1 -1
  30. package/dist/facade/simulate-capture.d.ts +51 -4
  31. package/dist/facade/simulate-capture.js +130 -31
  32. package/dist/facade/simulate-capture.js.map +1 -1
  33. package/dist/facade/simulate-display-view.d.ts +25 -2
  34. package/dist/facade/simulate-display-view.js +55 -22
  35. package/dist/facade/simulate-display-view.js.map +1 -1
  36. package/dist/gpu/image-kernel-execution.d.ts +5 -0
  37. package/dist/gpu/image-kernel-execution.js +2 -2
  38. package/dist/gpu/image-kernel-execution.js.map +1 -1
  39. package/dist/index.d.ts +2 -2
  40. package/dist/index.js +2 -2
  41. package/dist/index.js.map +1 -1
  42. package/dist/optics/irradiance-convolution.d.ts +11 -0
  43. package/dist/optics/irradiance-convolution.js +64 -24
  44. package/dist/optics/irradiance-convolution.js.map +1 -1
  45. package/dist/optics/scene-to-sensor-irradiance.d.ts +13 -0
  46. package/dist/optics/scene-to-sensor-irradiance.js +58 -24
  47. package/dist/optics/scene-to-sensor-irradiance.js.map +1 -1
  48. package/dist/optics/sensor-aperture-rays.js +2 -1
  49. package/dist/optics/sensor-aperture-rays.js.map +1 -1
  50. package/dist/optics/sensor-environment-query.js +4 -3
  51. package/dist/optics/sensor-environment-query.js.map +1 -1
  52. package/dist/optics/site-diffraction-kernel.d.ts +16 -0
  53. package/dist/optics/site-diffraction-kernel.js +60 -8
  54. package/dist/optics/site-diffraction-kernel.js.map +1 -1
  55. package/dist/processing/demosaic.js +114 -37
  56. package/dist/processing/demosaic.js.map +1 -1
  57. package/dist/schema/scene-radiance.d.ts +8 -0
  58. package/dist/schema/scene-radiance.js +28 -17
  59. package/dist/schema/scene-radiance.js.map +1 -1
  60. package/dist/sensor/environment-photo-signal.d.ts +21 -0
  61. package/dist/sensor/environment-photo-signal.js +68 -2
  62. package/dist/sensor/environment-photo-signal.js.map +1 -1
  63. package/docs/API_REFERENCE.md +16 -1
  64. package/docs/QUICK_START.md +18 -8
  65. package/docs/USAGE.md +30 -0
  66. package/docs/api/core-version.md +1 -1
  67. package/docs/api/exports.json +42 -2
  68. package/docs/api/facade-display-view.md +50 -0
  69. package/docs/api/facade-simulate-capture.md +60 -8
  70. package/docs/api/facade-simulate-display-view.md +23 -1
  71. package/docs/api/gpu-image-kernel-execution.md +5 -0
  72. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"expected-signal.js","sourceRoot":"","sources":["../../src/facade/expected-signal.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC;;;;G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ent":["// SPDX-License-Identifier: Apache-2.0\n\n/**\n * The tabulated expected signal (2.6 display view; #394 also the capture's tabulated RAW path): expected photo electrons of\n * real native sites for a still, rectilinear, distortion-free planar scene. Kept apart from display-view.ts so a bundle that\n * only captures does not contain the display view or the portable functions it uses (issue #380).\n */\n\nimport { InvalidConfigurationError } from \"../core/configuration-error.js\";\n\n/** A query offset from a site centre in sites (+x right, +y down) and its weight (pixel-aperture node × filter spot). */\nexport interface DisplayViewQueryOffset { x: number; y: number; weight: number }\n\n/** Scene access for the expected signal: chart materials (fast tables) or a radiance function. */\nexport type DisplayViewScene =\n | { kind: \"materials\"; materialAt(u: number, v: number): number;\n /** Per material: `{ neutral: reflectance }` (radiance = reflectance × illuminant) or the spectral radiance at each node. */\n materials: readonly ({ neutral: number } | { radiance: Float64Array })[];\n /** Illuminant radiance of a perfect white diffuser at each spectral node: irradianceScale·shape(λ)/π. */\n whiteRadiance: Float64Array }\n | { kind: \"radiance\"; radianceAt(u: number, v: number, nm: number): number };\n\nexport interface DisplayViewExpectedSignalInput {\n nativeWidth: number;\n nativeHeight: number;\n /** Frame output width: plane coordinates are 2 / outputWidth frame units per site. */\n outputWidth: number;\n /** Spectral nodes and, per CFA channel (red, green, blue), the expected electrons per unit spectral radiance at each node. */\n wavelengthsNm: readonly number[];\n electronsPerRadiance: readonly [Float64Array, Float64Array, Float64Array];\n offsets: readonly DisplayViewQueryOffset[];\n /** Diffraction: per-node kernels on the site lattice, (2R + 1)² taps in row-major order, out(x) = Σ in(x − t)·K(t). */\n kernels?: { radius: number; perNode: readonly Float64Array[] };\n scene: DisplayViewScene;\n /** CFA channel index (0 red, 1 green, 2 blue) of native site (x, y). */\n channelAt(x: number, y: number): number;\n /**\n * Without diffraction: the plane point (frame units) that the environment queries for offset `o` of native site (x, y),\n * computed with the environment's own arithmetic, so points that fall exactly on a chart boundary resolve to the same\n * material as in the capture. With diffraction the facade's object-space convolution uses the lattice formula, as here.\n */\n queryPoint?(x: number, y: number, offset: number, out: Float64Array): void;\n}\n\n/** Expected photo electrons of real native sites. */\nexport interface DisplayViewExpectedSignal {\n /**\n * Starts a new cache window: native sites [x0, x1) × [y0, y1) that the following `site` calls mostly read. Sites and\n * scene lookups inside it are computed once; anything outside is computed without caching.\n */\n window(x0: number, y0: number, x1: number, y1: number): void;\n /** Expected photo electrons of native site (x, y) for its own CFA channel (x, y inside the native raster). */\n site(x: number, y: number): number;\n /** A cheap classifier value of the scene at plane point (u, v) frame units: the material, or the radiance at one node. */\n pilot(u: number, v: number): number;\n /** Scene lookups performed so far (material or radiance queries), for diagnostics. */\n readonly lookups: number;\n /**\n * The chart material that every kernel tap of the last `site` call read, when they all read one material (its value is\n * then a function of that material and the site's CFA channel only); −1 when unknown or mixed.\n */\n readonly uniformMaterial: number;\n /** Whether `uniformMaterial` is tracked in the current window (otherwise it is not meaningful). */\n readonly tracksMaterial: boolean;\n /**\n * Whether the current window caches its sites: a second `site` call for a site inside the window then returns the stored\n * value without any work or lookup (#392).\n */\n readonly cachesSites: boolean;\n}\n\nconst OFFSET_TOLERANCE = 1e-9;\n/** Largest cache window, in sites or lattice points; larger windows are evaluated without caching. */\nconst CACHE_LIMIT = 1 << 22;\n/** Largest band of looked-up lattice materials per group, in lattice points (a band that would be larger restarts at the window). */\nconst BAND_LIMIT = 1 << 22;\n/**\n * Lattice-row ring (refinement windows): rows kept per group, the tallest band that uses it, and the columns kept beyond each\n * raster edge (kernel radius, demosaic reach and query offsets; columns beyond it are looked up directly).\n */\nconst LATTICE_RING_ROWS = 128, LATTICE_RING_MAXIMUM_BAND_ROWS = 64, LATTICE_RING_MARGIN = 64;\n\n/** The tables of `createDisplayViewExpectedSignal` that depend only on its input (see there), cached per input object. */\ninterface PreparedSignal {\n reflectance: Float64Array; spectralIndex: Int32Array; spectral: Float64Array[]; groups: Group[]; neutralDirect: number[]; spectralDirect: number[][]; uniformSite: Float64Array[];\n /** The filled path's lattice material rings, per group (created on first use). */\n rings: ({ width: number; material: Int16Array | Int32Array; rowId: Int32Array } | undefined)[];\n}\nconst PREPARED = new WeakMap<DisplayViewExpectedSignalInput, PreparedSignal>();\ninterface Group { fx: number; fy: number; members: { ix: number; iy: number; weight: number }[]; minIx: number; maxIx: number; minIy: number; maxIy: number;\n cw: number; ch: number; neutral: Float64Array[]; spectral: Float64Array[][]; perNode: Float64Array[][]; cache: Int32Array | Float64Array; cx0: number; cy0: number; cpw: number; cph: number }\nfunction prepareSignal(input: DisplayViewExpectedSignalInput): PreparedSignal {\n const nodes = input.wavelengthsNm.length, R = input.kernels ? input.kernels.radius : 0, size = 2 * R + 1;\n const A = input.electronsPerRadiance, scene = input.scene, offsets = input.offsets;\n const kernelAt = (node: number, t: number): number => (input.kernels ? input.kernels.perNode[node]![t]! : 1);\n // Materials: neutral ones by reflectance, spectral ones by index.\n let reflectance = new Float64Array(0), spectralIndex = new Int32Array(0);\n const spectral: Float64Array[] = [];\n if (scene.kind === \"materials\") {\n reflectance = new Float64Array(scene.materials.length); spectralIndex = new Int32Array(scene.materials.length).fill(-1);\n scene.materials.forEach((m, index) => { if (\"neutral\" in m) reflectance[index] = m.neutral; else { spectralIndex[index] = spectral.length; spectral.push(m.radiance); } });\n }\n // Offsets grouped by fractional shift: offsets that differ by whole sites share one lattice.\n const frac = (v: number): number => { const f = v - Math.floor(v); return f > 1 - OFFSET_TOLERANCE || f < OFFSET_TOLERANCE ? 0 : f; };\n const groups: Group[] = [];\n for (const o of offsets) {\n const fx = frac(o.x), fy = frac(o.y), ix = Math.round(o.x - fx), iy = Math.round(o.y - fy);\n let group = groups.find((q) => Math.abs(q.fx - fx) <= OFFSET_TOLERANCE && Math.abs(q.fy - fy) <= OFFSET_TOLERANCE);\n if (!group) { group = { fx, fy, members: [], minIx: ix, maxIx: ix, minIy: iy, maxIy: iy, cw: 0, ch: 0, neutral: [], spectral: [], perNode: [], cache: new Int32Array(0), cx0: 0, cy0: 0, cpw: 0, cph: 0 }; groups.push(group); }\n group.members.push({ ix, iy, weight: o.weight });\n group.minIx = Math.min(group.minIx, ix); group.maxIx = Math.max(group.maxIx, ix); group.minIy = Math.min(group.minIy, iy); group.maxIy = Math.max(group.maxIy, iy);\n }\n if (input.kernels) for (const group of groups) {\n // Combined kernel over lattice offsets d = (ix − tu, iy − tv), stored at (d − min + R).\n const cw = group.maxIx - group.minIx + size, ch = group.maxIy - group.minIy + size;\n group.cw = cw; group.ch = ch;\n const combine = (value: (c: number, node: number, t: number) => number): Float64Array[] => [0, 1, 2].map((c) => {\n const out = new Float64Array(cw * ch);\n for (const member of group.members) for (let tv = -R, t = 0; tv <= R; tv++) for (let tu = -R; tu <= R; tu++, t++) {\n let sum = 0;\n for (let n = 0; n < nodes; n++) sum += value(c, n, t);\n const index = (member.iy - tv - group.minIy + R) * cw + (member.ix - tu - group.minIx + R);\n out[index] = out[index]! + member.weight * sum;\n }\n return out;\n });\n if (scene.kind === \"materials\") {\n group.neutral = combine((c, n, t) => A[c]![n]! * kernelAt(n, t) * scene.whiteRadiance[n]!);\n const perMaterial = spectral.map((radiance) => combine((c, n, t) => A[c]![n]! * kernelAt(n, t) * radiance[n]!));\n group.spectral = [0, 1, 2].map((c) => perMaterial.map((tables) => tables[c]!));\n } else {\n // Radiance scenes: combined kernels per node, applied to the cached radiance at each node.\n group.perNode = Array.from({ length: nodes }, (_, n) => combine((c, node, t) => (node === n ? A[c]![n]! * kernelAt(n, t) : 0)));\n }\n }\n // Neutral tap-0 signal per channel and spectral per material, for the direct (no-kernel) path.\n const neutralDirect = scene.kind === \"materials\" ? [0, 1, 2].map((c) => { let s = 0; for (let n = 0; n < nodes; n++) s += A[c]![n]! * scene.whiteRadiance[n]!; return s; }) : [];\n const spectralDirect = [0, 1, 2].map((c) => spectral.map((radiance) => { let s = 0; for (let n = 0; n < nodes; n++) s += A[c]![n]! * radiance[n]!; return s; }));\n const uniformSite = scene.kind === \"materials\" && input.kernels ? [0, 1, 2].map((c) => Float64Array.from(scene.materials, (_, m) => {\n const si = spectralIndex[m]!;\n let sum = 0;\n for (const group of groups) {\n const nk = group.neutral[c]!, sk = si < 0 ? nk : group.spectral[c]![si]!;\n for (let t = 0; t < group.cw * group.ch; t++) sum += si < 0 ? reflectance[m]! * nk[t]! : sk[t]!;\n }\n return sum;\n })) : [];\n const prepared = { reflectance, spectralIndex, spectral, groups, neutralDirect, spectralDirect, uniformSite, rings: groups.map(() => undefined) };\n PREPARED.set(input, prepared);\n return prepared;\n}\n\n/**\n * Expected photo electrons per site: μ_c(i, j) = Σ_o w_o Σ_λ A_c(λ) Σ_t K_λ(t)·L(p_o(i, j) − t, λ), where p_o is the\n * query point of offset o and K the diffraction kernel (a single unit tap without diffraction). This is the sum the\n * facade's environment chain forms for a still, rectilinear, distortion-free planar scene, where the\n * radiance-to-irradiance factor is the same at every site (docs/DISPLAY_VIEW.md, \"Expected signal\").\n *\n * With diffraction, offsets that share a fractional shift read one lattice, and their kernels are combined in advance:\n * C_c(d) = Σ_members w·Σ_λ A_c(λ)·K_λ(t)·L(λ) over the taps t that reach lattice offset d. A neutral material's radiance\n * is its reflectance times the white radiance, so all neutral materials share one combined kernel per channel.\n *\n * `spanColumns`: how many native columns the render's windows move across beyond one window's width (a filled band is never\n * built wider). Only a speed hint: a window past it rebuilds its band, with the same values.\n */\nexport function createDisplayViewExpectedSignal(input: DisplayViewExpectedSignalInput, spanColumns = Infinity): DisplayViewExpectedSignal {\n const W = input.nativeWidth, H = input.nativeHeight, g = 2 / input.outputWidth, nodes = input.wavelengthsNm.length;\n const R = input.kernels ? input.kernels.radius : 0;\n if (input.kernels && input.kernels.perNode.length !== nodes) throw new InvalidConfigurationError(\"Display view kernels must match the spectral nodes.\");\n if (!input.kernels && !input.queryPoint) throw new InvalidConfigurationError(\"Display view needs the environment query points without diffraction.\");\n const A = input.electronsPerRadiance, scene = input.scene, offsets = input.offsets, channelAt = input.channelAt;\n // The request's tables (materials, lattice groups, combined kernels, per-material sums) are the same for every render of a\n // prepared view, which passes the same input object: computed once per input. Each render gets its own groups' window caches.\n const prepared = PREPARED.get(input) ?? prepareSignal(input);\n const { reflectance, spectralIndex, spectral, neutralDirect, spectralDirect, uniformSite } = prepared;\n const groups: Group[] = prepared.groups.map((group) => ({ ...group, cache: new Int32Array(0), cx0: 0, cy0: 0, cpw: 0, cph: 0 }));\n let lookups = 0;\n const point = new Float64Array(2);\n const materialSignalDirect = (m: number, c: number): number => {\n const si = spectralIndex[m];\n if (si === undefined) throw new InvalidConfigurationError(\"Unknown chart material.\");\n return si < 0 ? reflectance[m]! * neutralDirect[c]! : spectralDirect[c]![si]!;\n };\n /** Without diffraction: one site from the environment's own query points. */\n function directSite(x: number, y: number): number {\n const c = channelAt(x, y);\n let sum = 0;\n for (let o = 0; o < offsets.length; o++) {\n input.queryPoint!(x, y, o, point);\n let value: number;\n if (scene.kind === \"materials\") { value = materialSignalDirect(scene.materialAt(point[0]!, point[1]!), c); lookups++; }\n else { value = 0; for (let n = 0; n < nodes; n++) value += A[c]![n]! * scene.radianceAt(point[0]!, point[1]!, input.wavelengthsNm[n]!); lookups += nodes; }\n sum += offsets[o]!.weight * value;\n }\n return sum;\n }\n // Lattice point (p, q) of a group: the facade's lattice formula (createDiffractedPlanarProvider).\n const latticeU = (group: Group, p: number): number => (group.fx === 0 ? (p + 0.5 - W / 2) * g : (p + 0.5 + group.fx - W / 2) * g);\n const latticeV = (group: Group, q: number): number => (group.fy === 0 ? -(q + 0.5 - H / 2) * g : -(q + 0.5 + group.fy - H / 2) * g);\n const radianceScratch = new Float64Array(nodes);\n /** Material (or radiance at each node, into radianceScratch) of a group's lattice point, from the window cache when it holds it. */\n function latticeMaterial(group: Group, p: number, q: number): number {\n const i = p - group.cx0, j = q - group.cy0, cached = i >= 0 && j >= 0 && i < group.cpw && j < group.cph;\n if (cached) { const m = group.cache[j * group.cpw + i]!; if (m >= 0) return m; }\n const m = (scene as Extract<DisplayViewScene, { kind: \"materials\" }>).materialAt(latticeU(group, p), latticeV(group, q));\n lookups++;\n if (cached) group.cache[j * group.cpw + i] = m;\n return m;\n }\n function latticeRadiance(group: Group, p: number, q: number): Float64Array {\n const i = p - group.cx0, j = q - group.cy0, cached = i >= 0 && j >= 0 && i < group.cpw && j < group.cph, cache = group.cache as Float64Array;\n if (cached && !Number.isNaN(cache[(j * group.cpw + i) * nodes]!)) { for (let n = 0; n < nodes; n++) radianceScratch[n] = cache[(j * group.cpw + i) * nodes + n]!; return radianceScratch; }\n const u = latticeU(group, p), v = latticeV(group, q);\n for (let n = 0; n < nodes; n++) radianceScratch[n] = (scene as Extract<DisplayViewScene, { kind: \"radiance\" }>).radianceAt(u, v, input.wavelengthsNm[n]!);\n lookups += nodes;\n if (cached) for (let n = 0; n < nodes; n++) cache[(j * group.cpw + i) * nodes + n] = radianceScratch[n]!;\n return radianceScratch;\n }\n /** With diffraction: one site through the combined kernels on each group's lattice. */\n function kernelSite(x: number, y: number): number {\n const c = channelAt(x, y);\n let sum = 0;\n for (const group of groups) {\n const p0 = x + group.minIx - R, q0 = y + group.minIy - R, cw = group.cw, ch = group.ch;\n if (scene.kind === \"materials\") {\n const nk = group.neutral[c]!, sk = group.spectral[c]!;\n for (let dy = 0; dy < ch; dy++) for (let dx = 0; dx < cw; dx++) {\n const m = latticeMaterial(group, p0 + dx, q0 + dy), si = spectralIndex[m];\n if (si === undefined) throw new InvalidConfigurationError(\"Unknown chart material.\");\n sum += si < 0 ? reflectance[m]! * nk[dy * cw + dx]! : sk[si]![dy * cw + dx]!;\n }\n } else {\n for (let dy = 0; dy < ch; dy++) for (let dx = 0; dx < cw; dx++) {\n const radiance = latticeRadiance(group, p0 + dx, q0 + dy);\n for (let n = 0; n < nodes; n++) sum += group.perNode[n]![c]![dy * cw + dx]! * radiance[n]!;\n }\n }\n }\n return sum;\n }\n // Filled windows (chart materials with diffraction, every lattice point of the window cacheable): each group keeps a band of\n // looked-up lattice materials that covers the window's rows and grows to the right as the windows of a display row move\n // right, with summed-area tables of material changes. A site whose kernel reads one material only (each group's rectangle\n // uniform, the same material in all) takes the value of the same sum over that material, precomputed below in the same\n // order; other sites run the same sum from the band. Either way each site's value is the same sequence of operations as\n // kernelSite, so it is bit-identical. The scene lookup count stays the count kernelSite's lazy window cache makes (each\n // cache point a computed site reads counts once per window, points outside the cache once per read): the rectangles of\n // the sites computed in a window are counted when the window closes (windowLookups).\n const allNeutral = spectral.length === 0;\n /**\n * A group's band: lattice rows [y0, y0 + rows), columns [x0, x0 + filled) looked up, row stride `capacity`. `material`,\n * `reflectance` (neutral-only charts) and the summed-area tables of left changes (`changeLeft`, 1 where a point's material\n * differs from its left neighbour's) and upper changes (`changeUp`), (rows + 1) × (capacity + 1).\n */\n interface Band { x0: number; y0: number; rows: number; capacity: number; filled: number; material: Int32Array; reflectance: Float64Array; changeLeft: Int32Array; changeUp: Int32Array; v: Float64Array }\n const bands: Band[] = groups.map(() => ({ x0: 0, y0: 0, rows: 0, capacity: 0, filled: 0, material: new Int32Array(0), reflectance: new Float64Array(0),\n changeLeft: new Int32Array(0), changeUp: new Int32Array(0), v: new Float64Array(0) }));\n // Lattice rows of material indices per group, kept across windows (filled windows only): rows LATTICE_RING_ROWS apart share a\n // slot; columns from −LATTICE_RING_MARGIN. Int16 when every index fits (about 3 MB for four groups of a 6000-site row). A\n // lattice point's material depends only on the input, so the rings are kept with its prepared tables, across renders.\n const ringWide = scene.kind === \"materials\" && scene.materials.length <= 32767;\n const rings = prepared.rings;\n function latticeRing(g: number): { width: number; material: Int16Array | Int32Array; rowId: Int32Array } {\n let ring = rings[g];\n if (!ring) {\n const width = W + 2 * LATTICE_RING_MARGIN, size = LATTICE_RING_ROWS * width;\n ring = rings[g] = { width, material: ringWide ? new Int16Array(size) : new Int32Array(size), rowId: new Int32Array(LATTICE_RING_ROWS).fill(-2147483648) };\n }\n return ring;\n }\n /** Makes the band of group g cover lattice columns [x0, x1) of rows [y0, y0 + rows), extending it to the right when it can. */\n function coverBand(g: number, x0: number, x1: number, y0: number, rows: number): void {\n const group = groups[g]!, band = bands[g]!, materials = scene as Extract<DisplayViewScene, { kind: \"materials\" }>;\n if (!(y0 >= band.y0 && y0 + rows <= band.y0 + band.rows && x0 >= band.x0 && x1 - band.x0 <= band.capacity)) {\n // A band with the ring is built twice as tall, so the next display rows' windows (a few lattice rows lower) reuse its\n // filled columns; a lattice point's material and the change counts inside a rectangle do not depend on the band's origin.\n if (rows <= LATTICE_RING_MAXIMUM_BAND_ROWS) rows *= 2;\n const capacity = Math.max(x1 - x0, Math.min(Math.floor(BAND_LIMIT / rows), W + 2 * (x1 - x0), spanColumns + x1 - x0));\n const size = rows * capacity, tables = (rows + 1) * (capacity + 1);\n band.x0 = x0; band.y0 = y0; band.rows = rows; band.capacity = capacity; band.filled = 0;\n if (band.material.length < size) { band.material = new Int32Array(size); band.reflectance = new Float64Array(allNeutral ? size : 0); }\n if (band.changeLeft.length < tables) { band.changeLeft = new Int32Array(tables); band.changeUp = new Int32Array(tables); }\n band.changeLeft.fill(0, 0, capacity + 1); band.changeUp.fill(0, 0, capacity + 1);\n for (let j = 0; j < rows; j++) { band.changeLeft[(j + 1) * (capacity + 1)] = 0; band.changeUp[(j + 1) * (capacity + 1)] = 0; }\n if (band.v.length < rows) band.v = new Float64Array(rows);\n for (let j = 0; j < rows; j++) band.v[j] = latticeV(group, y0 + j);\n }\n const stride = band.capacity, S1 = stride + 1, material = band.material, left = band.changeLeft, up = band.changeUp;\n rows = band.rows; y0 = band.y0;\n const ring = rows <= 2 * LATTICE_RING_MAXIMUM_BAND_ROWS ? latticeRing(g) : undefined;\n for (let i = band.filled; i < x1 - band.x0; i++) {\n const p = band.x0 + i, u = latticeU(group, p), column = p + LATTICE_RING_MARGIN;\n for (let j = 0; j < rows; j++) {\n let m: number;\n if (ring && column >= 0 && column < ring.width) {\n // A lattice point's material is a function of the point alone, so one looked up for an earlier window (the rows a\n // display row shares with the next) is the same material; the ring only spares the repeated lookup.\n const q = y0 + j, slot = q & (LATTICE_RING_ROWS - 1), index = slot * ring.width + column;\n if (ring.rowId[slot] !== q) { ring.rowId[slot] = q; ring.material.fill(-1, slot * ring.width, (slot + 1) * ring.width); }\n m = ring.material[index]!;\n if (m < 0) { m = materials.materialAt(u, band.v[j]!); ring.material[index] = m; }\n } else m = materials.materialAt(u, band.v[j]!);\n if (spectralIndex[m] === undefined) throw new InvalidConfigurationError(\"Unknown chart material.\");\n material[j * stride + i] = m;\n if (allNeutral) band.reflectance[j * stride + i] = reflectance[m]!;\n const changedLeft = i > 0 && material[j * stride + i - 1] !== m ? 1 : 0, changedUp = j > 0 && material[(j - 1) * stride + i] !== m ? 1 : 0;\n left[(j + 1) * S1 + i + 1] = left[j * S1 + i + 1]! + left[(j + 1) * S1 + i]! - left[j * S1 + i]! + changedLeft;\n up[(j + 1) * S1 + i + 1] = up[j * S1 + i + 1]! + up[(j + 1) * S1 + i]! - up[j * S1 + i]! + changedUp;\n }\n }\n band.filled = Math.max(band.filled, x1 - band.x0);\n }\n const rectSum = (sat: Int32Array, S1: number, i0: number, j0: number, i1: number, j1: number): number =>\n sat[j1 * S1 + i1]! - sat[j0 * S1 + i1]! - sat[j1 * S1 + i0]! + sat[j0 * S1 + i0]!;\n let filled = false;\n /** Sites outside the site window computed in this window (x, y pairs in window coordinates); their rectangles count when the window closes. */\n let outsideSites: number[] = [];\n let marks = new Uint8Array(0), cover = new Uint8Array(0);\n /** A site of a filled window: (i, j) are its coordinates in the site window, inside or outside it. */\n function filledSite(x: number, y: number, i: number, j: number): number {\n const c = channelAt(x, y), inside = i >= 0 && j >= 0 && i < sw && j < sh;\n if (inside) {\n let m = -1;\n for (let g = 0; g < groups.length; g++) {\n const group = groups[g]!, band = bands[g]!, S1 = band.capacity + 1, bi = x + group.minIx - R - band.x0, bj = y + group.minIy - R - band.y0;\n if (rectSum(band.changeLeft, S1, bi + 1, bj, bi + group.cw, bj + group.ch) !== 0 || rectSum(band.changeUp, S1, bi, bj + 1, bi + group.cw, bj + group.ch) !== 0) { m = -2; break; }\n const own = band.material[bj * band.capacity + bi]!;\n if (m === -1) m = own; else if (own !== m) { m = -2; break; }\n }\n if (m >= 0) { lastMaterial = m; return uniformSite[c]![m]!; }\n }\n lastMaterial = -1;\n let sum = 0;\n for (let g = 0; g < groups.length; g++) {\n const group = groups[g]!, band = bands[g]!, cw = group.cw, ch = group.ch, nk = group.neutral[c]!, sk = group.spectral[c]!, stride = band.capacity;\n const p0 = x + group.minIx - R, q0 = y + group.minIy - R, bi = p0 - band.x0, bj = q0 - band.y0;\n if (inside && allNeutral) {\n const refl = band.reflectance;\n for (let dy = 0, t = 0; dy < ch; dy++) {\n const row = (bj + dy) * stride + bi;\n for (let dx = 0; dx < cw; dx++, t++) sum += refl[row + dx]! * nk[t]!;\n }\n } else if (inside) {\n const material = band.material;\n for (let dy = 0, t = 0; dy < ch; dy++) {\n const row = (bj + dy) * stride + bi;\n for (let dx = 0; dx < cw; dx++, t++) {\n const m = material[row + dx]!, si = spectralIndex[m]!;\n sum += si < 0 ? reflectance[m]! * nk[t]! : sk[si]![t]!;\n }\n }\n } else {\n for (let dy = 0; dy < ch; dy++) for (let dx = 0; dx < cw; dx++) {\n const ci = i + dx, cj = j + dy;\n let m: number;\n if (ci >= 0 && cj >= 0 && ci < group.cpw && cj < group.cph) m = band.material[(bj + dy) * stride + bi + dx]!;\n else m = (scene as Extract<DisplayViewScene, { kind: \"materials\" }>).materialAt(latticeU(group, p0 + dx), latticeV(group, q0 + dy));\n const si = spectralIndex[m];\n if (si === undefined) throw new InvalidConfigurationError(\"Unknown chart material.\");\n sum += si < 0 ? reflectance[m]! * nk[dy * cw + dx]! : sk[si]![dy * cw + dx]!;\n }\n }\n }\n return sum;\n }\n /** Lattice points of an outside site's rectangles that lie outside the window caches (kernelSite looks these up on every read). */\n function outsideLookups(i: number, j: number): number {\n let count = 0;\n for (const group of groups) {\n const w = Math.max(0, Math.min(i + group.cw, group.cpw) - Math.max(i, 0)), h = Math.max(0, Math.min(j + group.ch, group.cph) - Math.max(j, 0));\n count += group.cw * group.ch - w * h;\n }\n return count;\n }\n // Site values of filled windows persist across windows (a site's value does not depend on the window): rows of native\n // sites in a ring of a power-of-two number of rows, row y in slot y mod ringRows. The window's site cache still holds the\n // sites read in the window, which is also what its lookup count needs.\n let ringRows = 0, ringOn = false, ring = new Float64Array(0), ringMaterial = new Int32Array(0), ringRowId = new Int32Array(0), windowMaterial = new Int32Array(0), lastMaterial = -1;\n /** A filled-window site read outside the site window: counted as kernelSite counts it. */\n function outsideRead(i: number, j: number): void { lookups += outsideLookups(i, j); outsideSites.push(i, j); }\n /** A site from the ring; on a miss (re)claims the row's slot when another row holds it, computes the site and stores it. */\n function ringRead(x: number, y: number, i: number, j: number): number {\n const slot = y & (ringRows - 1), q = slot * W + x;\n if (ringRowId[slot] === y) { const v = ring[q]!; if (v === v) { lastMaterial = ringMaterial[q]!; return v; } }\n else { ringRowId[slot] = y; ring.fill(NaN, slot * W, (slot + 1) * W); }\n const v = filledSite(x, y, i, j);\n ring[q] = v; ringMaterial[q] = lastMaterial;\n return v;\n }\n // Without diffraction (#392): site values persist across windows the same way, in their own ring (a site's value does not\n // depend on the window). A ring hit counts the lookups directSite would have made, so `lookups` is unchanged.\n let directRows = 0, directOn = false, directRing = new Float64Array(0), directRowId = new Int32Array(0);\n const directLookups = offsets.length * (scene.kind === \"materials\" ? 1 : nodes);\n function directRead(x: number, y: number): number {\n const slot = y & (directRows - 1), q = slot * W + x;\n if (directRowId[slot] === y) { const v = directRing[q]!; if (v === v) { lookups += directLookups; return v; } }\n else { directRowId[slot] = y; directRing.fill(NaN, slot * W, (slot + 1) * W); }\n const v = directSite(x, y);\n directRing[q] = v;\n return v;\n }\n /** A site not in the window's site cache: from a ring, a filled window without the ring, the lazy window caches, or uncached. */\n function siteMiss(x: number, y: number, i: number, j: number, cached: boolean): number {\n if (directOn) {\n const v = directRead(x, y);\n if (cached) siteCache[j * sw + i] = v;\n return v;\n }\n if (ringOn) {\n if (!cached) { outsideRead(i, j); return ringRead(x, y, i, j); }\n const v = ringRead(x, y, i, j);\n siteCache[j * sw + i] = v; windowMaterial[j * sw + i] = lastMaterial; markFilled(i, j);\n return v;\n }\n if (filled && !cached) outsideRead(i, j);\n const v = filled ? filledSite(x, y, i, j) : input.kernels ? kernelSite(x, y) : directSite(x, y);\n if (cached) { siteCache[j * sw + i] = v; if (filled) markFilled(i, j); }\n return v;\n }\n /**\n * Lattice points of the closing window that kernelSite's lazy cache would have looked up: per group, the window cache points\n * covered by the rectangles of the computed sites (the site cache's filled entries and the outside sites), a box dilation.\n */\n function windowLookups(): number {\n let total = 0;\n if (outsideSites.length === 0 && filledCount === 0) return 0;\n if (outsideSites.length === 0 && sw <= 31) {\n // Computed sites as a bit mask per window row. Cache point (ci, cj) is covered when a computed site (i, j) has\n // i ≤ ci < i + cw and j ≤ cj < j + ch; a union of dilations is the dilation of the union, so per cache row the\n // covered columns are the dilation of the OR of the masks of window rows cj − ch + 1 … cj.\n for (const group of groups) {\n const cw = group.cw, ch = group.ch, cpw = group.cpw, cph = group.cph, last = Math.min(cph - 1, fy1 + ch - 1);\n let previous = -1, width = 0;\n for (let cj = fy0; cj <= last; cj++) {\n let m = 0;\n for (let j = Math.max(fy0, cj - ch + 1), top = Math.min(fy1, cj); j <= top; j++) m |= rowMask[j]!;\n if (m !== previous) {\n previous = m; width = 0;\n let end = -1;\n for (let i = 0; m >>> i !== 0; i++) {\n if (((m >>> i) & 1) === 0) continue;\n const to = Math.min(i + cw - 1, cpw - 1);\n if (i > end) width += to - i + 1; else if (to > end) width += to - end;\n if (to > end) end = to;\n }\n }\n total += width;\n }\n }\n return total;\n }\n for (const group of groups) {\n const cw = group.cw, ch = group.ch, cpw = group.cpw, cph = group.cph, ew = cpw + cw - 1, eh = cph + ch - 1;\n // Top-left marks in extended coordinates (window coordinates + (cw − 1, ch − 1)), and their bounding box.\n if (marks.length < ew * eh) { marks = new Uint8Array(ew * eh); }\n let x0 = ew, x1 = -1, y0 = eh, y1 = -1;\n const mark = (ei: number, ej: number): void => {\n if (ei < 0 || ej < 0 || ei >= ew || ej >= eh) return;\n marks[ej * ew + ei] = 1;\n if (ei < x0) x0 = ei; if (ei > x1) x1 = ei; if (ej < y0) y0 = ej; if (ej > y1) y1 = ej;\n };\n for (let j = 0; j < sh; j++) for (let i = 0; i < sw; i++) if (!Number.isNaN(siteCache[j * sw + i]!)) mark(i + cw - 1, j + ch - 1);\n for (let k = 0; k < outsideSites.length; k += 2) mark(outsideSites[k]! + cw - 1, outsideSites[k + 1]! + ch - 1);\n if (x1 < 0) continue;\n // Cache point (i, j) is covered when a mark lies in extended columns [i, i + cw) and rows [j, j + ch): a horizontal\n // then a vertical running count over the marks' box (outside it nothing is covered).\n const i0 = Math.max(0, x0 - cw + 1), i1 = Math.min(cpw - 1, x1), cwid = i1 - i0 + 1;\n if (cover.length < cwid * (y1 - y0 + 1)) cover = new Uint8Array(cwid * (y1 - y0 + 1));\n for (let r = y0; r <= y1; r++) {\n let run = 0;\n for (let e = i0; e <= i1 + cw - 1; e++) {\n run += marks[r * ew + e]!;\n if (e - cw >= i0) run -= marks[r * ew + e - cw]!;\n if (e >= i0 + cw - 1) cover[(r - y0) * cwid + e - cw + 1 - i0] = run > 0 ? 1 : 0;\n }\n marks.fill(0, r * ew + x0, r * ew + x1 + 1);\n }\n for (let i = 0; i < cwid; i++) {\n let run = 0;\n for (let r = y0; r <= y1 + ch - 1; r++) {\n if (r <= y1) run += cover[(r - y0) * cwid + i]!;\n if (r - ch >= y0 && r - ch <= y1) run -= cover[(r - ch - y0) * cwid + i]!;\n const j = r - ch + 1;\n if (j >= 0 && j < cph && run > 0) total++;\n }\n }\n }\n return total;\n }\n let sx0 = 0, sy0 = 0, sw = 0, sh = 0, siteCache = new Float64Array(0);\n // The computed entries of a filled window's site cache (windowLookups): their count, bounding box and a bit mask per row\n // (columns below 31).\n let filledCount = 0, fx0 = 0, fx1 = -1, fy0 = 0, fy1 = -1;\n let rowMask = new Int32Array(0);\n function markFilled(i: number, j: number): void {\n if (i < 31) rowMask[j] = rowMask[j]! | (1 << i);\n if (filledCount++ === 0) { fx0 = fx1 = i; fy0 = fy1 = j; return; }\n if (i < fx0) fx0 = i; else if (i > fx1) fx1 = i;\n if (j < fy0) fy0 = j; else if (j > fy1) fy1 = j;\n }\n const pilotNode = input.wavelengthsNm[Math.floor(nodes / 2)]!;\n return {\n get lookups(): number { return lookups + (filled ? windowLookups() : 0); },\n get uniformMaterial(): number { return lastMaterial; },\n get tracksMaterial(): boolean { return ringOn; },\n get cachesSites(): boolean { return sw > 0; },\n window(x0: number, y0: number, x1: number, y1: number): void {\n if (filled) lookups += windowLookups();\n filled = false; ringOn = false; outsideSites = []; filledCount = 0; rowMask.fill(0, 0, sh);\n sx0 = x0; sy0 = y0; sw = Math.max(0, x1 - x0); sh = Math.max(0, y1 - y0);\n if (sw * sh > CACHE_LIMIT) { sw = 0; sh = 0; }\n if (siteCache.length < sw * sh) siteCache = new Float64Array(sw * sh);\n if (rowMask.length < sh) rowMask = new Int32Array(sh);\n siteCache.fill(NaN, 0, sw * sh);\n if (!input.kernels) {\n // A ring of at least twice the window's rows keeps the rows of the previous display row's windows.\n if (sh > 0 && directRows < 2 * sh) {\n let rows = 1;\n while (rows < 2 * sh) rows *= 2;\n if (rows * W <= CACHE_LIMIT) { directRows = rows; directRing = new Float64Array(rows * W).fill(NaN); directRowId = new Int32Array(rows).fill(-1); }\n }\n directOn = sh > 0 && directRows >= 2 * sh;\n return;\n }\n for (const group of groups) {\n group.cx0 = x0 + group.minIx - R; group.cy0 = y0 + group.minIy - R;\n group.cpw = sw === 0 ? 0 : sw + group.cw - 1; group.cph = sh === 0 ? 0 : sh + group.ch - 1;\n if (group.cpw * group.cph * (scene.kind === \"materials\" ? 1 : nodes) > CACHE_LIMIT) { group.cpw = 0; group.cph = 0; }\n }\n // Chart materials whose every group caches the whole window: the filled path (bands). Otherwise the lazy window caches.\n if (scene.kind === \"materials\" && sw > 0 && groups.every((group) => group.cpw > 0)) {\n groups.forEach((group, g) => coverBand(g, group.cx0, group.cx0 + group.cpw, group.cy0, group.cph));\n filled = true;\n if (windowMaterial.length < sw * sh) windowMaterial = new Int32Array(sw * sh);\n // A ring of at least twice the window's rows keeps the rows of the previous display row's windows.\n if (ringRows < 2 * sh) {\n let rows = 1;\n while (rows < 2 * sh) rows *= 2;\n if (rows * W <= CACHE_LIMIT) { ringRows = rows; ring = new Float64Array(rows * W).fill(NaN); ringMaterial = new Int32Array(rows * W); ringRowId = new Int32Array(rows).fill(-1); }\n }\n ringOn = ringRows >= 2 * sh;\n return;\n }\n for (const group of groups) {\n const n = group.cpw * group.cph * (scene.kind === \"materials\" ? 1 : nodes);\n if (scene.kind === \"materials\") { if (group.cache.length < n || !(group.cache instanceof Int32Array)) group.cache = new Int32Array(n); group.cache.fill(-1, 0, n); }\n else { if (group.cache.length < n || !(group.cache instanceof Float64Array)) group.cache = new Float64Array(n); group.cache.fill(NaN, 0, n); }\n }\n },\n site(x: number, y: number): number {\n // The window's site cache first (with the ring: the sites read in this window, which its lookup count needs too).\n const i = x - sx0, j = y - sy0, cached = i >= 0 && j >= 0 && i < sw && j < sh;\n if (cached) { const w = j * sw + i, v = siteCache[w]!; if (v === v) { if (ringOn) lastMaterial = windowMaterial[w]!; return v; } }\n return siteMiss(x, y, i, j, cached);\n },\n pilot(u: number, v: number): number {\n lookups++;\n return scene.kind === \"materials\" ? scene.materialAt(u, v) : scene.radianceAt(u, v, pilotNode);\n }\n };\n}\n"]}
1
+ {"version":3,"file":"expected-signal.js","sourceRoot":"","sources":["../../src/facade/expected-signal.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC;;;;GAIG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAkF3E,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAC9B,sGAAsG;AACtG,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,CAAC;AAC5B,qIAAqI;AACrI,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,CAAC;AAC3B;;;GAGG;AACH,MAAM,iBAAiB,GAAG,G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AAC,CAAS,EAAE,CAAS;YACxB,OAAO,EAAE,CAAC;YACV,OAAO,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;QACjG,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\n/**\n * The tabulated expected signal (2.6 display view; #394 also the capture's tabulated RAW path): expected photo electrons of\n * real native sites for a still, rectilinear, distortion-free planar scene. Kept apart from display-view.ts so a bundle that\n * only captures does not contain the display view or the portable functions it uses (issue #380).\n */\n\nimport { InvalidConfigurationError } from \"../core/configuration-error.js\";\n\n/** A query offset from a site centre in sites (+x right, +y down) and its weight (pixel-aperture node × filter spot). */\nexport interface DisplayViewQueryOffset { x: number; y: number; weight: number }\n\n/** Scene access for the expected signal: chart materials (fast tables) or a radiance function. */\nexport type DisplayViewScene =\n | { kind: \"materials\"; materialAt(u: number, v: number): number;\n /** Per material: `{ neutral: reflectance }` (radiance = reflectance × illuminant) or the spectral radiance at each node. */\n materials: readonly ({ neutral: number } | { radiance: Float64Array })[];\n /** Illuminant radiance of a perfect white diffuser at each spectral node: irradianceScale·shape(λ)/π. */\n whiteRadiance: Float64Array }\n | { kind: \"radiance\"; radianceAt(u: number, v: number, nm: number): number };\n\nexport interface DisplayViewExpectedSignalInput {\n nativeWidth: number;\n nativeHeight: number;\n /** Frame output width: plane coordinates are 2 / outputWidth frame units per site. */\n outputWidth: number;\n /** Spectral nodes and, per CFA channel (red, green, blue), the expected electrons per unit spectral radiance at each node. */\n wavelengthsNm: readonly number[];\n electronsPerRadiance: readonly [Float64Array, Float64Array, Float64Array];\n offsets: readonly DisplayViewQueryOffset[];\n /** Diffraction: per-node kernels on the site lattice, (2R + 1)² taps in row-major order, out(x) = Σ in(x − t)·K(t). */\n kernels?: { radius: number; perNode: readonly Float64Array[] };\n scene: DisplayViewScene;\n /** CFA channel index (0 red, 1 green, 2 blue) of native site (x, y). */\n channelAt(x: number, y: number): number;\n /**\n * Without diffraction: the plane point (frame units) that the environment queries for offset `o` of native site (x, y),\n * computed with the environment's own arithmetic, so points that fall exactly on a chart boundary resolve to the same\n * material as in the capture. With diffraction the facade's object-space convolution uses the lattice formula, as here.\n */\n queryPoint?(x: number, y: number, offset: number, out: Float64Array): void;\n}\n\n/** Expected photo electrons of real native sites. */\nexport interface DisplayViewExpectedSignal {\n /**\n * Starts a new cache window: native sites [x0, x1) × [y0, y1) that the following `site` calls mostly read. Sites and\n * scene lookups inside it are computed once; anything outside is computed without caching.\n */\n window(x0: number, y0: number, x1: number, y1: number): void;\n /** Expected photo electrons of native site (x, y) for its own CFA channel (x, y inside the native raster). */\n site(x: number, y: number): number;\n /** A cheap classifier value of the scene at plane point (u, v) frame units: the material, or the radiance at one node. */\n pilot(u: number, v: number): number;\n /** Scene lookups performed so far (material or radiance queries), for diagnostics. */\n readonly lookups: number;\n /**\n * The chart material that every kernel tap (without diffraction: every query point) of the last `site` call read, when\n * they all read one material (its value is then a function of that material and the site's CFA channel only); −1 when\n * unknown or mixed.\n */\n readonly uniformMaterial: number;\n /**\n * Whether `uniformMaterial` is tracked in the current window (otherwise it is not meaningful): chart materials in a\n * filled window or, without diffraction, in a window the direct ring serves (#444); never for radiance scenes.\n */\n readonly tracksMaterial: boolean;\n /**\n * Whether the current window caches its sites: a second `site` call for a site inside the window then returns the stored\n * value without any work or lookup (#392).\n */\n readonly cachesSites: boolean;\n /**\n * Whether `markReads` is available in the current window: a filled window (chart materials with diffraction kernels),\n * whose lookup count comes from the sites it computed. False otherwise: for windows without kernels (whose sites the\n * direct ring already serves cheaply) and for the lazy window caches (radiance scenes with diffraction), whose count\n * depends on the lattice points each computed site reads.\n */\n readonly marksReads: boolean;\n /**\n * Records `count` sites as read in the current window without computing them: site n at (xs[n], ys[n]) with value values[n]\n * (as `site` returned it for that site) and uniform material materials[n] (as `uniformMaterial` reported it). Sites outside\n * the window and sites the window already holds are skipped. For the window's lookup count and for later `site` calls this\n * is the same as reading each site with `site`. Only valid while `marksReads` is true; it must do for a site the\n * bookkeeping `site` does for a site the window's cache does not hold yet.\n */\n markReads(xs: Int32Array, ys: Int32Array, values: Float64Array, materials: Int32Array, count: number): void;\n}\n\nconst OFFSET_TOLERANCE = 1e-9;\n/** Largest cache window, in sites or lattice points; larger windows are evaluated without caching. */\nconst CACHE_LIMIT = 1 << 22;\n/** Largest band of looked-up lattice materials per group, in lattice points (a band that would be larger restarts at the window). */\nconst BAND_LIMIT = 1 << 22;\n/**\n * Lattice-row ring (refinement windows): rows kept per group, the tallest band that uses it, and the columns kept beyond each\n * raster edge (kernel radius, demosaic reach and query offsets; columns beyond it are looked up directly).\n */\nconst LATTICE_RING_ROWS = 128, LATTICE_RING_MAXIMUM_BAND_ROWS = 64, LATTICE_RING_MARGIN = 64;\n\n/**\n * The tables of `createDisplayViewExpectedSignal` (see there) that are a function of the input's numbers alone: the materials,\n * the lattice groups' geometry and combined kernels, and the per-material sums. Written only while they are built, never after:\n * they are shared by every render of an input and, for chart materials, by every input of the same content (#449). Everything a\n * render changes (each group's window cache and its origin and size, the bands, rings and counts) lives in the render.\n */\ninterface SignalTables {\n readonly reflectance: Float64Array; readonly spectralIndex: Int32Array; readonly spectral: readonly Float64Array[]; readonly groups: readonly GroupTables[];\n readonly neutralDirect: readonly number[]; readonly spectralDirect: readonly (readonly number[])[]; readonly uniformSite: readonly Float64Array[];\n}\n/** A lattice group's fixed part: its fractional shift, members, index bounds, rectangle and combined kernels. */\ninterface GroupTables { fx: number; fy: number; members: { ix: number; iy: number; weight: number }[]; minIx: number; maxIx: number; minIy: number; maxIy: number;\n cw: number; ch: number; neutral: Float64Array[]; spectral: Float64Array[][]; perNode: Float64Array[][] }\n/** A render's lattice group: the fixed part and its own window cache (lattice points [cx0, cx0 + cpw) × [cy0, cy0 + cph)). */\ninterface Group extends GroupTables { cache: Int32Array | Float64Array; cx0: number; cy0: number; cpw: number; cph: number }\n/** Per input object: the tables, and the filled path's lattice material rings per group (created on first use), which depend on its `materialAt` and raster. */\ninterface PreparedSignal { tables: SignalTables; rings: ({ width: number; material: Int16Array | Int32Array; rowId: Int32Array } | undefined)[] }\nconst PREPARED = new WeakMap<DisplayViewExpectedSignalInput, PreparedSignal>();\n\n/** Chart-material tables kept by content across input objects (#449), least recently used first. */\nexport const EXPECTED_SIGNAL_TABLE_CACHE_SIZE = 4;\nconst tableCache: { signature: Uint32Array; tables: SignalTables }[] = [];\nlet tableBuilds = 0, tableHits = 0;\n\n/** Internal test hook: the kept table entries, and the tables built and found by content so far. */\nexport function expectedSignalTableCacheState(): { size: number; builds: number; hits: number } { return { size: tableCache.length, builds: tableBuilds, hits: tableHits }; }\n/** Internal test hook: forgets the tables kept by content (inputs already prepared keep theirs). */\nexport function clearExpectedSignalTableCache(): void { tableCache.length = 0; }\n\n/**\n * Every number the tables read, with the lengths that delimit them, as the bits of doubles (so -0, NaN and every digit are kept\n * apart): the spectral nodes, the three channel responses, the offsets, the kernel radius and taps, each material's reflectance or\n * radiance, and the white radiance. Undefined for radiance scenes, whose tables are not kept by content.\n */\nfunction tableSignature(input: DisplayViewExpectedSignalInput): Uint32Array | undefined {\n const scene = input.scene;\n if (scene.kind !== \"materials\") return undefined;\n const values: number[] = [];\n const push = (a: ArrayLike<number>): void => { values.push(a.length); for (let i = 0; i < a.length; i++) values.push(a[i]!); };\n push(input.wavelengthsNm);\n values.push(input.electronsPerRadiance.length);\n for (const a of input.electronsPerRadiance) push(a);\n values.push(input.offsets.length);\n for (const o of input.offsets) values.push(o.x, o.y, o.weight);\n if (input.kernels) { values.push(1, input.kernels.radius, input.kernels.perNode.length); for (const k of input.kernels.perNode) push(k); } else values.push(0);\n values.push(scene.materials.length);\n for (const m of scene.materials) if (\"neutral\" in m) values.push(0, m.neutral); else { values.push(1); push(m.radiance); }\n push(scene.whiteRadiance);\n return new Uint32Array(Float64Array.from(values).buffer);\n}\n\nfunction sameBits(a: Uint32Array, b: Uint32Array): boolean {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;\n return true;\n}\n\nfunction prepareSignal(input: DisplayViewExpectedSignalInput): PreparedSignal {\n const signature = tableSignature(input);\n let tables: SignalTables | undefined;\n if (signature) {\n const at = tableCache.findIndex((entry) => sameBits(entry.signature, signature));\n if (at >= 0) { const [entry] = tableCache.splice(at, 1); tableCache.push(entry!); tables = entry!.tables; tableHits++; }\n }\n if (!tables) {\n tables = buildTables(input);\n tableBuilds++;\n if (signature) { tableCache.push({ signature, tables }); while (tableCache.length > EXPECTED_SIGNAL_TABLE_CACHE_SIZE) tableCache.shift(); }\n }\n const prepared: PreparedSignal = { tables, rings: tables.groups.map(() => undefined) };\n PREPARED.set(input, prepared);\n return prepared;\n}\n\nfunction buildTables(input: DisplayViewExpectedSignalInput): SignalTables {\n const nodes = input.wavelengthsNm.length, R = input.kernels ? input.kernels.radius : 0, size = 2 * R + 1;\n const A = input.electronsPerRadiance, scene = input.scene, offsets = input.offsets;\n const kernelAt = (node: number, t: number): number => (input.kernels ? input.kernels.perNode[node]![t]! : 1);\n // Materials: neutral ones by reflectance, spectral ones by index.\n let reflectance = new Float64Array(0), spectralIndex = new Int32Array(0);\n const spectral: Float64Array[] = [];\n if (scene.kind === \"materials\") {\n reflectance = new Float64Array(scene.materials.length); spectralIndex = new Int32Array(scene.materials.length).fill(-1);\n // A copy of each spectral radiance: the tables may outlive the input and serve other inputs of the same content.\n scene.materials.forEach((m, index) => { if (\"neutral\" in m) reflectance[index] = m.neutral; else { spectralIndex[index] = spectral.length; spectral.push(Float64Array.from(m.radiance)); } });\n }\n // Offsets grouped by fractional shift: offsets that differ by whole sites share one lattice.\n const frac = (v: number): number => { const f = v - Math.floor(v); return f > 1 - OFFSET_TOLERANCE || f < OFFSET_TOLERANCE ? 0 : f; };\n const groups: GroupTables[] = [];\n for (const o of offsets) {\n const fx = frac(o.x), fy = frac(o.y), ix = Math.round(o.x - fx), iy = Math.round(o.y - fy);\n let group = groups.find((q) => Math.abs(q.fx - fx) <= OFFSET_TOLERANCE && Math.abs(q.fy - fy) <= OFFSET_TOLERANCE);\n if (!group) { group = { fx, fy, members: [], minIx: ix, maxIx: ix, minIy: iy, maxIy: iy, cw: 0, ch: 0, neutral: [], spectral: [], perNode: [] }; groups.push(group); }\n group.members.push({ ix, iy, weight: o.weight });\n group.minIx = Math.min(group.minIx, ix); group.maxIx = Math.max(group.maxIx, ix); group.minIy = Math.min(group.minIy, iy); group.maxIy = Math.max(group.maxIy, iy);\n }\n if (input.kernels) for (const group of groups) {\n // Combined kernel over lattice offsets d = (ix − tu, iy − tv), stored at (d − min + R).\n const cw = group.maxIx - group.minIx + size, ch = group.maxIy - group.minIy + size;\n group.cw = cw; group.ch = ch;\n const combine = (value: (c: number, node: number, t: number) => number): Float64Array[] => [0, 1, 2].map((c) => {\n const out = new Float64Array(cw * ch);\n for (const member of group.members) for (let tv = -R, t = 0; tv <= R; tv++) for (let tu = -R; tu <= R; tu++, t++) {\n let sum = 0;\n for (let n = 0; n < nodes; n++) sum += value(c, n, t);\n const index = (member.iy - tv - group.minIy + R) * cw + (member.ix - tu - group.minIx + R);\n out[index] = out[index]! + member.weight * sum;\n }\n return out;\n });\n if (scene.kind === \"materials\") {\n group.neutral = combine((c, n, t) => A[c]![n]! * kernelAt(n, t) * scene.whiteRadiance[n]!);\n const perMaterial = spectral.map((radiance) => combine((c, n, t) => A[c]![n]! * kernelAt(n, t) * radiance[n]!));\n group.spectral = [0, 1, 2].map((c) => perMaterial.map((tables) => tables[c]!));\n } else {\n // Radiance scenes: combined kernels per node, applied to the cached radiance at each node.\n group.perNode = Array.from({ length: nodes }, (_, n) => combine((c, node, t) => (node === n ? A[c]![n]! * kernelAt(n, t) : 0)));\n }\n }\n // Neutral tap-0 signal per channel and spectral per material, for the direct (no-kernel) path.\n const neutralDirect = scene.kind === \"materials\" ? [0, 1, 2].map((c) => { let s = 0; for (let n = 0; n < nodes; n++) s += A[c]![n]! * scene.whiteRadiance[n]!; return s; }) : [];\n const spectralDirect = [0, 1, 2].map((c) => spectral.map((radiance) => { let s = 0; for (let n = 0; n < nodes; n++) s += A[c]![n]! * radiance[n]!; return s; }));\n const uniformSite = scene.kind === \"materials\" && input.kernels ? [0, 1, 2].map((c) => Float64Array.from(scene.materials, (_, m) => {\n const si = spectralIndex[m]!;\n let sum = 0;\n for (const group of groups) {\n const nk = group.neutral[c]!, sk = si < 0 ? nk : group.spectral[c]![si]!;\n for (let t = 0; t < group.cw * group.ch; t++) sum += si < 0 ? reflectance[m]! * nk[t]! : sk[t]!;\n }\n return sum;\n })) : [];\n // Frozen records: a render copies each group before it gives it a window (see createDisplayViewExpectedSignal).\n for (const group of groups) Object.freeze(group);\n return Object.freeze({ reflectance, spectralIndex, spectral, groups, neutralDirect, spectralDirect, uniformSite });\n}\n\n/**\n * Expected photo electrons per site: μ_c(i, j) = Σ_o w_o Σ_λ A_c(λ) Σ_t K_λ(t)·L(p_o(i, j) − t, λ), where p_o is the\n * query point of offset o and K the diffraction kernel (a single unit tap without diffraction). This is the sum the\n * facade's environment chain forms for a still, rectilinear, distortion-free planar scene, where the\n * radiance-to-irradiance factor is the same at every site (docs/DISPLAY_VIEW.md, \"Expected signal\").\n *\n * With diffraction, offsets that share a fractional shift read one lattice, and their kernels are combined in advance:\n * C_c(d) = Σ_members w·Σ_λ A_c(λ)·K_λ(t)·L(λ) over the taps t that reach lattice offset d. A neutral material's radiance\n * is its reflectance times the white radiance, so all neutral materials share one combined kernel per channel.\n *\n * `spanColumns`: how many native columns the render's windows move across beyond one window's width (a filled band is never\n * built wider). Only a speed hint: a window past it rebuilds its band, with the same values.\n */\nexport function createDisplayViewExpectedSignal(input: DisplayViewExpectedSignalInput, spanColumns = Infinity): DisplayViewExpectedSignal {\n const W = input.nativeWidth, H = input.nativeHeight, g = 2 / input.outputWidth, nodes = input.wavelengthsNm.length;\n const R = input.kernels ? input.kernels.radius : 0;\n if (input.kernels && input.kernels.perNode.length !== nodes) throw new InvalidConfigurationError(\"Display view kernels must match the spectral nodes.\");\n if (!input.kernels && !input.queryPoint) throw new InvalidConfigurationError(\"Display view needs the environment query points without diffraction.\");\n const A = input.electronsPerRadiance, scene = input.scene, offsets = input.offsets, channelAt = input.channelAt;\n // The request's tables (materials, lattice groups, combined kernels, per-material sums) are the same for every render of a\n // prepared view, which passes the same input object: computed once per input. Each render gets its own groups' window caches.\n // Chart-material tables are also shared by inputs of the same content (#449): each render gets its own groups' window state.\n const prepared = PREPARED.get(input) ?? prepareSignal(input);\n const { reflectance, spectralIndex, spectral, neutralDirect, spectralDirect, uniformSite } = prepared.tables;\n const groups: Group[] = prepared.tables.groups.map((group) => ({ ...group, cache: new Int32Array(0), cx0: 0, cy0: 0, cpw: 0, cph: 0 }));\n let lookups = 0;\n const point = new Float64Array(2);\n const materialSignalDirect = (m: number, c: number): number => {\n const si = spectralIndex[m];\n if (si === undefined) throw new InvalidConfigurationError(\"Unknown chart material.\");\n return si < 0 ? reflectance[m]! * neutralDirect[c]! : spectralDirect[c]![si]!;\n };\n /**\n * Without diffraction: one site from the environment's own query points. Also sets lastMaterial: the chart material every\n * query point read, or −1 when they read more than one (or the scene is a radiance scene). A site whose points all read\n * material m sums the same operands in the same order as every other such site of its channel, so it holds the same value.\n */\n function directSite(x: number, y: number): number {\n const c = channelAt(x, y);\n let sum = 0, uniform = -1;\n for (let o = 0; o < offsets.length; o++) {\n input.queryPoint!(x, y, o, point);\n let value: number;\n if (scene.kind === \"materials\") {\n const m = scene.materialAt(point[0]!, point[1]!);\n uniform = o === 0 || uniform === m ? m : -2;\n value = materialSignalDirect(m, c); lookups++;\n } else { value = 0; for (let n = 0; n < nodes; n++) value += A[c]![n]! * scene.radianceAt(point[0]!, point[1]!, input.wavelengthsNm[n]!); lookups += nodes; }\n sum += offsets[o]!.weight * value;\n }\n lastMaterial = uniform < 0 ? -1 : uniform;\n return sum;\n }\n // Lattice point (p, q) of a group: the facade's lattice formula (createDiffractedPlanarProvider).\n const latticeU = (group: Group, p: number): number => (group.fx === 0 ? (p + 0.5 - W / 2) * g : (p + 0.5 + group.fx - W / 2) * g);\n const latticeV = (group: Group, q: number): number => (group.fy === 0 ? -(q + 0.5 - H / 2) * g : -(q + 0.5 + group.fy - H / 2) * g);\n const radianceScratch = new Float64Array(nodes);\n /** Material (or radiance at each node, into radianceScratch) of a group's lattice point, from the window cache when it holds it. */\n function latticeMaterial(group: Group, p: number, q: number): number {\n const i = p - group.cx0, j = q - group.cy0, cached = i >= 0 && j >= 0 && i < group.cpw && j < group.cph;\n if (cached) { const m = group.cache[j * group.cpw + i]!; if (m >= 0) return m; }\n const m = (scene as Extract<DisplayViewScene, { kind: \"materials\" }>).materialAt(latticeU(group, p), latticeV(group, q));\n lookups++;\n if (cached) group.cache[j * group.cpw + i] = m;\n return m;\n }\n function latticeRadiance(group: Group, p: number, q: number): Float64Array {\n const i = p - group.cx0, j = q - group.cy0, cached = i >= 0 && j >= 0 && i < group.cpw && j < group.cph, cache = group.cache as Float64Array;\n if (cached && !Number.isNaN(cache[(j * group.cpw + i) * nodes]!)) { for (let n = 0; n < nodes; n++) radianceScratch[n] = cache[(j * group.cpw + i) * nodes + n]!; return radianceScratch; }\n const u = latticeU(group, p), v = latticeV(group, q);\n for (let n = 0; n < nodes; n++) radianceScratch[n] = (scene as Extract<DisplayViewScene, { kind: \"radiance\" }>).radianceAt(u, v, input.wavelengthsNm[n]!);\n lookups += nodes;\n if (cached) for (let n = 0; n < nodes; n++) cache[(j * group.cpw + i) * nodes + n] = radianceScratch[n]!;\n return radianceScratch;\n }\n /** With diffraction: one site through the combined kernels on each group's lattice. */\n function kernelSite(x: number, y: number): number {\n const c = channelAt(x, y);\n let sum = 0;\n for (const group of groups) {\n const p0 = x + group.minIx - R, q0 = y + group.minIy - R, cw = group.cw, ch = group.ch;\n if (scene.kind === \"materials\") {\n const nk = group.neutral[c]!, sk = group.spectral[c]!;\n for (let dy = 0; dy < ch; dy++) for (let dx = 0; dx < cw; dx++) {\n const m = latticeMaterial(group, p0 + dx, q0 + dy), si = spectralIndex[m];\n if (si === undefined) throw new InvalidConfigurationError(\"Unknown chart material.\");\n sum += si < 0 ? reflectance[m]! * nk[dy * cw + dx]! : sk[si]![dy * cw + dx]!;\n }\n } else {\n for (let dy = 0; dy < ch; dy++) for (let dx = 0; dx < cw; dx++) {\n const radiance = latticeRadiance(group, p0 + dx, q0 + dy);\n for (let n = 0; n < nodes; n++) sum += group.perNode[n]![c]![dy * cw + dx]! * radiance[n]!;\n }\n }\n }\n return sum;\n }\n // Filled windows (chart materials with diffraction, every lattice point of the window cacheable): each group keeps a band of\n // looked-up lattice materials that covers the window's rows and grows to the right as the windows of a display row move\n // right, with summed-area tables of material changes. A site whose kernel reads one material only (each group's rectangle\n // uniform, the same material in all) takes the value of the same sum over that material, precomputed below in the same\n // order; other sites run the same sum from the band. Either way each site's value is the same sequence of operations as\n // kernelSite, so it is bit-identical. The scene lookup count stays the count kernelSite's lazy window cache makes (each\n // cache point a computed site reads counts once per window, points outside the cache once per read): the rectangles of\n // the sites computed in a window are counted when the window closes (windowLookups).\n const allNeutral = spectral.length === 0;\n /**\n * A group's band: lattice rows [y0, y0 + rows), columns [x0, x0 + filled) looked up, row stride `capacity`. `material`,\n * `reflectance` (neutral-only charts) and the summed-area tables of left changes (`changeLeft`, 1 where a point's material\n * differs from its left neighbour's) and upper changes (`changeUp`), (rows + 1) × (capacity + 1).\n */\n interface Band { x0: number; y0: number; rows: number; capacity: number; filled: number; material: Int32Array; reflectance: Float64Array; changeLeft: Int32Array; changeUp: Int32Array; v: Float64Array }\n const bands: Band[] = groups.map(() => ({ x0: 0, y0: 0, rows: 0, capacity: 0, filled: 0, material: new Int32Array(0), reflectance: new Float64Array(0),\n changeLeft: new Int32Array(0), changeUp: new Int32Array(0), v: new Float64Array(0) }));\n // Lattice rows of material indices per group, kept across windows (filled windows only): rows LATTICE_RING_ROWS apart share a\n // slot; columns from −LATTICE_RING_MARGIN. Int16 when every index fits (about 3 MB for four groups of a 6000-site row). A\n // lattice point's material depends only on the input, so the rings are kept per input object, across its renders (not with\n // the tables kept by content: they depend on `materialAt` and the raster).\n const ringWide = scene.kind === \"materials\" && scene.materials.length <= 32767;\n const rings = prepared.rings;\n function latticeRing(g: number): { width: number; material: Int16Array | Int32Array; rowId: Int32Array } {\n let ring = rings[g];\n if (!ring) {\n const width = W + 2 * LATTICE_RING_MARGIN, size = LATTICE_RING_ROWS * width;\n ring = rings[g] = { width, material: ringWide ? new Int16Array(size) : new Int32Array(size), rowId: new Int32Array(LATTICE_RING_ROWS).fill(-2147483648) };\n }\n return ring;\n }\n /** Makes the band of group g cover lattice columns [x0, x1) of rows [y0, y0 + rows), extending it to the right when it can. */\n function coverBand(g: number, x0: number, x1: number, y0: number, rows: number): void {\n const group = groups[g]!, band = bands[g]!, materials = scene as Extract<DisplayViewScene, { kind: \"materials\" }>;\n if (!(y0 >= band.y0 && y0 + rows <= band.y0 + band.rows && x0 >= band.x0 && x1 - band.x0 <= band.capacity)) {\n // A band with the ring is built twice as tall, so the next display rows' windows (a few lattice rows lower) reuse its\n // filled columns; a lattice point's material and the change counts inside a rectangle do not depend on the band's origin.\n if (rows <= LATTICE_RING_MAXIMUM_BAND_ROWS) rows *= 2;\n const capacity = Math.max(x1 - x0, Math.min(Math.floor(BAND_LIMIT / rows), W + 2 * (x1 - x0), spanColumns + x1 - x0));\n const size = rows * capacity, tables = (rows + 1) * (capacity + 1);\n band.x0 = x0; band.y0 = y0; band.rows = rows; band.capacity = capacity; band.filled = 0;\n if (band.material.length < size) { band.material = new Int32Array(size); band.reflectance = new Float64Array(allNeutral ? size : 0); }\n if (band.changeLeft.length < tables) { band.changeLeft = new Int32Array(tables); band.changeUp = new Int32Array(tables); }\n band.changeLeft.fill(0, 0, capacity + 1); band.changeUp.fill(0, 0, capacity + 1);\n for (let j = 0; j < rows; j++) { band.changeLeft[(j + 1) * (capacity + 1)] = 0; band.changeUp[(j + 1) * (capacity + 1)] = 0; }\n if (band.v.length < rows) band.v = new Float64Array(rows);\n for (let j = 0; j < rows; j++) band.v[j] = latticeV(group, y0 + j);\n }\n const stride = band.capacity, S1 = stride + 1, material = band.material, left = band.changeLeft, up = band.changeUp;\n rows = band.rows; y0 = band.y0;\n const ring = rows <= 2 * LATTICE_RING_MAXIMUM_BAND_ROWS ? latticeRing(g) : undefined;\n for (let i = band.filled; i < x1 - band.x0; i++) {\n const p = band.x0 + i, u = latticeU(group, p), column = p + LATTICE_RING_MARGIN;\n for (let j = 0; j < rows; j++) {\n let m: number;\n if (ring && column >= 0 && column < ring.width) {\n // A lattice point's material is a function of the point alone, so one looked up for an earlier window (the rows a\n // display row shares with the next) is the same material; the ring only spares the repeated lookup.\n const q = y0 + j, slot = q & (LATTICE_RING_ROWS - 1), index = slot * ring.width + column;\n if (ring.rowId[slot] !== q) { ring.rowId[slot] = q; ring.material.fill(-1, slot * ring.width, (slot + 1) * ring.width); }\n m = ring.material[index]!;\n if (m < 0) { m = materials.materialAt(u, band.v[j]!); ring.material[index] = m; }\n } else m = materials.materialAt(u, band.v[j]!);\n if (spectralIndex[m] === undefined) throw new InvalidConfigurationError(\"Unknown chart material.\");\n material[j * stride + i] = m;\n if (allNeutral) band.reflectance[j * stride + i] = reflectance[m]!;\n const changedLeft = i > 0 && material[j * stride + i - 1] !== m ? 1 : 0, changedUp = j > 0 && material[(j - 1) * stride + i] !== m ? 1 : 0;\n left[(j + 1) * S1 + i + 1] = left[j * S1 + i + 1]! + left[(j + 1) * S1 + i]! - left[j * S1 + i]! + changedLeft;\n up[(j + 1) * S1 + i + 1] = up[j * S1 + i + 1]! + up[(j + 1) * S1 + i]! - up[j * S1 + i]! + changedUp;\n }\n }\n band.filled = Math.max(band.filled, x1 - band.x0);\n }\n const rectSum = (sat: Int32Array, S1: number, i0: number, j0: number, i1: number, j1: number): number =>\n sat[j1 * S1 + i1]! - sat[j0 * S1 + i1]! - sat[j1 * S1 + i0]! + sat[j0 * S1 + i0]!;\n let filled = false;\n /** Sites outside the site window computed in this window (x, y pairs in window coordinates); their rectangles count when the window closes. */\n let outsideSites: number[] = [];\n let marks = new Uint8Array(0), cover = new Uint8Array(0);\n /** A site of a filled window: (i, j) are its coordinates in the site window, inside or outside it. */\n function filledSite(x: number, y: number, i: number, j: number): number {\n const c = channelAt(x, y), inside = i >= 0 && j >= 0 && i < sw && j < sh;\n if (inside) {\n let m = -1;\n for (let g = 0; g < groups.length; g++) {\n const group = groups[g]!, band = bands[g]!, S1 = band.capacity + 1, bi = x + group.minIx - R - band.x0, bj = y + group.minIy - R - band.y0;\n if (rectSum(band.changeLeft, S1, bi + 1, bj, bi + group.cw, bj + group.ch) !== 0 || rectSum(band.changeUp, S1, bi, bj + 1, bi + group.cw, bj + group.ch) !== 0) { m = -2; break; }\n const own = band.material[bj * band.capacity + bi]!;\n if (m === -1) m = own; else if (own !== m) { m = -2; break; }\n }\n if (m >= 0) { lastMaterial = m; return uniformSite[c]![m]!; }\n }\n lastMaterial = -1;\n let sum = 0;\n for (let g = 0; g < groups.length; g++) {\n const group = groups[g]!, band = bands[g]!, cw = group.cw, ch = group.ch, nk = group.neutral[c]!, sk = group.spectral[c]!, stride = band.capacity;\n const p0 = x + group.minIx - R, q0 = y + group.minIy - R, bi = p0 - band.x0, bj = q0 - band.y0;\n if (inside && allNeutral) {\n const refl = band.reflectance;\n for (let dy = 0, t = 0; dy < ch; dy++) {\n const row = (bj + dy) * stride + bi;\n for (let dx = 0; dx < cw; dx++, t++) sum += refl[row + dx]! * nk[t]!;\n }\n } else if (inside) {\n const material = band.material;\n for (let dy = 0, t = 0; dy < ch; dy++) {\n const row = (bj + dy) * stride + bi;\n for (let dx = 0; dx < cw; dx++, t++) {\n const m = material[row + dx]!, si = spectralIndex[m]!;\n sum += si < 0 ? reflectance[m]! * nk[t]! : sk[si]![t]!;\n }\n }\n } else {\n for (let dy = 0; dy < ch; dy++) for (let dx = 0; dx < cw; dx++) {\n const ci = i + dx, cj = j + dy;\n let m: number;\n if (ci >= 0 && cj >= 0 && ci < group.cpw && cj < group.cph) m = band.material[(bj + dy) * stride + bi + dx]!;\n else m = (scene as Extract<DisplayViewScene, { kind: \"materials\" }>).materialAt(latticeU(group, p0 + dx), latticeV(group, q0 + dy));\n const si = spectralIndex[m];\n if (si === undefined) throw new InvalidConfigurationError(\"Unknown chart material.\");\n sum += si < 0 ? reflectance[m]! * nk[dy * cw + dx]! : sk[si]![dy * cw + dx]!;\n }\n }\n }\n return sum;\n }\n /** Lattice points of an outside site's rectangles that lie outside the window caches (kernelSite looks these up on every read). */\n function outsideLookups(i: number, j: number): number {\n let count = 0;\n for (const group of groups) {\n const w = Math.max(0, Math.min(i + group.cw, group.cpw) - Math.max(i, 0)), h = Math.max(0, Math.min(j + group.ch, group.cph) - Math.max(j, 0));\n count += group.cw * group.ch - w * h;\n }\n return count;\n }\n // Site values of filled windows persist across windows (a site's value does not depend on the window): rows of native\n // sites in a ring of a power-of-two number of rows, row y in slot y mod ringRows. The window's site cache still holds the\n // sites read in the window, which is also what its lookup count needs.\n let ringRows = 0, ringOn = false, ring = new Float64Array(0), ringMaterial = new Int32Array(0), ringRowId = new Int32Array(0), windowMaterial = new Int32Array(0), lastMaterial = -1;\n /** A filled-window site read outside the site window: counted as kernelSite counts it. */\n function outsideRead(i: number, j: number): void { lookups += outsideLookups(i, j); outsideSites.push(i, j); }\n /** A site from the ring; on a miss (re)claims the row's slot when another row holds it, computes the site and stores it. */\n function ringRead(x: number, y: number, i: number, j: number): number {\n const slot = y & (ringRows - 1), q = slot * W + x;\n if (ringRowId[slot] === y) { const v = ring[q]!; if (v === v) { lastMaterial = ringMaterial[q]!; return v; } }\n else { ringRowId[slot] = y; ring.fill(NaN, slot * W, (slot + 1) * W); }\n const v = filledSite(x, y, i, j);\n ring[q] = v; ringMaterial[q] = lastMaterial;\n return v;\n }\n // Without diffraction (#392): site values persist across windows the same way, in their own ring (a site's value does not\n // depend on the window). A ring hit counts the lookups directSite would have made, so `lookups` is unchanged. The site's\n // material (directSite's lastMaterial) is kept beside its value, so the display view's one-material memo applies (#444).\n let directRows = 0, directOn = false, directRing = new Float64Array(0), directRowId = new Int32Array(0), directRingMaterial = new Int32Array(0);\n const directLookups = offsets.length * (scene.kind === \"materials\" ? 1 : nodes);\n function directRead(x: number, y: number): number {\n const slot = y & (directRows - 1), q = slot * W + x;\n if (directRowId[slot] === y) { const v = directRing[q]!; if (v === v) { lookups += directLookups; lastMaterial = directRingMaterial[q]!; return v; } }\n else { directRowId[slot] = y; directRing.fill(NaN, slot * W, (slot + 1) * W); }\n const v = directSite(x, y);\n directRing[q] = v; directRingMaterial[q] = lastMaterial;\n return v;\n }\n /** A site not in the window's site cache: from a ring, a filled window without the ring, the lazy window caches, or uncached. */\n function siteMiss(x: number, y: number, i: number, j: number, cached: boolean): number {\n if (directOn) {\n const v = directRead(x, y);\n if (cached) { siteCache[j * sw + i] = v; windowMaterial[j * sw + i] = lastMaterial; }\n return v;\n }\n if (ringOn) {\n if (!cached) { outsideRead(i, j); return ringRead(x, y, i, j); }\n const v = ringRead(x, y, i, j);\n siteCache[j * sw + i] = v; windowMaterial[j * sw + i] = lastMaterial; markFilled(i, j);\n return v;\n }\n if (filled && !cached) outsideRead(i, j);\n const v = filled ? filledSite(x, y, i, j) : input.kernels ? kernelSite(x, y) : directSite(x, y);\n if (cached) { siteCache[j * sw + i] = v; if (filled) markFilled(i, j); }\n return v;\n }\n /**\n * Lattice points of the closing window that kernelSite's lazy cache would have looked up: per group, the window cache points\n * covered by the rectangles of the computed sites (the site cache's filled entries and the outside sites), a box dilation.\n * A group's count depends only on the computed sites and its geometry (cw, ch, cpw, cph), so a group shaped like an\n * earlier one takes that group's count (the app's Quality groups all have one shape).\n */\n const groupTotals = new Float64Array(groups.length);\n function sameGeometry(g: number): number {\n const group = groups[g]!;\n for (let h = 0; h < g; h++) { const o = groups[h]!; if (o.cw === group.cw && o.ch === group.ch && o.cpw === group.cpw && o.cph === group.cph) return h; }\n return -1;\n }\n function windowLookups(): number {\n let total = 0;\n if (outsideSites.length === 0 && filledCount === 0) return 0;\n if (outsideSites.length === 0 && filledCount === sw * sh) {\n // Every site computed (each once) and none outside: the marks at (i + cw − 1, j + ch − 1) cover cache columns\n // 0 … sw + cw − 2 and rows 0 … sh + ch − 2, the whole cpw × cph cache of every group.\n for (const group of groups) total += group.cpw * group.cph;\n return total;\n }\n if (outsideSites.length === 0 && sw <= 31) {\n // Computed sites as a bit mask per window row. Cache point (ci, cj) is covered when a computed site (i, j) has\n // i ≤ ci < i + cw and j ≤ cj < j + ch; a union of dilations is the dilation of the union, so per cache row the\n // covered columns are the dilation of the OR of the masks of window rows cj − ch + 1 … cj. That OR is a prefix OR\n // when the rows start at fy0 and a suffix OR when they end at fy1 (OR is associative and commutative).\n if (prefixOr.length < sh) { prefixOr = new Int32Array(sh); suffixOr = new Int32Array(sh); }\n for (let j = fy0, m = 0; j <= fy1; j++) { m |= rowMask[j]!; prefixOr[j] = m; }\n for (let j = fy1, m = 0; j >= fy0; j--) { m |= rowMask[j]!; suffixOr[j] = m; }\n for (let g = 0; g < groups.length; g++) {\n const same = sameGeometry(g);\n if (same >= 0) { total += groupTotals[same]!; groupTotals[g] = groupTotals[same]!; continue; }\n const group = groups[g]!, cw = group.cw, ch = group.ch, cpw = group.cpw, cph = group.cph, last = Math.min(cph - 1, fy1 + ch - 1), before = total;\n let previous = -1, width = 0;\n for (let cj = fy0; cj <= last; cj++) {\n let m = 0;\n const a = Math.max(fy0, cj - ch + 1), b = Math.min(fy1, cj);\n if (a === fy0) m = prefixOr[b]!; else if (b === fy1) m = suffixOr[a]!;\n else for (let j = a; j <= b; j++) m |= rowMask[j]!;\n if (m !== previous) {\n previous = m; width = 0;\n let end = -1;\n for (let i = 0; m >>> i !== 0; i++) {\n if (((m >>> i) & 1) === 0) continue;\n const to = Math.min(i + cw - 1, cpw - 1);\n if (i > end) width += to - i + 1; else if (to > end) width += to - end;\n if (to > end) end = to;\n }\n }\n total += width;\n }\n groupTotals[g] = total - before;\n }\n return total;\n }\n for (let g = 0; g < groups.length; g++) {\n // The marks are the computed sites shifted by (cw − 1, ch − 1), so the count depends on the group's geometry only.\n const same = sameGeometry(g);\n if (same >= 0) { total += groupTotals[same]!; groupTotals[g] = groupTotals[same]!; continue; }\n const group = groups[g]!, cw = group.cw, ch = group.ch, cpw = group.cpw, cph = group.cph, ew = cpw + cw - 1, eh = cph + ch - 1, before = total;\n groupTotals[g] = 0;\n // Top-left marks in extended coordinates (window coordinates + (cw − 1, ch − 1)), and their bounding box.\n if (marks.length < ew * eh) { marks = new Uint8Array(ew * eh); }\n let x0 = ew, x1 = -1, y0 = eh, y1 = -1;\n const mark = (ei: number, ej: number): void => {\n if (ei < 0 || ej < 0 || ei >= ew || ej >= eh) return;\n marks[ej * ew + ei] = 1;\n if (ei < x0) x0 = ei; if (ei > x1) x1 = ei; if (ej < y0) y0 = ej; if (ej > y1) y1 = ej;\n };\n for (let j = 0; j < sh; j++) for (let i = 0; i < sw; i++) if (!Number.isNaN(siteCache[j * sw + i]!)) mark(i + cw - 1, j + ch - 1);\n for (let k = 0; k < outsideSites.length; k += 2) mark(outsideSites[k]! + cw - 1, outsideSites[k + 1]! + ch - 1);\n if (x1 < 0) continue;\n // Cache point (i, j) is covered when a mark lies in extended columns [i, i + cw) and rows [j, j + ch): a horizontal\n // then a vertical running count over the marks' box (outside it nothing is covered).\n const i0 = Math.max(0, x0 - cw + 1), i1 = Math.min(cpw - 1, x1), cwid = i1 - i0 + 1;\n if (cover.length < cwid * (y1 - y0 + 1)) cover = new Uint8Array(cwid * (y1 - y0 + 1));\n for (let r = y0; r <= y1; r++) {\n let run = 0;\n for (let e = i0; e <= i1 + cw - 1; e++) {\n run += marks[r * ew + e]!;\n if (e - cw >= i0) run -= marks[r * ew + e - cw]!;\n if (e >= i0 + cw - 1) cover[(r - y0) * cwid + e - cw + 1 - i0] = run > 0 ? 1 : 0;\n }\n marks.fill(0, r * ew + x0, r * ew + x1 + 1);\n }\n for (let i = 0; i < cwid; i++) {\n let run = 0;\n for (let r = y0; r <= y1 + ch - 1; r++) {\n if (r <= y1) run += cover[(r - y0) * cwid + i]!;\n if (r - ch >= y0 && r - ch <= y1) run -= cover[(r - ch - y0) * cwid + i]!;\n const j = r - ch + 1;\n if (j >= 0 && j < cph && run > 0) total++;\n }\n }\n groupTotals[g] = total - before;\n }\n return total;\n }\n let sx0 = 0, sy0 = 0, sw = 0, sh = 0, siteCache = new Float64Array(0);\n // The computed entries of a filled window's site cache (windowLookups): their count, bounding box and a bit mask per row\n // (columns below 31).\n let filledCount = 0, fx0 = 0, fx1 = -1, fy0 = 0, fy1 = -1;\n let rowMask = new Int32Array(0), prefixOr = new Int32Array(0), suffixOr = new Int32Array(0);\n function markFilled(i: number, j: number): void {\n if (i < 31) rowMask[j] = rowMask[j]! | (1 << i);\n if (filledCount++ === 0) { fx0 = fx1 = i; fy0 = fy1 = j; return; }\n if (i < fx0) fx0 = i; else if (i > fx1) fx1 = i;\n if (j < fy0) fy0 = j; else if (j > fy1) fy1 = j;\n }\n const pilotNode = input.wavelengthsNm[Math.floor(nodes / 2)]!;\n return {\n get lookups(): number { return lookups + (filled ? windowLookups() : 0); },\n get uniformMaterial(): number { return lastMaterial; },\n // Chart materials are tracked on the filled path and, without diffraction, on the direct ring (radiance scenes never).\n get tracksMaterial(): boolean { return ringOn || (directOn && scene.kind === \"materials\"); },\n get cachesSites(): boolean { return sw > 0; },\n get marksReads(): boolean { return filled; },\n markReads(xs: Int32Array, ys: Int32Array, values: Float64Array, materials: Int32Array, count: number): void {\n for (let n = 0; n < count; n++) {\n const i = xs[n]! - sx0, j = ys[n]! - sy0;\n if (!(i >= 0 && j >= 0 && i < sw && j < sh)) continue;\n const w = j * sw + i;\n if (siteCache[w]! === siteCache[w]!) continue;\n // As siteMiss for a site inside a filled window: the computed site is marked (windowLookups counts from the marks)\n // and its material kept.\n siteCache[w] = values[n]!; windowMaterial[w] = materials[n]!; markFilled(i, j);\n }\n },\n window(x0: number, y0: number, x1: number, y1: number): void {\n if (filled) lookups += windowLookups();\n filled = false; ringOn = false; outsideSites = []; filledCount = 0; rowMask.fill(0, 0, sh);\n sx0 = x0; sy0 = y0; sw = Math.max(0, x1 - x0); sh = Math.max(0, y1 - y0);\n if (sw * sh > CACHE_LIMIT) { sw = 0; sh = 0; }\n if (siteCache.length < sw * sh) siteCache = new Float64Array(sw * sh);\n if (rowMask.length < sh) rowMask = new Int32Array(sh);\n siteCache.fill(NaN, 0, sw * sh);\n if (!input.kernels) {\n // A ring of at least twice the window's rows keeps the rows of the previous display row's windows.\n if (sh > 0 && directRows < 2 * sh) {\n let rows = 1;\n while (rows < 2 * sh) rows *= 2;\n if (rows * W <= CACHE_LIMIT) { directRows = rows; directRing = new Float64Array(rows * W).fill(NaN); directRowId = new Int32Array(rows).fill(-1); directRingMaterial = new Int32Array(rows * W); }\n }\n directOn = sh > 0 && directRows >= 2 * sh;\n if (directOn && windowMaterial.length < sw * sh) windowMaterial = new Int32Array(sw * sh);\n return;\n }\n for (const group of groups) {\n group.cx0 = x0 + group.minIx - R; group.cy0 = y0 + group.minIy - R;\n group.cpw = sw === 0 ? 0 : sw + group.cw - 1; group.cph = sh === 0 ? 0 : sh + group.ch - 1;\n if (group.cpw * group.cph * (scene.kind === \"materials\" ? 1 : nodes) > CACHE_LIMIT) { group.cpw = 0; group.cph = 0; }\n }\n // Chart materials whose every group caches the whole window: the filled path (bands). Otherwise the lazy window caches.\n if (scene.kind === \"materials\" && sw > 0 && groups.every((group) => group.cpw > 0)) {\n groups.forEach((group, g) => coverBand(g, group.cx0, group.cx0 + group.cpw, group.cy0, group.cph));\n filled = true;\n if (windowMaterial.length < sw * sh) windowMaterial = new Int32Array(sw * sh);\n // A ring of at least twice the window's rows keeps the rows of the previous display row's windows.\n if (ringRows < 2 * sh) {\n let rows = 1;\n while (rows < 2 * sh) rows *= 2;\n if (rows * W <= CACHE_LIMIT) { ringRows = rows; ring = new Float64Array(rows * W).fill(NaN); ringMaterial = new Int32Array(rows * W); ringRowId = new Int32Array(rows).fill(-1); }\n }\n ringOn = ringRows >= 2 * sh;\n return;\n }\n for (const group of groups) {\n const n = group.cpw * group.cph * (scene.kind === \"materials\" ? 1 : nodes);\n if (scene.kind === \"materials\") { if (group.cache.length < n || !(group.cache instanceof Int32Array)) group.cache = new Int32Array(n); group.cache.fill(-1, 0, n); }\n else { if (group.cache.length < n || !(group.cache instanceof Float64Array)) group.cache = new Float64Array(n); group.cache.fill(NaN, 0, n); }\n }\n },\n site(x: number, y: number): number {\n // The window's site cache first (with the ring: the sites read in this window, which its lookup count needs too).\n const i = x - sx0, j = y - sy0, cached = i >= 0 && j >= 0 && i < sw && j < sh;\n if (cached) { const w = j * sw + i, v = siteCache[w]!; if (v === v) { if (ringOn || directOn) lastMaterial = windowMaterial[w]!; return v; } }\n return siteMiss(x, y, i, j, cached);\n },\n pilot(u: number, v: number): number {\n lookups++;\n return scene.kind === \"materials\" ? scene.materialAt(u, v) : scene.radianceAt(u, v, pilotNode);\n }\n };\n}\n"]}
@@ -51,6 +51,11 @@ export type SimulateCaptureColorEncoding = "srgb" | "display-p3" | "rec2020";
51
51
  * edge-directed method that reduces zipper and false colour on sharp edges.
52
52
  */
53
53
  export type SimulateCaptureDemosaic = "bilinear" | "ahd";
54
+ /** `output.demosaic` as a record (#395): the demosaic and its `fast` override (see {@link SimulateCaptureOptions.fast}). */
55
+ export interface SimulateCaptureDemosaicRecord {
56
+ kind: SimulateCaptureDemosaic;
57
+ fast?: boolean;
58
+ }
54
59
  /**
55
60
  * `margin` renders extra native sites around the output, as far as the kernel reaches. `mirror` renders
56
61
  * exactly the output and reads mirrored (reflect-101) copies of the missing border sites. Mirroring is
@@ -64,10 +69,20 @@ export type SimulateCaptureLensDistortion = {
64
69
  kind: "brown-conrady";
65
70
  profile: BrownConradyDistortionProfile;
66
71
  };
67
- /** Diffraction model (2.1): the shorthand or a record with an explicit kernel radius in sites. */
72
+ /**
73
+ * Diffraction model (2.1): the shorthand or a record with an explicit kernel radius in sites and (#395) a `fast` override
74
+ * (see {@link SimulateCaptureOptions.fast}). The record names the model by `kind`; `aperture`, its name before #395, is still
75
+ * accepted as a deprecated alias until 3.0.0, and giving both is an error.
76
+ */
68
77
  export type SimulateCaptureLensDiffraction = "circular-aperture" | {
78
+ kind: "circular-aperture";
79
+ kernelRadiusSamples?: number;
80
+ fast?: boolean;
81
+ } | {
82
+ /** @deprecated Since #395: use `kind`. Accepted until 3.0.0. */
69
83
  aperture: "circular-aperture";
70
84
  kernelRadiusSamples?: number;
85
+ fast?: boolean;
71
86
  };
72
87
  /**
73
88
  * Optical anti-aliasing (low-pass) filter (2.1), modelled as birefringent point splitting: each image point is
@@ -82,18 +97,22 @@ export type SimulateCaptureLensDiffraction = "circular-aperture" | {
82
97
  export type SimulateCaptureSensorAntiAliasing = {
83
98
  kind: "four-spot";
84
99
  separationSites?: number;
100
+ fast?: boolean;
85
101
  } | {
86
102
  kind: "two-spot";
87
103
  axis: "horizontal" | "vertical";
88
104
  separationSites?: number;
105
+ fast?: boolean;
89
106
  } | {
90
107
  kind: "point-splitting";
91
108
  components: readonly AntiAliasingPointSplitComponent[];
109
+ fast?: boolean;
92
110
  };
93
- /** Pixel aperture (2.3): centre sampling, or the square photosite integrated with an N × N midpoint rule. */
111
+ /** Pixel aperture (2.3): centre sampling, or the square photosite integrated with an N × N midpoint rule; `fast` (#395) overrides the top-level flag. */
94
112
  export type SimulateCapturePixelAperture = "point" | "box" | {
95
113
  kind: "box";
96
114
  samplesPerAxis?: number;
115
+ fast?: boolean;
97
116
  };
98
117
  /** Default midpoint samples per axis of `sensor.pixelAperture: "box"`. */
99
118
  export declare const SIMULATE_CAPTURE_BOX_APERTURE_DEFAULT_SAMPLES = 4;
@@ -204,8 +223,8 @@ export interface SimulateCaptureOptions {
204
223
  * through `prepareRgbGamutMapping`: constant CIELAB L* and hue, chroma above 90 % of the boundary compressed.
205
224
  */
206
225
  gamutMapping?: "clip" | "perceptual";
207
- /** Default: the 1.0 facade's bilinear RGGB kernels. */
208
- demosaic?: SimulateCaptureDemosaic;
226
+ /** Default: the 1.0 facade's bilinear RGGB kernels. The record form (#395) adds a `fast` override. */
227
+ demosaic?: SimulateCaptureDemosaic | SimulateCaptureDemosaicRecord;
209
228
  /** Default "margin". */
210
229
  borderHandling?: SimulateCaptureBorderHandling;
211
230
  /** DNG only: optional capture-event time (YYYY-MM-DDTHH:mm:ss.sssZ); without it no date tags are written. */
@@ -270,6 +289,13 @@ export interface SimulateCaptureOptions {
270
289
  */
271
290
  pixelAperture?: SimulateCapturePixelAperture;
272
291
  };
292
+ /**
293
+ * Exact or fast (#395). `false` or omitted: every option runs its exact method, the engine reference. `true`: each option
294
+ * listed in {@link SIMULATE_CAPTURE_FAST_OPTIONS} runs its fast method where it has one, a measured, bounded approximation of
295
+ * the exact one; an option without a fast method runs exact. An option's own record `fast` overrides this for that option
296
+ * only. `diagnostics.fast` reports what was requested and what ran. No option has a fast method yet, so every result is exact.
297
+ */
298
+ fast?: boolean;
273
299
  /** Aborting cancels the running task; the promise rejects with a domain error and returns no partial image. */
274
300
  signal?: AbortSignal;
275
301
  /** Called after each committed RAW, development or JPEG tile. Cannot change output. */
@@ -281,6 +307,22 @@ export interface SimulateCaptureOptions {
281
307
  */
282
308
  export declare const SIMULATE_CAPTURE_COST_OPTIONS: readonly ["lens.pupilSampling", "lens.projection", "lens.distortion", "lens.vignetting", "lens.psf", "lens.diffraction", "sensor.antiAliasing", "sensor.pixelAperture.box", "sensor.temporalSampleCount", "motion.rotation", "motion.shutter.rolling", "output.borderHandling.mirror", "output.region", "output.whiteBalance.auto", "output.demosaic.ahd", "output.highlightMode.reconstruct", "output.colorEncoding.wide-gamut", "output.gamutMapping.perceptual", "output.format.jpeg", "output.format.png", "output.format.dng"];
283
309
  export type SimulateCaptureCostOption = typeof SIMULATE_CAPTURE_COST_OPTIONS[number];
310
+ /**
311
+ * The options that take the exact-or-fast flag (#395), in the path style of {@link SIMULATE_CAPTURE_COST_OPTIONS}: each accepts
312
+ * the record form with `fast` and is reported in `diagnostics.fast.applied` when it runs. Every one of them takes the flag,
313
+ * whether or not it has a fast method yet; one without runs exact and reports `false`.
314
+ */
315
+ export declare const SIMULATE_CAPTURE_FAST_OPTIONS: readonly ["lens.diffraction", "sensor.antiAliasing", "sensor.pixelAperture.box", "output.demosaic.ahd"];
316
+ export type SimulateCaptureFastOption = typeof SIMULATE_CAPTURE_FAST_OPTIONS[number];
317
+ /** `diagnostics.fast` of a capture or display view (#395): what was asked for and what ran. */
318
+ export interface SimulateCaptureFastReport {
319
+ /** True when `fast: true` was given at the top level or in any option's record. */
320
+ requested: boolean;
321
+ /** Each fast-capable option that ran, in {@link SIMULATE_CAPTURE_FAST_OPTIONS} order: true where its fast method ran. */
322
+ applied: Readonly<Partial<Record<SimulateCaptureFastOption, boolean>>>;
323
+ /** `engine-reference` when every option ran exact; `approximation-with-a-priori-bound` when any fast method ran (the WebGPU execution record's values). */
324
+ assurance: "engine-reference" | "approximation-with-a-priori-bound";
325
+ }
284
326
  export interface SimulateCaptureProgress {
285
327
  stage: "raw" | "white-balance" | "development" | "jpeg";
286
328
  completedTileCount: number;
@@ -445,6 +487,8 @@ export interface SimulateCaptureResult {
445
487
  * the user's device.
446
488
  */
447
489
  options: readonly SimulateCaptureCostOption[];
490
+ /** #395: exact or fast, as requested and as run (see {@link SimulateCaptureFastReport}). */
491
+ fast: SimulateCaptureFastReport;
448
492
  };
449
493
  provenance: {
450
494
  scientificStatus: "approximation";
@@ -659,6 +703,8 @@ export interface DisplayViewResult {
659
703
  view: number;
660
704
  total: number;
661
705
  };
706
+ /** #395: exact or fast, as requested and as run (see {@link SimulateCaptureFastReport}). */
707
+ fast: SimulateCaptureFastReport;
662
708
  };
663
709
  provenance: {
664
710
  scientificStatus: "approximation";
@@ -674,6 +720,7 @@ export interface DisplayViewResult {
674
720
  /** Internal: the resolved request state that the display view's renderer (simulate-display-view.ts) reads. */
675
721
  export interface DisplayViewRunContext {
676
722
  ahd: boolean;
723
+ fastReport: SimulateCaptureFastReport;
677
724
  antiAliasing: ParsedAntiAliasing | undefined;
678
725
  aspect: number;
679
726
  assume: (id: string, kind: SimulateCaptureAssumption["kind"], value: unknown, explanation: string) => void;