@photivra/engine 2.17.0 → 2.19.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 (288) hide show
  1. package/CHANGELOG.md +116 -1
  2. package/CITATION.cff +1 -1
  3. package/README.md +6 -6
  4. package/SECURITY.md +1 -1
  5. package/dist/camera/sensor-equivalence.d.ts +156 -0
  6. package/dist/camera/sensor-equivalence.js +208 -0
  7. package/dist/camera/sensor-equivalence.js.map +1 -0
  8. package/dist/capture/focus-control.js +2 -75
  9. package/dist/capture/focus-control.js.map +1 -1
  10. package/dist/capture/native-environment-lean.d.ts +1 -0
  11. package/dist/capture/native-environment-lean.js +1 -1
  12. package/dist/capture/native-environment-lean.js.map +1 -1
  13. package/dist/capture/native-environment-optical-stage.d.ts +1 -0
  14. package/dist/capture/native-environment-optical-stage.js +2 -5
  15. package/dist/capture/native-environment-optical-stage.js.map +1 -1
  16. package/dist/capture/native-environment-raw.js +1 -5
  17. package/dist/capture/native-environment-raw.js.map +1 -1
  18. package/dist/capture/native-environment-tabulated.d.ts +5 -0
  19. package/dist/capture/native-environment-tabulated.js +1 -1
  20. package/dist/capture/native-environment-tabulated.js.map +1 -1
  21. package/dist/capture/release-sequence.js +2 -47
  22. package/dist/capture/release-sequence.js.map +1 -1
  23. package/dist/color/white-balance.d.ts +2 -0
  24. package/dist/color/white-balance.js +3 -56
  25. package/dist/color/white-balance.js.map +1 -1
  26. package/dist/composition/image-formation-plan.d.ts +1 -0
  27. package/dist/composition/image-formation-plan.js +3 -49
  28. package/dist/composition/image-formation-plan.js.map +1 -1
  29. package/dist/core/evidence-provenance.js +1 -16
  30. package/dist/core/evidence-provenance.js.map +1 -1
  31. package/dist/core/record-validation.d.ts +54 -0
  32. package/dist/core/record-validation.js +176 -0
  33. package/dist/core/record-validation.js.map +1 -1
  34. package/dist/core/scientific-assurance.js +1 -18
  35. package/dist/core/scientific-assurance.js.map +1 -1
  36. package/dist/core/shared-helpers.d.ts +33 -0
  37. package/dist/core/shared-helpers.js +34 -0
  38. package/dist/core/shared-helpers.js.map +1 -0
  39. package/dist/core/spectral-composition.js +1 -36
  40. package/dist/core/spectral-composition.js.map +1 -1
  41. package/dist/core/spectral.js +1 -19
  42. package/dist/core/spectral.js.map +1 -1
  43. package/dist/core/version.d.ts +1 -1
  44. package/dist/core/version.js +1 -1
  45. package/dist/core/version.js.map +1 -1
  46. package/dist/equipment/exposure-capabilities.d.ts +1 -0
  47. package/dist/equipment/exposure-capabilities.js +2 -36
  48. package/dist/equipment/exposure-capabilities.js.map +1 -1
  49. package/dist/equipment/ideal-lens.d.ts +25 -0
  50. package/dist/equipment/ideal-lens.js +21 -0
  51. package/dist/equipment/ideal-lens.js.map +1 -0
  52. package/dist/equipment/iso-capabilities.js +2 -49
  53. package/dist/equipment/iso-capabilities.js.map +1 -1
  54. package/dist/equipment/metering-capabilities.js +1 -26
  55. package/dist/equipment/metering-capabilities.js.map +1 -1
  56. package/dist/equipment/release-capabilities.js +1 -53
  57. package/dist/equipment/release-capabilities.js.map +1 -1
  58. package/dist/exposure/auto-iso-slowest-shutter.js +1 -7
  59. package/dist/exposure/auto-iso-slowest-shutter.js.map +1 -1
  60. package/dist/exposure/exposure-duration-control.js +1 -16
  61. package/dist/exposure/exposure-duration-control.js.map +1 -1
  62. package/dist/exposure/exposure-mode-resolver.js +1 -17
  63. package/dist/exposure/exposure-mode-resolver.js.map +1 -1
  64. package/dist/exposure/filtered-exposure-time.d.ts +93 -0
  65. package/dist/exposure/filtered-exposure-time.js +129 -0
  66. package/dist/exposure/filtered-exposure-time.js.map +1 -0
  67. package/dist/exposure/flash-ttl.d.ts +1 -0
  68. package/dist/exposure/flash-ttl.js +1 -1
  69. package/dist/exposure/flash-ttl.js.map +1 -1
  70. package/dist/exposure/flash.js +1 -49
  71. package/dist/exposure/flash.js.map +1 -1
  72. package/dist/exposure/metering-scene-radiance.js +1 -25
  73. package/dist/exposure/metering-scene-radiance.js.map +1 -1
  74. package/dist/exposure/metering-target.js +1 -30
  75. package/dist/exposure/metering-target.js.map +1 -1
  76. package/dist/exposure/metering-temporal.js +1 -8
  77. package/dist/exposure/metering-temporal.js.map +1 -1
  78. package/dist/exposure/metering.js +1 -72
  79. package/dist/exposure/metering.js.map +1 -1
  80. package/dist/exposure/program-line.js +1 -45
  81. package/dist/exposure/program-line.js.map +1 -1
  82. package/dist/facade/catalogue-lens-signal.d.ts +94 -0
  83. package/dist/facade/catalogue-lens-signal.js +362 -0
  84. package/dist/facade/catalogue-lens-signal.js.map +1 -0
  85. package/dist/facade/defocus-image-space-provider.js +5 -2
  86. package/dist/facade/defocus-image-space-provider.js.map +1 -1
  87. package/dist/facade/develop-joined-parts.d.ts +29 -0
  88. package/dist/facade/develop-joined-parts.js +33 -0
  89. package/dist/facade/develop-joined-parts.js.map +1 -0
  90. package/dist/facade/display-view-lens-signal.d.ts +32 -1
  91. package/dist/facade/display-view-lens-signal.js +85 -10
  92. package/dist/facade/display-view-lens-signal.js.map +1 -1
  93. package/dist/facade/expected-signal-setup.d.ts +8 -0
  94. package/dist/facade/expected-signal-setup.js +7 -0
  95. package/dist/facade/expected-signal-setup.js.map +1 -1
  96. package/dist/facade/expected-signal.d.ts +5 -0
  97. package/dist/facade/expected-signal.js +5 -1
  98. package/dist/facade/expected-signal.js.map +1 -1
  99. package/dist/facade/generic-lens-capture.d.ts +5 -2
  100. package/dist/facade/generic-lens-capture.js +5 -2
  101. package/dist/facade/generic-lens-capture.js.map +1 -1
  102. package/dist/facade/simulate-capture.d.ts +67 -8
  103. package/dist/facade/simulate-capture.js +262 -126
  104. package/dist/facade/simulate-capture.js.map +1 -1
  105. package/dist/facade/simulate-display-view.js +1 -1
  106. package/dist/facade/simulate-display-view.js.map +1 -1
  107. package/dist/gpu/chart-composite-gpu.js +1 -3
  108. package/dist/gpu/chart-composite-gpu.js.map +1 -1
  109. package/dist/gpu/chart-radiance-gpu.js +1 -5
  110. package/dist/gpu/chart-radiance-gpu.js.map +1 -1
  111. package/dist/gpu/display-view-quality-gpu.d.ts +13 -1
  112. package/dist/gpu/display-view-quality-gpu.js +4 -8
  113. package/dist/gpu/display-view-quality-gpu.js.map +1 -1
  114. package/dist/gpu/display-view-speed-gpu.js +3 -25
  115. package/dist/gpu/display-view-speed-gpu.js.map +1 -1
  116. package/dist/gpu/sensor-stage-gpu.js +1 -5
  117. package/dist/gpu/sensor-stage-gpu.js.map +1 -1
  118. package/dist/gpu/webgpu-runtime.d.ts +2 -0
  119. package/dist/gpu/webgpu-runtime.js +3 -0
  120. package/dist/gpu/webgpu-runtime.js.map +1 -1
  121. package/dist/index.d.ts +6 -1
  122. package/dist/index.js +5 -0
  123. package/dist/index.js.map +1 -1
  124. package/dist/motion/camera-rotation.js +1 -6
  125. package/dist/motion/camera-rotation.js.map +1 -1
  126. package/dist/motion/capture-rotation-inverse-mapping.d.ts +12 -0
  127. package/dist/motion/capture-rotation-inverse-mapping.js +2 -2
  128. package/dist/motion/capture-rotation-inverse-mapping.js.map +1 -1
  129. package/dist/motion/capture-rotation-temporal-quadrature.d.ts +1 -0
  130. package/dist/motion/capture-rotation-temporal-quadrature.js +1 -1
  131. package/dist/motion/capture-rotation-temporal-quadrature.js.map +1 -1
  132. package/dist/motion/capture-rotation-trajectory.js +2 -17
  133. package/dist/motion/capture-rotation-trajectory.js.map +1 -1
  134. package/dist/motion/capture-translation-parallax-temporal-quadrature.d.ts +1 -0
  135. package/dist/motion/capture-translation-parallax-temporal-quadrature.js +3 -14
  136. package/dist/motion/capture-translation-parallax-temporal-quadrature.js.map +1 -1
  137. package/dist/motion/extended-object-projection.js +5 -40
  138. package/dist/motion/extended-object-projection.js.map +1 -1
  139. package/dist/optics/atmospheric-haze.js +1 -7
  140. package/dist/optics/atmospheric-haze.js.map +1 -1
  141. package/dist/optics/brown-conrady-distortion.js +1 -7
  142. package/dist/optics/brown-conrady-distortion.js.map +1 -1
  143. package/dist/optics/complex-pupil-psf.d.ts +1 -0
  144. package/dist/optics/complex-pupil-psf.js +2 -84
  145. package/dist/optics/complex-pupil-psf.js.map +1 -1
  146. package/dist/optics/focus-state.js +1 -11
  147. package/dist/optics/focus-state.js.map +1 -1
  148. package/dist/optics/front-of-lens-filter.d.ts +5 -0
  149. package/dist/optics/front-of-lens-filter.js +3 -65
  150. package/dist/optics/front-of-lens-filter.js.map +1 -1
  151. package/dist/optics/generic-nd-filter-presets.d.ts +12 -0
  152. package/dist/optics/generic-nd-filter-presets.js +48 -0
  153. package/dist/optics/generic-nd-filter-presets.js.map +1 -0
  154. package/dist/optics/illumination-vignetting.js +1 -6
  155. package/dist/optics/illumination-vignetting.js.map +1 -1
  156. package/dist/optics/lens-psf-profile.d.ts +4 -1
  157. package/dist/optics/lens-psf-profile.js +12 -111
  158. package/dist/optics/lens-psf-profile.js.map +1 -1
  159. package/dist/optics/longitudinal-chromatic-aberration.js +1 -7
  160. package/dist/optics/longitudinal-chromatic-aberration.js.map +1 -1
  161. package/dist/optics/pupil-vignetting.js +1 -7
  162. package/dist/optics/pupil-vignetting.js.map +1 -1
  163. package/dist/optics/radial-distortion.js +1 -6
  164. package/dist/optics/radial-distortion.js.map +1 -1
  165. package/dist/optics/scene-to-sensor-irradiance.js +4 -96
  166. package/dist/optics/scene-to-sensor-irradiance.js.map +1 -1
  167. package/dist/optics/stray-light.d.ts +1 -0
  168. package/dist/optics/stray-light.js +1 -1
  169. package/dist/optics/stray-light.js.map +1 -1
  170. package/dist/optics/zernike-wavefront.js +1 -7
  171. package/dist/optics/zernike-wavefront.js.map +1 -1
  172. package/dist/output/capture-geometry.js +1 -8
  173. package/dist/output/capture-geometry.js.map +1 -1
  174. package/dist/output/developed-lens-corrections.d.ts +62 -0
  175. package/dist/output/developed-lens-corrections.js +135 -0
  176. package/dist/output/developed-lens-corrections.js.map +1 -0
  177. package/dist/output/generic-lens-corrections.d.ts +2 -6
  178. package/dist/output/generic-lens-corrections.js +3 -6
  179. package/dist/output/generic-lens-corrections.js.map +1 -1
  180. package/dist/output/geometric-transforms.js +1 -4
  181. package/dist/output/geometric-transforms.js.map +1 -1
  182. package/dist/output/native-capture-sdr.d.ts +2 -2
  183. package/dist/output/native-capture-sdr.js +3 -2
  184. package/dist/output/native-capture-sdr.js.map +1 -1
  185. package/dist/processing/development-detail.d.ts +29 -0
  186. package/dist/processing/development-detail.js +128 -107
  187. package/dist/processing/development-detail.js.map +1 -1
  188. package/dist/schema/illumination-temporal.js +3 -72
  189. package/dist/schema/illumination-temporal.js.map +1 -1
  190. package/dist/schema/illumination.d.ts +1 -0
  191. package/dist/schema/illumination.js +2 -65
  192. package/dist/schema/illumination.js.map +1 -1
  193. package/dist/schema/scene-radiance-temporal.js +2 -14
  194. package/dist/schema/scene-radiance-temporal.js.map +1 -1
  195. package/dist/schema/scene-radiance.js +2 -60
  196. package/dist/schema/scene-radiance.js.map +1 -1
  197. package/dist/schema/validation.d.ts +2 -0
  198. package/dist/schema/validation.js +2 -17
  199. package/dist/schema/validation.js.map +1 -1
  200. package/dist/sensor/accumulated-charge.js +2 -59
  201. package/dist/sensor/accumulated-charge.js.map +1 -1
  202. package/dist/sensor/architecture.js +1 -16
  203. package/dist/sensor/architecture.js.map +1 -1
  204. package/dist/sensor/camera-saturation-capacity.d.ts +1 -0
  205. package/dist/sensor/camera-saturation-capacity.js +3 -55
  206. package/dist/sensor/camera-saturation-capacity.js.map +1 -1
  207. package/dist/sensor/capture-color-sampling-binding.js +1 -26
  208. package/dist/sensor/capture-color-sampling-binding.js.map +1 -1
  209. package/dist/sensor/capture-mode-timing.js +1 -39
  210. package/dist/sensor/capture-mode-timing.js.map +1 -1
  211. package/dist/sensor/capture-mode.js +1 -23
  212. package/dist/sensor/capture-mode.js.map +1 -1
  213. package/dist/sensor/color-sampling.js +1 -26
  214. package/dist/sensor/color-sampling.js.map +1 -1
  215. package/dist/sensor/constant-rate-temporal-integration.js +2 -46
  216. package/dist/sensor/constant-rate-temporal-integration.js.map +1 -1
  217. package/dist/sensor/dark-current.js +2 -45
  218. package/dist/sensor/dark-current.js.map +1 -1
  219. package/dist/sensor/eqe-electron-rate.js +2 -35
  220. package/dist/sensor/eqe-electron-rate.js.map +1 -1
  221. package/dist/sensor/exposure-window.d.ts +5 -0
  222. package/dist/sensor/exposure-window.js +7 -22
  223. package/dist/sensor/exposure-window.js.map +1 -1
  224. package/dist/sensor/iso-gain.js +1 -7
  225. package/dist/sensor/iso-gain.js.map +1 -1
  226. package/dist/sensor/iso-signal-chain.js +1 -43
  227. package/dist/sensor/iso-signal-chain.js.map +1 -1
  228. package/dist/sensor/optical-stack.js +1 -25
  229. package/dist/sensor/optical-stack.js.map +1 -1
  230. package/dist/sensor/photon-energy.js +1 -26
  231. package/dist/sensor/photon-energy.js.map +1 -1
  232. package/dist/sensor/physical-charge-capacity.js +3 -77
  233. package/dist/sensor/physical-charge-capacity.js.map +1 -1
  234. package/dist/sensor/radiometry-readiness.js +2 -23
  235. package/dist/sensor/radiometry-readiness.js.map +1 -1
  236. package/dist/sensor/raw-readout.d.ts +3 -0
  237. package/dist/sensor/raw-readout.js +4 -66
  238. package/dist/sensor/raw-readout.js.map +1 -1
  239. package/dist/sensor/raw-reconstruction.js +2 -64
  240. package/dist/sensor/raw-reconstruction.js.map +1 -1
  241. package/dist/sensor/readout-exposure-linkage.js +1 -9
  242. package/dist/sensor/readout-exposure-linkage.js.map +1 -1
  243. package/dist/sensor/readout-timing.js +3 -57
  244. package/dist/sensor/readout-timing.js.map +1 -1
  245. package/dist/sensor/response-application-compatibility.d.ts +2 -0
  246. package/dist/sensor/response-application-compatibility.js +3 -29
  247. package/dist/sensor/response-application-compatibility.js.map +1 -1
  248. package/dist/sensor/response-operating-range.d.ts +1 -0
  249. package/dist/sensor/response-operating-range.js +3 -79
  250. package/dist/sensor/response-operating-range.js.map +1 -1
  251. package/dist/sensor/responsivity-photocurrent.js +4 -108
  252. package/dist/sensor/responsivity-photocurrent.js.map +1 -1
  253. package/dist/sensor/sampling-aperture.js +1 -25
  254. package/dist/sensor/sampling-aperture.js.map +1 -1
  255. package/dist/sensor/spatial-sample-reduction.js +2 -19
  256. package/dist/sensor/spatial-sample-reduction.js.map +1 -1
  257. package/dist/sensor/spatial-sampling-quadrature.js +1 -3
  258. package/dist/sensor/spatial-sampling-quadrature.js.map +1 -1
  259. package/dist/sensor/spatio-spectral-reduction.js +1 -18
  260. package/dist/sensor/spatio-spectral-reduction.js.map +1 -1
  261. package/dist/sensor/spectral-coverage.d.ts +10 -1
  262. package/dist/sensor/spectral-coverage.js +1 -1
  263. package/dist/sensor/spectral-coverage.js.map +1 -1
  264. package/dist/sensor/spectral-quadrature.js +2 -35
  265. package/dist/sensor/spectral-quadrature.js.map +1 -1
  266. package/dist/sensor/spectral-response.js +1 -47
  267. package/dist/sensor/spectral-response.js.map +1 -1
  268. package/dist/stabilization/camera-shake.js +1 -6
  269. package/dist/stabilization/camera-shake.js.map +1 -1
  270. package/dist/stabilization/system.js +2 -80
  271. package/dist/stabilization/system.js.map +1 -1
  272. package/docs/AGENT_GUIDE.md +4 -0
  273. package/docs/API_REFERENCE.md +69 -2
  274. package/docs/QUICK_START.md +136 -6
  275. package/docs/USAGE.md +89 -3
  276. package/docs/api/camera-sensor-equivalence.md +209 -0
  277. package/docs/api/core-version.md +1 -1
  278. package/docs/api/equipment-ideal-lens.md +26 -0
  279. package/docs/api/exports.json +118 -3
  280. package/docs/api/exposure-filtered-exposure-time.md +105 -0
  281. package/docs/api/facade-develop-joined-parts.md +32 -0
  282. package/docs/api/facade-simulate-capture.md +62 -8
  283. package/docs/api/optics-generic-nd-filter-presets.md +34 -0
  284. package/docs/api/optics-lens-psf-profile.md +3 -1
  285. package/docs/api/output-developed-lens-corrections.md +12 -0
  286. package/docs/api/output-generic-lens-corrections.md +0 -9
  287. package/llms.txt +3 -0
  288. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"display-view-lens-signal.js","sourceRoot":"","sources":["../../src/facade/display-view-lens-signal.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC;;;;;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AG,EAAE,CAAC,CAAC;gBAC7J,CAAC;YACD,OAAO,OAAO,CAAC;QACjB,CAAC,EAAE,CAAC,CAAC;IACP,OAAO;QACL,IAAI,OAAO,KAAa,OAAO,OAAO,EAAE,CAAC,CAAC,CAAC;QAC3C,eAAe,EAAE,CAAC,CAAC;QACnB,cAAc,EAAE,KAAK;QACrB,WAAW,EAAE,KAAK;QAClB,UAAU,EAAE,KAAK;QACjB,SAAS,KAAmD,CAAC;QAC7D,MAAM,KAAuF,CAAC;QAC9F,IAAI,CAAC,CAAS,EAAE,CAAS,IAAY,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACrF,KAAK;KACN,CAAC;AACJ,CAAC","sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\n/**\n * The display view's expected signal with a lens field mapping (`lens.projection`, `lens.distortion`), `lens.vignetting` or\n * camera rotation (#563), in focus and with `lens.defocus` out of focus. Loaded on demand (a dynamic import in `runCapture`),\n * so a display view without these options, and a bundle that never asks for them, does not load it.\n *\n * What it computes. The capture's environment chain forms, for site (i, j) of CFA channel c,\n * μ_c(i, j) = Σ_o w_o · (1/T) Σ_t Σ_λ A_c(λ) Σ_k K_λ(k) · F(s) · L(D_t(s), λ), s = q_o(i, j) − k·p,\n * with q_o the query point of offset o (pixel-aperture node minus anti-aliasing split), K_λ the site kernel (diffraction, the\n * defocus disc or both; a single unit tap without them), D_t the scene ray of sensor point s at temporal midpoint t (inverse\n * distortion, the declared projection, the camera rotation at t), F = T·A its field factor (vignetting throughput × distortion\n * area factor) and A_c(λ) the electrons per unit spectral radiance on the axis (the display view's channel response, ideal\n * optics). In focus with a kernel this is the environment PSF quadrature (the field factor applied once at the source point,\n * before the PSF spreads the light); out of focus it is #548's image-space disc, the same sum in another order\n * (`defocus-image-space-provider.ts`); without a kernel it is the environment's own per-query sum. Only the scene access changes:\n * the readout, the estimators, the demosaic and the development run unchanged on these site values.\n *\n * Scene points. Without a kernel each query point is formed with the environment's own arithmetic (the site centre, aperture node\n * and split offset of `native-environment-lean.ts`), then `lookOf` (the environment's mapping, rotation and field factor,\n * #548) and the planar provider's plane-point arithmetic, so a point exactly on a chart boundary resolves as in the capture.\n * With a kernel the sources are the site lattice of each fractional offset, with #548's lattice formula. Kernels, materials and\n * per-material sums are the display view's own tables (`displayViewSignalTables`), shared with the rectilinear path.\n *\n * Caches (memory only, never values): site values in a ring of native rows across windows, and with a kernel each lattice\n * point's material (or radiance at each node) and field factor per lattice group and temporal midpoint, in a two-dimensional\n * ring tagged with the point, sized from the window and capped at LATTICE_CACHE_LIMIT entries (beyond it, points are\n * evaluated as they are read).\n *\n * Large defocus kernels (#564, `input.largeKernel`, radius above 64 sites). The image-space disc D is the same at every lattice\n * group, spectral node and temporal midpoint, so it commutes with those sums as in the rectilinear signal (`expected-signal.ts`):\n * μ_c(x) = Σ_s D(s)·E_c(x − s), with E_c(x) the sum above through the in-focus kernels (each node's diffraction kernel, or a unit\n * tap) at site position x for channel c, whatever x's own channel. E is computed in fixed 64-site tiles (all three channels, each\n * group's lattice points mapped once per tile and midpoint), and D ⊛ E_c by runs (`site-kernel-runs.ts`) in fixed 128-site tiles,\n * each site taking its own channel: every value depends only on its site, so regions and parts equal the whole view.\n */\n\nimport { InvalidConfigurationError } from \"../core/configuration-error.js\";\nimport { createSiteKernelRunsLattice, type SiteKernelRunsRowPattern } from \"../optics/site-kernel-runs.js\";\nimport type { PreparedDefocusImageSpaceGeometry } from \"./defocus-image-space-provider.js\";\nimport { displayViewSignalTables, type DisplayViewExpectedSignal, type DisplayViewExpectedSignalInput } from \"./expected-signal.js\";\n\n/** What the lens signal needs from the resolved request. */\nexport interface DisplayViewLensSetup {\n geometry: PreparedDefocusImageSpaceGeometry;\n /** Temporal midpoints, seconds from exposure start: (i + 0.5)·shutter/T with camera rotation, [0] without. */\n times: readonly number[];\n /** The planar provider's plane distance and frame-unit scale. */\n distanceM: number;\n metresPerFrameUnit: number;\n pitch: number;\n imagingArea: { widthMm: number; heightMm: number };\n boxSamples: number;\n /** Anti-aliasing split spots (or one zero spot), in the order of the expected signal's offsets within each aperture node. */\n spots: readonly { offsetMicrometers: { x: number; y: number } }[];\n}\n\n/** Largest lattice cache, in entries over all lattice groups and temporal midpoints (times the spectral nodes for radiance scenes). */\nconst LATTICE_CACHE_LIMIT = 1 << 22;\n\nconst pow2 = (n: number): number => { let p = 1; while (p < n) p *= 2; return p; };\n\n/**\n * Checks that the mapping and the vignetting profile cover the farthest source point the view reads, (W/2 + reachSites, H/2 + reachSites)\n * sites from the axis at each corner (reachSites: the kernel radius plus the largest query offset, less the half site to the outer site\n * centre), and returns the factory of the view's expected signal for this request.\n */\nexport function prepareDisplayViewLensSignal(lens: DisplayViewLensSetup, nativeWidth: number, nativeHeight: number, reachSites: number, options: string):\n (input: DisplayViewExpectedSignalInput, spanColumns?: number) => DisplayViewExpectedSignal {\n const xMm = (nativeWidth / 2 + reachSites) * lens.pitch / 1000, yMm = (nativeHeight / 2 + reachSites) * lens.pitch / 1000;\n for (const t of lens.times) for (const [x, y] of [[-xMm, -yMm], [xMm, -yMm], [-xMm, yMm], [xMm, yMm]] as const) {\n try { if (!(lens.geometry.lookOf(x, y, t).z > 0)) throw new InvalidConfigurationError(\"its ray does not point toward the scene plane.\"); } catch (error) {\n throw new InvalidConfigurationError(\"simulateDisplayView with \" + options + \" reads the scene through the lens up to \" + (reachSites + 0.5) + \" sites beyond the native \" +\n \"raster's outer site centres (the kernel radius and the query offsets), and there (\" + Math.hypot(x, y).toFixed(3) + \" mm from the axis) \" + (error as Error).message);\n }\n }\n return (input, spanColumns = Infinity) => createLensSignal(lens, input, spanColumns);\n}\n\nfunction createLensSignal(lens: DisplayViewLensSetup, input: DisplayViewExpectedSignalInput, spanColumns: number): DisplayViewExpectedSignal {\n const W = input.nativeWidth, H = input.nativeHeight, nodes = input.wavelengthsNm.length, T = lens.times.length, times = lens.times;\n const { geometry, distanceM: distance, metresPerFrameUnit: scale, pitch, imagingArea } = lens;\n const mmPerSite = pitch / 1000, scene = input.scene, offsets = input.offsets, A = input.electronsPerRadiance, channelAt = input.channelAt;\n const materials = scene.kind === \"materials\" ? scene : undefined, radianceAt = scene.kind === \"radiance\" ? scene.radianceAt : undefined;\n const { reflectance, spectralIndex, neutralDirect, spectralDirect, groups } = displayViewSignalTables(input);\n const kernels = input.kernels, R = kernels ? kernels.radius : 0;\n let lookups = 0;\n // The plane point (frame units) and field factor of native sensor point (x, y) mm at time t: the environment's mapping (lookOf) and\n // the planar provider's own arithmetic for the outgoing direction −look.\n let pu = 0, pv = 0, pf = 0;\n const map = (xMm: number, yMm: number, t: number): void => {\n const look = geometry.lookOf(xMm, yMm, t);\n if (!(look.z > 0)) throw new InvalidConfigurationError(\"simulateDisplayView: a query ray does not point toward the scene plane.\");\n const s = distance / look.z;\n pu = look.x * s / scale; pv = look.y * s / scale; pf = look.factor;\n };\n const materialOf = (m: number): number => { if (spectralIndex[m] === undefined) throw new InvalidConfigurationError(\"Unknown chart material.\"); return m; };\n // Without a kernel: the environment's query point of offset o of site (x, y) (native-environment-lean.ts, as buildExpectedSignalInput's queryPoint).\n const box = lens.boxSamples, siteWidthMm = pitch / 1000;\n const phases = offsets.map((_, o) => {\n const node = Math.floor(o / lens.spots.length), spot = lens.spots[o % lens.spots.length]!.offsetMicrometers;\n return { xPhase: (node % box + 0.5) / box, yPhase: (Math.floor(node / box) + 0.5) / box, aaX: spot.x / 1000, aaY: spot.y / 1000 };\n });\n function directSite(x: number, y: number): number {\n const c = channelAt(x, y), centerX = -imagingArea.widthMm / 2 + (pitch / 2 + x * pitch + 0) / 1000, centerY = -imagingArea.heightMm / 2 + (pitch / 2 + y * pitch + 0) / 1000;\n let total = 0;\n for (let ti = 0; ti < T; ti++) {\n let sum = 0;\n for (let o = 0; o < offsets.length; o++) {\n const node = phases[o]!;\n map((centerX - siteWidthMm / 2 + node.xPhase * siteWidthMm) - node.aaX, (centerY - siteWidthMm / 2 + node.yPhase * siteWidthMm) - node.aaY, times[ti]!);\n let value: number;\n if (materials) {\n const m = materialOf(materials.materialAt(pu, pv)), si = spectralIndex[m]!;\n value = si < 0 ? reflectance[m]! * neutralDirect[c]! : spectralDirect[c]![si]!; lookups++;\n } else { value = 0; for (let n = 0; n < nodes; n++) value += A[c]![n]! * radianceAt!(pu, pv, input.wavelengthsNm[n]!); lookups += nodes; }\n sum += offsets[o]!.weight * (pf * value);\n }\n total += sum;\n }\n return total / T;\n }\n // With a kernel: lattice point (p, q) of group g at time t, #548's lattice formula, cached in a ring tagged with (p, q).\n const G = groups.length, slots = G * T, per = materials ? 1 : nodes;\n let cacheRows = 0, cacheCols = 0, tagQ = new Int32Array(0), tagP = new Int32Array(0), cacheMaterial = new Int32Array(0), cacheFactor = new Float64Array(0), cacheRadiance = new Float64Array(0);\n const radiance = new Float64Array(nodes);\n let lm = 0, lf = 0;\n function lattice(g: number, ti: number, p: number, q: number): void {\n let k = -1;\n if (cacheRows > 0) {\n k = ((g * T + ti) * cacheRows + (q & (cacheRows - 1))) * cacheCols + (p & (cacheCols - 1));\n if (tagQ[k] === q && tagP[k] === p) {\n lf = cacheFactor[k]!;\n if (materials) lm = cacheMaterial[k]!; else for (let n = 0; n < nodes; n++) radiance[n] = cacheRadiance[k * nodes + n]!;\n return;\n }\n }\n const group = groups[g]!;\n map((p + 0.5 + group.fx - W / 2) * mmPerSite, (q + 0.5 + group.fy - H / 2) * mmPerSite, times[ti]!);\n lf = pf;\n if (materials) { lm = materialOf(materials.materialAt(pu, pv)); lookups++; }\n else { for (let n = 0; n < nodes; n++) radiance[n] = radianceAt!(pu, pv, input.wavelengthsNm[n]!); lookups += nodes; }\n if (k >= 0) {\n tagQ[k] = q; tagP[k] = p; cacheFactor[k] = lf;\n if (materials) cacheMaterial[k] = lm; else for (let n = 0; n < nodes; n++) cacheRadiance[k * nodes + n] = radiance[n]!;\n }\n }\n function kernelSite(x: number, y: number): number {\n const c = channelAt(x, y), rowMask = cacheRows - 1, colMask = cacheCols - 1;\n let total = 0;\n for (let ti = 0; ti < T; ti++) {\n let sum = 0;\n for (let g = 0; g < G; g++) {\n const group = groups[g]!, p0 = x + group.minIx - R, q0 = y + group.minIy - R, cw = group.cw, ch = group.ch;\n if (materials) {\n const nk = group.neutral[c]!, sk = group.spectral[c]!;\n for (let dy = 0, t = 0; dy < ch; dy++) {\n // The cache row of lattice row q (read inline: the common case is a hit).\n const q = q0 + dy, row = cacheRows > 0 ? ((g * T + ti) * cacheRows + (q & rowMask)) * cacheCols : -1;\n for (let dx = 0; dx < cw; dx++, t++) {\n const p = p0 + dx, k = row + (p & colMask);\n if (row >= 0 && tagQ[k] === q && tagP[k] === p) { lm = cacheMaterial[k]!; lf = cacheFactor[k]!; } else lattice(g, ti, p, q);\n const si = spectralIndex[lm]!;\n sum += lf * (si < 0 ? reflectance[lm]! * nk[t]! : sk[si]![t]!);\n }\n }\n } else for (let dy = 0, t = 0; dy < ch; dy++) for (let dx = 0; dx < cw; dx++, t++) {\n lattice(g, ti, p0 + dx, q0 + dy);\n let value = 0;\n for (let n = 0; n < nodes; n++) value += group.perNode[n]![c]![t]! * radiance[n]!;\n sum += lf * value;\n }\n }\n total += sum;\n }\n return total / T;\n }\n const pilotNode = input.wavelengthsNm[Math.floor(nodes / 2)]!;\n if (input.largeKernel) return createLargeLensSignal(input, inFocusLensTile, () => lookups, pilot);\n /** E_c (#564) of the native site positions [x0, x0 + T) × [y0, y0 + T) for the three channels: kernelSite's sum for each channel. */\n function inFocusLensTile(x0: number, y0: number, TS: number): Float64Array[] {\n const out = [0, 1, 2].map(() => new Float64Array(TS * TS));\n // A fixed tile reaches past the raster: positions more than the disc's radius beyond it feed no site, so they stay 0 and are never\n // mapped (the lens profiles are checked only up to the view's reach).\n const D = input.largeKernel!.radius;\n if (x0 + TS <= -D || x0 >= W + D || y0 + TS <= -D || y0 >= H + D) return out;\n if (x0 < -D || x0 + TS > W + D || y0 < -D || y0 + TS > H + D) {\n const xa = Math.max(x0, -D), xb = Math.min(x0 + TS, W + D), ya = Math.max(y0, -D), yb = Math.min(y0 + TS, H + D);\n const part = inFocusLensRect(xa, ya, xb - xa, yb - ya);\n for (let c = 0; c < 3; c++) for (let y = ya; y < yb; y++) out[c]!.set(part[c]!.subarray((y - ya) * (xb - xa), (y - ya + 1) * (xb - xa)), (y - y0) * TS + xa - x0);\n return out;\n }\n return inFocusLensRect(x0, y0, TS, TS);\n }\n /** E_c of the native site positions [x0, x0 + w) × [y0, y0 + h), row-major, for the three channels. */\n function inFocusLensRect(x0: number, y0: number, TW: number, TH: number): Float64Array[] {\n const out = [0, 1, 2].map(() => new Float64Array(TW * TH)), sum = [0, 1, 2].map(() => new Float64Array(TW * TH));\n for (let ti = 0; ti < T; ti++) {\n for (const e of sum) e.fill(0);\n for (const group of groups) {\n const cw = group.cw, ch = group.ch, gw = TW + cw - 1, gh = TH + ch - 1, p0 = x0 + group.minIx - R, q0 = y0 + group.minIy - R;\n const factor = new Float64Array(gw * gh), material = materials ? new Int32Array(gw * gh) : undefined, values = materials ? undefined : new Float64Array(gw * gh * nodes);\n for (let j = 0; j < gh; j++) for (let i = 0; i < gw; i++) {\n const k = j * gw + i;\n map((p0 + i + 0.5 + group.fx - W / 2) * mmPerSite, (q0 + j + 0.5 + group.fy - H / 2) * mmPerSite, times[ti]!);\n factor[k] = pf;\n if (material) material[k] = materialOf(materials!.materialAt(pu, pv));\n else for (let n = 0; n < nodes; n++) values![k * nodes + n] = radianceAt!(pu, pv, input.wavelengthsNm[n]!);\n }\n lookups += material ? gw * gh : gw * gh * nodes;\n for (let c = 0; c < 3; c++) {\n const e = sum[c]!, nk = group.neutral[c], sk = group.spectral[c];\n for (let y = 0; y < TH; y++) for (let x = 0; x < TW; x++) {\n let v = 0;\n for (let dy = 0, t = 0; dy < ch; dy++) for (let dx = 0; dx < cw; dx++, t++) {\n const k = (y + dy) * gw + x + dx;\n if (material) { const m = material[k]!, si = spectralIndex[m]!; v += factor[k]! * (si < 0 ? reflectance[m]! * nk![t]! : sk![si]![t]!); }\n else { let r = 0; for (let n = 0; n < nodes; n++) r += group.perNode[n]![c]![t]! * values![k * nodes + n]!; v += factor[k]! * r; }\n }\n e[y * TW + x] = e[y * TW + x]! + v;\n }\n }\n }\n for (let c = 0; c < 3; c++) { const o = out[c]!, e = sum[c]!; for (let k = 0; k < o.length; k++) o[k] = o[k]! + e[k]!; }\n }\n for (const o of out) for (let k = 0; k < o.length; k++) o[k] = o[k]! / T;\n return out;\n }\n // Site values persist across windows in a ring of native rows (a site's value does not depend on the window).\n let ringRows = 0, ring = new Float64Array(0), ringRowId = new Int32Array(0), ringOn = false;\n const compute = kernels ? kernelSite : directSite;\n return {\n get lookups(): number { return lookups; },\n uniformMaterial: -1,\n tracksMaterial: false,\n get cachesSites(): boolean { return ringOn; },\n marksReads: false,\n markReads(): void { /* never called: marksReads is false */ },\n window(x0: number, y0: number, x1: number, y1: number): void {\n const sw = Math.max(0, x1 - x0), sh = Math.max(0, y1 - y0);\n if (sh > 0 && ringRows < 2 * sh) {\n const rows = pow2(2 * sh);\n if (rows * W <= LATTICE_CACHE_LIMIT) { ringRows = rows; ring = new Float64Array(rows * W).fill(NaN); ringRowId = new Int32Array(rows).fill(-1); }\n }\n ringOn = sh > 0 && ringRows >= 2 * sh;\n if (!kernels || sw === 0) return;\n // The lattice rectangle the window's sites read, per group; the cache keeps two such heights and the columns the render's windows span.\n let cw = 0, ch = 0;\n for (const group of groups) { cw = Math.max(cw, group.cw); ch = Math.max(ch, group.ch); }\n const height = sh + ch - 1, width = sw + cw - 1;\n let rows = pow2(2 * height), cols = pow2(Math.min(W + 2 * (R + cw), Math.max(width, (Number.isFinite(spanColumns) ? spanColumns : W) + width)));\n if (slots * per * rows * cols > LATTICE_CACHE_LIMIT) rows = pow2(height);\n if (slots * per * rows * cols > LATTICE_CACHE_LIMIT) cols = pow2(width);\n if (slots * per * rows * cols > LATTICE_CACHE_LIMIT) { cacheRows = 0; return; }\n if (rows > cacheRows || cols > cacheCols) {\n rows = Math.max(rows, cacheRows); cols = Math.max(cols, cacheCols);\n if (slots * per * rows * cols > LATTICE_CACHE_LIMIT) { rows = pow2(height); cols = pow2(width); }\n cacheRows = rows; cacheCols = cols;\n const size = slots * rows * cols;\n tagQ = new Int32Array(size).fill(-2147483648); tagP = new Int32Array(size); cacheFactor = new Float64Array(size);\n if (materials) cacheMaterial = new Int32Array(size); else cacheRadiance = new Float64Array(size * nodes);\n }\n },\n site(x: number, y: number): number {\n if (!ringOn) return compute(x, y);\n const slot = y & (ringRows - 1), k = slot * W + x;\n if (ringRowId[slot] === y) { const v = ring[k]!; if (v === v) return v; }\n else { ringRowId[slot] = y; ring.fill(NaN, slot * W, (slot + 1) * W); }\n const v = compute(x, y);\n ring[k] = v;\n return v;\n },\n pilot\n };\n /**\n * The renderer's pilot point is a rectilinear plane point of the native raster: back to the sensor point, then through the lens at\n * every temporal midpoint. A point whose scene value differs between the instants (motion) counts as detail (NaN equals nothing).\n */\n function pilot(u: number, v: number): number {\n const g = 2 / input.outputWidth, xMm = u / g * mmPerSite, yMm = -v / g * mmPerSite;\n let first = NaN;\n try {\n for (let ti = 0; ti < T; ti++) {\n map(xMm, yMm, times[ti]!);\n const value = materials ? materials.materialAt(pu, pv) : radianceAt!(pu, pv, pilotNode);\n lookups++;\n if (ti === 0) first = value; else if (value !== first) return NaN;\n }\n } catch { return NaN; }\n return first;\n }\n}\n\n/** #564: tile sides of the large-kernel lens signal (the in-focus E and the convolved sites) and the bytes each tile cache keeps. */\nconst LARGE_E_TILE = 64, LARGE_OUTPUT_TILE = 128, LARGE_CACHE_BYTES = 32 * 1048576;\n\n/** #564: the lens signal with a defocus kernel above 64 sites: D ⊛ E_c by runs over the in-focus tiles (see the module comment). */\nfunction createLargeLensSignal(input: DisplayViewExpectedSignalInput, inFocusTile: (x0: number, y0: number, T: number) => Float64Array[], lookups: () => number,\n pilot: (u: number, v: number) => number): DisplayViewExpectedSignal {\n const runs = input.largeKernel!, channelAt = input.channelAt, TE = LARGE_E_TILE;\n // At least the in-focus tiles one output tile's source spans plus one more row of them, so the next output tile of a row reuses them.\n const span = Math.ceil((LARGE_OUTPUT_TILE + 2 * runs.radius) / TE) + 1;\n const inFocus = new Map<number, Float64Array[]>(), capacity = Math.max(span * (span + 1), Math.floor(LARGE_CACHE_BYTES / (3 * TE * TE * 8)));\n const tileAt = (tx: number, ty: number): Float64Array[] => {\n const key = (ty + 1048576) * 2097152 + tx + 1048576;\n let tile = inFocus.get(key);\n if (tile) { inFocus.delete(key); inFocus.set(key, tile); }\n else {\n tile = inFocusTile(tx * TE, ty * TE, TE);\n inFocus.set(key, tile);\n if (inFocus.size > capacity) inFocus.delete(inFocus.keys().next().value!);\n }\n return tile;\n };\n // Which sites of a tile row hold channel c: the CFA's 2 × 2 period (tile origins are even).\n const phase = [0, 1].map((py) => [0, 1].map((px) => channelAt(px, py)));\n const patterns: SiteKernelRunsRowPattern[] = [0, 1, 2].map((c) => (row: number) => {\n const p = phase[row & 1]!, even = p[0] === c, odd = p[1] === c;\n return even && odd ? { start: 0, step: 1 } : even ? { start: 0, step: 2 } : odd ? { start: 1, step: 2 } : null;\n });\n const lattice = createSiteKernelRunsLattice({ runs, tile: LARGE_OUTPUT_TILE, fields: 3, capacityBytes: LARGE_CACHE_BYTES, pattern: (c) => patterns[c],\n source: (x0, y0, width, height) => (c: number): Float64Array => {\n const samples = new Float64Array(width * height);\n for (let ty = Math.floor(y0 / TE); ty * TE < y0 + height; ty++) for (let tx = Math.floor(x0 / TE); tx * TE < x0 + width; tx++) {\n const tile = tileAt(tx, ty)[c]!, ax = Math.max(x0, tx * TE), bx = Math.min(x0 + width, (tx + 1) * TE), ay = Math.max(y0, ty * TE), by = Math.min(y0 + height, (ty + 1) * TE);\n for (let y = ay; y < by; y++) samples.set(tile.subarray((y - ty * TE) * TE + ax - tx * TE, (y - ty * TE) * TE + bx - tx * TE), (y - y0) * width + ax - x0);\n }\n return samples;\n } });\n return {\n get lookups(): number { return lookups(); },\n uniformMaterial: -1,\n tracksMaterial: false,\n cachesSites: false,\n marksReads: false,\n markReads(): void { /* never called: marksReads is false */ },\n window(): void { /* the tiles are fixed and kept for the signal; a window changes nothing */ },\n site(x: number, y: number): number { return lattice.valueAt(channelAt(x, y), x, y); },\n pilot\n };\n}\n"]}
1
+ {"version":3,"file":"display-view-lens-signal.js","sourceRoot":"","sources":["../../src/facade/display-view-lens-signal.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,2BAA2B,EAAiC,MAAM,+BAA+B,CAAC;AAE3G,OAAO,EAAE,2BAA2B,EAAmC,MAAM,+BAA+B,CAAC;AAC7G,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAyF,MAAM,sBAAsB,CAAC;AAEnK,+DAA+D;AAC/D,MAAM,CAAC,MAAM,2BAA2B,GAAG,EAAE,CAAC;AAa9C;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CAAC,GAAsE,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,KAAa;IAC7J,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,2BAA2B,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5G,MAAM,MAAM,GAAG,CAAC,CAAS,EAAE,CAAS,EAAU,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAChG,MAAM,SAAS,GAAG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AC;YACD,OAAO,OAAO,CAAC;QACjB,CAAC,EAAE,CAAC,CAAC;IACP,OAAO;QACL,IAAI,OAAO,KAAa,OAAO,OAAO,EAAE,CAAC,CAAC,CAAC;QAC3C,eAAe,EAAE,CAAC,CAAC;QACnB,cAAc,EAAE,KAAK;QACrB,WAAW,EAAE,KAAK;QAClB,UAAU,EAAE,KAAK;QACjB,SAAS,KAAmD,CAAC;QAC7D,MAAM,KAAuF,CAAC;QAC9F,IAAI,CAAC,CAAS,EAAE,CAAS,IAAY,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACrF,KAAK;KACN,CAAC;AACJ,CAAC","sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\n/**\n * The display view's expected signal with a lens field mapping (`lens.projection`, `lens.distortion`), `lens.vignetting` or\n * camera rotation (#563), in focus and with `lens.defocus` out of focus. Loaded on demand (a dynamic import in `runCapture`),\n * so a display view without these options, and a bundle that never asks for them, does not load it.\n *\n * What it computes. The capture's environment chain forms, for site (i, j) of CFA channel c,\n * μ_c(i, j) = Σ_o w_o · (1/T) Σ_t Σ_λ A_c(λ) Σ_k K_λ(k) · F(s) · L(D_t(s), λ), s = q_o(i, j) − k·p,\n * with q_o the query point of offset o (pixel-aperture node minus anti-aliasing split), K_λ the site kernel (diffraction, the\n * defocus disc or both; a single unit tap without them), D_t the scene ray of sensor point s at temporal midpoint t (inverse\n * distortion, the declared projection, the camera rotation at t), F = T·A its field factor (vignetting throughput × distortion\n * area factor) and A_c(λ) the electrons per unit spectral radiance on the axis (the display view's channel response, ideal\n * optics). In focus with a kernel this is the environment PSF quadrature (the field factor applied once at the source point,\n * before the PSF spreads the light); out of focus it is #548's image-space disc, the same sum in another order\n * (`defocus-image-space-provider.ts`); without a kernel it is the environment's own per-query sum. Only the scene access changes:\n * the readout, the estimators, the demosaic and the development run unchanged on these site values.\n *\n * Scene points. Without a kernel each query point is formed with the environment's own arithmetic (the site centre, aperture node\n * and split offset of `native-environment-lean.ts`), then `lookOf` (the environment's mapping, rotation and field factor,\n * #548) and the planar provider's plane-point arithmetic, so a point exactly on a chart boundary resolves as in the capture.\n * With a kernel the sources are the site lattice of each fractional offset, with #548's lattice formula. Kernels, materials and\n * per-material sums are the display view's own tables (`displayViewSignalTables`), shared with the rectilinear path.\n *\n * Caches (memory only, never values): site values in a ring of native rows across windows, and with a kernel each lattice\n * point's material (or radiance at each node) and field factor per lattice group and temporal midpoint, in a two-dimensional\n * ring tagged with the point, sized from the window and capped at LATTICE_CACHE_LIMIT entries (beyond it, points are\n * evaluated as they are read).\n *\n * Field-dependent PSF (#569, `lens.catalogue`; {@link createDisplayViewLensPsf}). The capture's environment PSF quadrature resolves the\n * catalogue lens's sampled PSF at each query point's own field position. The view cuts the native raster into square zones of\n * Z = ⌈max(W, H) / DISPLAY_VIEW_LENS_PSF_ZONES⌉ sites (one site on frames of at most that many sites a side) and every site of a zone\n * takes the PSF the capture's own resolver gives at the zone's centre, at each spectral node (an approximation: the PSF's change\n * across half a zone). A profile kernel's rows run with image +Y (up) and its tap (i, j) reads (x − (i − c)·p, y + (j − c)·p) in\n * native coordinates (`sensorPsfSourcePoint`), so the view's kernel (reading in(x − t)) is the profile kernel flipped vertically.\n * Each zone's combined kernels are the expected signal's own tables (`buildTables`) with the zone's kernels, built when a site of\n * the zone is first read and kept per input in a least-recently-used cache of at most 64 MB (at least four zones).\n *\n * Large defocus kernels (#564, `input.largeKernel`, radius above 64 sites). The image-space disc D is the same at every lattice\n * group, spectral node and temporal midpoint, so it commutes with those sums as in the rectilinear signal (`expected-signal.ts`):\n * μ_c(x) = Σ_s D(s)·E_c(x − s), with E_c(x) the sum above through the in-focus kernels (each node's diffraction kernel, or a unit\n * tap) at site position x for channel c, whatever x's own channel. E is computed in fixed 64-site tiles (all three channels, each\n * group's lattice points mapped once per tile and midpoint), and D ⊛ E_c by runs (`site-kernel-runs.ts`) in fixed 128-site tiles,\n * each site taking its own channel: every value depends only on its site, so regions and parts equal the whole view.\n */\n\nimport { InvalidConfigurationError } from \"../core/configuration-error.js\";\nimport { createSiteKernelRunsLattice, type SiteKernelRunsRowPattern } from \"../optics/site-kernel-runs.js\";\nimport type { PreparedDefocusImageSpaceGeometry } from \"./defocus-image-space-provider.js\";\nimport { resolveLensSampledPsfKernel, type ResolveLensSampledPsfInput } from \"../optics/lens-psf-profile.js\";\nimport { buildTables, displayViewSignalTables, type DisplayViewExpectedSignal, type DisplayViewExpectedSignalInput, type GroupTables } from \"./expected-signal.js\";\n\n/** #569: field zones along the native raster's longer side. */\nexport const DISPLAY_VIEW_LENS_PSF_ZONES = 64;\n\n/** #569: a field-dependent PSF for the display view (see the module comment). */\nexport interface DisplayViewLensPsf {\n /** Kernel radius and zone side, in sites. */\n readonly radius: number;\n readonly zoneSites: number;\n /** The kernels at the frame centre's zone, for the expected-signal input's lattice groups and reach. */\n axisKernels(wavelengthsNm: readonly number[]): { radius: number; perNode: Float64Array[] };\n /** The combined kernels of the zone of native site (x, y), for an input whose kernels are the axis kernels. */\n tables(input: DisplayViewExpectedSignalInput): (x: number, y: number) => readonly GroupTables[];\n}\n\n/**\n * #569: the field-dependent PSF of a display view from the sampled PSF the capture resolves (everything but the field point and wavelength),\n * of kernel radius R, on the W × H native raster of `pitch` µm.\n */\nexport function createDisplayViewLensPsf(psf: Omit<ResolveLensSampledPsfInput, \"fieldPointMm\" | \"wavelengthNm\">, R: number, W: number, H: number, pitch: number): DisplayViewLensPsf {\n const Z = Math.ceil(Math.max(W, H) / DISPLAY_VIEW_LENS_PSF_ZONES), zonesX = Math.ceil(W / Z), w = 2 * R + 1;\n const zoneOf = (x: number, y: number): number => Math.floor(y / Z) * zonesX + Math.floor(x / Z);\n const kernelsOf = (zone: number, wavelengthsNm: readonly number[]): Float64Array[] => {\n // The zone's centre in sites from the top-left corner (an edge zone may be narrower), in image millimetres (+Y up).\n const zx = zone % zonesX, zy = (zone - zx) / zonesX, fieldPointMm = { x: ((zx * Z + Math.min(W, zx * Z + Z)) / 2 - W / 2) * pitch / 1000,\n y: (H / 2 - (zy * Z + Math.min(H, zy * Z + Z)) / 2) * pitch / 1000 };\n return wavelengthsNm.map((wavelengthNm) => {\n // Every node of the engine-built profile has the same (2R + 1)² window, so every resolved kernel has it too.\n const values = resolveLensSampledPsfKernel({ ...psf, fieldPointMm, wavelengthNm } as ResolveLensSampledPsfInput).normalizedIntensity, out = new Float64Array(w * w);\n for (let j = 0; j < w; j++) for (let i = 0; i < w; i++) out[(w - 1 - j) * w + i] = values[j * w + i]!;\n return out;\n });\n };\n const caches = new WeakMap<DisplayViewExpectedSignalInput, (x: number, y: number) => readonly GroupTables[]>();\n return { radius: R, zoneSites: Z,\n axisKernels: (wavelengthsNm) => ({ radius: R, perNode: kernelsOf(zoneOf(W >> 1, H >> 1), wavelengthsNm) }),\n tables(input): (x: number, y: number) => readonly GroupTables[] {\n let read = caches.get(input);\n if (read) return read;\n const cache = new Map<number, readonly GroupTables[]>();\n let kept = 0, last = -1, lastTables: readonly GroupTables[] = [];\n read = (x, y): readonly GroupTables[] => {\n const zone = zoneOf(x, y);\n if (zone === last) return lastTables;\n let tables = cache.get(zone);\n if (tables) cache.delete(zone);\n else {\n tables = buildTables({ ...input, kernels: { radius: R, perNode: kernelsOf(zone, input.wavelengthsNm) } }).groups;\n // Zones kept: at least 4, and at most 64 MB of them (every zone's tables have the same size).\n kept ||= Math.max(4, (1 << 23) / tables.reduce((n, g) => n + g.cw * g.ch * (g.neutral.length + g.spectral.flat().length + g.perNode.flat().length), 0));\n if (cache.size >= kept) cache.delete(cache.keys().next().value!);\n }\n cache.set(zone, tables); last = zone; lastTables = tables;\n return tables;\n };\n caches.set(input, read);\n return read;\n } };\n}\n\n/** What the lens signal needs from the resolved request. */\nexport interface DisplayViewLensSetup {\n geometry: PreparedDefocusImageSpaceGeometry;\n /** Temporal midpoints, seconds from exposure start: (i + 0.5)·shutter/T with camera rotation, [0] without. */\n times: readonly number[];\n /** The planar provider's plane distance and frame-unit scale. */\n distanceM: number;\n metresPerFrameUnit: number;\n pitch: number;\n imagingArea: { widthMm: number; heightMm: number };\n boxSamples: number;\n /** Anti-aliasing split spots (or one zero spot), in the order of the expected signal's offsets within each aperture node. */\n spots: readonly { offsetMicrometers: { x: number; y: number } }[];\n /**\n * #569: a field-dependent lens PSF (`lens.catalogue`, {@link createDisplayViewLensPsf}): each site reads its field zone's kernels\n * instead of the input's. The input's kernels (the axis zone's) set the lattice groups and the reach; absent, every site reads them.\n */\n psf?: DisplayViewLensPsf | undefined;\n /**\n * #569 (catalogue fisheyes): a ray that does not point toward the scene plane sees no scene (zero radiance), as the capture's provider\n * with `zeroBeyondHorizon` gives it, instead of failing.\n */\n zeroBeyondHorizon?: boolean | undefined;\n}\n\n/** Largest lattice cache, in entries over all lattice groups and temporal midpoints (times the spectral nodes for radiance scenes). */\nconst LATTICE_CACHE_LIMIT = 1 << 22;\n\nconst pow2 = (n: number): number => { let p = 1; while (p < n) p *= 2; return p; };\n\n/**\n * Checks that the mapping and the vignetting profile cover the farthest source point the view reads, (W/2 + reachSites, H/2 + reachSites)\n * sites from the axis at each corner (reachSites: the kernel radius plus the largest query offset, less the half site to the outer site\n * centre), and returns the factory of the view's expected signal for this request.\n */\nexport function prepareDisplayViewLensSignal(lens: DisplayViewLensSetup, nativeWidth: number, nativeHeight: number, reachSites: number, options: string):\n (input: DisplayViewExpectedSignalInput, spanColumns?: number) => DisplayViewExpectedSignal {\n const xMm = (nativeWidth / 2 + reachSites) * lens.pitch / 1000, yMm = (nativeHeight / 2 + reachSites) * lens.pitch / 1000;\n for (const t of lens.times) for (const [x, y] of [[-xMm, -yMm], [xMm, -yMm], [-xMm, yMm], [xMm, yMm]] as const) {\n try { if (!(lens.geometry.lookOf(x, y, t).z > 0) && !lens.zeroBeyondHorizon) throw new InvalidConfigurationError(\"its ray does not point toward the scene plane.\"); } catch (error) {\n throw new InvalidConfigurationError(\"simulateDisplayView with \" + options + \" reads the scene through the lens up to \" + (reachSites + 0.5) + \" sites beyond the native \" +\n \"raster's outer site centres (the kernel radius and the query offsets), and there (\" + Math.hypot(x, y).toFixed(3) + \" mm from the axis) \" + (error as Error).message);\n }\n }\n return (input, spanColumns = Infinity) => createLensSignal(lens, input, spanColumns);\n}\n\nfunction createLensSignal(lens: DisplayViewLensSetup, input: DisplayViewExpectedSignalInput, spanColumns: number): DisplayViewExpectedSignal {\n const W = input.nativeWidth, H = input.nativeHeight, nodes = input.wavelengthsNm.length, T = lens.times.length, times = lens.times;\n const { geometry, distanceM: distance, metresPerFrameUnit: scale, pitch, imagingArea } = lens;\n const mmPerSite = pitch / 1000, scene = input.scene, offsets = input.offsets, A = input.electronsPerRadiance, channelAt = input.channelAt;\n const materials = scene.kind === \"materials\" ? scene : undefined, radianceAt = scene.kind === \"radiance\" ? scene.radianceAt : undefined;\n const { reflectance, spectralIndex, neutralDirect, spectralDirect, groups } = displayViewSignalTables(input);\n const kernels = input.kernels, R = kernels ? kernels.radius : 0;\n /** #569: the combined kernels of the zone of site (x, y), or the input's own without a field-dependent PSF. */\n const zoneTables = lens.psf ? lens.psf.tables(input) : (): typeof groups => groups;\n let lookups = 0;\n // The plane point (frame units) and field factor of native sensor point (x, y) mm at time t: the environment's mapping (lookOf) and\n // the planar provider's own arithmetic for the outgoing direction −look.\n // #569: with zeroBeyondHorizon, a ray at or beyond 90° reads the plane's origin with a zero factor (zero radiance; `beyond` is set).\n let pu = 0, pv = 0, pf = 0, beyond = false;\n const zeroBeyond = lens.zeroBeyondHorizon === true;\n const map = (xMm: number, yMm: number, t: number): void => {\n const look = geometry.lookOf(xMm, yMm, t);\n beyond = !(look.z > 0);\n if (beyond) {\n if (!zeroBeyond || !Number.isFinite(look.z)) throw new InvalidConfigurationError(\"simulateDisplayView: a query ray does not point toward the scene plane.\");\n pu = 0; pv = 0; pf = 0;\n return;\n }\n const s = distance / look.z;\n pu = look.x * s / scale; pv = look.y * s / scale; pf = look.factor;\n };\n const materialOf = (m: number): number => { if (spectralIndex[m] === undefined) throw new InvalidConfigurationError(\"Unknown chart material.\"); return m; };\n // Without a kernel: the environment's query point of offset o of site (x, y) (native-environment-lean.ts, as buildExpectedSignalInput's queryPoint).\n const box = lens.boxSamples, siteWidthMm = pitch / 1000;\n const phases = offsets.map((_, o) => {\n const node = Math.floor(o / lens.spots.length), spot = lens.spots[o % lens.spots.length]!.offsetMicrometers;\n return { xPhase: (node % box + 0.5) / box, yPhase: (Math.floor(node / box) + 0.5) / box, aaX: spot.x / 1000, aaY: spot.y / 1000 };\n });\n function directSite(x: number, y: number): number {\n const c = channelAt(x, y), centerX = -imagingArea.widthMm / 2 + (pitch / 2 + x * pitch + 0) / 1000, centerY = -imagingArea.heightMm / 2 + (pitch / 2 + y * pitch + 0) / 1000;\n let total = 0;\n for (let ti = 0; ti < T; ti++) {\n let sum = 0;\n for (let o = 0; o < offsets.length; o++) {\n const node = phases[o]!;\n map((centerX - siteWidthMm / 2 + node.xPhase * siteWidthMm) - node.aaX, (centerY - siteWidthMm / 2 + node.yPhase * siteWidthMm) - node.aaY, times[ti]!);\n let value: number;\n if (materials) {\n const m = materialOf(materials.materialAt(pu, pv)), si = spectralIndex[m]!;\n value = si < 0 ? reflectance[m]! * neutralDirect[c]! : spectralDirect[c]![si]!; lookups++;\n } else { value = 0; for (let n = 0; n < nodes; n++) value += A[c]![n]! * radianceAt!(pu, pv, input.wavelengthsNm[n]!); lookups += nodes; }\n sum += offsets[o]!.weight * (pf * value);\n }\n total += sum;\n }\n return total / T;\n }\n // With a kernel: lattice point (p, q) of group g at time t, #548's lattice formula, cached in a ring tagged with (p, q).\n const G = groups.length, slots = G * T, per = materials ? 1 : nodes;\n let cacheRows = 0, cacheCols = 0, tagQ = new Int32Array(0), tagP = new Int32Array(0), cacheMaterial = new Int32Array(0), cacheFactor = new Float64Array(0), cacheRadiance = new Float64Array(0);\n const radiance = new Float64Array(nodes);\n let lm = 0, lf = 0;\n function lattice(g: number, ti: number, p: number, q: number): void {\n let k = -1;\n if (cacheRows > 0) {\n k = ((g * T + ti) * cacheRows + (q & (cacheRows - 1))) * cacheCols + (p & (cacheCols - 1));\n if (tagQ[k] === q && tagP[k] === p) {\n lf = cacheFactor[k]!;\n if (materials) lm = cacheMaterial[k]!; else for (let n = 0; n < nodes; n++) radiance[n] = cacheRadiance[k * nodes + n]!;\n return;\n }\n }\n const group = groups[g]!;\n map((p + 0.5 + group.fx - W / 2) * mmPerSite, (q + 0.5 + group.fy - H / 2) * mmPerSite, times[ti]!);\n lf = pf;\n if (materials) { lm = materialOf(materials.materialAt(pu, pv)); lookups++; }\n else { for (let n = 0; n < nodes; n++) radiance[n] = radianceAt!(pu, pv, input.wavelengthsNm[n]!); lookups += nodes; }\n if (k >= 0) {\n tagQ[k] = q; tagP[k] = p; cacheFactor[k] = lf;\n if (materials) cacheMaterial[k] = lm; else for (let n = 0; n < nodes; n++) cacheRadiance[k * nodes + n] = radiance[n]!;\n }\n }\n function kernelSite(x: number, y: number): number {\n const c = channelAt(x, y), rowMask = cacheRows - 1, colMask = cacheCols - 1, zone = zoneTables(x, y);\n let total = 0;\n for (let ti = 0; ti < T; ti++) {\n let sum = 0;\n for (let g = 0; g < G; g++) {\n const group = groups[g]!, p0 = x + group.minIx - R, q0 = y + group.minIy - R, cw = group.cw, ch = group.ch, weights = zone[g]!;\n if (materials) {\n const nk = weights.neutral[c]!, sk = weights.spectral[c]!;\n for (let dy = 0, t = 0; dy < ch; dy++) {\n // The cache row of lattice row q (read inline: the common case is a hit).\n const q = q0 + dy, row = cacheRows > 0 ? ((g * T + ti) * cacheRows + (q & rowMask)) * cacheCols : -1;\n for (let dx = 0; dx < cw; dx++, t++) {\n const p = p0 + dx, k = row + (p & colMask);\n if (row >= 0 && tagQ[k] === q && tagP[k] === p) { lm = cacheMaterial[k]!; lf = cacheFactor[k]!; } else lattice(g, ti, p, q);\n const si = spectralIndex[lm]!;\n sum += lf * (si < 0 ? reflectance[lm]! * nk[t]! : sk[si]![t]!);\n }\n }\n } else for (let dy = 0, t = 0; dy < ch; dy++) for (let dx = 0; dx < cw; dx++, t++) {\n lattice(g, ti, p0 + dx, q0 + dy);\n let value = 0;\n for (let n = 0; n < nodes; n++) value += weights.perNode[n]![c]![t]! * radiance[n]!;\n sum += lf * value;\n }\n }\n total += sum;\n }\n return total / T;\n }\n const pilotNode = input.wavelengthsNm[Math.floor(nodes / 2)]!;\n if (input.largeKernel) return createLargeLensSignal(input, inFocusLensTile, () => lookups, pilot);\n /** E_c (#564) of the native site positions [x0, x0 + T) × [y0, y0 + T) for the three channels: kernelSite's sum for each channel. */\n function inFocusLensTile(x0: number, y0: number, TS: number): Float64Array[] {\n const out = [0, 1, 2].map(() => new Float64Array(TS * TS));\n // A fixed tile reaches past the raster: positions more than the disc's radius beyond it feed no site, so they stay 0 and are never\n // mapped (the lens profiles are checked only up to the view's reach).\n const D = input.largeKernel!.radius;\n if (x0 + TS <= -D || x0 >= W + D || y0 + TS <= -D || y0 >= H + D) return out;\n if (x0 < -D || x0 + TS > W + D || y0 < -D || y0 + TS > H + D) {\n const xa = Math.max(x0, -D), xb = Math.min(x0 + TS, W + D), ya = Math.max(y0, -D), yb = Math.min(y0 + TS, H + D);\n const part = inFocusLensRect(xa, ya, xb - xa, yb - ya);\n for (let c = 0; c < 3; c++) for (let y = ya; y < yb; y++) out[c]!.set(part[c]!.subarray((y - ya) * (xb - xa), (y - ya + 1) * (xb - xa)), (y - y0) * TS + xa - x0);\n return out;\n }\n return inFocusLensRect(x0, y0, TS, TS);\n }\n /** E_c of the native site positions [x0, x0 + w) × [y0, y0 + h), row-major, for the three channels. */\n function inFocusLensRect(x0: number, y0: number, TW: number, TH: number): Float64Array[] {\n const out = [0, 1, 2].map(() => new Float64Array(TW * TH)), sum = [0, 1, 2].map(() => new Float64Array(TW * TH));\n for (let ti = 0; ti < T; ti++) {\n for (const e of sum) e.fill(0);\n for (const group of groups) {\n const cw = group.cw, ch = group.ch, gw = TW + cw - 1, gh = TH + ch - 1, p0 = x0 + group.minIx - R, q0 = y0 + group.minIy - R;\n const factor = new Float64Array(gw * gh), material = materials ? new Int32Array(gw * gh) : undefined, values = materials ? undefined : new Float64Array(gw * gh * nodes);\n for (let j = 0; j < gh; j++) for (let i = 0; i < gw; i++) {\n const k = j * gw + i;\n map((p0 + i + 0.5 + group.fx - W / 2) * mmPerSite, (q0 + j + 0.5 + group.fy - H / 2) * mmPerSite, times[ti]!);\n factor[k] = pf;\n if (material) material[k] = materialOf(materials!.materialAt(pu, pv));\n else for (let n = 0; n < nodes; n++) values![k * nodes + n] = radianceAt!(pu, pv, input.wavelengthsNm[n]!);\n }\n lookups += material ? gw * gh : gw * gh * nodes;\n for (let c = 0; c < 3; c++) {\n const e = sum[c]!, nk = group.neutral[c], sk = group.spectral[c];\n for (let y = 0; y < TH; y++) for (let x = 0; x < TW; x++) {\n let v = 0;\n for (let dy = 0, t = 0; dy < ch; dy++) for (let dx = 0; dx < cw; dx++, t++) {\n const k = (y + dy) * gw + x + dx;\n if (material) { const m = material[k]!, si = spectralIndex[m]!; v += factor[k]! * (si < 0 ? reflectance[m]! * nk![t]! : sk![si]![t]!); }\n else { let r = 0; for (let n = 0; n < nodes; n++) r += group.perNode[n]![c]![t]! * values![k * nodes + n]!; v += factor[k]! * r; }\n }\n e[y * TW + x] = e[y * TW + x]! + v;\n }\n }\n }\n for (let c = 0; c < 3; c++) { const o = out[c]!, e = sum[c]!; for (let k = 0; k < o.length; k++) o[k] = o[k]! + e[k]!; }\n }\n for (const o of out) for (let k = 0; k < o.length; k++) o[k] = o[k]! / T;\n return out;\n }\n // Site values persist across windows in a ring of native rows (a site's value does not depend on the window).\n let ringRows = 0, ring = new Float64Array(0), ringRowId = new Int32Array(0), ringOn = false;\n const compute = kernels ? kernelSite : directSite;\n return {\n get lookups(): number { return lookups; },\n uniformMaterial: -1,\n tracksMaterial: false,\n get cachesSites(): boolean { return ringOn; },\n marksReads: false,\n markReads(): void { /* never called: marksReads is false */ },\n window(x0: number, y0: number, x1: number, y1: number): void {\n const sw = Math.max(0, x1 - x0), sh = Math.max(0, y1 - y0);\n if (sh > 0 && ringRows < 2 * sh) {\n const rows = pow2(2 * sh);\n if (rows * W <= LATTICE_CACHE_LIMIT) { ringRows = rows; ring = new Float64Array(rows * W).fill(NaN); ringRowId = new Int32Array(rows).fill(-1); }\n }\n ringOn = sh > 0 && ringRows >= 2 * sh;\n if (!kernels || sw === 0) return;\n // The lattice rectangle the window's sites read, per group; the cache keeps two such heights and the columns the render's windows span.\n let cw = 0, ch = 0;\n for (const group of groups) { cw = Math.max(cw, group.cw); ch = Math.max(ch, group.ch); }\n const height = sh + ch - 1, width = sw + cw - 1;\n let rows = pow2(2 * height), cols = pow2(Math.min(W + 2 * (R + cw), Math.max(width, (Number.isFinite(spanColumns) ? spanColumns : W) + width)));\n if (slots * per * rows * cols > LATTICE_CACHE_LIMIT) rows = pow2(height);\n if (slots * per * rows * cols > LATTICE_CACHE_LIMIT) cols = pow2(width);\n if (slots * per * rows * cols > LATTICE_CACHE_LIMIT) { cacheRows = 0; return; }\n if (rows > cacheRows || cols > cacheCols) {\n rows = Math.max(rows, cacheRows); cols = Math.max(cols, cacheCols);\n if (slots * per * rows * cols > LATTICE_CACHE_LIMIT) { rows = pow2(height); cols = pow2(width); }\n cacheRows = rows; cacheCols = cols;\n const size = slots * rows * cols;\n tagQ = new Int32Array(size).fill(-2147483648); tagP = new Int32Array(size); cacheFactor = new Float64Array(size);\n if (materials) cacheMaterial = new Int32Array(size); else cacheRadiance = new Float64Array(size * nodes);\n }\n },\n site(x: number, y: number): number {\n if (!ringOn) return compute(x, y);\n const slot = y & (ringRows - 1), k = slot * W + x;\n if (ringRowId[slot] === y) { const v = ring[k]!; if (v === v) return v; }\n else { ringRowId[slot] = y; ring.fill(NaN, slot * W, (slot + 1) * W); }\n const v = compute(x, y);\n ring[k] = v;\n return v;\n },\n pilot\n };\n /**\n * The renderer's pilot point is a rectilinear plane point of the native raster: back to the sensor point, then through the lens at\n * every temporal midpoint. A point whose scene value differs between the instants (motion) counts as detail (NaN equals nothing).\n */\n function pilot(u: number, v: number): number {\n const g = 2 / input.outputWidth, xMm = u / g * mmPerSite, yMm = -v / g * mmPerSite;\n let first = NaN;\n try {\n for (let ti = 0; ti < T; ti++) {\n map(xMm, yMm, times[ti]!);\n const value = beyond ? -1 : materials ? materials.materialAt(pu, pv) : radianceAt!(pu, pv, pilotNode);\n lookups++;\n if (ti === 0) first = value; else if (value !== first) return NaN;\n }\n } catch { return NaN; }\n return first;\n }\n}\n\n/** #564: tile sides of the large-kernel lens signal (the in-focus E and the convolved sites) and the bytes each tile cache keeps. */\nconst LARGE_E_TILE = 64, LARGE_OUTPUT_TILE = 128, LARGE_CACHE_BYTES = 32 * 1048576;\n\n/** #564: the lens signal with a defocus kernel above 64 sites: D ⊛ E_c by runs over the in-focus tiles (see the module comment). */\nfunction createLargeLensSignal(input: DisplayViewExpectedSignalInput, inFocusTile: (x0: number, y0: number, T: number) => Float64Array[], lookups: () => number,\n pilot: (u: number, v: number) => number): DisplayViewExpectedSignal {\n const runs = input.largeKernel!, channelAt = input.channelAt, TE = LARGE_E_TILE;\n // At least the in-focus tiles one output tile's source spans plus one more row of them, so the next output tile of a row reuses them.\n const span = Math.ceil((LARGE_OUTPUT_TILE + 2 * runs.radius) / TE) + 1;\n const inFocus = new Map<number, Float64Array[]>(), capacity = Math.max(span * (span + 1), Math.floor(LARGE_CACHE_BYTES / (3 * TE * TE * 8)));\n const tileAt = (tx: number, ty: number): Float64Array[] => {\n const key = (ty + 1048576) * 2097152 + tx + 1048576;\n let tile = inFocus.get(key);\n if (tile) { inFocus.delete(key); inFocus.set(key, tile); }\n else {\n tile = inFocusTile(tx * TE, ty * TE, TE);\n inFocus.set(key, tile);\n if (inFocus.size > capacity) inFocus.delete(inFocus.keys().next().value!);\n }\n return tile;\n };\n // Which sites of a tile row hold channel c: the CFA's 2 × 2 period (tile origins are even).\n const phase = [0, 1].map((py) => [0, 1].map((px) => channelAt(px, py)));\n const patterns: SiteKernelRunsRowPattern[] = [0, 1, 2].map((c) => (row: number) => {\n const p = phase[row & 1]!, even = p[0] === c, odd = p[1] === c;\n return even && odd ? { start: 0, step: 1 } : even ? { start: 0, step: 2 } : odd ? { start: 1, step: 2 } : null;\n });\n const lattice = createSiteKernelRunsLattice({ runs, tile: LARGE_OUTPUT_TILE, fields: 3, capacityBytes: LARGE_CACHE_BYTES, pattern: (c) => patterns[c],\n source: (x0, y0, width, height) => (c: number): Float64Array => {\n const samples = new Float64Array(width * height);\n for (let ty = Math.floor(y0 / TE); ty * TE < y0 + height; ty++) for (let tx = Math.floor(x0 / TE); tx * TE < x0 + width; tx++) {\n const tile = tileAt(tx, ty)[c]!, ax = Math.max(x0, tx * TE), bx = Math.min(x0 + width, (tx + 1) * TE), ay = Math.max(y0, ty * TE), by = Math.min(y0 + height, (ty + 1) * TE);\n for (let y = ay; y < by; y++) samples.set(tile.subarray((y - ty * TE) * TE + ax - tx * TE, (y - ty * TE) * TE + bx - tx * TE), (y - y0) * width + ax - x0);\n }\n return samples;\n } });\n return {\n get lookups(): number { return lookups(); },\n uniformMaterial: -1,\n tracksMaterial: false,\n cachesSites: false,\n marksReads: false,\n markReads(): void { /* never called: marksReads is false */ },\n window(): void { /* the tiles are fixed and kept for the signal; a window changes nothing */ },\n site(x: number, y: number): number { return lattice.valueAt(channelAt(x, y), x, y); },\n pilot\n };\n}\n"]}
@@ -32,6 +32,14 @@ export interface ExpectedSignalSetupInput {
32
32
  psf: Psf;
33
33
  profileWavelengths: readonly number[];
34
34
  } | undefined;
35
+ /**
36
+ * #569: a lens PSF's kernels per spectral node on the site lattice (the catalogue lens's at the frame centre; the display view's
37
+ * lens signal reads each field zone's own), used when there is no diffraction and no defocus disc (the lens's PSF includes both).
38
+ */
39
+ lensKernels?: {
40
+ radius: number;
41
+ perNode: Float64Array[];
42
+ } | undefined;
35
43
  /** Defocus (#492): the geometric disc on the site lattice, (2R + 1)² row-major weights; absent or null in focus. */
36
44
  defocus?: {
37
45
  radius: number;
@@ -38,6 +38,13 @@ export function buildExpectedSignalInput(input) {
38
38
  return siteDiffractionKernel(diffraction.psf, wavelengthNm, pitch, radius, input.caller + ": diffraction kernels must sample the site pitch exactly.");
39
39
  }) };
40
40
  }
41
+ if (input.lensKernels) {
42
+ if (diffraction || input.defocus || input.largeDefocus)
43
+ throw new InvalidConfigurationError(input.caller + ": a lens PSF includes its own diffraction and defocus.");
44
+ if (input.lensKernels.perNode.length !== wavelengths.length)
45
+ throw new InvalidConfigurationError(input.caller + ": the lens PSF needs one kernel per spectral node.");
46
+ kernels = input.lensKernels;
47
+ }
41
48
  // #564: a disc above the direct radius (64 sites) is convolved by runs after the in-focus signal instead (below).
42
49
  const largeDefocus = input.largeDefocus ?? (input.defocus && input.defocus.radius > DEFOCUS_DIRECT_KERNEL_MAXIMUM_RADIUS_SITES ?
43
50
  siteKernelRuns(input.defocus.weights, input.defocus.radius) : undefined);
@@ -1 +1 @@
1
- {"version":3,"file":"expected-signal-setup.js","sourceRoot":"","sources":["../../src/facade/expected-signal-setup.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,0CAA0C,EAAE,cAAc,EAAuB,MAAM,+BAA+B,CAAC;AAChI,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAGlD,wEAAwE;AACxE,MAAM,QAAQ,GAAG,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAuCpC,6FAA6F;AAC7F,MAAM,UAAU,wBAAwB,CAAC,KAA+B;IACtE,MAAM,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CAAC;QACjK,MAAM,EAAE,GAAG,kBAAkB,GAAG,CAAC,OAAO,GAAG,kBAAkB,CAAC,EAAE,EAAE,GAAG,kBAAkB,GAAG,CAAC,CAAC,OAAO,GAAG,kBAAkB,CAAC,CAAC;QAC1H,MAAM,MAAM,GAAG,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,kBAAkB,CAAC,EAAE,CAAC,GAAG,gBAAgB,GAAG,CAAC,kBAAkB,GAAG,MAAM,CAAC,CAAC;QACxG,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,MAAM,GAAG,CAAC,GAAG,kBAAkB,CAAC;QAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,MAAM,GAAG,CAAC,GAAG,kBAAkB,CAAC;IAC/F,CAAC,CAAC;IACF,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,WAAW,EAAE,KAAK,CAAC,KAAK,EAAE,aAAa,EAAE,WAAW;YACrJ,oBAAoB,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,CAAC;AAC1L,CAAC","sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Internal (#394, not exported from the package): the input of the tabulated expected signal (`createDisplayViewExpectedSignal`)\n * for a resolved `simulateCapture` request, shared by the display view and the capture's tabulated RAW path so both build it\n * the same way: query offsets of each site, the environment's query points, the diffraction kernels and the scene tables.\n *\n * Defocus (#492, `lens.defocus`): the geometric disc D on the site lattice (`createDefocusDiscSiteKernel`) enters as a site\n * kernel, so every query stays on the lattice. Without diffraction every spectral node takes D itself (a wavelength-independent\n * kernel). With diffraction node λ takes K_λ ∗ D, the full 2-D convolution of the diffraction kernel with the disc (radius\n * R_diff + R_defocus): a labelled approximation, since the defocused wave's PSF is not the in-focus Airy pattern convolved\n * with a geometric disc. The convolution is linear, so Σ_t (K_λ ∗ D)(t)·L(p − t) is the diffracted radiance blurred by D, the\n * order the capture's object-space convolutions apply them in. The kernels are built as the capture builds them\n * (`siteDiffractionKernel`, then `convolveSiteKernels`), so the two have the same bits.\n */\n\nimport { InvalidConfigurationError } from \"../core/configuration-error.js\";\nimport type { resolveLensPsfConvolutionKernels } from \"../optics/lens-psf-kernels.js\";\nimport { siteDiffractionKernel } from \"../optics/site-diffraction-kernel.js\";\nimport { convolveSiteKernels } from \"../optics/defocus-disc-kernel.js\";\nimport { DEFOCUS_DIRECT_KERNEL_MAXIMUM_RADIUS_SITES, siteKernelRuns, type SiteKernelRuns } from \"../optics/site-kernel-runs.js\";\nimport { resolveProjectionDistanceMm } from \"../motion/camera-rotation.js\";\nimport { hypot3 } from \"../core/portable-math.js\";\nimport type { DisplayViewExpectedSignalInput, DisplayViewScene } from \"./display-view.js\";\n\n/** A unit site kernel of radius 0 (shared: the tables only read it). */\nconst UNIT_TAP = Float64Array.of(1);\n\ntype Psf = Parameters<typeof resolveLensPsfConvolutionKernels>[0][\"psf\"];\n\nexport interface ExpectedSignalSetupInput {\n nativeWidth: number;\n nativeHeight: number;\n /** Frame output width (plane coordinates are 2 / width frame units per site). */\n width: number;\n wavelengths: readonly number[];\n /** Per CFA channel (red, green, blue): expected electrons per unit spectral radiance at each node. */\n perNode: readonly [Float64Array, Float64Array, Float64Array];\n /** Pixel-aperture nodes in sites from the site centre (`apertureNodeOffsets(boxSamples)`) and the box sample count. */\n apertureNodes: readonly { x: number; y: number }[];\n boxSamples: number;\n antiAliasing?: { components: readonly { offsetMicrometers: { x: number; y: number }; normalizedWeight: number }[] } | undefined;\n pitch: number;\n /** Object-space diffraction: the kernel radius, the PSF and its profile wavelengths. */\n diffraction?: { radius: number; psf: Psf; profileWavelengths: readonly number[] } | undefined;\n /** Defocus (#492): the geometric disc on the site lattice, (2R + 1)² row-major weights; absent or null in focus. */\n defocus?: { radius: number; weights: Float64Array } | null | undefined;\n /**\n * #564: a defocus kernel above the direct radius, as runs, used instead of `defocus`: the tables keep the in-focus kernels\n * (diffraction, or a unit tap per node for the lattice formula) and the expected signal convolves the result with it. A\n * `defocus` disc of radius above 64 sites takes this path too.\n */\n largeDefocus?: SiteKernelRuns | undefined;\n /** Material scenes: the materials (neutral reflectances, or radiance per wavelength), the material lookup and the white radiance. */\n materials?: { list: readonly ({ neutral: number } | { radiance: (nm: number) => number })[]; materialAt(u: number, v: number): number; whiteRadiance(nm: number): number } | undefined;\n radianceAt(u: number, v: number, nm: number): number;\n imagingArea: { widthMm: number; heightMm: number };\n focalLengthMm: number;\n focusDistanceM: number;\n subjectDistanceM: number;\n metresPerFrameUnit: number;\n /** Prefix of the error messages (\"simulateDisplayView\", \"simulateCapture\"). */\n caller: string;\n}\n\n/** The query offsets of each site and the expected-signal input (see the module comment). */\nexport function buildExpectedSignalInput(input: ExpectedSignalSetupInput): { offsets: { x: number; y: number; weight: number }[]; signalInput: DisplayViewExpectedSignalInput } {\n const { boxSamples, pitch, wavelengths, imagingArea, subjectDistanceM, metresPerFrameUnit } = input;\n // Query offsets of each site: pixel-aperture nodes minus anti-aliasing split offsets (sites, +x right, +y down), as the environment forms them.\n const spots = input.antiAliasing ? input.antiAliasing.components : [{ offsetMicrometers: { x: 0, y: 0 }, normalizedWeight: 1 }];\n const offsets = input.apertureNodes.flatMap((node) => spots.map((c) => ({ x: node.x - c.offsetMicrometers.x / pitch, y: node.y - c.offsetMicrometers.y / pitch,\n weight: c.normalizedWeight / (boxSamples * boxSamples) })));\n // Diffraction: the same per-node site kernels as the object-space convolution (createDiffractedPlanarProvider).\n let kernels: { radius: number; perNode: Float64Array[] } | undefined;\n const diffraction = input.diffraction;\n if (diffraction) {\n const radius = diffraction.radius;\n kernels = { radius, perNode: wavelengths.map((wavelengthNm) => {\n if (!diffraction.profileWavelengths.includes(wavelengthNm)) throw new InvalidConfigurationError(input.caller + \": a spectral node has no diffraction kernel.\");\n return siteDiffractionKernel(diffraction.psf, wavelengthNm, pitch, radius, input.caller + \": diffraction kernels must sample the site pitch exactly.\");\n }) };\n }\n // #564: a disc above the direct radius (64 sites) is convolved by runs after the in-focus signal instead (below).\n const largeDefocus = input.largeDefocus ?? (input.defocus && input.defocus.radius > DEFOCUS_DIRECT_KERNEL_MAXIMUM_RADIUS_SITES ?\n siteKernelRuns(input.defocus.weights, input.defocus.radius) : undefined);\n // Defocus (#492): the disc alone at every node (one shared array), or each node's diffraction kernel convolved with it.\n const defocus = largeDefocus ? undefined : input.defocus;\n if (defocus) {\n const diffracted = kernels;\n kernels = diffracted ? { radius: diffracted.radius + defocus.radius, perNode: diffracted.perNode.map((k) => convolveSiteKernels(k, diffracted.radius, defocus.weights, defocus.radius)) } :\n { radius: defocus.radius, perNode: wavelengths.map(() => defocus.weights) };\n }\n // #564: a large defocus kernel is applied after the in-focus signal (expected-signal.ts); without diffraction the in-focus\n // kernels are a unit tap per node, so the tables read the scene on the lattice formula as the defocus path does.\n if (largeDefocus && !kernels) kernels = { radius: 0, perNode: wavelengths.map(() => UNIT_TAP) };\n // Chart presets and (2.7) caller material scenes take the material path: each material tabulated once per node.\n const materials = input.materials;\n const scene: DisplayViewScene = materials ? { kind: \"materials\", materialAt: materials.materialAt,\n materials: materials.list.map((m) => (\"neutral\" in m ? { neutral: m.neutral } : { radiance: Float64Array.from(wavelengths, (nm) => m.radiance(nm)) })),\n whiteRadiance: Float64Array.from(wavelengths, (nm) => materials.whiteRadiance(nm)) } :\n { kind: \"radiance\", radianceAt: input.radianceAt };\n const channelIndex = (x: number, y: number): number => ((y & 1) === 0 ? ((x & 1) === 0 ? 0 : 1) : ((x & 1) === 0 ? 1 : 2));\n // Without diffraction the environment's own query arithmetic (native-environment-lean.ts `geometry`, then the rectilinear\n // still-camera ray and the planar provider's plane point), so boundary points resolve as in the capture.\n const projectionDistance = resolveProjectionDistanceMm(input.focalLengthMm, input.focusDistanceM).projectionDistanceMm, siteWidthMm = pitch / 1000;\n const nodePhases = input.apertureNodes.flatMap((_, index) => spots.map((c) => ({ xPhase: (index % boxSamples + 0.5) / boxSamples, yPhase: (Math.floor(index / boxSamples) + 0.5) / boxSamples,\n aaX: c.offsetMicrometers.x / 1000, aaY: c.offsetMicrometers.y / 1000 })));\n const queryPoint = (x: number, y: number, o: number, out: Float64Array): void => {\n const node = nodePhases[o]!;\n const centerX = -imagingArea.widthMm / 2 + (pitch / 2 + x * pitch + 0) / 1000, centerY = -imagingArea.heightMm / 2 + (pitch / 2 + y * pitch + 0) / 1000;\n const sourceX = (centerX - siteWidthMm / 2 + node.xPhase * siteWidthMm) - node.aaX, sourceY = (centerY - siteWidthMm / 2 + node.yPhase * siteWidthMm) - node.aaY;\n const rx = projectionDistance * (sourceX / projectionDistance), ry = projectionDistance * (-sourceY / projectionDistance);\n const length = hypot3(rx, ry, projectionDistance), t = subjectDistanceM / (projectionDistance / length);\n out[0] = rx / length * t / metresPerFrameUnit; out[1] = ry / length * t / metresPerFrameUnit;\n };\n return { offsets, signalInput: { nativeWidth: input.nativeWidth, nativeHeight: input.nativeHeight, outputWidth: input.width, wavelengthsNm: wavelengths,\n electronsPerRadiance: input.perNode, offsets, ...(kernels ? { kernels } : { queryPoint }), ...(largeDefocus ? { largeKernel: largeDefocus } : {}), scene, channelAt: channelIndex } };\n}\n\n"]}
1
+ {"version":3,"file":"expected-signal-setup.js","sourceRoot":"","sources":["../../src/facade/expected-signal-setup.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC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,GAAG,kBAAkB,CAAC;IAC/F,CAAC,CAAC;IACF,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,WAAW,EAAE,KAAK,CAAC,KAAK,EAAE,aAAa,EAAE,WAAW;YACrJ,oBAAoB,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,CAAC;AAC1L,CAAC","sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Internal (#394, not exported from the package): the input of the tabulated expected signal (`createDisplayViewExpectedSignal`)\n * for a resolved `simulateCapture` request, shared by the display view and the capture's tabulated RAW path so both build it\n * the same way: query offsets of each site, the environment's query points, the diffraction kernels and the scene tables.\n *\n * Defocus (#492, `lens.defocus`): the geometric disc D on the site lattice (`createDefocusDiscSiteKernel`) enters as a site\n * kernel, so every query stays on the lattice. Without diffraction every spectral node takes D itself (a wavelength-independent\n * kernel). With diffraction node λ takes K_λ ∗ D, the full 2-D convolution of the diffraction kernel with the disc (radius\n * R_diff + R_defocus): a labelled approximation, since the defocused wave's PSF is not the in-focus Airy pattern convolved\n * with a geometric disc. The convolution is linear, so Σ_t (K_λ ∗ D)(t)·L(p − t) is the diffracted radiance blurred by D, the\n * order the capture's object-space convolutions apply them in. The kernels are built as the capture builds them\n * (`siteDiffractionKernel`, then `convolveSiteKernels`), so the two have the same bits.\n */\n\nimport { InvalidConfigurationError } from \"../core/configuration-error.js\";\nimport type { resolveLensPsfConvolutionKernels } from \"../optics/lens-psf-kernels.js\";\nimport { siteDiffractionKernel } from \"../optics/site-diffraction-kernel.js\";\nimport { convolveSiteKernels } from \"../optics/defocus-disc-kernel.js\";\nimport { DEFOCUS_DIRECT_KERNEL_MAXIMUM_RADIUS_SITES, siteKernelRuns, type SiteKernelRuns } from \"../optics/site-kernel-runs.js\";\nimport { resolveProjectionDistanceMm } from \"../motion/camera-rotation.js\";\nimport { hypot3 } from \"../core/portable-math.js\";\nimport type { DisplayViewExpectedSignalInput, DisplayViewScene } from \"./display-view.js\";\n\n/** A unit site kernel of radius 0 (shared: the tables only read it). */\nconst UNIT_TAP = Float64Array.of(1);\n\ntype Psf = Parameters<typeof resolveLensPsfConvolutionKernels>[0][\"psf\"];\n\nexport interface ExpectedSignalSetupInput {\n nativeWidth: number;\n nativeHeight: number;\n /** Frame output width (plane coordinates are 2 / width frame units per site). */\n width: number;\n wavelengths: readonly number[];\n /** Per CFA channel (red, green, blue): expected electrons per unit spectral radiance at each node. */\n perNode: readonly [Float64Array, Float64Array, Float64Array];\n /** Pixel-aperture nodes in sites from the site centre (`apertureNodeOffsets(boxSamples)`) and the box sample count. */\n apertureNodes: readonly { x: number; y: number }[];\n boxSamples: number;\n antiAliasing?: { components: readonly { offsetMicrometers: { x: number; y: number }; normalizedWeight: number }[] } | undefined;\n pitch: number;\n /** Object-space diffraction: the kernel radius, the PSF and its profile wavelengths. */\n diffraction?: { radius: number; psf: Psf; profileWavelengths: readonly number[] } | undefined;\n /**\n * #569: a lens PSF's kernels per spectral node on the site lattice (the catalogue lens's at the frame centre; the display view's\n * lens signal reads each field zone's own), used when there is no diffraction and no defocus disc (the lens's PSF includes both).\n */\n lensKernels?: { radius: number; perNode: Float64Array[] } | undefined;\n /** Defocus (#492): the geometric disc on the site lattice, (2R + 1)² row-major weights; absent or null in focus. */\n defocus?: { radius: number; weights: Float64Array } | null | undefined;\n /**\n * #564: a defocus kernel above the direct radius, as runs, used instead of `defocus`: the tables keep the in-focus kernels\n * (diffraction, or a unit tap per node for the lattice formula) and the expected signal convolves the result with it. A\n * `defocus` disc of radius above 64 sites takes this path too.\n */\n largeDefocus?: SiteKernelRuns | undefined;\n /** Material scenes: the materials (neutral reflectances, or radiance per wavelength), the material lookup and the white radiance. */\n materials?: { list: readonly ({ neutral: number } | { radiance: (nm: number) => number })[]; materialAt(u: number, v: number): number; whiteRadiance(nm: number): number } | undefined;\n radianceAt(u: number, v: number, nm: number): number;\n imagingArea: { widthMm: number; heightMm: number };\n focalLengthMm: number;\n focusDistanceM: number;\n subjectDistanceM: number;\n metresPerFrameUnit: number;\n /** Prefix of the error messages (\"simulateDisplayView\", \"simulateCapture\"). */\n caller: string;\n}\n\n/** The query offsets of each site and the expected-signal input (see the module comment). */\nexport function buildExpectedSignalInput(input: ExpectedSignalSetupInput): { offsets: { x: number; y: number; weight: number }[]; signalInput: DisplayViewExpectedSignalInput } {\n const { boxSamples, pitch, wavelengths, imagingArea, subjectDistanceM, metresPerFrameUnit } = input;\n // Query offsets of each site: pixel-aperture nodes minus anti-aliasing split offsets (sites, +x right, +y down), as the environment forms them.\n const spots = input.antiAliasing ? input.antiAliasing.components : [{ offsetMicrometers: { x: 0, y: 0 }, normalizedWeight: 1 }];\n const offsets = input.apertureNodes.flatMap((node) => spots.map((c) => ({ x: node.x - c.offsetMicrometers.x / pitch, y: node.y - c.offsetMicrometers.y / pitch,\n weight: c.normalizedWeight / (boxSamples * boxSamples) })));\n // Diffraction: the same per-node site kernels as the object-space convolution (createDiffractedPlanarProvider).\n let kernels: { radius: number; perNode: Float64Array[] } | undefined;\n const diffraction = input.diffraction;\n if (diffraction) {\n const radius = diffraction.radius;\n kernels = { radius, perNode: wavelengths.map((wavelengthNm) => {\n if (!diffraction.profileWavelengths.includes(wavelengthNm)) throw new InvalidConfigurationError(input.caller + \": a spectral node has no diffraction kernel.\");\n return siteDiffractionKernel(diffraction.psf, wavelengthNm, pitch, radius, input.caller + \": diffraction kernels must sample the site pitch exactly.\");\n }) };\n }\n if (input.lensKernels) {\n if (diffraction || input.defocus || input.largeDefocus) throw new InvalidConfigurationError(input.caller + \": a lens PSF includes its own diffraction and defocus.\");\n if (input.lensKernels.perNode.length !== wavelengths.length) throw new InvalidConfigurationError(input.caller + \": the lens PSF needs one kernel per spectral node.\");\n kernels = input.lensKernels;\n }\n // #564: a disc above the direct radius (64 sites) is convolved by runs after the in-focus signal instead (below).\n const largeDefocus = input.largeDefocus ?? (input.defocus && input.defocus.radius > DEFOCUS_DIRECT_KERNEL_MAXIMUM_RADIUS_SITES ?\n siteKernelRuns(input.defocus.weights, input.defocus.radius) : undefined);\n // Defocus (#492): the disc alone at every node (one shared array), or each node's diffraction kernel convolved with it.\n const defocus = largeDefocus ? undefined : input.defocus;\n if (defocus) {\n const diffracted = kernels;\n kernels = diffracted ? { radius: diffracted.radius + defocus.radius, perNode: diffracted.perNode.map((k) => convolveSiteKernels(k, diffracted.radius, defocus.weights, defocus.radius)) } :\n { radius: defocus.radius, perNode: wavelengths.map(() => defocus.weights) };\n }\n // #564: a large defocus kernel is applied after the in-focus signal (expected-signal.ts); without diffraction the in-focus\n // kernels are a unit tap per node, so the tables read the scene on the lattice formula as the defocus path does.\n if (largeDefocus && !kernels) kernels = { radius: 0, perNode: wavelengths.map(() => UNIT_TAP) };\n // Chart presets and (2.7) caller material scenes take the material path: each material tabulated once per node.\n const materials = input.materials;\n const scene: DisplayViewScene = materials ? { kind: \"materials\", materialAt: materials.materialAt,\n materials: materials.list.map((m) => (\"neutral\" in m ? { neutral: m.neutral } : { radiance: Float64Array.from(wavelengths, (nm) => m.radiance(nm)) })),\n whiteRadiance: Float64Array.from(wavelengths, (nm) => materials.whiteRadiance(nm)) } :\n { kind: \"radiance\", radianceAt: input.radianceAt };\n const channelIndex = (x: number, y: number): number => ((y & 1) === 0 ? ((x & 1) === 0 ? 0 : 1) : ((x & 1) === 0 ? 1 : 2));\n // Without diffraction the environment's own query arithmetic (native-environment-lean.ts `geometry`, then the rectilinear\n // still-camera ray and the planar provider's plane point), so boundary points resolve as in the capture.\n const projectionDistance = resolveProjectionDistanceMm(input.focalLengthMm, input.focusDistanceM).projectionDistanceMm, siteWidthMm = pitch / 1000;\n const nodePhases = input.apertureNodes.flatMap((_, index) => spots.map((c) => ({ xPhase: (index % boxSamples + 0.5) / boxSamples, yPhase: (Math.floor(index / boxSamples) + 0.5) / boxSamples,\n aaX: c.offsetMicrometers.x / 1000, aaY: c.offsetMicrometers.y / 1000 })));\n const queryPoint = (x: number, y: number, o: number, out: Float64Array): void => {\n const node = nodePhases[o]!;\n const centerX = -imagingArea.widthMm / 2 + (pitch / 2 + x * pitch + 0) / 1000, centerY = -imagingArea.heightMm / 2 + (pitch / 2 + y * pitch + 0) / 1000;\n const sourceX = (centerX - siteWidthMm / 2 + node.xPhase * siteWidthMm) - node.aaX, sourceY = (centerY - siteWidthMm / 2 + node.yPhase * siteWidthMm) - node.aaY;\n const rx = projectionDistance * (sourceX / projectionDistance), ry = projectionDistance * (-sourceY / projectionDistance);\n const length = hypot3(rx, ry, projectionDistance), t = subjectDistanceM / (projectionDistance / length);\n out[0] = rx / length * t / metresPerFrameUnit; out[1] = ry / length * t / metresPerFrameUnit;\n };\n return { offsets, signalInput: { nativeWidth: input.nativeWidth, nativeHeight: input.nativeHeight, outputWidth: input.width, wavelengthsNm: wavelengths,\n electronsPerRadiance: input.perNode, offsets, ...(kernels ? { kernels } : { queryPoint }), ...(largeDefocus ? { largeKernel: largeDefocus } : {}), scene, channelAt: channelIndex } };\n}\n\n"]}
@@ -152,6 +152,11 @@ export declare function clearExpectedSignalTableCache(): void;
152
152
  * prepares them, so a GPU render of an input and a CPU render read the same doubles.
153
153
  */
154
154
  export declare function displayViewSignalTables(input: DisplayViewExpectedSignalInput): SignalTables;
155
+ /**
156
+ * Internal (#569): the tables of an input, built without the content cache (the display view's lens PSF builds one per field zone,
157
+ * which would only evict the view's own entries).
158
+ */
159
+ export declare function buildTables(input: DisplayViewExpectedSignalInput): SignalTables;
155
160
  /**
156
161
  * 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
157
162
  * query point of offset o and K the diffraction kernel (a single unit tap without diffraction). This is the sum the
@@ -103,7 +103,11 @@ function prepareSignal(input) {
103
103
  export function displayViewSignalTables(input) {
104
104
  return (PREPARED.get(input) ?? prepareSignal(input)).tables;
105
105
  }
106
- function buildTables(input) {
106
+ /**
107
+ * Internal (#569): the tables of an input, built without the content cache (the display view's lens PSF builds one per field zone,
108
+ * which would only evict the view's own entries).
109
+ */
110
+ export function buildTables(input) {
107
111
  const nodes = input.wavelengthsNm.length, R = input.kernels ? input.kernels.radius : 0, size = 2 * R + 1;
108
112
  const A = input.electronsPerRadiance, scene = input.scene, offsets = input.offsets;
109
113
  const kernelAt = (node, t) => (input.kernels ? input.kernels.perNode[node][t] : 1);