@hraness/slopcamera 3.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/NOTICE.md +60 -0
- package/PRIVACY.md +46 -0
- package/README.md +311 -0
- package/SECURITY.md +21 -0
- package/apps/desktop/README.md +966 -0
- package/apps/desktop/analysis/protocol.ts +223 -0
- package/apps/desktop/application/capability-binding.ts +594 -0
- package/apps/desktop/application/context.ts +97 -0
- package/apps/desktop/application/creative-iteration.ts +1385 -0
- package/apps/desktop/application/default-registry.ts +146 -0
- package/apps/desktop/application/directing-contract.ts +218 -0
- package/apps/desktop/application/directing-plan.ts +178 -0
- package/apps/desktop/application/errors.ts +18 -0
- package/apps/desktop/application/gateway-port.ts +867 -0
- package/apps/desktop/application/html-overlay-browser-runtime.ts +687 -0
- package/apps/desktop/application/html-overlay-integrity.ts +337 -0
- package/apps/desktop/application/html-overlay-renderer.ts +45 -0
- package/apps/desktop/application/index.ts +13 -0
- package/apps/desktop/application/operation-completion-checkpoint.ts +333 -0
- package/apps/desktop/application/operation-effects.ts +94 -0
- package/apps/desktop/application/operation.ts +224 -0
- package/apps/desktop/application/operations/analysis/faces.ts +244 -0
- package/apps/desktop/application/operations/analysis/music.ts +248 -0
- package/apps/desktop/application/operations/analysis/project-auto-zooms.ts +302 -0
- package/apps/desktop/application/operations/analysis/project-inactivity.ts +381 -0
- package/apps/desktop/application/operations/analysis/scenes.ts +272 -0
- package/apps/desktop/application/operations/analysis/shared.ts +202 -0
- package/apps/desktop/application/operations/derive/edit-batch.ts +967 -0
- package/apps/desktop/application/operations/derive/follow-faces.ts +454 -0
- package/apps/desktop/application/operations/edit/bind-candidate-revision.ts +91 -0
- package/apps/desktop/application/operations/edit/create-candidate-revision.ts +377 -0
- package/apps/desktop/application/operations/edit/create-revision.ts +255 -0
- package/apps/desktop/application/operations/edit/freeze-revision.ts +182 -0
- package/apps/desktop/application/operations/gateway/image.ts +41 -0
- package/apps/desktop/application/operations/gateway/index.ts +17 -0
- package/apps/desktop/application/operations/gateway/shared.ts +122 -0
- package/apps/desktop/application/operations/gateway/speech.ts +41 -0
- package/apps/desktop/application/operations/gateway/transcription.ts +42 -0
- package/apps/desktop/application/operations/gateway/video.ts +41 -0
- package/apps/desktop/application/operations/index.ts +31 -0
- package/apps/desktop/application/operations/iteration/create-candidate.ts +240 -0
- package/apps/desktop/application/operations/iteration/create-matrix.ts +117 -0
- package/apps/desktop/application/operations/iteration/select.ts +155 -0
- package/apps/desktop/application/operations/iteration/shared.ts +250 -0
- package/apps/desktop/application/operations/media/audio-effects.ts +376 -0
- package/apps/desktop/application/operations/media/binding.ts +79 -0
- package/apps/desktop/application/operations/media/capabilities.ts +112 -0
- package/apps/desktop/application/operations/media/color-grade.ts +343 -0
- package/apps/desktop/application/operations/media/html-overlay.ts +802 -0
- package/apps/desktop/application/operations/media/index.ts +8 -0
- package/apps/desktop/application/operations/media/ingest.ts +303 -0
- package/apps/desktop/application/operations/media/overlay.ts +729 -0
- package/apps/desktop/application/operations/media/shared.ts +845 -0
- package/apps/desktop/application/operations/media/transform-platform.ts +120 -0
- package/apps/desktop/application/operations/project/commit-edits.ts +2054 -0
- package/apps/desktop/application/operations/project/promote-selection.ts +495 -0
- package/apps/desktop/application/operations/project/snapshot.ts +95 -0
- package/apps/desktop/application/operations/recording/index.ts +5 -0
- package/apps/desktop/application/operations/recording/pause.ts +34 -0
- package/apps/desktop/application/operations/recording/resume.ts +34 -0
- package/apps/desktop/application/operations/recording/shared.ts +199 -0
- package/apps/desktop/application/operations/recording/start.ts +169 -0
- package/apps/desktop/application/operations/recording/stop.ts +34 -0
- package/apps/desktop/application/operations/render/bind-candidate-output.ts +324 -0
- package/apps/desktop/application/operations/render/materialize-selection.ts +322 -0
- package/apps/desktop/application/operations/render/project-caption-plan.ts +287 -0
- package/apps/desktop/application/operations/render/project-plan.ts +939 -0
- package/apps/desktop/application/operations/render/project-spatial-receipt.ts +70 -0
- package/apps/desktop/application/operations/render/project.ts +1922 -0
- package/apps/desktop/application/operations/shared.ts +67 -0
- package/apps/desktop/application/operations/slopcamera-portable.ts +1188 -0
- package/apps/desktop/application/operations/slopcamera-visuals.ts +784 -0
- package/apps/desktop/application/operations/spatial-project.ts +209 -0
- package/apps/desktop/application/operations/spatial-render.ts +415 -0
- package/apps/desktop/application/operations/spatial-scene.ts +97 -0
- package/apps/desktop/application/operations/studio.ts +143 -0
- package/apps/desktop/application/output-publication-lease.ts +163 -0
- package/apps/desktop/application/project-publication-lease.ts +233 -0
- package/apps/desktop/application/project-store.ts +196 -0
- package/apps/desktop/application/receipts.ts +533 -0
- package/apps/desktop/application/registry.ts +182 -0
- package/apps/desktop/application/spatial-assets.ts +675 -0
- package/apps/desktop/application/spatial-compositor-cadence.ts +23 -0
- package/apps/desktop/application/spatial-project-authority.ts +35 -0
- package/apps/desktop/application/spatial-project-lease.ts +126 -0
- package/apps/desktop/application/spatial-project-render-preparation.ts +225 -0
- package/apps/desktop/application/spatial-project-store.ts +286 -0
- package/apps/desktop/application/spatial-render-projection.ts +201 -0
- package/apps/desktop/application/spatial-render.ts +677 -0
- package/apps/desktop/application/spatial-spz.ts +44 -0
- package/apps/desktop/application/spatial-world-import.ts +135 -0
- package/apps/desktop/application/spatial-world-provenance.ts +46 -0
- package/apps/desktop/application/studio-port.ts +58 -0
- package/apps/desktop/application/verified-receipt-reconciliation.ts +1574 -0
- package/apps/desktop/capture/protocol.ts +689 -0
- package/apps/desktop/cli/analyzer.ts +406 -0
- package/apps/desktop/cli/args.ts +3181 -0
- package/apps/desktop/cli/asset-ingest.ts +747 -0
- package/apps/desktop/cli/atomic-render-effects.ts +210 -0
- package/apps/desktop/cli/atomic-render-platform.ts +205 -0
- package/apps/desktop/cli/atomic-render.ts +50 -0
- package/apps/desktop/cli/audio-analysis.ts +252 -0
- package/apps/desktop/cli/bounded-map.ts +39 -0
- package/apps/desktop/cli/bundle-service.ts +256 -0
- package/apps/desktop/cli/capabilities.ts +212 -0
- package/apps/desktop/cli/capture-bundle.ts +1117 -0
- package/apps/desktop/cli/command-host-resources.ts +251 -0
- package/apps/desktop/cli/commands.ts +6836 -0
- package/apps/desktop/cli/directing-blob.ts +291 -0
- package/apps/desktop/cli/directing-media.ts +517 -0
- package/apps/desktop/cli/directing-quote.ts +89 -0
- package/apps/desktop/cli/directing-service.ts +288 -0
- package/apps/desktop/cli/emoji-assets.ts +538 -0
- package/apps/desktop/cli/errors.ts +29 -0
- package/apps/desktop/cli/face-analysis-service.ts +940 -0
- package/apps/desktop/cli/filter-script.ts +76 -0
- package/apps/desktop/cli/gateway-application-port.ts +1142 -0
- package/apps/desktop/cli/gateway-credential.ts +81 -0
- package/apps/desktop/cli/gateway-media-artifacts.ts +723 -0
- package/apps/desktop/cli/gateway-media-catalog.ts +922 -0
- package/apps/desktop/cli/gateway-media-service.ts +3106 -0
- package/apps/desktop/cli/gateway-media-signature.ts +122 -0
- package/apps/desktop/cli/gateway-provider-options.ts +562 -0
- package/apps/desktop/cli/gateway-scene-provider.ts +391 -0
- package/apps/desktop/cli/help.ts +501 -0
- package/apps/desktop/cli/html-overlay-gpu.ts +97 -0
- package/apps/desktop/cli/html-overlay-renderer.ts +2478 -0
- package/apps/desktop/cli/io.ts +290 -0
- package/apps/desktop/cli/main.ts +123 -0
- package/apps/desktop/cli/media-effects-service.ts +885 -0
- package/apps/desktop/cli/media-ingest-model.ts +364 -0
- package/apps/desktop/cli/media-ingest-platform.ts +227 -0
- package/apps/desktop/cli/media-ingest-program.ts +200 -0
- package/apps/desktop/cli/media-ingest.ts +30 -0
- package/apps/desktop/cli/music-analysis-service.ts +434 -0
- package/apps/desktop/cli/mutation-lock.ts +530 -0
- package/apps/desktop/cli/native-assets.d.ts +12 -0
- package/apps/desktop/cli/native-media-runtime.macos.ts +7 -0
- package/apps/desktop/cli/overlay-playback.ts +177 -0
- package/apps/desktop/cli/paths.ts +265 -0
- package/apps/desktop/cli/portable-surface.ts +242 -0
- package/apps/desktop/cli/project-camera-receipt.ts +112 -0
- package/apps/desktop/cli/project-face-camera.ts +394 -0
- package/apps/desktop/cli/project-inactivity-service.ts +552 -0
- package/apps/desktop/cli/project-media-integrity.ts +121 -0
- package/apps/desktop/cli/project-renderer.ts +1526 -0
- package/apps/desktop/cli/project-service.ts +519 -0
- package/apps/desktop/cli/project-state-transaction.ts +520 -0
- package/apps/desktop/cli/query-limits.ts +1 -0
- package/apps/desktop/cli/recording-controller.ts +1567 -0
- package/apps/desktop/cli/recording-daemon.ts +931 -0
- package/apps/desktop/cli/recording-ref.ts +56 -0
- package/apps/desktop/cli/renamed-environment.ts +6 -0
- package/apps/desktop/cli/renderer.ts +1439 -0
- package/apps/desktop/cli/run-cli-test-helper.ts +60 -0
- package/apps/desktop/cli/scene-analysis-service.ts +879 -0
- package/apps/desktop/cli/spatial-compositor-verifier.ts +213 -0
- package/apps/desktop/cli/spatial-project-service.ts +90 -0
- package/apps/desktop/cli/spatial-scene-service.ts +105 -0
- package/apps/desktop/cli/spatial-world-service.ts +39 -0
- package/apps/desktop/cli/speech-analysis-service.ts +682 -0
- package/apps/desktop/cli/studio-assemble.ts +58 -0
- package/apps/desktop/cli/studio-command.ts +60 -0
- package/apps/desktop/cli/studio-custody.ts +60 -0
- package/apps/desktop/cli/studio-encode.ts +216 -0
- package/apps/desktop/cli/studio-exr.ts +52 -0
- package/apps/desktop/cli/studio-files.ts +179 -0
- package/apps/desktop/cli/studio-output-validation.ts +162 -0
- package/apps/desktop/cli/studio-process.ts +145 -0
- package/apps/desktop/cli/studio-runtime.ts +77 -0
- package/apps/desktop/cli/studio-scaffold.ts +70 -0
- package/apps/desktop/cli/studio-service.ts +301 -0
- package/apps/desktop/cli/studio-spatial-asset.ts +248 -0
- package/apps/desktop/cli/studio-template-names.ts +3 -0
- package/apps/desktop/cli/studio-workflow.ts +19 -0
- package/apps/desktop/cli/time.ts +25 -0
- package/apps/desktop/cli/workflow-code.ts +584 -0
- package/apps/desktop/cli/workflow-runs.ts +576 -0
- package/apps/desktop/code/advanced.ts +139 -0
- package/apps/desktop/code/application-node-planner.ts +1288 -0
- package/apps/desktop/code/compiler.ts +329 -0
- package/apps/desktop/code/contracts.ts +13 -0
- package/apps/desktop/code/creative-recipes.ts +94 -0
- package/apps/desktop/code/define-workflow.ts +115 -0
- package/apps/desktop/code/editing.ts +284 -0
- package/apps/desktop/code/file-candidate-provenance.ts +420 -0
- package/apps/desktop/code/file-candidate.ts +69 -0
- package/apps/desktop/code/graph-builder.ts +10 -0
- package/apps/desktop/code/host-resource-policy.ts +55 -0
- package/apps/desktop/code/plan-contracts.ts +159 -0
- package/apps/desktop/code/planning.ts +361 -0
- package/apps/desktop/code/public.ts +134 -0
- package/apps/desktop/code/reference-projection.ts +62 -0
- package/apps/desktop/code/run-contracts.ts +466 -0
- package/apps/desktop/code/run-store.ts +2478 -0
- package/apps/desktop/code/runtime-identity.ts +328 -0
- package/apps/desktop/code/scheduler.ts +3067 -0
- package/apps/desktop/code/semantic-builder.ts +1436 -0
- package/apps/desktop/code/source-bundle.ts +1641 -0
- package/apps/desktop/code/source-typecheck.ts +211 -0
- package/apps/desktop/code/testing.ts +79 -0
- package/apps/desktop/code/worker-client.ts +1675 -0
- package/apps/desktop/code/worker-effects.ts +141 -0
- package/apps/desktop/code/worker-entry.ts +435 -0
- package/apps/desktop/code/worker-lease-guardian.ts +179 -0
- package/apps/desktop/code/worker-process-identity.ts +484 -0
- package/apps/desktop/code/worker-protocol.ts +211 -0
- package/apps/desktop/code/workflow-effects.ts +132 -0
- package/apps/desktop/contracts/analysis.ts +949 -0
- package/apps/desktop/contracts/edit.ts +576 -0
- package/apps/desktop/contracts/index.ts +9 -0
- package/apps/desktop/contracts/media-effects.ts +139 -0
- package/apps/desktop/contracts/project-render.ts +644 -0
- package/apps/desktop/contracts/project.ts +740 -0
- package/apps/desktop/contracts/recording.ts +1434 -0
- package/apps/desktop/contracts/render.ts +334 -0
- package/apps/desktop/contracts/runtime.ts +155 -0
- package/apps/desktop/contracts/spatial-compositor.ts +58 -0
- package/apps/desktop/contracts/spatial-project.ts +159 -0
- package/apps/desktop/contracts/spatial-world.ts +48 -0
- package/apps/desktop/contracts/video-effects.ts +120 -0
- package/apps/desktop/core/alignment-apply.ts +400 -0
- package/apps/desktop/core/audio-alignment.ts +466 -0
- package/apps/desktop/core/auto-zoom.ts +209 -0
- package/apps/desktop/core/canonical-json.ts +14 -0
- package/apps/desktop/core/emoji.ts +210 -0
- package/apps/desktop/core/events.ts +409 -0
- package/apps/desktop/core/face-framing.ts +533 -0
- package/apps/desktop/core/face-tracks.ts +326 -0
- package/apps/desktop/core/inactivity.ts +137 -0
- package/apps/desktop/core/index.ts +30 -0
- package/apps/desktop/core/intervals.ts +123 -0
- package/apps/desktop/core/montage.ts +236 -0
- package/apps/desktop/core/music-analysis.ts +518 -0
- package/apps/desktop/core/plan.ts +244 -0
- package/apps/desktop/core/project-auto-zoom.ts +75 -0
- package/apps/desktop/core/project-camera-spatial.ts +676 -0
- package/apps/desktop/core/project-camera.ts +403 -0
- package/apps/desktop/core/project-captions.ts +888 -0
- package/apps/desktop/core/project-inactivity.ts +125 -0
- package/apps/desktop/core/project-metadata.ts +927 -0
- package/apps/desktop/core/project-plan.ts +375 -0
- package/apps/desktop/core/project-render-plan.ts +303 -0
- package/apps/desktop/core/project-time.ts +469 -0
- package/apps/desktop/core/render-plan.ts +442 -0
- package/apps/desktop/core/scene-cache.ts +174 -0
- package/apps/desktop/core/scene-sampling.ts +448 -0
- package/apps/desktop/core/spatial-compositor.ts +22 -0
- package/apps/desktop/core/spatial-durability.ts +99 -0
- package/apps/desktop/core/spatial-project.ts +169 -0
- package/apps/desktop/core/spatial-shot-clock.ts +32 -0
- package/apps/desktop/core/speech-analysis.ts +333 -0
- package/apps/desktop/core/storage.ts +970 -0
- package/apps/desktop/core/time-map.ts +91 -0
- package/apps/desktop/core/time.ts +61 -0
- package/apps/desktop/core/video-effects.ts +660 -0
- package/apps/desktop/dist/cli/NebulaSans-Bold-26se8aek.otf +0 -0
- package/apps/desktop/dist/cli/NebulaSans-Bold-bcz7y08t.woff2 +0 -0
- package/apps/desktop/dist/cli/NebulaSans-Book-5ax05zvn.woff2 +0 -0
- package/apps/desktop/dist/cli/NebulaSans-Book-8cenzchw.otf +0 -0
- package/apps/desktop/dist/cli/main.js +5086 -0
- package/apps/desktop/html-overlay/catalog.ts +171 -0
- package/apps/desktop/html-overlay/contracts.ts +372 -0
- package/apps/desktop/html-overlay/execution-profile.ts +77 -0
- package/apps/desktop/html-overlay/index.ts +98 -0
- package/apps/desktop/html-overlay/libraries.ts +263 -0
- package/apps/desktop/html-overlay/random.ts +49 -0
- package/apps/desktop/html-overlay/runtime.ts +813 -0
- package/apps/desktop/html-overlay/scaffolds.ts +792 -0
- package/apps/desktop/html-overlay/spark-runtime.ts +88 -0
- package/apps/desktop/html-overlay/spatial-splat-runtime.ts +60 -0
- package/apps/desktop/html-overlay/spatial.ts +720 -0
- package/apps/desktop/studio/assets/README.md +39 -0
- package/apps/desktop/studio/assets/contracts.ts +129 -0
- package/apps/desktop/studio/assets/network.ts +64 -0
- package/apps/desktop/studio/assets/poly-haven.ts +148 -0
- package/apps/desktop/studio/drivers/blender_driver.py +466 -0
- package/apps/desktop/studio/drivers/cadquery_driver.py +176 -0
- package/apps/desktop/studio/education/driver.py +308 -0
- package/apps/desktop/studio/education/lesson.py +180 -0
- package/apps/desktop/studio/education/toolkit.py +249 -0
- package/apps/desktop/workflows/chaptered-demo.ts +48 -0
- package/apps/desktop/workflows/creative-iteration.ts +107 -0
- package/apps/desktop/workflows/creative-selection.ts +92 -0
- package/apps/desktop/workflows/fragments.ts +486 -0
- package/apps/desktop/workflows/index.ts +93 -0
- package/apps/desktop/workflows/polished-screen-demo.ts +128 -0
- package/apps/desktop/workflows/scene-direction.ts +12 -0
- package/apps/desktop/workflows/social-variants.ts +75 -0
- package/apps/desktop/workflows/talking-head-cleanup.ts +53 -0
- package/dist/NebulaSans-Bold-26se8aek.otf +0 -0
- package/dist/NebulaSans-Bold-bcz7y08t.woff2 +0 -0
- package/dist/NebulaSans-Book-5ax05zvn.woff2 +0 -0
- package/dist/NebulaSans-Book-8cenzchw.otf +0 -0
- package/dist/cli.js +479 -0
- package/dist/code/advanced.js +270 -0
- package/dist/code/index.js +2240 -0
- package/dist/generate.js +24 -0
- package/dist/host-resources.js +26 -0
- package/dist/index-42zsesc1.js +2257 -0
- package/dist/index-7308egqr.js +48 -0
- package/dist/index-8txs6fkn.js +712 -0
- package/dist/index-mcy8z0br.js +192 -0
- package/dist/index-p63wavx0.js +2029 -0
- package/dist/index-r7gdhmsp.js +424 -0
- package/dist/index-sh6xbav6.js +1219 -0
- package/dist/index-z1w83f81.js +4 -0
- package/dist/index-z7239b4h.js +2363 -0
- package/dist/index-zfeg9hmw.js +2013 -0
- package/dist/index.js +241 -0
- package/dist/operations.js +29 -0
- package/dist/skill-install-dh0ntqba.js +10 -0
- package/dist/vectorize/worker.js +142 -0
- package/dist/workflow.js +16 -0
- package/docs/README.md +38 -0
- package/docs/studio.md +215 -0
- package/examples/studio/blender/README.md +26 -0
- package/examples/studio/blender/character.py +152 -0
- package/examples/studio/blender/cloth.py +101 -0
- package/examples/studio/blender/color_chart.py +29 -0
- package/examples/studio/blender/fluid.py +78 -0
- package/examples/studio/blender/import_model.py +74 -0
- package/examples/studio/blender/product.py +53 -0
- package/examples/studio/blender/shaded_street.py +481 -0
- package/examples/studio/blender/studio_scene.py +147 -0
- package/examples/studio/cadquery/README.md +13 -0
- package/examples/studio/cadquery/bracket.py +36 -0
- package/examples/studio/cadquery/import_step.py +12 -0
- package/examples/studio/education/README.md +46 -0
- package/examples/studio/education/lesson.json +99 -0
- package/examples/studio/education/scene.py +7 -0
- package/examples/studio/hybrid-scene.ts +96 -0
- package/examples/studio/native-workflow.ts +14 -0
- package/examples/studio/vgpu/README.md +64 -0
- package/examples/studio/vgpu/heat-field.mjs +290 -0
- package/package.json +304 -0
- package/packages/scene/src/index.ts +1 -0
- package/packages/scene/src/scene.ts +215 -0
- package/schema/diagram.schema.json +334 -0
- package/skills/slopcamera/SKILL.md +45 -0
- package/skills/slopcamera/agents/openai.yaml +4 -0
- package/skills/slopcamera/references/customization.md +77 -0
- package/skills/slopcamera/references/diagrams.md +153 -0
- package/skills/slopcamera/references/directed-scenes.md +42 -0
- package/skills/slopcamera/references/directing-video.md +18 -0
- package/skills/slopcamera/references/educational-video.md +26 -0
- package/skills/slopcamera/references/gateway-media.md +134 -0
- package/skills/slopcamera/references/install.md +62 -0
- package/skills/slopcamera/references/native-studio.md +31 -0
- package/skills/slopcamera/references/reference-led-3d.md +140 -0
- package/skills/slopcamera/references/rubber-stamp-examples/poster-example-1.jpg +0 -0
- package/skills/slopcamera/references/rubber-stamp-examples/poster-example-2.jpg +0 -0
- package/skills/slopcamera/references/rubber-stamp-examples/stamp-style-1.png +0 -0
- package/skills/slopcamera/references/rubber-stamp-examples/stamp-style-2.png +0 -0
- package/skills/slopcamera/references/rubber-stamp-field-notes.md +144 -0
- package/skills/slopcamera/references/vectorization.md +29 -0
- package/skills/slopcamera/references/video-projects.md +187 -0
- package/skills/slopcamera/references/visual-communication.md +120 -0
- package/skills/slopcamera/references/workflows-sdk.md +45 -0
- package/skills/slopcamera/scripts/compose-rubber-stamp-field-note.ts +229 -0
- package/src/artifacts.ts +106 -0
- package/src/assets/fonts/nebula-sans/LICENSE.txt +96 -0
- package/src/assets/fonts/nebula-sans/NebulaSans-Bold.otf +0 -0
- package/src/assets/fonts/nebula-sans/NebulaSans-Bold.woff2 +0 -0
- package/src/assets/fonts/nebula-sans/NebulaSans-Book.otf +0 -0
- package/src/assets/fonts/nebula-sans/NebulaSans-Book.woff2 +0 -0
- package/src/assets/fonts/nebula-sans/PROVENANCE.md +21 -0
- package/src/assets.d.ts +9 -0
- package/src/cli.ts +601 -0
- package/src/cloud-errors.ts +26 -0
- package/src/code/advanced.ts +10 -0
- package/src/code/boundary.ts +21 -0
- package/src/code/canonical-json.ts +129 -0
- package/src/code/compiler.ts +953 -0
- package/src/code/contracts.ts +576 -0
- package/src/code/define-workflow.ts +334 -0
- package/src/code/errors.ts +41 -0
- package/src/code/graph-builder.ts +945 -0
- package/src/code/index.ts +121 -0
- package/src/code/json-snapshot.ts +899 -0
- package/src/code/json-utf8.ts +88 -0
- package/src/code/portable-builder.ts +136 -0
- package/src/code/projection.ts +378 -0
- package/src/code/public-operations.ts +450 -0
- package/src/code/runtime.ts +580 -0
- package/src/code/sha256.ts +36 -0
- package/src/config.ts +180 -0
- package/src/desktop.ts +253 -0
- package/src/fs.ts +10 -0
- package/src/generate.ts +704 -0
- package/src/host-resource-posix.ts +161 -0
- package/src/host-resources.ts +1749 -0
- package/src/icons.ts +58 -0
- package/src/index.ts +200 -0
- package/src/label-layout.ts +130 -0
- package/src/layout.ts +413 -0
- package/src/lint.ts +127 -0
- package/src/mcp/boundary.ts +354 -0
- package/src/mcp/index.ts +33 -0
- package/src/mcp/server.ts +272 -0
- package/src/mcp/tools.ts +963 -0
- package/src/mcp/types.ts +71 -0
- package/src/operations.ts +775 -0
- package/src/parse.ts +861 -0
- package/src/process-environment.ts +17 -0
- package/src/render.ts +437 -0
- package/src/skill-install.ts +49 -0
- package/src/spatial-scene/authoring.ts +27 -0
- package/src/spatial-scene/camera-track.ts +83 -0
- package/src/spatial-scene/contracts.ts +277 -0
- package/src/spatial-scene/evaluate.ts +145 -0
- package/src/spatial-scene/gltf.ts +558 -0
- package/src/spatial-scene/identity.ts +260 -0
- package/src/spatial-scene/index.ts +10 -0
- package/src/spatial-scene/inspect.ts +68 -0
- package/src/spatial-scene/math.ts +280 -0
- package/src/spatial-scene/patch.ts +131 -0
- package/src/spatial-scene/time.ts +53 -0
- package/src/studio/contracts.ts +129 -0
- package/src/studio/index.ts +2 -0
- package/src/studio/plan.ts +156 -0
- package/src/studio/shared.ts +41 -0
- package/src/theme.ts +68 -0
- package/src/tldr.ts +474 -0
- package/src/types.ts +212 -0
- package/src/vectorize/archive.ts +101 -0
- package/src/vectorize/command.ts +797 -0
- package/src/vectorize/index.ts +27 -0
- package/src/vectorize/limits.ts +61 -0
- package/src/vectorize/metrics.ts +351 -0
- package/src/vectorize/pixels.ts +323 -0
- package/src/vectorize/supervisor.ts +339 -0
- package/src/vectorize/svg.ts +188 -0
- package/src/vectorize/tool.ts +542 -0
- package/src/vectorize/types.ts +113 -0
- package/src/vectorize/vectorize.ts +634 -0
- package/src/vectorize/worker-protocol.ts +40 -0
- package/src/vectorize/worker.ts +209 -0
- package/src/version.ts +1 -0
- package/src/workflow.ts +409 -0
|
@@ -0,0 +1,660 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ColorGradeControls,
|
|
3
|
+
ColorGradeSelection,
|
|
4
|
+
} from "../contracts/media-effects";
|
|
5
|
+
import {
|
|
6
|
+
VideoLookPresetOptionsSchema,
|
|
7
|
+
VideoLookPresetSchema,
|
|
8
|
+
VideoLookV1Schema,
|
|
9
|
+
type VideoEffect,
|
|
10
|
+
type VideoEffectInput,
|
|
11
|
+
type VideoLookPreset,
|
|
12
|
+
type VideoLookPresetOptionsInput,
|
|
13
|
+
type VideoLookV1,
|
|
14
|
+
} from "../contracts/video-effects";
|
|
15
|
+
import { canonicalJsonSha256 } from "./canonical-json";
|
|
16
|
+
|
|
17
|
+
interface ResolvedColorGradeControls {
|
|
18
|
+
readonly brightness: number;
|
|
19
|
+
readonly contrast: number;
|
|
20
|
+
readonly gamma: number;
|
|
21
|
+
readonly hue: number;
|
|
22
|
+
readonly saturation: number;
|
|
23
|
+
readonly temperature: number;
|
|
24
|
+
readonly tint: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
type ColorGradePreset = Extract<
|
|
28
|
+
ColorGradeSelection,
|
|
29
|
+
{ readonly kind: "preset" }
|
|
30
|
+
>["preset"];
|
|
31
|
+
|
|
32
|
+
const NEUTRAL_GRADE: ResolvedColorGradeControls = {
|
|
33
|
+
brightness: 0,
|
|
34
|
+
contrast: 1,
|
|
35
|
+
gamma: 1,
|
|
36
|
+
hue: 0,
|
|
37
|
+
saturation: 1,
|
|
38
|
+
temperature: 0,
|
|
39
|
+
tint: 0,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const COLOR_PRESETS = {
|
|
43
|
+
cinematic: {
|
|
44
|
+
brightness: -0.02,
|
|
45
|
+
contrast: 1.14,
|
|
46
|
+
gamma: 0.96,
|
|
47
|
+
hue: 0,
|
|
48
|
+
saturation: 0.88,
|
|
49
|
+
temperature: 0.12,
|
|
50
|
+
tint: 0.06,
|
|
51
|
+
},
|
|
52
|
+
clean: {
|
|
53
|
+
brightness: 0.02,
|
|
54
|
+
contrast: 1.04,
|
|
55
|
+
gamma: 1,
|
|
56
|
+
hue: 0,
|
|
57
|
+
saturation: 1.02,
|
|
58
|
+
temperature: 0,
|
|
59
|
+
tint: 0,
|
|
60
|
+
},
|
|
61
|
+
cool: {
|
|
62
|
+
brightness: 0,
|
|
63
|
+
contrast: 1.05,
|
|
64
|
+
gamma: 1,
|
|
65
|
+
hue: 0,
|
|
66
|
+
saturation: 0.96,
|
|
67
|
+
temperature: -0.35,
|
|
68
|
+
tint: 0,
|
|
69
|
+
},
|
|
70
|
+
flat: {
|
|
71
|
+
brightness: 0.02,
|
|
72
|
+
contrast: 0.86,
|
|
73
|
+
gamma: 1.04,
|
|
74
|
+
hue: 0,
|
|
75
|
+
saturation: 0.85,
|
|
76
|
+
temperature: 0,
|
|
77
|
+
tint: 0,
|
|
78
|
+
},
|
|
79
|
+
monochrome: {
|
|
80
|
+
brightness: 0,
|
|
81
|
+
contrast: 1.1,
|
|
82
|
+
gamma: 1,
|
|
83
|
+
hue: 0,
|
|
84
|
+
saturation: 0,
|
|
85
|
+
temperature: 0,
|
|
86
|
+
tint: 0,
|
|
87
|
+
},
|
|
88
|
+
vivid: {
|
|
89
|
+
brightness: 0.01,
|
|
90
|
+
contrast: 1.12,
|
|
91
|
+
gamma: 1,
|
|
92
|
+
hue: 0,
|
|
93
|
+
saturation: 1.22,
|
|
94
|
+
temperature: 0,
|
|
95
|
+
tint: 0,
|
|
96
|
+
},
|
|
97
|
+
warm: {
|
|
98
|
+
brightness: 0,
|
|
99
|
+
contrast: 1.04,
|
|
100
|
+
gamma: 1,
|
|
101
|
+
hue: 0,
|
|
102
|
+
saturation: 1.08,
|
|
103
|
+
temperature: 0.35,
|
|
104
|
+
tint: 0,
|
|
105
|
+
},
|
|
106
|
+
} as const satisfies Readonly<Record<ColorGradePreset, ResolvedColorGradeControls>>;
|
|
107
|
+
|
|
108
|
+
const MAXIMUM_VIDEO_STREAM_INDEX = 1_024;
|
|
109
|
+
const COMPILER_VERSION = 1;
|
|
110
|
+
|
|
111
|
+
export interface VideoLookFfmpegCompileOptions {
|
|
112
|
+
readonly videoStreamIndex?: number;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface CompiledVideoLook {
|
|
116
|
+
readonly compiler: "slopcamera.ffmpeg-video-look";
|
|
117
|
+
readonly compilerVersion: typeof COMPILER_VERSION;
|
|
118
|
+
readonly filterGraph: string;
|
|
119
|
+
readonly inputLabel: string;
|
|
120
|
+
readonly look: VideoLookV1;
|
|
121
|
+
readonly lookHash: string;
|
|
122
|
+
readonly outputLabel: string;
|
|
123
|
+
readonly requiredFilters: readonly string[];
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function decimal(value: number): string {
|
|
127
|
+
if (!Number.isFinite(value)) {
|
|
128
|
+
throw new RangeError("FFmpeg video-effect values must be finite.");
|
|
129
|
+
}
|
|
130
|
+
const normalized = Math.abs(value) < 0.000_000_000_1 ? 0 : value;
|
|
131
|
+
return normalized.toFixed(10).replace(/0+$/u, "").replace(/\.$/u, "");
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function roundAmount(value: number): number {
|
|
135
|
+
return Math.round(value * 1_000_000) / 1_000_000;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function scaledAmount(base: number, intensity: number): number {
|
|
139
|
+
return roundAmount(Math.min(1, Math.max(0, base * intensity)));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function createPresetEffects(
|
|
143
|
+
preset: VideoLookPreset,
|
|
144
|
+
intensity: number,
|
|
145
|
+
seed: number,
|
|
146
|
+
): readonly VideoEffectInput[] {
|
|
147
|
+
if (preset === "blue-16mm") {
|
|
148
|
+
return [
|
|
149
|
+
{
|
|
150
|
+
amount: intensity,
|
|
151
|
+
grade: {
|
|
152
|
+
kind: "preset",
|
|
153
|
+
overrides: {
|
|
154
|
+
brightness: -0.03,
|
|
155
|
+
contrast: 1.18,
|
|
156
|
+
gamma: 0.92,
|
|
157
|
+
saturation: 0.78,
|
|
158
|
+
temperature: -0.55,
|
|
159
|
+
tint: -0.06,
|
|
160
|
+
},
|
|
161
|
+
preset: "cinematic",
|
|
162
|
+
},
|
|
163
|
+
kind: "color-grade",
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
amount: scaledAmount(0.72, intensity),
|
|
167
|
+
highlights: "#9edbfa",
|
|
168
|
+
kind: "duotone",
|
|
169
|
+
shadows: "#061018",
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
amount: scaledAmount(0.17, intensity),
|
|
173
|
+
blendMode: "screen",
|
|
174
|
+
kind: "diffusion",
|
|
175
|
+
radiusPx: 4.8,
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
amount: scaledAmount(0.48, intensity),
|
|
179
|
+
cadence: "frame-varying",
|
|
180
|
+
chroma: 0.08,
|
|
181
|
+
kind: "film-grain",
|
|
182
|
+
seed,
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
amount: scaledAmount(0.22, intensity),
|
|
186
|
+
kind: "vignette",
|
|
187
|
+
},
|
|
188
|
+
];
|
|
189
|
+
}
|
|
190
|
+
if (preset === "warm-super-8") {
|
|
191
|
+
return [
|
|
192
|
+
{
|
|
193
|
+
amount: intensity,
|
|
194
|
+
grade: {
|
|
195
|
+
kind: "preset",
|
|
196
|
+
overrides: {
|
|
197
|
+
brightness: 0.015,
|
|
198
|
+
contrast: 1.1,
|
|
199
|
+
gamma: 0.97,
|
|
200
|
+
saturation: 0.96,
|
|
201
|
+
temperature: 0.48,
|
|
202
|
+
tint: 0.08,
|
|
203
|
+
},
|
|
204
|
+
preset: "warm",
|
|
205
|
+
},
|
|
206
|
+
kind: "color-grade",
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
amount: scaledAmount(0.18, intensity),
|
|
210
|
+
highlights: "#f4d6a2",
|
|
211
|
+
kind: "duotone",
|
|
212
|
+
shadows: "#21100e",
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
amount: scaledAmount(0.12, intensity),
|
|
216
|
+
blendMode: "screen",
|
|
217
|
+
kind: "diffusion",
|
|
218
|
+
radiusPx: 3.2,
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
amount: scaledAmount(0.34, intensity),
|
|
222
|
+
cadence: "frame-varying",
|
|
223
|
+
chroma: 0.18,
|
|
224
|
+
kind: "film-grain",
|
|
225
|
+
seed,
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
amount: scaledAmount(0.18, intensity),
|
|
229
|
+
kind: "vignette",
|
|
230
|
+
},
|
|
231
|
+
];
|
|
232
|
+
}
|
|
233
|
+
if (preset === "photocopy") {
|
|
234
|
+
return [
|
|
235
|
+
{
|
|
236
|
+
amount: intensity,
|
|
237
|
+
grade: { kind: "preset", preset: "monochrome" },
|
|
238
|
+
kind: "color-grade",
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
amount: scaledAmount(0.9, intensity),
|
|
242
|
+
highlights: "#f0eee4",
|
|
243
|
+
kind: "duotone",
|
|
244
|
+
shadows: "#080808",
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
amount: scaledAmount(0.82, intensity),
|
|
248
|
+
bayerScale: 1,
|
|
249
|
+
colors: 4,
|
|
250
|
+
kind: "ordered-dither",
|
|
251
|
+
matrix: "bayer-8x8",
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
amount: scaledAmount(0.12, intensity),
|
|
255
|
+
cadence: "fixed",
|
|
256
|
+
chroma: 0,
|
|
257
|
+
kind: "film-grain",
|
|
258
|
+
seed,
|
|
259
|
+
},
|
|
260
|
+
];
|
|
261
|
+
}
|
|
262
|
+
if (preset === "soft-vhs") {
|
|
263
|
+
return [
|
|
264
|
+
{
|
|
265
|
+
amount: scaledAmount(0.72, intensity),
|
|
266
|
+
grade: {
|
|
267
|
+
kind: "preset",
|
|
268
|
+
overrides: {
|
|
269
|
+
contrast: 1.08,
|
|
270
|
+
gamma: 0.98,
|
|
271
|
+
saturation: 1.12,
|
|
272
|
+
},
|
|
273
|
+
preset: "cool",
|
|
274
|
+
},
|
|
275
|
+
kind: "color-grade",
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
amount: scaledAmount(0.28, intensity),
|
|
279
|
+
cadence: "frame-varying",
|
|
280
|
+
chroma: 0.65,
|
|
281
|
+
kind: "film-grain",
|
|
282
|
+
seed,
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
amount: scaledAmount(0.16, intensity),
|
|
286
|
+
kind: "scanlines",
|
|
287
|
+
spacingPx: 4,
|
|
288
|
+
thicknessPx: 1,
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
amount: scaledAmount(0.08, intensity),
|
|
292
|
+
blendMode: "soft-light",
|
|
293
|
+
kind: "diffusion",
|
|
294
|
+
radiusPx: 2.4,
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
amount: scaledAmount(0.15, intensity),
|
|
298
|
+
kind: "vignette",
|
|
299
|
+
},
|
|
300
|
+
];
|
|
301
|
+
}
|
|
302
|
+
preset satisfies never;
|
|
303
|
+
throw new Error("Unreachable video-look preset.");
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/** Expand a stable, inspectable preset into the same graph used by custom code. */
|
|
307
|
+
export function createVideoLookPreset(
|
|
308
|
+
presetInput: VideoLookPreset,
|
|
309
|
+
optionsInput: VideoLookPresetOptionsInput = {},
|
|
310
|
+
): VideoLookV1 {
|
|
311
|
+
const preset = VideoLookPresetSchema.parse(presetInput);
|
|
312
|
+
const options = VideoLookPresetOptionsSchema.parse(optionsInput);
|
|
313
|
+
return VideoLookV1Schema.parse({
|
|
314
|
+
effects: createPresetEffects(preset, options.intensity, options.seed),
|
|
315
|
+
kind: "slopcamera.video-look",
|
|
316
|
+
processingColorSpace: "bt709-display",
|
|
317
|
+
schemaVersion: 1,
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/** Normalize a custom graph so code-mode workflows receive defaults immediately. */
|
|
322
|
+
export function createVideoLook(effects: readonly VideoEffectInput[]): VideoLookV1 {
|
|
323
|
+
return VideoLookV1Schema.parse({
|
|
324
|
+
effects,
|
|
325
|
+
kind: "slopcamera.video-look",
|
|
326
|
+
processingColorSpace: "bt709-display",
|
|
327
|
+
schemaVersion: 1,
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
export const videoLooks = {
|
|
332
|
+
blue16mm: (options?: VideoLookPresetOptionsInput) =>
|
|
333
|
+
createVideoLookPreset("blue-16mm", options),
|
|
334
|
+
photocopy: (options?: VideoLookPresetOptionsInput) =>
|
|
335
|
+
createVideoLookPreset("photocopy", options),
|
|
336
|
+
softVhs: (options?: VideoLookPresetOptionsInput) =>
|
|
337
|
+
createVideoLookPreset("soft-vhs", options),
|
|
338
|
+
warmSuper8: (options?: VideoLookPresetOptionsInput) =>
|
|
339
|
+
createVideoLookPreset("warm-super-8", options),
|
|
340
|
+
} as const;
|
|
341
|
+
|
|
342
|
+
function applyControls(
|
|
343
|
+
base: ResolvedColorGradeControls,
|
|
344
|
+
overrides: ColorGradeControls | undefined,
|
|
345
|
+
): ResolvedColorGradeControls {
|
|
346
|
+
return {
|
|
347
|
+
brightness: overrides?.brightness ?? base.brightness,
|
|
348
|
+
contrast: overrides?.contrast ?? base.contrast,
|
|
349
|
+
gamma: overrides?.gamma ?? base.gamma,
|
|
350
|
+
hue: overrides?.hue ?? base.hue,
|
|
351
|
+
saturation: overrides?.saturation ?? base.saturation,
|
|
352
|
+
temperature: overrides?.temperature ?? base.temperature,
|
|
353
|
+
tint: overrides?.tint ?? base.tint,
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
function resolveColorGrade(grade: ColorGradeSelection): ResolvedColorGradeControls {
|
|
358
|
+
return grade.kind === "custom"
|
|
359
|
+
? applyControls(NEUTRAL_GRADE, grade.controls)
|
|
360
|
+
: applyControls(COLOR_PRESETS[grade.preset], grade.overrides);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
function clampBalance(value: number): number {
|
|
364
|
+
return Math.max(-1, Math.min(1, value));
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function balanceBand(
|
|
368
|
+
temperature: number,
|
|
369
|
+
tint: number,
|
|
370
|
+
strength: number,
|
|
371
|
+
): { readonly blue: number; readonly green: number; readonly red: number } {
|
|
372
|
+
return {
|
|
373
|
+
blue: clampBalance((-temperature + tint * 0.5) * strength),
|
|
374
|
+
green: clampBalance(-tint * strength),
|
|
375
|
+
red: clampBalance((temperature + tint * 0.5) * strength),
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
function colorGradeTreatment(
|
|
380
|
+
effect: Extract<VideoEffect, { readonly kind: "color-grade" }>,
|
|
381
|
+
): { readonly filter: string; readonly names: readonly string[] } {
|
|
382
|
+
const controls = resolveColorGrade(effect.grade);
|
|
383
|
+
const filters = [
|
|
384
|
+
`eq=brightness=${decimal(controls.brightness)}:contrast=${decimal(controls.contrast)}:saturation=${decimal(controls.saturation)}:gamma=${decimal(controls.gamma)}`,
|
|
385
|
+
];
|
|
386
|
+
const names = ["eq"];
|
|
387
|
+
if (controls.temperature !== 0 || controls.tint !== 0) {
|
|
388
|
+
const shadows = balanceBand(controls.temperature, controls.tint, 0.12);
|
|
389
|
+
const midtones = balanceBand(controls.temperature, controls.tint, 0.2);
|
|
390
|
+
const highlights = balanceBand(controls.temperature, controls.tint, 0.1);
|
|
391
|
+
filters.push([
|
|
392
|
+
`colorbalance=rs=${decimal(shadows.red)}`,
|
|
393
|
+
`gs=${decimal(shadows.green)}`,
|
|
394
|
+
`bs=${decimal(shadows.blue)}`,
|
|
395
|
+
`rm=${decimal(midtones.red)}`,
|
|
396
|
+
`gm=${decimal(midtones.green)}`,
|
|
397
|
+
`bm=${decimal(midtones.blue)}`,
|
|
398
|
+
`rh=${decimal(highlights.red)}`,
|
|
399
|
+
`gh=${decimal(highlights.green)}`,
|
|
400
|
+
`bh=${decimal(highlights.blue)}`,
|
|
401
|
+
].join(":"));
|
|
402
|
+
names.push("colorbalance");
|
|
403
|
+
}
|
|
404
|
+
if (controls.hue !== 0) {
|
|
405
|
+
filters.push(`hue=h=${decimal(controls.hue)}`);
|
|
406
|
+
names.push("hue");
|
|
407
|
+
}
|
|
408
|
+
return { filter: filters.join(","), names };
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
function parseRgbHex(color: string): readonly [number, number, number] {
|
|
412
|
+
return [
|
|
413
|
+
Number.parseInt(color.slice(1, 3), 16) / 255,
|
|
414
|
+
Number.parseInt(color.slice(3, 5), 16) / 255,
|
|
415
|
+
Number.parseInt(color.slice(5, 7), 16) / 255,
|
|
416
|
+
];
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
function duotoneTreatment(
|
|
420
|
+
effect: Extract<VideoEffect, { readonly kind: "duotone" }>,
|
|
421
|
+
): string {
|
|
422
|
+
const shadows = parseRgbHex(effect.shadows);
|
|
423
|
+
const highlights = parseRgbHex(effect.highlights);
|
|
424
|
+
const curve = (shadow: number, highlight: number) =>
|
|
425
|
+
`'0/${decimal(shadow)} 1/${decimal(highlight)}'`;
|
|
426
|
+
return [
|
|
427
|
+
"hue=s=0",
|
|
428
|
+
`curves=interp=pchip:r=${curve(shadows[0], highlights[0])}:g=${curve(shadows[1], highlights[1])}:b=${curve(shadows[2], highlights[2])}`,
|
|
429
|
+
].join(",");
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
function effectOutputLabel(index: number): string {
|
|
433
|
+
return `video_look_${index}`;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
function addRequired(required: Set<string>, names: readonly string[]): void {
|
|
437
|
+
for (const name of names) required.add(name);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
function appendMixedTreatment(
|
|
441
|
+
graph: string[],
|
|
442
|
+
required: Set<string>,
|
|
443
|
+
currentLabel: string,
|
|
444
|
+
outputLabel: string,
|
|
445
|
+
treatment: string,
|
|
446
|
+
treatmentFilters: readonly string[],
|
|
447
|
+
amount: number,
|
|
448
|
+
): string {
|
|
449
|
+
addRequired(required, treatmentFilters);
|
|
450
|
+
if (amount === 1) {
|
|
451
|
+
graph.push(`[${currentLabel}]${treatment}[${outputLabel}]`);
|
|
452
|
+
return outputLabel;
|
|
453
|
+
}
|
|
454
|
+
const base = `${outputLabel}_base`;
|
|
455
|
+
const treatedInput = `${outputLabel}_treated_input`;
|
|
456
|
+
const treated = `${outputLabel}_treated`;
|
|
457
|
+
graph.push(`[${currentLabel}]split=2[${base}][${treatedInput}]`);
|
|
458
|
+
graph.push(`[${treatedInput}]${treatment}[${treated}]`);
|
|
459
|
+
graph.push(
|
|
460
|
+
`[${base}][${treated}]blend=all_mode=normal:all_opacity=${decimal(amount)}[${outputLabel}]`,
|
|
461
|
+
);
|
|
462
|
+
required.add("split");
|
|
463
|
+
required.add("blend");
|
|
464
|
+
return outputLabel;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
function appendDiffusion(
|
|
468
|
+
graph: string[],
|
|
469
|
+
required: Set<string>,
|
|
470
|
+
currentLabel: string,
|
|
471
|
+
outputLabel: string,
|
|
472
|
+
effect: Extract<VideoEffect, { readonly kind: "diffusion" }>,
|
|
473
|
+
): string {
|
|
474
|
+
const base = `${outputLabel}_base`;
|
|
475
|
+
const blurInput = `${outputLabel}_blur_input`;
|
|
476
|
+
const blurred = `${outputLabel}_blurred`;
|
|
477
|
+
const blendMode = effect.blendMode === "soft-light" ? "softlight" : "screen";
|
|
478
|
+
graph.push(`[${currentLabel}]split=2[${base}][${blurInput}]`);
|
|
479
|
+
graph.push(`[${blurInput}]gblur=sigma=${decimal(effect.radiusPx)}:steps=2[${blurred}]`);
|
|
480
|
+
graph.push(
|
|
481
|
+
`[${base}][${blurred}]blend=all_mode=${blendMode}:all_opacity=${decimal(effect.amount)}[${outputLabel}]`,
|
|
482
|
+
);
|
|
483
|
+
addRequired(required, ["split", "gblur", "blend"]);
|
|
484
|
+
return outputLabel;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
function grainTreatment(
|
|
488
|
+
effect: Extract<VideoEffect, { readonly kind: "film-grain" }>,
|
|
489
|
+
): string {
|
|
490
|
+
const lumaStrength = Math.max(1, Math.round(effect.amount * 64));
|
|
491
|
+
const chromaStrength = Math.round(lumaStrength * effect.chroma);
|
|
492
|
+
const flags = effect.cadence === "frame-varying" ? "t+u" : "u";
|
|
493
|
+
const seed1 = effect.seed === 2_147_483_647 ? 0 : effect.seed + 1;
|
|
494
|
+
const seed2 = seed1 === 2_147_483_647 ? 0 : seed1 + 1;
|
|
495
|
+
return [
|
|
496
|
+
"format=yuv444p",
|
|
497
|
+
[
|
|
498
|
+
`noise=c0s=${lumaStrength}`,
|
|
499
|
+
`c1s=${chromaStrength}`,
|
|
500
|
+
`c2s=${chromaStrength}`,
|
|
501
|
+
`c0_seed=${effect.seed}`,
|
|
502
|
+
`c1_seed=${seed1}`,
|
|
503
|
+
`c2_seed=${seed2}`,
|
|
504
|
+
`c0f=${flags}`,
|
|
505
|
+
`c1f=${flags}`,
|
|
506
|
+
`c2f=${flags}`,
|
|
507
|
+
].join(":"),
|
|
508
|
+
].join(",");
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
function appendPaletteDither(
|
|
512
|
+
graph: string[],
|
|
513
|
+
required: Set<string>,
|
|
514
|
+
currentLabel: string,
|
|
515
|
+
outputLabel: string,
|
|
516
|
+
colors: number,
|
|
517
|
+
amount: number,
|
|
518
|
+
paletteUse: string,
|
|
519
|
+
): string {
|
|
520
|
+
const base = `${outputLabel}_base`;
|
|
521
|
+
const pixels = `${outputLabel}_pixels`;
|
|
522
|
+
const paletteInput = `${outputLabel}_palette_input`;
|
|
523
|
+
const palette = `${outputLabel}_palette`;
|
|
524
|
+
const dithered = `${outputLabel}_dithered`;
|
|
525
|
+
graph.push(
|
|
526
|
+
`[${currentLabel}]split=3[${base}][${pixels}][${paletteInput}]`,
|
|
527
|
+
);
|
|
528
|
+
graph.push(
|
|
529
|
+
`[${paletteInput}]palettegen=max_colors=${colors}:reserve_transparent=0:stats_mode=full[${palette}]`,
|
|
530
|
+
);
|
|
531
|
+
graph.push(`[${pixels}][${palette}]${paletteUse}[${dithered}]`);
|
|
532
|
+
graph.push(
|
|
533
|
+
`[${base}][${dithered}]blend=all_mode=normal:all_opacity=${decimal(amount)}[${outputLabel}]`,
|
|
534
|
+
);
|
|
535
|
+
addRequired(required, ["split", "palettegen", "paletteuse", "blend"]);
|
|
536
|
+
return outputLabel;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
function compileEffect(
|
|
540
|
+
graph: string[],
|
|
541
|
+
required: Set<string>,
|
|
542
|
+
currentLabel: string,
|
|
543
|
+
effect: VideoEffect,
|
|
544
|
+
index: number,
|
|
545
|
+
): string {
|
|
546
|
+
if (effect.amount === 0) return currentLabel;
|
|
547
|
+
const outputLabel = effectOutputLabel(index);
|
|
548
|
+
if (effect.kind === "color-grade") {
|
|
549
|
+
const treatment = colorGradeTreatment(effect);
|
|
550
|
+
return appendMixedTreatment(
|
|
551
|
+
graph,
|
|
552
|
+
required,
|
|
553
|
+
currentLabel,
|
|
554
|
+
outputLabel,
|
|
555
|
+
treatment.filter,
|
|
556
|
+
treatment.names,
|
|
557
|
+
effect.amount,
|
|
558
|
+
);
|
|
559
|
+
}
|
|
560
|
+
if (effect.kind === "duotone") {
|
|
561
|
+
return appendMixedTreatment(
|
|
562
|
+
graph,
|
|
563
|
+
required,
|
|
564
|
+
currentLabel,
|
|
565
|
+
outputLabel,
|
|
566
|
+
duotoneTreatment(effect),
|
|
567
|
+
["hue", "curves"],
|
|
568
|
+
effect.amount,
|
|
569
|
+
);
|
|
570
|
+
}
|
|
571
|
+
if (effect.kind === "diffusion") {
|
|
572
|
+
return appendDiffusion(graph, required, currentLabel, outputLabel, effect);
|
|
573
|
+
}
|
|
574
|
+
if (effect.kind === "film-grain") {
|
|
575
|
+
graph.push(`[${currentLabel}]${grainTreatment(effect)}[${outputLabel}]`);
|
|
576
|
+
addRequired(required, ["format", "noise"]);
|
|
577
|
+
return outputLabel;
|
|
578
|
+
}
|
|
579
|
+
if (effect.kind === "vignette") {
|
|
580
|
+
const angle = effect.amount * Math.PI * 0.35;
|
|
581
|
+
graph.push(
|
|
582
|
+
`[${currentLabel}]vignette=angle=${decimal(angle)}:x0=w*${decimal(effect.center.xUnit)}:y0=h*${decimal(effect.center.yUnit)}:dither=0[${outputLabel}]`,
|
|
583
|
+
);
|
|
584
|
+
required.add("vignette");
|
|
585
|
+
return outputLabel;
|
|
586
|
+
}
|
|
587
|
+
if (effect.kind === "scanlines") {
|
|
588
|
+
graph.push(
|
|
589
|
+
`[${currentLabel}]drawgrid=w=iw:h=${effect.spacingPx}:t=${effect.thicknessPx}:c=black@${decimal(effect.amount)}[${outputLabel}]`,
|
|
590
|
+
);
|
|
591
|
+
required.add("drawgrid");
|
|
592
|
+
return outputLabel;
|
|
593
|
+
}
|
|
594
|
+
if (effect.kind === "ordered-dither") {
|
|
595
|
+
return appendPaletteDither(
|
|
596
|
+
graph,
|
|
597
|
+
required,
|
|
598
|
+
currentLabel,
|
|
599
|
+
outputLabel,
|
|
600
|
+
effect.colors,
|
|
601
|
+
effect.amount,
|
|
602
|
+
`paletteuse=dither=bayer:bayer_scale=${effect.bayerScale}`,
|
|
603
|
+
);
|
|
604
|
+
}
|
|
605
|
+
if (effect.kind === "error-diffusion-dither") {
|
|
606
|
+
const algorithm = effect.algorithm === "floyd-steinberg"
|
|
607
|
+
? "floyd_steinberg"
|
|
608
|
+
: "atkinson";
|
|
609
|
+
return appendPaletteDither(
|
|
610
|
+
graph,
|
|
611
|
+
required,
|
|
612
|
+
currentLabel,
|
|
613
|
+
outputLabel,
|
|
614
|
+
effect.colors,
|
|
615
|
+
effect.amount,
|
|
616
|
+
`paletteuse=dither=${algorithm}`,
|
|
617
|
+
);
|
|
618
|
+
}
|
|
619
|
+
effect satisfies never;
|
|
620
|
+
throw new Error("Unreachable video effect.");
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Compile a validated display-referred look into a numeric-only filter graph.
|
|
625
|
+
* Input labels, filter names, and expressions are all owned by Slopcamera.
|
|
626
|
+
*/
|
|
627
|
+
export function compileVideoLookToFfmpeg(
|
|
628
|
+
lookInput: unknown,
|
|
629
|
+
options: VideoLookFfmpegCompileOptions = {},
|
|
630
|
+
): CompiledVideoLook {
|
|
631
|
+
const look = VideoLookV1Schema.parse(lookInput);
|
|
632
|
+
const videoStreamIndex = options.videoStreamIndex ?? 0;
|
|
633
|
+
if (
|
|
634
|
+
!Number.isSafeInteger(videoStreamIndex)
|
|
635
|
+
|| videoStreamIndex < 0
|
|
636
|
+
|| videoStreamIndex > MAXIMUM_VIDEO_STREAM_INDEX
|
|
637
|
+
) {
|
|
638
|
+
throw new RangeError(
|
|
639
|
+
`videoStreamIndex must be a safe integer from 0 through ${MAXIMUM_VIDEO_STREAM_INDEX}.`,
|
|
640
|
+
);
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
const inputLabel = `0:v:${videoStreamIndex}`;
|
|
644
|
+
const graph: string[] = [];
|
|
645
|
+
const required = new Set<string>();
|
|
646
|
+
let currentLabel = inputLabel;
|
|
647
|
+
for (const [index, effect] of look.effects.entries()) {
|
|
648
|
+
currentLabel = compileEffect(graph, required, currentLabel, effect, index);
|
|
649
|
+
}
|
|
650
|
+
return {
|
|
651
|
+
compiler: "slopcamera.ffmpeg-video-look",
|
|
652
|
+
compilerVersion: COMPILER_VERSION,
|
|
653
|
+
filterGraph: graph.join(";"),
|
|
654
|
+
inputLabel,
|
|
655
|
+
look,
|
|
656
|
+
lookHash: canonicalJsonSha256(look),
|
|
657
|
+
outputLabel: currentLabel,
|
|
658
|
+
requiredFilters: [...required],
|
|
659
|
+
};
|
|
660
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|