@automovie/render 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (681) hide show
  1. package/lib/IAutoMovieCaptionEntry.d.ts +1 -28
  2. package/lib/IAutoMovieCaptionSidecar.d.ts +1 -25
  3. package/lib/IAutoMovieCapturedFrame.d.ts +1 -22
  4. package/lib/IAutoMovieGuidePassOutput.d.ts +1 -23
  5. package/lib/IAutoMoviePoseKeypointActor.d.ts +1 -36
  6. package/lib/IAutoMoviePoseKeypointFrame.d.ts +1 -25
  7. package/lib/IAutoMoviePoseKeypointSidecar.d.ts +1 -21
  8. package/lib/IAutoMovieRenderAdapters.d.ts +1 -34
  9. package/lib/IAutoMovieRenderAndSeeRequest.d.ts +1 -32
  10. package/lib/IAutoMovieRenderAndSeeResult.d.ts +1 -20
  11. package/lib/IAutoMovieRenderChunk.d.ts +1 -48
  12. package/lib/IAutoMovieRenderChunkPlan.d.ts +1 -32
  13. package/lib/IAutoMovieRenderPassManifest.d.ts +1 -21
  14. package/lib/IAutoMovieRenderReassembly.d.ts +1 -24
  15. package/lib/IAutoMovieRenderResult.d.ts +1 -39
  16. package/lib/IAutoMovieSequenceRenderAdapters.d.ts +1 -36
  17. package/lib/IAutoMovieSequenceRenderAndSeeRequest.d.ts +1 -36
  18. package/lib/IAutoMovieSequenceRenderAndSeeResult.d.ts +1 -23
  19. package/lib/IAutoMovieSequenceRenderFrame.d.ts +1 -41
  20. package/lib/IAutoMovieSequenceRenderPlan.d.ts +1 -76
  21. package/lib/IAutoMovieSequenceRenderResult.d.ts +1 -44
  22. package/lib/IAutoMovieSequenceRenderShotSpan.d.ts +1 -39
  23. package/lib/IAutoMovieSequenceRenderTransitionSpan.d.ts +1 -39
  24. package/lib/audio/mixAutoMovieAudioPcm.d.ts +2 -39
  25. package/lib/audio/mixAutoMovieAudioPcm.js.map +1 -1
  26. package/lib/audio/mixAutoMovieAudioPcm.mjs.map +1 -1
  27. package/lib/auditAutoMovieRenderObservation.d.ts +2 -14
  28. package/lib/auditAutoMovieRenderObservation.js.map +1 -1
  29. package/lib/auditAutoMovieRenderObservation.mjs.map +1 -1
  30. package/lib/cache/createAutoMovieHttpArtifactStore.d.ts +1 -1
  31. package/lib/cache/createAutoMovieHttpArtifactStore.mjs.map +1 -1
  32. package/lib/caption/IAutoMovieBeatCaption.d.ts +1 -22
  33. package/lib/caption/beatCaptions.d.ts +1 -2
  34. package/lib/caption/beatCaptions.js.map +1 -1
  35. package/lib/caption/beatCaptions.mjs.map +1 -1
  36. package/lib/caption/inspectAutoMovieCaptionReadabilityWithRuntime.d.ts +1 -12
  37. package/lib/caption/inspectAutoMovieCaptionReadabilityWithRuntime.js.map +1 -1
  38. package/lib/caption/inspectAutoMovieCaptionReadabilityWithRuntime.mjs.map +1 -1
  39. package/lib/caption/parseAutoMovieCaptionLanguage.d.ts +1 -14
  40. package/lib/caption/parseAutoMovieCaptionLanguage.js.map +1 -1
  41. package/lib/caption/parseAutoMovieCaptionLanguage.mjs.map +1 -1
  42. package/lib/capture/AutoMovieCaptureFolder.d.ts +3 -13
  43. package/lib/capture/AutoMovieCaptureFolder.js.map +1 -1
  44. package/lib/capture/AutoMovieCaptureFolder.mjs.map +1 -1
  45. package/lib/capture/IAutoMovieCaptureBudget.d.ts +1 -24
  46. package/lib/capture/IAutoMovieCaptureCell.d.ts +1 -33
  47. package/lib/capture/IAutoMovieCaptureComparison.d.ts +1 -75
  48. package/lib/capture/IAutoMovieCaptureDrawing.d.ts +1 -56
  49. package/lib/capture/IAutoMovieCaptureLayout.d.ts +1 -47
  50. package/lib/capture/IAutoMovieCapturePlan.d.ts +1 -30
  51. package/lib/capture/IAutoMovieCapturePlanRequest.d.ts +1 -97
  52. package/lib/capture/IAutoMovieCaptureRecord.d.ts +1 -134
  53. package/lib/capture/IAutoMovieCaptureRequestSource.d.ts +1 -36
  54. package/lib/capture/IAutoMovieCaptureResolution.d.ts +1 -20
  55. package/lib/capture/IAutoMovieCaptureSelection.d.ts +1 -23
  56. package/lib/capture/IAutoMovieCaptureStorage.d.ts +1 -76
  57. package/lib/capture/IAutoMovieCaptureSubject.d.ts +1 -81
  58. package/lib/capture/IAutoMovieCaptureTime.d.ts +1 -16
  59. package/lib/capture/IAutoMovieCaptureWindow.d.ts +1 -24
  60. package/lib/capture/compareAutoMovieCaptureRounds.d.ts +2 -23
  61. package/lib/capture/compareAutoMovieCaptureRounds.js.map +1 -1
  62. package/lib/capture/compareAutoMovieCaptureRounds.mjs.map +1 -1
  63. package/lib/capture/formatAutoMovieCapturePlanRequest.d.ts +1 -1
  64. package/lib/capture/formatAutoMovieCapturePlanRequest.js.map +1 -1
  65. package/lib/capture/formatAutoMovieCapturePlanRequest.mjs.map +1 -1
  66. package/lib/capture/markAutoMovieCaptureCell.d.ts +1 -1
  67. package/lib/capture/markAutoMovieCaptureCell.mjs.map +1 -1
  68. package/lib/capture/parseAutoMovieCapturePlanRequest.d.ts +1 -2
  69. package/lib/capture/parseAutoMovieCapturePlanRequest.js.map +1 -1
  70. package/lib/capture/parseAutoMovieCapturePlanRequest.mjs.map +1 -1
  71. package/lib/capture/planAutoMovieCapture.d.ts +2 -11
  72. package/lib/capture/planAutoMovieCapture.js.map +1 -1
  73. package/lib/capture/planAutoMovieCapture.mjs.map +1 -1
  74. package/lib/capture/planAutoMovieCaptureFrames.d.ts +2 -22
  75. package/lib/capture/planAutoMovieCaptureFrames.js.map +1 -1
  76. package/lib/capture/planAutoMovieCaptureFrames.mjs.map +1 -1
  77. package/lib/capture/planAutoMovieCaptureLayout.d.ts +2 -16
  78. package/lib/capture/planAutoMovieCaptureLayout.js.map +1 -1
  79. package/lib/capture/planAutoMovieCaptureLayout.mjs.map +1 -1
  80. package/lib/capture/planAutoMovieVideoFrames.d.ts +2 -8
  81. package/lib/capture/planAutoMovieVideoFrames.js.map +1 -1
  82. package/lib/capture/planAutoMovieVideoFrames.mjs.map +1 -1
  83. package/lib/capture/planAutoMovieVideoSceneCuts.d.ts +2 -8
  84. package/lib/capture/planAutoMovieVideoSceneCuts.js.map +1 -1
  85. package/lib/capture/planAutoMovieVideoSceneCuts.mjs.map +1 -1
  86. package/lib/capture/readAutoMovieVideoSceneCuts.d.ts +2 -6
  87. package/lib/capture/readAutoMovieVideoSceneCuts.js.map +1 -1
  88. package/lib/capture/readAutoMovieVideoSceneCuts.mjs.map +1 -1
  89. package/lib/capture/resolveAutoMovieCapturePatterns.d.ts +2 -10
  90. package/lib/capture/resolveAutoMovieCapturePatterns.js.map +1 -1
  91. package/lib/capture/resolveAutoMovieCapturePatterns.mjs.map +1 -1
  92. package/lib/capture/runAutoMovieCapture.d.ts +2 -21
  93. package/lib/capture/runAutoMovieCapture.js.map +1 -1
  94. package/lib/capture/runAutoMovieCapture.mjs.map +1 -1
  95. package/lib/capture/runAutoMovieVideoCapture.d.ts +2 -20
  96. package/lib/capture/runAutoMovieVideoCapture.js.map +1 -1
  97. package/lib/capture/runAutoMovieVideoCapture.mjs.map +1 -1
  98. package/lib/capture/scaleAutoMovieCaptureLabels.d.ts +2 -5
  99. package/lib/capture/scaleAutoMovieCaptureLabels.js.map +1 -1
  100. package/lib/capture/scaleAutoMovieCaptureLabels.mjs.map +1 -1
  101. package/lib/delivery/AUTOMOVIE_MP4_SRGB_COLOUR.d.ts +2 -6
  102. package/lib/delivery/AUTOMOVIE_MP4_SRGB_COLOUR.js.map +1 -1
  103. package/lib/delivery/AUTOMOVIE_MP4_SRGB_COLOUR.mjs.map +1 -1
  104. package/lib/delivery/AUTOMOVIE_PRODUCTION_OPUS_PROFILE.d.ts +2 -14
  105. package/lib/delivery/AUTOMOVIE_PRODUCTION_OPUS_PROFILE.js.map +1 -1
  106. package/lib/delivery/AUTOMOVIE_PRODUCTION_OPUS_PROFILE.mjs.map +1 -1
  107. package/lib/delivery/AutoMovieProductionPngRole.d.ts +1 -14
  108. package/lib/delivery/IAutoMovieProductionPngProfile.d.ts +1 -41
  109. package/lib/delivery/IAutoMovieProductionVideoProfile.d.ts +1 -46
  110. package/lib/delivery/assertAutoMovieCaptureClock.d.ts +2 -9
  111. package/lib/delivery/assertAutoMovieCaptureClock.js.map +1 -1
  112. package/lib/delivery/assertAutoMovieCaptureClock.mjs.map +1 -1
  113. package/lib/delivery/assertProductionPngPicture.d.ts +2 -6
  114. package/lib/delivery/assertProductionPngPicture.js.map +1 -1
  115. package/lib/delivery/assertProductionPngPicture.mjs.map +1 -1
  116. package/lib/delivery/assertProductionVideoProfile.d.ts +2 -6
  117. package/lib/delivery/assertProductionVideoProfile.js.map +1 -1
  118. package/lib/delivery/assertProductionVideoProfile.mjs.map +1 -1
  119. package/lib/delivery/auditAutoMovieDecodedFrames.d.ts +2 -35
  120. package/lib/delivery/auditAutoMovieDecodedFrames.js.map +1 -1
  121. package/lib/delivery/auditAutoMovieDecodedFrames.mjs.map +1 -1
  122. package/lib/delivery/auditAutoMovieEncodedPresentation.d.ts +2 -8
  123. package/lib/delivery/auditAutoMovieEncodedPresentation.js.map +1 -1
  124. package/lib/delivery/auditAutoMovieEncodedPresentation.mjs.map +1 -1
  125. package/lib/delivery/planAutoMovieVideoEncoding.d.ts +2 -18
  126. package/lib/delivery/planAutoMovieVideoEncoding.js.map +1 -1
  127. package/lib/delivery/planAutoMovieVideoEncoding.mjs.map +1 -1
  128. package/lib/delivery/productionOpusDescription.d.ts +2 -6
  129. package/lib/delivery/productionOpusDescription.js.map +1 -1
  130. package/lib/delivery/productionOpusDescription.mjs.map +1 -1
  131. package/lib/delivery/resolveProductionPngProfile.d.ts +2 -7
  132. package/lib/delivery/resolveProductionPngProfile.js.map +1 -1
  133. package/lib/delivery/resolveProductionPngProfile.mjs.map +1 -1
  134. package/lib/delivery/resolveProductionVideoProfile.d.ts +2 -7
  135. package/lib/delivery/resolveProductionVideoProfile.js.map +1 -1
  136. package/lib/delivery/resolveProductionVideoProfile.mjs.map +1 -1
  137. package/lib/draw/AutoMovieDrawSession.d.ts +3 -16
  138. package/lib/draw/AutoMovieDrawSession.js.map +1 -1
  139. package/lib/draw/AutoMovieDrawSession.mjs.map +1 -1
  140. package/lib/draw/IAutoMovieDrawCall.d.ts +1 -27
  141. package/lib/draw/IAutoMovieDrawDescription.d.ts +1 -15
  142. package/lib/draw/IAutoMovieDrawFunction.d.ts +1 -3
  143. package/lib/draw/IAutoMovieDrawResult.d.ts +1 -36
  144. package/lib/draw/IAutoMovieDrawScene.d.ts +9 -2
  145. package/lib/draw/decodeAutoMovieDrawPixels.d.ts +2 -6
  146. package/lib/draw/decodeAutoMovieDrawPixels.js.map +1 -1
  147. package/lib/draw/decodeAutoMovieDrawPixels.mjs.map +1 -1
  148. package/lib/draw/describeAutoMovieDrawScene.d.ts +4 -4
  149. package/lib/draw/describeAutoMovieDrawScene.js +10 -4
  150. package/lib/draw/describeAutoMovieDrawScene.js.map +1 -1
  151. package/lib/draw/describeAutoMovieDrawScene.mjs +8 -4
  152. package/lib/draw/describeAutoMovieDrawScene.mjs.map +1 -1
  153. package/lib/draw/index.d.ts +1 -0
  154. package/lib/draw/index.js +1 -0
  155. package/lib/draw/index.js.map +1 -1
  156. package/lib/draw/index.mjs +2 -1
  157. package/lib/draw/installAutoMovieDraw.d.ts +6 -6
  158. package/lib/draw/installAutoMovieDraw.js +18 -23
  159. package/lib/draw/installAutoMovieDraw.js.map +1 -1
  160. package/lib/draw/installAutoMovieDraw.mjs +16 -23
  161. package/lib/draw/installAutoMovieDraw.mjs.map +1 -1
  162. package/lib/draw/planAutoMovieDrawCall.d.ts +1 -3
  163. package/lib/draw/planAutoMovieDrawCall.js.map +1 -1
  164. package/lib/draw/planAutoMovieDrawCall.mjs.map +1 -1
  165. package/lib/draw/renderAutoMovieDrawnVideo.d.ts +2 -12
  166. package/lib/draw/renderAutoMovieDrawnVideo.js.map +1 -1
  167. package/lib/draw/renderAutoMovieDrawnVideo.mjs.map +1 -1
  168. package/lib/draw/replaceAutoMovieDrawInspection.d.ts +24 -0
  169. package/lib/draw/replaceAutoMovieDrawInspection.js +29 -0
  170. package/lib/draw/replaceAutoMovieDrawInspection.js.map +1 -0
  171. package/lib/draw/replaceAutoMovieDrawInspection.mjs +29 -0
  172. package/lib/draw/replaceAutoMovieDrawInspection.mjs.map +1 -0
  173. package/lib/draw/stampAutoMovieDrawLegend.d.ts +2 -4
  174. package/lib/draw/stampAutoMovieDrawLegend.js.map +1 -1
  175. package/lib/draw/stampAutoMovieDrawLegend.mjs.map +1 -1
  176. package/lib/film/AutoMovieOrderedScalar.d.ts +1 -15
  177. package/lib/film/IAutoMovieProductionAudioAssetIdentity.d.ts +1 -28
  178. package/lib/film/IAutoMovieProductionAudioAssetIdentityBase.d.ts +1 -29
  179. package/lib/film/IAutoMovieProductionEncoderIdentity.d.ts +1 -36
  180. package/lib/film/IAutoMovieProductionRenderChunk.d.ts +1 -39
  181. package/lib/film/IAutoMovieProductionRenderJobPlan.d.ts +1 -53
  182. package/lib/film/IAutoMovieProductionRenderRuntimeIdentity.d.ts +1 -31
  183. package/lib/film/IAutoMovieProductionRenderTier.d.ts +1 -25
  184. package/lib/film/equalOrderedScalars.d.ts +2 -5
  185. package/lib/film/equalOrderedScalars.js.map +1 -1
  186. package/lib/film/equalOrderedScalars.mjs.map +1 -1
  187. package/lib/film/normalizeAudioAssets.d.ts +1 -1
  188. package/lib/film/normalizeAudioAssets.js.map +1 -1
  189. package/lib/film/normalizeAudioAssets.mjs.map +1 -1
  190. package/lib/film/normalizeRenderTier.d.ts +1 -1
  191. package/lib/film/normalizeRenderTier.mjs.map +1 -1
  192. package/lib/film/planProductionRenderJob.d.ts +2 -16
  193. package/lib/film/planProductionRenderJob.js.map +1 -1
  194. package/lib/film/planProductionRenderJob.mjs.map +1 -1
  195. package/lib/film/resolveProductionRenderTierFrameFormat.d.ts +1 -2
  196. package/lib/film/resolveProductionRenderTierFrameFormat.mjs.map +1 -1
  197. package/lib/film/validWaveAudioIdentity.d.ts +1 -1
  198. package/lib/film/validWaveAudioIdentity.mjs.map +1 -1
  199. package/lib/index.mjs +8 -7
  200. package/lib/picture/AutoMovieRasterSheet.d.ts +2 -2
  201. package/lib/picture/AutoMovieRasterSheet.js.map +1 -1
  202. package/lib/picture/AutoMovieRasterSheet.mjs.map +1 -1
  203. package/lib/picture/IAutoMovieRasterComparison.d.ts +1 -33
  204. package/lib/picture/IAutoMovieRasterImage.d.ts +1 -17
  205. package/lib/picture/compareAutoMovieRasters.d.ts +1 -2
  206. package/lib/picture/compareAutoMovieRasters.js.map +1 -1
  207. package/lib/picture/compareAutoMovieRasters.mjs.map +1 -1
  208. package/lib/picture/decodeAutoMovieRasterPng.d.ts +1 -1
  209. package/lib/picture/decodeAutoMovieRasterPng.js.map +1 -1
  210. package/lib/picture/decodeAutoMovieRasterPng.mjs.map +1 -1
  211. package/lib/picture/encodeAutoMovieRasterPng.d.ts +1 -1
  212. package/lib/picture/encodeAutoMovieRasterPng.js.map +1 -1
  213. package/lib/picture/encodeAutoMovieRasterPng.mjs.map +1 -1
  214. package/lib/picture/hashAutoMovieRasterImage.d.ts +1 -1
  215. package/lib/picture/hashAutoMovieRasterImage.mjs.map +1 -1
  216. package/lib/picture/stampAutoMovieRasterLabel.d.ts +2 -5
  217. package/lib/picture/stampAutoMovieRasterLabel.js.map +1 -1
  218. package/lib/picture/stampAutoMovieRasterLabel.mjs.map +1 -1
  219. package/lib/planCaptionSidecar.d.ts +2 -8
  220. package/lib/planCaptionSidecar.js.map +1 -1
  221. package/lib/planCaptionSidecar.mjs.map +1 -1
  222. package/lib/planChunkedSequenceRender.d.ts +2 -9
  223. package/lib/planChunkedSequenceRender.js.map +1 -1
  224. package/lib/planChunkedSequenceRender.mjs.map +1 -1
  225. package/lib/planGuidePassOutputs.d.ts +2 -6
  226. package/lib/planGuidePassOutputs.js.map +1 -1
  227. package/lib/planGuidePassOutputs.mjs.map +1 -1
  228. package/lib/planPoseKeypointSidecar.d.ts +2 -12
  229. package/lib/planPoseKeypointSidecar.js.map +1 -1
  230. package/lib/planPoseKeypointSidecar.mjs.map +1 -1
  231. package/lib/planSequenceRender.d.ts +2 -9
  232. package/lib/planSequenceRender.js.map +1 -1
  233. package/lib/planSequenceRender.mjs.map +1 -1
  234. package/lib/planViewerFrameTimes.d.ts +2 -16
  235. package/lib/planViewerFrameTimes.js.map +1 -1
  236. package/lib/planViewerFrameTimes.mjs.map +1 -1
  237. package/lib/renderAndSee.d.ts +1 -2
  238. package/lib/renderAndSee.js.map +1 -1
  239. package/lib/renderAndSee.mjs.map +1 -1
  240. package/lib/renderBudgetPreflight/IAutoMovieRenderBudgetAssessment.d.ts +1 -41
  241. package/lib/renderBudgetPreflight/IAutoMovieRenderBudgetEvidence.d.ts +1 -53
  242. package/lib/renderBudgetPreflight/IAutoMovieRenderGraphicsIdentity.d.ts +1 -27
  243. package/lib/renderBudgetPreflight/assessAutoMovieRenderBudget.d.ts +2 -13
  244. package/lib/renderBudgetPreflight/assessAutoMovieRenderBudget.js.map +1 -1
  245. package/lib/renderBudgetPreflight/assessAutoMovieRenderBudget.mjs.map +1 -1
  246. package/lib/renderBudgetPreflight/autoMovieRenderBudgetEvidence.d.ts +2 -8
  247. package/lib/renderBudgetPreflight/autoMovieRenderBudgetEvidence.js.map +1 -1
  248. package/lib/renderBudgetPreflight/autoMovieRenderBudgetEvidence.mjs.map +1 -1
  249. package/lib/renderBudgetPreflight/autoMovieRenderBudgetRefusal.d.ts +1 -1
  250. package/lib/renderBudgetPreflight/autoMovieRenderBudgetRefusal.js.map +1 -1
  251. package/lib/renderBudgetPreflight/autoMovieRenderBudgetRefusal.mjs.map +1 -1
  252. package/lib/renderBudgetPreflight/autoMovieRenderTargetRendererOfGraphics.d.ts +1 -2
  253. package/lib/renderBudgetPreflight/autoMovieRenderTargetRendererOfGraphics.js.map +1 -1
  254. package/lib/renderBudgetPreflight/autoMovieRenderTargetRendererOfGraphics.mjs.map +1 -1
  255. package/lib/renderBudgetPreflight/autoMovieRenderTargetSettingsOfShot.d.ts +2 -8
  256. package/lib/renderBudgetPreflight/autoMovieRenderTargetSettingsOfShot.js.map +1 -1
  257. package/lib/renderBudgetPreflight/autoMovieRenderTargetSettingsOfShot.mjs.map +1 -1
  258. package/lib/renderCaptionSidecar.d.ts +1 -1
  259. package/lib/renderCaptionSidecar.mjs.map +1 -1
  260. package/lib/renderPoseKeypointSidecar.d.ts +1 -1
  261. package/lib/renderPoseKeypointSidecar.mjs.map +1 -1
  262. package/lib/renderSequenceAndSee.d.ts +1 -2
  263. package/lib/renderSequenceAndSee.js.map +1 -1
  264. package/lib/renderSequenceAndSee.mjs.map +1 -1
  265. package/lib/renderSequenceVideo.d.ts +1 -3
  266. package/lib/renderSequenceVideo.js.map +1 -1
  267. package/lib/renderSequenceVideo.mjs.map +1 -1
  268. package/lib/renderVideo.d.ts +1 -3
  269. package/lib/renderVideo.js.map +1 -1
  270. package/lib/renderVideo.mjs.map +1 -1
  271. package/lib/scene/AutoMovieFilmBeautyComposition.d.ts +1 -25
  272. package/lib/scene/AutoMoviePlayer.d.ts +1 -2
  273. package/lib/scene/AutoMoviePlayer.js.map +1 -1
  274. package/lib/scene/AutoMoviePlayer.mjs.map +1 -1
  275. package/lib/scene/IApplyAutoMovieSectionPlanesProps.d.ts +1 -1
  276. package/lib/scene/IAutoMovieFilmBeautyLayer.d.ts +1 -12
  277. package/lib/scene/IAutoMovieFormationPoseTake.d.ts +1 -22
  278. package/lib/scene/IAutoMovieFormationViewerObject.d.ts +1 -2
  279. package/lib/scene/IAutoMovieRigLocalTransform.d.ts +1 -15
  280. package/lib/scene/IAutoMovieSpringAxisSettlement.d.ts +2 -2
  281. package/lib/scene/IBakeFormationCycleProps.d.ts +1 -2
  282. package/lib/scene/applyAutoMovieRigLocals.d.ts +1 -2
  283. package/lib/scene/applyAutoMovieRigLocals.js.map +1 -1
  284. package/lib/scene/applyAutoMovieRigLocals.mjs.map +1 -1
  285. package/lib/scene/applyAutoMovieSectionPlanes.mjs.map +1 -1
  286. package/lib/scene/applyFormationCycleCadence.d.ts +1 -1
  287. package/lib/scene/applyFormationCycleCadence.mjs.map +1 -1
  288. package/lib/scene/applyPose.d.ts +1 -2
  289. package/lib/scene/applyPose.js.map +1 -1
  290. package/lib/scene/applyPose.mjs.map +1 -1
  291. package/lib/scene/applyRenderMode.js.map +1 -1
  292. package/lib/scene/applyRenderMode.mjs.map +1 -1
  293. package/lib/scene/applySampledObjectMotion.d.ts +1 -1
  294. package/lib/scene/applySampledObjectMotion.mjs.map +1 -1
  295. package/lib/scene/applySemanticMaskMode.d.ts +1 -1
  296. package/lib/scene/applySemanticMaskMode.js.map +1 -1
  297. package/lib/scene/applySemanticMaskMode.mjs.map +1 -1
  298. package/lib/scene/autoMovieAnalysisRampColor.d.ts +2 -5
  299. package/lib/scene/autoMovieAnalysisRampColor.js.map +1 -1
  300. package/lib/scene/autoMovieAnalysisRampColor.mjs.map +1 -1
  301. package/lib/scene/bakeFormationCycle.d.ts +2 -1
  302. package/lib/scene/bakeFormationCycle.js +3 -2
  303. package/lib/scene/bakeFormationCycle.js.map +1 -1
  304. package/lib/scene/bakeFormationCycle.mjs +3 -2
  305. package/lib/scene/bakeFormationCycle.mjs.map +1 -1
  306. package/lib/scene/buildAutoMovieConstruction.d.ts +2 -5
  307. package/lib/scene/buildAutoMovieConstruction.js.map +1 -1
  308. package/lib/scene/buildAutoMovieConstruction.mjs.map +1 -1
  309. package/lib/scene/buildGeometry.d.ts +1 -1
  310. package/lib/scene/buildGeometry.js.map +1 -1
  311. package/lib/scene/buildGeometry.mjs.map +1 -1
  312. package/lib/scene/buildInstancedEffect.js.map +1 -1
  313. package/lib/scene/buildInstancedEffect.mjs.map +1 -1
  314. package/lib/scene/buildInstancedFormation.js.map +1 -1
  315. package/lib/scene/buildInstancedFormation.mjs.map +1 -1
  316. package/lib/scene/buildSpaceObject.js.map +1 -1
  317. package/lib/scene/buildSpaceObject.mjs.map +1 -1
  318. package/lib/scene/createAutoMoviePhysicalPoseAdapter.d.ts +2 -2
  319. package/lib/scene/createAutoMoviePhysicalPoseAdapter.js.map +1 -1
  320. package/lib/scene/createAutoMoviePhysicalPoseAdapter.mjs.map +1 -1
  321. package/lib/scene/describeFormationTextureSources.d.ts +1 -2
  322. package/lib/scene/describeFormationTextureSources.mjs.map +1 -1
  323. package/lib/scene/formation/index.d.ts +1 -1
  324. package/lib/scene/formationCycleCadence.d.ts +1 -1
  325. package/lib/scene/formationCycleCadence.mjs.map +1 -1
  326. package/lib/scene/human-polygon/AutoMovieHumanPolygon.d.ts +7 -57
  327. package/lib/scene/human-polygon/applyHumanPolygonPose.d.ts +2 -2
  328. package/lib/scene/human-polygon/applyHumanPolygonPose.js.map +1 -1
  329. package/lib/scene/human-polygon/applyHumanPolygonPose.mjs.map +1 -1
  330. package/lib/scene/human-polygon/buildHumanPolygon.d.ts +2 -1
  331. package/lib/scene/human-polygon/buildHumanPolygon.js.map +1 -1
  332. package/lib/scene/human-polygon/buildHumanPolygon.mjs.map +1 -1
  333. package/lib/scene/human-polygon/buildHumanPolygonModule.d.ts +2 -2
  334. package/lib/scene/human-polygon/buildHumanPolygonModule.js.map +1 -1
  335. package/lib/scene/human-polygon/buildHumanPolygonModule.mjs.map +1 -1
  336. package/lib/scene/human-polygon/buildHumanPolygonParts.d.ts +2 -2
  337. package/lib/scene/human-polygon/buildHumanPolygonParts.js.map +1 -1
  338. package/lib/scene/human-polygon/buildHumanPolygonParts.mjs.map +1 -1
  339. package/lib/scene/human-polygon/createAutoMovieHumanPolygonFigure.d.ts +3 -2
  340. package/lib/scene/human-polygon/createAutoMovieHumanPolygonFigure.js.map +1 -1
  341. package/lib/scene/human-polygon/createAutoMovieHumanPolygonFigure.mjs.map +1 -1
  342. package/lib/scene/index.d.ts +1 -1
  343. package/lib/scene/index.js +0 -1
  344. package/lib/scene/index.js.map +1 -1
  345. package/lib/scene/index.mjs +6 -6
  346. package/lib/scene/inspection/AUTO_MOVIE_INSPECTION_KINDS.d.ts +2 -4
  347. package/lib/scene/inspection/AUTO_MOVIE_INSPECTION_KINDS.js.map +1 -1
  348. package/lib/scene/inspection/AUTO_MOVIE_INSPECTION_KINDS.mjs.map +1 -1
  349. package/lib/scene/inspection/AUTO_MOVIE_INSPECTION_PALETTE.d.ts +1 -1
  350. package/lib/scene/inspection/AUTO_MOVIE_INSPECTION_PALETTE.mjs.map +1 -1
  351. package/lib/scene/inspection/IApplyAutoMovieInspectionProps.d.ts +2 -3
  352. package/lib/scene/inspection/IAutoMovieInspectionCamera.d.ts +1 -29
  353. package/lib/scene/inspection/IAutoMovieInspectionHandle.d.ts +3 -6
  354. package/lib/scene/inspection/IAutoMovieInspectionKind.d.ts +1 -16
  355. package/lib/scene/inspection/IAutoMovieInspectionLabel.d.ts +1 -18
  356. package/lib/scene/inspection/IAutoMovieInspectionLegendEntry.d.ts +1 -22
  357. package/lib/scene/inspection/IAutoMovieInspectionMarkSet.d.ts +1 -1
  358. package/lib/scene/inspection/IAutoMovieInspectionMeasured.d.ts +1 -1
  359. package/lib/scene/inspection/IAutoMovieInspectionRequest.d.ts +1 -99
  360. package/lib/scene/inspection/IAutoMovieInspectionTrail.d.ts +1 -18
  361. package/lib/scene/inspection/IAutoMovieInspectionView.d.ts +1 -80
  362. package/lib/scene/inspection/applyAutoMovieInspection.js.map +1 -1
  363. package/lib/scene/inspection/applyAutoMovieInspection.mjs.map +1 -1
  364. package/lib/scene/inspection/applyAutoMovieInspectionSection.d.ts +1 -1
  365. package/lib/scene/inspection/applyAutoMovieInspectionSection.mjs.map +1 -1
  366. package/lib/scene/inspection/applyAutoMovieInspectionShade.d.ts +2 -2
  367. package/lib/scene/inspection/applyAutoMovieInspectionShade.js.map +1 -1
  368. package/lib/scene/inspection/applyAutoMovieInspectionShade.mjs.map +1 -1
  369. package/lib/scene/inspection/buildAutoMovieInspectionMarks.mjs.map +1 -1
  370. package/lib/scene/inspection/chooseAutoMovieInspectionMarks.d.ts +1 -1
  371. package/lib/scene/inspection/chooseAutoMovieInspectionMarks.mjs.map +1 -1
  372. package/lib/scene/inspection/colorAutoMovieInspectionObjects.d.ts +3 -3
  373. package/lib/scene/inspection/colorAutoMovieInspectionObjects.js.map +1 -1
  374. package/lib/scene/inspection/colorAutoMovieInspectionObjects.mjs.map +1 -1
  375. package/lib/scene/inspection/expandAutoMovieInspectionSweep.d.ts +2 -17
  376. package/lib/scene/inspection/expandAutoMovieInspectionSweep.js.map +1 -1
  377. package/lib/scene/inspection/expandAutoMovieInspectionSweep.mjs.map +1 -1
  378. package/lib/scene/inspection/focusAutoMovieInspection.d.ts +2 -3
  379. package/lib/scene/inspection/focusAutoMovieInspection.js.map +1 -1
  380. package/lib/scene/inspection/focusAutoMovieInspection.mjs.map +1 -1
  381. package/lib/scene/inspection/formatAutoMovieInspectionCameraView.d.ts +1 -1
  382. package/lib/scene/inspection/formatAutoMovieInspectionCameraView.js.map +1 -1
  383. package/lib/scene/inspection/formatAutoMovieInspectionCameraView.mjs.map +1 -1
  384. package/lib/scene/inspection/formatAutoMovieInspectionRequest.d.ts +1 -1
  385. package/lib/scene/inspection/formatAutoMovieInspectionRequest.js.map +1 -1
  386. package/lib/scene/inspection/formatAutoMovieInspectionRequest.mjs.map +1 -1
  387. package/lib/scene/inspection/formatAutoMovieInspectionView.d.ts +1 -1
  388. package/lib/scene/inspection/formatAutoMovieInspectionView.js.map +1 -1
  389. package/lib/scene/inspection/formatAutoMovieInspectionView.mjs.map +1 -1
  390. package/lib/scene/inspection/legendAutoMovieInspectionMarks.d.ts +2 -6
  391. package/lib/scene/inspection/legendAutoMovieInspectionMarks.js.map +1 -1
  392. package/lib/scene/inspection/legendAutoMovieInspectionMarks.mjs.map +1 -1
  393. package/lib/scene/inspection/listAutoMovieInspectionKinds.d.ts +2 -9
  394. package/lib/scene/inspection/listAutoMovieInspectionKinds.js.map +1 -1
  395. package/lib/scene/inspection/listAutoMovieInspectionKinds.mjs.map +1 -1
  396. package/lib/scene/inspection/markAutoMovieInspectionTrails.d.ts +1 -2
  397. package/lib/scene/inspection/markAutoMovieInspectionTrails.js.map +1 -1
  398. package/lib/scene/inspection/markAutoMovieInspectionTrails.mjs.map +1 -1
  399. package/lib/scene/inspection/measureAutoMovieInspectionDefects.d.ts +1 -1
  400. package/lib/scene/inspection/measureAutoMovieInspectionDefects.js.map +1 -1
  401. package/lib/scene/inspection/measureAutoMovieInspectionDefects.mjs.map +1 -1
  402. package/lib/scene/inspection/measureAutoMovieInspectionEdges.mjs.map +1 -1
  403. package/lib/scene/inspection/measureAutoMovieInspectionMeshes.d.ts +1 -1
  404. package/lib/scene/inspection/measureAutoMovieInspectionMeshes.mjs.map +1 -1
  405. package/lib/scene/inspection/measureAutoMovieInspectionPaths.d.ts +2 -7
  406. package/lib/scene/inspection/measureAutoMovieInspectionPaths.js.map +1 -1
  407. package/lib/scene/inspection/measureAutoMovieInspectionPaths.mjs.map +1 -1
  408. package/lib/scene/inspection/mergeAutoMovieInspectionLegends.d.ts +1 -1
  409. package/lib/scene/inspection/mergeAutoMovieInspectionLegends.mjs.map +1 -1
  410. package/lib/scene/inspection/parseAutoMovieInspectionRequest.d.ts +1 -1
  411. package/lib/scene/inspection/parseAutoMovieInspectionRequest.js.map +1 -1
  412. package/lib/scene/inspection/parseAutoMovieInspectionRequest.mjs.map +1 -1
  413. package/lib/scene/inspection/parseAutoMovieInspectionView.d.ts +1 -1
  414. package/lib/scene/inspection/parseAutoMovieInspectionView.js.map +1 -1
  415. package/lib/scene/inspection/parseAutoMovieInspectionView.mjs.map +1 -1
  416. package/lib/scene/inspection/placeAutoMovieInspectionLabels.d.ts +2 -6
  417. package/lib/scene/inspection/placeAutoMovieInspectionLabels.js.map +1 -1
  418. package/lib/scene/inspection/placeAutoMovieInspectionLabels.mjs.map +1 -1
  419. package/lib/scene/inspection/planAutoMovieInspectionTrailTimes.d.ts +2 -9
  420. package/lib/scene/inspection/planAutoMovieInspectionTrailTimes.js.map +1 -1
  421. package/lib/scene/inspection/planAutoMovieInspectionTrailTimes.mjs.map +1 -1
  422. package/lib/scene/inspection/resolveAutoMovieInspectionColors.d.ts +2 -18
  423. package/lib/scene/inspection/resolveAutoMovieInspectionColors.js.map +1 -1
  424. package/lib/scene/inspection/resolveAutoMovieInspectionColors.mjs.map +1 -1
  425. package/lib/scene/inspection/resolveAutoMovieInspectionView.d.ts +1 -2
  426. package/lib/scene/inspection/resolveAutoMovieInspectionView.js.map +1 -1
  427. package/lib/scene/inspection/resolveAutoMovieInspectionView.mjs.map +1 -1
  428. package/lib/scene/inspection/sampleAutoMovieInspectionTrails.d.ts +1 -1
  429. package/lib/scene/inspection/sampleAutoMovieInspectionTrails.js.map +1 -1
  430. package/lib/scene/inspection/sampleAutoMovieInspectionTrails.mjs.map +1 -1
  431. package/lib/scene/matchesAutoMovieShadowTextureProfile.d.ts +1 -1
  432. package/lib/scene/matchesAutoMovieShadowTextureProfile.mjs.map +1 -1
  433. package/lib/scene/observeAutoMovieRendererFrame.d.ts +2 -5
  434. package/lib/scene/observeAutoMovieRendererFrame.js.map +1 -1
  435. package/lib/scene/observeAutoMovieRendererFrame.mjs.map +1 -1
  436. package/lib/scene/planAutoMovieShadowTextureTarget.d.ts +1 -1
  437. package/lib/scene/planAutoMovieShadowTextureTarget.mjs.map +1 -1
  438. package/lib/scene/readAutoMovieFilmDisplayTextureResidency.d.ts +2 -6
  439. package/lib/scene/readAutoMovieFilmDisplayTextureResidency.js.map +1 -1
  440. package/lib/scene/readAutoMovieFilmDisplayTextureResidency.mjs.map +1 -1
  441. package/lib/scene/readAutoMovieMaterialTextureSources.d.ts +3 -5
  442. package/lib/scene/readAutoMovieMaterialTextureSources.js.map +1 -1
  443. package/lib/scene/readAutoMovieMaterialTextureSources.mjs.map +1 -1
  444. package/lib/scene/readAutoMovieRenderTextureTarget.d.ts +1 -1
  445. package/lib/scene/readAutoMovieRenderTextureTarget.mjs.map +1 -1
  446. package/lib/scene/readAutoMovieShadowTextureTargets.d.ts +1 -2
  447. package/lib/scene/readAutoMovieShadowTextureTargets.js.map +1 -1
  448. package/lib/scene/readAutoMovieShadowTextureTargets.mjs.map +1 -1
  449. package/lib/scene/readAutoMovieTextureSource.d.ts +1 -1
  450. package/lib/scene/readAutoMovieTextureSource.js.map +1 -1
  451. package/lib/scene/readAutoMovieTextureSource.mjs.map +1 -1
  452. package/lib/scene/readAutoMovieTransmissionTextureTarget.d.ts +1 -1
  453. package/lib/scene/readAutoMovieTransmissionTextureTarget.mjs.map +1 -1
  454. package/lib/scene/resolveAutoMovieFilmBeautyComposition.d.ts +2 -3
  455. package/lib/scene/resolveAutoMovieFilmBeautyComposition.js.map +1 -1
  456. package/lib/scene/resolveAutoMovieFilmBeautyComposition.mjs.map +1 -1
  457. package/lib/scene/semanticMask/IAutoMovieSemanticMaskBinding.d.ts +1 -19
  458. package/lib/scene/semanticMask/attachAutoMovieSemanticMask.d.ts +1 -1
  459. package/lib/scene/semanticMask/attachAutoMovieSemanticMask.mjs.map +1 -1
  460. package/lib/scene/semanticMask/autoMovieSemanticMaskOf.d.ts +1 -1
  461. package/lib/scene/semanticMask/autoMovieSemanticMaskOf.mjs.map +1 -1
  462. package/lib/sliceCaptionSidecar.d.ts +1 -1
  463. package/lib/sliceCaptionSidecar.mjs.map +1 -1
  464. package/package.json +7 -7
  465. package/src/IAutoMovieCaptionEntry.ts +1 -32
  466. package/src/IAutoMovieCaptionSidecar.ts +1 -29
  467. package/src/IAutoMovieCapturedFrame.ts +1 -24
  468. package/src/IAutoMovieGuidePassOutput.ts +1 -27
  469. package/src/IAutoMoviePoseKeypointActor.ts +1 -39
  470. package/src/IAutoMoviePoseKeypointFrame.ts +1 -28
  471. package/src/IAutoMoviePoseKeypointSidecar.ts +1 -25
  472. package/src/IAutoMovieRenderAdapters.ts +1 -39
  473. package/src/IAutoMovieRenderAndSeeRequest.ts +1 -38
  474. package/src/IAutoMovieRenderAndSeeResult.ts +1 -23
  475. package/src/IAutoMovieRenderChunk.ts +1 -62
  476. package/src/IAutoMovieRenderChunkPlan.ts +1 -40
  477. package/src/IAutoMovieRenderPassManifest.ts +1 -25
  478. package/src/IAutoMovieRenderReassembly.ts +1 -28
  479. package/src/IAutoMovieRenderResult.ts +1 -46
  480. package/src/IAutoMovieSequenceRenderAdapters.ts +1 -41
  481. package/src/IAutoMovieSequenceRenderAndSeeRequest.ts +1 -47
  482. package/src/IAutoMovieSequenceRenderAndSeeResult.ts +1 -23
  483. package/src/IAutoMovieSequenceRenderFrame.ts +1 -48
  484. package/src/IAutoMovieSequenceRenderPlan.ts +1 -88
  485. package/src/IAutoMovieSequenceRenderResult.ts +1 -52
  486. package/src/IAutoMovieSequenceRenderShotSpan.ts +1 -46
  487. package/src/IAutoMovieSequenceRenderTransitionSpan.ts +1 -46
  488. package/src/audio/mixAutoMovieAudioPcm.ts +10 -44
  489. package/src/auditAutoMovieRenderObservation.ts +5 -14
  490. package/src/cache/createAutoMovieHttpArtifactStore.ts +1 -1
  491. package/src/caption/IAutoMovieBeatCaption.ts +1 -23
  492. package/src/caption/beatCaptions.ts +1 -1
  493. package/src/caption/inspectAutoMovieCaptionReadabilityWithRuntime.ts +1 -12
  494. package/src/caption/parseAutoMovieCaptionLanguage.ts +1 -13
  495. package/src/capture/AutoMovieCaptureFolder.ts +10 -16
  496. package/src/capture/IAutoMovieCaptureBudget.ts +1 -26
  497. package/src/capture/IAutoMovieCaptureCell.ts +1 -42
  498. package/src/capture/IAutoMovieCaptureComparison.ts +1 -96
  499. package/src/capture/IAutoMovieCaptureDrawing.ts +1 -64
  500. package/src/capture/IAutoMovieCaptureLayout.ts +1 -51
  501. package/src/capture/IAutoMovieCapturePlan.ts +1 -36
  502. package/src/capture/IAutoMovieCapturePlanRequest.ts +1 -117
  503. package/src/capture/IAutoMovieCaptureRecord.ts +1 -174
  504. package/src/capture/IAutoMovieCaptureRequestSource.ts +1 -37
  505. package/src/capture/IAutoMovieCaptureResolution.ts +1 -23
  506. package/src/capture/IAutoMovieCaptureSelection.ts +1 -28
  507. package/src/capture/IAutoMovieCaptureStorage.ts +1 -76
  508. package/src/capture/IAutoMovieCaptureSubject.ts +1 -94
  509. package/src/capture/IAutoMovieCaptureTime.ts +1 -17
  510. package/src/capture/IAutoMovieCaptureWindow.ts +1 -29
  511. package/src/capture/compareAutoMovieCaptureRounds.ts +33 -48
  512. package/src/capture/formatAutoMovieCapturePlanRequest.ts +7 -3
  513. package/src/capture/markAutoMovieCaptureCell.ts +1 -1
  514. package/src/capture/parseAutoMovieCapturePlanRequest.ts +13 -10
  515. package/src/capture/planAutoMovieCapture.ts +20 -21
  516. package/src/capture/planAutoMovieCaptureFrames.ts +9 -28
  517. package/src/capture/planAutoMovieCaptureLayout.ts +8 -21
  518. package/src/capture/planAutoMovieVideoFrames.ts +5 -10
  519. package/src/capture/planAutoMovieVideoSceneCuts.ts +5 -10
  520. package/src/capture/readAutoMovieVideoSceneCuts.ts +5 -7
  521. package/src/capture/resolveAutoMovieCapturePatterns.ts +11 -14
  522. package/src/capture/runAutoMovieCapture.ts +19 -33
  523. package/src/capture/runAutoMovieVideoCapture.ts +13 -32
  524. package/src/capture/scaleAutoMovieCaptureLabels.ts +5 -2
  525. package/src/delivery/AUTOMOVIE_MP4_SRGB_COLOUR.ts +5 -6
  526. package/src/delivery/AUTOMOVIE_PRODUCTION_OPUS_PROFILE.ts +17 -27
  527. package/src/delivery/AutoMovieProductionPngRole.ts +1 -18
  528. package/src/delivery/IAutoMovieProductionPngProfile.ts +1 -52
  529. package/src/delivery/IAutoMovieProductionVideoProfile.ts +1 -48
  530. package/src/delivery/assertAutoMovieCaptureClock.ts +7 -7
  531. package/src/delivery/assertProductionPngPicture.ts +8 -13
  532. package/src/delivery/assertProductionVideoProfile.ts +5 -12
  533. package/src/delivery/auditAutoMovieDecodedFrames.ts +17 -56
  534. package/src/delivery/auditAutoMovieEncodedPresentation.ts +3 -8
  535. package/src/delivery/planAutoMovieVideoEncoding.ts +8 -23
  536. package/src/delivery/productionOpusDescription.ts +9 -15
  537. package/src/delivery/resolveProductionPngProfile.ts +9 -17
  538. package/src/delivery/resolveProductionVideoProfile.ts +9 -16
  539. package/src/draw/AutoMovieDrawSession.ts +19 -18
  540. package/src/draw/IAutoMovieDrawCall.ts +1 -34
  541. package/src/draw/IAutoMovieDrawDescription.ts +1 -17
  542. package/src/draw/IAutoMovieDrawFunction.ts +5 -3
  543. package/src/draw/IAutoMovieDrawResult.ts +1 -45
  544. package/src/draw/IAutoMovieDrawScene.ts +10 -2
  545. package/src/draw/decodeAutoMovieDrawPixels.ts +5 -3
  546. package/src/draw/describeAutoMovieDrawScene.ts +18 -11
  547. package/src/draw/index.ts +1 -0
  548. package/src/draw/installAutoMovieDraw.ts +43 -45
  549. package/src/draw/planAutoMovieDrawCall.ts +8 -5
  550. package/src/draw/renderAutoMovieDrawnVideo.ts +6 -9
  551. package/src/draw/replaceAutoMovieDrawInspection.ts +36 -0
  552. package/src/draw/stampAutoMovieDrawLegend.ts +7 -5
  553. package/src/film/AutoMovieOrderedScalar.ts +1 -15
  554. package/src/film/IAutoMovieProductionAudioAssetIdentity.ts +1 -40
  555. package/src/film/IAutoMovieProductionAudioAssetIdentityBase.ts +1 -34
  556. package/src/film/IAutoMovieProductionEncoderIdentity.ts +1 -42
  557. package/src/film/IAutoMovieProductionRenderChunk.ts +1 -47
  558. package/src/film/IAutoMovieProductionRenderJobPlan.ts +1 -73
  559. package/src/film/IAutoMovieProductionRenderRuntimeIdentity.ts +1 -37
  560. package/src/film/IAutoMovieProductionRenderTier.ts +1 -27
  561. package/src/film/equalOrderedScalars.ts +10 -10
  562. package/src/film/normalizeAudioAssets.ts +4 -2
  563. package/src/film/normalizeRenderTier.ts +1 -1
  564. package/src/film/planProductionRenderJob.ts +11 -48
  565. package/src/film/resolveProductionRenderTierFrameFormat.ts +1 -1
  566. package/src/film/validWaveAudioIdentity.ts +3 -3
  567. package/src/picture/AutoMovieRasterSheet.ts +7 -3
  568. package/src/picture/IAutoMovieRasterComparison.ts +1 -33
  569. package/src/picture/IAutoMovieRasterImage.ts +1 -19
  570. package/src/picture/compareAutoMovieRasters.ts +4 -2
  571. package/src/picture/decodeAutoMovieRasterPng.ts +2 -1
  572. package/src/picture/encodeAutoMovieRasterPng.ts +2 -1
  573. package/src/picture/hashAutoMovieRasterImage.ts +1 -1
  574. package/src/picture/stampAutoMovieRasterLabel.ts +5 -2
  575. package/src/planCaptionSidecar.ts +11 -30
  576. package/src/planChunkedSequenceRender.ts +15 -26
  577. package/src/planGuidePassOutputs.ts +10 -16
  578. package/src/planPoseKeypointSidecar.ts +11 -40
  579. package/src/planSequenceRender.ts +11 -32
  580. package/src/planViewerFrameTimes.ts +5 -22
  581. package/src/renderAndSee.ts +5 -2
  582. package/src/renderBudgetPreflight/IAutoMovieRenderBudgetAssessment.ts +1 -53
  583. package/src/renderBudgetPreflight/IAutoMovieRenderBudgetEvidence.ts +1 -61
  584. package/src/renderBudgetPreflight/IAutoMovieRenderGraphicsIdentity.ts +1 -29
  585. package/src/renderBudgetPreflight/assessAutoMovieRenderBudget.ts +9 -37
  586. package/src/renderBudgetPreflight/autoMovieRenderBudgetEvidence.ts +11 -15
  587. package/src/renderBudgetPreflight/autoMovieRenderBudgetRefusal.ts +2 -3
  588. package/src/renderBudgetPreflight/autoMovieRenderTargetRendererOfGraphics.ts +4 -3
  589. package/src/renderBudgetPreflight/autoMovieRenderTargetSettingsOfShot.ts +7 -19
  590. package/src/renderCaptionSidecar.ts +1 -1
  591. package/src/renderPoseKeypointSidecar.ts +1 -1
  592. package/src/renderSequenceAndSee.ts +5 -2
  593. package/src/renderSequenceVideo.ts +6 -4
  594. package/src/renderVideo.ts +5 -3
  595. package/src/scene/AutoMovieFilmBeautyComposition.ts +1 -24
  596. package/src/scene/AutoMoviePlayer.ts +12 -12
  597. package/src/scene/IApplyAutoMovieSectionPlanesProps.ts +1 -1
  598. package/src/scene/IAutoMovieFilmBeautyLayer.ts +1 -12
  599. package/src/scene/IAutoMovieFormationPoseTake.ts +1 -26
  600. package/src/scene/IAutoMovieFormationViewerObject.ts +4 -2
  601. package/src/scene/IAutoMovieRigLocalTransform.ts +1 -16
  602. package/src/scene/IAutoMovieSpringAxisSettlement.ts +2 -2
  603. package/src/scene/IBakeFormationCycleProps.ts +4 -2
  604. package/src/scene/applyAutoMovieRigLocals.ts +4 -2
  605. package/src/scene/applyAutoMovieSectionPlanes.ts +1 -1
  606. package/src/scene/applyFormationCycleCadence.ts +1 -1
  607. package/src/scene/applyPose.ts +2 -5
  608. package/src/scene/applyRenderMode.ts +5 -5
  609. package/src/scene/applySampledObjectMotion.ts +1 -1
  610. package/src/scene/applySemanticMaskMode.ts +1 -1
  611. package/src/scene/autoMovieAnalysisRampColor.ts +7 -5
  612. package/src/scene/bakeFormationCycle.ts +4 -3
  613. package/src/scene/buildAutoMovieConstruction.ts +2 -5
  614. package/src/scene/buildGeometry.ts +6 -9
  615. package/src/scene/buildInstancedEffect.ts +6 -6
  616. package/src/scene/buildInstancedFormation.ts +3 -3
  617. package/src/scene/buildSpaceObject.ts +7 -3
  618. package/src/scene/createAutoMoviePhysicalPoseAdapter.ts +4 -4
  619. package/src/scene/describeFormationTextureSources.ts +2 -2
  620. package/src/scene/formation/index.ts +1 -1
  621. package/src/scene/formationCycleCadence.ts +1 -1
  622. package/src/scene/human-polygon/AutoMovieHumanPolygon.ts +7 -67
  623. package/src/scene/human-polygon/applyHumanPolygonPose.ts +12 -7
  624. package/src/scene/human-polygon/buildHumanPolygon.ts +23 -12
  625. package/src/scene/human-polygon/buildHumanPolygonModule.ts +6 -3
  626. package/src/scene/human-polygon/buildHumanPolygonParts.ts +10 -6
  627. package/src/scene/human-polygon/createAutoMovieHumanPolygonFigure.ts +10 -3
  628. package/src/scene/index.ts +1 -1
  629. package/src/scene/inspection/AUTO_MOVIE_INSPECTION_KINDS.ts +3 -1
  630. package/src/scene/inspection/AUTO_MOVIE_INSPECTION_PALETTE.ts +1 -1
  631. package/src/scene/inspection/IApplyAutoMovieInspectionProps.ts +5 -3
  632. package/src/scene/inspection/IAutoMovieInspectionCamera.ts +1 -38
  633. package/src/scene/inspection/IAutoMovieInspectionHandle.ts +8 -6
  634. package/src/scene/inspection/IAutoMovieInspectionKind.ts +1 -18
  635. package/src/scene/inspection/IAutoMovieInspectionLabel.ts +1 -21
  636. package/src/scene/inspection/IAutoMovieInspectionLegendEntry.ts +1 -24
  637. package/src/scene/inspection/IAutoMovieInspectionMarkSet.ts +1 -1
  638. package/src/scene/inspection/IAutoMovieInspectionMeasured.ts +1 -1
  639. package/src/scene/inspection/IAutoMovieInspectionRequest.ts +1 -115
  640. package/src/scene/inspection/IAutoMovieInspectionTrail.ts +1 -21
  641. package/src/scene/inspection/IAutoMovieInspectionView.ts +1 -92
  642. package/src/scene/inspection/applyAutoMovieInspection.ts +12 -8
  643. package/src/scene/inspection/applyAutoMovieInspectionSection.ts +1 -1
  644. package/src/scene/inspection/applyAutoMovieInspectionShade.ts +2 -2
  645. package/src/scene/inspection/buildAutoMovieInspectionMarks.ts +1 -1
  646. package/src/scene/inspection/chooseAutoMovieInspectionMarks.ts +1 -1
  647. package/src/scene/inspection/colorAutoMovieInspectionObjects.ts +6 -3
  648. package/src/scene/inspection/expandAutoMovieInspectionSweep.ts +8 -15
  649. package/src/scene/inspection/focusAutoMovieInspection.ts +6 -4
  650. package/src/scene/inspection/formatAutoMovieInspectionCameraView.ts +2 -1
  651. package/src/scene/inspection/formatAutoMovieInspectionRequest.ts +6 -3
  652. package/src/scene/inspection/formatAutoMovieInspectionView.ts +4 -3
  653. package/src/scene/inspection/legendAutoMovieInspectionMarks.ts +6 -3
  654. package/src/scene/inspection/listAutoMovieInspectionKinds.ts +7 -10
  655. package/src/scene/inspection/markAutoMovieInspectionTrails.ts +4 -2
  656. package/src/scene/inspection/measureAutoMovieInspectionDefects.ts +5 -5
  657. package/src/scene/inspection/measureAutoMovieInspectionEdges.ts +1 -1
  658. package/src/scene/inspection/measureAutoMovieInspectionMeshes.ts +1 -1
  659. package/src/scene/inspection/measureAutoMovieInspectionPaths.ts +6 -3
  660. package/src/scene/inspection/mergeAutoMovieInspectionLegends.ts +1 -1
  661. package/src/scene/inspection/parseAutoMovieInspectionRequest.ts +10 -7
  662. package/src/scene/inspection/parseAutoMovieInspectionView.ts +6 -4
  663. package/src/scene/inspection/placeAutoMovieInspectionLabels.ts +6 -7
  664. package/src/scene/inspection/planAutoMovieInspectionTrailTimes.ts +4 -11
  665. package/src/scene/inspection/resolveAutoMovieInspectionColors.ts +7 -11
  666. package/src/scene/inspection/resolveAutoMovieInspectionView.ts +5 -3
  667. package/src/scene/inspection/sampleAutoMovieInspectionTrails.ts +1 -1
  668. package/src/scene/matchesAutoMovieShadowTextureProfile.ts +1 -1
  669. package/src/scene/observeAutoMovieRendererFrame.ts +3 -3
  670. package/src/scene/planAutoMovieShadowTextureTarget.ts +1 -1
  671. package/src/scene/readAutoMovieFilmDisplayTextureResidency.ts +3 -12
  672. package/src/scene/readAutoMovieMaterialTextureSources.ts +5 -3
  673. package/src/scene/readAutoMovieRenderTextureTarget.ts +1 -1
  674. package/src/scene/readAutoMovieShadowTextureTargets.ts +5 -5
  675. package/src/scene/readAutoMovieTextureSource.ts +4 -2
  676. package/src/scene/readAutoMovieTransmissionTextureTarget.ts +1 -1
  677. package/src/scene/resolveAutoMovieFilmBeautyComposition.ts +6 -4
  678. package/src/scene/semanticMask/IAutoMovieSemanticMaskBinding.ts +1 -24
  679. package/src/scene/semanticMask/attachAutoMovieSemanticMask.ts +1 -1
  680. package/src/scene/semanticMask/autoMovieSemanticMaskOf.ts +1 -1
  681. package/src/sliceCaptionSidecar.ts +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"AutoMovieRasterSheet.mjs","names":[],"sources":["../../src/picture/AutoMovieRasterSheet.ts"],"sourcesContent":["import type { IAutoMovieRasterImage } from \"./IAutoMovieRasterImage.js\";\nimport { stampAutoMovieRasterLabel } from \"./stampAutoMovieRasterLabel.js\";\n\n/**\n * A contact sheet of pictures, filled one picture at a time: each picture is\n * reduced into its cell in row-major order, and its caption is written in a\n * dark strip under the cell, outside the picture, so the caption hides no part\n * of the subject or its legend and stays legible however small the cell is.\n * A caption longer than the cell is wide wraps onto further lines at word\n * boundaries, so it keeps every word that identifies the cell; the sheet's\n * strip holds the number of lines its constructor states, which\n * `AutoMovieRasterSheet.lines` and `AutoMovieRasterSheet.caption` let a layout\n * size from its captions before any picture is added. Reduction averages\n * every source pixel a cell pixel covers (`area`, the default), or copies the\n * source pixel at the cell pixel's centre (`nearest`), which keeps exact\n * colours for a review that reads pixel values.\n *\n * A cell takes any picture, a drawn frame, a difference image or a decoded\n * still alike. Pictures are reduced as they arrive, so a sheet never holds\n * more than its own pixels; the finished sheet is an ordinary picture for\n * `encodeAutoMovieRasterPng`, cut to the cells that were filled.\n *\n * ```ts\n * const sheet = new AutoMovieRasterSheet(20, 5, 180, 320);\n * for (const [seconds, frame] of frames) sheet.add(frame, `${seconds}s`);\n * await writeFile(\"sheet.png\", await encodeAutoMovieRasterPng(sheet.finish()));\n * ```\n *\n * @evidence contracts/development/common.md#meaningful-documentation The comment states the fill order, both reductions and what each keeps, where captions are drawn and why, the memory bound, the extent of the result and how it is encoded.\n * @evidence contracts/development/design.md#principled-representation The sheet is itself an IAutoMovieRasterImage, so encoding and captioning reuse the frame path unchanged.\n * @evidence contracts/development/design.md#minimal-and-owned-surface A constructor, `add` and `finish`, and the statics `lines` and `caption` that a layout reads to reserve the strip; layout is fixed by the constructor.\n * @evidence contracts/development/design.md#prohibited-design-shortcuts Nothing names a film or capture command; captions are caller text.\n */\nexport class AutoMovieRasterSheet {\n /** The sheet pixels, opaque RGBA. */\n private readonly sheet: IAutoMovieRasterImage;\n\n /** Cells filled so far. */\n private count: number;\n\n /** Number of cells. */\n private readonly capacity: number;\n\n /** Cells per row. */\n private readonly columns: number;\n\n /** Cell width in pixels. */\n private readonly cellWidth: number;\n\n /** Cell height in pixels, the picture alone. */\n private readonly cellHeight: number;\n\n /** Height in pixels of the caption strip under each cell. */\n private readonly strip: number;\n\n /** Lines of caption the strip holds. */\n private readonly lines: number;\n\n /** How a picture is reduced into its cell. */\n private readonly reduction: \"area\" | \"nearest\";\n\n /**\n * Height in pixels of the caption strip a sheet writes under a cell of the given height, holding `lines` lines: the label stamp's 3 × 5 font at a scale of one font pixel per 90 cell pixels, at least one, one font pixel between lines and two of margin above and below.\n *\n * @evidence contracts/development/common.md#meaningful-documentation States the unit, what the strip holds, the scale rule and its floor, and the spacing.\n * @evidence contracts/development/implementation.md#principled-implementation One line is exactly the stamp's box, `5 × scale` of glyph plus `2 × scale` of margin on each side; each further line adds its glyph and one font pixel of space, `6 × scale`, so a strip of `n` lines is `(6n + 3) × scale` and holds every line uncut. The scale follows the cell, as it did when captions were drawn inside it.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure One expression, shared by the sheet and every layout that reserves the strip.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No fixed strip height: it follows the cell.\n * @evidence contracts/development/implementation.md#efficient-algorithms Constant.\n * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work A pure expression.\n * @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Returns a number.\n */\n public static caption(cellHeight: number, lines: number = 1): number {\n return (6 * lines + 3) * AutoMovieRasterSheet.scale(cellHeight);\n }\n\n /**\n * The lines a caption takes under a cell of the given size: its words in order, as many to a line as the stamp fits in the cell's width, a word longer than a line broken across lines.\n *\n * @evidence contracts/development/common.md#meaningful-documentation States the wrapping rule and the long-word case.\n * @evidence contracts/development/implementation.md#principled-implementation A stamped box is `4 × scale × characters + 3 × scale` pixels wide, so a line holds `floor((width - 3 × scale) / (4 × scale))` characters, at least one; greedy filling at spaces keeps every word whole where it fits.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure One pass over the words, shared by the sheet and every layout that sizes a strip.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No character is dropped: a word wider than the cell is broken, never cut.\n * @evidence contracts/development/implementation.md#efficient-algorithms Linear in the caption's length.\n * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work A pure function of its text and size.\n * @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Returns fresh strings.\n */\n public static wrap(\n caption: string,\n cellWidth: number,\n cellHeight: number,\n ): string[] {\n const scale: number = AutoMovieRasterSheet.scale(cellHeight);\n const room: number = Math.max(\n 1,\n Math.floor((cellWidth - 3 * scale) / (4 * scale)),\n );\n const lines: string[] = [];\n let line: string = \"\";\n for (const word of caption\n .split(\" \")\n .filter((part: string): boolean => part !== \"\")) {\n for (let rest: string = word; rest !== \"\"; ) {\n const joined: string = line === \"\" ? rest : `${line} ${rest}`;\n if (joined.length <= room) {\n line = joined;\n rest = \"\";\n } else if (line !== \"\") {\n lines.push(line);\n line = \"\";\n } else {\n lines.push(rest.slice(0, room));\n rest = rest.slice(room);\n }\n }\n }\n if (line !== \"\" || lines.length === 0) lines.push(line);\n return lines;\n }\n\n /**\n * The most lines any of the captions takes under a cell of the given size, at least one, which a sheet's strip must hold.\n *\n * @evidence contracts/development/common.md#meaningful-documentation States what is counted and the floor.\n * @evidence contracts/development/implementation.md#principled-implementation Every cell of a sheet has one strip height, so the strip holds the longest wrapped caption.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure One `wrap` per caption.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No caption is assumed short.\n * @evidence contracts/development/implementation.md#efficient-algorithms Linear in the captions' total length.\n * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work A pure function of its arguments.\n * @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Returns a number.\n */\n public static lines(\n captions: readonly string[],\n cellWidth: number,\n cellHeight: number,\n ): number {\n let most: number = 1;\n for (const caption of captions)\n most = Math.max(\n most,\n AutoMovieRasterSheet.wrap(caption, cellWidth, cellHeight).length,\n );\n return most;\n }\n\n /** The caption's font scale for a cell height: one font pixel per 90 cell pixels, at least one. */\n private static scale(cellHeight: number): number {\n return Math.max(1, Math.round(cellHeight / 90));\n }\n\n /**\n * Allocate an empty sheet.\n *\n * @param capacity Number of cells, a positive integer.\n * @param columns Cells per row, a positive integer.\n * @param cellWidth Cell width in pixels, a positive integer.\n * @param cellHeight Cell height in pixels, a positive integer, not counting the caption strip under it.\n * @param reduction `area` to average the pixels a cell pixel covers, `nearest` to copy the one at its centre.\n * @param lines Lines of caption the strip under each cell holds, a positive integer; a caption that wraps onto more lines keeps its first ones.\n */\n public constructor(\n capacity: number,\n columns: number,\n cellWidth: number,\n cellHeight: number,\n reduction: \"area\" | \"nearest\" = \"area\",\n lines: number = 1,\n ) {\n this.capacity = capacity;\n this.columns = columns;\n this.cellWidth = cellWidth;\n this.cellHeight = cellHeight;\n this.reduction = reduction;\n this.lines = lines;\n this.strip = AutoMovieRasterSheet.caption(cellHeight, lines);\n if (\n ![capacity, columns, cellWidth, cellHeight, lines].every(\n (value: number): boolean => Number.isSafeInteger(value) && value > 0,\n )\n )\n throw new Error(\n \"Sheet capacity, columns, cell size and caption lines must be positive integers\",\n );\n const used: number = Math.min(columns, capacity);\n const width: number = used * cellWidth;\n const height: number =\n Math.ceil(capacity / used) * (cellHeight + this.strip);\n if (width * height > 64_000_000)\n throw new Error(\"Sheet exceeds 64 megapixels\");\n this.sheet = {\n width,\n height,\n pixels: new Uint8ClampedArray(width * height * 4),\n };\n for (let offset: number = 3; offset < this.sheet.pixels.length; offset += 4)\n this.sheet.pixels[offset] = 255;\n this.count = 0;\n }\n\n /**\n * Reduce one frame into the next cell and write its caption in the strip under it.\n *\n * @evidence contracts/development/common.md#meaningful-documentation States that the frame fills the next cell and its caption the strip under it.\n * @evidence contracts/development/implementation.md#principled-implementation Under `area` each cell pixel averages the source pixels its footprint covers, so thin lines and small figures survive reduction instead of being skipped by point sampling; under `nearest` it copies the source pixel under its centre, `floor((x + 0.5) × source / cell)`, so every colour on the sheet is one the picture holds.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure One pass over the cell's pixels, then one caption strip.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A full sheet throws instead of overwriting a cell.\n * @evidence contracts/development/implementation.md#efficient-algorithms Linear in the source frame's pixel count.\n * @evidence contracts/development/implementation.md#reuse-equivalent-work The caption reuses the frame label stamp on a strip the width of the cell.\n * @evidence contracts/development/implementation.md#bound-retention-and-release-resources The frame is not retained.\n */\n public add(frame: IAutoMovieRasterImage, caption: string): void {\n if (this.count >= this.capacity) throw new Error(\"The sheet is full\");\n const left: number = (this.count % this.columns) * this.cellWidth;\n const top: number =\n Math.floor(this.count / this.columns) * (this.cellHeight + this.strip);\n const cell: IAutoMovieRasterImage = {\n width: this.cellWidth,\n height: this.cellHeight,\n pixels: new Uint8ClampedArray(this.cellWidth * this.cellHeight * 4),\n };\n for (let y: number = 0; y < this.cellHeight; y++) {\n const y0: number = Math.floor((y * frame.height) / this.cellHeight);\n const y1: number = Math.max(\n y0 + 1,\n Math.floor(((y + 1) * frame.height) / this.cellHeight),\n );\n for (let x: number = 0; x < this.cellWidth; x++) {\n const target: number = (y * this.cellWidth + x) * 4;\n cell.pixels[target + 3] = 255;\n\n // Nearest: the source pixel under the cell pixel's centre.\n if (this.reduction === \"nearest\") {\n const source: number =\n (Math.floor(((y + 0.5) * frame.height) / this.cellHeight) *\n frame.width +\n Math.floor(((x + 0.5) * frame.width) / this.cellWidth)) *\n 4;\n cell.pixels[target] = frame.pixels[source]!;\n cell.pixels[target + 1] = frame.pixels[source + 1]!;\n cell.pixels[target + 2] = frame.pixels[source + 2]!;\n continue;\n }\n\n // Area: the mean of the source pixels the cell pixel covers.\n const x0: number = Math.floor((x * frame.width) / this.cellWidth);\n const x1: number = Math.max(\n x0 + 1,\n Math.floor(((x + 1) * frame.width) / this.cellWidth),\n );\n let r: number = 0;\n let g: number = 0;\n let b: number = 0;\n for (let sy: number = y0; sy < y1; sy++)\n for (let sx: number = x0; sx < x1; sx++) {\n const source: number = (sy * frame.width + sx) * 4;\n r += frame.pixels[source]!;\n g += frame.pixels[source + 1]!;\n b += frame.pixels[source + 2]!;\n }\n const n: number = (y1 - y0) * (x1 - x0);\n cell.pixels[target] = r / n;\n cell.pixels[target + 1] = g / n;\n cell.pixels[target + 2] = b / n;\n }\n }\n\n // The caption in a dark strip under the cell, wrapped at the cell's width, one stamp per line.\n const strip: IAutoMovieRasterImage = {\n width: this.cellWidth,\n height: this.strip,\n pixels: new Uint8ClampedArray(this.cellWidth * this.strip * 4),\n };\n for (let offset: number = 0; offset < strip.pixels.length; offset += 4)\n strip.pixels.set([16, 16, 16, 255], offset);\n // Each line is stamped on a band of its own and only its glyph rows are copied, so a line's box never paints over the glyphs of the line above it.\n const scale: number = AutoMovieRasterSheet.scale(this.cellHeight);\n const row: number = this.cellWidth * 4;\n const band: IAutoMovieRasterImage = {\n width: this.cellWidth,\n height: 9 * scale,\n pixels: new Uint8ClampedArray(row * 9 * scale),\n };\n AutoMovieRasterSheet.wrap(caption, this.cellWidth, this.cellHeight)\n .slice(0, this.lines)\n .forEach((line: string, index: number): void => {\n for (let offset: number = 0; offset < band.pixels.length; offset += 4)\n band.pixels.set([16, 16, 16, 255], offset);\n stampAutoMovieRasterLabel(band, line, scale);\n strip.pixels.set(\n band.pixels.subarray(2 * scale * row, 7 * scale * row),\n (index * 6 + 2) * scale * row,\n );\n });\n for (const [picture, offset] of [\n [cell, 0],\n [strip, this.cellHeight],\n ] as const)\n for (let y: number = 0; y < picture.height; y++)\n this.sheet.pixels.set(\n picture.pixels.subarray(\n y * this.cellWidth * 4,\n (y + 1) * this.cellWidth * 4,\n ),\n ((top + offset + y) * this.sheet.width + left) * 4,\n );\n this.count++;\n }\n\n /**\n * The sheet as filled so far, cut to the rows and columns that hold a\n * picture.\n *\n * A sheet filled short of its capacity gives a picture no larger than its\n * filled cells: as wide as the cells of its first row and as tall as its\n * started rows, with the unfilled cells of a last row left black. That\n * picture is the caller's own, so a later `add` does not change it. It throws\n * when no picture was added.\n *\n * @evidence contracts/development/common.md#meaningful-documentation States the extent of the result, how unfilled cells look, who owns the picture and the refusal.\n * @evidence contracts/development/implementation.md#principled-implementation The extent follows the filled cell count, so a short last sheet carries no empty rows or columns for a reader to scroll or a model to spend attention on.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure A full sheet is returned; otherwise the filled extent is copied row by row.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts An empty sheet throws rather than producing a blank image, and a partly filled sheet is copied instead of handing out a buffer a later `add` would rewrite.\n * @evidence contracts/development/implementation.md#efficient-algorithms Constant time for a full sheet; linear in the filled extent otherwise.\n * @evidence contracts/development/implementation.md#reuse-equivalent-work A full sheet can take no further picture, so its own raster is returned without a copy.\n * @evidence contracts/development/implementation.md#bound-retention-and-release-resources The caller owns the returned raster; the sheet keeps no buffer besides its own.\n */\n public finish(): IAutoMovieRasterImage {\n if (this.count === 0) throw new Error(\"The sheet has no frames\");\n if (this.count === this.capacity) return this.sheet;\n const width: number = Math.min(this.columns, this.count) * this.cellWidth;\n const height: number =\n Math.ceil(this.count / this.columns) * (this.cellHeight + this.strip);\n const pixels: Uint8ClampedArray = new Uint8ClampedArray(width * height * 4);\n for (let y: number = 0; y < height; y++)\n pixels.set(\n this.sheet.pixels.subarray(\n y * this.sheet.width * 4,\n (y * this.sheet.width + width) * 4,\n ),\n y * width * 4,\n );\n return { width, height, pixels };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,IAAa,uBAAb,MAAa,qBAAqB;;CAEhC;;CAGA;;CAGA;;CAGA;;CAGA;;CAGA;;CAGA;;CAGA;;CAGA;;;;;;;;;;;;CAaA,OAAc,QAAQ,YAAoB,QAAgB,GAAW;EACnE,QAAQ,IAAI,QAAQ,KAAK,qBAAqB,MAAM,UAAU;CAChE;;;;;;;;;;;;CAaA,OAAc,KACZ,SACA,WACA,YACU;EACV,MAAM,QAAgB,qBAAqB,MAAM,UAAU;EAC3D,MAAM,OAAe,KAAK,IACxB,GACA,KAAK,OAAO,YAAY,IAAI,UAAU,IAAI,MAAM,CAClD;EACA,MAAM,QAAkB,CAAC;EACzB,IAAI,OAAe;EACnB,KAAK,MAAM,QAAQ,QAChB,MAAM,GAAG,CAAC,CACV,QAAQ,SAA0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GAAG,GAAG,MAAM;GAC3C,0BAA0B,MAAM,MAAM,KAAK;GAC3C,MAAM,OAAO,IACX,KAAK,OAAO,SAAS,IAAI,QAAQ,KAAK,IAAI,QAAQ,GAAG,IACpD,QAAQ,IAAI,KAAK,QAAQ,GAC5B;EACF,CAAC;EACH,KAAK,MAAM,CAAC,SAAS,WAAW,CAC9B,CAAC,MAAM,CAAC,GACR,CAAC,OAAO,KAAK,UAAU,CACzB,GACE,KAAK,IAAI,IAAY,GAAG,IAAI,QAAQ,QAAQ,KAC1C,KAAK,MAAM,OAAO,IAChB,QAAQ,OAAO,SACb,IAAI,KAAK,YAAY,IACpB,IAAI,KAAK,KAAK,YAAY,CAC7B,KACE,MAAM,SAAS,KAAK,KAAK,MAAM,QAAQ,QAAQ,CACnD;EACJ,KAAK;CACP;;;;;;;;;;;;;;;;;;;CAoBA,SAAuC;EACrC,IAAI,KAAK,UAAU,GAAG,MAAM,IAAI,MAAM,yBAAyB;EAC/D,IAAI,KAAK,UAAU,KAAK,UAAU,OAAO,KAAK;EAC9C,MAAM,QAAgB,KAAK,IAAI,KAAK,SAAS,KAAK,KAAK,IAAI,KAAK;EAChE,MAAM,SACJ,KAAK,KAAK,KAAK,QAAQ,KAAK,OAAO,KAAK,KAAK,aAAa,KAAK;EACjE,MAAM,SAA4B,IAAI,kBAAkB,QAAQ,SAAS,CAAC;EAC1E,KAAK,IAAI,IAAY,GAAG,IAAI,QAAQ,KAClC,OAAO,IACL,KAAK,MAAM,OAAO,SAChB,IAAI,KAAK,MAAM,QAAQ,IACtB,IAAI,KAAK,MAAM,QAAQ,SAAS,CACnC,GACA,IAAI,QAAQ,CACd;EACF,OAAO;GAAE;GAAO;GAAQ;EAAO;CACjC;AACF"}
1
+ {"version":3,"file":"AutoMovieRasterSheet.mjs","names":[],"sources":["../../src/picture/AutoMovieRasterSheet.ts"],"sourcesContent":["import type {\n IAutoMovieCaptureBudget,\n IAutoMovieRasterImage,\n} from \"@automovie/interface\";\n\nimport { stampAutoMovieRasterLabel } from \"./stampAutoMovieRasterLabel.js\";\n\n/**\n * A contact sheet of pictures, filled one picture at a time: each picture is\n * reduced into its cell in row-major order, and its caption is written in a\n * dark strip under the cell, outside the picture, so the caption hides no part\n * of the subject or its legend and stays legible however small the cell is.\n * A caption longer than the cell is wide wraps onto further lines at word\n * boundaries, so it keeps every word that identifies the cell; the sheet's\n * strip holds the number of lines its constructor states, which\n * `AutoMovieRasterSheet.lines` and `AutoMovieRasterSheet.caption` let a layout\n * size from its captions before any picture is added. Reduction averages\n * every source pixel a cell pixel covers (`area`, the default), or copies the\n * source pixel at the cell pixel's centre (`nearest`), which keeps exact\n * colours for a review that reads pixel values.\n *\n * A cell takes any picture, a drawn frame, a difference image or a decoded\n * still alike. Pictures are reduced as they arrive, so a sheet never holds\n * more than its own pixels; the finished sheet is an ordinary picture for\n * `encodeAutoMovieRasterPng`, cut to the cells that were filled.\n *\n * ```ts\n * const sheet = new AutoMovieRasterSheet(20, 5, 180, 320);\n * for (const [seconds, frame] of frames) sheet.add(frame, `${seconds}s`);\n * await writeFile(\"sheet.png\", await encodeAutoMovieRasterPng(sheet.finish()));\n * ```\n *\n * @evidence contracts/development/common.md#meaningful-documentation The comment states the fill order, both reductions and what each keeps, where captions are drawn and why, the memory bound, the extent of the result and how it is encoded.\n * @evidence contracts/development/design.md#principled-representation The sheet is itself an IAutoMovieRasterImage, so encoding and captioning reuse the frame path unchanged.\n * @evidence contracts/development/design.md#minimal-and-owned-surface A constructor, `add` and `finish`, and the statics `lines` and `caption` that a layout reads to reserve the strip; layout is fixed by the constructor.\n * @evidence contracts/development/design.md#prohibited-design-shortcuts Nothing names a film or capture command; captions are caller text.\n */\nexport class AutoMovieRasterSheet {\n /** The sheet pixels, opaque RGBA. */\n private readonly sheet: IAutoMovieRasterImage;\n\n /** Cells filled so far. */\n private count: number;\n\n /** Number of cells. */\n private readonly capacity: number;\n\n /** Cells per row. */\n private readonly columns: number;\n\n /** Cell width in pixels. */\n private readonly cellWidth: number;\n\n /** Cell height in pixels, the picture alone. */\n private readonly cellHeight: number;\n\n /** Height in pixels of the caption strip under each cell. */\n private readonly strip: number;\n\n /** Lines of caption the strip holds. */\n private readonly lines: number;\n\n /** How a picture is reduced into its cell. */\n private readonly reduction: IAutoMovieCaptureBudget[\"reduction\"];\n\n /**\n * Height in pixels of the caption strip a sheet writes under a cell of the given height, holding `lines` lines: the label stamp's 3 × 5 font at a scale of one font pixel per 90 cell pixels, at least one, one font pixel between lines and two of margin above and below.\n *\n * @evidence contracts/development/common.md#meaningful-documentation States the unit, what the strip holds, the scale rule and its floor, and the spacing.\n * @evidence contracts/development/implementation.md#principled-implementation One line is exactly the stamp's box, `5 × scale` of glyph plus `2 × scale` of margin on each side; each further line adds its glyph and one font pixel of space, `6 × scale`, so a strip of `n` lines is `(6n + 3) × scale` and holds every line uncut. The scale follows the cell, as it did when captions were drawn inside it.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure One expression, shared by the sheet and every layout that reserves the strip.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No fixed strip height: it follows the cell.\n * @evidence contracts/development/implementation.md#efficient-algorithms Constant.\n * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work A pure expression.\n * @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Returns a number.\n */\n public static caption(cellHeight: number, lines: number = 1): number {\n return (6 * lines + 3) * AutoMovieRasterSheet.scale(cellHeight);\n }\n\n /**\n * The lines a caption takes under a cell of the given size: its words in order, as many to a line as the stamp fits in the cell's width, a word longer than a line broken across lines.\n *\n * @evidence contracts/development/common.md#meaningful-documentation States the wrapping rule and the long-word case.\n * @evidence contracts/development/implementation.md#principled-implementation A stamped box is `4 × scale × characters + 3 × scale` pixels wide, so a line holds `floor((width - 3 × scale) / (4 × scale))` characters, at least one; greedy filling at spaces keeps every word whole where it fits.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure One pass over the words, shared by the sheet and every layout that sizes a strip.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No character is dropped: a word wider than the cell is broken, never cut.\n * @evidence contracts/development/implementation.md#efficient-algorithms Linear in the caption's length.\n * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work A pure function of its text and size.\n * @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Returns fresh strings.\n */\n public static wrap(\n caption: string,\n cellWidth: number,\n cellHeight: number,\n ): string[] {\n const scale: number = AutoMovieRasterSheet.scale(cellHeight);\n const room: number = Math.max(\n 1,\n Math.floor((cellWidth - 3 * scale) / (4 * scale)),\n );\n const lines: string[] = [];\n let line: string = \"\";\n for (const word of caption\n .split(\" \")\n .filter((part: string): boolean => part !== \"\")) {\n for (let rest: string = word; rest !== \"\"; ) {\n const joined: string = line === \"\" ? rest : `${line} ${rest}`;\n if (joined.length <= room) {\n line = joined;\n rest = \"\";\n } else if (line !== \"\") {\n lines.push(line);\n line = \"\";\n } else {\n lines.push(rest.slice(0, room));\n rest = rest.slice(room);\n }\n }\n }\n if (line !== \"\" || lines.length === 0) lines.push(line);\n return lines;\n }\n\n /**\n * The most lines any of the captions takes under a cell of the given size, at least one, which a sheet's strip must hold.\n *\n * @evidence contracts/development/common.md#meaningful-documentation States what is counted and the floor.\n * @evidence contracts/development/implementation.md#principled-implementation Every cell of a sheet has one strip height, so the strip holds the longest wrapped caption.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure One `wrap` per caption.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No caption is assumed short.\n * @evidence contracts/development/implementation.md#efficient-algorithms Linear in the captions' total length.\n * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work A pure function of its arguments.\n * @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Returns a number.\n */\n public static lines(\n captions: readonly string[],\n cellWidth: number,\n cellHeight: number,\n ): number {\n let most: number = 1;\n for (const caption of captions)\n most = Math.max(\n most,\n AutoMovieRasterSheet.wrap(caption, cellWidth, cellHeight).length,\n );\n return most;\n }\n\n /** The caption's font scale for a cell height: one font pixel per 90 cell pixels, at least one. */\n private static scale(cellHeight: number): number {\n return Math.max(1, Math.round(cellHeight / 90));\n }\n\n /**\n * Allocate an empty sheet.\n *\n * @param capacity Number of cells, a positive integer.\n * @param columns Cells per row, a positive integer.\n * @param cellWidth Cell width in pixels, a positive integer.\n * @param cellHeight Cell height in pixels, a positive integer, not counting the caption strip under it.\n * @param reduction `area` to average the pixels a cell pixel covers, `nearest` to copy the one at its centre.\n * @param lines Lines of caption the strip under each cell holds, a positive integer; a caption that wraps onto more lines keeps its first ones.\n */\n public constructor(\n capacity: number,\n columns: number,\n cellWidth: number,\n cellHeight: number,\n reduction: IAutoMovieCaptureBudget[\"reduction\"] = \"area\",\n lines: number = 1,\n ) {\n this.capacity = capacity;\n this.columns = columns;\n this.cellWidth = cellWidth;\n this.cellHeight = cellHeight;\n this.reduction = reduction;\n this.lines = lines;\n this.strip = AutoMovieRasterSheet.caption(cellHeight, lines);\n if (\n ![capacity, columns, cellWidth, cellHeight, lines].every(\n (value: number): boolean => Number.isSafeInteger(value) && value > 0,\n )\n )\n throw new Error(\n \"Sheet capacity, columns, cell size and caption lines must be positive integers\",\n );\n const used: number = Math.min(columns, capacity);\n const width: number = used * cellWidth;\n const height: number =\n Math.ceil(capacity / used) * (cellHeight + this.strip);\n if (width * height > 64_000_000)\n throw new Error(\"Sheet exceeds 64 megapixels\");\n this.sheet = {\n width,\n height,\n pixels: new Uint8ClampedArray(width * height * 4),\n };\n for (let offset: number = 3; offset < this.sheet.pixels.length; offset += 4)\n this.sheet.pixels[offset] = 255;\n this.count = 0;\n }\n\n /**\n * Reduce one frame into the next cell and write its caption in the strip under it.\n *\n * @evidence contracts/development/common.md#meaningful-documentation States that the frame fills the next cell and its caption the strip under it.\n * @evidence contracts/development/implementation.md#principled-implementation Under `area` each cell pixel averages the source pixels its footprint covers, so thin lines and small figures survive reduction instead of being skipped by point sampling; under `nearest` it copies the source pixel under its centre, `floor((x + 0.5) × source / cell)`, so every colour on the sheet is one the picture holds.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure One pass over the cell's pixels, then one caption strip.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A full sheet throws instead of overwriting a cell.\n * @evidence contracts/development/implementation.md#efficient-algorithms Linear in the source frame's pixel count.\n * @evidence contracts/development/implementation.md#reuse-equivalent-work The caption reuses the frame label stamp on a strip the width of the cell.\n * @evidence contracts/development/implementation.md#bound-retention-and-release-resources The frame is not retained.\n */\n public add(frame: IAutoMovieRasterImage, caption: string): void {\n if (this.count >= this.capacity) throw new Error(\"The sheet is full\");\n const left: number = (this.count % this.columns) * this.cellWidth;\n const top: number =\n Math.floor(this.count / this.columns) * (this.cellHeight + this.strip);\n const cell: IAutoMovieRasterImage = {\n width: this.cellWidth,\n height: this.cellHeight,\n pixels: new Uint8ClampedArray(this.cellWidth * this.cellHeight * 4),\n };\n for (let y: number = 0; y < this.cellHeight; y++) {\n const y0: number = Math.floor((y * frame.height) / this.cellHeight);\n const y1: number = Math.max(\n y0 + 1,\n Math.floor(((y + 1) * frame.height) / this.cellHeight),\n );\n for (let x: number = 0; x < this.cellWidth; x++) {\n const target: number = (y * this.cellWidth + x) * 4;\n cell.pixels[target + 3] = 255;\n\n // Nearest: the source pixel under the cell pixel's centre.\n if (this.reduction === \"nearest\") {\n const source: number =\n (Math.floor(((y + 0.5) * frame.height) / this.cellHeight) *\n frame.width +\n Math.floor(((x + 0.5) * frame.width) / this.cellWidth)) *\n 4;\n cell.pixels[target] = frame.pixels[source]!;\n cell.pixels[target + 1] = frame.pixels[source + 1]!;\n cell.pixels[target + 2] = frame.pixels[source + 2]!;\n continue;\n }\n\n // Area: the mean of the source pixels the cell pixel covers.\n const x0: number = Math.floor((x * frame.width) / this.cellWidth);\n const x1: number = Math.max(\n x0 + 1,\n Math.floor(((x + 1) * frame.width) / this.cellWidth),\n );\n let r: number = 0;\n let g: number = 0;\n let b: number = 0;\n for (let sy: number = y0; sy < y1; sy++)\n for (let sx: number = x0; sx < x1; sx++) {\n const source: number = (sy * frame.width + sx) * 4;\n r += frame.pixels[source]!;\n g += frame.pixels[source + 1]!;\n b += frame.pixels[source + 2]!;\n }\n const n: number = (y1 - y0) * (x1 - x0);\n cell.pixels[target] = r / n;\n cell.pixels[target + 1] = g / n;\n cell.pixels[target + 2] = b / n;\n }\n }\n\n // The caption in a dark strip under the cell, wrapped at the cell's width, one stamp per line.\n const strip: IAutoMovieRasterImage = {\n width: this.cellWidth,\n height: this.strip,\n pixels: new Uint8ClampedArray(this.cellWidth * this.strip * 4),\n };\n for (let offset: number = 0; offset < strip.pixels.length; offset += 4)\n strip.pixels.set([16, 16, 16, 255], offset);\n // Each line is stamped on a band of its own and only its glyph rows are copied, so a line's box never paints over the glyphs of the line above it.\n const scale: number = AutoMovieRasterSheet.scale(this.cellHeight);\n const row: number = this.cellWidth * 4;\n const band: IAutoMovieRasterImage = {\n width: this.cellWidth,\n height: 9 * scale,\n pixels: new Uint8ClampedArray(row * 9 * scale),\n };\n AutoMovieRasterSheet.wrap(caption, this.cellWidth, this.cellHeight)\n .slice(0, this.lines)\n .forEach((line: string, index: number): void => {\n for (let offset: number = 0; offset < band.pixels.length; offset += 4)\n band.pixels.set([16, 16, 16, 255], offset);\n stampAutoMovieRasterLabel(band, line, scale);\n strip.pixels.set(\n band.pixels.subarray(2 * scale * row, 7 * scale * row),\n (index * 6 + 2) * scale * row,\n );\n });\n for (const [picture, offset] of [\n [cell, 0],\n [strip, this.cellHeight],\n ] as const)\n for (let y: number = 0; y < picture.height; y++)\n this.sheet.pixels.set(\n picture.pixels.subarray(\n y * this.cellWidth * 4,\n (y + 1) * this.cellWidth * 4,\n ),\n ((top + offset + y) * this.sheet.width + left) * 4,\n );\n this.count++;\n }\n\n /**\n * The sheet as filled so far, cut to the rows and columns that hold a\n * picture.\n *\n * A sheet filled short of its capacity gives a picture no larger than its\n * filled cells: as wide as the cells of its first row and as tall as its\n * started rows, with the unfilled cells of a last row left black. That\n * picture is the caller's own, so a later `add` does not change it. It throws\n * when no picture was added.\n *\n * @evidence contracts/development/common.md#meaningful-documentation States the extent of the result, how unfilled cells look, who owns the picture and the refusal.\n * @evidence contracts/development/implementation.md#principled-implementation The extent follows the filled cell count, so a short last sheet carries no empty rows or columns for a reader to scroll or a model to spend attention on.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure A full sheet is returned; otherwise the filled extent is copied row by row.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts An empty sheet throws rather than producing a blank image, and a partly filled sheet is copied instead of handing out a buffer a later `add` would rewrite.\n * @evidence contracts/development/implementation.md#efficient-algorithms Constant time for a full sheet; linear in the filled extent otherwise.\n * @evidence contracts/development/implementation.md#reuse-equivalent-work A full sheet can take no further picture, so its own raster is returned without a copy.\n * @evidence contracts/development/implementation.md#bound-retention-and-release-resources The caller owns the returned raster; the sheet keeps no buffer besides its own.\n */\n public finish(): IAutoMovieRasterImage {\n if (this.count === 0) throw new Error(\"The sheet has no frames\");\n if (this.count === this.capacity) return this.sheet;\n const width: number = Math.min(this.columns, this.count) * this.cellWidth;\n const height: number =\n Math.ceil(this.count / this.columns) * (this.cellHeight + this.strip);\n const pixels: Uint8ClampedArray = new Uint8ClampedArray(width * height * 4);\n for (let y: number = 0; y < height; y++)\n pixels.set(\n this.sheet.pixels.subarray(\n y * this.sheet.width * 4,\n (y * this.sheet.width + width) * 4,\n ),\n y * width * 4,\n );\n return { width, height, pixels };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,IAAa,uBAAb,MAAa,qBAAqB;;CAEhC;;CAGA;;CAGA;;CAGA;;CAGA;;CAGA;;CAGA;;CAGA;;CAGA;;;;;;;;;;;;CAaA,OAAc,QAAQ,YAAoB,QAAgB,GAAW;EACnE,QAAQ,IAAI,QAAQ,KAAK,qBAAqB,MAAM,UAAU;CAChE;;;;;;;;;;;;CAaA,OAAc,KACZ,SACA,WACA,YACU;EACV,MAAM,QAAgB,qBAAq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ACF,OAAO;GAAE;GAAO;GAAQ;EAAO;CACjC;AACF"}
@@ -1,33 +1 @@
1
- import type { IAutoMovieRasterImage } from "./IAutoMovieRasterImage.js";
2
- /**
3
- * What `compareAutoMovieRasters` found between two pictures of one size: a
4
- * difference image to look at and the numbers that say how much changed and
5
- * where.
6
- *
7
- * @evidence contracts/development/common.md#meaningful-documentation Names the producing call; each member states its unit, range and what an unchanged pair yields.
8
- * @evidence contracts/development/design.md#principled-representation A reviewer needs the picture and a gate needs the count, so both come from one pass; the box says where to look and is null when nothing changed instead of an empty rectangle.
9
- * @evidence contracts/development/design.md#minimal-and-owned-surface Five members: the image a sheet takes, and the count, share, magnitude and place a comparison record takes.
10
- * @evidence contracts/development/design.md#prohibited-design-shortcuts No pass or fail verdict is stored; the threshold belongs to the caller who knows what was meant to change.
11
- */
12
- export interface IAutoMovieRasterComparison {
13
- /**
14
- * The newer picture in dimmed grey with every changed pixel in magenta.
15
- */
16
- image: IAutoMovieRasterImage;
17
- /** Number of pixels whose largest channel difference exceeds the tolerance. */
18
- changed: number;
19
- /** `changed` over the pixel count, in [0, 1]. */
20
- ratio: number;
21
- /** Largest channel difference found anywhere, 0 to 255, tolerance not applied. */
22
- maximum: number;
23
- /**
24
- * Smallest box holding every changed pixel, in inclusive pixel coordinates
25
- * from the top-left corner, or null when no pixel changed.
26
- */
27
- bounds: {
28
- left: number;
29
- top: number;
30
- right: number;
31
- bottom: number;
32
- } | null;
33
- }
1
+ export type { IAutoMovieRasterComparison } from "@automovie/interface";
@@ -1,17 +1 @@
1
- /**
2
- * An opaque sRGB picture as the raster tools exchange it: a frame the draw-only
3
- * function returned, a contact sheet, a difference image or a file a host decoded.
4
- *
5
- * @evidence contracts/development/common.md#meaningful-documentation Names the four producers of such a picture; each member states its unit and layout.
6
- * @evidence contracts/development/design.md#principled-representation Integer size and row-major RGBA bytes are what a PNG encoder, a label stamp, a sheet and a comparison all read, so one shape passes between them without conversion.
7
- * @evidence contracts/development/design.md#minimal-and-owned-surface Three members, each read by every consumer; drawing counts stay on the frame type that has them.
8
- * @evidence contracts/development/design.md#prohibited-design-shortcuts A picture with no drawing history, such as a decoded file, is not made to carry invented statistics.
9
- */
10
- export interface IAutoMovieRasterImage {
11
- /** Width in pixels. */
12
- width: number;
13
- /** Height in pixels. */
14
- height: number;
15
- /** Opaque sRGB RGBA bytes, row-major from the top-left corner. */
16
- pixels: Uint8ClampedArray;
17
- }
1
+ export type { IAutoMovieRasterImage } from "@automovie/interface";
@@ -1,5 +1,4 @@
1
- import type { IAutoMovieRasterComparison } from "./IAutoMovieRasterComparison.js";
2
- import type { IAutoMovieRasterImage } from "./IAutoMovieRasterImage.js";
1
+ import type { IAutoMovieRasterComparison, IAutoMovieRasterImage } from "@automovie/interface";
3
2
  /**
4
3
  * Compare two pictures of one size pixel by pixel, for reading what a
5
4
  * correction changed and what it left alone.
@@ -1 +1 @@
1
- {"version":3,"file":"compareAutoMovieRasters.js","sourceRoot":"","sources":["../../src/picture/compareAutoMovieRasters.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,iCACE,MAA6B,EAC7B,KAA4B,EAC5B,SAAS,GAAW,CAAC;IAErB,IAAI,MAAM,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,IAAI,MAAM,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM;QAChE,MAAM,IAAI,KAAK,CACb,oCAAoC,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,MAAM,YAAY,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,CAC3G,CAAC;IACJ,MAAM,KAAK,GAAW,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC;IACjD,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,KAAK,KAAK,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,KAAK,KAAK,GAAG,CAAC;QACzE,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CA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B,SAAS;QACX,CAAC;QAED,kDAAkD;QAClD,MAAM,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC;QACrB,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;QACzB,OAAO,EAAE,CAAC;QACV,MAAM,CAAC,GAAW,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QACtC,MAAM,CAAC,GAAW,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAClD,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACzB,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACvB,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC3B,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO;QACL,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE;QAC3D,OAAO;QACP,KAAK,EAAE,OAAO,GAAG,KAAK;QACtB,OAAO;QACP,MAAM,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE;KAC5D,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"compareAutoMovieRasters.mjs","names":[],"sources":["../../src/picture/compareAutoMovieRasters.ts"],"sourcesContent":["import type { IAutoMovieRasterComparison } from \"./IAutoMovieRasterComparison.js\";\nimport type { IAutoMovieRasterImage } from \"./IAutoMovieRasterImage.js\";\n\n/**\n * Compare two pictures of one size pixel by pixel, for reading what a\n * correction changed and what it left alone.\n *\n * A pixel is changed when its largest red, green or blue difference exceeds\n * `tolerance`, a byte count that is zero when omitted. The difference image\n * shows the newer picture as grey at half its luma, so the subject stays\n * recognizable, with every changed pixel in magenta.\n *\n * ```ts\n * const difference = compareAutoMovieRasters(before, after);\n * if (difference.changed > 0) sheet.add(difference.image, \"changed\");\n * ```\n *\n * @evidence contracts/development/common.md#meaningful-documentation States the change rule and its unit, the default tolerance and how the difference image is coloured and why.\n * @evidence contracts/development/implementation.md#principled-implementation The change measure is the Chebyshev distance between the two sRGB byte triples, which a lossless capture of an unchanged deterministic frame leaves at exactly zero; the grey is Rec. 709 luma of the encoded bytes.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure One pass over the pixels fills the image and accumulates the count, the maximum and the box.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Pictures of different sizes, a buffer that disagrees with its size and a negative or non-finite tolerance throw; nothing is resampled to force a comparison.\n * @evidence contracts/development/implementation.md#efficient-algorithms Linear in the pixel count with constant work per pixel.\n * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Each pair is compared once by its caller; no intermediate result is shared between pairs.\n * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Allocates the difference image only; neither input is retained or written.\n */\nexport function compareAutoMovieRasters(\n before: IAutoMovieRasterImage,\n after: IAutoMovieRasterImage,\n tolerance: number = 0,\n): IAutoMovieRasterComparison {\n if (before.width !== after.width || before.height !== after.height)\n throw new Error(\n `Compared rasters differ in size: ${before.width}x${before.height} against ${after.width}x${after.height}`,\n );\n const count: number = after.width * after.height;\n if (before.pixels.length !== count * 4 || after.pixels.length !== count * 4)\n throw new Error(\"Raster pixels do not match its size\");\n if (!Number.isFinite(tolerance) || tolerance < 0)\n throw new Error(\"Comparison tolerance must be a non-negative number\");\n\n const pixels: Uint8ClampedArray = new Uint8ClampedArray(count * 4);\n let changed: number = 0;\n let maximum: number = 0;\n let left: number = after.width;\n let top: number = after.height;\n let right: number = -1;\n let bottom: number = -1;\n for (let index: number = 0; index < count; index++) {\n const offset: number = index * 4;\n const r: number = after.pixels[offset]!;\n const g: number = after.pixels[offset + 1]!;\n const b: number = after.pixels[offset + 2]!;\n const delta: number = Math.max(\n Math.abs(r - before.pixels[offset]!),\n Math.abs(g - before.pixels[offset + 1]!),\n Math.abs(b - before.pixels[offset + 2]!),\n );\n maximum = Math.max(maximum, delta);\n pixels[offset + 3] = 255;\n\n // Unchanged: the newer picture, dimmed so the marks stand out.\n if (delta <= tolerance) {\n const grey: number = (0.2126 * r + 0.7152 * g + 0.0722 * b) * 0.5;\n pixels[offset] = grey;\n pixels[offset + 1] = grey;\n pixels[offset + 2] = grey;\n continue;\n }\n\n // Changed: magenta, and the box grows to hold it.\n pixels[offset] = 255;\n pixels[offset + 2] = 255;\n changed++;\n const x: number = index % after.width;\n const y: number = Math.floor(index / after.width);\n left = Math.min(left, x);\n top = Math.min(top, y);\n right = Math.max(right, x);\n bottom = Math.max(bottom, y);\n }\n return {\n image: { width: after.width, height: after.height, pixels },\n changed,\n ratio: changed / count,\n maximum,\n bounds: changed === 0 ? null : { left, top, right, bottom },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,wBACd,QACA,OACA,YAAoB,GACQ;CAC5B,IAAI,OAAO,UAAU,MAAM,SAAS,OAAO,WAAW,MAAM,QAC1D,MAAM,IAAI,MACR,oCAAoC,OAAO,MAAM,GAAG,OAAO,OAAO,WAAW,MAAM,MAAM,GAAG,MAAM,QACpG;CACF,MAAM,QAAgB,MAAM,QAAQ,MAAM;CAC1C,IAAI,OAAO,OAAO,WAAW,QAAQ,KAAK,MAAM,OAAO,WAAW,QAAQ,GACxE,MAAM,IAAI,MAAM,qCAAqC;CACvD,IAAI,CAAC,OAAO,SAAS,SAAS,KAAK,YAAY,GAC7C,MAAM,IAAI,MAAM,oDAAoD;CAEtE,MAAM,SAA4B,IAAI,kBAAkB,QAAQ,CAAC;CACjE,IAAI,UAAkB;CACtB,IAAI,UAAkB;CACtB,IAAI,OAAe,MAAM;CACzB,IAAI,MAAc,MAAM;CACxB,IAAI,QAAgB;CACpB,IAAI,SAAiB;CACrB,KAAK,IAAI,QAAgB,GAAG,QAAQ,OAAO,SAAS;EAClD,MAAM,SAAiB,QAAQ;EAC/B,MAAM,IAAY,MAAM,OAAO;EAC/B,MAAM,IAAY,MAAM,OAAO,SAAS;EACxC,MAAM,IAAY,MAAM,OAAO,SAAS;EACxC,MAAM,QAAgB,KAAK,IACzB,KAAK,IAAI,IAAI,OAAO,OAAO,OAAQ,GACnC,KAAK,IAAI,IAAI,OAAO,OAAO,SAAS,EAAG,GACvC,KAAK,IAAI,IAAI,OAAO,OAAO,SAAS,EAAG,CACzC;EACA,UAAU,KAAK,IAAI,SAAS,KAAK;EACjC,OAAO,SAAS,KAAK;EAGrB,IAAI,SAAS,WAAW;GACtB,MAAM,QAAgB,QAAS,IAAI,QAAS,IAAI,QAAS,KAAK;GAC9D,OAAO,UAAU;GACjB,OAAO,SAAS,KAAK;GACrB,OAAO,SAAS,KAAK;GACrB;EACF;EAGA,OAAO,UAAU;EACjB,OAAO,SAAS,KAAK;EACrB;EACA,MAAM,IAAY,QAAQ,MAAM;EAChC,MAAM,IAAY,KAAK,MAAM,QAAQ,MAAM,KAAK;EAChD,OAAO,KAAK,IAAI,MAAM,CAAC;EACvB,MAAM,KAAK,IAAI,KAAK,CAAC;EACrB,QAAQ,KAAK,IAAI,OAAO,CAAC;EACzB,SAAS,KAAK,IAAI,QAAQ,CAAC;CAC7B;CACA,OAAO;EACL,OAAO;GAAE,OAAO,MAAM;GAAO,QAAQ,MAAM;GAAQ;EAAO;EAC1D;EACA,OAAO,UAAU;EACjB;EACA,QAAQ,YAAY,IAAI,OAAO;GAAE;GAAM;GAAK;GAAO;EAAO;CAC5D;AACF"}
1
+ {"version":3,"file":"compareAutoMovieRasters.mjs","names":[],"sources":["../../src/picture/compareAutoMovieRasters.ts"],"sourcesContent":["import type {\n IAutoMovieRasterComparison,\n IAutoMovieRasterImage,\n} from \"@automovie/interface\";\n\n/**\n * Compare two pictures of one size pixel by pixel, for reading what a\n * correction changed and what it left alone.\n *\n * A pixel is changed when its largest red, green or blue difference exceeds\n * `tolerance`, a byte count that is zero when omitted. The difference image\n * shows the newer picture as grey at half its luma, so the subject stays\n * recognizable, with every changed pixel in magenta.\n *\n * ```ts\n * const difference = compareAutoMovieRasters(before, after);\n * if (difference.changed > 0) sheet.add(difference.image, \"changed\");\n * ```\n *\n * @evidence contracts/development/common.md#meaningful-documentation States the change rule and its unit, the default tolerance and how the difference image is coloured and why.\n * @evidence contracts/development/implementation.md#principled-implementation The change measure is the Chebyshev distance between the two sRGB byte triples, which a lossless capture of an unchanged deterministic frame leaves at exactly zero; the grey is Rec. 709 luma of the encoded bytes.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure One pass over the pixels fills the image and accumulates the count, the maximum and the box.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Pictures of different sizes, a buffer that disagrees with its size and a negative or non-finite tolerance throw; nothing is resampled to force a comparison.\n * @evidence contracts/development/implementation.md#efficient-algorithms Linear in the pixel count with constant work per pixel.\n * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Each pair is compared once by its caller; no intermediate result is shared between pairs.\n * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Allocates the difference image only; neither input is retained or written.\n */\nexport function compareAutoMovieRasters(\n before: IAutoMovieRasterImage,\n after: IAutoMovieRasterImage,\n tolerance: number = 0,\n): IAutoMovieRasterComparison {\n if (before.width !== after.width || before.height !== after.height)\n throw new Error(\n `Compared rasters differ in size: ${before.width}x${before.height} against ${after.width}x${after.height}`,\n );\n const count: number = after.width * after.height;\n if (before.pixels.length !== count * 4 || after.pixels.length !== count * 4)\n throw new Error(\"Raster pixels do not match its size\");\n if (!Number.isFinite(tolerance) || tolerance < 0)\n throw new Error(\"Comparison tolerance must be a non-negative number\");\n\n const pixels: Uint8ClampedArray = new Uint8ClampedArray(count * 4);\n let changed: number = 0;\n let maximum: number = 0;\n let left: number = after.width;\n let top: number = after.height;\n let right: number = -1;\n let bottom: number = -1;\n for (let index: number = 0; index < count; index++) {\n const offset: number = index * 4;\n const r: number = after.pixels[offset]!;\n const g: number = after.pixels[offset + 1]!;\n const b: number = after.pixels[offset + 2]!;\n const delta: number = Math.max(\n Math.abs(r - before.pixels[offset]!),\n Math.abs(g - before.pixels[offset + 1]!),\n Math.abs(b - before.pixels[offset + 2]!),\n );\n maximum = Math.max(maximum, delta);\n pixels[offset + 3] = 255;\n\n // Unchanged: the newer picture, dimmed so the marks stand out.\n if (delta <= tolerance) {\n const grey: number = (0.2126 * r + 0.7152 * g + 0.0722 * b) * 0.5;\n pixels[offset] = grey;\n pixels[offset + 1] = grey;\n pixels[offset + 2] = grey;\n continue;\n }\n\n // Changed: magenta, and the box grows to hold it.\n pixels[offset] = 255;\n pixels[offset + 2] = 255;\n changed++;\n const x: number = index % after.width;\n const y: number = Math.floor(index / after.width);\n left = Math.min(left, x);\n top = Math.min(top, y);\n right = Math.max(right, x);\n bottom = Math.max(bottom, y);\n }\n return {\n image: { width: after.width, height: after.height, pixels },\n changed,\n ratio: changed / count,\n maximum,\n bounds: changed === 0 ? null : { left, top, right, bottom },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA2BA,SAAgB,wBACd,QACA,OACA,YAAoB,GACQ;CAC5B,IAAI,OAAO,UAAU,MAAM,SAAS,OAAO,WAAW,MAAM,QAC1D,MAAM,IAAI,MACR,oCAAoC,OAAO,MAAM,GAAG,OAAO,OAAO,WAAW,MAAM,MAAM,GAAG,MAAM,QACpG;CACF,MAAM,QAAgB,MAAM,QAAQ,MAAM;CAC1C,IAAI,OAAO,OAAO,WAAW,QAAQ,KAAK,MAAM,OAAO,WAAW,QAAQ,GACxE,MAAM,IAAI,MAAM,qCAAqC;CACvD,IAAI,CAAC,OAAO,SAAS,SAAS,KAAK,YAAY,GAC7C,MAAM,IAAI,MAAM,oDAAoD;CAEtE,MAAM,SAA4B,IAAI,kBAAkB,QAAQ,CAAC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oMovieRasterImage } from "@automovie/interface";
2
2
  /**
3
3
  * Decode a PNG file into the picture record the sheet, the comparison and the content hash take: 8-bit RGBA rows from the top.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"decodeAutoMovieRasterPng.js","sourceRoot":"","sources":["../../src/picture/decodeAutoMovieRasterPng.ts"],"names":[],"mappings":";;;AACA,uEAAiE;AAEjE,kDAAkD;AAClD,MAAM,SAAS,GAAsB;IACnC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;CAC/C,CAAC;AAEF,sGAAsG;AACtG,MAAM,YAAY,GAEd;IACF,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE;IAC5C,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE;IACnC,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE;IACxC,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE;IACnC,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE;CACpC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACI,KAAK,mCACV,KAAiB;IAEjB,IACE,KAAK,CAAC,MAAM,GAAG,CAAC;QAChB,CAAC,SAAS,CAAC,KAAK,CACd,CAAC,IAAY,EAAE,KAAa,EAAW,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,IAAI,CAChE;QAED,MAAM,IAAI,KAAK,CAAC,8BAA8B,CA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AM,MAAM,GAAW,IAAI,CAAC,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IACjD,MAAM,IAAI,GAAW,IAAI,CAAC,GAAG,CAAC,QAAQ,GAAG,EAAE,CAAC,CAAC;IAC7C,MAAM,QAAQ,GAAW,IAAI,CAAC,GAAG,CAAC,QAAQ,GAAG,MAAM,CAAC,CAAC;IACrD,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,IAAI,QAAQ;QAAE,OAAO,IAAI,CAAC;IACtD,IAAI,IAAI,IAAI,QAAQ;QAAE,OAAO,EAAE,CAAC;IAChC,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"decodeAutoMovieRasterPng.mjs","names":[],"sources":["../../src/picture/decodeAutoMovieRasterPng.ts"],"sourcesContent":["import type { IAutoMovieRasterImage } from \"./IAutoMovieRasterImage.js\";\nimport { crcAutoMoviePngChunk } from \"./crcAutoMoviePngChunk.js\";\n\n/** The eight bytes every PNG file starts with. */\nconst SIGNATURE: readonly number[] = [\n 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a,\n];\n\n/** Samples per pixel of each PNG colour type, with the bit depths the specification allows for it. */\nconst COLOUR_TYPES: Readonly<\n Record<number, { channels: number; depths: readonly number[] }>\n> = {\n 0: { channels: 1, depths: [1, 2, 4, 8, 16] },\n 2: { channels: 3, depths: [8, 16] },\n 3: { channels: 1, depths: [1, 2, 4, 8] },\n 4: { channels: 2, depths: [8, 16] },\n 6: { channels: 4, depths: [8, 16] },\n};\n\n/**\n * Decode a PNG file into the picture record the sheet, the comparison and the content hash take: 8-bit RGBA rows from the top.\n *\n * It reads every non-interlaced PNG the specification allows: grey, RGB, palette, grey with alpha and RGBA, at every bit depth of each, so a still this package encoded and a still FFmpeg wrote read alike. A sample of 16 bits keeps its high byte and a sample under 8 bits is scaled to the full byte. Alpha comes from an alpha channel when the file has one and is 255 otherwise; transparency chunks are ignored, because the picture record is opaque and no consumer reads alpha. The zlib stream is inflated by `DecompressionStream(\"deflate\")`, a global of Node 22 and every current browser, so the call is asynchronous and imports no Node built-in.\n *\n * It rejects a file that is not a PNG, a chunk whose CRC disagrees, a missing header, palette or image data, an interlaced file, an unknown colour type, bit depth, compression, filter method or row filter, and image data that does not inflate to the size the header states, each with the reason; the caller adds the file's name.\n *\n * @evidence contracts/development/common.md#meaningful-documentation States the output layout, the colour types and depths read, how samples become bytes, what alpha holds and why transparency is ignored, where inflation comes from, and every refusal.\n * @evidence contracts/development/implementation.md#principled-implementation Chunk walking, CRC checking, the five row filters with the Paeth predictor and sample unpacking follow the PNG specification (sections 5, 7, 9 and 11); the Compression Streams `deflate` format is the zlib stream an IDAT sequence holds.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure Walk the chunks, inflate the joined image data, undo each row's filter, then expand each pixel to RGBA.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Interlaced files are refused rather than read as if they were not; a corrupt or truncated file throws instead of yielding a partial picture.\n * @evidence contracts/development/implementation.md#efficient-algorithms Linear in the file and the pixel count: one CRC pass per chunk, one inflation, one unfiltering pass and one expansion pass, reusing the previous row in place.\n * @evidence contracts/development/implementation.md#reuse-equivalent-work The CRC table is shared with the encoder.\n * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Holds the joined image data, the inflated rows and the returned pixels until the call ends; only the returned picture outlives it.\n */\nexport async function decodeAutoMovieRasterPng(\n bytes: Uint8Array,\n): Promise<IAutoMovieRasterImage> {\n if (\n bytes.length < 8 ||\n !SIGNATURE.every(\n (byte: number, index: number): boolean => bytes[index] === byte,\n )\n )\n throw new Error(\"The bytes are not a PNG file\");\n\n // Walk the chunks, checking each CRC.\n const view: DataView = new DataView(\n bytes.buffer,\n bytes.byteOffset,\n bytes.byteLength,\n );\n let header: Uint8Array | null = null;\n let palette: Uint8Array | null = null;\n const data: Uint8Array[] = [];\n let ended: boolean = false;\n for (let at: number = 8; at < bytes.length && !ended; ) {\n if (at + 12 > bytes.length) throw new Error(\"A PNG chunk is truncated\");\n const length: number = view.getUint32(at);\n if (at + 12 + length > bytes.length)\n throw new Error(\"A PNG chunk is truncated\");\n const type: string = String.fromCharCode(...bytes.subarray(at + 4, at + 8));\n const body: Uint8Array = bytes.subarray(at + 8, at + 8 + length);\n if (\n crcAutoMoviePngChunk(bytes.subarray(at + 4, at + 8 + length)) !==\n view.getUint32(at + 8 + length)\n )\n throw new Error(`The PNG chunk ${type} fails its CRC`);\n if (type === \"IHDR\") header = body;\n else if (type === \"PLTE\") palette = body;\n else if (type === \"IDAT\") data.push(body);\n else if (type === \"IEND\") ended = true;\n at += 12 + length;\n }\n if (header === null || header.length !== 13)\n throw new Error(\"The PNG has no valid IHDR chunk\");\n if (data.length === 0) throw new Error(\"The PNG has no image data\");\n\n // Header fields.\n const fields: DataView = new DataView(\n header.buffer,\n header.byteOffset,\n header.byteLength,\n );\n const width: number = fields.getUint32(0);\n const height: number = fields.getUint32(4);\n const depth: number = header[8]!;\n const colour: number = header[9]!;\n const form: { channels: number; depths: readonly number[] } | undefined =\n COLOUR_TYPES[colour];\n if (width === 0 || height === 0)\n throw new Error(`The PNG's size ${width}x${height} is empty`);\n if (form === undefined)\n throw new Error(`PNG colour type ${colour} is unknown`);\n if (!form.depths.includes(depth))\n throw new Error(`PNG colour type ${colour} has no bit depth ${depth}`);\n if (header[10] !== 0 || header[11] !== 0)\n throw new Error(\"The PNG's compression or filter method is unknown\");\n if (header[12] !== 0) throw new Error(\"Interlaced PNG files are not read\");\n if (colour === 3 && (palette === null || palette.length % 3 !== 0))\n throw new Error(\"The palette PNG has no valid PLTE chunk\");\n\n // Inflate the joined image data.\n const joined: Uint8Array<ArrayBuffer> = new Uint8Array(\n data.reduce(\n (sum: number, part: Uint8Array): number => sum + part.length,\n 0,\n ),\n );\n let offset: number = 0;\n for (const part of data) {\n joined.set(part, offset);\n offset += part.length;\n }\n let rows: Uint8Array;\n try {\n rows = new Uint8Array(\n await new Response(\n new Blob([joined])\n .stream()\n .pipeThrough(new DecompressionStream(\"deflate\")),\n ).arrayBuffer(),\n );\n } catch (error) {\n throw new Error(\n `The PNG's image data does not inflate: ${error instanceof Error ? error.message : String(error)}`,\n { cause: error },\n );\n }\n const stride: number = Math.ceil((width * form.channels * depth) / 8);\n if (rows.length !== (stride + 1) * height)\n throw new Error(\n `The PNG's image data holds ${rows.length} bytes where its header asks for ${(stride + 1) * height}`,\n );\n\n // Undo each row's filter in place; `step` is the bytes of one whole pixel, at least one.\n const step: number = Math.max(1, (form.channels * depth) / 8);\n for (let y: number = 0; y < height; y++) {\n const start: number = y * (stride + 1) + 1;\n const filter: number = rows[start - 1]!;\n const above: number = start - (stride + 1);\n for (let x: number = 0; x < stride; x++) {\n const left: number = x >= step ? rows[start + x - step]! : 0;\n const up: number = y > 0 ? rows[above + x]! : 0;\n const corner: number = y > 0 && x >= step ? rows[above + x - step]! : 0;\n let predicted: number;\n if (filter === 0) predicted = 0;\n else if (filter === 1) predicted = left;\n else if (filter === 2) predicted = up;\n else if (filter === 3) predicted = Math.floor((left + up) / 2);\n else if (filter === 4) predicted = paeth(left, up, corner);\n else throw new Error(`PNG row ${y} has an unknown filter ${filter}`);\n rows[start + x] = (rows[start + x]! + predicted) & 0xff;\n }\n }\n\n // Expand every pixel to 8-bit RGBA.\n const colours: Uint8Array = palette ?? new Uint8Array(0);\n const pixels: Uint8ClampedArray = new Uint8ClampedArray(width * height * 4);\n const top: number = (1 << Math.min(depth, 8)) - 1;\n for (let y: number = 0; y < height; y++) {\n const start: number = y * (stride + 1) + 1;\n const sample: (index: number) => number = (index: number): number => {\n if (depth === 16) return rows[start + index * 2]!;\n if (depth === 8) return rows[start + index]!;\n const bit: number = index * depth;\n return (rows[start + (bit >> 3)]! >> (8 - depth - (bit & 7))) & top;\n };\n for (let x: number = 0; x < width; x++) {\n const target: number = (y * width + x) * 4;\n const first: number = x * form.channels;\n if (colour === 3) {\n const entry: number = sample(first) * 3;\n if (entry + 3 > colours.length)\n throw new Error(`PNG palette index ${entry / 3} is out of range`);\n pixels.set(\n [colours[entry]!, colours[entry + 1]!, colours[entry + 2]!, 255],\n target,\n );\n continue;\n }\n const scale: (value: number) => number = (value: number): number =>\n depth < 8 ? Math.round((value * 255) / top) : value;\n if (form.channels <= 2) {\n const grey: number = scale(sample(first));\n pixels.set(\n [grey, grey, grey, form.channels === 2 ? sample(first + 1) : 255],\n target,\n );\n } else\n pixels.set(\n [\n sample(first),\n sample(first + 1),\n sample(first + 2),\n form.channels === 4 ? sample(first + 3) : 255,\n ],\n target,\n );\n }\n }\n return { width, height, pixels };\n}\n\n/** The Paeth predictor of the PNG specification, section 9.4: the neighbour nearest to left + up - corner. */\nfunction paeth(left: number, up: number, corner: number): number {\n const estimate: number = left + up - corner;\n const toLeft: number = Math.abs(estimate - left);\n const toUp: number = Math.abs(estimate - up);\n const toCorner: number = Math.abs(estimate - corner);\n if (toLeft <= toUp && toLeft <= toCorner) return left;\n if (toUp <= toCorner) return up;\n return corner;\n}\n"],"mappings":";;;AAIA,MAAM,YAA+B;CACnC;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;AAC5C;;AAGA,MAAM,eAEF;CACF,GAAG;EAAE,UAAU;EAAG,QAAQ;GAAC;GAAG;GAAG;GAAG;GAAG;EAAE;CAAE;CAC3C,GAAG;EAAE,UAAU;EAAG,QAAQ,CAAC,GAAG,EAAE;CAAE;CAClC,GAAG;EAAE,UAAU;EAAG,QAAQ;GAAC;GAAG;GAAG;GAAG;EAAC;CAAE;CACvC,GAAG;EAAE,UAAU;EAAG,QAAQ,CAAC,GAAG,EAAE;CAAE;CAClC,GAAG;EAAE,UAAU;EAAG,QAAQ,CAAC,GAAG,EAAE;CAAE;AACpC;;;;;;;;;;;;;;;;AAiBA,eAAsB,yBACpB,OACgC;CAChC,IACE,MAAM,SAAS,KACf,CAAC,UAAU,OACR,MAAc,UAA2B,MAAM,WAAW,IAC7D,GAEA,MAAM,IAAI,MAAM,8BAA8B;CAGhD,MA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KAAK,IAAI;IACtC,IAAI,QAAQ,IAAI,QAAQ,QACtB,MAAM,IAAI,MAAM,qBAAqB,QAAQ,EAAE,iBAAiB;IAClE,OAAO,IACL;KAAC,QAAQ;KAAS,QAAQ,QAAQ;KAAK,QAAQ,QAAQ;KAAK;IAAG,GAC/D,MACF;IACA;GACF;GACA,MAAM,SAAoC,UACxC,QAAQ,IAAI,KAAK,MAAO,QAAQ,MAAO,GAAG,IAAI;GAChD,IAAI,KAAK,YAAY,GAAG;IACtB,MAAM,OAAe,MAAM,OAAO,KAAK,CAAC;IACxC,OAAO,IACL;KAAC;KAAM;KAAM;KAAM,KAAK,aAAa,IAAI,OAAO,QAAQ,CAAC,IAAI;IAAG,GAChE,MACF;GACF,OACE,OAAO,IACL;IACE,OAAO,KAAK;IACZ,OAAO,QAAQ,CAAC;IAChB,OAAO,QAAQ,CAAC;IAChB,KAAK,aAAa,IAAI,OAAO,QAAQ,CAAC,IAAI;GAC5C,GACA,MACF;EACJ;CACF;CACA,OAAO;EAAE;EAAO;EAAQ;CAAO;AACjC;;AAGA,SAAS,MAAM,MAAc,IAAY,QAAwB;CAC/D,MAAM,WAAmB,OAAO,KAAK;CACrC,MAAM,SAAiB,KAAK,IAAI,WAAW,IAAI;CAC/C,MAAM,OAAe,KAAK,IAAI,WAAW,EAAE;CAC3C,MAAM,WAAmB,KAAK,IAAI,WAAW,MAAM;CACnD,IAAI,UAAU,QAAQ,UAAU,UAAU,OAAO;CACjD,IAAI,QAAQ,UAAU,OAAO;CAC7B,OAAO;AACT"}
1
+ {"version":3,"file":"decodeAutoMovieRasterPng.mjs","names":[],"sources":["../../src/picture/decodeAutoMovieRasterPng.ts"],"sourcesContent":["import type { IAutoMovieRasterImage } from \"@automovie/interface\";\n\nimport { crcAutoMoviePngChunk } from \"./crcAutoMoviePngChunk.js\";\n\n/** The eight bytes every PNG file starts with. */\nconst SIGNATURE: readonly number[] = [\n 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a,\n];\n\n/** Samples per pixel of each PNG colour type, with the bit depths the specification allows for it. */\nconst COLOUR_TYPES: Readonly<\n Record<number, { channels: number; depths: readonly number[] }>\n> = {\n 0: { channels: 1, depths: [1, 2, 4, 8, 16] },\n 2: { channels: 3, depths: [8, 16] },\n 3: { channels: 1, depths: [1, 2, 4, 8] },\n 4: { channels: 2, depths: [8, 16] },\n 6: { channels: 4, depths: [8, 16] },\n};\n\n/**\n * Decode a PNG file into the picture record the sheet, the comparison and the content hash take: 8-bit RGBA rows from the top.\n *\n * It reads every non-interlaced PNG the specification allows: grey, RGB, palette, grey with alpha and RGBA, at every bit depth of each, so a still this package encoded and a still FFmpeg wrote read alike. A sample of 16 bits keeps its high byte and a sample under 8 bits is scaled to the full byte. Alpha comes from an alpha channel when the file has one and is 255 otherwise; transparency chunks are ignored, because the picture record is opaque and no consumer reads alpha. The zlib stream is inflated by `DecompressionStream(\"deflate\")`, a global of Node 22 and every current browser, so the call is asynchronous and imports no Node built-in.\n *\n * It rejects a file that is not a PNG, a chunk whose CRC disagrees, a missing header, palette or image data, an interlaced file, an unknown colour type, bit depth, compression, filter method or row filter, and image data that does not inflate to the size the header states, each with the reason; the caller adds the file's name.\n *\n * @evidence contracts/development/common.md#meaningful-documentation States the output layout, the colour types and depths read, how samples become bytes, what alpha holds and why transparency is ignored, where inflation comes from, and every refusal.\n * @evidence contracts/development/implementation.md#principled-implementation Chunk walking, CRC checking, the five row filters with the Paeth predictor and sample unpacking follow the PNG specification (sections 5, 7, 9 and 11); the Compression Streams `deflate` format is the zlib stream an IDAT sequence holds.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure Walk the chunks, inflate the joined image data, undo each row's filter, then expand each pixel to RGBA.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Interlaced files are refused rather than read as if they were not; a corrupt or truncated file throws instead of yielding a partial picture.\n * @evidence contracts/development/implementation.md#efficient-algorithms Linear in the file and the pixel count: one CRC pass per chunk, one inflation, one unfiltering pass and one expansion pass, reusing the previous row in place.\n * @evidence contracts/development/implementation.md#reuse-equivalent-work The CRC table is shared with the encoder.\n * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Holds the joined image data, the inflated rows and the returned pixels until the call ends; only the returned picture outlives it.\n */\nexport async function decodeAutoMovieRasterPng(\n bytes: Uint8Array,\n): Promise<IAutoMovieRasterImage> {\n if (\n bytes.length < 8 ||\n !SIGNATURE.every(\n (byte: number, index: number): boolean => bytes[index] === byte,\n )\n )\n throw new Error(\"The bytes are not a PNG file\");\n\n // Walk the chunks, checking each CRC.\n const view: DataView = new DataView(\n bytes.buffer,\n bytes.byteOffset,\n bytes.byteLength,\n );\n let header: Uint8Array | null = null;\n let palette: Uint8Array | null = null;\n const data: Uint8Array[] = [];\n let ended: boolean = false;\n for (let at: number = 8; at < bytes.length && !ended; ) {\n if (at + 12 > bytes.length) throw new Error(\"A PNG chunk is truncated\");\n const length: number = view.getUint32(at);\n if (at + 12 + length > bytes.length)\n throw new Error(\"A PNG chunk is truncated\");\n const type: string = String.fromCharCode(...bytes.subarray(at + 4, at + 8));\n const body: Uint8Array = bytes.subarray(at + 8, at + 8 + length);\n if (\n crcAutoMoviePngChunk(bytes.subarray(at + 4, at + 8 + length)) !==\n view.getUint32(at + 8 + length)\n )\n throw new Error(`The PNG chunk ${type} fails its CRC`);\n if (type === \"IHDR\") header = body;\n else if (type === \"PLTE\") palette = body;\n else if (type === \"IDAT\") data.push(body);\n else if (type === \"IEND\") ended = true;\n at += 12 + length;\n }\n if (header === null || header.length !== 13)\n throw new Error(\"The PNG has no valid IHDR chunk\");\n if (data.length === 0) throw new Error(\"The PNG has no image data\");\n\n // Header fields.\n const fields: DataView = new DataView(\n header.buffer,\n header.byteOffset,\n header.byteLength,\n );\n const width: number = fields.getUint32(0);\n const height: number = fields.getUint32(4);\n const depth: number = header[8]!;\n const colour: number = header[9]!;\n const form: { channels: number; depths: readonly number[] } | undefined =\n COLOUR_TYPES[colour];\n if (width === 0 || height === 0)\n throw new Error(`The PNG's size ${width}x${height} is empty`);\n if (form === undefined)\n throw new Error(`PNG colour type ${colour} is unknown`);\n if (!form.depths.includes(depth))\n throw new Error(`PNG colour type ${colour} has no bit depth ${depth}`);\n if (header[10] !== 0 || header[11] !== 0)\n throw new Error(\"The PNG's compression or filter method is unknown\");\n if (header[12] !== 0) throw new Error(\"Interlaced PNG files are not read\");\n if (colour === 3 && (palette === null || palette.length % 3 !== 0))\n throw new Error(\"The palette PNG has no valid PLTE chunk\");\n\n // Inflate the joined image data.\n const joined: Uint8Array<ArrayBuffer> = new Uint8Array(\n data.reduce(\n (sum: number, part: Uint8Array): number => sum + part.length,\n 0,\n ),\n );\n let offset: number = 0;\n for (const part of data) {\n joined.set(part, offset);\n offset += part.length;\n }\n let rows: Uint8Array;\n try {\n rows = new Uint8Array(\n await new Response(\n new Blob([joined])\n .stream()\n .pipeThrough(new DecompressionStream(\"deflate\")),\n ).arrayBuffer(),\n );\n } catch (error) {\n throw new Error(\n `The PNG's image data does not inflate: ${error instanceof Error ? error.message : String(error)}`,\n { cause: error },\n );\n }\n const stride: number = Math.ceil((width * form.channels * depth) / 8);\n if (rows.length !== (stride + 1) * height)\n throw new Error(\n `The PNG's image data holds ${rows.length} bytes where its header asks for ${(stride + 1) * height}`,\n );\n\n // Undo each row's filter in place; `step` is the bytes of one whole pixel, at least one.\n const step: number = Math.max(1, (form.channels * depth) / 8);\n for (let y: number = 0; y < height; y++) {\n const start: number = y * (stride + 1) + 1;\n const filter: number = rows[start - 1]!;\n const above: number = start - (stride + 1);\n for (let x: number = 0; x < stride; x++) {\n const left: number = x >= step ? rows[start + x - step]! : 0;\n const up: number = y > 0 ? rows[above + x]! : 0;\n const corner: number = y > 0 && x >= step ? rows[above + x - step]! : 0;\n let predicted: number;\n if (filter === 0) predicted = 0;\n else if (filter === 1) predicted = left;\n else if (filter === 2) predicted = up;\n else if (filter === 3) predicted = Math.floor((left + up) / 2);\n else if (filter === 4) predicted = paeth(left, up, corner);\n else throw new Error(`PNG row ${y} has an unknown filter ${filter}`);\n rows[start + x] = (rows[start + x]! + predicted) & 0xff;\n }\n }\n\n // Expand every pixel to 8-bit RGBA.\n const colours: Uint8Array = palette ?? new Uint8Array(0);\n const pixels: Uint8ClampedArray = new Uint8ClampedArray(width * height * 4);\n const top: number = (1 << Math.min(depth, 8)) - 1;\n for (let y: number = 0; y < height; y++) {\n const start: number = y * (stride + 1) + 1;\n const sample: (index: number) => number = (index: number): number => {\n if (depth === 16) return rows[start + index * 2]!;\n if (depth === 8) return rows[start + index]!;\n const bit: number = index * depth;\n return (rows[start + (bit >> 3)]! >> (8 - depth - (bit & 7))) & top;\n };\n for (let x: number = 0; x < width; x++) {\n const target: number = (y * width + x) * 4;\n const first: number = x * form.channels;\n if (colour === 3) {\n const entry: number = sample(first) * 3;\n if (entry + 3 > colours.length)\n throw new Error(`PNG palette index ${entry / 3} is out of range`);\n pixels.set(\n [colours[entry]!, colours[entry + 1]!, colours[entry + 2]!, 255],\n target,\n );\n continue;\n }\n const scale: (value: number) => number = (value: number): number =>\n depth < 8 ? Math.round((value * 255) / top) : value;\n if (form.channels <= 2) {\n const grey: number = scale(sample(first));\n pixels.set(\n [grey, grey, grey, form.channels === 2 ? sample(first + 1) : 255],\n target,\n );\n } else\n pixels.set(\n [\n sample(first),\n sample(first + 1),\n sample(first + 2),\n form.channels === 4 ? sample(first + 3) : 255,\n ],\n target,\n );\n }\n }\n return { width, height, pixels };\n}\n\n/** The Paeth predictor of the PNG specification, section 9.4: the neighbour nearest to left + up - corner. */\nfunction paeth(left: number, up: number, corner: number): number {\n const estimate: number = left + up - corner;\n const toLeft: number = Math.abs(estimate - left);\n const toUp: number = Math.abs(estimate - up);\n const toCorner: number = Math.abs(estimate - corner);\n if (toLeft <= toUp && toLeft <= toCorner) return left;\n if (toUp <= toCorner) return up;\n return corner;\n}\n"],"mappings":";;;AAKA,MAAM,YAA+B;CACnC;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;AAC5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,MAAM,WAAmB,OAAO,KAAK;CACrC,MAAM,SAAiB,KAAK,IAAI,WAAW,IAAI;CAC/C,MAAM,OAAe,KAAK,IAAI,WAAW,EAAE;CAC3C,MAAM,WAAmB,KAAK,IAAI,WAAW,MAAM;CACnD,IAAI,UAAU,QAAQ,UAAU,UAAU,OAAO;CACjD,IAAI,QAAQ,UAAU,OAAO;CAC7B,OAAO;AACT"}
@@ -1,4 +1,4 @@
1
- import type { IAutoMovieRasterImage } from "./IAutoMovieRasterImage.js";
1
+ import type { IAutoMovieRasterImage } from "@automovie/interface";
2
2
  /**
3
3
  * Encode a picture, such as a drawn still, a contact sheet or a difference image, as a lossless 8-bit RGB PNG.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"encodeAutoMovieRasterPng.js","sourceRoot":"","sources":["../../src/picture/encodeAutoMovieRasterPng.ts"],"names":[],"mappings":";;;AACA,uEAAiE;AAEjE,kDAAkD;AAClD,MAAM,SAAS,GAAsB;IACnC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;CAC/C,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACI,KAAK,mCACV,MAA6B;IAE7B,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IACzC,IACE,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC;QAC3C,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC;QAE7C,MAAM,IAAI,KAAK,CAAC,YAAY,KAAK,IAAI,MAAM,2BAA2B,CAAC,CAAC;IAC1E,IAAI,MAAM,CAAC,MAAM,KAAK,KAAK,GAAG,MAAM,GAAG,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IAEzD,mDAAmD;IACnD,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AG,CAAC;AACb,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"encodeAutoMovieRasterPng.mjs","names":[],"sources":["../../src/picture/encodeAutoMovieRasterPng.ts"],"sourcesContent":["import type { IAutoMovieRasterImage } from \"./IAutoMovieRasterImage.js\";\nimport { crcAutoMoviePngChunk } from \"./crcAutoMoviePngChunk.js\";\n\n/** The eight bytes every PNG file starts with. */\nconst SIGNATURE: readonly number[] = [\n 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a,\n];\n\n/**\n * Encode a picture, such as a drawn still, a contact sheet or a difference image, as a lossless 8-bit RGB PNG.\n *\n * The picture is opaque, so alpha is dropped. Rows use filter type 0 and one zlib stream made by `CompressionStream(\"deflate\")`, which Node 22 and every current browser provide as a global, so this module imports no Node built-in and runs in a page as in a Node host. Encoding is therefore asynchronous. `decodeAutoMovieRasterPng` and every PNG reader decode the result.\n *\n * It rejects a size that is not a positive whole number of pixels and a pixel buffer whose length disagrees with the size.\n *\n * ```ts\n * await storage.writeFile(`${root}/still.png`, await encodeAutoMovieRasterPng(picture));\n * ```\n *\n * @evidence contracts/development/common.md#meaningful-documentation States the format, the dropped alpha, the row filter, where compression comes from and why the call is asynchronous, who can read the result, and both refusals.\n * @evidence contracts/development/implementation.md#principled-implementation The chunk layout, big-endian lengths and CRC-32 over type and data follow the PNG specification; the Compression Streams standard's `deflate` format is the zlib stream (RFC 1950) an IDAT chunk requires.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure Rows are packed once, compressed once and wrapped in the three required chunks.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A buffer that disagrees with the size throws instead of writing a truncated image, and a zero-sized picture, which PNG forbids, is refused.\n * @evidence contracts/development/implementation.md#efficient-algorithms Linear in the pixel count: one packing pass, one compression stream and one copy into the file.\n * @evidence contracts/development/implementation.md#reuse-equivalent-work The CRC table is shared with the decoder.\n * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Holds the packed rows and the compressed stream until the file is assembled; the stream ends with the call and nothing is retained.\n */\nexport async function encodeAutoMovieRasterPng(\n raster: IAutoMovieRasterImage,\n): Promise<Uint8Array> {\n const { width, height, pixels } = raster;\n if (\n !(Number.isSafeInteger(width) && width > 0) ||\n !(Number.isSafeInteger(height) && height > 0)\n )\n throw new Error(`A PNG of ${width}x${height} pixels cannot be written`);\n if (pixels.length !== width * height * 4)\n throw new Error(\"Raster pixels do not match its size\");\n\n // Each row is a filter byte 0 and its RGB triples.\n const stride: number = width * 3 + 1;\n const rows: Uint8Array<ArrayBuffer> = new Uint8Array(stride * height);\n for (let y: number = 0; y < height; y++)\n for (let x: number = 0; x < width; x++) {\n const from: number = (y * width + x) * 4;\n const to: number = y * stride + 1 + x * 3;\n rows[to] = pixels[from]!;\n rows[to + 1] = pixels[from + 1]!;\n rows[to + 2] = pixels[from + 2]!;\n }\n const compressed: Uint8Array = new Uint8Array(\n await new Response(\n new Blob([rows]).stream().pipeThrough(new CompressionStream(\"deflate\")),\n ).arrayBuffer(),\n );\n\n // IHDR: size, bit depth 8, colour type 2 (RGB), deflate, filter method 0, no interlace.\n const header: Uint8Array = new Uint8Array(13);\n const view: DataView = new DataView(header.buffer);\n view.setUint32(0, width);\n view.setUint32(4, height);\n header.set([8, 2, 0, 0, 0], 8);\n const parts: Uint8Array[] = [\n Uint8Array.from(SIGNATURE),\n chunk(\"IHDR\", header),\n chunk(\"IDAT\", compressed),\n chunk(\"IEND\", new Uint8Array(0)),\n ];\n const file: Uint8Array = new Uint8Array(\n parts.reduce(\n (sum: number, part: Uint8Array): number => sum + part.length,\n 0,\n ),\n );\n let offset: number = 0;\n for (const part of parts) {\n file.set(part, offset);\n offset += part.length;\n }\n return file;\n}\n\n/** One PNG chunk: length, type, data and CRC-32 of type and data. */\nfunction chunk(type: string, data: Uint8Array): Uint8Array {\n const out: Uint8Array = new Uint8Array(12 + data.length);\n const view: DataView = new DataView(out.buffer);\n view.setUint32(0, data.length);\n for (let index: number = 0; index < 4; index++)\n out[4 + index] = type.charCodeAt(index);\n out.set(data, 8);\n view.setUint32(\n 8 + data.length,\n crcAutoMoviePngChunk(out.subarray(4, 8 + data.length)),\n );\n return out;\n}\n"],"mappings":";;;AAIA,MAAM,YAA+B;CACnC;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;AAC5C;;;;;;;;;;;;;;;;;;;;AAqBA,eAAsB,yBACpB,QACqB;CACrB,MAAM,EAAE,OAAO,QAAQ,WAAW;CAClC,IACE,EAAE,OAAO,cAAc,KAAK,KAAK,QAAQ,MACzC,EAAE,OAAO,cAAc,MAAM,KAAK,SAAS,IAE3C,MAAM,IAAI,MAAM,YAAY,MAAM,GAAG,OAAO,0BAA0B;CACxE,IAAI,OAAO,WAAW,QAAQ,SAAS,GACrC,MAAM,IAAI,MAAM,qCAAqC;CAGvD,MAAM,SAAiB,QAAQ,IAAI;CACnC,MAAM,OAAgC,IAAI,WAAW,SAAS,MAAM;CACpE,KAAK,IAAI,IAAY,GAAG,IAAI,QAAQ,KAClC,KAAK,IAAI,IAAY,GAAG,IAAI,OAAO,KAAK;EACtC,MAAM,QAAgB,IAAI,QAAQ,KAAK;EACvC,MAAM,KAAa,IAAI,SAAS,IAAI,IAAI;EACxC,KAAK,MAAM,OAAO;EAClB,KAAK,KAAK,KAAK,OAAO,OAAO;EAC7B,KAAK,KAAK,KAAK,OAAO,OAAO;CAC/B;CACF,MAAM,aAAyB,IAAI,WACjC,MAAM,IAAI,SACR,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,YAAY,IAAI,kBAAkB,SAAS,CAAC,CACxE,CAAC,CAAC,YAAY,CAChB;CAGA,MAAM,yBAAqB,IAAI,WAAW,EAAE;CAC5C,MAAM,OAAiB,IAAI,SAAS,OAAO,MAAM;CACjD,KAAK,UAAU,GAAG,KAAK;CACvB,KAAK,UAAU,GAAG,MAAM;CACxB,OAAO,IAAI;EAAC;EAAG;EAAG;EAAG;EAAG;CAAC,GAAG,CAAC;CAC7B,MAAM,QAAsB;EAC1B,WAAW,KAAK,SAAS;EACzB,MAAM,QAAQ,MAAM;EACpB,MAAM,QAAQ,UAAU;EACxB,MAAM,wBAAQ,IAAI,WAAW,CAAC,CAAC;CACjC;CACA,MAAM,OAAmB,IAAI,WAC3B,MAAM,QACH,KAAa,SAA6B,MAAM,KAAK,QACtD,CACF,CACF;CACA,IAAI,SAAiB;CACrB,KAAK,MAAM,QAAQ,OAAO;EACxB,KAAK,IAAI,MAAM,MAAM;EACrB,UAAU,KAAK;CACjB;CACA,OAAO;AACT;;AAGA,SAAS,MAAM,MAAc,MAA8B;CACzD,MAAM,MAAkB,IAAI,WAAW,KAAK,KAAK,MAAM;CACvD,MAAM,OAAiB,IAAI,SAAS,IAAI,MAAM;CAC9C,KAAK,UAAU,GAAG,KAAK,MAAM;CAC7B,KAAK,IAAI,QAAgB,GAAG,QAAQ,GAAG,SACrC,IAAI,IAAI,SAAS,KAAK,WAAW,KAAK;CACxC,IAAI,IAAI,MAAM,CAAC;CACf,KAAK,UACH,IAAI,KAAK,QACT,qBAAqB,IAAI,SAAS,GAAG,IAAI,KAAK,MAAM,CAAC,CACvD;CACA,OAAO;AACT"}
1
+ {"version":3,"file":"encodeAutoMovieRasterPng.mjs","names":[],"sources":["../../src/picture/encodeAutoMovieRasterPng.ts"],"sourcesContent":["import type { IAutoMovieRasterImage } from \"@automovie/interface\";\n\nimport { crcAutoMoviePngChunk } from \"./crcAutoMoviePngChunk.js\";\n\n/** The eight bytes every PNG file starts with. */\nconst SIGNATURE: readonly number[] = [\n 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a,\n];\n\n/**\n * Encode a picture, such as a drawn still, a contact sheet or a difference image, as a lossless 8-bit RGB PNG.\n *\n * The picture is opaque, so alpha is dropped. Rows use filter type 0 and one zlib stream made by `CompressionStream(\"deflate\")`, which Node 22 and every current browser provide as a global, so this module imports no Node built-in and runs in a page as in a Node host. Encoding is therefore asynchronous. `decodeAutoMovieRasterPng` and every PNG reader decode the result.\n *\n * It rejects a size that is not a positive whole number of pixels and a pixel buffer whose length disagrees with the size.\n *\n * ```ts\n * await storage.writeFile(`${root}/still.png`, await encodeAutoMovieRasterPng(picture));\n * ```\n *\n * @evidence contracts/development/common.md#meaningful-documentation States the format, the dropped alpha, the row filter, where compression comes from and why the call is asynchronous, who can read the result, and both refusals.\n * @evidence contracts/development/implementation.md#principled-implementation The chunk layout, big-endian lengths and CRC-32 over type and data follow the PNG specification; the Compression Streams standard's `deflate` format is the zlib stream (RFC 1950) an IDAT chunk requires.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure Rows are packed once, compressed once and wrapped in the three required chunks.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A buffer that disagrees with the size throws instead of writing a truncated image, and a zero-sized picture, which PNG forbids, is refused.\n * @evidence contracts/development/implementation.md#efficient-algorithms Linear in the pixel count: one packing pass, one compression stream and one copy into the file.\n * @evidence contracts/development/implementation.md#reuse-equivalent-work The CRC table is shared with the decoder.\n * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Holds the packed rows and the compressed stream until the file is assembled; the stream ends with the call and nothing is retained.\n */\nexport async function encodeAutoMovieRasterPng(\n raster: IAutoMovieRasterImage,\n): Promise<Uint8Array> {\n const { width, height, pixels } = raster;\n if (\n !(Number.isSafeInteger(width) && width > 0) ||\n !(Number.isSafeInteger(height) && height > 0)\n )\n throw new Error(`A PNG of ${width}x${height} pixels cannot be written`);\n if (pixels.length !== width * height * 4)\n throw new Error(\"Raster pixels do not match its size\");\n\n // Each row is a filter byte 0 and its RGB triples.\n const stride: number = width * 3 + 1;\n const rows: Uint8Array<ArrayBuffer> = new Uint8Array(stride * height);\n for (let y: number = 0; y < height; y++)\n for (let x: number = 0; x < width; x++) {\n const from: number = (y * width + x) * 4;\n const to: number = y * stride + 1 + x * 3;\n rows[to] = pixels[from]!;\n rows[to + 1] = pixels[from + 1]!;\n rows[to + 2] = pixels[from + 2]!;\n }\n const compressed: Uint8Array = new Uint8Array(\n await new Response(\n new Blob([rows]).stream().pipeThrough(new CompressionStream(\"deflate\")),\n ).arrayBuffer(),\n );\n\n // IHDR: size, bit depth 8, colour type 2 (RGB), deflate, filter method 0, no interlace.\n const header: Uint8Array = new Uint8Array(13);\n const view: DataView = new DataView(header.buffer);\n view.setUint32(0, width);\n view.setUint32(4, height);\n header.set([8, 2, 0, 0, 0], 8);\n const parts: Uint8Array[] = [\n Uint8Array.from(SIGNATURE),\n chunk(\"IHDR\", header),\n chunk(\"IDAT\", compressed),\n chunk(\"IEND\", new Uint8Array(0)),\n ];\n const file: Uint8Array = new Uint8Array(\n parts.reduce(\n (sum: number, part: Uint8Array): number => sum + part.length,\n 0,\n ),\n );\n let offset: number = 0;\n for (const part of parts) {\n file.set(part, offset);\n offset += part.length;\n }\n return file;\n}\n\n/** One PNG chunk: length, type, data and CRC-32 of type and data. */\nfunction chunk(type: string, data: Uint8Array): Uint8Array {\n const out: Uint8Array = new Uint8Array(12 + data.length);\n const view: DataView = new DataView(out.buffer);\n view.setUint32(0, data.length);\n for (let index: number = 0; index < 4; index++)\n out[4 + index] = type.charCodeAt(index);\n out.set(data, 8);\n view.setUint32(\n 8 + data.length,\n crcAutoMoviePngChunk(out.subarray(4, 8 + data.length)),\n );\n return out;\n}\n"],"mappings":";;;AAKA,MAAM,YAA+B;CACnC;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;AAC5C;;;;;;;;;;;;;;;;;;;;AAqBA,eAAsB,yBACpB,QACqB;CACrB,MAAM,EAAE,OAAO,QAAQ,WAAW;CAClC,IACE,EAAE,OAAO,cAAc,KAAK,KAAK,QAAQ,MACzC,EAAE,OAAO,cAAc,MAAM,KAAK,SAAS,IAE3C,MAAM,IAAI,MAAM,YAAY,MAAM,GAAG,OAAO,0BAA0B;CACxE,IAAI,OAAO,WAAW,QAAQ,SAAS,GACrC,MAAM,IAAI,MAAM,qCAAqC;CAGvD,MAAM,SAAiB,QAAQ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IAAI,QAAgB,GAAG,QAAQ,GAAG,SACrC,IAAI,IAAI,SAAS,KAAK,WAAW,KAAK;CACxC,IAAI,IAAI,MAAM,CAAC;CACf,KAAK,UACH,IAAI,KAAK,QACT,qBAAqB,IAAI,SAAS,GAAG,IAAI,KAAK,MAAM,CAAC,CACvD;CACA,OAAO;AACT"}
@@ -1,4 +1,4 @@
1
- import type { IAutoMovieRasterImage } from "./IAutoMovieRasterImage.js";
1
+ import type { IAutoMovieRasterImage } from "@automovie/interface";
2
2
  /**
3
3
  * The content hash a capture records for a still: `sha256:` and 64 lowercase hex digits over the picture's width and height, each a big-endian 32-bit integer, followed by its red, green and blue bytes row by row.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"hashAutoMovieRasterImage.mjs","names":[],"sources":["../../src/picture/hashAutoMovieRasterImage.ts"],"sourcesContent":["import type { IAutoMovieRasterImage } from \"./IAutoMovieRasterImage.js\";\n\n/** SHA-256 round constants, FIPS 180-4 section 4.2.2. */\nconst K: Uint32Array = Uint32Array.from([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1,\n 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,\n 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,\n 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,\n 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,\n 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b,\n 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,\n 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,\n 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,\n]);\n\n/**\n * The content hash a capture records for a still: `sha256:` and 64 lowercase hex digits over the picture's width and height, each a big-endian 32-bit integer, followed by its red, green and blue bytes row by row.\n *\n * The hash covers the colours the PNG file stores and nothing of how they were compressed, so two stills with equal pixels hash alike whatever encoder wrote them, and a still decoded from its file hashes as it did when it was drawn. Alpha is left out because the file drops it. Equal hashes establish that nothing changed, not that the picture is right.\n *\n * SHA-256 is written out in TypeScript: `node:crypto` would tie the capture core to Node, and `SubtleCrypto` is absent from a page outside a secure context, while this runs in either.\n *\n * @evidence contracts/development/common.md#meaningful-documentation States the output form, the exact bytes hashed, why compression and alpha are excluded, what equality establishes, and why the digest is written out.\n * @evidence contracts/development/implementation.md#principled-implementation FIPS 180-4 SHA-256: 512-bit blocks, the 64-word message schedule, the round constants of section 4.2.2, and padding with a 0x80 byte and the 64-bit big-endian message length, all in unsigned 32-bit arithmetic.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure Lay out the hashed bytes once, then one compression loop over the padded message.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The constants are the standard's; the size is part of the hashed bytes, so two pictures with the same bytes in different shapes differ.\n * @evidence contracts/development/implementation.md#efficient-algorithms Linear in the pixel count: one copy of the RGB bytes and 64 rounds per 64-byte block, with the schedule array reused across blocks.\n * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Each still is hashed once by the capture that records it.\n * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Holds one padded copy of the hashed bytes for the call; only the digest string escapes.\n */\nexport function hashAutoMovieRasterImage(image: IAutoMovieRasterImage): string {\n const count: number = image.width * image.height;\n if (image.pixels.length !== count * 4)\n throw new Error(\"Raster pixels do not match its size\");\n\n // The message: size, then RGB, then SHA-256 padding to a whole number of blocks.\n const length: number = 8 + count * 3;\n const blocks: number = Math.floor((length + 8) / 64) + 1;\n const message: Uint8Array = new Uint8Array(blocks * 64);\n const view: DataView = new DataView(message.buffer);\n view.setUint32(0, image.width);\n view.setUint32(4, image.height);\n for (let index: number = 0; index < count; index++) {\n message[8 + index * 3] = image.pixels[index * 4]!;\n message[9 + index * 3] = image.pixels[index * 4 + 1]!;\n message[10 + index * 3] = image.pixels[index * 4 + 2]!;\n }\n message[length] = 0x80;\n view.setUint32(message.length - 8, Math.floor((length * 8) / 0x100000000));\n view.setUint32(message.length - 4, (length * 8) >>> 0);\n\n // The compression function over every block.\n const state: Uint32Array = Uint32Array.from([\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c,\n 0x1f83d9ab, 0x5be0cd19,\n ]);\n const w: Uint32Array = new Uint32Array(64);\n for (let block: number = 0; block < blocks; block++) {\n for (let t: number = 0; t < 16; t++)\n w[t] = view.getUint32(block * 64 + t * 4);\n for (let t: number = 16; t < 64; t++) {\n const older: number = w[t - 15]!;\n const recent: number = w[t - 2]!;\n const s0: number = rotate(older, 7) ^ rotate(older, 18) ^ (older >>> 3);\n const s1: number =\n rotate(recent, 17) ^ rotate(recent, 19) ^ (recent >>> 10);\n w[t] = (w[t - 16]! + s0 + w[t - 7]! + s1) >>> 0;\n }\n let a: number = state[0]!;\n let b: number = state[1]!;\n let c: number = state[2]!;\n let d: number = state[3]!;\n let e: number = state[4]!;\n let f: number = state[5]!;\n let g: number = state[6]!;\n let h: number = state[7]!;\n for (let t: number = 0; t < 64; t++) {\n const t1: number =\n (h +\n (rotate(e, 6) ^ rotate(e, 11) ^ rotate(e, 25)) +\n ((e & f) ^ (~e & g)) +\n K[t]! +\n w[t]!) >>>\n 0;\n const t2: number =\n ((rotate(a, 2) ^ rotate(a, 13) ^ rotate(a, 22)) +\n ((a & b) ^ (a & c) ^ (b & c))) >>>\n 0;\n h = g;\n g = f;\n f = e;\n e = (d + t1) >>> 0;\n d = c;\n c = b;\n b = a;\n a = (t1 + t2) >>> 0;\n }\n const round: number[] = [a, b, c, d, e, f, g, h];\n for (let index: number = 0; index < 8; index++)\n state[index] = (state[index]! + round[index]!) >>> 0;\n }\n return `sha256:${Array.from(state, (word: number): string => word.toString(16).padStart(8, \"0\")).join(\"\")}`;\n}\n\n/** Rotate a 32-bit word right. */\nfunction rotate(value: number, bits: number): number {\n return ((value >>> bits) | (value << (32 - bits))) >>> 0;\n}\n"],"mappings":";;AAGA,MAAM,IAAiB,YAAY,KAAK;CACtC;CAAY;CAAY;CAAY;CAAY;CAAY;CAC5D;CAAY;CAAY;CAAY;CAAY;CAAY;CAC5D;CAAY;CAAY;CAAY;CAAY;CAAY;CAC5D;CAAY;CAAY;CAAY;CAAY;CAAY;CAC5D;CAAY;CAAY;CAAY;CAAY;CAAY;CAC5D;CAAY;CAAY;CAAY;CAAY;CAAY;CAC5D;CAAY;CAAY;CAAY;CAAY;CAAY;CAC5D;CAAY;CAAY;CAAY;CAAY;CAAY;CAC5D;CAAY;CAAY;CAAY;CAAY;CAAY;CAC5D;CAAY;CAAY;CAAY;CAAY;CAAY;CAC5D;CAAY;CAAY;CAAY;AACtC,CAAC;;;;;;;;;;;;;;;;AAiBD,SAAgB,yBAAyB,OAAsC;CAC7E,MAAM,QAAgB,MAAM,QAAQ,MAAM;CAC1C,IAAI,MAAM,OAAO,WAAW,QAAQ,GAClC,MAAM,IAAI,MAAM,qCAAqC;CAGvD,MAAM,SAAiB,IAAI,QAAQ;CACnC,MAAM,SAAiB,KAAK,OAAO,SAAS,KAAK,EAAE,IAAI;CACvD,MAAM,UAAsB,IAAI,WAAW,SAAS,EAAE;CACtD,MAAM,OAAiB,IAAI,SAAS,QAAQ,MAAM;CAClD,KAAK,UAAU,GAAG,MAAM,KAAK;CAC7B,KAAK,UAAU,GAAG,MAAM,MAAM;CAC9B,KAAK,IAAI,QAAgB,GAAG,QAAQ,OAAO,SAAS;EAClD,QAAQ,I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OAAO,GAAG,EAAE,MAC1C,IAAI,IAAM,CAAC,IAAI,KACjB,EAAE,KACF,EAAE,OACJ;GACF,MAAM,MACF,OAAO,GAAG,CAAC,IAAI,OAAO,GAAG,EAAE,IAAI,OAAO,GAAG,EAAE,MACzC,IAAI,IAAM,IAAI,IAAM,IAAI,OAC5B;GACF,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAK,IAAI,OAAQ;GACjB,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAK,KAAK,OAAQ;EACpB;EACA,MAAM,QAAkB;GAAC;GAAG;GAAG;GAAG;GAAG;GAAG;GAAG;GAAG;EAAC;EAC/C,KAAK,IAAI,QAAgB,GAAG,QAAQ,GAAG,SACrC,MAAM,SAAU,MAAM,SAAU,MAAM,WAAa;CACvD;CACA,OAAO,UAAU,MAAM,KAAK,QAAQ,SAAyB,KAAK,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE;AAC1G;;AAGA,SAAS,OAAO,OAAe,MAAsB;CACnD,QAAS,UAAU,OAAS,SAAU,KAAK,UAAY;AACzD"}
1
+ {"version":3,"file":"hashAutoMovieRasterImage.mjs","names":[],"sources":["../../src/picture/hashAutoMovieRasterImage.ts"],"sourcesContent":["import type { IAutoMovieRasterImage } from \"@automovie/interface\";\n\n/** SHA-256 round constants, FIPS 180-4 section 4.2.2. */\nconst K: Uint32Array = Uint32Array.from([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1,\n 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,\n 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,\n 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,\n 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,\n 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b,\n 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,\n 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,\n 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,\n]);\n\n/**\n * The content hash a capture records for a still: `sha256:` and 64 lowercase hex digits over the picture's width and height, each a big-endian 32-bit integer, followed by its red, green and blue bytes row by row.\n *\n * The hash covers the colours the PNG file stores and nothing of how they were compressed, so two stills with equal pixels hash alike whatever encoder wrote them, and a still decoded from its file hashes as it did when it was drawn. Alpha is left out because the file drops it. Equal hashes establish that nothing changed, not that the picture is right.\n *\n * SHA-256 is written out in TypeScript: `node:crypto` would tie the capture core to Node, and `SubtleCrypto` is absent from a page outside a secure context, while this runs in either.\n *\n * @evidence contracts/development/common.md#meaningful-documentation States the output form, the exact bytes hashed, why compression and alpha are excluded, what equality establishes, and why the digest is written out.\n * @evidence contracts/development/implementation.md#principled-implementation FIPS 180-4 SHA-256: 512-bit blocks, the 64-word message schedule, the round constants of section 4.2.2, and padding with a 0x80 byte and the 64-bit big-endian message length, all in unsigned 32-bit arithmetic.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure Lay out the hashed bytes once, then one compression loop over the padded message.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The constants are the standard's; the size is part of the hashed bytes, so two pictures with the same bytes in different shapes differ.\n * @evidence contracts/development/implementation.md#efficient-algorithms Linear in the pixel count: one copy of the RGB bytes and 64 rounds per 64-byte block, with the schedule array reused across blocks.\n * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Each still is hashed once by the capture that records it.\n * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Holds one padded copy of the hashed bytes for the call; only the digest string escapes.\n */\nexport function hashAutoMovieRasterImage(image: IAutoMovieRasterImage): string {\n const count: number = image.width * image.height;\n if (image.pixels.length !== count * 4)\n throw new Error(\"Raster pixels do not match its size\");\n\n // The message: size, then RGB, then SHA-256 padding to a whole number of blocks.\n const length: number = 8 + count * 3;\n const blocks: number = Math.floor((length + 8) / 64) + 1;\n const message: Uint8Array = new Uint8Array(blocks * 64);\n const view: DataView = new DataView(message.buffer);\n view.setUint32(0, image.width);\n view.setUint32(4, image.height);\n for (let index: number = 0; index < count; index++) {\n message[8 + index * 3] = image.pixels[index * 4]!;\n message[9 + index * 3] = image.pixels[index * 4 + 1]!;\n message[10 + index * 3] = image.pixels[index * 4 + 2]!;\n }\n message[length] = 0x80;\n view.setUint32(message.length - 8, Math.floor((length * 8) / 0x100000000));\n view.setUint32(message.length - 4, (length * 8) >>> 0);\n\n // The compression function over every block.\n const state: Uint32Array = Uint32Array.from([\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c,\n 0x1f83d9ab, 0x5be0cd19,\n ]);\n const w: Uint32Array = new Uint32Array(64);\n for (let block: number = 0; block < blocks; block++) {\n for (let t: number = 0; t < 16; t++)\n w[t] = view.getUint32(block * 64 + t * 4);\n for (let t: number = 16; t < 64; t++) {\n const older: number = w[t - 15]!;\n const recent: number = w[t - 2]!;\n const s0: number = rotate(older, 7) ^ rotate(older, 18) ^ (older >>> 3);\n const s1: number =\n rotate(recent, 17) ^ rotate(recent, 19) ^ (recent >>> 10);\n w[t] = (w[t - 16]! + s0 + w[t - 7]! + s1) >>> 0;\n }\n let a: number = state[0]!;\n let b: number = state[1]!;\n let c: number = state[2]!;\n let d: number = state[3]!;\n let e: number = state[4]!;\n let f: number = state[5]!;\n let g: number = state[6]!;\n let h: number = state[7]!;\n for (let t: number = 0; t < 64; t++) {\n const t1: number =\n (h +\n (rotate(e, 6) ^ rotate(e, 11) ^ rotate(e, 25)) +\n ((e & f) ^ (~e & g)) +\n K[t]! +\n w[t]!) >>>\n 0;\n const t2: number =\n ((rotate(a, 2) ^ rotate(a, 13) ^ rotate(a, 22)) +\n ((a & b) ^ (a & c) ^ (b & c))) >>>\n 0;\n h = g;\n g = f;\n f = e;\n e = (d + t1) >>> 0;\n d = c;\n c = b;\n b = a;\n a = (t1 + t2) >>> 0;\n }\n const round: number[] = [a, b, c, d, e, f, g, h];\n for (let index: number = 0; index < 8; index++)\n state[index] = (state[index]! + round[index]!) >>> 0;\n }\n return `sha256:${Array.from(state, (word: number): string => word.toString(16).padStart(8, \"0\")).join(\"\")}`;\n}\n\n/** Rotate a 32-bit word right. */\nfunction rotate(value: number, bits: number): number {\n return ((value >>> bits) | (value << (32 - bits))) >>> 0;\n}\n"],"mappings":";;AAGA,MAAM,IAAiB,YAAY,KAAK;CACtC;CAAY;CAAY;CAAY;CAAY;CAAY;CAC5D;CAAY;CAAY;CAAY;CAAY;CAAY;CAC5D;CAAY;CAAY;CAAY;CAAY;CAAY;CAC5D;CAAY;CAAY;CAAY;CAAY;CAAY;CAC5D;CAAY;CAAY;CAAY;CAAY;CAAY;CAC5D;CAAY;CAAY;CAAY;CAAY;CAAY;CAC5D;CAAY;CAAY;CAAY;CAAY;CAAY;CAC5D;CAAY;CAAY;CAAY;CAAY;CAAY;CAC5D;CAAY;CAAY;CAAY;CAAY;CAAY;CAC5D;CAAY;CAAY;CAAY;CAAY;CAAY;CAC5D;CAAY;CAAY;CAAY;AACtC,CAAC;;;;;;;;;;;;;;;;AAiBD,SAAgB,yBAAyB,OAAsC;CAC7E,MAAM,QAAgB,MAAM,QAAQ,MAAM;CAC1C,IAAI,MAAM,OAAO,WAAW,QAAQ,GAClC,MAAM,IAAI,MAAM,qCAAqC;CAGvD,MAAM,SAAiB,IAAI,QAAQ;CACnC,MAAM,SAAiB,KA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ACtB,IAAI,IAAY,MAAM;EACtB,IAAI,IAAY,MAAM;EACtB,IAAI,IAAY,MAAM;EACtB,IAAI,IAAY,MAAM;EACtB,IAAI,IAAY,MAAM;EACtB,IAAI,IAAY,MAAM;EACtB,KAAK,IAAI,IAAY,GAAG,IAAI,IAAI,KAAK;GACnC,MAAM,KACH,KACE,OAAO,GAAG,CAAC,IAAI,OAAO,GAAG,EAAE,IAAI,OAAO,GAAG,EAAE,MAC1C,IAAI,IAAM,CAAC,IAAI,KACjB,EAAE,KACF,EAAE,OACJ;GACF,MAAM,MACF,OAAO,GAAG,CAAC,IAAI,OAAO,GAAG,EAAE,IAAI,OAAO,GAAG,EAAE,MACzC,IAAI,IAAM,IAAI,IAAM,IAAI,OAC5B;GACF,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAK,IAAI,OAAQ;GACjB,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAK,KAAK,OAAQ;EACpB;EACA,MAAM,QAAkB;GAAC;GAAG;GAAG;GAAG;GAAG;GAAG;GAAG;GAAG;EAAC;EAC/C,KAAK,IAAI,QAAgB,GAAG,QAAQ,GAAG,SACrC,MAAM,SAAU,MAAM,SAAU,MAAM,WAAa;CACvD;CACA,OAAO,UAAU,MAAM,KAAK,QAAQ,SAAyB,KAAK,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE;AAC1G;;AAGA,SAAS,OAAO,OAAe,MAAsB;CACnD,QAAS,UAAU,OAAS,SAAU,KAAK,UAAY;AACzD"}
@@ -1,4 +1,4 @@
1
- import type { IAutoMovieRasterImage } from "./IAutoMovieRasterImage.js";
1
+ import type { IAutoMovieRasterImage, IAutoMovieRasterPoint } from "@automovie/interface";
2
2
  /**
3
3
  * Burn a short caption, such as a film second or a mark's label, into a
4
4
  * picture, white on a dark box, so a thumbnail on a contact sheet still says
@@ -18,7 +18,4 @@ import type { IAutoMovieRasterImage } from "./IAutoMovieRasterImage.js";
18
18
  * @evidence contracts/development/implementation.md#reuse-equivalent-work Glyph rows are fixed data shared by every call.
19
19
  * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Writes into the frame's own bytes; allocates nothing else.
20
20
  */
21
- export declare function stampAutoMovieRasterLabel(raster: IAutoMovieRasterImage, text: string, scale: number, at?: {
22
- x: number;
23
- y: number;
24
- }): void;
21
+ export declare function stampAutoMovieRasterLabel(raster: IAutoMovieRasterImage, text: string, scale: number, at?: IAutoMovieRasterPoint): void;
@@ -1 +1 @@
1
- {"version":3,"file":"stampAutoMovieRasterLabel.js","sourceRoot":"","sources":["../../src/picture/stampAutoMovieRasterLabel.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACH,mCACE,MAA6B,EAC7B,IAAY,EACZ,KAAa,EACb,EAAE,GAA6B,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;IAE7C,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC5D,MAAM,GAAG,GAAW,KAAK,GAAG,CAAC,CAAC;IAC9B,MAAM,QAAQ,GAAW,IAAI,CAAC,GAAG,CAC/B,MAAM,CAAC,KAAK,EACZ,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,KAAK,GAAG,KAAK,CAC1C,CAAC;IACF,MAAM,SAAS,GAAW,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;IAEvE,uFAAuF;IACvF,MAAM,IAAI,GAAW,IAAI,CAAC,GAAG,CAC3B,CAAC,EACD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,GAAG,QAAQ,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,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;CACnB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"stampAutoMovieRasterLabel.mjs","names":[],"sources":["../../src/picture/stampAutoMovieRasterLabel.ts"],"sourcesContent":["import type { IAutoMovieRasterImage } from \"./IAutoMovieRasterImage.js\";\n\n/**\n * Burn a short caption, such as a film second or a mark's label, into a\n * picture, white on a dark box, so a thumbnail on a contact sheet still says\n * which moment it shows and a mark says what it is.\n *\n * The box's top-left corner goes at `at`, the picture's top-left corner when\n * omitted, moved left and up as far as needed to keep the box inside the\n * picture. The built-in 3 × 5 pixel font covers digits, `.`, `:`, `-`, `/`,\n * space and lower-case `a`–`z`; other characters draw as blanks. `scale`\n * enlarges each font pixel to a square of that many pixels.\n *\n * @evidence contracts/development/common.md#meaningful-documentation States the purpose, placement and how it is kept inside the picture, colours, character coverage and scale.\n * @evidence contracts/development/implementation.md#principled-implementation A bitmap font needs no font file or native canvas, so captions work in a page and in a Node host alike.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure One box fill and one loop over glyph pixels.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A non-positive or fractional scale throws; text wider than the frame is cut at the frame edge rather than wrapped onto content.\n * @evidence contracts/development/implementation.md#efficient-algorithms Linear in the caption's pixel area.\n * @evidence contracts/development/implementation.md#reuse-equivalent-work Glyph rows are fixed data shared by every call.\n * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Writes into the frame's own bytes; allocates nothing else.\n */\nexport function stampAutoMovieRasterLabel(\n raster: IAutoMovieRasterImage,\n text: string,\n scale: number,\n at: { x: number; y: number } = { x: 0, y: 0 },\n): void {\n if (!Number.isSafeInteger(scale) || scale <= 0)\n throw new Error(\"Label scale must be a positive integer\");\n const pad: number = scale * 2;\n const boxWidth: number = Math.min(\n raster.width,\n pad * 2 + text.length * 4 * scale - scale,\n );\n const boxHeight: number = Math.min(raster.height, pad * 2 + 5 * scale);\n\n // The box starts at the anchor, moved back inside the picture where it would leave it.\n const left: number = Math.max(\n 0,\n Math.min(Math.round(at.x), raster.width - boxWidth),\n );\n const top: number = Math.max(\n 0,\n Math.min(Math.round(at.y), raster.height - boxHeight),\n );\n fill(raster, left, top, boxWidth, boxHeight, [16, 16, 16]);\n for (const [n, character] of [...text.toLowerCase()].entries()) {\n const rows: readonly number[] = GLYPHS[character] ?? [0, 0, 0, 0, 0];\n for (let row: number = 0; row < 5; row++)\n for (let column: number = 0; column < 3; column++)\n if ((rows[row]! >> (2 - column)) & 1)\n fill(\n raster,\n left + pad + (n * 4 + column) * scale,\n top + pad + row * scale,\n scale,\n scale,\n [255, 255, 255],\n );\n }\n}\n\n/** Fill a clamped rectangle of the frame with one opaque colour. */\nfunction fill(\n raster: IAutoMovieRasterImage,\n x: number,\n y: number,\n width: number,\n height: number,\n rgb: readonly [number, number, number],\n): void {\n for (\n let py: number = Math.max(0, y);\n py < Math.min(raster.height, y + height);\n py++\n )\n for (\n let px: number = Math.max(0, x);\n px < Math.min(raster.width, x + width);\n px++\n ) {\n const offset: number = (py * raster.width + px) * 4;\n raster.pixels[offset] = rgb[0];\n raster.pixels[offset + 1] = rgb[1];\n raster.pixels[offset + 2] = rgb[2];\n raster.pixels[offset + 3] = 255;\n }\n}\n\n/** 3 × 5 glyphs, one 3-bit row each, most significant bit on the left. */\nconst GLYPHS: Readonly<Record<string, readonly number[]>> = {\n \"0\": [7, 5, 5, 5, 7],\n \"1\": [2, 6, 2, 2, 7],\n \"2\": [7, 1, 7, 4, 7],\n \"3\": [7, 1, 7, 1, 7],\n \"4\": [5, 5, 7, 1, 1],\n \"5\": [7, 4, 7, 1, 7],\n \"6\": [7, 4, 7, 5, 7],\n \"7\": [7, 1, 1, 2, 2],\n \"8\": [7, 5, 7, 5, 7],\n \"9\": [7, 5, 7, 1, 7],\n \".\": [0, 0, 0, 0, 2],\n \":\": [0, 2, 0, 2, 0],\n \"-\": [0, 0, 7, 0, 0],\n \"/\": [1, 1, 2, 4, 4],\n \" \": [0, 0, 0, 0, 0],\n a: [2, 5, 7, 5, 5],\n b: [6, 5, 6, 5, 6],\n c: [3, 4, 4, 4, 3],\n d: [6, 5, 5, 5, 6],\n e: [7, 4, 6, 4, 7],\n f: [7, 4, 6, 4, 4],\n g: [3, 4, 5, 5, 3],\n h: [5, 5, 7, 5, 5],\n i: [7, 2, 2, 2, 7],\n j: [1, 1, 1, 5, 2],\n k: [5, 5, 6, 5, 5],\n l: [4, 4, 4, 4, 7],\n m: [5, 7, 7, 5, 5],\n n: [6, 5, 5, 5, 5],\n o: [2, 5, 5, 5, 2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EAAG;CAAC;CACjB,GAAG;EAAC;EAAG;EAAG;EAAG;EAAG;CAAC;AACnB"}
1
+ {"version":3,"file":"stampAutoMovieRasterLabel.mjs","names":[],"sources":["../../src/picture/stampAutoMovieRasterLabel.ts"],"sourcesContent":["import type {\n IAutoMovieRasterImage,\n IAutoMovieRasterPoint,\n} from \"@automovie/interface\";\n\n/**\n * Burn a short caption, such as a film second or a mark's label, into a\n * picture, white on a dark box, so a thumbnail on a contact sheet still says\n * which moment it shows and a mark says what it is.\n *\n * The box's top-left corner goes at `at`, the picture's top-left corner when\n * omitted, moved left and up as far as needed to keep the box inside the\n * picture. The built-in 3 × 5 pixel font covers digits, `.`, `:`, `-`, `/`,\n * space and lower-case `a`–`z`; other characters draw as blanks. `scale`\n * enlarges each font pixel to a square of that many pixels.\n *\n * @evidence contracts/development/common.md#meaningful-documentation States the purpose, placement and how it is kept inside the picture, colours, character coverage and scale.\n * @evidence contracts/development/implementation.md#principled-implementation A bitmap font needs no font file or native canvas, so captions work in a page and in a Node host alike.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure One box fill and one loop over glyph pixels.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A non-positive or fractional scale throws; text wider than the frame is cut at the frame edge rather than wrapped onto content.\n * @evidence contracts/development/implementation.md#efficient-algorithms Linear in the caption's pixel area.\n * @evidence contracts/development/implementation.md#reuse-equivalent-work Glyph rows are fixed data shared by every call.\n * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Writes into the frame's own bytes; allocates nothing else.\n */\nexport function stampAutoMovieRasterLabel(\n raster: IAutoMovieRasterImage,\n text: string,\n scale: number,\n at: IAutoMovieRasterPoint = { x: 0, y: 0 },\n): void {\n if (!Number.isSafeInteger(scale) || scale <= 0)\n throw new Error(\"Label scale must be a positive integer\");\n const pad: number = scale * 2;\n const boxWidth: number = Math.min(\n raster.width,\n pad * 2 + text.length * 4 * scale - scale,\n );\n const boxHeight: number = Math.min(raster.height, pad * 2 + 5 * scale);\n\n // The box starts at the anchor, moved back inside the picture where it would leave it.\n const left: number = Math.max(\n 0,\n Math.min(Math.round(at.x), raster.width - boxWidth),\n );\n const top: number = Math.max(\n 0,\n Math.min(Math.round(at.y), raster.height - boxHeight),\n );\n fill(raster, left, top, boxWidth, boxHeight, [16, 16, 16]);\n for (const [n, character] of [...text.toLowerCase()].entries()) {\n const rows: readonly number[] = GLYPHS[character] ?? [0, 0, 0, 0, 0];\n for (let row: number = 0; row < 5; row++)\n for (let column: number = 0; column < 3; column++)\n if ((rows[row]! >> (2 - column)) & 1)\n fill(\n raster,\n left + pad + (n * 4 + column) * scale,\n top + pad + row * scale,\n scale,\n scale,\n [255, 255, 255],\n );\n }\n}\n\n/** Fill a clamped rectangle of the frame with one opaque colour. */\nfunction fill(\n raster: IAutoMovieRasterImage,\n x: number,\n y: number,\n width: number,\n height: number,\n rgb: readonly [number, number, number],\n): void {\n for (\n let py: number = Math.max(0, y);\n py < Math.min(raster.height, y + height);\n py++\n )\n for (\n let px: number = Math.max(0, x);\n px < Math.min(raster.width, x + width);\n px++\n ) {\n const offset: number = (py * raster.width + px) * 4;\n raster.pixels[offset] = rgb[0];\n raster.pixels[offset + 1] = rgb[1];\n raster.pixels[offset + 2] = rgb[2];\n raster.pixels[offset + 3] = 255;\n }\n}\n\n/** 3 × 5 glyphs, one 3-bit row each, most significant bit on the left. */\nconst GLYPHS: Readonly<Record<string, readonly number[]>> = {\n \"0\": [7, 5, 5, 5, 7],\n \"1\": [2, 6, 2, 2, 7],\n \"2\": [7, 1, 7, 4, 7],\n \"3\": [7, 1, 7, 1, 7],\n \"4\": [5, 5, 7, 1, 1],\n \"5\": [7, 4, 7, 1, 7],\n \"6\": [7, 4, 7, 5, 7],\n \"7\": [7, 1, 1, 2, 2],\n \"8\": [7, 5, 7, 5, 7],\n \"9\": [7, 5, 7, 1, 7],\n \".\": [0, 0, 0, 0, 2],\n \":\": [0, 2, 0, 2, 0],\n \"-\": [0, 0, 7, 0, 0],\n \"/\": [1, 1, 2, 4, 4],\n \" \": [0, 0, 0, 0, 0],\n a: [2, 5, 7, 5, 5],\n b: [6, 5, 6, 5, 6],\n c: [3, 4, 4, 4, 3],\n d: [6, 5, 5, 5, 6],\n e: [7, 4, 6, 4, 7],\n f: [7, 4, 6, 4, 4],\n g: [3, 4, 5, 5, 3],\n h: [5, 5, 7, 5, 5],\n i: [7, 2, 2, 2, 7],\n j: [1, 1, 1, 5, 2],\n k: [5, 5, 6, 5, 5],\n l: [4, 4, 4, 4, 7],\n m: [5, 7, 7, 5, 5],\n n: [6, 5, 5, 5, 5],\n o: [2, 5, 5, 5, 2],\n p: [6, 5, 6, 4, 4],\n q: [2, 5, 5, 6, 3],\n r: [6, 5, 6, 5, 5],\n s: [3, 4, 2, 1, 6],\n t: [7, 2, 2, 2, 2],\n u: [5, 5, 5, 5, 7],\n v: [5, 5, 5, 5, 2],\n w: [5, 5, 7, 7, 5],\n x: [5, 5, 2, 5, 5],\n y: [5, 5, 2, 2, 2],\n z: [7, 1, 2, 4, 7],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAwBA,SAAgB,0BACd,QACA,MACA,OACA,KAA4B;CAAE,GAAG;CAAG,GAAG;AAAE,GACnC;CACN,IAAI,CAAC,OAAO,cAAc,KAAK,KAAK,SAAS,GAC3C,MAAM,IAAI,MAAM,wCAAwC;CAC1D,MAAM,MAAc,QAAQ;CAC5B,MAAM,WAAmB,KAAK,IAC5B,OAAO,OACP,MAAM,IAAI,KAAK,SAAS,IAAI,QAAQ,KACtC;CACA,MAAM,YAAoB,KAAK,IAAI,OAAO,QAAQ,MAAM,IAAI,IAAI,KAAK;CAGrE,MAAM,OAAe,KAAK,IACxB,GACA,KAAK,IAAI,KAAK,MAAM,GAAG,CAAC,GAAG,OAAO,QAAQ,QAAQ,CACpD;CACA,MAAM,MAAc,KAAK,IACvB,GACA,KAAK,IAAI,KAAK,MAAM,GAAG,CAAC,GAAG,OAAO,SAAS,SAAS,CACtD;CACA,KAAK,Q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AAG;CAAC;CACjB,GAAG;EAAC;EAAG;EAAG;EAAG;EAAG;CAAC;CACjB,GAAG;EAAC;EAAG;EAAG;EAAG;EAAG;CAAC;CACjB,GAAG;EAAC;EAAG;EAAG;EAAG;EAAG;CAAC;CACjB,GAAG;EAAC;EAAG;EAAG;EAAG;EAAG;CAAC;CACjB,GAAG;EAAC;EAAG;EAAG;EAAG;EAAG;CAAC;CACjB,GAAG;EAAC;EAAG;EAAG;EAAG;EAAG;CAAC;CACjB,GAAG;EAAC;EAAG;EAAG;EAAG;EAAG;CAAC;CACjB,GAAG;EAAC;EAAG;EAAG;EAAG;EAAG;CAAC;CACjB,GAAG;EAAC;EAAG;EAAG;EAAG;EAAG;CAAC;AACnB"}
@@ -1,5 +1,4 @@
1
- import { IAutoMovieScript, IAutoMovieSequence, IAutoMovieShot } from "@automovie/interface";
2
- import { IAutoMovieCaptionSidecar } from "./captionSidecar.js";
1
+ import type { IAutoMovieCaptionSidecar, IAutoMoviePlanCaptionSidecarProps } from "@automovie/interface";
3
2
  /**
4
3
  * Plan the caption sidecar of one sequence render: which beat's shot is live at every output frame, grouped into spans, each joined to its beat's caption and enclosing scene slug.
5
4
  *
@@ -15,9 +14,4 @@ import { IAutoMovieCaptionSidecar } from "./captionSidecar.js";
15
14
  * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work The planner computes one sidecar per call from caller-supplied values and coordinates no phases; a host that also plans the render recomputes the shared schedule, which is cheap arithmetic.
16
15
  * @evidence contracts/development/implementation.md#bound-retention-and-release-resources The frame schedule, cursor and beat index are local and released on return; the returned sidecar, owned by the caller, holds one entry per run of consecutive frames of one beat, at most F.
17
16
  */
18
- export declare const planCaptionSidecar: (props: {
19
- script: IAutoMovieScript;
20
- sequence: IAutoMovieSequence;
21
- shots: IAutoMovieShot[];
22
- fps: number;
23
- }) => IAutoMovieCaptionSidecar;
17
+ export declare const planCaptionSidecar: (props: IAutoMoviePlanCaptionSidecarProps) => IAutoMovieCaptionSidecar;
@@ -1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