@photivra/engine 1.3.0 → 1.5.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 (235) hide show
  1. package/CHANGELOG.md +17 -1
  2. package/CITATION.cff +1 -1
  3. package/dist/capture/environment-raw-producer.d.ts +6 -3
  4. package/dist/capture/environment-raw-producer.d.ts.map +1 -1
  5. package/dist/capture/environment-raw-producer.js +26 -15
  6. package/dist/capture/environment-raw-producer.js.map +1 -1
  7. package/dist/capture/export-jpeg.d.ts +9 -0
  8. package/dist/capture/export-jpeg.d.ts.map +1 -1
  9. package/dist/capture/export-jpeg.js +51 -12
  10. package/dist/capture/export-jpeg.js.map +1 -1
  11. package/dist/capture/native-environment-raw.d.ts +43 -0
  12. package/dist/capture/native-environment-raw.d.ts.map +1 -0
  13. package/dist/capture/native-environment-raw.js +81 -0
  14. package/dist/capture/native-environment-raw.js.map +1 -0
  15. package/dist/capture/native-raw-development.d.ts +45 -0
  16. package/dist/capture/native-raw-development.d.ts.map +1 -0
  17. package/dist/capture/native-raw-development.js +159 -0
  18. package/dist/capture/native-raw-development.js.map +1 -0
  19. package/dist/capture/native-raw.d.ts +83 -0
  20. package/dist/capture/native-raw.d.ts.map +1 -0
  21. package/dist/capture/native-raw.js +146 -0
  22. package/dist/capture/native-raw.js.map +1 -0
  23. package/dist/capture/raw-frame-reconstruction.d.ts +2 -0
  24. package/dist/capture/raw-frame-reconstruction.d.ts.map +1 -1
  25. package/dist/capture/raw-frame-reconstruction.js +18 -13
  26. package/dist/capture/raw-frame-reconstruction.js.map +1 -1
  27. package/dist/capture/sensor-raw-producer.d.ts +8 -0
  28. package/dist/capture/sensor-raw-producer.d.ts.map +1 -1
  29. package/dist/capture/sensor-raw-producer.js +43 -38
  30. package/dist/capture/sensor-raw-producer.js.map +1 -1
  31. package/dist/capture/simulated-capture.d.ts +8 -0
  32. package/dist/capture/simulated-capture.d.ts.map +1 -1
  33. package/dist/capture/simulated-capture.js +24 -13
  34. package/dist/capture/simulated-capture.js.map +1 -1
  35. package/dist/color/srgb-icc.d.ts +8 -0
  36. package/dist/color/srgb-icc.d.ts.map +1 -0
  37. package/dist/color/srgb-icc.js +67 -0
  38. package/dist/color/srgb-icc.js.map +1 -0
  39. package/dist/color/srgb-transfer.d.ts +4 -0
  40. package/dist/color/srgb-transfer.d.ts.map +1 -0
  41. package/dist/color/srgb-transfer.js +9 -0
  42. package/dist/color/srgb-transfer.js.map +1 -0
  43. package/dist/composition/image-formation-plan.d.ts.map +1 -1
  44. package/dist/composition/image-formation-plan.js +4 -1
  45. package/dist/composition/image-formation-plan.js.map +1 -1
  46. package/dist/core/version.d.ts +1 -1
  47. package/dist/core/version.js +1 -1
  48. package/dist/index.d.ts +12 -2
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +6 -0
  51. package/dist/index.js.map +1 -1
  52. package/dist/motion/camera-rotation.d.ts +8 -0
  53. package/dist/motion/camera-rotation.d.ts.map +1 -1
  54. package/dist/motion/camera-rotation.js +2 -1
  55. package/dist/motion/camera-rotation.js.map +1 -1
  56. package/dist/optics/sensor-aperture-rays.d.ts +56 -0
  57. package/dist/optics/sensor-aperture-rays.d.ts.map +1 -0
  58. package/dist/optics/sensor-aperture-rays.js +55 -0
  59. package/dist/optics/sensor-aperture-rays.js.map +1 -0
  60. package/dist/output/print-jpeg.d.ts +63 -0
  61. package/dist/output/print-jpeg.d.ts.map +1 -0
  62. package/dist/output/print-jpeg.js +141 -0
  63. package/dist/output/print-jpeg.js.map +1 -0
  64. package/dist/output/sdr-rendering.d.ts.map +1 -1
  65. package/dist/output/sdr-rendering.js +2 -1
  66. package/dist/output/sdr-rendering.js.map +1 -1
  67. package/dist/sensor/environment-photo-signal.d.ts +15 -4
  68. package/dist/sensor/environment-photo-signal.d.ts.map +1 -1
  69. package/dist/sensor/environment-photo-signal.js +39 -15
  70. package/dist/sensor/environment-photo-signal.js.map +1 -1
  71. package/dist/sensor/raw-reconstruction.d.ts +5 -0
  72. package/dist/sensor/raw-reconstruction.d.ts.map +1 -1
  73. package/dist/sensor/raw-reconstruction.js +21 -47
  74. package/dist/sensor/raw-reconstruction.js.map +1 -1
  75. package/docs/API_REFERENCE.md +87 -1
  76. package/docs/DENSE_PUPIL_QUALIFICATION.md +121 -0
  77. package/docs/ENVIRONMENT_RAW_CAPTURE.md +2 -0
  78. package/docs/NATIVE_RAW_AND_PRINT.md +54 -0
  79. package/docs/RELEASE_1_4_0.md +23 -0
  80. package/docs/RELEASE_1_5_0.md +105 -0
  81. package/docs/SENSOR_APERTURE_RAYS.md +23 -0
  82. package/docs/SEPARABLE_EMISSION_DRAFT.md +103 -0
  83. package/docs/api/camera-equivalent-focal-length.md +1 -1
  84. package/docs/api/camera-field-of-view.md +1 -1
  85. package/docs/api/camera-projected-object-size.md +1 -1
  86. package/docs/api/capture-capture-export-metadata.md +1 -1
  87. package/docs/api/capture-environment-raw-producer.md +3 -2
  88. package/docs/api/capture-focus-control.md +1 -1
  89. package/docs/api/capture-linear-encoding.md +1 -1
  90. package/docs/api/capture-native-environment-raw.md +88 -0
  91. package/docs/api/capture-native-raw-development.md +70 -0
  92. package/docs/api/capture-native-raw.md +161 -0
  93. package/docs/api/capture-photographic-export.md +1 -1
  94. package/docs/api/capture-raw-frame-reconstruction.md +1 -1
  95. package/docs/api/capture-release-sequence.md +1 -1
  96. package/docs/api/capture-sensor-raw-frame.md +1 -1
  97. package/docs/api/capture-sensor-raw-producer.md +1 -1
  98. package/docs/api/capture-simulated-capture.md +9 -1
  99. package/docs/api/color-capture-color.md +1 -1
  100. package/docs/api/color-srgb-icc.md +23 -0
  101. package/docs/api/color-white-balance.md +1 -1
  102. package/docs/api/composition-image-formation-plan.md +1 -1
  103. package/docs/api/composition-plan-consumer.md +1 -1
  104. package/docs/api/core-calculation-result.md +1 -1
  105. package/docs/api/core-configuration-error.md +1 -1
  106. package/docs/api/core-image-formation.md +1 -1
  107. package/docs/api/core-scientific-assurance.md +1 -1
  108. package/docs/api/core-spectral-composition.md +1 -1
  109. package/docs/api/core-spectral.md +1 -1
  110. package/docs/api/core-validation.md +1 -1
  111. package/docs/api/core-version.md +2 -2
  112. package/docs/api/equipment-exposure-capabilities.md +1 -1
  113. package/docs/api/equipment-generic-tier-assets.md +1 -1
  114. package/docs/api/equipment-generic-tier-presets.md +1 -1
  115. package/docs/api/equipment-iso-capabilities.md +1 -1
  116. package/docs/api/equipment-metering-capabilities.md +1 -1
  117. package/docs/api/equipment-release-capabilities.md +1 -1
  118. package/docs/api/exports.json +222 -2
  119. package/docs/api/exposure-exposure-duration-control.md +1 -1
  120. package/docs/api/exposure-exposure-mode-resolver.md +1 -1
  121. package/docs/api/exposure-exposure.md +1 -1
  122. package/docs/api/exposure-flash.md +1 -1
  123. package/docs/api/exposure-metering-scene-radiance.md +1 -1
  124. package/docs/api/exposure-metering-target.md +1 -1
  125. package/docs/api/exposure-metering-temporal.md +1 -1
  126. package/docs/api/exposure-metering.md +1 -1
  127. package/docs/api/exposure-program-line.md +1 -1
  128. package/docs/api/motion-camera-rotation.md +1 -1
  129. package/docs/api/motion-capture-rotation-inverse-mapping.md +1 -1
  130. package/docs/api/motion-capture-rotation-temporal-quadrature.md +1 -1
  131. package/docs/api/motion-capture-rotation-trajectory.md +1 -1
  132. package/docs/api/motion-capture-translation-parallax-temporal-quadrature.md +1 -1
  133. package/docs/api/motion-extended-object-projection.md +1 -1
  134. package/docs/api/motion-projected-motion.md +1 -1
  135. package/docs/api/optics-aperture.md +1 -1
  136. package/docs/api/optics-circle-of-confusion.md +1 -1
  137. package/docs/api/optics-complex-pupil-psf.md +1 -1
  138. package/docs/api/optics-depth-of-field.md +1 -1
  139. package/docs/api/optics-diffraction.md +1 -1
  140. package/docs/api/optics-focus-breathing.md +1 -1
  141. package/docs/api/optics-focus-state.md +1 -1
  142. package/docs/api/optics-front-of-lens-filter.md +1 -1
  143. package/docs/api/optics-illumination-vignetting.md +1 -1
  144. package/docs/api/optics-lateral-chromatic-aberration.md +1 -1
  145. package/docs/api/optics-lens-psf-profile.md +1 -1
  146. package/docs/api/optics-polygon-diffraction.md +1 -1
  147. package/docs/api/optics-profile-contract.md +1 -1
  148. package/docs/api/optics-psf-foundation.md +1 -1
  149. package/docs/api/optics-radial-distortion.md +1 -1
  150. package/docs/api/optics-scene-to-sensor-irradiance.md +1 -1
  151. package/docs/api/optics-scene-to-sensor-quadrature.md +1 -1
  152. package/docs/api/optics-sensor-aperture-rays.md +75 -0
  153. package/docs/api/optics-sensor-environment-query.md +1 -1
  154. package/docs/api/optics-sensor-psf-quadrature.md +1 -1
  155. package/docs/api/optics-stray-light.md +1 -1
  156. package/docs/api/optics-thin-lens.md +1 -1
  157. package/docs/api/output-capture-corrected-sdr.md +1 -1
  158. package/docs/api/output-capture-geometry.md +1 -1
  159. package/docs/api/output-capture-sdr.md +1 -1
  160. package/docs/api/output-crop.md +1 -1
  161. package/docs/api/output-geometric-transforms.md +1 -1
  162. package/docs/api/output-lens-corrections.md +1 -1
  163. package/docs/api/output-native-capture-sdr.md +1 -1
  164. package/docs/api/output-print-contrast-reference.md +1 -1
  165. package/docs/api/output-print-detail.md +1 -1
  166. package/docs/api/output-print-jpeg.md +117 -0
  167. package/docs/api/output-print-plan.md +1 -1
  168. package/docs/api/output-print-region-statistics.md +1 -1
  169. package/docs/api/output-sdr-rendering.md +1 -1
  170. package/docs/api/output-subject-framing-crop.md +1 -1
  171. package/docs/api/schema-camera.md +1 -1
  172. package/docs/api/schema-illumination-spectral.md +1 -1
  173. package/docs/api/schema-illumination-temporal.md +1 -1
  174. package/docs/api/schema-illumination.md +1 -1
  175. package/docs/api/schema-scene-radiance-temporal.md +1 -1
  176. package/docs/api/schema-scene-radiance.md +1 -1
  177. package/docs/api/schema-scene.md +1 -1
  178. package/docs/api/schema-validation.md +1 -1
  179. package/docs/api/sensor-accumulated-charge.md +1 -1
  180. package/docs/api/sensor-architecture.md +1 -1
  181. package/docs/api/sensor-camera-saturation-capacity.md +1 -1
  182. package/docs/api/sensor-capture-color-sampling-binding.md +1 -1
  183. package/docs/api/sensor-capture-mode-timing.md +1 -1
  184. package/docs/api/sensor-capture-mode.md +1 -1
  185. package/docs/api/sensor-color-sampling.md +1 -1
  186. package/docs/api/sensor-constant-rate-temporal-integration.md +1 -1
  187. package/docs/api/sensor-dark-current.md +1 -1
  188. package/docs/api/sensor-environment-photo-signal.md +17 -1
  189. package/docs/api/sensor-eqe-electron-rate.md +1 -1
  190. package/docs/api/sensor-eqe-local-exposure.md +1 -1
  191. package/docs/api/sensor-eqe-temporal-exposure.md +1 -1
  192. package/docs/api/sensor-exposure-window.md +1 -1
  193. package/docs/api/sensor-iso-signal-chain.md +1 -1
  194. package/docs/api/sensor-local-exposure-binding.md +1 -1
  195. package/docs/api/sensor-optical-stack.md +1 -1
  196. package/docs/api/sensor-photon-energy.md +1 -1
  197. package/docs/api/sensor-physical-charge-capacity.md +1 -1
  198. package/docs/api/sensor-pixel-pitch.md +1 -1
  199. package/docs/api/sensor-radiometry-readiness.md +1 -1
  200. package/docs/api/sensor-raw-readout.md +1 -1
  201. package/docs/api/sensor-raw-reconstruction.md +1 -1
  202. package/docs/api/sensor-readout-exposure-linkage.md +1 -1
  203. package/docs/api/sensor-readout-timing.md +1 -1
  204. package/docs/api/sensor-response-application-compatibility.md +1 -1
  205. package/docs/api/sensor-response-operating-range.md +1 -1
  206. package/docs/api/sensor-responsivity-photocurrent.md +1 -1
  207. package/docs/api/sensor-sampling-aperture.md +1 -1
  208. package/docs/api/sensor-scene-eqe-temporal-exposure.md +1 -1
  209. package/docs/api/sensor-sensor-geometry.md +1 -1
  210. package/docs/api/sensor-signal-noise.md +1 -1
  211. package/docs/api/sensor-spatial-sample-reduction.md +1 -1
  212. package/docs/api/sensor-spatial-sampling-quadrature.md +1 -1
  213. package/docs/api/sensor-spatio-spectral-reduction.md +1 -1
  214. package/docs/api/sensor-spectral-coverage.md +1 -1
  215. package/docs/api/sensor-spectral-quadrature.md +1 -1
  216. package/docs/api/sensor-spectral-response.md +1 -1
  217. package/docs/api/sensor-temporal-photo-signal.md +1 -1
  218. package/docs/api/simulation-poc-simulation.md +1 -1
  219. package/docs/api/stabilization-camera-shake.md +1 -1
  220. package/docs/api/stabilization-system.md +1 -1
  221. package/docs/validation/dense-pupil-2026-10-06/pilot.jsonl +6 -0
  222. package/docs/validation/native-raw-print-2026-10-04/fractional-asymmetric-crop.jpg +0 -0
  223. package/docs/validation/native-raw-print-2026-10-04/gray-ramp.jpg +0 -0
  224. package/docs/validation/native-raw-print-2026-10-04/linear-area-checker.jpg +0 -0
  225. package/docs/validation/native-raw-print-2026-10-04/manifest.json +218 -0
  226. package/docs/validation/native-raw-print-2026-10-04/megapixel-native.jpg +0 -0
  227. package/docs/validation/native-raw-print-2026-10-04/native-color.jpg +0 -0
  228. package/docs/validation/native-raw-print-2026-10-04/photivra-native-full-megapixel-validation.json +9 -0
  229. package/docs/validation/native-raw-print-2026-10-04/photivra-native-full-megapixel.json +29 -0
  230. package/docs/validation/native-raw-print-2026-10-04/photivra-native-full-megapixel.json.codes.u16le.gz +0 -0
  231. package/docs/validation/native-raw-print-2026-10-04/photivra-native-full-megapixel.json.jpg +0 -0
  232. package/docs/validation/native-raw-print-2026-10-04/photivra-native-full-megapixel.json.rgb.gz +0 -0
  233. package/docs/validation/native-raw-print-2026-10-04/srgb.icc +0 -0
  234. package/docs/validation/native-raw-print-2026-10-04/validation.json +41 -0
  235. package/package.json +1 -1
@@ -0,0 +1,159 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ /** Exact packed RAW reconstruction and shared color/SDR development, with bounded pixel tiles. */
3
+ import { calculateNativeRawPlan } from "./native-raw.js";
4
+ import { parseRawReconstructionPhaseProfiles } from "./raw-frame-reconstruction.js";
5
+ import { calculateRawReconstructionChannel } from "../sensor/raw-reconstruction.js";
6
+ import { resolveColorSamplingSite } from "../sensor/color-sampling.js";
7
+ import { parseExportSensorColorProfile } from "./photographic-export.js";
8
+ import { prepareSensorColorDevelopment, invertSensorColorMatrix, sensorColorReferenceWhite } from "../color/sensor-color-development.js";
9
+ import { calculateSdrRendering, parseSdrRenderingProfile } from "../output/sdr-rendering.js";
10
+ import { transformOrientedRasterPointToNative } from "../output/capture-geometry.js";
11
+ import { InvalidConfigurationError } from "../core/configuration-error.js";
12
+ import { requireAllowlistedRecord } from "../core/record-validation.js";
13
+ import { stringifyCanonicalJson } from "../core/canonical-json.js";
14
+ import { freezeOwnedData } from "../core/owned-data.js";
15
+ function canonical(value) {
16
+ return stringifyCanonicalJson(value, { undefinedObjectProperties: "reject", nonFiniteNumberMessage: "Invalid RAW metadata.", unsupportedValueMessage: "Invalid RAW metadata." });
17
+ }
18
+ function validateRaw(raw) {
19
+ requireAllowlistedRecord(raw, ["plan", "codes", "blackLevels", "digitalSaturationCodes", "saturationFlags"], "Invalid packed RAW output.");
20
+ const p = raw.plan;
21
+ if (!p?.exposure || !p.frame)
22
+ throw new InvalidConfigurationError("Packed RAW requires complete exposure and frame metadata.");
23
+ const { engineApiVersion, resolvedGeometry, equivalentFocalLength35Mm, ...exposure } = p.exposure;
24
+ void engineApiVersion;
25
+ void resolvedGeometry;
26
+ void equivalentFocalLength35Mm;
27
+ const { capture, containerBitDepth, ...frame } = p.frame;
28
+ void capture;
29
+ void containerBitDepth;
30
+ const input = { exposure, ...frame, maximumOutputBytes: p.outputBytes, ...(p.tileWidth === undefined ? {} : { tileWidth: p.tileWidth }), ...(p.exposureWindow ? { exposureWindow: p.exposureWindow } : {}) };
31
+ const plan = calculateNativeRawPlan(input);
32
+ if (canonical(p) !== canonical(plan))
33
+ throw new InvalidConfigurationError("Packed RAW metadata is stale or inconsistent.");
34
+ for (const [a, type] of [[raw.codes, Uint16Array], [raw.blackLevels, Uint16Array], [raw.digitalSaturationCodes, Uint16Array], [raw.saturationFlags, Uint8Array]])
35
+ if (!(a instanceof type) || !(a.buffer instanceof ArrayBuffer) || a.length !== plan.pixelCount || a.buffer.byteLength !== a.byteLength)
36
+ throw new InvalidConfigurationError("Packed RAW storage must be exact owned native arrays.");
37
+ return plan;
38
+ }
39
+ /**
40
+ * Validates complete phase/halo support, snapshots RAW once, and yields between 256-pixel output tiles.
41
+ * Retains explicit acquisition tile width when reconstructing the exact packed plan. Omitted width
42
+ * preserves legacy plan shape; inconsistent tile counts or unsupported widths fail validation.
43
+ * Acquisition chunk width changes neither CFA/seed coordinates nor development pixels, and does
44
+ * not establish transport or device-resource qualification.
45
+ */
46
+ export function createNativeRawDevelopmentTask(input, yieldControl) {
47
+ const r = requireAllowlistedRecord(input, ["raw", "phaseProfiles", "colorProfile", "whiteBalance", "rendering", "maximumRetainedPayloadBytes"], "Invalid native RAW development input.");
48
+ if (typeof yieldControl !== "function")
49
+ throw new InvalidConfigurationError("Development requires a host event-loop yield.");
50
+ const plan = validateRaw(input.raw), g = plan.exposure.resolvedGeometry, native = plan.exposure.geometry.nativeRaster;
51
+ const phases = freezeOwnedData(parseRawReconstructionPhaseProfiles(r.phaseProfiles, plan.frame.modeId, plan.frame.colorSamplingProfile));
52
+ const color = freezeOwnedData(parseExportSensorColorProfile(r.colorProfile)), profile = freezeOwnedData(parseSdrRenderingProfile(r.rendering));
53
+ const crop = g.output.cropRect, raster = g.output.raster, active = g.activeCapture.nativeRect, intent = plan.exposure.whiteBalanceIntent;
54
+ if (color.colorSamplingProfileId !== plan.frame.colorSamplingProfile.profileId || phases.some(p => canonical(p.profile.kernels.map(k => k.outputChannelId)) !== canonical(color.channelIds)) ||
55
+ (r.whiteBalance !== "not-required" && r.whiteBalance !== "apply-resolved-sensor-gains") || (intent !== null) !== (r.whiteBalance === "apply-resolved-sensor-gains") ||
56
+ raster.pixelWidth !== crop.width || raster.pixelHeight !== crop.height)
57
+ throw new InvalidConfigurationError("Development requires bound sensor RGB, explicit one-time WB and 1:1 output crop.");
58
+ const whiteBalance = r.whiteBalance;
59
+ const bytes = plan.outputBytes + raster.pixelWidth * raster.pixelHeight * 3 * profile.bitDepth / 8;
60
+ if (typeof r.maximumRetainedPayloadBytes !== "number" || !Number.isSafeInteger(r.maximumRetainedPayloadBytes) || r.maximumRetainedPayloadBytes < bytes)
61
+ throw new InvalidConfigurationError("Development exceeds retained output budget.");
62
+ const gains = intent ? [intent.channelGains.red, intent.channelGains.green, intent.channelGains.blue] : [1, 1, 1];
63
+ if (sensorColorReferenceWhite(invertSensorColorMatrix(color.normalizedCameraChannelsToXyz)).some(x => x <= 0 || !Number.isFinite(x)))
64
+ throw new InvalidConfigurationError("Reference white requires positive camera coordinates.");
65
+ const development = prepareSensorColorDevelopment(color.normalizedCameraChannelsToXyz, gains), layout = plan.frame.colorSamplingProfile.layout;
66
+ if (layout.kind !== "periodic-mosaic")
67
+ throw new InvalidConfigurationError("Development requires periodic CFA.");
68
+ const nativeCorners = [{ x: crop.x + .5, y: crop.y + .5 }, { x: crop.x + crop.width - .5, y: crop.y + crop.height - .5 }].map(point => {
69
+ const p = transformOrientedRasterPointToNative({ point, nativeRaster: g.activeCapture.raster, orientation: plan.exposure.geometry.orientation });
70
+ return { x: Math.floor(p.x) + active.x, y: Math.floor(p.y) + active.y };
71
+ });
72
+ const minX = Math.min(...nativeCorners.map(p => p.x)), maxX = Math.max(...nativeCorners.map(p => p.x)), minY = Math.min(...nativeCorners.map(p => p.y)), maxY = Math.max(...nativeCorners.map(p => p.y));
73
+ for (const phase of phases) {
74
+ const firstX = minX + (phase.phaseX - minX % layout.repeatWidthSites + layout.repeatWidthSites) % layout.repeatWidthSites;
75
+ const firstY = minY + (phase.phaseY - minY % layout.repeatHeightSites + layout.repeatHeightSites) % layout.repeatHeightSites;
76
+ if (firstX > maxX || firstY > maxY)
77
+ continue;
78
+ const lastX = maxX - (maxX - phase.phaseX + layout.repeatWidthSites) % layout.repeatWidthSites, lastY = maxY - (maxY - phase.phaseY + layout.repeatHeightSites) % layout.repeatHeightSites;
79
+ for (const kernel of phase.profile.kernels)
80
+ for (const c of kernel.contributions) {
81
+ if (firstX + c.offsetX < 0 || firstY + c.offsetY < 0 || lastX + c.offsetX >= native.pixelWidth || lastY + c.offsetY >= native.pixelHeight)
82
+ throw new InvalidConfigurationError("Reconstruction halo leaves native RAW; no padding or renormalization.");
83
+ const channel = resolveColorSamplingSite({ profile: plan.frame.colorSamplingProfile, site: { x: firstX + c.offsetX, y: firstY + c.offsetY } }).mapping.channelId;
84
+ if (channel !== c.sourceChannelId)
85
+ throw new InvalidConfigurationError("Reconstruction source channel disagrees with absolute CFA phase.");
86
+ }
87
+ }
88
+ // Numeric integrity before execution; signed values below black are preserved.
89
+ for (let i = 0; i < plan.pixelCount; i++)
90
+ if (input.raw.blackLevels[i] >= input.raw.digitalSaturationCodes[i] || input.raw.codes[i] > input.raw.digitalSaturationCodes[i] || input.raw.saturationFlags[i] > 7)
91
+ throw new InvalidConfigurationError("Invalid packed RAW code span or saturation flags.");
92
+ const raw = { plan, codes: input.raw.codes.slice(), blackLevels: input.raw.blackLevels.slice(), digitalSaturationCodes: input.raw.digitalSaturationCodes.slice(), saturationFlags: input.raw.saturationFlags.slice() };
93
+ const abort = new AbortController();
94
+ let state = "ready", output = null, codes = null;
95
+ function release() { raw.codes.fill(0); raw.blackLevels.fill(0); raw.digitalSaturationCodes.fill(0); raw.saturationFlags.fill(0); codes?.fill(0); codes = null; output = null; }
96
+ function check() { if (abort.signal.aborted)
97
+ throw new InvalidConfigurationError("Native RAW development aborted."); }
98
+ return { get state() { return state; },
99
+ async run() {
100
+ if (state !== "ready")
101
+ throw new InvalidConfigurationError("Development task is single-use.");
102
+ state = "running";
103
+ try {
104
+ codes = profile.bitDepth === 8 ? new Uint8Array(raster.pixelWidth * raster.pixelHeight * 3) : new Uint16Array(raster.pixelWidth * raster.pixelHeight * 3);
105
+ const diagnostics = { renderingNegativeSampleCount: 0, renderingAboveReferenceSampleCount: 0, toneChangedSampleCount: 0, gamutClippedLowSampleCount: 0, gamutClippedHighSampleCount: 0, captureSaturation: "not-consumed" };
106
+ let encoding, adaptation;
107
+ for (let y = 0; y < raster.pixelHeight; y++)
108
+ for (let x = 0; x < raster.pixelWidth; x += 256) {
109
+ check();
110
+ const width = Math.min(256, raster.pixelWidth - x);
111
+ {
112
+ const rgb = [];
113
+ for (let j = 0; j < width; j++) {
114
+ const q = transformOrientedRasterPointToNative({ point: { x: crop.x + x + j + .5, y: crop.y + y + .5 }, nativeRaster: g.activeCapture.raster, orientation: plan.exposure.geometry.orientation });
115
+ const point = { x: Math.floor(q.x) + active.x, y: Math.floor(q.y) + active.y };
116
+ const phase = phases[(point.y % layout.repeatHeightSites) * layout.repeatWidthSites + point.x % layout.repeatWidthSites];
117
+ const values = phase.profile.kernels.map(kernel => calculateRawReconstructionChannel(kernel, point, (sx, sy) => {
118
+ const i = sy * native.pixelWidth + sx;
119
+ return (raw.codes[i] - raw.blackLevels[i]) / (raw.digitalSaturationCodes[i] - raw.blackLevels[i]);
120
+ }).linearBlackSubtractedNormalizedValue);
121
+ rgb.push(...development.develop(values));
122
+ }
123
+ const rendered = calculateSdrRendering({ sourceImageStateId: plan.frame.frameId + ":developed", inputImageState: "color-transformed-linear-rgb", inputColorSpace: "linear-srgb-d65", whiteBalanceHandling: intent ? "already-applied-upstream" : "not-required", pixelWidth: width, pixelHeight: 1, referenceWhiteValue: 1, samples: rgb, profile }).value;
124
+ codes.set(rendered.integerSamples, (y * raster.pixelWidth + x) * 3);
125
+ for (const key of ["renderingNegativeSampleCount", "renderingAboveReferenceSampleCount", "toneChangedSampleCount", "gamutClippedLowSampleCount", "gamutClippedHighSampleCount"])
126
+ diagnostics[key] += rendered.diagnostics[key];
127
+ encoding = rendered.outputEncoding;
128
+ adaptation = rendered.displayAdaptation;
129
+ }
130
+ await yieldControl(abort.signal);
131
+ check();
132
+ }
133
+ output = { raw, phaseProfiles: phases, colorProfile: color, whiteBalance, width: raster.pixelWidth, height: raster.pixelHeight, integerSamples: codes, diagnostics, rendering: profile, displayAdaptation: adaptation, outputEncoding: encoding, imageDataPairing: "derived-from-exact-packed-native-raw", producerOriginVerified: false };
134
+ state = "completed";
135
+ }
136
+ catch (error) {
137
+ release();
138
+ if (!abort.signal.aborted) {
139
+ state = "failed";
140
+ abort.abort();
141
+ }
142
+ throw error;
143
+ }
144
+ },
145
+ cancel() { if (state === "ready" || state === "running" || state === "completed") {
146
+ state = "cancelled";
147
+ abort.abort();
148
+ release();
149
+ } },
150
+ dispose() { if (state !== "transferred") {
151
+ state = "disposed";
152
+ abort.abort();
153
+ release();
154
+ } },
155
+ takeOutput() { if (state !== "completed" || !output)
156
+ throw new InvalidConfigurationError("Development output unavailable."); const value = output; output = null; codes = null; state = "transferred"; return value; }
157
+ };
158
+ }
159
+ //# sourceMappingURL=native-raw-development.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-raw-development.js","sourceRoot":"","sources":["../../src/capture/native-raw-development.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC,kGAAkG;AAClG,OAAO,EAAE,sBAAsB,EAAsE,MAAM,iBAAiB,CAAC;AAC7H,OAAO,EAAE,mCAAmC,EAA2C,MAAM,+BAA+B,CAAC;AAC7H,OAAO,EAAE,iCAAiC,EAAE,MAAM,iCAAiC,CAAC;AACpF,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,6BAA6B,EAAiC,MAAM,0BAA0B,CAAC;AACxG,OAAO,EAAE,6BAA6B,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACzI,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAqD,MAAM,4BAA4B,CAAC;AAChJ,OAAO,EAAE,oCAAoC,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAiCxD,SAAS,SAAS,CAA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AA,CAAC;KAC5N,CAAC;AACJ,CAAC"}
@@ -0,0 +1,83 @@
1
+ /** Metadata-only admission and bounded execution of the existing native scalar RAW model. */
2
+ import { type SimulatedCaptureInput, type SimulatedCapture, type CaptureExposureSource } from "./simulated-capture.js";
3
+ import { type NativeRawProducerFrameContext, type SensorRawProducerSiteInput, type SensorRawProducerExposureWindowInput } from "./sensor-raw-producer.js";
4
+ export declare const NATIVE_RAW_SCHEMA_VERSION: "0.1.0";
5
+ export declare const NATIVE_RAW_LIMITS: Readonly<{
6
+ maximumPixels: 24000000;
7
+ maximumDimension: 16384;
8
+ tileWidth: 256;
9
+ tileHeight: 1;
10
+ outputBytesPerPixel: 7;
11
+ }>;
12
+ /** A shooting event and source provenance, not a produced float master or committed RAW frame. */
13
+ export type NativeRawExposureInput = Omit<SimulatedCaptureInput, "planes" | "source"> & {
14
+ source: CaptureExposureSource;
15
+ };
16
+ export type NativeRawExposure = Omit<SimulatedCapture, "schemaVersion" | "planes" | "source"> & {
17
+ source: CaptureExposureSource;
18
+ };
19
+ export interface NativeRawInput {
20
+ exposure: NativeRawExposureInput;
21
+ frameId: string;
22
+ modeId: string;
23
+ captureModeProfile: NativeRawProducerFrameContext["captureModeProfile"];
24
+ colorSamplingProfile: NativeRawProducerFrameContext["colorSamplingProfile"];
25
+ bindingProfile: NativeRawProducerFrameContext["bindingProfile"];
26
+ exposureWindow?: SensorRawProducerExposureWindowInput;
27
+ maximumOutputBytes: number;
28
+ /** Optional execution chunk width in native sites, 1–256; omission preserves 256. Not a sampling control. */
29
+ tileWidth?: number;
30
+ }
31
+ export interface NativeRawPlan {
32
+ schemaVersion: typeof NATIVE_RAW_SCHEMA_VERSION;
33
+ exposure: NativeRawExposure;
34
+ frame: NativeRawProducerFrameContext;
35
+ exposureWindow?: SensorRawProducerExposureWindowInput;
36
+ pixelCount: number;
37
+ outputBytes: number;
38
+ tileCount: number;
39
+ /** Present only for an explicit execution chunk width. Omission preserves legacy plan shape. */
40
+ tileWidth?: number;
41
+ upstreamRadiometryVerified: false;
42
+ seedSchedule: "capture-seed-plus-two-native-index-modulo-2-to-32-v1";
43
+ }
44
+ /** Rectangle is absolute full-native CFA space, before orientation, active crop or output scaling. */
45
+ export interface NativeRawTileRequest {
46
+ captureId: string;
47
+ frameId: string;
48
+ x: number;
49
+ y: number;
50
+ width: number;
51
+ height: number;
52
+ }
53
+ export interface NativeRawTile extends NativeRawTileRequest {
54
+ sites: readonly SensorRawProducerSiteInput[];
55
+ }
56
+ export interface NativeRawProvider {
57
+ readTile(request: Readonly<NativeRawTileRequest>, signal: AbortSignal): Promise<NativeRawTile>;
58
+ yieldControl(signal: AbortSignal): Promise<void>;
59
+ }
60
+ /** Sole-owner row-major arrays. They are not attachable to the bounded SensorRawFrame contract. */
61
+ export interface NativeRawOutput {
62
+ plan: NativeRawPlan;
63
+ codes: Uint16Array;
64
+ blackLevels: Uint16Array;
65
+ digitalSaturationCodes: Uint16Array;
66
+ /** Bits 0,1,2: physical scalar clamp, pre-ADC clamp, digital saturation respectively. */
67
+ saturationFlags: Uint8Array;
68
+ }
69
+ export type NativeRawTaskState = "ready" | "running" | "completed" | "cancelled" | "failed" | "disposed" | "transferred";
70
+ export interface NativeRawTask {
71
+ readonly plan: NativeRawPlan;
72
+ readonly state: NativeRawTaskState;
73
+ readonly completedTileCount: number;
74
+ run(): Promise<void>;
75
+ cancel(): void;
76
+ dispose(): void;
77
+ takeOutput(): NativeRawOutput;
78
+ }
79
+ /** Full raster/resource/profile admission before callbacks or output allocation; no placeholder plane. */
80
+ export declare function calculateNativeRawPlan(input: NativeRawInput): NativeRawPlan;
81
+ /** Executes validated EQE/dark/completeness events through the shared reference scalar physics. */
82
+ export declare function createNativeRawTask(input: NativeRawInput, provider: NativeRawProvider): NativeRawTask;
83
+ //# sourceMappingURL=native-raw.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-raw.d.ts","sourceRoot":"","sources":["../../src/capture/native-raw.ts"],"names":[],"mappings":"AAEA,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IAAI,CAAC,CAAC;IACrB,MAAM,IAAI,IAAI,CAAC;IACf,OAAO,IAAI,IAAI,CAAC;IAChB,UAAU,IAAI,eAAe,CAAC;CAC/B;AAcD,0GAA0G;AAC1G,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,cAAc,GAAG,aAAa,CA8B3E;AACD,mGAAmG;AACnG,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,cAAc,EAAC,QAAQ,EAAE,iBAAiB,GAAG,aAAa,CAwCpG"}
@@ -0,0 +1,146 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ /** Metadata-only admission and bounded execution of the existing native scalar RAW model. */
3
+ import { normalizeCaptureExposureMetadata } from "./simulated-capture.js";
4
+ import { ENGINE_API_VERSION } from "../core/version.js";
5
+ import { InvalidConfigurationError } from "../core/configuration-error.js";
6
+ import { requireAllowlistedRecord, requirePublicOpaqueId } from "../core/record-validation.js";
7
+ import { freezeOwnedData } from "../core/owned-data.js";
8
+ import { parseCaptureModeProfile } from "../sensor/capture-mode.js";
9
+ import { parseSensorColorSamplingProfile } from "../sensor/color-sampling.js";
10
+ import { parseNativeEffectiveRasterColorSamplingBindingProfile, resolveCaptureModeColorSamplingContributors } from "../sensor/capture-color-sampling-binding.js";
11
+ import { calculateCaptureExposureWindows } from "../sensor/exposure-window.js";
12
+ import { SENSOR_RAW_PRODUCER_NOISE_MODEL, calculateNativeRawSite, parseNativeRawProducerSite, validateNativeRawReadoutIdentity } from "./sensor-raw-producer.js";
13
+ export const NATIVE_RAW_SCHEMA_VERSION = "0.1.0";
14
+ export const NATIVE_RAW_LIMITS = Object.freeze({ maximumPixels: 24_000_000, maximumDimension: 16_384,
15
+ tileWidth: 256, tileHeight: 1, outputBytesPerPixel: 7 });
16
+ function windows(exposure, schedule, points) {
17
+ const r = requireAllowlistedRecord(schedule, ["shutterMechanism", "nominalExposureDurationSeconds", "opening", "closing"], "Invalid RAW exposure schedule.");
18
+ requireAllowlistedRecord(r.nominalExposureDurationSeconds, ["value", "unit", "evidence"], "Invalid RAW nominal exposure.");
19
+ for (const boundary of [r.opening, r.closing]) {
20
+ const b = requireAllowlistedRecord(boundary, ["kind", "directionNative", "traversalDurationSeconds"], "Invalid RAW exposure boundary.");
21
+ if (b.directionNative !== undefined)
22
+ requireAllowlistedRecord(b.directionNative, ["value", "evidence"], "Invalid RAW scan direction.");
23
+ if (b.traversalDurationSeconds !== undefined)
24
+ requireAllowlistedRecord(b.traversalDurationSeconds, ["value", "unit", "evidence"], "Invalid RAW scan duration.");
25
+ }
26
+ const result = calculateCaptureExposureWindows({ ...schedule, nativeRaster: exposure.geometry.nativeRaster, samplePointsNative: points });
27
+ if (result.value.nominalExposureDurationSeconds.value !== exposure.exposure.shutterSeconds)
28
+ throw new InvalidConfigurationError("RAW schedule differs from exposure duration.");
29
+ return result.value;
30
+ }
31
+ /** Full raster/resource/profile admission before callbacks or output allocation; no placeholder plane. */
32
+ export function calculateNativeRawPlan(input) {
33
+ const r = requireAllowlistedRecord(input, ["exposure", "frameId", "modeId", "captureModeProfile", "colorSamplingProfile", "bindingProfile", "exposureWindow", "maximumOutputBytes", "tileWidth"], "Invalid native RAW input.");
34
+ if (r.tileWidth !== undefined && (typeof r.tileWidth !== "number" || !Number.isSafeInteger(r.tileWidth) || r.tileWidth < 1 || r.tileWidth > NATIVE_RAW_LIMITS.tileWidth))
35
+ throw new InvalidConfigurationError("Native RAW tile width must be an integer from 1 to 256.");
36
+ const tileWidth = r.tileWidth ?? NATIVE_RAW_LIMITS.tileWidth;
37
+ const exposure = normalizeCaptureExposureMetadata(r.exposure, ENGINE_API_VERSION, true), native = exposure.geometry.nativeRaster;
38
+ const pixelCount = native.pixelWidth * native.pixelHeight, outputBytes = pixelCount * NATIVE_RAW_LIMITS.outputBytesPerPixel;
39
+ if (pixelCount > NATIVE_RAW_LIMITS.maximumPixels || native.pixelWidth > NATIVE_RAW_LIMITS.maximumDimension || native.pixelHeight > NATIVE_RAW_LIMITS.maximumDimension ||
40
+ !Number.isSafeInteger(r.maximumOutputBytes) || typeof r.maximumOutputBytes !== "number" || r.maximumOutputBytes < outputBytes)
41
+ throw new InvalidConfigurationError("Native RAW raster exceeds output admission budget.");
42
+ const frame = { frameId: requirePublicOpaqueId(r.frameId, "Invalid RAW frame ID."), capture: exposure,
43
+ modeId: requirePublicOpaqueId(r.modeId, "Invalid RAW mode ID."), containerBitDepth: 16,
44
+ captureModeProfile: parseCaptureModeProfile(r.captureModeProfile), colorSamplingProfile: parseSensorColorSamplingProfile(r.colorSamplingProfile),
45
+ bindingProfile: parseNativeEffectiveRasterColorSamplingBindingProfile(r.bindingProfile) };
46
+ const mode = frame.captureModeProfile.modes.find(m => m.modeId === frame.modeId);
47
+ if (exposure.noise.model.id !== SENSOR_RAW_PRODUCER_NOISE_MODEL.id || exposure.noise.model.version !== SENSOR_RAW_PRODUCER_NOISE_MODEL.version ||
48
+ frame.colorSamplingProfile.layout.kind !== "periodic-mosaic" || mode?.acquisition.kind !== "single-frame" || mode.perFrameSampling.kind !== "native-effective-raster" || (mode.reconstructionStages?.length ?? 0) !== 0)
49
+ throw new InvalidConfigurationError("Native RAW requires exact noise identity and single-frame native periodic CFA.");
50
+ // Binding is global and affine; validate both corners before any provider work.
51
+ for (const p of [{ x: 0, y: 0 }, { x: native.pixelWidth - 1, y: native.pixelHeight - 1 }]) {
52
+ const c = resolveCaptureModeColorSamplingContributors({ nativeRaster: native, captureModeProfile: frame.captureModeProfile, modeId: frame.modeId, colorSamplingProfile: frame.colorSamplingProfile, bindingProfile: frame.bindingProfile, modeSampleIndexFullFrame: p });
53
+ if (c.totalContributorSites !== 1 || c.channelComposition.kind !== "single-channel")
54
+ throw new InvalidConfigurationError("Native RAW must preserve one native CFA site per sample.");
55
+ }
56
+ const schedule = r.exposureWindow === undefined ? undefined : structuredClone(r.exposureWindow);
57
+ // Supported linear scan extrema occur at raster corners. Check them before acquisition.
58
+ if (schedule)
59
+ windows(exposure, schedule, [{ x: .5, y: .5 }, { x: native.pixelWidth - .5, y: .5 }, { x: .5, y: native.pixelHeight - .5 }, { x: native.pixelWidth - .5, y: native.pixelHeight - .5 }]);
60
+ return freezeOwnedData({ schemaVersion: NATIVE_RAW_SCHEMA_VERSION, exposure, frame, pixelCount, outputBytes,
61
+ tileCount: Math.ceil(native.pixelWidth / tileWidth) * native.pixelHeight,
62
+ ...(r.tileWidth === undefined ? {} : { tileWidth }),
63
+ ...(schedule ? { exposureWindow: schedule } : {}), upstreamRadiometryVerified: false,
64
+ seedSchedule: "capture-seed-plus-two-native-index-modulo-2-to-32-v1" });
65
+ }
66
+ /** Executes validated EQE/dark/completeness events through the shared reference scalar physics. */
67
+ export function createNativeRawTask(input, provider) {
68
+ const plan = calculateNativeRawPlan(input);
69
+ if (!provider || typeof provider.readTile !== "function" || typeof provider.yieldControl !== "function")
70
+ throw new InvalidConfigurationError("Native RAW requires reader and host event-loop yield.");
71
+ const read = provider.readTile.bind(provider), yieldControl = provider.yieldControl.bind(provider), abort = new AbortController();
72
+ const native = plan.exposure.geometry.nativeRaster, tileWidth = plan.tileWidth ?? NATIVE_RAW_LIMITS.tileWidth;
73
+ let state = "ready", count = 0, output = null, first;
74
+ function release() { if (output) {
75
+ output.codes.fill(0);
76
+ output.blackLevels.fill(0);
77
+ output.digitalSaturationCodes.fill(0);
78
+ output.saturationFlags.fill(0);
79
+ } output = null; first = undefined; }
80
+ function active() { if (abort.signal.aborted)
81
+ throw new InvalidConfigurationError("Native RAW execution aborted."); }
82
+ return { plan, get state() { return state; }, get completedTileCount() { return count; },
83
+ async run() {
84
+ if (state !== "ready")
85
+ throw new InvalidConfigurationError("Native RAW task is single-use.");
86
+ state = "running";
87
+ try {
88
+ output = { plan, codes: new Uint16Array(plan.pixelCount), blackLevels: new Uint16Array(plan.pixelCount), digitalSaturationCodes: new Uint16Array(plan.pixelCount), saturationFlags: new Uint8Array(plan.pixelCount) };
89
+ for (let y = 0; y < native.pixelHeight; y++)
90
+ for (let x = 0; x < native.pixelWidth; x += tileWidth) {
91
+ active();
92
+ const request = Object.freeze({ captureId: plan.exposure.captureId, frameId: plan.frame.frameId, x, y, width: Math.min(tileWidth, native.pixelWidth - x), height: 1 });
93
+ {
94
+ const supplied = await read(request, abort.signal);
95
+ active();
96
+ const tile = requireAllowlistedRecord(supplied, ["captureId", "frameId", "x", "y", "width", "height", "sites"], "Invalid native RAW tile.");
97
+ for (const key of Object.keys(request))
98
+ if (tile[key] !== request[key])
99
+ throw new InvalidConfigurationError("Native RAW tile identity mismatch.");
100
+ if (!Array.isArray(tile.sites) || tile.sites.length !== request.width || Array.from({ length: request.width }, (_, i) => i in tile.sites).includes(false))
101
+ throw new InvalidConfigurationError("Native RAW tile needs exact dense coverage.");
102
+ const timing = plan.exposureWindow ? windows(plan.exposure, plan.exposureWindow, Array.from({ length: request.width }, (_, i) => ({ x: x + i + .5, y: y + .5 }))) : undefined;
103
+ const sites = tile.sites.map((site, j) => parseNativeRawProducerSite(site, y * native.pixelWidth + x + j, plan.frame, timing?.samples[j]));
104
+ first ??= sites[0];
105
+ for (const s of sites)
106
+ validateNativeRawReadoutIdentity(s, first);
107
+ // Every site in this tile is validated before writing owned output. Failures never publish partial output.
108
+ for (let j = 0; j < sites.length; j++) {
109
+ const index = y * native.pixelWidth + x + j, r = calculateNativeRawSite(sites[j], plan.exposure.noise.seedUint32, index).readout.value;
110
+ output.codes[index] = r.rawCode;
111
+ output.blackLevels[index] = r.blackLevelCode;
112
+ output.digitalSaturationCodes[index] = r.digitalSaturationCode;
113
+ output.saturationFlags[index] = Number(r.physicalScalarSaturationApplied) | Number(r.preAdcSaturationApplied) << 1 | Number(r.digitalSaturationApplied) << 2;
114
+ }
115
+ count++;
116
+ }
117
+ await yieldControl(abort.signal);
118
+ active();
119
+ }
120
+ first = undefined;
121
+ state = "completed";
122
+ }
123
+ catch (error) {
124
+ release();
125
+ if (!abort.signal.aborted) {
126
+ state = "failed";
127
+ abort.abort();
128
+ }
129
+ throw error;
130
+ }
131
+ },
132
+ cancel() { if (state === "ready" || state === "running" || state === "completed") {
133
+ state = "cancelled";
134
+ abort.abort();
135
+ release();
136
+ } },
137
+ dispose() { if (state !== "transferred") {
138
+ state = "disposed";
139
+ abort.abort();
140
+ release();
141
+ } },
142
+ takeOutput() { if (state !== "completed" || !output)
143
+ throw new InvalidConfigurationError("Native RAW output unavailable."); const result = output; output = null; first = undefined; state = "transferred"; return result; }
144
+ };
145
+ }
146
+ //# sourceMappingURL=native-raw.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-raw.js","sourceRoot":"","sources":["../../src/capture/native-raw.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC,6FAA6F;AAC7F,OAAO,EAAE,gCAAgC,EAAiF,MAAM,wBAAwB,CAAC;AACzJ,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC/F,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,+BAA+B,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,qDAAqD,EAAE,2CAA2C,EAAE,MAAM,6CAA6C,CAAC;AACjK,OAAO,EAAE,+BAA+B,EAAE,MAAM,8BAA8B,CAAC;AAC/E,OAAO,EAAE,+BAA+B,EAAE,sBAAsB,EAAE,0BAA0B,EAC1F,gCAAgC,EACW,MAAM,0BAA0B,CAAC;AAE9E,MAAM,CAAC,MAAM,yBAAyB,GAAG,OAAgB,CAAC;AAC1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,aAAa,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM;IAClG,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,EAAE,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AK,GAAC,aAAa,CAAC,CAAA,OAAO,MAAM,CAAC,CAAA,CAAC;KACzN,CAAC;AACJ,CAAC"}
@@ -41,6 +41,8 @@ export interface RawFrameReconstruction {
41
41
  sharpeningApplied: false;
42
42
  denoisingApplied: false;
43
43
  }
44
+ /** Internal phase dispatch parser shared with packed native reconstruction. */
45
+ export declare function parseRawReconstructionPhaseProfiles(value: unknown, modeId: string, colorSamplingProfile: SensorRawFrame["colorSamplingProfile"]): RawFrameReconstructionPhaseProfile[];
44
46
  /** Revalidates committed RAW codes/geometry and complete phase dispatch; no external plane may supply output values. */
45
47
  export declare function parseRawFrameReconstructionInput(value: unknown): RawFrameReconstructionInput;
46
48
  /** Delegates each pixel to #14's explicit linear reconstruction using only the attached native RAW samples. */
@@ -1 +1 @@
1
- {"version":3,"file":"raw-frame-reconstruction.d.ts","sourceRoot":"","sources":["../../src/capture/raw-frame-reconstruction.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAuB,KAAK,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAE5F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EACL,KAAK,8BAA8B,EAAE,KAAK,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AACjH,OAAO,EAAwB,KAAK,cAAc,EAA4B,MAAM,uBAAuB,CAAC;AAE5G,eAAO,MAAM,uCAAuC,EAAG,OAAgB,CAAC;AACxE,yGAAyG;AACzG,MAAM,WAAW,kCAAkC;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,8BAA8B,CAAC;CACzC;AACD,0FAA0F;AAC1F,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,cAAc,CAAC;IACzB,MAAM,EAAE,UAAU,CAAC;IACnB,aAAa,EAAE,SAAS,kCAAkC,EAAE,CAAC;CAC9D;AACD,8FAA8F;AAC9F,MAAM,WAAW,sBAAsB;IACrC,aAAa,EAA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,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAChF,oBAAoB,EAAE,cAAc,CAAC,sBAAsB,CAAC,GAAG,kCAAkC,EAAE,CAsBpG;AACD,wHAAwH;AACxH,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,OAAO,GAAG,2BAA2B,CAS5F;AACD,+GAA+G;AAC/G,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,2BAA2B,GAAG,iBAAiB,CAAC,sBAAsB,CAAC,CAwC3H"}
@@ -67,29 +67,23 @@ function profile(value) {
67
67
  }
68
68
  return parseSensorRawReconstructionProfile(r);
69
69
  }
70
- /** Revalidates committed RAW codes/geometry and complete phase dispatch; no external plane may supply output values. */
71
- export function parseRawFrameReconstructionInput(value) {
72
- const r = object(value, ["rawFrame", "region", "phaseProfiles"]), rawFrame = frame(r.rawFrame);
73
- const rect = object(r.region, ["x", "y", "width", "height"]);
74
- const region = { x: integer(rect.x), y: integer(rect.y), width: integer(rect.width, true), height: integer(rect.height, true) };
75
- if (region.x + region.width > rawFrame.nativePixelWidth || region.y + region.height > rawFrame.nativePixelHeight) {
76
- throw new InvalidConfigurationError("Reconstruction region must lie within the full native RAW frame.");
77
- }
78
- const layout = rawFrame.colorSamplingProfile.layout;
70
+ /** Internal phase dispatch parser shared with packed native reconstruction. */
71
+ export function parseRawReconstructionPhaseProfiles(value, modeId, colorSamplingProfile) {
72
+ const layout = colorSamplingProfile.layout;
79
73
  if (layout.kind !== "periodic-mosaic")
80
74
  throw new InvalidConfigurationError("Reconstruction requires periodic native CFA.");
81
75
  const phaseCount = layout.repeatWidthSites * layout.repeatHeightSites;
82
- if (phaseCount > 64 || !Array.isArray(r.phaseProfiles) || r.phaseProfiles.length !== phaseCount) {
76
+ if (phaseCount > 64 || !Array.isArray(value) || value.length !== phaseCount) {
83
77
  throw new InvalidConfigurationError("Every CFA phase requires one profile, with a maximum of 64 phases.");
84
78
  }
85
79
  const phaseProfiles = [];
86
80
  const phases = new Set();
87
81
  let channels;
88
- for (const value of r.phaseProfiles) {
89
- const p = object(value, ["phaseX", "phaseY", "profile"]), phaseX = integer(p.phaseX), phaseY = integer(p.phaseY), parsed = profile(p.profile);
82
+ for (const entry of value) {
83
+ const p = object(entry, ["phaseX", "phaseY", "profile"]), phaseX = integer(p.phaseX), phaseY = integer(p.phaseY), parsed = profile(p.profile);
90
84
  const key = phaseX + ":" + phaseY, ids = parsed.kernels.map((k) => k.outputChannelId);
91
85
  if (phaseX >= layout.repeatWidthSites || phaseY >= layout.repeatHeightSites || phases.has(key) ||
92
- parsed.captureModeId !== rawFrame.modeId || parsed.colorSamplingProfileId !== rawFrame.colorSamplingProfile.profileId ||
86
+ parsed.captureModeId !== modeId || parsed.colorSamplingProfileId !== colorSamplingProfile.profileId ||
93
87
  (channels && JSON.stringify(ids) !== JSON.stringify(channels))) {
94
88
  throw new InvalidConfigurationError("CFA phase/profile identity or output-channel order is inconsistent.");
95
89
  }
@@ -98,6 +92,17 @@ export function parseRawFrameReconstructionInput(value) {
98
92
  phaseProfiles.push({ phaseX, phaseY, profile: parsed });
99
93
  }
100
94
  phaseProfiles.sort((a, b) => a.phaseY - b.phaseY || a.phaseX - b.phaseX);
95
+ return phaseProfiles;
96
+ }
97
+ /** Revalidates committed RAW codes/geometry and complete phase dispatch; no external plane may supply output values. */
98
+ export function parseRawFrameReconstructionInput(value) {
99
+ const r = object(value, ["rawFrame", "region", "phaseProfiles"]), rawFrame = frame(r.rawFrame);
100
+ const rect = object(r.region, ["x", "y", "width", "height"]);
101
+ const region = { x: integer(rect.x), y: integer(rect.y), width: integer(rect.width, true), height: integer(rect.height, true) };
102
+ if (region.x + region.width > rawFrame.nativePixelWidth || region.y + region.height > rawFrame.nativePixelHeight) {
103
+ throw new InvalidConfigurationError("Reconstruction region must lie within the full native RAW frame.");
104
+ }
105
+ const phaseProfiles = parseRawReconstructionPhaseProfiles(r.phaseProfiles, rawFrame.modeId, rawFrame.colorSamplingProfile);
101
106
  return { rawFrame, region, phaseProfiles };
102
107
  }
103
108
  /** Delegates each pixel to #14's explicit linear reconstruction using only the attached native RAW samples. */
@@ -1 +1 @@
1
- {"version":3,"file":"raw-frame-reconstruction.js","sourceRoot":"","sources":["../../src/capture/raw-frame-reconstruction.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC;;;;;;;;GAQG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAEvE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAA0B,MAAM,+BAA+B,CAAC;AAC5F,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,OAAO,EAAE,mCAAmC,EAAE,8BAA8B,EACH,MAAM,iCAAiC,CAAC;AACjH,OAAO,EAAE,oBAAoB,EAAiD,MAAM,uBAAuB,CAAC;AAE5G,MAAM,CAAC,MAAM,uCAAuC,GAAG,OAAgB,CAAC;AAuCxE,SAAS,MAAM,CAAC,KAAc,EAAE,IAAuB;IACrD,OAAO,wBAAwB,CAAC,KAAK,EAAE,IAAI,EAAE,uDAAuD,CAAC,CAAC;AACxG,CAAC;AACD,SAAS,OAAO,CAAC,KAAc,EAAE,QAAQ,GAAG,KAAK;IAC/C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5F,MAAM,IAAI,yBAAyB,CAAC,uEAAuE,CAAC,CAAC;IAC/G,CAAC;IACD,OAAO,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC1C,CAAC;AACD,SAAS,KAAK,CAAC,KAA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,CAAC;AACR,CAAC"}
@@ -44,6 +44,14 @@ export interface SensorRawProducerResult {
44
44
  readout: ReturnType<typeof simulateSensorRawCode>;
45
45
  }[];
46
46
  }
47
+ /** Internal scalar validation shared by reference and bounded packed execution. */
48
+ export type NativeRawProducerFrameContext = Omit<SensorRawProducerInput["frame"], "capture"> & {
49
+ capture: Pick<SensorRawProducerInput["frame"]["capture"], "geometry" | "exposure" | "noise" | "focus" | "sceneStateId" | "sceneTimeSeconds">;
50
+ };
51
+ export declare function parseNativeRawProducerSite(site: unknown, i: number, frame: NativeRawProducerFrameContext, window?: CaptureExposureWindows["samples"][number]): SensorRawProducerSiteInput;
52
+ export declare function validateNativeRawReadoutIdentity(s: SensorRawProducerSiteInput, first: SensorRawProducerSiteInput): void;
53
+ /** The shared scalar pipeline owns all charge, capacity, stochastic and ADC equations. */
54
+ export declare function calculateNativeRawSite(s: SensorRawProducerSiteInput, seed: number, i: number): SensorRawProducerResult["sites"][number];
47
55
  /** Validates complete native exposure inputs; no charge/noise/RAW code is accepted as a shortcut. */
48
56
  export declare function parseSensorRawProducerInput(value: unknown): SensorRawProducerInput;
49
57
  /** Composes existing accumulated-charge → capacity → Poisson → read noise/ADC → native sample → immutable frame contracts. */
@@ -1 +1 @@
1
- {"version":3,"file":"sensor-raw-producer.d.ts","sourceRoot":"","sources":["../../src/capture/sensor-raw-producer.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAuB,KAAK,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAI5F,OAAO,EAAwB,KAAK,mBAAmB,EAAE,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5G,OAAO,EAAE,8BAA8B,EACrC,KAAK,wCAAwC,IAAI,mCAAmC,EAAE,MAAM,iCAAiC,CAAC;AAChI,OAAO,EAAE,kCAAkC,EACzC,KAAK,mCAAmC,EAAE,MAAM,uCAAuC,CAAC;AAC1F,OAAO,EAAE,+BAA+B,EAAE,qBAAqB,EACI,KAAK,2BAA2B,EAA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