@photivra/engine 1.4.0 → 2.0.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.
- package/CHANGELOG.md +401 -6
- package/CITATION.cff +1 -1
- package/NODE_SUPPORT.md +64 -12
- package/README.md +301 -182
- package/SECURITY.md +37 -28
- package/THIRD_PARTY.md +148 -4
- package/dist/camera/equivalent-focal-length.d.ts +13 -14
- package/dist/camera/equivalent-focal-length.js +15 -13
- package/dist/camera/equivalent-focal-length.js.map +1 -1
- package/dist/camera/field-of-view.d.ts +30 -19
- package/dist/camera/field-of-view.js +67 -18
- package/dist/camera/field-of-view.js.map +1 -1
- package/dist/camera/lens-projection.d.ts +170 -0
- package/dist/camera/lens-projection.js +444 -0
- package/dist/camera/lens-projection.js.map +1 -0
- package/dist/camera/projected-object-size.d.ts +10 -11
- package/dist/camera/projected-object-size.js +12 -10
- package/dist/camera/projected-object-size.js.map +1 -1
- package/dist/capture/capture-export-metadata.d.ts +9 -10
- package/dist/capture/capture-export-metadata.js +8 -5
- package/dist/capture/capture-export-metadata.js.map +1 -1
- package/dist/capture/dng-import.d.ts +91 -0
- package/dist/capture/dng-import.js +343 -0
- package/dist/capture/dng-import.js.map +1 -0
- package/dist/capture/environment-raw-producer.d.ts +37 -17
- package/dist/capture/environment-raw-producer.js +43 -19
- package/dist/capture/environment-raw-producer.js.map +1 -1
- package/dist/capture/export-jpeg.d.ts +35 -4
- package/dist/capture/export-jpeg.js +133 -47
- package/dist/capture/export-jpeg.js.map +1 -1
- package/dist/capture/export-tiff.d.ts +48 -24
- package/dist/capture/export-tiff.js +91 -31
- package/dist/capture/export-tiff.js.map +1 -1
- package/dist/capture/focus-control.d.ts +42 -65
- package/dist/capture/focus-control.js +56 -75
- package/dist/capture/focus-control.js.map +1 -1
- package/dist/capture/host-yield-cadence.d.ts +25 -0
- package/dist/capture/host-yield-cadence.js +25 -0
- package/dist/capture/host-yield-cadence.js.map +1 -0
- package/dist/capture/linear-encoding.d.ts +14 -12
- package/dist/capture/linear-encoding.js +14 -13
- package/dist/capture/linear-encoding.js.map +1 -1
- package/dist/capture/lossless-jpeg.d.ts +27 -0
- package/dist/capture/lossless-jpeg.js +237 -0
- package/dist/capture/lossless-jpeg.js.map +1 -0
- package/dist/capture/native-environment-lean.d.ts +227 -0
- package/dist/capture/native-environment-lean.js +974 -0
- package/dist/capture/native-environment-lean.js.map +1 -0
- package/dist/capture/native-environment-optical-stage.d.ts +97 -0
- package/dist/capture/native-environment-optical-stage.js +340 -0
- package/dist/capture/native-environment-optical-stage.js.map +1 -0
- package/dist/capture/native-environment-raw.d.ts +140 -6
- package/dist/capture/native-environment-raw.js +435 -34
- package/dist/capture/native-environment-raw.js.map +1 -1
- package/dist/capture/native-raw-development.d.ts +118 -5
- package/dist/capture/native-raw-development.js +224 -59
- package/dist/capture/native-raw-development.js.map +1 -1
- package/dist/capture/native-raw-dng.d.ts +60 -0
- package/dist/capture/native-raw-dng.js +167 -0
- package/dist/capture/native-raw-dng.js.map +1 -0
- package/dist/capture/native-raw.d.ts +67 -10
- package/dist/capture/native-raw.js +90 -24
- package/dist/capture/native-raw.js.map +1 -1
- package/dist/capture/packed-sensor-raw.d.ts +160 -0
- package/dist/capture/packed-sensor-raw.js +221 -0
- package/dist/capture/packed-sensor-raw.js.map +1 -0
- package/dist/capture/photographic-export.d.ts +58 -35
- package/dist/capture/photographic-export.js +177 -70
- package/dist/capture/photographic-export.js.map +1 -1
- package/dist/capture/raw-development-kernel.d.ts +52 -0
- package/dist/capture/raw-development-kernel.js +88 -0
- package/dist/capture/raw-development-kernel.js.map +1 -0
- package/dist/capture/raw-frame-limits.d.ts +7 -7
- package/dist/capture/raw-frame-limits.js +7 -6
- package/dist/capture/raw-frame-limits.js.map +1 -1
- package/dist/capture/raw-frame-reconstruction.d.ts +8 -9
- package/dist/capture/raw-frame-reconstruction.js +9 -8
- package/dist/capture/raw-frame-reconstruction.js.map +1 -1
- package/dist/capture/raw-white-level.d.ts +55 -0
- package/dist/capture/raw-white-level.js +165 -0
- package/dist/capture/raw-white-level.js.map +1 -0
- package/dist/capture/release-sequence.d.ts +5 -7
- package/dist/capture/release-sequence.js +15 -13
- package/dist/capture/release-sequence.js.map +1 -1
- package/dist/capture/sensor-raw-frame.d.ts +5 -6
- package/dist/capture/sensor-raw-frame.js +26 -9
- package/dist/capture/sensor-raw-frame.js.map +1 -1
- package/dist/capture/sensor-raw-producer.d.ts +21 -13
- package/dist/capture/sensor-raw-producer.js +86 -25
- package/dist/capture/sensor-raw-producer.js.map +1 -1
- package/dist/capture/simulated-capture.d.ts +15 -16
- package/dist/capture/simulated-capture.js +22 -12
- package/dist/capture/simulated-capture.js.map +1 -1
- package/dist/color/camera-color-matrix.d.ts +69 -0
- package/dist/color/camera-color-matrix.js +132 -0
- package/dist/color/camera-color-matrix.js.map +1 -0
- package/dist/color/capture-color.d.ts +17 -10
- package/dist/color/capture-color.js +50 -17
- package/dist/color/capture-color.js.map +1 -1
- package/dist/color/chromatic-adaptation.d.ts +63 -0
- package/dist/color/chromatic-adaptation.js +91 -0
- package/dist/color/chromatic-adaptation.js.map +1 -0
- package/dist/color/color-difference.d.ts +104 -0
- package/dist/color/color-difference.js +205 -0
- package/dist/color/color-difference.js.map +1 -0
- package/dist/color/color-matching-functions.d.ts +168 -0
- package/dist/color/color-matching-functions.js +309 -0
- package/dist/color/color-matching-functions.js.map +1 -0
- package/dist/color/colorimetry-math.d.ts +52 -0
- package/dist/color/colorimetry-math.js +144 -0
- package/dist/color/colorimetry-math.js.map +1 -0
- package/dist/color/gamut-mapping.d.ts +54 -0
- package/dist/color/gamut-mapping.js +107 -0
- package/dist/color/gamut-mapping.js.map +1 -0
- package/dist/color/illuminants.d.ts +182 -0
- package/dist/color/illuminants.js +434 -0
- package/dist/color/illuminants.js.map +1 -0
- package/dist/color/rgb-color-spaces.d.ts +79 -0
- package/dist/color/rgb-color-spaces.js +115 -0
- package/dist/color/rgb-color-spaces.js.map +1 -0
- package/dist/color/sensor-color-development.d.ts +33 -11
- package/dist/color/sensor-color-development.js +104 -30
- package/dist/color/sensor-color-development.js.map +1 -1
- package/dist/color/srgb-icc.d.ts +9 -2
- package/dist/color/srgb-icc.js +16 -5
- package/dist/color/srgb-icc.js.map +1 -1
- package/dist/color/srgb-transfer.d.ts +1 -2
- package/dist/color/srgb-transfer.js +1 -1
- package/dist/color/srgb-transfer.js.map +1 -1
- package/dist/color/white-balance.d.ts +68 -19
- package/dist/color/white-balance.js +168 -35
- package/dist/color/white-balance.js.map +1 -1
- package/dist/composition/image-formation-plan.d.ts +152 -128
- package/dist/composition/image-formation-plan.js +292 -138
- package/dist/composition/image-formation-plan.js.map +1 -1
- package/dist/composition/plan-consumer.d.ts +6 -7
- package/dist/composition/plan-consumer.js +14 -11
- package/dist/composition/plan-consumer.js.map +1 -1
- package/dist/core/calculation-result.d.ts +21 -14
- package/dist/core/calculation-result.js +209 -11
- package/dist/core/calculation-result.js.map +1 -1
- package/dist/core/canonical-json.d.ts +13 -8
- package/dist/core/canonical-json.js +34 -15
- package/dist/core/canonical-json.js.map +1 -1
- package/dist/core/configuration-error.d.ts +5 -4
- package/dist/core/configuration-error.js +5 -3
- package/dist/core/configuration-error.js.map +1 -1
- package/dist/core/evidence-provenance.d.ts +12 -12
- package/dist/core/evidence-provenance.js +10 -9
- package/dist/core/evidence-provenance.js.map +1 -1
- package/dist/core/image-formation.d.ts +11 -10
- package/dist/core/image-formation.js +11 -9
- package/dist/core/image-formation.js.map +1 -1
- package/dist/core/owned-data.d.ts +9 -17
- package/dist/core/owned-data.js +9 -16
- package/dist/core/owned-data.js.map +1 -1
- package/dist/core/portable-math.d.ts +15 -0
- package/dist/core/portable-math.js +56 -0
- package/dist/core/portable-math.js.map +1 -0
- package/dist/core/record-validation.d.ts +48 -9
- package/dist/core/record-validation.js +93 -19
- package/dist/core/record-validation.js.map +1 -1
- package/dist/core/scientific-assurance.d.ts +16 -14
- package/dist/core/scientific-assurance.js +22 -18
- package/dist/core/scientific-assurance.js.map +1 -1
- package/dist/core/spectral-composition.d.ts +13 -14
- package/dist/core/spectral-composition.js +30 -27
- package/dist/core/spectral-composition.js.map +1 -1
- package/dist/core/spectral.d.ts +5 -6
- package/dist/core/spectral.js +9 -7
- package/dist/core/spectral.js.map +1 -1
- package/dist/core/validation.d.ts +3 -6
- package/dist/core/validation.js +3 -5
- package/dist/core/validation.js.map +1 -1
- package/dist/core/version.d.ts +6 -6
- package/dist/core/version.js +6 -5
- package/dist/core/version.js.map +1 -1
- package/dist/equipment/exposure-capabilities.d.ts +10 -10
- package/dist/equipment/exposure-capabilities.js +40 -30
- package/dist/equipment/exposure-capabilities.js.map +1 -1
- package/dist/equipment/generic-tier-assets.d.ts +13 -6
- package/dist/equipment/generic-tier-assets.js +34 -15
- package/dist/equipment/generic-tier-assets.js.map +1 -1
- package/dist/equipment/generic-tier-presets.d.ts +5 -6
- package/dist/equipment/generic-tier-presets.js +15 -13
- package/dist/equipment/generic-tier-presets.js.map +1 -1
- package/dist/equipment/iso-capabilities.d.ts +21 -22
- package/dist/equipment/iso-capabilities.js +49 -44
- package/dist/equipment/iso-capabilities.js.map +1 -1
- package/dist/equipment/metering-capabilities.d.ts +5 -6
- package/dist/equipment/metering-capabilities.js +22 -19
- package/dist/equipment/metering-capabilities.js.map +1 -1
- package/dist/equipment/release-capabilities.d.ts +3 -4
- package/dist/equipment/release-capabilities.js +18 -14
- package/dist/equipment/release-capabilities.js.map +1 -1
- package/dist/exposure/exposure-duration-control.d.ts +19 -17
- package/dist/exposure/exposure-duration-control.js +27 -23
- package/dist/exposure/exposure-duration-control.js.map +1 -1
- package/dist/exposure/exposure-mode-resolver.d.ts +42 -39
- package/dist/exposure/exposure-mode-resolver.js +127 -82
- package/dist/exposure/exposure-mode-resolver.js.map +1 -1
- package/dist/exposure/exposure.d.ts +17 -16
- package/dist/exposure/exposure.js +22 -15
- package/dist/exposure/exposure.js.map +1 -1
- package/dist/exposure/flash-ttl.d.ts +135 -0
- package/dist/exposure/flash-ttl.js +193 -0
- package/dist/exposure/flash-ttl.js.map +1 -0
- package/dist/exposure/flash.d.ts +144 -36
- package/dist/exposure/flash.js +259 -59
- package/dist/exposure/flash.js.map +1 -1
- package/dist/exposure/metering-scene-radiance.d.ts +10 -10
- package/dist/exposure/metering-scene-radiance.js +42 -23
- package/dist/exposure/metering-scene-radiance.js.map +1 -1
- package/dist/exposure/metering-target.d.ts +8 -8
- package/dist/exposure/metering-target.js +30 -20
- package/dist/exposure/metering-target.js.map +1 -1
- package/dist/exposure/metering-temporal.d.ts +16 -15
- package/dist/exposure/metering-temporal.js +41 -19
- package/dist/exposure/metering-temporal.js.map +1 -1
- package/dist/exposure/metering.d.ts +64 -17
- package/dist/exposure/metering.js +159 -30
- package/dist/exposure/metering.js.map +1 -1
- package/dist/exposure/program-line.d.ts +5 -5
- package/dist/exposure/program-line.js +20 -13
- package/dist/exposure/program-line.js.map +1 -1
- package/dist/facade/camera-preset.d.ts +8 -0
- package/dist/facade/camera-preset.js +102 -0
- package/dist/facade/camera-preset.js.map +1 -0
- package/dist/facade/chart-radiance-batch.d.ts +57 -0
- package/dist/facade/chart-radiance-batch.js +121 -0
- package/dist/facade/chart-radiance-batch.js.map +1 -0
- package/dist/facade/chart-scenes.d.ts +177 -0
- package/dist/facade/chart-scenes.js +232 -0
- package/dist/facade/chart-scenes.js.map +1 -0
- package/dist/facade/host-yield.d.ts +7 -0
- package/dist/facade/host-yield.js +23 -0
- package/dist/facade/host-yield.js.map +1 -0
- package/dist/facade/scene-radiance.d.ts +117 -0
- package/dist/facade/scene-radiance.js +205 -0
- package/dist/facade/scene-radiance.js.map +1 -0
- package/dist/facade/simulate-capture.d.ts +284 -0
- package/dist/facade/simulate-capture.js +1026 -0
- package/dist/facade/simulate-capture.js.map +1 -0
- package/dist/gpu/chart-radiance-gpu.d.ts +17 -0
- package/dist/gpu/chart-radiance-gpu.js +176 -0
- package/dist/gpu/chart-radiance-gpu.js.map +1 -0
- package/dist/gpu/image-kernel-accelerator.d.ts +132 -0
- package/dist/gpu/image-kernel-accelerator.js +720 -0
- package/dist/gpu/image-kernel-accelerator.js.map +1 -0
- package/dist/gpu/image-kernel-execution.d.ts +92 -0
- package/dist/gpu/image-kernel-execution.js +84 -0
- package/dist/gpu/image-kernel-execution.js.map +1 -0
- package/dist/gpu/sensor-stage-gpu.d.ts +44 -0
- package/dist/gpu/sensor-stage-gpu.js +317 -0
- package/dist/gpu/sensor-stage-gpu.js.map +1 -0
- package/dist/gpu/temporal-sum-gpu.d.ts +23 -0
- package/dist/gpu/temporal-sum-gpu.js +150 -0
- package/dist/gpu/temporal-sum-gpu.js.map +1 -0
- package/dist/gpu/webgpu-runtime.d.ts +63 -0
- package/dist/gpu/webgpu-runtime.js +215 -0
- package/dist/gpu/webgpu-runtime.js.map +1 -0
- package/dist/gpu/wgsl-chart-kernel.d.ts +30 -0
- package/dist/gpu/wgsl-chart-kernel.js +165 -0
- package/dist/gpu/wgsl-chart-kernel.js.map +1 -0
- package/dist/gpu/wgsl-kernels.d.ts +53 -0
- package/dist/gpu/wgsl-kernels.js +365 -0
- package/dist/gpu/wgsl-kernels.js.map +1 -0
- package/dist/gpu/wgsl-sensor-kernel.d.ts +64 -0
- package/dist/gpu/wgsl-sensor-kernel.js +409 -0
- package/dist/gpu/wgsl-sensor-kernel.js.map +1 -0
- package/dist/index.d.ts +89 -25
- package/dist/index.js +59 -15
- package/dist/index.js.map +1 -1
- package/dist/motion/camera-rotation.d.ts +92 -40
- package/dist/motion/camera-rotation.js +84 -47
- package/dist/motion/camera-rotation.js.map +1 -1
- package/dist/motion/capture-rotation-inverse-mapping.d.ts +37 -34
- package/dist/motion/capture-rotation-inverse-mapping.js +32 -24
- package/dist/motion/capture-rotation-inverse-mapping.js.map +1 -1
- package/dist/motion/capture-rotation-temporal-quadrature.d.ts +39 -35
- package/dist/motion/capture-rotation-temporal-quadrature.js +37 -28
- package/dist/motion/capture-rotation-temporal-quadrature.js.map +1 -1
- package/dist/motion/capture-rotation-trajectory.d.ts +32 -28
- package/dist/motion/capture-rotation-trajectory.js +36 -26
- package/dist/motion/capture-rotation-trajectory.js.map +1 -1
- package/dist/motion/capture-translation-parallax-temporal-quadrature.d.ts +23 -21
- package/dist/motion/capture-translation-parallax-temporal-quadrature.js +33 -14
- package/dist/motion/capture-translation-parallax-temporal-quadrature.js.map +1 -1
- package/dist/motion/extended-object-projection.d.ts +19 -16
- package/dist/motion/extended-object-projection.js +38 -18
- package/dist/motion/extended-object-projection.js.map +1 -1
- package/dist/motion/projected-motion.d.ts +18 -17
- package/dist/motion/projected-motion.js +25 -17
- package/dist/motion/projected-motion.js.map +1 -1
- package/dist/motion/temporal-exposure-sum.d.ts +55 -0
- package/dist/motion/temporal-exposure-sum.js +141 -0
- package/dist/motion/temporal-exposure-sum.js.map +1 -0
- package/dist/motion/video-sequence.d.ts +111 -0
- package/dist/motion/video-sequence.js +179 -0
- package/dist/motion/video-sequence.js.map +1 -0
- package/dist/optics/aperture.d.ts +14 -15
- package/dist/optics/aperture.js +13 -11
- package/dist/optics/aperture.js.map +1 -1
- package/dist/optics/atmospheric-haze.d.ts +83 -0
- package/dist/optics/atmospheric-haze.js +113 -0
- package/dist/optics/atmospheric-haze.js.map +1 -0
- package/dist/optics/brown-conrady-distortion.d.ts +116 -0
- package/dist/optics/brown-conrady-distortion.js +291 -0
- package/dist/optics/brown-conrady-distortion.js.map +1 -0
- package/dist/optics/circle-of-confusion.d.ts +10 -10
- package/dist/optics/circle-of-confusion.js +15 -11
- package/dist/optics/circle-of-confusion.js.map +1 -1
- package/dist/optics/complex-pupil-psf.d.ts +64 -33
- package/dist/optics/complex-pupil-psf.js +190 -98
- package/dist/optics/complex-pupil-psf.js.map +1 -1
- package/dist/optics/depth-of-field.d.ts +25 -15
- package/dist/optics/depth-of-field.js +67 -27
- package/dist/optics/depth-of-field.js.map +1 -1
- package/dist/optics/diffraction.d.ts +14 -13
- package/dist/optics/diffraction.js +14 -10
- package/dist/optics/diffraction.js.map +1 -1
- package/dist/optics/focus-breathing.d.ts +88 -27
- package/dist/optics/focus-breathing.js +114 -23
- package/dist/optics/focus-breathing.js.map +1 -1
- package/dist/optics/focus-state.d.ts +18 -18
- package/dist/optics/focus-state.js +21 -15
- package/dist/optics/focus-state.js.map +1 -1
- package/dist/optics/front-of-lens-filter.d.ts +45 -14
- package/dist/optics/front-of-lens-filter.js +259 -88
- package/dist/optics/front-of-lens-filter.js.map +1 -1
- package/dist/optics/illumination-vignetting.d.ts +16 -17
- package/dist/optics/illumination-vignetting.js +40 -17
- package/dist/optics/illumination-vignetting.js.map +1 -1
- package/dist/optics/irradiance-convolution.d.ts +59 -0
- package/dist/optics/irradiance-convolution.js +138 -0
- package/dist/optics/irradiance-convolution.js.map +1 -0
- package/dist/optics/lateral-chromatic-aberration.d.ts +33 -30
- package/dist/optics/lateral-chromatic-aberration.js +33 -23
- package/dist/optics/lateral-chromatic-aberration.js.map +1 -1
- package/dist/optics/lens-psf-kernels.d.ts +89 -0
- package/dist/optics/lens-psf-kernels.js +175 -0
- package/dist/optics/lens-psf-kernels.js.map +1 -0
- package/dist/optics/lens-psf-profile.d.ts +78 -46
- package/dist/optics/lens-psf-profile.js +335 -124
- package/dist/optics/lens-psf-profile.js.map +1 -1
- package/dist/optics/longitudinal-chromatic-aberration.d.ts +102 -0
- package/dist/optics/longitudinal-chromatic-aberration.js +210 -0
- package/dist/optics/longitudinal-chromatic-aberration.js.map +1 -0
- package/dist/optics/polygon-diffraction.d.ts +80 -23
- package/dist/optics/polygon-diffraction.js +130 -25
- package/dist/optics/polygon-diffraction.js.map +1 -1
- package/dist/optics/profile-contract.d.ts +5 -6
- package/dist/optics/profile-contract.js +14 -11
- package/dist/optics/profile-contract.js.map +1 -1
- package/dist/optics/psf-foundation.d.ts +23 -23
- package/dist/optics/psf-foundation.js +24 -21
- package/dist/optics/psf-foundation.js.map +1 -1
- package/dist/optics/pupil-vignetting.d.ts +118 -0
- package/dist/optics/pupil-vignetting.js +264 -0
- package/dist/optics/pupil-vignetting.js.map +1 -0
- package/dist/optics/radial-distortion.d.ts +34 -33
- package/dist/optics/radial-distortion.js +37 -30
- package/dist/optics/radial-distortion.js.map +1 -1
- package/dist/optics/scene-to-sensor-irradiance.d.ts +47 -33
- package/dist/optics/scene-to-sensor-irradiance.js +73 -45
- package/dist/optics/scene-to-sensor-irradiance.js.map +1 -1
- package/dist/optics/scene-to-sensor-quadrature.d.ts +23 -18
- package/dist/optics/scene-to-sensor-quadrature.js +16 -11
- package/dist/optics/scene-to-sensor-quadrature.js.map +1 -1
- package/dist/optics/sensor-aperture-rays.d.ts +20 -4
- package/dist/optics/sensor-aperture-rays.js +32 -14
- package/dist/optics/sensor-aperture-rays.js.map +1 -1
- package/dist/optics/sensor-environment-query.d.ts +81 -16
- package/dist/optics/sensor-environment-query.js +145 -12
- package/dist/optics/sensor-environment-query.js.map +1 -1
- package/dist/optics/sensor-psf-quadrature.d.ts +12 -10
- package/dist/optics/sensor-psf-quadrature.js +18 -11
- package/dist/optics/sensor-psf-quadrature.js.map +1 -1
- package/dist/optics/sensor-psf-support.d.ts +8 -6
- package/dist/optics/sensor-psf-support.js +8 -5
- package/dist/optics/sensor-psf-support.js.map +1 -1
- package/dist/optics/stray-light.d.ts +22 -19
- package/dist/optics/stray-light.js +18 -12
- package/dist/optics/stray-light.js.map +1 -1
- package/dist/optics/thin-lens.d.ts +10 -9
- package/dist/optics/thin-lens.js +12 -8
- package/dist/optics/thin-lens.js.map +1 -1
- package/dist/optics/zernike-wavefront.d.ts +154 -0
- package/dist/optics/zernike-wavefront.js +352 -0
- package/dist/optics/zernike-wavefront.js.map +1 -0
- package/dist/output/capture-corrected-sdr.d.ts +16 -8
- package/dist/output/capture-corrected-sdr.js +16 -8
- package/dist/output/capture-corrected-sdr.js.map +1 -1
- package/dist/output/capture-geometry.d.ts +34 -36
- package/dist/output/capture-geometry.js +52 -32
- package/dist/output/capture-geometry.js.map +1 -1
- package/dist/output/capture-sdr.d.ts +7 -6
- package/dist/output/capture-sdr.js +11 -8
- package/dist/output/capture-sdr.js.map +1 -1
- package/dist/output/crop.d.ts +22 -6
- package/dist/output/crop.js +40 -6
- package/dist/output/crop.js.map +1 -1
- package/dist/output/geometric-transforms.d.ts +60 -23
- package/dist/output/geometric-transforms.js +111 -24
- package/dist/output/geometric-transforms.js.map +1 -1
- package/dist/output/lens-corrections.d.ts +27 -19
- package/dist/output/lens-corrections.js +29 -13
- package/dist/output/lens-corrections.js.map +1 -1
- package/dist/output/native-capture-sdr.d.ts +71 -16
- package/dist/output/native-capture-sdr.js +190 -33
- package/dist/output/native-capture-sdr.js.map +1 -1
- package/dist/output/png-encoder.d.ts +65 -0
- package/dist/output/png-encoder.js +461 -0
- package/dist/output/png-encoder.js.map +1 -0
- package/dist/output/print-contrast-reference.d.ts +10 -9
- package/dist/output/print-contrast-reference.js +10 -8
- package/dist/output/print-contrast-reference.js.map +1 -1
- package/dist/output/print-detail.d.ts +18 -17
- package/dist/output/print-detail.js +12 -10
- package/dist/output/print-detail.js.map +1 -1
- package/dist/output/print-jpeg.d.ts +26 -5
- package/dist/output/print-jpeg.js +117 -50
- package/dist/output/print-jpeg.js.map +1 -1
- package/dist/output/print-plan.d.ts +19 -19
- package/dist/output/print-plan.js +11 -10
- package/dist/output/print-plan.js.map +1 -1
- package/dist/output/print-region-statistics.d.ts +14 -15
- package/dist/output/print-region-statistics.js +11 -11
- package/dist/output/print-region-statistics.js.map +1 -1
- package/dist/output/sdr-rendering.d.ts +48 -10
- package/dist/output/sdr-rendering.js +114 -25
- package/dist/output/sdr-rendering.js.map +1 -1
- package/dist/output/subject-framing-crop.d.ts +6 -10
- package/dist/output/subject-framing-crop.js +23 -13
- package/dist/output/subject-framing-crop.js.map +1 -1
- package/dist/processing/demosaic.d.ts +90 -0
- package/dist/processing/demosaic.js +275 -0
- package/dist/processing/demosaic.js.map +1 -0
- package/dist/processing/denoise.d.ts +68 -0
- package/dist/processing/denoise.js +214 -0
- package/dist/processing/denoise.js.map +1 -0
- package/dist/processing/focus-stacking.d.ts +17 -0
- package/dist/processing/focus-stacking.js +80 -0
- package/dist/processing/focus-stacking.js.map +1 -0
- package/dist/processing/hdr.d.ts +54 -0
- package/dist/processing/hdr.js +172 -0
- package/dist/processing/hdr.js.map +1 -0
- package/dist/processing/image-ops.d.ts +66 -0
- package/dist/processing/image-ops.js +192 -0
- package/dist/processing/image-ops.js.map +1 -0
- package/dist/processing/panorama.d.ts +51 -0
- package/dist/processing/panorama.js +305 -0
- package/dist/processing/panorama.js.map +1 -0
- package/dist/processing/processing-task.d.ts +85 -0
- package/dist/processing/processing-task.js +164 -0
- package/dist/processing/processing-task.js.map +1 -0
- package/dist/processing/tone-mapping.d.ts +69 -0
- package/dist/processing/tone-mapping.js +310 -0
- package/dist/processing/tone-mapping.js.map +1 -0
- package/dist/schema/camera.d.ts +5 -4
- package/dist/schema/illumination-spectral.d.ts +13 -19
- package/dist/schema/illumination-spectral.js +23 -19
- package/dist/schema/illumination-spectral.js.map +1 -1
- package/dist/schema/illumination-temporal.d.ts +12 -15
- package/dist/schema/illumination-temporal.js +43 -28
- package/dist/schema/illumination-temporal.js.map +1 -1
- package/dist/schema/illumination.d.ts +5 -4
- package/dist/schema/illumination.js +55 -20
- package/dist/schema/illumination.js.map +1 -1
- package/dist/schema/scene-radiance-temporal.d.ts +9 -11
- package/dist/schema/scene-radiance-temporal.js +26 -23
- package/dist/schema/scene-radiance-temporal.js.map +1 -1
- package/dist/schema/scene-radiance.d.ts +17 -17
- package/dist/schema/scene-radiance.js +56 -34
- package/dist/schema/scene-radiance.js.map +1 -1
- package/dist/schema/scene.d.ts +14 -13
- package/dist/schema/validation.d.ts +0 -1
- package/dist/schema/validation.js +17 -15
- package/dist/schema/validation.js.map +1 -1
- package/dist/sensor/accumulated-charge.d.ts +45 -64
- package/dist/sensor/accumulated-charge.js +41 -47
- package/dist/sensor/accumulated-charge.js.map +1 -1
- package/dist/sensor/architecture.d.ts +22 -25
- package/dist/sensor/architecture.js +17 -16
- package/dist/sensor/architecture.js.map +1 -1
- package/dist/sensor/camera-saturation-capacity.d.ts +21 -28
- package/dist/sensor/camera-saturation-capacity.js +36 -34
- package/dist/sensor/camera-saturation-capacity.js.map +1 -1
- package/dist/sensor/capture-color-sampling-binding.d.ts +46 -51
- package/dist/sensor/capture-color-sampling-binding.js +39 -41
- package/dist/sensor/capture-color-sampling-binding.js.map +1 -1
- package/dist/sensor/capture-mode-timing.d.ts +8 -9
- package/dist/sensor/capture-mode-timing.js +24 -21
- package/dist/sensor/capture-mode-timing.js.map +1 -1
- package/dist/sensor/capture-mode.d.ts +28 -30
- package/dist/sensor/capture-mode.js +33 -31
- package/dist/sensor/capture-mode.js.map +1 -1
- package/dist/sensor/color-sampling.d.ts +30 -33
- package/dist/sensor/color-sampling.js +32 -37
- package/dist/sensor/color-sampling.js.map +1 -1
- package/dist/sensor/constant-rate-temporal-integration.d.ts +19 -23
- package/dist/sensor/constant-rate-temporal-integration.js +28 -26
- package/dist/sensor/constant-rate-temporal-integration.js.map +1 -1
- package/dist/sensor/dark-current.d.ts +53 -49
- package/dist/sensor/dark-current.js +87 -46
- package/dist/sensor/dark-current.js.map +1 -1
- package/dist/sensor/environment-photo-signal.d.ts +71 -30
- package/dist/sensor/environment-photo-signal.js +127 -46
- package/dist/sensor/environment-photo-signal.js.map +1 -1
- package/dist/sensor/eqe-electron-rate.d.ts +14 -13
- package/dist/sensor/eqe-electron-rate.js +34 -14
- package/dist/sensor/eqe-electron-rate.js.map +1 -1
- package/dist/sensor/eqe-local-exposure.d.ts +24 -24
- package/dist/sensor/eqe-local-exposure.js +15 -11
- package/dist/sensor/eqe-local-exposure.js.map +1 -1
- package/dist/sensor/eqe-temporal-exposure.d.ts +11 -11
- package/dist/sensor/eqe-temporal-exposure.js +15 -10
- package/dist/sensor/eqe-temporal-exposure.js.map +1 -1
- package/dist/sensor/exposure-window.d.ts +48 -34
- package/dist/sensor/exposure-window.js +77 -36
- package/dist/sensor/exposure-window.js.map +1 -1
- package/dist/sensor/fixed-pattern-noise.d.ts +108 -0
- package/dist/sensor/fixed-pattern-noise.js +166 -0
- package/dist/sensor/fixed-pattern-noise.js.map +1 -0
- package/dist/sensor/iso-gain.d.ts +44 -0
- package/dist/sensor/iso-gain.js +119 -0
- package/dist/sensor/iso-gain.js.map +1 -0
- package/dist/sensor/iso-signal-chain.d.ts +25 -48
- package/dist/sensor/iso-signal-chain.js +52 -66
- package/dist/sensor/iso-signal-chain.js.map +1 -1
- package/dist/sensor/local-exposure-binding.d.ts +21 -21
- package/dist/sensor/local-exposure-binding.js +22 -18
- package/dist/sensor/local-exposure-binding.js.map +1 -1
- package/dist/sensor/optical-stack.d.ts +36 -40
- package/dist/sensor/optical-stack.js +34 -37
- package/dist/sensor/optical-stack.js.map +1 -1
- package/dist/sensor/photon-energy.d.ts +22 -28
- package/dist/sensor/photon-energy.js +42 -34
- package/dist/sensor/photon-energy.js.map +1 -1
- package/dist/sensor/physical-charge-capacity.d.ts +20 -30
- package/dist/sensor/physical-charge-capacity.js +35 -36
- package/dist/sensor/physical-charge-capacity.js.map +1 -1
- package/dist/sensor/pixel-pitch.d.ts +2 -3
- package/dist/sensor/pixel-pitch.js +4 -2
- package/dist/sensor/pixel-pitch.js.map +1 -1
- package/dist/sensor/radiometry-readiness.d.ts +13 -15
- package/dist/sensor/radiometry-readiness.js +20 -17
- package/dist/sensor/radiometry-readiness.js.map +1 -1
- package/dist/sensor/raw-readout.d.ts +173 -83
- package/dist/sensor/raw-readout.js +425 -160
- package/dist/sensor/raw-readout.js.map +1 -1
- package/dist/sensor/raw-reconstruction.d.ts +112 -44
- package/dist/sensor/raw-reconstruction.js +200 -47
- package/dist/sensor/raw-reconstruction.js.map +1 -1
- package/dist/sensor/readout-exposure-linkage.d.ts +103 -34
- package/dist/sensor/readout-exposure-linkage.js +125 -27
- package/dist/sensor/readout-exposure-linkage.js.map +1 -1
- package/dist/sensor/readout-timing.d.ts +43 -44
- package/dist/sensor/readout-timing.js +38 -30
- package/dist/sensor/readout-timing.js.map +1 -1
- package/dist/sensor/response-application-compatibility.d.ts +21 -28
- package/dist/sensor/response-application-compatibility.js +35 -34
- package/dist/sensor/response-application-compatibility.js.map +1 -1
- package/dist/sensor/response-operating-range.d.ts +26 -35
- package/dist/sensor/response-operating-range.js +40 -39
- package/dist/sensor/response-operating-range.js.map +1 -1
- package/dist/sensor/responsivity-photocurrent.d.ts +21 -29
- package/dist/sensor/responsivity-photocurrent.js +57 -40
- package/dist/sensor/responsivity-photocurrent.js.map +1 -1
- package/dist/sensor/sampling-aperture.d.ts +21 -25
- package/dist/sensor/sampling-aperture.js +29 -28
- package/dist/sensor/sampling-aperture.js.map +1 -1
- package/dist/sensor/scene-eqe-temporal-exposure.d.ts +14 -12
- package/dist/sensor/scene-eqe-temporal-exposure.js +13 -8
- package/dist/sensor/scene-eqe-temporal-exposure.js.map +1 -1
- package/dist/sensor/sensor-geometry.d.ts +28 -32
- package/dist/sensor/sensor-geometry.js +35 -20
- package/dist/sensor/sensor-geometry.js.map +1 -1
- package/dist/sensor/signal-noise.d.ts +14 -16
- package/dist/sensor/signal-noise.js +15 -13
- package/dist/sensor/signal-noise.js.map +1 -1
- package/dist/sensor/spatial-sample-reduction.d.ts +45 -60
- package/dist/sensor/spatial-sample-reduction.js +39 -48
- package/dist/sensor/spatial-sample-reduction.js.map +1 -1
- package/dist/sensor/spatial-sampling-quadrature.d.ts +46 -54
- package/dist/sensor/spatial-sampling-quadrature.js +31 -36
- package/dist/sensor/spatial-sampling-quadrature.js.map +1 -1
- package/dist/sensor/spatio-spectral-reduction.d.ts +32 -42
- package/dist/sensor/spatio-spectral-reduction.js +24 -29
- package/dist/sensor/spatio-spectral-reduction.js.map +1 -1
- package/dist/sensor/spectral-coverage.d.ts +6 -9
- package/dist/sensor/spectral-coverage.js +9 -6
- package/dist/sensor/spectral-coverage.js.map +1 -1
- package/dist/sensor/spectral-quadrature.d.ts +46 -60
- package/dist/sensor/spectral-quadrature.js +38 -48
- package/dist/sensor/spectral-quadrature.js.map +1 -1
- package/dist/sensor/spectral-response.d.ts +53 -41
- package/dist/sensor/spectral-response.js +80 -47
- package/dist/sensor/spectral-response.js.map +1 -1
- package/dist/sensor/stochastic-seed.d.ts +50 -0
- package/dist/sensor/stochastic-seed.js +123 -0
- package/dist/sensor/stochastic-seed.js.map +1 -0
- package/dist/sensor/temporal-eqe-sum.d.ts +2 -4
- package/dist/sensor/temporal-eqe-sum.js +5 -6
- package/dist/sensor/temporal-eqe-sum.js.map +1 -1
- package/dist/sensor/temporal-photo-signal.d.ts +5 -6
- package/dist/sensor/temporal-photo-signal.js +11 -10
- package/dist/sensor/temporal-photo-signal.js.map +1 -1
- package/dist/sensor/temporal-sample-binding.d.ts +1 -2
- package/dist/sensor/temporal-sample-binding.js +3 -3
- package/dist/sensor/temporal-sample-binding.js.map +1 -1
- package/dist/simulation/poc-simulation.d.ts +16 -16
- package/dist/simulation/poc-simulation.js +20 -15
- package/dist/simulation/poc-simulation.js.map +1 -1
- package/dist/stabilization/camera-shake.d.ts +42 -18
- package/dist/stabilization/camera-shake.js +43 -20
- package/dist/stabilization/camera-shake.js.map +1 -1
- package/dist/stabilization/system.d.ts +44 -41
- package/dist/stabilization/system.js +196 -108
- package/dist/stabilization/system.js.map +1 -1
- package/docs/AGENT_GUIDE.md +183 -0
- package/docs/API_REFERENCE.md +761 -2
- package/docs/QUICK_START.md +495 -0
- package/docs/USAGE.md +1719 -714
- package/docs/api/camera-equivalent-focal-length.md +6 -7
- package/docs/api/camera-field-of-view.md +16 -8
- package/docs/api/camera-lens-projection.md +246 -0
- package/docs/api/camera-projected-object-size.md +6 -5
- package/docs/api/capture-capture-export-metadata.md +10 -10
- package/docs/api/capture-dng-import.md +134 -0
- package/docs/api/capture-environment-raw-producer.md +17 -11
- package/docs/api/capture-export-jpeg.md +16 -0
- package/docs/api/capture-focus-control.md +25 -47
- package/docs/api/capture-linear-encoding.md +21 -12
- package/docs/api/capture-lossless-jpeg.md +49 -0
- package/docs/api/capture-native-environment-optical-stage.md +75 -0
- package/docs/api/capture-native-environment-raw.md +161 -4
- package/docs/api/capture-native-raw-development.md +69 -4
- package/docs/api/capture-native-raw-dng.md +84 -0
- package/docs/api/capture-native-raw.md +23 -8
- package/docs/api/capture-packed-sensor-raw.md +156 -0
- package/docs/api/capture-photographic-export.md +69 -31
- package/docs/api/capture-raw-frame-reconstruction.md +8 -8
- package/docs/api/capture-raw-white-level.md +37 -0
- package/docs/api/capture-release-sequence.md +6 -7
- package/docs/api/capture-sensor-raw-frame.md +6 -6
- package/docs/api/capture-sensor-raw-producer.md +17 -11
- package/docs/api/capture-simulated-capture.md +15 -15
- package/docs/api/color-camera-color-matrix.md +103 -0
- package/docs/api/color-capture-color.md +22 -11
- package/docs/api/color-chromatic-adaptation.md +82 -0
- package/docs/api/color-color-difference.md +134 -0
- package/docs/api/color-color-matching-functions.md +259 -0
- package/docs/api/color-colorimetry-math.md +54 -0
- package/docs/api/color-gamut-mapping.md +72 -0
- package/docs/api/color-illuminants.md +280 -0
- package/docs/api/color-rgb-color-spaces.md +151 -0
- package/docs/api/color-sensor-color-development.md +27 -0
- package/docs/api/color-srgb-icc.md +2 -4
- package/docs/api/color-white-balance.md +95 -19
- package/docs/api/composition-image-formation-plan.md +124 -95
- package/docs/api/composition-plan-consumer.md +7 -7
- package/docs/api/core-calculation-result.md +18 -14
- package/docs/api/core-configuration-error.md +1 -1
- package/docs/api/core-image-formation.md +7 -7
- package/docs/api/core-scientific-assurance.md +12 -10
- package/docs/api/core-spectral-composition.md +14 -14
- package/docs/api/core-spectral.md +6 -6
- package/docs/api/core-validation.md +3 -3
- package/docs/api/core-version.md +7 -6
- package/docs/api/equipment-exposure-capabilities.md +11 -10
- package/docs/api/equipment-generic-tier-assets.md +7 -2
- package/docs/api/equipment-generic-tier-presets.md +6 -6
- package/docs/api/equipment-iso-capabilities.md +18 -18
- package/docs/api/equipment-metering-capabilities.md +6 -6
- package/docs/api/equipment-release-capabilities.md +4 -4
- package/docs/api/exports.json +2213 -8
- package/docs/api/exposure-exposure-duration-control.md +9 -9
- package/docs/api/exposure-exposure-mode-resolver.md +35 -31
- package/docs/api/exposure-exposure.md +10 -10
- package/docs/api/exposure-flash-ttl.md +182 -0
- package/docs/api/exposure-flash.md +183 -28
- package/docs/api/exposure-metering-scene-radiance.md +11 -10
- package/docs/api/exposure-metering-target.md +9 -8
- package/docs/api/exposure-metering-temporal.md +8 -8
- package/docs/api/exposure-metering.md +69 -9
- package/docs/api/exposure-program-line.md +6 -5
- package/docs/api/facade-chart-radiance-batch.md +96 -0
- package/docs/api/facade-chart-scenes.md +240 -0
- package/docs/api/facade-scene-radiance.md +122 -0
- package/docs/api/facade-simulate-capture.md +324 -0
- package/docs/api/gpu-image-kernel-accelerator.md +157 -0
- package/docs/api/gpu-image-kernel-execution.md +152 -0
- package/docs/api/motion-camera-rotation.md +43 -26
- package/docs/api/motion-capture-rotation-inverse-mapping.md +24 -23
- package/docs/api/motion-capture-rotation-temporal-quadrature.md +22 -22
- package/docs/api/motion-capture-rotation-trajectory.md +15 -15
- package/docs/api/motion-capture-translation-parallax-temporal-quadrature.md +15 -14
- package/docs/api/motion-extended-object-projection.md +10 -8
- package/docs/api/motion-projected-motion.md +8 -8
- package/docs/api/motion-temporal-exposure-sum.md +98 -0
- package/docs/api/motion-video-sequence.md +159 -0
- package/docs/api/optics-aperture.md +8 -8
- package/docs/api/optics-atmospheric-haze.md +104 -0
- package/docs/api/optics-brown-conrady-distortion.md +123 -0
- package/docs/api/optics-circle-of-confusion.md +5 -4
- package/docs/api/optics-complex-pupil-psf.md +57 -16
- package/docs/api/optics-depth-of-field.md +12 -6
- package/docs/api/optics-diffraction.md +8 -7
- package/docs/api/optics-focus-breathing.md +104 -16
- package/docs/api/optics-focus-state.md +9 -10
- package/docs/api/optics-front-of-lens-filter.md +72 -14
- package/docs/api/optics-illumination-vignetting.md +10 -10
- package/docs/api/optics-irradiance-convolution.md +95 -0
- package/docs/api/optics-lateral-chromatic-aberration.md +22 -21
- package/docs/api/optics-lens-psf-kernels.md +72 -0
- package/docs/api/optics-lens-psf-profile.md +48 -26
- package/docs/api/optics-longitudinal-chromatic-aberration.md +128 -0
- package/docs/api/optics-polygon-diffraction.md +78 -13
- package/docs/api/optics-profile-contract.md +4 -4
- package/docs/api/optics-psf-foundation.md +12 -12
- package/docs/api/optics-pupil-vignetting.md +132 -0
- package/docs/api/optics-radial-distortion.md +12 -12
- package/docs/api/optics-scene-to-sensor-irradiance.md +25 -14
- package/docs/api/optics-scene-to-sensor-quadrature.md +15 -12
- package/docs/api/optics-sensor-aperture-rays.md +3 -2
- package/docs/api/optics-sensor-environment-query.md +52 -9
- package/docs/api/optics-sensor-psf-quadrature.md +13 -10
- package/docs/api/optics-stray-light.md +12 -11
- package/docs/api/optics-thin-lens.md +4 -3
- package/docs/api/optics-zernike-wavefront.md +229 -0
- package/docs/api/output-capture-corrected-sdr.md +10 -7
- package/docs/api/output-capture-geometry.md +35 -36
- package/docs/api/output-capture-sdr.md +4 -4
- package/docs/api/output-crop.md +7 -4
- package/docs/api/output-geometric-transforms.md +65 -19
- package/docs/api/output-lens-corrections.md +17 -15
- package/docs/api/output-native-capture-sdr.md +26 -13
- package/docs/api/output-png-encoder.md +105 -0
- package/docs/api/output-print-contrast-reference.md +8 -8
- package/docs/api/output-print-detail.md +14 -14
- package/docs/api/output-print-jpeg.md +22 -5
- package/docs/api/output-print-plan.md +18 -18
- package/docs/api/output-print-region-statistics.md +14 -14
- package/docs/api/output-sdr-rendering.md +52 -10
- package/docs/api/output-subject-framing-crop.md +5 -6
- package/docs/api/processing-demosaic.md +120 -0
- package/docs/api/processing-denoise.md +148 -0
- package/docs/api/processing-focus-stacking.md +41 -0
- package/docs/api/processing-hdr.md +113 -0
- package/docs/api/processing-panorama.md +82 -0
- package/docs/api/processing-processing-task.md +107 -0
- package/docs/api/processing-tone-mapping.md +142 -0
- package/docs/api/schema-camera.md +6 -4
- package/docs/api/schema-illumination-spectral.md +10 -11
- package/docs/api/schema-illumination-temporal.md +13 -15
- package/docs/api/schema-illumination.md +4 -4
- package/docs/api/schema-scene-radiance-temporal.md +10 -11
- package/docs/api/schema-scene-radiance.md +18 -17
- package/docs/api/schema-scene.md +9 -9
- package/docs/api/schema-validation.md +1 -1
- package/docs/api/sensor-accumulated-charge.md +12 -20
- package/docs/api/sensor-architecture.md +15 -16
- package/docs/api/sensor-camera-saturation-capacity.md +9 -11
- package/docs/api/sensor-capture-color-sampling-binding.md +47 -51
- package/docs/api/sensor-capture-mode-timing.md +9 -9
- package/docs/api/sensor-capture-mode.md +29 -30
- package/docs/api/sensor-color-sampling.md +31 -33
- package/docs/api/sensor-constant-rate-temporal-integration.md +10 -11
- package/docs/api/sensor-dark-current.md +30 -14
- package/docs/api/sensor-environment-photo-signal.md +13 -6
- package/docs/api/sensor-eqe-electron-rate.md +9 -8
- package/docs/api/sensor-eqe-local-exposure.md +18 -17
- package/docs/api/sensor-eqe-temporal-exposure.md +12 -11
- package/docs/api/sensor-exposure-window.md +24 -24
- package/docs/api/sensor-fixed-pattern-noise.md +104 -0
- package/docs/api/sensor-iso-gain.md +63 -0
- package/docs/api/sensor-iso-signal-chain.md +13 -22
- package/docs/api/sensor-local-exposure-binding.md +12 -13
- package/docs/api/sensor-optical-stack.md +37 -40
- package/docs/api/sensor-photon-energy.md +10 -11
- package/docs/api/sensor-physical-charge-capacity.md +8 -13
- package/docs/api/sensor-pixel-pitch.md +1 -1
- package/docs/api/sensor-radiometry-readiness.md +9 -9
- package/docs/api/sensor-raw-readout.md +118 -52
- package/docs/api/sensor-raw-reconstruction.md +97 -20
- package/docs/api/sensor-readout-exposure-linkage.md +120 -24
- package/docs/api/sensor-readout-timing.md +33 -35
- package/docs/api/sensor-response-application-compatibility.md +9 -11
- package/docs/api/sensor-response-operating-range.md +14 -18
- package/docs/api/sensor-responsivity-photocurrent.md +9 -12
- package/docs/api/sensor-sampling-aperture.md +22 -25
- package/docs/api/sensor-scene-eqe-temporal-exposure.md +9 -8
- package/docs/api/sensor-sensor-geometry.md +23 -24
- package/docs/api/sensor-signal-noise.md +10 -10
- package/docs/api/sensor-spatial-sample-reduction.md +27 -30
- package/docs/api/sensor-spatial-sampling-quadrature.md +37 -39
- package/docs/api/sensor-spatio-spectral-reduction.md +27 -29
- package/docs/api/sensor-spectral-coverage.md +5 -5
- package/docs/api/sensor-spectral-quadrature.md +33 -35
- package/docs/api/sensor-spectral-response.md +28 -16
- package/docs/api/sensor-temporal-photo-signal.md +6 -6
- package/docs/api/simulation-poc-simulation.md +17 -16
- package/docs/api/stabilization-camera-shake.md +29 -10
- package/docs/api/stabilization-system.md +25 -21
- package/docs/examples/production-request.json +3821 -2157
- package/docs/examples/simulate-capture.mjs +14 -0
- package/llms.txt +35 -0
- package/package.json +32 -12
- package/AGENTS.md +0 -674
- package/CONTRIBUTING.md +0 -76
- package/DCO +0 -33
- package/dist/camera/equivalent-focal-length.d.ts.map +0 -1
- package/dist/camera/field-of-view.d.ts.map +0 -1
- package/dist/camera/projected-object-size.d.ts.map +0 -1
- package/dist/capture/capture-export-metadata.d.ts.map +0 -1
- package/dist/capture/environment-raw-producer.d.ts.map +0 -1
- package/dist/capture/export-jpeg.d.ts.map +0 -1
- package/dist/capture/export-tiff.d.ts.map +0 -1
- package/dist/capture/focus-control.d.ts.map +0 -1
- package/dist/capture/linear-encoding.d.ts.map +0 -1
- package/dist/capture/native-environment-raw.d.ts.map +0 -1
- package/dist/capture/native-raw-development.d.ts.map +0 -1
- package/dist/capture/native-raw.d.ts.map +0 -1
- package/dist/capture/photographic-export.d.ts.map +0 -1
- package/dist/capture/raw-frame-limits.d.ts.map +0 -1
- package/dist/capture/raw-frame-reconstruction.d.ts.map +0 -1
- package/dist/capture/release-sequence.d.ts.map +0 -1
- package/dist/capture/sensor-raw-frame.d.ts.map +0 -1
- package/dist/capture/sensor-raw-producer.d.ts.map +0 -1
- package/dist/capture/simulated-capture.d.ts.map +0 -1
- package/dist/color/capture-color.d.ts.map +0 -1
- package/dist/color/sensor-color-development.d.ts.map +0 -1
- package/dist/color/srgb-icc.d.ts.map +0 -1
- package/dist/color/srgb-transfer.d.ts.map +0 -1
- package/dist/color/white-balance.d.ts.map +0 -1
- package/dist/composition/image-formation-plan.d.ts.map +0 -1
- package/dist/composition/plan-consumer.d.ts.map +0 -1
- package/dist/core/calculation-result.d.ts.map +0 -1
- package/dist/core/canonical-json.d.ts.map +0 -1
- package/dist/core/configuration-error.d.ts.map +0 -1
- package/dist/core/evidence-provenance.d.ts.map +0 -1
- package/dist/core/image-formation.d.ts.map +0 -1
- package/dist/core/owned-data.d.ts.map +0 -1
- package/dist/core/record-validation.d.ts.map +0 -1
- package/dist/core/scientific-assurance.d.ts.map +0 -1
- package/dist/core/spectral-composition.d.ts.map +0 -1
- package/dist/core/spectral.d.ts.map +0 -1
- package/dist/core/validation.d.ts.map +0 -1
- package/dist/core/version.d.ts.map +0 -1
- package/dist/equipment/exposure-capabilities.d.ts.map +0 -1
- package/dist/equipment/generic-tier-assets.d.ts.map +0 -1
- package/dist/equipment/generic-tier-presets.d.ts.map +0 -1
- package/dist/equipment/iso-capabilities.d.ts.map +0 -1
- package/dist/equipment/metering-capabilities.d.ts.map +0 -1
- package/dist/equipment/release-capabilities.d.ts.map +0 -1
- package/dist/exposure/exposure-duration-control.d.ts.map +0 -1
- package/dist/exposure/exposure-mode-resolver.d.ts.map +0 -1
- package/dist/exposure/exposure.d.ts.map +0 -1
- package/dist/exposure/flash.d.ts.map +0 -1
- package/dist/exposure/metering-scene-radiance.d.ts.map +0 -1
- package/dist/exposure/metering-target.d.ts.map +0 -1
- package/dist/exposure/metering-temporal.d.ts.map +0 -1
- package/dist/exposure/metering.d.ts.map +0 -1
- package/dist/exposure/program-line.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/motion/camera-rotation.d.ts.map +0 -1
- package/dist/motion/capture-rotation-inverse-mapping.d.ts.map +0 -1
- package/dist/motion/capture-rotation-temporal-quadrature.d.ts.map +0 -1
- package/dist/motion/capture-rotation-trajectory.d.ts.map +0 -1
- package/dist/motion/capture-translation-parallax-temporal-quadrature.d.ts.map +0 -1
- package/dist/motion/extended-object-projection.d.ts.map +0 -1
- package/dist/motion/projected-motion.d.ts.map +0 -1
- package/dist/optics/aperture.d.ts.map +0 -1
- package/dist/optics/circle-of-confusion.d.ts.map +0 -1
- package/dist/optics/complex-pupil-psf.d.ts.map +0 -1
- package/dist/optics/depth-of-field.d.ts.map +0 -1
- package/dist/optics/diffraction.d.ts.map +0 -1
- package/dist/optics/focus-breathing.d.ts.map +0 -1
- package/dist/optics/focus-state.d.ts.map +0 -1
- package/dist/optics/front-of-lens-filter.d.ts.map +0 -1
- package/dist/optics/illumination-vignetting.d.ts.map +0 -1
- package/dist/optics/lateral-chromatic-aberration.d.ts.map +0 -1
- package/dist/optics/lens-psf-profile.d.ts.map +0 -1
- package/dist/optics/polygon-diffraction.d.ts.map +0 -1
- package/dist/optics/profile-contract.d.ts.map +0 -1
- package/dist/optics/psf-foundation.d.ts.map +0 -1
- package/dist/optics/radial-distortion.d.ts.map +0 -1
- package/dist/optics/scene-to-sensor-irradiance.d.ts.map +0 -1
- package/dist/optics/scene-to-sensor-quadrature.d.ts.map +0 -1
- package/dist/optics/sensor-aperture-rays.d.ts.map +0 -1
- package/dist/optics/sensor-environment-query.d.ts.map +0 -1
- package/dist/optics/sensor-psf-quadrature.d.ts.map +0 -1
- package/dist/optics/sensor-psf-support.d.ts.map +0 -1
- package/dist/optics/stray-light.d.ts.map +0 -1
- package/dist/optics/thin-lens.d.ts.map +0 -1
- package/dist/output/capture-corrected-sdr.d.ts.map +0 -1
- package/dist/output/capture-geometry.d.ts.map +0 -1
- package/dist/output/capture-sdr.d.ts.map +0 -1
- package/dist/output/crop.d.ts.map +0 -1
- package/dist/output/geometric-transforms.d.ts.map +0 -1
- package/dist/output/lens-corrections.d.ts.map +0 -1
- package/dist/output/native-capture-sdr.d.ts.map +0 -1
- package/dist/output/print-contrast-reference.d.ts.map +0 -1
- package/dist/output/print-detail.d.ts.map +0 -1
- package/dist/output/print-jpeg.d.ts.map +0 -1
- package/dist/output/print-plan.d.ts.map +0 -1
- package/dist/output/print-region-statistics.d.ts.map +0 -1
- package/dist/output/sdr-rendering.d.ts.map +0 -1
- package/dist/output/subject-framing-crop.d.ts.map +0 -1
- package/dist/schema/camera.d.ts.map +0 -1
- package/dist/schema/camera.js +0 -3
- package/dist/schema/camera.js.map +0 -1
- package/dist/schema/illumination-spectral.d.ts.map +0 -1
- package/dist/schema/illumination-temporal.d.ts.map +0 -1
- package/dist/schema/illumination.d.ts.map +0 -1
- package/dist/schema/scene-radiance-temporal.d.ts.map +0 -1
- package/dist/schema/scene-radiance.d.ts.map +0 -1
- package/dist/schema/scene.d.ts.map +0 -1
- package/dist/schema/scene.js +0 -3
- package/dist/schema/scene.js.map +0 -1
- package/dist/schema/validation.d.ts.map +0 -1
- package/dist/sensor/accumulated-charge.d.ts.map +0 -1
- package/dist/sensor/architecture.d.ts.map +0 -1
- package/dist/sensor/camera-saturation-capacity.d.ts.map +0 -1
- package/dist/sensor/capture-color-sampling-binding.d.ts.map +0 -1
- package/dist/sensor/capture-mode-timing.d.ts.map +0 -1
- package/dist/sensor/capture-mode.d.ts.map +0 -1
- package/dist/sensor/color-sampling.d.ts.map +0 -1
- package/dist/sensor/constant-rate-temporal-integration.d.ts.map +0 -1
- package/dist/sensor/dark-current.d.ts.map +0 -1
- package/dist/sensor/environment-photo-signal.d.ts.map +0 -1
- package/dist/sensor/eqe-electron-rate.d.ts.map +0 -1
- package/dist/sensor/eqe-local-exposure.d.ts.map +0 -1
- package/dist/sensor/eqe-temporal-exposure.d.ts.map +0 -1
- package/dist/sensor/exposure-window.d.ts.map +0 -1
- package/dist/sensor/iso-signal-chain.d.ts.map +0 -1
- package/dist/sensor/local-exposure-binding.d.ts.map +0 -1
- package/dist/sensor/optical-stack.d.ts.map +0 -1
- package/dist/sensor/photon-energy.d.ts.map +0 -1
- package/dist/sensor/physical-charge-capacity.d.ts.map +0 -1
- package/dist/sensor/pixel-pitch.d.ts.map +0 -1
- package/dist/sensor/radiometry-readiness.d.ts.map +0 -1
- package/dist/sensor/raw-readout.d.ts.map +0 -1
- package/dist/sensor/raw-reconstruction.d.ts.map +0 -1
- package/dist/sensor/readout-exposure-linkage.d.ts.map +0 -1
- package/dist/sensor/readout-timing.d.ts.map +0 -1
- package/dist/sensor/response-application-compatibility.d.ts.map +0 -1
- package/dist/sensor/response-operating-range.d.ts.map +0 -1
- package/dist/sensor/responsivity-photocurrent.d.ts.map +0 -1
- package/dist/sensor/sampling-aperture.d.ts.map +0 -1
- package/dist/sensor/scene-eqe-temporal-exposure.d.ts.map +0 -1
- package/dist/sensor/sensor-geometry.d.ts.map +0 -1
- package/dist/sensor/signal-noise.d.ts.map +0 -1
- package/dist/sensor/spatial-sample-reduction.d.ts.map +0 -1
- package/dist/sensor/spatial-sampling-quadrature.d.ts.map +0 -1
- package/dist/sensor/spatio-spectral-reduction.d.ts.map +0 -1
- package/dist/sensor/spectral-coverage.d.ts.map +0 -1
- package/dist/sensor/spectral-quadrature.d.ts.map +0 -1
- package/dist/sensor/spectral-response.d.ts.map +0 -1
- package/dist/sensor/temporal-eqe-sum.d.ts.map +0 -1
- package/dist/sensor/temporal-photo-signal.d.ts.map +0 -1
- package/dist/sensor/temporal-sample-binding.d.ts.map +0 -1
- package/dist/simulation/poc-simulation.d.ts.map +0 -1
- package/dist/stabilization/camera-shake.d.ts.map +0 -1
- package/dist/stabilization/system.d.ts.map +0 -1
- package/docs/API_STYLE.md +0 -235
- package/docs/ARCHITECTURE.md +0 -356
- package/docs/AUTOMATION_COORDINATION.md +0 -190
- package/docs/CAPTURE_COLOR.md +0 -25
- package/docs/CAPTURE_CORRECTED_SDR.md +0 -25
- package/docs/CAPTURE_EXPORT_METADATA.md +0 -27
- package/docs/CAPTURE_SDR.md +0 -22
- package/docs/DEVELOPERS.md +0 -68
- package/docs/DIGITAL_OPTICS_FOUNDATION.md +0 -69
- package/docs/ENVIRONMENT_RAW_CAPTURE.md +0 -208
- package/docs/EXPORT_ACCEPTANCE.md +0 -133
- package/docs/GENERIC_TIER_PRESETS.md +0 -269
- package/docs/GEOMETRIC_PREPARATION_REUSE.md +0 -141
- package/docs/IMAGE_FORMATION.md +0 -247
- package/docs/LINEAR_CAPTURE_ENCODING.md +0 -25
- package/docs/MOTION_AND_SIGNAL.md +0 -250
- package/docs/NATIVE_CAPTURE_SDR.md +0 -70
- package/docs/NATIVE_CAPTURE_SDR_REVIEW.md +0 -37
- package/docs/NATIVE_CAPTURE_SDR_VALIDATION.md +0 -34
- package/docs/NATIVE_RAW_AND_PRINT.md +0 -47
- package/docs/NUMERICAL_CORRECTNESS.md +0 -191
- package/docs/PERFORMANCE_BASELINE.md +0 -56
- package/docs/PHOTOGRAPHIC_EXPORT.md +0 -206
- package/docs/PHYSICS_FOUNDATION.md +0 -426
- package/docs/POC_API.md +0 -278
- package/docs/POC_PROJECTION_PLATFORM_REFERENCE.md +0 -12
- package/docs/POC_PROJECTION_REUSE.md +0 -124
- package/docs/PRINT_195_196_REVIEW.md +0 -93
- package/docs/PRINT_196_ENGINE_ACCEPTANCE.md +0 -45
- package/docs/PRINT_CONTRAST_REFERENCE.md +0 -43
- package/docs/PRINT_DETAIL_ASSESSMENT.md +0 -81
- package/docs/PRINT_DETAIL_JPEG_EVIDENCE.md +0 -36
- package/docs/PRINT_DETAIL_SDR_EVIDENCE.md +0 -29
- package/docs/PRINT_DETAIL_VALIDATION.md +0 -36
- package/docs/PRINT_PLANNING.md +0 -75
- package/docs/PRINT_REGION_STATISTICS.md +0 -38
- package/docs/PROCESSED_OUTPUT.md +0 -157
- package/docs/PRODUCTION_COMPOSITION.md +0 -373
- package/docs/PRODUCTION_ENVIRONMENT_CAPTURE.md +0 -131
- package/docs/PROVENANCE.md +0 -115
- package/docs/PSF_FOUNDATION.md +0 -165
- package/docs/RAW_FRAME_ENVELOPE.md +0 -56
- package/docs/RAW_FRAME_RECONSTRUCTION.md +0 -30
- package/docs/RELEASE_1_0.md +0 -66
- package/docs/RELEASE_1_0_1.md +0 -61
- package/docs/RELEASE_1_1_0.md +0 -25
- package/docs/RELEASE_1_2_0.md +0 -51
- package/docs/RELEASE_1_3_0.md +0 -15
- package/docs/RELEASE_1_4_0.md +0 -23
- package/docs/RELEASE_AUDIT.md +0 -39
- package/docs/SCENE_RADIANCE_AND_ILLUMINATION.md +0 -298
- package/docs/SCENE_SENSOR_QUADRATURE.md +0 -98
- package/docs/SCENE_SENSOR_TEMPORAL_EXPOSURE.md +0 -86
- package/docs/SCIENTIFIC_ASSURANCE.md +0 -280
- package/docs/SCIENTIFIC_CONFORMANCE.md +0 -83
- package/docs/SDR_RENDERING.md +0 -33
- package/docs/SENSOR_APERTURE_RAYS.md +0 -23
- package/docs/SENSOR_ENVIRONMENT_QUERY.md +0 -86
- package/docs/SENSOR_EQE_LOCAL_EXPOSURE.md +0 -104
- package/docs/SENSOR_EQE_TEMPORAL_EXPOSURE.md +0 -74
- package/docs/SENSOR_PSF_QUADRATURE.md +0 -90
- package/docs/SENSOR_RAW_FRAME.md +0 -20
- package/docs/SENSOR_RAW_PRODUCER.md +0 -77
- package/docs/SIGNAL_CONFORMANCE.md +0 -23
- package/docs/SIMULATED_CAPTURE.md +0 -65
- package/docs/STABILIZATION.md +0 -234
- package/docs/TEMPORAL_PHOTO_RAW.md +0 -83
- package/docs/TIER_ACCEPTANCE.md +0 -129
- package/docs/TIER_PRESET_ACCEPTANCE.md +0 -59
- package/docs/V1_COMPOSITION_MAP.md +0 -123
- package/docs/V1_HELPER_REUSE_REVIEW.md +0 -60
- package/docs/V1_PERFORMANCE_DISPOSITION.md +0 -88
- package/docs/benchmarks/2026-10-01-main-baseline.json +0 -694
- package/docs/benchmarks/2026-10-02-geometric-preparation-reuse.json +0 -2190
- package/docs/benchmarks/2026-10-02-poc-projection-reuse.json +0 -2423
- package/docs/benchmarks/2026-10-02-v1-environment-gc-profile.json +0 -210
- package/docs/benchmarks/2026-10-02-v1-environment-ordinary.json +0 -187
- package/docs/benchmarks/2026-10-02-v1-geometry-gc-profile.json +0 -756
- package/docs/benchmarks/2026-10-02-v1-geometry-ordinary-1.json +0 -711
- package/docs/benchmarks/2026-10-02-v1-geometry-ordinary-2.json +0 -711
- package/docs/benchmarks/2026-10-02-v1-poc-gc-profile.json +0 -885
- package/docs/benchmarks/2026-10-02-v1-poc-ordinary-1.json +0 -868
- package/docs/benchmarks/2026-10-02-v1-poc-ordinary-2.json +0 -868
- package/docs/licenses/castleCSF-MIT.txt +0 -21
- package/docs/validation/documentation-fragments.json +0 -212
- package/docs/validation/native-capture-sdr-darwin-arm64-node26-review.jsonl +0 -4
- package/docs/validation/native-capture-sdr-darwin-arm64.jsonl +0 -3
- package/docs/validation/native-raw-print-2026-10-04/fractional-asymmetric-crop.jpg +0 -0
- package/docs/validation/native-raw-print-2026-10-04/gray-ramp.jpg +0 -0
- package/docs/validation/native-raw-print-2026-10-04/linear-area-checker.jpg +0 -0
- package/docs/validation/native-raw-print-2026-10-04/manifest.json +0 -218
- package/docs/validation/native-raw-print-2026-10-04/megapixel-native.jpg +0 -0
- package/docs/validation/native-raw-print-2026-10-04/native-color.jpg +0 -0
- package/docs/validation/native-raw-print-2026-10-04/photivra-native-full-megapixel-validation.json +0 -9
- package/docs/validation/native-raw-print-2026-10-04/photivra-native-full-megapixel.json +0 -29
- package/docs/validation/native-raw-print-2026-10-04/photivra-native-full-megapixel.json.codes.u16le.gz +0 -0
- package/docs/validation/native-raw-print-2026-10-04/photivra-native-full-megapixel.json.jpg +0 -0
- package/docs/validation/native-raw-print-2026-10-04/photivra-native-full-megapixel.json.rgb.gz +0 -0
- package/docs/validation/native-raw-print-2026-10-04/srgb.icc +0 -0
- package/docs/validation/native-raw-print-2026-10-04/validation.json +0 -41
- package/docs/validation/print-196-candidate-capabilities.json +0 -28
- package/docs/validation/print-196-candidate-evidence.json +0 -356
- package/docs/validation/print-196-engine-acceptance.json +0 -81
- package/docs/validation/print-detail-capabilities.json +0 -103
- package/docs/validation/print-detail-jpeg-evidence.json +0 -116
- package/docs/validation/print-detail-sdr-evidence.json +0 -81
- package/docs/validation/release-audit-inventory.json +0 -1306
- package/docs/validation/tier-acceptance-report-v1.json +0 -2538
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import { InvalidConfigurationError } from "../core/configuration-error.js";
|
|
3
|
+
import { InvalidScientificInputError, InvalidScientificResultError } from "../core/validation.js";
|
|
4
|
+
import { requireAllowlistedRecord } from "../core/record-validation.js";
|
|
5
|
+
import { DEFAULT_HOST_YIELD_CADENCE, createHostYieldGate } from "../capture/host-yield-cadence.js";
|
|
6
|
+
/** Largest image (pixels per frame) any processing operator accepts. */
|
|
7
|
+
export const PROCESSING_MAX_PIXELS = 1 << 26;
|
|
8
|
+
/** Largest number of input frames (brackets, focus slices, panorama frames). */
|
|
9
|
+
export const PROCESSING_MAX_FRAMES = 32;
|
|
10
|
+
/** Default working-memory bound when `maximumWorkingBytes` is omitted (1 GiB). */
|
|
11
|
+
export const PROCESSING_DEFAULT_MAXIMUM_WORKING_BYTES = 1 << 30;
|
|
12
|
+
export const PROCESSING_MODEL_VERSION = "1.0.0";
|
|
13
|
+
export function processingProvenance(model, assumptions) {
|
|
14
|
+
return { kind: "approximation", model, modelVersion: PROCESSING_MODEL_VERSION, assumptions: [...assumptions] };
|
|
15
|
+
}
|
|
16
|
+
/** Internal: wraps a row generator in the shared cancellable task contract. */
|
|
17
|
+
export function createProcessingTask(spec) {
|
|
18
|
+
const hooks = requireProvider(spec.provider);
|
|
19
|
+
if (spec.estimatedWorkingBytes > spec.maximumWorkingBytes) {
|
|
20
|
+
throw new InvalidConfigurationError("Processing working memory estimate (" + spec.estimatedWorkingBytes + " bytes) exceeds maximumWorkingBytes.");
|
|
21
|
+
}
|
|
22
|
+
const yieldControl = hooks.yieldControl.bind(hooks), onProgress = hooks.onProgress?.bind(hooks);
|
|
23
|
+
const abort = new AbortController(), total = spec.totalTileCount;
|
|
24
|
+
let state = "ready", completed = 0, output = null;
|
|
25
|
+
const check = () => { if (abort.signal.aborted)
|
|
26
|
+
throw new InvalidConfigurationError("Processing task aborted."); };
|
|
27
|
+
return {
|
|
28
|
+
get state() { return state; },
|
|
29
|
+
get completedTileCount() { return completed; },
|
|
30
|
+
totalTileCount: total,
|
|
31
|
+
estimatedWorkingBytes: spec.estimatedWorkingBytes,
|
|
32
|
+
async run() {
|
|
33
|
+
if (state !== "ready")
|
|
34
|
+
throw new InvalidConfigurationError("Processing task is single-use.");
|
|
35
|
+
state = "running";
|
|
36
|
+
try {
|
|
37
|
+
const gate = createHostYieldGate(spec.cadence ?? DEFAULT_HOST_YIELD_CADENCE), body = spec.body();
|
|
38
|
+
for (;;) {
|
|
39
|
+
check();
|
|
40
|
+
const step = body.next();
|
|
41
|
+
if (step.done === true) {
|
|
42
|
+
output = step.value;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
completed++;
|
|
46
|
+
onProgress?.({ completedTileCount: completed, totalTileCount: total });
|
|
47
|
+
if (gate.due()) {
|
|
48
|
+
await yieldControl(abort.signal);
|
|
49
|
+
check();
|
|
50
|
+
gate.restart();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (completed !== total)
|
|
54
|
+
throw new InvalidScientificResultError("Processing progress accounting disagrees with its plan.");
|
|
55
|
+
await yieldControl(abort.signal);
|
|
56
|
+
check();
|
|
57
|
+
state = "completed";
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
output = null;
|
|
61
|
+
if (!abort.signal.aborted) {
|
|
62
|
+
state = "failed";
|
|
63
|
+
abort.abort();
|
|
64
|
+
}
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
cancel() { if (state === "ready" || state === "running" || state === "completed") {
|
|
69
|
+
state = "cancelled";
|
|
70
|
+
abort.abort();
|
|
71
|
+
output = null;
|
|
72
|
+
} },
|
|
73
|
+
dispose() { if (state !== "transferred") {
|
|
74
|
+
state = "disposed";
|
|
75
|
+
abort.abort();
|
|
76
|
+
output = null;
|
|
77
|
+
} },
|
|
78
|
+
takeOutput() {
|
|
79
|
+
if (state !== "completed" || output === null)
|
|
80
|
+
throw new InvalidConfigurationError("Processing output unavailable.");
|
|
81
|
+
const value = output;
|
|
82
|
+
output = null;
|
|
83
|
+
state = "transferred";
|
|
84
|
+
return value;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function requireProvider(provider) {
|
|
89
|
+
const hooks = provider;
|
|
90
|
+
if (hooks === null || typeof hooks !== "object" || typeof hooks.yieldControl !== "function" ||
|
|
91
|
+
(hooks.onProgress !== undefined && typeof hooks.onProgress !== "function")) {
|
|
92
|
+
throw new InvalidConfigurationError("Processing requires a provider { yieldControl, onProgress? }.");
|
|
93
|
+
}
|
|
94
|
+
return hooks;
|
|
95
|
+
}
|
|
96
|
+
// ------------------------------------------------------------------ validation helpers (internal)
|
|
97
|
+
export function requireOptions(value, keys, label) {
|
|
98
|
+
return requireAllowlistedRecord(value, keys, label + " must be an object with only the documented fields.");
|
|
99
|
+
}
|
|
100
|
+
export function requireFiniteIn(value, label, min, max, exclusiveMin = false) {
|
|
101
|
+
if (typeof value !== "number" || !Number.isFinite(value) || (exclusiveMin ? value <= min : value < min) || value > max) {
|
|
102
|
+
throw new InvalidScientificInputError(label + " must be a finite number in " + (exclusiveMin ? "(" : "[") + min + ", " + max + "].");
|
|
103
|
+
}
|
|
104
|
+
return value;
|
|
105
|
+
}
|
|
106
|
+
export function optionalFiniteIn(value, fallback, label, min, max, exclusiveMin = false) {
|
|
107
|
+
return value === undefined ? fallback : requireFiniteIn(value, label, min, max, exclusiveMin);
|
|
108
|
+
}
|
|
109
|
+
export function requireIntegerIn(value, label, min, max) {
|
|
110
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < min || value > max) {
|
|
111
|
+
throw new InvalidConfigurationError(label + " must be an integer in [" + min + ", " + max + "].");
|
|
112
|
+
}
|
|
113
|
+
return value;
|
|
114
|
+
}
|
|
115
|
+
export function optionalIntegerIn(value, fallback, label, min, max) {
|
|
116
|
+
return value === undefined ? fallback : requireIntegerIn(value, label, min, max);
|
|
117
|
+
}
|
|
118
|
+
export function requireEnum(value, allowed, label, fallback) {
|
|
119
|
+
if (value === undefined && fallback !== undefined)
|
|
120
|
+
return fallback;
|
|
121
|
+
if (typeof value !== "string" || !allowed.includes(value)) {
|
|
122
|
+
throw new InvalidConfigurationError(label + " must be one of " + allowed.join(", ") + ".");
|
|
123
|
+
}
|
|
124
|
+
return value;
|
|
125
|
+
}
|
|
126
|
+
export function maximumWorkingBytes(value) {
|
|
127
|
+
return optionalIntegerIn(value, PROCESSING_DEFAULT_MAXIMUM_WORKING_BYTES, "maximumWorkingBytes", 1, Number.MAX_SAFE_INTEGER);
|
|
128
|
+
}
|
|
129
|
+
/** Validates the shape (not the values) of an interleaved image; values are checked by `finiteRows`. */
|
|
130
|
+
export function requireImage(value, label, channels = 3) {
|
|
131
|
+
const r = requireOptions(value, ["width", "height", "data"], label);
|
|
132
|
+
const width = requireIntegerIn(r.width, label + ".width", 1, PROCESSING_MAX_PIXELS);
|
|
133
|
+
const height = requireIntegerIn(r.height, label + ".height", 1, PROCESSING_MAX_PIXELS);
|
|
134
|
+
if (width * height > PROCESSING_MAX_PIXELS)
|
|
135
|
+
throw new InvalidConfigurationError(label + " exceeds " + PROCESSING_MAX_PIXELS + " pixels.");
|
|
136
|
+
if (!(r.data instanceof Float32Array) || r.data.length !== width * height * channels) {
|
|
137
|
+
throw new InvalidConfigurationError(label + ".data must be a Float32Array of width·height·" + channels + " samples.");
|
|
138
|
+
}
|
|
139
|
+
return { width, height, data: r.data };
|
|
140
|
+
}
|
|
141
|
+
/** Validates 1..PROCESSING_MAX_FRAMES same-size images. */
|
|
142
|
+
export function requireImageList(value, label, minimum) {
|
|
143
|
+
if (!Array.isArray(value) || value.length < minimum || value.length > PROCESSING_MAX_FRAMES) {
|
|
144
|
+
throw new InvalidConfigurationError(label + " must contain " + minimum + " to " + PROCESSING_MAX_FRAMES + " images.");
|
|
145
|
+
}
|
|
146
|
+
const images = value.map((v, i) => requireImage(v, label + "[" + i + "]"));
|
|
147
|
+
if (images.some((im) => im.width !== images[0].width || im.height !== images[0].height)) {
|
|
148
|
+
throw new InvalidConfigurationError(label + " images must share one size.");
|
|
149
|
+
}
|
|
150
|
+
return images;
|
|
151
|
+
}
|
|
152
|
+
/** Row generator rejecting non-finite samples (one tile per row). */
|
|
153
|
+
export function* finiteRows(data, width, height, channels, label, minimum = -Infinity) {
|
|
154
|
+
const stride = width * channels;
|
|
155
|
+
for (let y = 0; y < height; y++) {
|
|
156
|
+
for (let i = y * stride, end = i + stride; i < end; i++) {
|
|
157
|
+
const v = data[i];
|
|
158
|
+
if (!Number.isFinite(v) || v < minimum)
|
|
159
|
+
throw new InvalidScientificInputError(label + " samples must be finite" + (minimum > -Infinity ? " and ≥ " + minimum : "") + ".");
|
|
160
|
+
}
|
|
161
|
+
yield;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=processing-task.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processing-task.js","sourceRoot":"","sources":["../../src/processing/processing-task.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAiBtC,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAClG,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,0BAA0B,EAAE,mBAAmB,EAAyB,MAAM,kCAAkC,CAAC;AAG1H,wEAAwE;AACxE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,IAAI,EAAE,CAAC;AAC7C,gFAAgF;AAChF,MAAM,CAAC,MAAM,qBAAq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EAAE,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAE,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1F,MAAM,IAAI,yBAAyB,CAAC,KAAK,GAAG,8BAA8B,CAAC,CAAC;IAC9E,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,qEAAqE;AACrE,MAAM,SAAS,CAAC,CAAC,UAAU,CAAC,IAAkB,EAAE,KAAa,EAAE,MAAc,EAAE,QAAgB,EAAE,KAAa,EAC5G,OAAO,GAAG,CAAC,QAAQ;IACnB,MAAM,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC;IAChC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAChC,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,EAAE,GAAG,GAAG,CAAC,GAAG,MAAM,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;YACxD,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAE,CAAC;YACnB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO;gBAAE,MAAM,IAAI,2BAA2B,CAAC,KAAK,GAAG,yBAAyB,GAAG,CAAC,OAAO,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC;QAC5K,CAAC;QACD,KAAK,CAAC;IACR,CAAC;AACH,CAAC","sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Shared cancellable task wrapper and typed-image contracts for the standalone image-processing\n * operators: demosaic, HDR merge and encode, tone mapping, exposure fusion, focus stacking, panorama,\n * denoise, sharpening and synthetic grain.\n *\n * Each operator is a synchronous row generator. This wrapper steps through it and reports one\n * progress tile for each processed row of every pass. It awaits the host's `yieldControl` on the same\n * time budget as the native RAW tasks. How often it yields never changes the output.\n *\n * Inputs are read during `run()` and never written. Callers must not change them until `run()`\n * settles. Working memory is estimated in advance and capped by `maximumWorkingBytes`.\n * @see docs/PROCESSING.md for algorithms, sources, approximation status and limits.\n */\n\nimport type { CalculationProvenance } from \"../core/calculation-result.js\";\nimport { InvalidConfigurationError } from \"../core/configuration-error.js\";\nimport { InvalidScientificInputError, InvalidScientificResultError } from \"../core/validation.js\";\nimport { requireAllowlistedRecord } from \"../core/record-validation.js\";\nimport { DEFAULT_HOST_YIELD_CADENCE, createHostYieldGate, type HostYieldCadence } from \"../capture/host-yield-cadence.js\";\nimport type { NativeTaskProgress } from \"../output/native-capture-sdr.js\";\n\n/** Largest image (pixels per frame) any processing operator accepts. */\nexport const PROCESSING_MAX_PIXELS = 1 << 26;\n/** Largest number of input frames (brackets, focus slices, panorama frames). */\nexport const PROCESSING_MAX_FRAMES = 32;\n/** Default working-memory bound when `maximumWorkingBytes` is omitted (1 GiB). */\nexport const PROCESSING_DEFAULT_MAXIMUM_WORKING_BYTES = 1 << 30;\nexport const PROCESSING_MODEL_VERSION = \"1.0.0\" as const;\n\n/** Host hooks, the same shape as the native task providers. */\nexport interface ProcessingProvider {\n /** Must yield to the host event loop, allowing cancellation/input events between rows. */\n yieldControl(signal: AbortSignal): Promise<void>;\n /** Optional observer called after each processed row of each pass; cannot change output. */\n onProgress?(progress: NativeTaskProgress): void;\n}\n\nexport type ProcessingTaskState = \"ready\" | \"running\" | \"completed\" | \"cancelled\" | \"failed\" | \"disposed\" | \"transferred\";\n\n/** Single-use cancellable processing task. */\nexport interface ProcessingTask<T> {\n readonly state: ProcessingTaskState;\n /** Rows processed so far across every pass. */\n readonly completedTileCount: number;\n /** Total rows of every pass; known before `run()`. */\n readonly totalTileCount: number;\n /** Upper estimate of typed-array bytes allocated by the task, including its output. */\n readonly estimatedWorkingBytes: number;\n run(): Promise<void>;\n cancel(): void;\n dispose(): void;\n takeOutput(): T;\n}\n\n/** Interleaved RGB image: `data[(y·width + x)·3 + c]`, row-major, +Y down. */\nexport interface ProcessingRgbImage {\n width: number;\n height: number;\n data: Float32Array;\n}\n\n/** Linear RGB encodings the colour-aware operators accept (all D65). */\nexport type ProcessingLinearColorSpace = \"linear-srgb-d65\" | \"linear-display-p3-d65\" | \"linear-rec2020-d65\";\n\n/** Result provenance of a processing operator; processing outputs are never calibrated. */\nexport interface ProcessingProvenance extends CalculationProvenance {\n kind: \"approximation\";\n assumptions: readonly string[];\n}\n\nexport function processingProvenance(model: string, assumptions: readonly string[]): ProcessingProvenance {\n return { kind: \"approximation\", model, modelVersion: PROCESSING_MODEL_VERSION, assumptions: [...assumptions] };\n}\n\n/** Internal: a processing body yields once per processed row of every pass. */\nexport type ProcessingBody<T> = Generator<void, T, void>;\n\ninterface TaskSpec<T> {\n provider: unknown;\n totalTileCount: number;\n estimatedWorkingBytes: number;\n maximumWorkingBytes: number;\n body: () => ProcessingBody<T>;\n cadence?: HostYieldCadence;\n}\n\n/** Internal: wraps a row generator in the shared cancellable task contract. */\nexport function createProcessingTask<T>(spec: TaskSpec<T>): ProcessingTask<T> {\n const hooks = requireProvider(spec.provider);\n if (spec.estimatedWorkingBytes > spec.maximumWorkingBytes) {\n throw new InvalidConfigurationError(\"Processing working memory estimate (\" + spec.estimatedWorkingBytes + \" bytes) exceeds maximumWorkingBytes.\");\n }\n const yieldControl = hooks.yieldControl.bind(hooks), onProgress = hooks.onProgress?.bind(hooks);\n const abort = new AbortController(), total = spec.totalTileCount;\n let state: ProcessingTaskState = \"ready\", completed = 0, output: T | null = null;\n const check = (): void => { if (abort.signal.aborted) throw new InvalidConfigurationError(\"Processing task aborted.\"); };\n return {\n get state(): ProcessingTaskState { return state; },\n get completedTileCount(): number { return completed; },\n totalTileCount: total,\n estimatedWorkingBytes: spec.estimatedWorkingBytes,\n async run(): Promise<void> {\n if (state !== \"ready\") throw new InvalidConfigurationError(\"Processing task is single-use.\");\n state = \"running\";\n try {\n const gate = createHostYieldGate(spec.cadence ?? DEFAULT_HOST_YIELD_CADENCE), body = spec.body();\n for (;;) {\n check();\n const step = body.next();\n if (step.done === true) { output = step.value; break; }\n completed++;\n onProgress?.({ completedTileCount: completed, totalTileCount: total });\n if (gate.due()) { await yieldControl(abort.signal); check(); gate.restart(); }\n }\n if (completed !== total) throw new InvalidScientificResultError(\"Processing progress accounting disagrees with its plan.\");\n await yieldControl(abort.signal); check();\n state = \"completed\";\n } catch (error) {\n output = null;\n if (!abort.signal.aborted) { state = \"failed\"; abort.abort(); }\n throw error;\n }\n },\n cancel(): void { if (state === \"ready\" || state === \"running\" || state === \"completed\") { state = \"cancelled\"; abort.abort(); output = null; } },\n dispose(): void { if (state !== \"transferred\") { state = \"disposed\"; abort.abort(); output = null; } },\n takeOutput(): T {\n if (state !== \"completed\" || output === null) throw new InvalidConfigurationError(\"Processing output unavailable.\");\n const value = output; output = null; state = \"transferred\";\n return value;\n }\n };\n}\n\nfunction requireProvider(provider: unknown): ProcessingProvider {\n const hooks = provider as ProcessingProvider | null | undefined;\n if (hooks === null || typeof hooks !== \"object\" || typeof hooks.yieldControl !== \"function\" ||\n (hooks.onProgress !== undefined && typeof hooks.onProgress !== \"function\")) {\n throw new InvalidConfigurationError(\"Processing requires a provider { yieldControl, onProgress? }.\");\n }\n return hooks;\n}\n\n// ------------------------------------------------------------------ validation helpers (internal)\n\nexport function requireOptions(value: unknown, keys: readonly string[], label: string): Record<string, unknown> {\n return requireAllowlistedRecord(value, keys, label + \" must be an object with only the documented fields.\");\n}\n\nexport function requireFiniteIn(value: unknown, label: string, min: number, max: number, exclusiveMin = false): number {\n if (typeof value !== \"number\" || !Number.isFinite(value) || (exclusiveMin ? value <= min : value < min) || value > max) {\n throw new InvalidScientificInputError(label + \" must be a finite number in \" + (exclusiveMin ? \"(\" : \"[\") + min + \", \" + max + \"].\");\n }\n return value;\n}\n\nexport function optionalFiniteIn(value: unknown, fallback: number, label: string, min: number, max: number, exclusiveMin = false): number {\n return value === undefined ? fallback : requireFiniteIn(value, label, min, max, exclusiveMin);\n}\n\nexport function requireIntegerIn(value: unknown, label: string, min: number, max: number): number {\n if (typeof value !== \"number\" || !Number.isSafeInteger(value) || value < min || value > max) {\n throw new InvalidConfigurationError(label + \" must be an integer in [\" + min + \", \" + max + \"].\");\n }\n return value;\n}\n\nexport function optionalIntegerIn(value: unknown, fallback: number, label: string, min: number, max: number): number {\n return value === undefined ? fallback : requireIntegerIn(value, label, min, max);\n}\n\nexport function requireEnum<T extends string>(value: unknown, allowed: readonly T[], label: string, fallback?: T): T {\n if (value === undefined && fallback !== undefined) return fallback;\n if (typeof value !== \"string\" || !(allowed as readonly string[]).includes(value)) {\n throw new InvalidConfigurationError(label + \" must be one of \" + allowed.join(\", \") + \".\");\n }\n return value as T;\n}\n\nexport function maximumWorkingBytes(value: unknown): number {\n return optionalIntegerIn(value, PROCESSING_DEFAULT_MAXIMUM_WORKING_BYTES, \"maximumWorkingBytes\", 1, Number.MAX_SAFE_INTEGER);\n}\n\n/** Validates the shape (not the values) of an interleaved image; values are checked by `finiteRows`. */\nexport function requireImage(value: unknown, label: string, channels = 3): ProcessingRgbImage {\n const r = requireOptions(value, [\"width\", \"height\", \"data\"], label);\n const width = requireIntegerIn(r.width, label + \".width\", 1, PROCESSING_MAX_PIXELS);\n const height = requireIntegerIn(r.height, label + \".height\", 1, PROCESSING_MAX_PIXELS);\n if (width * height > PROCESSING_MAX_PIXELS) throw new InvalidConfigurationError(label + \" exceeds \" + PROCESSING_MAX_PIXELS + \" pixels.\");\n if (!(r.data instanceof Float32Array) || r.data.length !== width * height * channels) {\n throw new InvalidConfigurationError(label + \".data must be a Float32Array of width·height·\" + channels + \" samples.\");\n }\n return { width, height, data: r.data };\n}\n\n/** Validates 1..PROCESSING_MAX_FRAMES same-size images. */\nexport function requireImageList(value: unknown, label: string, minimum: number): ProcessingRgbImage[] {\n if (!Array.isArray(value) || value.length < minimum || value.length > PROCESSING_MAX_FRAMES) {\n throw new InvalidConfigurationError(label + \" must contain \" + minimum + \" to \" + PROCESSING_MAX_FRAMES + \" images.\");\n }\n const images = value.map((v, i) => requireImage(v, label + \"[\" + i + \"]\"));\n if (images.some((im) => im.width !== images[0]!.width || im.height !== images[0]!.height)) {\n throw new InvalidConfigurationError(label + \" images must share one size.\");\n }\n return images;\n}\n\n/** Row generator rejecting non-finite samples (one tile per row). */\nexport function* finiteRows(data: Float32Array, width: number, height: number, channels: number, label: string,\n minimum = -Infinity): ProcessingBody<void> {\n const stride = width * channels;\n for (let y = 0; y < height; y++) {\n for (let i = y * stride, end = i + stride; i < end; i++) {\n const v = data[i]!;\n if (!Number.isFinite(v) || v < minimum) throw new InvalidScientificInputError(label + \" samples must be finite\" + (minimum > -Infinity ? \" and ≥ \" + minimum : \"\") + \".\");\n }\n yield;\n }\n}\n"]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type ProcessingLinearColorSpace, type ProcessingProvenance, type ProcessingProvider, type ProcessingRgbImage, type ProcessingTask } from "./processing-task.js";
|
|
2
|
+
export interface ToneMappedImage extends ProcessingRgbImage {
|
|
3
|
+
/** Output components above 1 (left unclipped for the downstream gamut/encoding stage). */
|
|
4
|
+
aboveOneSampleCount: number;
|
|
5
|
+
provenance: ProcessingProvenance;
|
|
6
|
+
}
|
|
7
|
+
export interface ReinhardGlobalToneMappingInput {
|
|
8
|
+
image: ProcessingRgbImage;
|
|
9
|
+
inputColorSpace: ProcessingLinearColorSpace;
|
|
10
|
+
/** Key value a; default 0.18. */
|
|
11
|
+
key?: number;
|
|
12
|
+
/** Smallest scaled luminance mapped to white; default the largest scaled luminance. */
|
|
13
|
+
whiteLuminance?: number;
|
|
14
|
+
/** δ in the log-average exp(mean(log(δ + L_w))); default 1e-6. */
|
|
15
|
+
logAverageDelta?: number;
|
|
16
|
+
maximumWorkingBytes?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface ReinhardGlobalToneMappingOutput extends ToneMappedImage {
|
|
19
|
+
logAverageLuminance: number;
|
|
20
|
+
whiteLuminance: number;
|
|
21
|
+
}
|
|
22
|
+
/** Reinhard, Stark, Shirley & Ferwerda (2002) global photographic tone reproduction. */
|
|
23
|
+
export declare function createReinhardGlobalToneMappingTask(input: ReinhardGlobalToneMappingInput, provider: ProcessingProvider): ProcessingTask<ReinhardGlobalToneMappingOutput>;
|
|
24
|
+
export interface DurandDorseyToneMappingInput {
|
|
25
|
+
image: ProcessingRgbImage;
|
|
26
|
+
inputColorSpace: ProcessingLinearColorSpace;
|
|
27
|
+
/** Spatial σ in pixels; default 2% of the larger image side. */
|
|
28
|
+
spatialSigmaPixels?: number;
|
|
29
|
+
/** Range σ in log₁₀ luminance; default 0.4. */
|
|
30
|
+
rangeSigmaLog10?: number;
|
|
31
|
+
/** Target base-layer contrast ratio; default 5. */
|
|
32
|
+
targetContrast?: number;
|
|
33
|
+
/** Spatial downsampling factor of the fast bilateral filter; default max(1, round(σ_s/4)). */
|
|
34
|
+
downsampleFactor?: number;
|
|
35
|
+
maximumWorkingBytes?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface DurandDorseyToneMappingOutput extends ToneMappedImage {
|
|
38
|
+
/** Bilateral base layer (log₁₀ luminance) per pixel; −Infinity for pixels with luminance ≤ 0, which are excluded from the filter. */
|
|
39
|
+
baseLog10: Float32Array;
|
|
40
|
+
compressionFactor: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Durand & Dorsey (2002) bilateral base/detail tone mapping. The fast bilateral filter is the paper's
|
|
44
|
+
* piecewise-linear scheme:
|
|
45
|
+
* 1. Place intensity nodes i_j no more than σ_r apart.
|
|
46
|
+
* 2. For each node, compute J_j = (f ⊗ (g_r(I − i_j)·I)) / (f ⊗ g_r(I − i_j)) on a box-downsampled grid.
|
|
47
|
+
* 3. Upsample bilinearly, then interpolate linearly between the two nodes on either side of each
|
|
48
|
+
* full-resolution intensity.
|
|
49
|
+
*/
|
|
50
|
+
export declare function createDurandDorseyToneMappingTask(input: DurandDorseyToneMappingInput, provider: ProcessingProvider): ProcessingTask<DurandDorseyToneMappingOutput>;
|
|
51
|
+
export interface ExposureFusionInput {
|
|
52
|
+
/** Display-referred (e.g. sRGB-encoded) frames with values nominally in [0, 1]. */
|
|
53
|
+
frames: readonly ProcessingRgbImage[];
|
|
54
|
+
contrastExponent?: number;
|
|
55
|
+
saturationExponent?: number;
|
|
56
|
+
wellExposednessExponent?: number;
|
|
57
|
+
/** Well-exposedness Gaussian σ; default 0.2. */
|
|
58
|
+
wellExposednessSigma?: number;
|
|
59
|
+
/** Pyramid levels; default down to a 1-pixel side (at most 12). */
|
|
60
|
+
pyramidLevels?: number;
|
|
61
|
+
maximumWorkingBytes?: number;
|
|
62
|
+
}
|
|
63
|
+
export interface ExposureFusionOutput extends ProcessingRgbImage {
|
|
64
|
+
/** Components clipped to [0, 1] after collapsing the blended pyramid. */
|
|
65
|
+
clippedSampleCount: number;
|
|
66
|
+
provenance: ProcessingProvenance;
|
|
67
|
+
}
|
|
68
|
+
/** Mertens, Kautz & Van Reeth (2007) exposure fusion with Laplacian-pyramid blending. */
|
|
69
|
+
export declare function createExposureFusionTask(input: ExposureFusionInput, provider: ProcessingProvider): ProcessingTask<ExposureFusionOutput>;
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
/**
|
|
3
|
+
* HDR → SDR tone-mapping operators, and exposure fusion. Each is a named rendering choice (an
|
|
4
|
+
* approximation), not a perceptual or display-calibrated model:
|
|
5
|
+
* - Reinhard et al. 2002 global photographic operator: log-average key, L = a·L_w/L̄_w,
|
|
6
|
+
* L_d = L(1 + L/L_white²)/(1 + L); colour by the luminance ratio L_d/L_w (chromaticity-preserving).
|
|
7
|
+
* - Durand & Dorsey 2002 local operator: base = bilateral(log₁₀ L), detail = log₁₀ L − base,
|
|
8
|
+
* output log = base·c + detail − max(base)·c with c = log₁₀(contrast)/(max(base) − min(base)); the
|
|
9
|
+
* bilateral filter uses the paper's piecewise-linear acceleration with spatial downsampling.
|
|
10
|
+
* - Mertens, Kautz & Van Reeth 2007 exposure fusion of display-referred frames: per-pixel weight
|
|
11
|
+
* W = C^ωc·S^ωs·E^ωe from Laplacian contrast, RGB standard deviation and well-exposedness
|
|
12
|
+
* exp(−(v − 0.5)²/(2·0.2²)), normalized across frames and blended with Laplacian pyramids
|
|
13
|
+
* (Burt & Adelson 1983).
|
|
14
|
+
* The HDR operators output display-referred linear RGB in the input primaries; encode it with the SDR
|
|
15
|
+
* rendering functions. Fusion output stays in the (encoded) domain of its inputs.
|
|
16
|
+
* @see docs/PROCESSING.md for equations, sources and limits.
|
|
17
|
+
*/
|
|
18
|
+
import { autoLevels, collapse, collapseRows, convolveRows, convolveSeparable, gaussianKernel, gaussianPyramid, gaussianPyramidRows, laplacianPyramid, laplacianPyramidRows, luminanceWeights, pyramidBytes, reflect } from "./image-ops.js";
|
|
19
|
+
import { createProcessingTask, finiteRows, maximumWorkingBytes, optionalFiniteIn, optionalIntegerIn, processingProvenance, requireEnum, requireImage, requireImageList, requireOptions } from "./processing-task.js";
|
|
20
|
+
const SPACES = ["linear-srgb-d65", "linear-display-p3-d65", "linear-rec2020-d65"];
|
|
21
|
+
/** Reinhard, Stark, Shirley & Ferwerda (2002) global photographic tone reproduction. */
|
|
22
|
+
export function createReinhardGlobalToneMappingTask(input, provider) {
|
|
23
|
+
const r = requireOptions(input, ["image", "inputColorSpace", "key", "whiteLuminance", "logAverageDelta", "maximumWorkingBytes"], "createReinhardGlobalToneMappingTask input");
|
|
24
|
+
const image = requireImage(r.image, "image"), space = requireEnum(r.inputColorSpace, SPACES, "inputColorSpace");
|
|
25
|
+
const key = optionalFiniteIn(r.key, 0.18, "key", 0, 1e6, true), delta = optionalFiniteIn(r.logAverageDelta, 1e-6, "logAverageDelta", 0, 1, true);
|
|
26
|
+
const white = r.whiteLuminance === undefined ? undefined : optionalFiniteIn(r.whiteLuminance, 1, "whiteLuminance", 0, 1e12, true);
|
|
27
|
+
const [wr, wg, wb] = luminanceWeights(space), h = image.height, stride = image.width * 3, n = image.width * h;
|
|
28
|
+
return createProcessingTask({
|
|
29
|
+
provider, totalTileCount: 3 * h, estimatedWorkingBytes: n * 12, maximumWorkingBytes: maximumWorkingBytes(r.maximumWorkingBytes),
|
|
30
|
+
body: function* () {
|
|
31
|
+
yield* finiteRows(image.data, image.width, h, 3, "image");
|
|
32
|
+
const d = image.data;
|
|
33
|
+
let logSum = 0, maxL = 0;
|
|
34
|
+
for (let y = 0; y < h; y++) {
|
|
35
|
+
for (let i = y * stride; i < (y + 1) * stride; i += 3) {
|
|
36
|
+
const l = Math.max(0, wr * d[i] + wg * d[i + 1] + wb * d[i + 2]);
|
|
37
|
+
logSum += Math.log(delta + l);
|
|
38
|
+
maxL = Math.max(maxL, l);
|
|
39
|
+
}
|
|
40
|
+
yield;
|
|
41
|
+
}
|
|
42
|
+
const logAverage = Math.exp(logSum / n), scale = key / logAverage, lWhite = white ?? Math.max(maxL * scale, Number.MIN_VALUE);
|
|
43
|
+
const out = new Float32Array(3 * n);
|
|
44
|
+
let above = 0;
|
|
45
|
+
for (let y = 0; y < h; y++) {
|
|
46
|
+
for (let i = y * stride; i < (y + 1) * stride; i += 3) {
|
|
47
|
+
const lw = wr * d[i] + wg * d[i + 1] + wb * d[i + 2];
|
|
48
|
+
if (!(lw > 0)) {
|
|
49
|
+
out[i] = 0;
|
|
50
|
+
out[i + 1] = 0;
|
|
51
|
+
out[i + 2] = 0;
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
const l = scale * lw, ld = l * (1 + l / (lWhite * lWhite)) / (1 + l), ratio = ld / lw;
|
|
55
|
+
for (let c = 0; c < 3; c++) {
|
|
56
|
+
const v = (out[i + c] = Math.max(0, d[i + c]) * ratio);
|
|
57
|
+
if (v > 1)
|
|
58
|
+
above++;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
yield;
|
|
62
|
+
}
|
|
63
|
+
return { width: image.width, height: h, data: out, aboveOneSampleCount: above, logAverageLuminance: logAverage, whiteLuminance: lWhite,
|
|
64
|
+
provenance: processingProvenance("tone-reinhard-2002-global", [
|
|
65
|
+
"Global photographic operator L_d = L(1 + L/L_white^2)/(1 + L) with L = a L_w / exp(mean log(delta + L_w)).",
|
|
66
|
+
"Colour scaled by L_d/L_w (preserves chromaticity); negative components and non-positive luminance map to 0.",
|
|
67
|
+
"Display-referred linear output; no dodging-and-burning (local) variant, gamut mapping or transfer encoding."
|
|
68
|
+
]) };
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Durand & Dorsey (2002) bilateral base/detail tone mapping. The fast bilateral filter is the paper's
|
|
74
|
+
* piecewise-linear scheme:
|
|
75
|
+
* 1. Place intensity nodes i_j no more than σ_r apart.
|
|
76
|
+
* 2. For each node, compute J_j = (f ⊗ (g_r(I − i_j)·I)) / (f ⊗ g_r(I − i_j)) on a box-downsampled grid.
|
|
77
|
+
* 3. Upsample bilinearly, then interpolate linearly between the two nodes on either side of each
|
|
78
|
+
* full-resolution intensity.
|
|
79
|
+
*/
|
|
80
|
+
export function createDurandDorseyToneMappingTask(input, provider) {
|
|
81
|
+
const r = requireOptions(input, ["image", "inputColorSpace", "spatialSigmaPixels", "rangeSigmaLog10", "targetContrast", "downsampleFactor",
|
|
82
|
+
"maximumWorkingBytes"], "createDurandDorseyToneMappingTask input");
|
|
83
|
+
const image = requireImage(r.image, "image"), space = requireEnum(r.inputColorSpace, SPACES, "inputColorSpace");
|
|
84
|
+
const W = image.width, H = image.height, n = W * H;
|
|
85
|
+
const sigmaS = optionalFiniteIn(r.spatialSigmaPixels, Math.max(0.5, 0.02 * Math.max(W, H)), "spatialSigmaPixels", 0, 1e5, true);
|
|
86
|
+
const sigmaR = optionalFiniteIn(r.rangeSigmaLog10, 0.4, "rangeSigmaLog10", 0, 100, true);
|
|
87
|
+
const contrast = optionalFiniteIn(r.targetContrast, 5, "targetContrast", 1, 1e12, true);
|
|
88
|
+
const z = optionalIntegerIn(r.downsampleFactor, Math.max(1, Math.round(sigmaS / 4)), "downsampleFactor", 1, 1024);
|
|
89
|
+
const cw = Math.ceil(W / z), ch = Math.ceil(H / z), kernel = gaussianKernel(sigmaS / z);
|
|
90
|
+
const [wr, wg, wb] = luminanceWeights(space);
|
|
91
|
+
// Node count depends on the data range; the plan bounds it by the float32 log₁₀ range (≈ 90 decades).
|
|
92
|
+
const maxNodes = Math.ceil(90 / sigmaR) + 2;
|
|
93
|
+
const nodeRows = 2 * convolveRows(ch) + ch;
|
|
94
|
+
return createProcessingTask({
|
|
95
|
+
provider, totalTileCount: 4 * H + ch + maxNodes * nodeRows, estimatedWorkingBytes: n * (3 * 4 + 4 + 4) + cw * ch * 4 * 6 + Math.min(maxNodes, 4096) * cw * ch * 4,
|
|
96
|
+
maximumWorkingBytes: maximumWorkingBytes(r.maximumWorkingBytes),
|
|
97
|
+
body: function* () {
|
|
98
|
+
yield* finiteRows(image.data, W, H, 3, "image");
|
|
99
|
+
const d = image.data, logL = new Float32Array(n);
|
|
100
|
+
// Pixels with luminance ≤ 0 have no finite log₁₀; they are marked −∞, excluded from the filter and from the
|
|
101
|
+
// ranges below, and output as 0 by the colour pass.
|
|
102
|
+
for (let y = 0; y < H; y++) {
|
|
103
|
+
for (let x = 0; x < W; x++) {
|
|
104
|
+
const i = y * W + x, l = wr * d[3 * i] + wg * d[3 * i + 1] + wb * d[3 * i + 2];
|
|
105
|
+
logL[i] = l > 0 ? Math.log10(l) : -Infinity;
|
|
106
|
+
}
|
|
107
|
+
yield;
|
|
108
|
+
}
|
|
109
|
+
const coarse = new Float32Array(cw * ch);
|
|
110
|
+
let lo = Infinity, hi = -Infinity;
|
|
111
|
+
for (let y = 0; y < ch; y++) {
|
|
112
|
+
for (let x = 0; x < cw; x++) {
|
|
113
|
+
let s = 0, c = 0;
|
|
114
|
+
for (let yy = y * z; yy < Math.min(H, (y + 1) * z); yy++)
|
|
115
|
+
for (let xx = x * z; xx < Math.min(W, (x + 1) * z); xx++) {
|
|
116
|
+
const v = logL[yy * W + xx];
|
|
117
|
+
if (v > -Infinity) {
|
|
118
|
+
s += v;
|
|
119
|
+
c++;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
// A cell with no positive-luminance pixel is NaN and carries zero filter weight.
|
|
123
|
+
const v = (coarse[y * cw + x] = c > 0 ? s / c : NaN);
|
|
124
|
+
if (c > 0) {
|
|
125
|
+
lo = Math.min(lo, v);
|
|
126
|
+
hi = Math.max(hi, v);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
yield;
|
|
130
|
+
}
|
|
131
|
+
for (let i = 0; i < n; i++)
|
|
132
|
+
if (logL[i] > -Infinity) {
|
|
133
|
+
lo = Math.min(lo, logL[i]);
|
|
134
|
+
hi = Math.max(hi, logL[i]);
|
|
135
|
+
}
|
|
136
|
+
if (!(hi >= lo)) {
|
|
137
|
+
lo = 0;
|
|
138
|
+
hi = 0;
|
|
139
|
+
} // all-zero image
|
|
140
|
+
const nodes = hi > lo ? Math.min(maxNodes, Math.ceil((hi - lo) / sigmaR) + 1) : 1;
|
|
141
|
+
const step = nodes > 1 ? (hi - lo) / (nodes - 1) : 0, J = [];
|
|
142
|
+
const g = new Float32Array(cw * ch), hgt = new Float32Array(cw * ch), tmp = new Float32Array(cw * ch), gs = new Float32Array(cw * ch), hs = new Float32Array(cw * ch);
|
|
143
|
+
for (let j = 0; j < maxNodes; j++) {
|
|
144
|
+
if (j >= nodes) {
|
|
145
|
+
for (let k = 0; k < nodeRows; k++)
|
|
146
|
+
yield;
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
const node = lo + j * step;
|
|
150
|
+
for (let i = 0; i < cw * ch; i++) {
|
|
151
|
+
const c = coarse[i];
|
|
152
|
+
if (Number.isNaN(c)) {
|
|
153
|
+
g[i] = 0;
|
|
154
|
+
hgt[i] = 0;
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
const w = Math.exp(-((c - node) ** 2) / (2 * sigmaR * sigmaR));
|
|
158
|
+
g[i] = w;
|
|
159
|
+
hgt[i] = w * c;
|
|
160
|
+
}
|
|
161
|
+
yield* convolveSeparable(g, cw, ch, 1, kernel, tmp, gs);
|
|
162
|
+
yield* convolveSeparable(hgt, cw, ch, 1, kernel, tmp, hs);
|
|
163
|
+
const out = new Float32Array(cw * ch);
|
|
164
|
+
for (let y = 0; y < ch; y++) {
|
|
165
|
+
for (let i = y * cw; i < (y + 1) * cw; i++)
|
|
166
|
+
out[i] = gs[i] > 0 ? hs[i] / gs[i] : node;
|
|
167
|
+
yield;
|
|
168
|
+
}
|
|
169
|
+
J.push(out);
|
|
170
|
+
}
|
|
171
|
+
const sample = (plane, x, y) => {
|
|
172
|
+
const fx = Math.min(Math.max((x + 0.5) / z - 0.5, 0), cw - 1), fy = Math.min(Math.max((y + 0.5) / z - 0.5, 0), ch - 1);
|
|
173
|
+
const x0 = Math.floor(fx), y0 = Math.floor(fy), x1 = Math.min(x0 + 1, cw - 1), y1 = Math.min(y0 + 1, ch - 1), ax = fx - x0, ay = fy - y0;
|
|
174
|
+
return (1 - ay) * ((1 - ax) * plane[y0 * cw + x0] + ax * plane[y0 * cw + x1]) + ay * ((1 - ax) * plane[y1 * cw + x0] + ax * plane[y1 * cw + x1]);
|
|
175
|
+
};
|
|
176
|
+
const base = new Float32Array(n);
|
|
177
|
+
let bLo = Infinity, bHi = -Infinity;
|
|
178
|
+
for (let y = 0; y < H; y++) {
|
|
179
|
+
for (let x = 0; x < W; x++) {
|
|
180
|
+
const i = y * W + x, v = logL[i];
|
|
181
|
+
if (!(v > -Infinity)) {
|
|
182
|
+
base[i] = -Infinity;
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
let b;
|
|
186
|
+
if (nodes === 1)
|
|
187
|
+
b = sample(J[0], x, y);
|
|
188
|
+
else {
|
|
189
|
+
const t = Math.min(Math.max((v - lo) / step, 0), nodes - 1), j0 = Math.min(Math.floor(t), nodes - 2), a = t - j0;
|
|
190
|
+
b = (1 - a) * sample(J[j0], x, y) + a * sample(J[j0 + 1], x, y);
|
|
191
|
+
}
|
|
192
|
+
base[i] = b;
|
|
193
|
+
bLo = Math.min(bLo, b);
|
|
194
|
+
bHi = Math.max(bHi, b);
|
|
195
|
+
}
|
|
196
|
+
yield;
|
|
197
|
+
}
|
|
198
|
+
if (!(bHi >= bLo)) {
|
|
199
|
+
bLo = 0;
|
|
200
|
+
bHi = 0;
|
|
201
|
+
} // all-zero image
|
|
202
|
+
const factor = bHi > bLo ? Math.log10(contrast) / (bHi - bLo) : 1, offset = bHi * factor, out = new Float32Array(3 * n);
|
|
203
|
+
let above = 0;
|
|
204
|
+
for (let y = 0; y < H; y++) {
|
|
205
|
+
for (let i = y * W; i < (y + 1) * W; i++) {
|
|
206
|
+
const lw = wr * d[3 * i] + wg * d[3 * i + 1] + wb * d[3 * i + 2];
|
|
207
|
+
if (!(lw > 0)) {
|
|
208
|
+
out[3 * i] = 0;
|
|
209
|
+
out[3 * i + 1] = 0;
|
|
210
|
+
out[3 * i + 2] = 0;
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
const ratio = 10 ** (base[i] * factor + (logL[i] - base[i]) - offset) / lw;
|
|
214
|
+
for (let c = 0; c < 3; c++) {
|
|
215
|
+
const v = (out[3 * i + c] = Math.max(0, d[3 * i + c]) * ratio);
|
|
216
|
+
if (v > 1)
|
|
217
|
+
above++;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
yield;
|
|
221
|
+
}
|
|
222
|
+
return { width: W, height: H, data: out, baseLog10: base, compressionFactor: factor, aboveOneSampleCount: above,
|
|
223
|
+
provenance: processingProvenance("tone-durand-dorsey-2002-bilateral", [
|
|
224
|
+
"Base = fast piecewise-linear bilateral filter of log10 luminance (spatial sigma " + sigmaS + " px, range sigma " + sigmaR + ", downsampling " + z + ").",
|
|
225
|
+
"Base compressed to a " + contrast + ":1 contrast, detail kept, largest base mapped to luminance 1.",
|
|
226
|
+
"Colour scaled by the luminance ratio; display-referred linear output without gamut mapping or transfer encoding."
|
|
227
|
+
]) };
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
// Patent note (public record, not legal advice): standard Mertens et al. Laplacian-pyramid fusion. CyberLink
|
|
232
|
+
// US 8,885,976 (in force to 2034) claims a specific merged-pyramid variant that this implementation does not use;
|
|
233
|
+
// see THIRD_PARTY.md.
|
|
234
|
+
/** Mertens, Kautz & Van Reeth (2007) exposure fusion with Laplacian-pyramid blending. */
|
|
235
|
+
export function createExposureFusionTask(input, provider) {
|
|
236
|
+
const r = requireOptions(input, ["frames", "contrastExponent", "saturationExponent", "wellExposednessExponent", "wellExposednessSigma",
|
|
237
|
+
"pyramidLevels", "maximumWorkingBytes"], "createExposureFusionTask input");
|
|
238
|
+
const frames = requireImageList(r.frames, "frames", 1), W = frames[0].width, H = frames[0].height, n = W * H, K = frames.length;
|
|
239
|
+
const wc = optionalFiniteIn(r.contrastExponent, 1, "contrastExponent", 0, 16), ws = optionalFiniteIn(r.saturationExponent, 1, "saturationExponent", 0, 16);
|
|
240
|
+
const we = optionalFiniteIn(r.wellExposednessExponent, 1, "wellExposednessExponent", 0, 16), sigma = optionalFiniteIn(r.wellExposednessSigma, 0.2, "wellExposednessSigma", 0, 10, true);
|
|
241
|
+
const levels = optionalIntegerIn(r.pyramidLevels, autoLevels(W, H, 12), "pyramidLevels", 1, autoLevels(W, H, 32));
|
|
242
|
+
const rows = K * H + H + K * (laplacianPyramidRows(W, H, levels) + gaussianPyramidRows(W, H, levels)) + collapseRows(W, H, levels) + H;
|
|
243
|
+
return createProcessingTask({
|
|
244
|
+
provider, totalTileCount: K * H + rows, estimatedWorkingBytes: K * n * 4 + 3 * pyramidBytes(W, H, 3, levels) + 2 * pyramidBytes(W, H, 1, levels) + n * 12,
|
|
245
|
+
maximumWorkingBytes: maximumWorkingBytes(r.maximumWorkingBytes),
|
|
246
|
+
body: function* () {
|
|
247
|
+
for (const [k, f] of frames.entries())
|
|
248
|
+
yield* finiteRows(f.data, W, H, 3, "frames[" + k + "]");
|
|
249
|
+
const weights = frames.map(() => new Float32Array(n)), [lr, lg, lb] = luminanceWeights("linear-srgb-d65");
|
|
250
|
+
for (const [k, f] of frames.entries()) {
|
|
251
|
+
const d = f.data, w = weights[k];
|
|
252
|
+
const gray = (x, y) => { const i = 3 * (reflect(y, H) * W + reflect(x, W)); return lr * d[i] + lg * d[i + 1] + lb * d[i + 2]; };
|
|
253
|
+
for (let y = 0; y < H; y++) {
|
|
254
|
+
for (let x = 0; x < W; x++) {
|
|
255
|
+
const i = y * W + x, R = d[3 * i], G = d[3 * i + 1], B = d[3 * i + 2];
|
|
256
|
+
const c = Math.abs(gray(x - 1, y) + gray(x + 1, y) + gray(x, y - 1) + gray(x, y + 1) - 4 * gray(x, y));
|
|
257
|
+
const mu = (R + G + B) / 3, s = Math.sqrt(((R - mu) ** 2 + (G - mu) ** 2 + (B - mu) ** 2) / 3);
|
|
258
|
+
const e = Math.exp(-((R - 0.5) ** 2 + (G - 0.5) ** 2 + (B - 0.5) ** 2) / (2 * sigma * sigma));
|
|
259
|
+
w[i] = c ** wc * s ** ws * e ** we + 1e-12;
|
|
260
|
+
}
|
|
261
|
+
yield;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
for (let y = 0; y < H; y++) {
|
|
265
|
+
for (let i = y * W; i < (y + 1) * W; i++) {
|
|
266
|
+
let sum = 0;
|
|
267
|
+
for (const w of weights)
|
|
268
|
+
sum += w[i];
|
|
269
|
+
for (const w of weights)
|
|
270
|
+
w[i] = w[i] / sum;
|
|
271
|
+
}
|
|
272
|
+
yield;
|
|
273
|
+
}
|
|
274
|
+
let acc = null, sizes = [];
|
|
275
|
+
for (const [k, f] of frames.entries()) {
|
|
276
|
+
const lap = yield* laplacianPyramid(f.data, W, H, 3, levels), gw = yield* gaussianPyramid(weights[k], W, H, 1, levels);
|
|
277
|
+
sizes = lap.sizes;
|
|
278
|
+
acc ??= lap.sizes.map((s) => new Float32Array(s.width * s.height * 3));
|
|
279
|
+
for (let l = 0; l < levels; l++) {
|
|
280
|
+
const a = acc[l], L = lap.levels[l], G = gw.levels[l];
|
|
281
|
+
for (let i = 0; i < G.length; i++)
|
|
282
|
+
for (let c = 0; c < 3; c++)
|
|
283
|
+
a[3 * i + c] = a[3 * i + c] + G[i] * L[3 * i + c];
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
const fused = yield* collapse({ levels: acc, sizes, channels: 3 });
|
|
287
|
+
let clipped = 0;
|
|
288
|
+
for (let y = 0; y < H; y++) {
|
|
289
|
+
for (let i = 3 * y * W; i < 3 * (y + 1) * W; i++) {
|
|
290
|
+
const v = fused[i];
|
|
291
|
+
if (v < 0) {
|
|
292
|
+
fused[i] = 0;
|
|
293
|
+
clipped++;
|
|
294
|
+
}
|
|
295
|
+
else if (v > 1) {
|
|
296
|
+
fused[i] = 1;
|
|
297
|
+
clipped++;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
yield;
|
|
301
|
+
}
|
|
302
|
+
return { width: W, height: H, data: fused, clippedSampleCount: clipped, provenance: processingProvenance("exposure-fusion-mertens-2007", [
|
|
303
|
+
"Weights: |3x3 Laplacian of Rec.709 luma|^wc * RGB std^ws * prod exp(-(v-0.5)^2/(2 sigma^2))^we, normalized per pixel.",
|
|
304
|
+
"Laplacian-pyramid blending with Burt-Adelson 5-tap kernel and reflect-101 borders; output clipped to [0, 1].",
|
|
305
|
+
"Display-referred blending of registered frames; not a radiance estimate."
|
|
306
|
+
]) };
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
//# sourceMappingURL=tone-mapping.js.map
|