Compare commits

...
Author SHA1 Message Date
shinyobjectz f68805b981 Videoform: its rules in a taste line's shape, and where to start
Controllers are gone (projects.feature PJ9, #209), so a videoform's mined rules go in its own `rules`, each in a taste
line's shape (words, a check, its values, a level), and `raea check PROJECT` holds a piece to the rules of the
fingerprint that judges it (VF8, a 15-line hook in apps/direction check.rs). docs/videoform.feature gains a short
"Start here": the order (VF1, VF2, VF3, then VF4 with VF12 as the gate before VF1b and VF9-VF11), the new crates, the
three hooks into what exists and the bench. docs/fingerprint.md records decision 6: Pro and Studio's monthly pool of
clef checks and content intelligence.
2026-11-20 14:09:40 -08:00
shane db53845b01 Merge pull request #207 from wackyza/styles-plan
Videoform: the plan and its tasks (VF1-VF13)
2026-11-20 12:38:35 -05:00
shane 3ffe34bb7d Merge pull request #205 from wackyza/check-fewer-rounds
raea check: fewer rounds, shorter checks, and raea's own mix and master
2026-11-20 12:38:08 -05:00
Zachary GuglinandClaude Opus 5.5 0706baee4e Videoform: the plan and its tasks (VF1-VF13)
A videoform is the kind of video a person makes again and again, read once from five to ten of their finished videos
(from the drive, or streamed from a URL with nothing downloaded) into embeddings and measures, then followed and checked
on every cut without going back to the references. It's a kind of fingerprint, and flows into what raea has: its
ranges into its profile (FP6e), its rules into a controller's rule fields (DR4, DR8), its structure into a script
template, its references into brief.ts's shape. What ships runs on raea's own models; the domain vocabulary is written
by the person's own AI. docs/videoform.md is the plan (what's built on, what a videoform keeps, the resolver, when it
doesn't hold together, judging, the build order); docs/videoform.feature its rask tasks, with their plans.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-19 19:09:46 -08:00
shane 1b7450fb4b Merge pull request #206 from shinyobjectz/win-sizes-export-game
Windows: sizes without du, export-game says it makes Mac games; TokenSynth's line in 0.1.8's notes
2026-11-19 21:34:26 -05:00
shinyobjectz 84acab1f50 whats-new 0.1.8: TokenSynth ran end to end on Windows
rc12 on a Windows runner with nothing on the PATH but raea and Windows: raea setup-audio tokensynth in 113 s, then C2 and C3 of "warm analog bass" in about 75 s each on the CPU, both in tune (64.8 Hz and 130.5 Hz), and again from the asset store at once. The Known line now says only that it runs on the CPU there.
2026-11-19 17:52:04 -08:00
shinyobjectz 25280d1eba Windows: sizes without du, and export-game says it makes Mac games
raea setup-audio (and raea motion's model folders) said "(?)" for every size on Windows: raea_io_home::disk_use ran du, which Windows has no copy of. Without du it now adds up the files' sizes (through links when asked, 64 folders deep at most) and writes them in du -h's units. a_folder_is_sized_without_du; run on a Windows 11 PC with no du, and on macOS.

raea export-game on Windows or Linux said "no player at ...\\raea-game (build it: cargo build --profile game ...)": its targets are a Mac's (signed with codesign) and those releases carry no player, so the advice led nowhere. Off a Mac it now says it makes Mac games and that Windows and Linux games aren't there yet.
2026-11-19 17:52:03 -08:00
Zachary GuglinandClaude Opus 5.5 6350c5deb0 raea-runtime-export keeps under its crate limit with LX6 and LT1's plan: the exposure filter's comment trimmed
rask's size gate counts a crate's planned tasks: the 2D fill filter left raea-runtime-export at 2001 lines with them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-19 17:00:57 -08:00
Zachary GuglinandClaude Opus 5.5 b6dad1b8aa raea check reads the picture once for flashing, freezes, flash frames and blotching: the same findings in half the time
Four of raea check's rules each decoded the whole export, one after another: 3.7 s apiece on the 11-14 walkaround,
38 s of FFmpeg on a 56 s master export. Run at the same time they took 15.8 s, the same as in turn: decoding is the
machine's whole CPU, so only decoding less saves anything. One FFmpeg now decodes it once and splits the frames into
the four filter chains the rules were tuned on, each to its own output with its own options as when it ran alone
(raea-app-check-read once.rs): the flashing screen's frames to stdout with their showinfo times on stderr,
freezedetect's lines on stderr, the 32x18 grey and blotching's 2 s crops to named pipes. Each rule is split into its
read and its judgement, and the judgements run on what the one read gave, in the order they ran before.

tests/parity.rs holds the one read to the four alone on a clip FFmpeg makes: the same flashing frames and times, the
same brightness, the same crops and the same freeze. On both Telluride projects' exports the check's findings and passes
are identical to before (its JSON byte for byte), and it takes 7-8 s where it took 13-20, and 20-29 s where blotching's
comparison render also runs (37-59 before). Without named pipes (Windows with FFmpeg) the rules read alone as before,
and without FFmpeg raea's own readers do.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-19 16:41:53 -08:00
Zachary GuglinandClaude Opus 5.5 4c3a3ba799 raea mixes and masters every render's sound: dialogue at one level, a leveller before the limiter, room tone at the joins
The person's rule, 11-19: raea does its own mix on everything, then masters it. Until now a render was
mastered only with a <Mix>, and then by a gain and a limiter alone; levels were the agent's to set. The 11-14 walkaround's
lines ran from -13.8 to -26.9 LUFS, so the agent measured each with ffmpeg and set its gainDb, the limiter still took
up to 8 dB off phone speech's peaks, and the joins between lines fell to dead silence (a dropout, the check said). It
then built and mastered the voice outside raea.

- The mix (raea-sys-mix-level, level.rs): each line of dialogue, a clip on the voice bus or footage's sound on no bus,
  is measured over the span of its take it plays (BS.1770, gated) and brought to -23 LUFS, by at most 12 dB. Room tone
  and silent takes (under -45) keep their level; so do music, effects and every other bus, which sit under dialogue as
  their buses set them. gainDb is an offset on top. Live play and the render level the same span the same way (the
  clip's span comes from the SDK's data-clip-from and data-clip-to).
- The master: a leveller in the limiter (from 9 dB under the ceiling, 3:1 on the mix's RMS, 10 ms in, 150 ms out)
  rounds the loud passages so the limiter catches only what's left, in live play, the render and seedling's limiter
  alike; the gain is made up for what it took. Without a <Mix>, every render masters to -14 LUFS at -1 dBTP.
- The joins (joins.rs): a gap the mix drops into dead silence and comes straight back from gets the room's own tone, the
  quietest stretch of sound near it, looped and faded, found at the level the master plays it. A pause that fades is
  the edit's and stays. The render fills them; live play hears the gap.

The walkaround's v1 sound, each line straight from its take: before, its lines spread 6.7 LU and it had a dropout (and
the mono fold's false clipping); now 2.1 LU, no dropout, -14.5 LUFS, -1.6 dBTP, with nothing set by hand. The Kia cut,
whose voice was mastered outside raea, comes out at -14.1 LUFS, -1.2 dBTP. MASTER_VERSION 4. The guides stop telling
agents to level lines or add a <Mix> to be mastered.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-19 16:41:53 -08:00
Zachary GuglinandClaude Opus 5.5 6d076868f0 raea check measures clipping on each channel: the mono fold read a clean master as clipped
The clipping rule read the sound folded to mono, which ffmpeg's -ac 1 (and raea's fold, after it) make at
(L + R) * 0.707: a centred voice comes out 3 dB hotter than either side. The 11-14 walkaround's v1 and v2 masters peak at
-1.5 and -1.6 dBTP, no channel near full scale, yet their folds passed 1.0 and the check found 9 to 36 flat-topped runs
over full scale. The agent spent two renders on it and then mastered the voice outside raea; raea check on those same
files, each channel at its own level, finds no clipping. Clipping is a channel's: each is now read as it is (read::channels,
FFmpeg's -ac 2 or raea's own decoders), and a second is the most runs any channel had. A clipped channel is still found,
one that the fold would have hidden among the other too. The dropout and dead-stop rules keep reading the fold.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-19 16:41:53 -08:00
Zachary GuglinandClaude Opus 5.5 119f458018 raea render holds a video's text to the check's rules as it ends, and keeps a 2D frame's fill out of the lighting advice
A round sooner: what the render's manifest already knows is said by the render, not left for the check after it (the
11-14 walkaround's price figures in the UI zone waited a render and a check). Text off the frame is an error, as the
check has it. Text in a UI zone is a warn by the default zones, since the platform's are the check's to decide; reading
time waits for the check, which has the transcript. Video renders only: a stills render samples too few frames to time
a text. raea check's issue-to-finding conversion is now Issue::finding, which both use.

Exposure's lighting advice ("a fill, an ambient or the sky's light reaches them nowhere") is a 3D scene's. A frame with
no 3D in the render and no footage on it is the page's own fill, dark or bright by design (the walkaround's brand-dark
logo card warned on every stills render), so it's measured and kept in the manifest, not said. A frame with footage
keeps its warning: a clip that drew black still shows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-19 16:41:53 -08:00
Zachary GuglinandClaude Opus 5.5 1899d29dff raea check says who can fix what it finds, so a round goes only to what another render can change
Two Telluride walkaround projects (11-14, 11-16) took nine renders; five chased findings no render could move. The
checks measured right every time; what they didn't say was whose each finding was. Nothing a rule measures, and no
line it draws, changes here: what changes is how a finding is told.

- The picture's own or the encode's (raea-app-check-cause). A rule an encode can cause is measured again on the
  composition drawn at the same frames without encoding (raea render --at, out of the record). Blotching is the first:
  the walkaround's phone footage scored blotchy in 9 of 28 samples before any encoding, so every export failed and no
  setting cleared it. Now the picture's own is a note, and what the encode added is the error with a fix raea has:
  --quality high added to 14 of 28 samples (x264 crf 12 moved the score at most 0.005; master added none), so the
  check says render with --quality master, and the master export then passes with the note.
- Carried. A finding an earlier export of the same composition had at the same moment ends "[also in …]": what changed
  between them didn't move it. Its rank stays as measured.
- A source isn't a delivery: a take under assets/ or media/ checked on its own reports its loudness as a note.

The text rules (clipped, UI zones, reading time, face, cues, brand kit) move to raea-app-check-text, so raea render can
hold its own text to them, and raea-app-check stays under its size limit. Probe gives the video's frame rate.
The rendering guide tells agents to fix every error in one pass, not to repeat a change that didn't move a carried
finding, and that a note is for the person.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-19 16:41:53 -08:00
shane a9ecc06820 Merge pull request #204 from shinyobjectz/win-noavx
Windows: raea.exe starts on a CPU without AVX; 0.1.8's notes for rc10-rc12
2026-11-19 19:19:25 -05:00
shinyobjectz 191314a69a whats-new 0.1.8: #169's workspaces, #112/#124, raea show, Intl, master's darks, no-AVX; Linux's requirements
The Windows fixes since the notes were written (rc10-rc12), in the notes' words, and what Linux needs: a processor
with AVX (the static ONNX Runtime's initializers use it) and glibc 2.39, in the notes' Known and the install page.
Dated the 19th.
2026-11-19 15:27:53 -08:00
shinyobjectz 865e608857 Windows: raea.exe starts on a CPU without AVX (Goldmont, Nehalem)
rc11's raea.exe stopped before main on a processor without AVX (Intel's SDE as a Goldmont Celeron and as a Nehalem:
"Executed instruction not valid", vmovaps ymm at raea.exe+0x123b5d40). The instruction is in one of seven C++
dynamic initializers in the CRT's table: ctt-etcpak's ETC1 tables (Tables.cpp's g_table_SIMD and the rest, set with
_mm_setr_epi16, which MSVC initializes at run time), from the copy ctt builds with /arch:AVX2. ctt picks an ISA's
copy at run time for its encoders, but every copy's static initializers run at start, on every CPU. With those seven
skipped (a patched rc11), raea.exe --version runs under SDE as both chips.

ctt comes only from Bevy's compressed_image_saver feature (bevy_image's CompressedImageSaver, BC7/ASTC/ETC2 for
Bevy's asset processing), which raea never runs. It's out of the plugin catalog's Bevy features (0.19 and 0.20),
engine/bevy-plugins' generated `bevy` feature (tools/bevy-plugins.sh sync agrees) and engine/render's bevy-all, so
ctt's eight crates, fast_image_resize, ispc-build-utils and zstd leave the lock; NOTICE and LICENSES are
tools/licenses.sh's on main with the change. compressed_image_saver_universal (basis-universal) stays.
2026-11-19 15:27:47 -08:00
shane 56cf86c5c8 Merge pull request #203 from shinyobjectz/windows-169-rc12
Windows: #169's last bugs, and what the agent shell got wrong there
2026-11-19 18:03:10 -05:00
shinyobjectz ee1f3bc32e JavaScriptCore modules get their import.meta.url on macOS 15 too
macOS 15's JavaScriptCore leaves import.meta.url undefined for a module from raea's Objective-C loader (macOS 27's
sets it), so new URL("./x.png", import.meta.url) threw there. jsengine's tests::jsc, run in CI for the first time by
#169's step, found it on the macos-15 runner. A module that reads import.meta gets `import.meta.url ??= "URL";` on
line 1, before its own first line, so every other line keeps its number and an engine's own URL is left alone.
2026-11-19 14:44:39 -08:00
shinyobjectz 040153449c CI runs what a Windows or Linux user meets: Intl on QuickJS, openh264 at master, git, the Node core (#169)
The matrix's unit tests left out raea-runtime-jsengine, raea-io-soft and raea-io-assets, and tests/node.rs and
io-soft's tests/quality.rs need features (modules, h264), so none of #169's fixes ran in CI.
2026-11-19 14:30:32 -08:00
shinyobjectz b60d901473 Git on a PC without it: found or fetched once, as the app's host does (#169)
raea workspace, project and controller failed with "git: program not found" on a PC whose only Git was the app's.
raea_io_assets::git(): $RAEA_GIT, the PATH's, then on Windows the app's (InstallLocation\git), Git for Windows off the
PATH, and raea's own in the tools cache, fetched once (dugite-native, the build the app's host uses, sha256 checked).
Elsewhere it says how to install git. The default root is joined a folder at a time. NOTICE names the fetch, and
FormatJS and CLDR for the Intl commit before this.
2026-11-19 14:30:31 -08:00
shinyobjectz 457121f804 raea show, brand and cut on Windows and Linux (#169)
raea show asked kill whether the app ran, looked only in /Applications and said it opened files in "the Mac's own
viewer". app.ts asks each system its own way through one Here a test can fake: tasklist and the installer's
InstallLocation (#178) on Windows, Explorer to open files and start the app, raea.desktop and xdg-open on Linux, and one
PowerShell listing to name the harness that ran it. The shell's absolute-path tests take C:\, \\server\share and \
(show.ts absolute/fromCwd). raea brand reads a logo's size from its own header (PNG, GIF, JPEG, WebP, ICO), sips only as
a Mac's fallback, and cutting by words off a Mac says what works there. conformance/app.test.ts fakes each system.
2026-11-19 14:30:17 -08:00
shinyobjectz 3f9d5eda2d The agent shell's Node core speaks Windows: platform, arch, ppid, paths, file URLs (#169)
process.platform was Rust's word ("windows", "macos"), so every === "win32" and === "darwin" in the shell was false, on
a Mac too; os.platform() said "darwin" and the arch "arm64" everywhere; there was no process.ppid. path was POSIX only:
resolve(".") named "/C:\Users\...", isAbsolute("C:\x") was false and dirname/basename ignored \. On Windows path
parses drives, shares and \ now and writes /, path.win32 parses them anywhere, and fileURLToPath, pathToFileURL,
createRequire, tmpdir, execSync (cmd) and the module URL (file:///C:/...) follow. tests/node.rs checks each against
Node 22's answer. The arch and parent-pid helpers live in node/os.rs (node.rs was over the size limit).
2026-11-19 14:30:17 -08:00
shinyobjectz 3a08d33f37 openh264 keeps every block of a slowly changing dark ground at --quality master (#169)
Its background detection took a dim glow drifting over black for still and copied old blocks forward: 6-8% of dark
blocks stepped in every sampled frame, at any bitrate or quantiser. Off, 0.1%, as a lossless encode of the same frames.
a_dark_glow_drifting_keeps_every_block_at_master asks under 3% (5.3% before, 1.6% now).
2026-11-19 14:30:17 -08:00
shinyobjectz 917bc94f59 Intl on QuickJS: a composition that formats a number works on Windows and Linux (#169)
QuickJS has no Intl, so toLocaleString or Intl.NumberFormat threw "Intl is not defined" off a Mac. FormatJS's polyfills
(MIT) and the CLDR data they carry (Unicode-3.0) are packed in runtime/jsengine/js/intl.pack (2.2 MB, deflate; js/intl
build.ts, versions pinned), and js/intl/loader.js runs the core the first time anything reads Intl or calls a toLocale*
method, and a locale's data the first time something asks for it, so a script that never formats pays nothing. A small
Collator (letters, then accents, then case) backs localeCompare. quickjs_formats_as_javascriptcore_does: fourteen cases
give JavaScriptCore's answers, and on a Mac it asks JavaScriptCore too. Apple builds are unchanged.
2026-11-19 14:30:17 -08:00
shane 69fb3d8f87 Merge pull request #202 from shinyobjectz/win-export-xml
Windows: export xml's paths open in Resolve (#195); DX12 with DXC renders 3D again (#196)
2026-11-19 15:37:33 -05:00
shane a669144986 Merge pull request #201 from shinyobjectz/whats-new-weather
whats-new 0.1.8: raea/wear's weather during a shot (WR9)
2026-11-19 14:46:12 -05:00
shinyobjectz b39dd4e7de release.yml windows-verify: the bundle's list beside release-check.sh, where it reads it
windows-verify checks the zip on a runner with only release-check.sh and lavapipe.sh checked out, and runs
release-check.sh from RUNNER_TEMP; since the Windows bundle it reads release/win-bundle.files beside itself, which
wasn't there, so the step would have stopped on it once rc9's pack step stopped failing. It's checked out and copied
there now.
2026-11-19 11:39:35 -08:00
shinyobjectz f46529b461 Release: the Windows bundle's list read without its \r (rc9's Windows pack failed on it)
GitHub's Windows runner checks text files out with CRLF, as the Models step already allows for (tr -d '\r' <
models.tsv), so release.sh looked for "vcruntime140.dll\r" in target/dist, beside the vcruntime140.dll win-bundle.sh
had just put there, and stopped. release.sh and release-check.sh, the list's two readers, now strip it.
2026-11-19 11:37:55 -08:00
shinyobjectz c3e7206581 DX12 with DXC: hanabi's utils shader named so DXC can read it; an export refuses a codec before rendering (#196)
wgpu hands DXC a shader module's label as its source's file name, and on Windows LLVM reads "hanabi:shader:utils"
as a root and a file, so DXC said "error reading 'hanabi:shader:utils'" and every Bevy app failed: on a PC where
dxcompiler.dll is on the PATH (wgpu loads it when it can, else FXC), rc8 rendered no 3D at all on DX12 (exit 101 on
an RTX 4070 with WGPU_BACKEND=dx12 and DXC 1.9.2609; the same render passed with FXC). raea export xml's passes were
where the reporter saw it, on a PC whose Intel iGPU puts raea on DX12. Bevy names its modules nothing; hanabi's
utils module and its contract tests' were the only labels with a colon, now underscores.

And an export refuses an alpha codec this machine can't write (ProRes or HEVC off a Mac) when it starts, not after the
reference render: Codec::chosen, which layers, capcut and render_movie share.
2026-11-19 11:37:55 -08:00
shinyobjectz 96c450fb75 export xml: a Windows path is a file URL an editor opens (#195)
0.1.8-rc8 percent-encoded a Windows path whole into <pathurl>: file://localhostD%3A%5CWork%5C... for D:\Work\...,
which DaVinci Resolve refused. The same XML imported at once with file:///D:/Work/... (the reporter's test). A drive's
path is now that, a share's file://nas/clips/..., separators as slashes and the \\?\ prefix off; a Mac's and
Linux's are as before. cargo test -p raea-app-layers passes, with a test of each kind of path.
2026-11-19 11:37:55 -08:00
shinyobjectz 85f4b98616 whats-new 0.1.8: raea/wear's weather during a shot (WR9)
The page named the bake and the shader but not the eight conditions or weatherAt, which change the weather as a
shot runs (rain soaking a front over minutes and drying over the hour after, snow settling, frost forming).
2026-11-19 10:59:41 -08:00
shane fcdcf1c883 Merge pull request #200 from shinyobjectz/wear-crumble
raea/wear: crumbling (WR6), weather during a shot (WR9), the corner house demo (WR7); wear on the public hook (EX9)
2026-11-19 13:55:36 -05:00
shane 3f99e479cd Merge pull request #199 from shinyobjectz/win-bundle
Windows: everything raea needs ships in bin\, under licences we can meet
2026-11-19 13:46:12 -05:00
shinyobjectz bb8b497b58 docs/wear.feature WR8: what the wear shader costs, measured before building the detail layers
At 4K on the M5 Pro the corner house renders 17.2 ms a frame plain and 17.2 worn (17.6 and 17.7 again), so the
recipes' per-pixel noise costs nothing a render can see; the bake's four maps hold 36 MB on the GPU, which BC7 would
take to about 9 MB once the class code has a map of its own. WR8 stays open: the detail layers, mips on arrays (with
them) and BC/KTX2 maps with a fallback where BC isn't.
2026-11-19 10:14:49 -08:00
shinyobjectz c37509d17f Debris thinned by raea-sys-touch's rule, a crack's bounds by parry's Aabb (two near copies folded)
raea-sys-damage kept its debris in seed order with none nearer than a gap, as touch's thin() does for spots, and
found a crack path's bounds with a fold pick.rs also has. touch's rule is now thin_by (any candidate with a place),
which thin_if and damage's debris both use, and the bounds are Aabb::from_points. The same spots come out:
cargo test -p raea-sys-touch -p raea-sys-damage -p raea-sys-weathering pass. Near-duplicate groups back to 58, so
tools/dupes.max goes down to it.
2026-11-19 10:14:49 -08:00
shinyobjectz 913931ad9a Windows: bin\ carries what raea needs, so a PC with nothing installed and no downloads works
tools/release/win-bundle.sh puts beside raea.exe, each with its licence: Microsoft's Visual C++ runtime
(vcruntime140, vcruntime140_1, msvcp140, msvcp140_1) from the runner's Visual Studio, app-local as Microsoft
documents; raea's LGPL FFmpeg 9.0.2 (tools-ffmpeg-9.0.2-lgpl, libvpx's licence and patent grant beside it); and
uv. Before, raea.exe didn't start without the VC++ Redistributable installed, and a PC that blocks GitHub's downloads
couldn't read a phone's video or set up a local model. Its pins are setup.rs's, so what ships and what raea fetches
where it isn't are the same build: setup.rs now fetches our LGPL zip (sha256 d3a3d8cd...) in place of GyanD's GPL
essentials. release.yml runs it, and release-check.sh refuses a Windows zip whose bin\ lacks a file
win-bundle.files lists, whose FFmpeg isn't the LGPL build, or that has no libvpx-vp9 or h264_mf. NOTICE, the README
and 0.1.8's what's new say so.

Checked on the Windows box with the published zip: LGPL, the libvpx VP8/VP9 decoders and h264_mf listed; a 2 s
H.264 clip with AAC cut by h264_mf at notes check's arguments; an alpha VP9 WebM decoded with its alpha (253,0,0,127);
the filters raea runs (ebur128, freezedetect, signalstats, scale, concat, showwavespic, ...) present.
2026-11-19 10:05:03 -08:00
shinyobjectz 02051ee992 One smoothstep for the systems: raea_core_ease::smoothstep (raea-sys-damage's copied raea-sys-foliage's)
Neither crate can depend on the other (systems don't reach sideways), so the cubic Hermite ease goes down to
raea-core-ease, the curves crate, and both use it; foliage keeps its name for it (smooth). Behaviour unchanged:
cargo test -p raea-core-ease -p raea-sys-damage -p raea-sys-foliage pass.
2026-11-19 09:58:24 -08:00
shinyobjectz adec0aef74 docs/wear.feature: WR6, WR7 and WR9 as built, done
Their crates, files, lines and proof: raea-sys-damage and raea/wear's crumbling (WR6), the corner house demo with
worn paint and EX9's deletion (WR7), and weather during a shot with the eight conditions named (WR9). WR8, detail
textures from mask stacks and what they cost, is what's left of raea/wear.
2026-11-19 09:55:02 -08:00
shinyobjectz 84b7659b09 Worn paint is a surface shader of raea's own; raea-sys-wear goes (docs/examples.feature EX9)
MeshStandardMaterial's wear and raea/pbr's <WearExtension> drew with the engine's own MaterialExtension
(systems/wear). They now write the same shader on the public surface hook (sdk/render/src/worn.ts, WORN_WESL: the
same noise, curvature edges, grime, rust and chips, in the mesh's own space), so wear is an author's shader like any
other and raea/wear's weather and the paint wear share one path. A parity scene (sharp, turned and round parts, every
setting) renders the same as before, RMSE 3.8e-5 of full scale. One change: clay draws custom surface shaders as they
are, so worn paint now shows in a clay render, as a ShaderExtension's does.

Deleted: systems/wear, its WearPlugin, its spawn branch, its mesh-row columns, its layer entries, and its type in
the registry snapshot, bevy.gen.tsx and sdk-coverage (reached 1557 -> 1556: the type is gone; wear is still
authored). wear with shader or grid on one material is refused (it was silently dropped). WearExtension keeps its
props, so the guides are unchanged; it carries no @bevy tag of its own now, since its Bevy type is ShaderExtension's.
2026-11-19 09:53:04 -08:00
shinyobjectz e8e3500466 Clip cuts pick the H.264 encoder this machine's ffmpeg has (raea_io_ffmpeg::h264)
raea notes check's sign-off clip and a postmortem's clip were cut with libx264, which only a GPL ffmpeg has:
Homebrew's and Linux distributions' do, and GyanD's Windows build did, but the LGPL build raea now ships on
Windows doesn't. h264() asks ffmpeg -encoders once and takes libx264, else Windows' own Media Foundation encoder
(h264_mf, in raea's LGPL build), else VideoToolbox's, at 8 Mb/s for the system ones; None without one (notes check
says so; a postmortem plays the whole piece, as it did when a cut failed).
2026-11-19 09:51:02 -08:00
shinyobjectz abc6828def Git for Windows' complete source, published beside raea's releases (tools/release/git-sources.sh)
The Windows app ships dugite-native's Git for Windows (GPLv2) so a workspace is made on a PC without Git. GPLv2
section 3 asks whoever distributes it to make its complete corresponding source available, and dugite-native's
repository alone isn't that: Git for Windows' MSYS2 runtime, bash, curl, OpenSSH and the rest are built from their
own source packages. git-sources.sh resolves each package the build's etc/package-versions.txt names to the source
package it came from (51: Git for Windows' pacman repository first, MSYS2's source mirror for the rest) and packs
them with the list; tools-git-sources.yml publishes that once as the prerelease tools-git-<tag>-sources, which the
app's git\SOURCE.txt names.
2026-11-19 09:49:58 -08:00
shinyobjectz d184deb4d1 FFmpeg for Windows, LGPL, built from FFmpeg's own release (tools/release/ffmpeg-win.sh)
raea ships FFmpeg beside raea.exe on Windows so a PC that can't download it still reads a phone's video. GyanD's
essentials build, which raea fetched until now, is GPLv3 with a dozen GPL libraries linked in; shipping it would
mean shipping all their sources. This build is FFmpeg's own code, zlib and libvpx's decoders (BSD, for alpha
WebM, #113), static, LGPL 2.1 or later, with no capture devices and no network; its H.264 encoder is Windows' own
through Media Foundation (h264_mf), since FFmpeg has none of its own and libx264 is GPL. Its complete source is
FFmpeg's signed tarball, libvpx's tarball and this script. tools-ffmpeg.yml builds it with mingw-w64 (apt reading
Ubuntu's archive, as the runner's own mirror trickled) and publishes it once as a prerelease with that source.
2026-11-19 09:49:58 -08:00
shinyobjectz 80ffc0f8e3 wear WR7: the corner house demo (examples/materials/wear)
A Berlin corner block made in code (house.ts): a sandstone plinth, a rusticated ground floor, plastered storeys,
sills, a string course, a cornice on consoles under a hipped slate roof, a door in a sandstone surround up granite
steps, an iron balcony, a zinc gutter and downpipe, an enamel street plate on each face of the corner, a cellar
hatch, a brick firewall, the walk and the road. Its openings go through the walls with the glass 15 cm in, so
cracks start at their corners; one glTF material per wear class. make-house.ts writes media/house.glb.

wear.tsx bakes it once and draws it new, after 80 years of a coal-burning city, as a ruin (with the debris its
age leaves lying, in lumps), at its door and its foot up close; each of the 16 causes in false colour; each of
WR9's eight conditions by day and at dusk; and a shower crossing it as a timelapse (weatherAt). Rendered on the
Mac, 0 errors on every still. Its tests (6) check the house's parts, the openings, the .glb and that the demo
lists every cause and condition.
2026-11-19 09:37:02 -08:00
shinyobjectz 80cc01f11d wear WR6: crumbling, from the same causes (raea-sys-damage, raea/wear); WR9's weather during a shot
Where a building breaks, by rules over the weathering bake's texels, in a crate of its own (raea-sys-damage 3):
- cracks from the re-entrant corners of a wall's openings: a wall texel is beside one when, of eight probes
  across and up the wall, only one diagonal misses it; about half the corners crack (which ones by place, so a
  house cracks the same way every bake), each leaving away from the opening, steeper than 45 degrees, 0.35-1.25 m,
  wandering. causes3's alpha is each texel's distance to the nearest crack on its own wall.
- the loss potential: how readily a coat comes off at the damp foot, where run-off soaks what the rain doesn't
  wash, at a knocked arris low down and along a crack (LOSS; raea/wear's test checks its copy against it).
- debris on the walk under outdoor plaster with a high loss potential, dropped onto the walk from 0.2 m out (none
  where a plinth or step is below first, none from a wall the rain never reaches, a room's or a hollow model's
  back), each with its potential (spots.json "loss"); touch's old debris rule, which waited for this, is gone
  (raea-sys-touch 5). raea-sys-weathering 7 keys on raea-sys-damage's version.

raea/wear draws it by neglect (years less what upkeep keeps up): render lost to the brick 2 cm behind it (drawn
at the view's parallax) under a shadowed lip, paint to red-lead primer and the wood, enamel flaking to rusting
iron, cracks no thinner than a pixel (stepped along brick's joints). What a lived-in house mends however poorly
it is kept (panes, most slates, fallen render on its walk) goes only once it is left empty: abandonOf, neglect
past ABANDON_FROM (0.85) by the house's own upkeep. wearSpots reads spots.json; wearDebris is the debris an age
leaves lying; debug views crack and loss.

WR9: weatherAt eases what lies on the surfaces (wet, snow, driven snow, frost) toward what the sky does, spell by
spell, each at its own rate (WEATHER_RATES, ASSUMED: wet in about 3 minutes, dry over an hour), exactly, so any
frame draws alone; WEAR_CONDITIONS are the eight conditions as weather.

Tests: cargo test -p raea-sys-damage (5: an opening's four corners and no others, cracks along the wall, about
half the corners crack, what loosens a coat, debris under outdoor plaster's foot and on the walk only),
-p raea-sys-weathering (11), -p raea-sys-touch (9); bun test in sdk/wear (22).
2026-11-19 09:37:01 -08:00
172 changed files with 5346 additions and 2460 deletions

No files matched your search

+12
View File
@@ -119,3 +119,15 @@ jobs:
env:
CARGO_PROFILE_TEST_DEBUG: "0"
run: cargo test --locked -p raea-runtime-plugins -p raea-io-media -p raea-core-fonts -p raea-native -p raea-core-brief -p raea-core-k -p raea-bundle -p raea-app-check -p raea-app-check-flash -p raea-io-ffmpeg -p raea-app-workspace -p raea-app-tools -p raea-app-targets
- name: Windows' and Linux's own (#169)
# what a Windows or Linux user meets that no other step ran: QuickJS's Intl (raea-runtime-jsengine's
# quickjs_formats_as_javascriptcore_does, on Linux), openh264 at --quality master (raea-io-soft), git found or
# fetched (raea-io-assets), and raea's Node core under the agent shell (raea-native's tests/node.rs: Node's names
# for the system, Windows' paths); tests/node.rs needs raea-native's modules feature and tests/quality.rs
# raea-io-soft's h264
env:
CARGO_PROFILE_TEST_DEBUG: "0"
run: |
cargo test --locked -p raea-native --features modules --test node
cargo test --locked -p raea-io-soft --features h264
cargo test --locked -p raea-runtime-jsengine -p raea-io-assets
+13 -6
View File
@@ -217,9 +217,10 @@ jobs:
retention-days: 3
compression-level: 0
# Windows in Git's bash on GitHub's runner, with the Visual Studio Build Tools in its image (their image terms; we
# accept no licence and download no Microsoft files). The C runtime is the DLL one (the VC++ redistributable): ort's
# prebuilt ONNX Runtime is built against it, so crt-static doesn't link (LNK2019 on __imp_ symbols, 10-29).
# Windows in Git's bash on GitHub's runner, with Visual Studio in its image. The C runtime is the DLL one: ONNX
# Runtime is built against it (crt-static didn't link: LNK2019 on __imp_ symbols, 10-29), and Microsoft's
# onnxruntime.dll imports it too, so the VC++ runtime's DLLs ship beside raea.exe from this image's Visual Studio
# (tools/release/win-bundle.sh), as Microsoft documents for app-local deployment.
windows:
runs-on: ${{ (vars.RELEASE_WINDOWS_RUNNER && fromJSON(vars.RELEASE_WINDOWS_RUNNER)) || 'windows-latest' }}
timeout-minutes: 350
@@ -333,12 +334,16 @@ jobs:
# static runtime ort links by default is built for AVX2 and stopped raea.exe at start on CPUs without it
- name: ONNX Runtime (tools/release/onnxruntime.sh)
run: bash tools/release/onnxruntime.sh target/dist
# which DLLs raea needs from the machine (the CRT's come from the VC++ redistributable)
# and what a PC with nothing installed and no downloads needs beside raea.exe: the VC++ runtime (from this
# runner's Visual Studio), FFmpeg (raea's LGPL build) and uv, each with its licence
- name: The Windows bundle (tools/release/win-bundle.sh)
run: bash tools/release/win-bundle.sh target/dist
# which DLLs raea needs from the machine (the CRT's now ship beside it: win-bundle.sh)
- name: What raea.exe imports
run: |
{ echo '### what raea.exe, raea_bundle.dll, raea-perceive.exe and onnxruntime.dll import'; echo '```'
dumpbin=$(ls "/c/Program Files/Microsoft Visual Studio"/*/*/VC/Tools/MSVC/*/bin/HostX64/x64/dumpbin.exe | head -1)
"$dumpbin" -nologo -dependents target/dist/raea.exe target/dist/raea_bundle.dll target/dist/raea-perceive.exe target/dist/onnxruntime.dll | grep -iE '\.dll$|Dump of' | sed 's/^ *//'
"$dumpbin" -nologo -dependents target/dist/raea.exe target/dist/raea_bundle.dll target/dist/raea-perceive.exe target/dist/onnxruntime.dll target/dist/ffmpeg.exe | grep -iE '\.dll$|Dump of' | sed 's/^ *//'
echo '```'; } | tee -a "$GITHUB_STEP_SUMMARY" || true
# release.sh's checks render on Mesa's lavapipe (software Vulkan, MIT; on the runner only, never in the zip): the
# runner has no GPU, and WARP, Windows' own software DX12, crashes compiling one of Bevy's compute shaders there
@@ -419,6 +424,7 @@ jobs:
lfs: false
sparse-checkout: |
tools/release-check.sh
tools/release/win-bundle.files
tools/release/lavapipe.sh
sparse-checkout-cone-mode: false
path: check
@@ -432,7 +438,8 @@ jobs:
run: |
set -e
v=${TAG#v}
cp check/tools/release-check.sh "$RUNNER_TEMP/"
# and the list of what bin\ must carry, where release-check.sh looks for it (release/ beside it)
cp check/tools/release-check.sh "$RUNNER_TEMP/" && mkdir -p "$RUNNER_TEMP/release" && cp check/tools/release/win-bundle.files "$RUNNER_TEMP/release/"
rm -rf check
cd "$RUNNER_TEMP/zip"
sha256sum -c "raea-$v-windows-x86_64.zip.sha256"
+49
View File
@@ -0,0 +1,49 @@
# FFmpeg for Windows as raea ships it (tools/release/ffmpeg-win.sh): built on Linux with mingw-w64 and published once
# as the prerelease tools-ffmpeg-<version>-lgpl, with FFmpeg's source tarball, its signature and the script, which are
# its complete source (LGPL 2.1 or later). io/assets/src/setup.rs pins the zip by its
# sha256, so a published zip is never replaced: a run whose release already holds one only builds it and says
# whether its own sha256 differs.
name: tools-ffmpeg
on:
workflow_dispatch:
push:
paths: [tools/release/ffmpeg-win.sh, .github/workflows/tools-ffmpeg.yml]
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
lfs: false
# the x86_64 cross compiler only, and non-interactive: an install that asks (needrestart, debconf) waits forever.
# The runner's own EC2 mirror has trickled (35 MB in 11 minutes, 11-19), so apt reads Ubuntu's archive first
# and Azure's mirror after it, gives up on a stalled request and retries.
- name: mingw-w64
env:
DEBIAN_FRONTEND: noninteractive
NEEDRESTART_MODE: a
run: |
printf 'http://archive.ubuntu.com/ubuntu/\tpriority:1\nhttp://azure.archive.ubuntu.com/ubuntu/\tpriority:2\n' | sudo tee /etc/apt/apt-mirrors.txt
o="-o Acquire::Retries=5 -o Acquire::http::Timeout=30"
sudo -E apt-get $o update -q
sudo -E apt-get $o install -y -q --no-install-recommends gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 binutils-mingw-w64-x86-64 libz-mingw-w64-dev nasm make pkg-config xz-utils zip
timeout-minutes: 25
- name: build
run: bash tools/release/ffmpeg-win.sh out
- name: publish (once)
env:
GH_TOKEN: ${{ github.token }}
run: |
v=$(sed -n 's/^v=//p' tools/release/ffmpeg-win.sh)
tag=tools-ffmpeg-$v-lgpl; zip=ffmpeg-$v-lgpl-win64.zip
if gh release view "$tag" --json assets -q '.assets[].name' 2>/dev/null | grep -qx "$zip"; then
echo "$tag already has $zip (never replaced); this run's: $(cat out/$zip.sha256)"; exit 0
fi
curl -fsSL -o "out/ffmpeg-$v.tar.xz.asc" "https://ffmpeg.org/releases/ffmpeg-$v.tar.xz.asc"
cp tools/release/ffmpeg-win.sh out/
gh release view "$tag" >/dev/null 2>&1 || gh release create "$tag" --prerelease --title "FFmpeg $v for Windows (LGPL), as raea ships it" \
--notes "FFmpeg $v cross-built for Windows x64 by tools/release/ffmpeg-win.sh: static, FFmpeg's own code, zlib and libvpx's decoders (BSD), LGPL 2.1 or later; its H.264 encoder is Windows' own (Media Foundation). Its complete source is ffmpeg-$v.tar.xz (with FFmpeg's signature), the libvpx tarball and ffmpeg-win.sh, attached here. raea ships it beside raea.exe on Windows and fetches it where it isn't."
gh release upload "$tag" "out/$zip" "out/$zip.sha256" "out/ffmpeg-$v.tar.xz" "out/ffmpeg-$v.tar.xz.asc" out/libvpx-*.tar.gz out/ffmpeg-win.sh
+34
View File
@@ -0,0 +1,34 @@
# The complete corresponding source of the Git for Windows the Windows app ships (tools/release/git-sources.sh),
# published once as the prerelease tools-git-<tag>-sources, which the app's git\SOURCE.txt names: GPLv2 section 3
# asks whoever distributes Git to make it available, and dugite-native's own repository isn't all of it (Git for
# Windows' MSYS2 runtime, bash, curl and the rest are built from their own source packages). A run whose release
# already holds the archive changes nothing.
name: tools-git-sources
on:
workflow_dispatch:
push:
paths: [tools/release/git-sources.sh, .github/workflows/tools-git-sources.yml]
permissions:
contents: write
jobs:
sources:
runs-on: ubuntu-24.04
timeout-minutes: 60
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
with:
lfs: false
- name: publish (once)
run: |
t=$(sed -n 's/^tag=//p' tools/release/git-sources.sh)
tag=tools-git-$t-sources; tar=git-for-windows-$t-sources.tar
if gh release view "$tag" --json assets -q '.assets[].name' 2>/dev/null | grep -qx "$tar"; then
echo "$tag already has $tar"; exit 0
fi
bash tools/release/git-sources.sh out
cp tools/release/git-sources.sh out/
gh release view "$tag" >/dev/null 2>&1 || gh release create "$tag" --prerelease --title "Git for Windows ($t) sources, as raea's Windows app ships it" \
--notes "The complete corresponding source of the Git for Windows (dugite-native $t) that raea's Windows app ships in its git folder: each package of its etc/package-versions.txt as the source package it was built from, from Git for Windows' pacman repository or MSYS2's source mirror (SOURCES.tsv inside says which), collected by git-sources.sh, attached here. raea runs Git as a separate program."
gh release upload "$tag" "out/$tar" "out/$tar.sha256" out/git-sources.sh
+3
View File
@@ -104,5 +104,8 @@ sdk/raea/.scratch-*/
# the Tripo CLI writes its last task id into the directory it runs in
.tripo/
# examples/materials/wear: its house is made by make-house.ts (media/) and baked at render time (assets/wear/)
/examples/materials/wear/media/
/examples/materials/wear/assets/
# tools/bevy-parity links each example folder's assets/ to Bevy's checkout at run time (an absolute, per-machine path)
/sdk/raea/bench/bevy-parity/**/assets
Generated
+48 -156
View File
@@ -2668,7 +2668,6 @@ dependencies = [
"bevy_utils",
"bitflags 2.13.2",
"bytemuck",
"ctt",
"ddsfile",
"futures-lite",
"guillotiere",
@@ -5567,100 +5566,6 @@ dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "ctt"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c119cc328a986d0bae3a1753941595f1dc6a0f2d938b5f49edf8937bd606fa9"
dependencies = [
"bytemuck",
"ctt-astcenc",
"ctt-bc7enc-rdo",
"ctt-compressonator",
"ctt-etcpak",
"ctt-intel-texture-compressor",
"ddsfile",
"fast_image_resize",
"flate2",
"half",
"ktx2",
"log",
"miniz_oxide 0.8.9",
"profiling",
"thiserror 2.0.21",
"zstd",
]
[[package]]
name = "ctt-astcenc"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24a806826f523401c1c8a9afded1c5625f005fd8e6567ceba2fe6254d8c59e3e"
dependencies = [
"bitflags 2.13.2",
"cc",
"paste",
]
[[package]]
name = "ctt-bc7enc-rdo"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a4ad8fcbfcafc39a9e02bfb344fd517dd0bcd7adabcc25de19e9703eb3b99a3"
dependencies = [
"ctt-bc7enc-rdo-prebuilt",
"ispc-build-utils",
]
[[package]]
name = "ctt-bc7enc-rdo-prebuilt"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f27a2776bbafcc2d335c0621aa9dbd40ecfecdb02a636d3fcd2a2379f96f7472"
dependencies = [
"ispc-build-utils",
]
[[package]]
name = "ctt-compressonator"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21eefd5a6f96023adc6bc8c95de1afccded8f958afdbf7e02fa98bf325c41058"
dependencies = [
"cc",
"thiserror 2.0.21",
]
[[package]]
name = "ctt-etcpak"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c6025bf0456c4a8c0a693c803eb7368f045f74709adc6b271223ca7f76898ab"
dependencies = [
"cc",
"paste",
]
[[package]]
name = "ctt-intel-texture-compressor"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "452985b4223f1a68da0722161ff9a7dbb33bcb32cd30f341b541fd980c58fb26"
dependencies = [
"cc",
"ctt-intel-texture-compressor-prebuilt",
"ispc-build-utils",
]
[[package]]
name = "ctt-intel-texture-compressor-prebuilt"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa4031e53991b02e2b9fb903f3bb458ab9a2afcec99320800d4d4092dc43d33c"
dependencies = [
"ispc-build-utils",
]
[[package]]
name = "cursor-icon"
version = "1.2.0"
@@ -6839,18 +6744,6 @@ dependencies = [
"arrayvec",
]
[[package]]
name = "fast_image_resize"
version = "6.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9c50201dc184ba6553da1695aac20a042efffbe2d84542cee31917c86c3ab1e"
dependencies = [
"cfg-if",
"document-features",
"num-traits",
"thiserror 2.0.21",
]
[[package]]
name = "fastbloom"
version = "0.17.0"
@@ -8684,15 +8577,6 @@ version = "1.70.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695"
[[package]]
name = "ispc-build-utils"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4cda913ddb107b9bb5c46769855e3849e62daa52fc7e70de0080ca4e6cfd030"
dependencies = [
"find-msvc-tools",
]
[[package]]
name = "itertools"
version = "0.10.5"
@@ -13770,10 +13654,11 @@ dependencies = [
name = "raea-app-check"
version = "0.1.0"
dependencies = [
"dunce",
"raea-app-check-cause",
"raea-app-check-flash",
"raea-app-check-inbox",
"raea-app-check-read",
"raea-app-check-text",
"raea-core-brief",
"raea-core-facts",
"raea-io-ffmpeg",
@@ -13783,6 +13668,15 @@ dependencies = [
"serde_json",
]
[[package]]
name = "raea-app-check-cause"
version = "0.1.0"
dependencies = [
"image",
"raea-core-facts",
"serde_json",
]
[[package]]
name = "raea-app-check-flash"
version = "0.1.0"
@@ -13799,13 +13693,24 @@ dependencies = [
name = "raea-app-check-read"
version = "0.1.0"
dependencies = [
"libc",
"raea-app-media",
"raea-io-ffmpeg",
"raea-io-home",
"raea-io-media",
"raea-sys-measure",
"serde_json",
]
[[package]]
name = "raea-app-check-text"
version = "0.1.0"
dependencies = [
"dunce",
"raea-core-facts",
"serde_json",
]
[[package]]
name = "raea-app-ci"
version = "0.1.0"
@@ -13821,6 +13726,7 @@ version = "0.1.0"
dependencies = [
"dunce",
"raea-app-check",
"raea-app-check-text",
"raea-app-notes",
"raea-app-registry",
"raea-core-brief",
@@ -13954,6 +13860,7 @@ name = "raea-app-notes"
version = "0.1.0"
dependencies = [
"raea-core-facts",
"raea-io-ffmpeg",
"raea-io-home",
"raea-io-trace",
"serde",
@@ -14050,6 +13957,7 @@ dependencies = [
"raea-app-registry",
"raea-core-brief",
"raea-core-facts",
"raea-io-assets",
"raea-io-home",
"serde_json",
]
@@ -14953,7 +14861,6 @@ dependencies = [
"raea-sys-three-shader",
"raea-sys-viewbox",
"raea-sys-volume",
"raea-sys-wear",
"serde_json",
"wgpu",
]
@@ -15349,6 +15256,8 @@ dependencies = [
name = "raea-runtime-jsengine"
version = "0.1.0"
dependencies = [
"iana-time-zone",
"miniz_oxide 0.8.9",
"objc2 0.6.5",
"raea-io-home",
"rquickjs",
@@ -15495,7 +15404,6 @@ dependencies = [
"raea-sys-frame",
"raea-sys-layers",
"raea-sys-procmat",
"raea-sys-wear",
"serde_json",
]
@@ -15805,6 +15713,16 @@ dependencies = [
"raea-sys-shader",
]
[[package]]
name = "raea-sys-damage"
version = "0.1.0"
dependencies = [
"parry3d",
"raea-core-ease",
"raea-sys-touch",
"rayon",
]
[[package]]
name = "raea-sys-environment"
version = "0.1.0"
@@ -15867,6 +15785,7 @@ dependencies = [
"dunce",
"fastrand",
"image",
"raea-io-ffmpeg",
"raea-sys-columns",
"raea-sys-fingerprint",
"serde",
@@ -15902,6 +15821,7 @@ version = "0.1.0"
dependencies = [
"image",
"parry3d",
"raea-core-ease",
"raea-sys-glb",
"serde_json",
]
@@ -16183,10 +16103,18 @@ dependencies = [
"cpal 0.15.3",
"firewheel",
"raea-io-media",
"raea-sys-mix-level",
"raea-sys-tone",
"serde_json",
]
[[package]]
name = "raea-sys-mix-level"
version = "0.1.0"
dependencies = [
"raea-io-media",
]
[[package]]
name = "raea-sys-ml"
version = "0.1.0"
@@ -16523,15 +16451,6 @@ dependencies = [
"serde_json",
]
[[package]]
name = "raea-sys-wear"
version = "0.1.0"
dependencies = [
"bevy",
"raea-core-program",
"serde_json",
]
[[package]]
name = "raea-sys-weathering"
version = "0.1.0"
@@ -16539,6 +16458,7 @@ dependencies = [
"image",
"parry3d",
"raea-core-meshcheck",
"raea-sys-damage",
"raea-sys-exposure",
"raea-sys-glb",
"raea-sys-runoff",
@@ -23811,34 +23731,6 @@ dependencies = [
"futures-io",
]
[[package]]
name = "zstd"
version = "0.13.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb02c3132d251ab1606e9fc913a7da6c6ed08cc263df15edf082e1dc497d157"
dependencies = [
"zstd-safe",
]
[[package]]
name = "zstd-safe"
version = "7.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c8ea04668f5de8d8d51051714ba560c9536519cadcdb8829bba4fe2ad159b03"
dependencies = [
"zstd-sys",
]
[[package]]
name = "zstd-sys"
version = "2.1.2+zstd.1.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "481ada9c543b2323cbb7bbdbb5249177fbf0188ed959ed2c15e4b22421c84ed3"
dependencies = [
"cc",
"pkg-config",
]
[[package]]
name = "zune-core"
version = "0.5.3"
+4 -1
View File
@@ -80,6 +80,7 @@ members = [
"systems/k",
"systems/tone",
"systems/mix",
"systems/mix/level",
"systems/ml",
"systems/mlx",
"systems/kimodo",
@@ -102,11 +103,11 @@ members = [
"systems/canvas",
"systems/tweak",
"systems/filters",
"systems/wear",
"systems/weathering",
"systems/runoff",
"systems/touch",
"systems/exposure",
"systems/damage",
"systems/glb",
"systems/procmat",
"systems/page",
@@ -187,9 +188,11 @@ members = [
"runtime/scene2d",
"runtime/shared",
"apps/check",
"apps/check/cause",
"apps/check/flash",
"apps/check/inbox",
"apps/check/read",
"apps/check/text",
"apps/direction",
"apps/notes",
"apps/fingerprint",
-37
View File
@@ -1,37 +0,0 @@
ctt 0.5.0 ships no licence file of its own. Its Cargo.toml declares MIT OR Apache-2.0 OR Zlib, by The ctt developers.
---- Apache-2.0: the text is LICENSES/texts/Apache-2.0.txt ----
---- MIT ----
Copyright (c) The ctt developers
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
---- Zlib ----
Copyright (c) The ctt developers
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held
liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter
it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If
you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not
required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original
software.
3. This notice may not be removed or altered from any source distribution.
@@ -1,175 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
@@ -1,178 +0,0 @@
Copyright (C) 2018-2021 Binomial LLC
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
@@ -1,20 +0,0 @@
ctt-bc7enc-rdo-prebuilt 0.5.0 ships no licence file of its own. Its Cargo.toml declares (MIT OR Apache-2.0) AND Apache-2.0, by The ctt developers, Rich Geldreich <[email protected]>.
---- Apache-2.0: the text is LICENSES/texts/Apache-2.0.txt ----
---- MIT ----
Copyright (c) The ctt developers, Rich Geldreich <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,19 +0,0 @@
Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
@@ -1,26 +0,0 @@
etcpak, an extremely fast ETC compression utility (https://github.com/wolfpld/etcpak)
Copyright (c) 2013-2026, Bartosz Taudul <wolf@nereid.pl>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the <organization> nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,176 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2019 Graham Wihlidal
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -1,19 +0,0 @@
Copyright 2017 Intel Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -1,20 +0,0 @@
ctt-intel-texture-compressor-prebuilt 0.5.0 ships no licence file of its own. Its Cargo.toml declares (MIT OR Apache-2.0) AND MIT, by The ctt developers, Traverse Research <[email protected]>, Graham Wihlidal <[email protected]>, Intel Corporation.
---- Apache-2.0: the text is LICENSES/texts/Apache-2.0.txt ----
---- MIT ----
Copyright (c) The ctt developers, Traverse Research <[email protected]>, Graham Wihlidal <[email protected]>, Intel Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright (c) 2021 Kirill Kuzminykh
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2021 Kirill Kuzminykh
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2020 Andrew Straw
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@@ -1,25 +0,0 @@
Copyright (c) 2020 Andrew D. Straw
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
@@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2020 Andrew Straw
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@@ -1,25 +0,0 @@
Copyright (c) 2020 Andrew D. Straw
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
@@ -1,37 +0,0 @@
ispc-build-utils 0.5.0 ships no licence file of its own. Its Cargo.toml declares MIT OR Apache-2.0 OR Zlib, by The ctt developers.
---- Apache-2.0: the text is LICENSES/texts/Apache-2.0.txt ----
---- MIT ----
Copyright (c) The ctt developers
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
---- Zlib ----
Copyright (c) The ctt developers
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held
liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter
it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If
you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not
required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original
software.
3. This notice may not be removed or altered from any source distribution.
-28
View File
@@ -1,28 +0,0 @@
BSD 3-Clause License
Copyright (c) 2026, Alexandre Bury
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-28
View File
@@ -1,28 +0,0 @@
BSD 3-Clause License
Copyright (c) 2026, Alexandre Bury
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,28 +0,0 @@
BSD 3-Clause License
Copyright (c) 2026, Alexandre Bury
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,32 +0,0 @@
The auto-generated bindings are under the 3-clause BSD license:
BSD License
For Zstandard software
Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name Facebook, nor Meta, nor the names of its contributors may
be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+14 -17
View File
@@ -20,8 +20,20 @@ animato (MIT OR Apache-2.0), usvg and resvg (Apache-2.0 OR MIT), mediabunny (MPL
The Windows build (docs/ports.feature PT20) adds: junction 1.4.2 (MIT, node_modules' links in io/npm) and windows-sys
0.61.2 (Microsoft, MIT OR Apache-2.0, in io/trace); every build has dunce 1.0.5 (CC0-1.0 OR MIT-0 OR Apache-2.0, plain
paths for Windows in runtime/bundle). It ships none of Microsoft's C runtime or SDK files: the runtime comes from the
Microsoft Visual C++ Redistributable, installed on the machine.
paths for Windows in runtime/bundle). Its bin\ also carries, each with its licence beside it (tools/release/win-bundle.sh):
Microsoft's Visual C++ runtime (vcruntime140.dll, vcruntime140_1.dll, msvcp140.dll, msvcp140_1.dll), redistributed
under Microsoft's Visual Studio licence terms; ONNX Runtime's onnxruntime.dll (Microsoft, MIT);
FFmpeg 9.0.2 (ffmpeg.exe, ffprobe.exe; LGPL-2.1-or-later), built from FFmpeg's release with FFmpeg's own code, zlib
and libvpx 1.17.0's decoders (BSD-3-Clause with the WebM project's patent grant: libvpx-LICENSE.txt,
libvpx-PATENTS.txt) by tools/release/ffmpeg-win.sh, its H.264 encoder Windows' own (Media Foundation), its source
published as the release tools-ffmpeg-9.0.2-lgpl;
uv (uv.exe; Astral, MIT OR Apache-2.0).
The Windows app adds Git for Windows with Git LFS (dugite-native; GPLv2 and its parts' licences, in git\), which raea
runs as a separate program; its complete corresponding source is published as the release tools-git-<tag>-sources.
raea.exe, on a PC with no Git, fetches the same build once into its tools cache (io/assets git()).
The Windows and Linux builds' JavaScript engine, QuickJS (rquickjs, MIT), carries FormatJS's Intl polyfills (MIT,
Copyright FormatJS) and the Unicode CLDR locale data they're made with (Unicode-3.0), packed in
runtime/jsengine/js/intl.pack; both licences are in runtime/jsengine/js/intl/LICENSE-FormatJS.md and in the pack.
The native target (engine/rune, docs/targets.feature) builds on Rune (https://github.com/anomalyco/rune, Copyright
2026 Anomaly, MIT; LICENSES/rune-0.0.1/repository-LICENSE): rune, rune-kit and their crates, by a pinned rev.
@@ -155,14 +167,6 @@ LICENSES/<crate>-<version>/.
cssparser 0.37.0: MPL-2.0
csv-core 0.1.13: Unlicense/MIT
csv 1.4.0: Unlicense/MIT
ctt-astcenc 0.5.0: (MIT OR Apache-2.0 OR Zlib) AND Apache-2.0
ctt-bc7enc-rdo-prebuilt 0.5.0: (MIT OR Apache-2.0) AND Apache-2.0
ctt-bc7enc-rdo 0.5.0: (MIT OR Apache-2.0 OR Zlib) AND Apache-2.0
ctt-compressonator 0.5.0: (MIT OR Apache-2.0 OR Zlib) AND MIT
ctt-etcpak 0.5.0: (MIT OR Apache-2.0 OR Zlib) AND BSD-3-Clause
ctt-intel-texture-compressor-prebuilt 0.5.0: (MIT OR Apache-2.0) AND MIT
ctt-intel-texture-compressor 0.5.0: (MIT OR Apache-2.0) AND MIT
ctt 0.5.0: MIT OR Apache-2.0 OR Zlib
dashmap 6.2.1: MIT
default-struct-builder 0.5.1: MIT OR Apache-2.0
deluxe-core 0.5.0: MIT
@@ -188,7 +192,6 @@ LICENSES/<crate>-<version>/.
enumflags2 0.7.12: MIT OR Apache-2.0
epaint_default_fonts 0.36.2: (MIT OR Apache-2.0) AND OFL-1.1 AND Ubuntu-font-1.0
epaint 0.36.2: MIT OR Apache-2.0
fast_image_resize 6.1.0: MIT OR Apache-2.0
fastbloom 0.17.0: MIT OR Apache-2.0
fastnoise-lite 1.1.1: MIT
fid-rs 0.2.0: MIT OR Apache-2.0
@@ -219,14 +222,11 @@ LICENSES/<crate>-<version>/.
i_overlay 4.5.2: MIT OR Apache-2.0
i_shape 1.18.0: MIT
i_tree 0.18.0: MIT
iana-time-zone-haiku 0.1.2: MIT OR Apache-2.0
iana-time-zone 0.1.65: MIT OR Apache-2.0
ilattice 0.1.0: MIT OR Apache-2.0
imagesize 0.13.0: MIT
inout 0.1.4: MIT OR Apache-2.0
interpolation 0.3.0: MIT
is-terminal 0.4.17: MIT
ispc-build-utils 0.5.0: MIT OR Apache-2.0 OR Zlib
itertools 0.10.5: MIT/Apache-2.0
iyes_progress 0.18.0: MIT OR Apache-2.0
jzon 0.12.5: MIT/Apache-2.0
@@ -428,9 +428,6 @@ LICENSES/<crate>-<version>/.
zbus 6.2.1: MIT
zcheapstr 1.1.0: MIT
zruntime 0.2.2: MIT
zstd-safe 7.4.0: BSD-3-Clause
zstd-sys 2.1.2+zstd.1.5.7: BSD-3-Clause
zstd 0.13.4: BSD-3-Clause
zvariant_derive 5.15.0: MIT
zvariant_utils 4.2.0: MIT
zvariant 5.15.0: MIT
+2 -2
View File
@@ -86,8 +86,8 @@ On Windows 10 or 11, in PowerShell:
irm https://raea.io/install.ps1 | iex
```
It does the same under `~\.raea` and adds raea to your PATH. raea needs the Microsoft Visual C++ Redistributable
(x64), which most machines already have, and a DirectX 12 or Vulkan GPU driver.
It does the same under `~\.raea` and adds raea to your PATH. raea needs a DirectX 12 or Vulkan GPU driver; what
else it needs (the Visual C++ runtime, FFmpeg and uv) is in its `bin\` folder.
## Hello
+1 -1
View File
@@ -48,7 +48,7 @@ fn export(args: &[String]) -> R<String> {
let tsx = args.first().filter(|a| !a.starts_with('-')).ok_or(USAGE)?;
let tsx = dunce::canonicalize(&PathBuf::from(tsx)).map_err(|e| format!("{tsx}: {e}"))?;
let dir = tsx.parent().unwrap().to_path_buf();
let codec = flag(args, "--alpha-codec").map_or(Ok(raea_io_alpha::Codec::default_here()), |c| raea_io_alpha::Codec::parse(&c))?;
let codec = raea_io_alpha::Codec::chosen(flag(args, "--alpha-codec").as_deref())?;
let (root, in_store) = match flag(args, "-o") {
Some(o) => (PathBuf::from(o), false),
None => {
+4 -1
View File
@@ -7,7 +7,6 @@ publish = false
description = "`raea check`: the floor's measurable lines on an export, ranked P0-P3"
[dependencies]
dunce = "1"
# taste.ts rules, as the raea CLI evaluates them (docs/projects.feature PJ0)
raea-core-brief = { path = "../../core/brief" }
# a transcript's words, read as `raea world` reads them (docs/direction.feature DR1)
@@ -21,6 +20,10 @@ raea-io-ffmpeg = { path = "../../io/ffmpeg" }
raea-sys-measure = { path = "../../systems/measure" }
# what it reads of a video, through FFmpeg or raea's own decoders where it isn't installed
raea-app-check-read = { path = "read" }
# who can fix what it finds: the encode's or the picture's own, carried, a source (split out to keep this crate small)
raea-app-check-cause = { path = "cause" }
# the text rules on a render's manifest (split out: raea render holds its own text to them)
raea-app-check-text = { path = "text" }
# the flashing screen (WCAG 2.3.1), split out to keep this crate small
raea-app-check-flash = { path = "flash" }
# what the person sent from the raea app, handed to the agent (split out to keep this crate small)
+15
View File
@@ -0,0 +1,15 @@
[package]
name = "raea-app-check-cause"
version = "0.1.0"
edition = "2024"
license = "FSL-1.1-ALv2"
publish = false
description = "Who can fix what raea check finds: the encode's or the picture's own, carried from an earlier export, a source rather than a delivery"
[dependencies]
# a project's record of renders and checks (DR3)
raea-core-facts = { path = "../../../core/facts" }
image = { version = "0.25", default-features = false, features = ["png"] }
[dev-dependencies]
serde_json = "1"
+174
View File
@@ -0,0 +1,174 @@
//! Who can fix what `raea check` finds, so a round is spent only on what another render can change (11-19: two
//! Telluride projects took nine renders, five of them for findings no render could move). Three things, for any rule:
//!
//! - **Introduced or there already.** A rule an encode can cause is measured again on the composition's own frames,
//! rendered without encoding (`unencoded`), and the export is set against them (`against`): what the picture already
//! held is the footage's (a note), what the export adds is the encode's (the error, with a fix raea has).
//! - **Carried.** A finding an earlier export of the same composition had at the same moment (`earlier`, `carried`)
//! says since when: the change between them didn't move it, so doing that again won't.
//! - **A source isn't a delivery.** A take or a download checked on its own (`is_source`) isn't held to a delivery's
//! loudness target.
//!
//! None of it changes what a rule measures or where it draws the line.
use std::path::{Path, PathBuf};
use std::process::Command;
use raea_core_facts::{Finding, record};
pub type R<T> = Result<T, String>;
/// Whether a record entry is the render that wrote `out` (a path as the record names it)
fn rendered(e: &record::Entry, out: &str) -> bool {
e.by == "raea render" && e.out.as_deref() == Some(out)
}
/// The composition a video was rendered from, and its project: the newest `raea render` writing it in the project's
/// record (DR3). None outside a project, or for a video no render there wrote (a take, a download).
pub fn composition_of(video: &Path) -> Option<(PathBuf, PathBuf)> {
let project = record::up(video, ".raea/project")?;
let want = record::rel(&project, video);
let made = record::read(&project).into_iter().rev().find(|e| e.kind == "video" && rendered(e, &want))?;
let of = project.join(&made.of);
of.is_file().then_some((project, of))
}
/// Whether a file is one of a project's sources (a take or a download under assets/ or media/ that no render wrote):
/// it isn't a delivery, so a delivery's rules (its loudness target) don't hold it
pub fn is_source(video: &Path) -> bool {
let Some(project) = record::up(video, ".raea/project") else { return false };
let me = record::rel(&project, video);
(me.starts_with("assets/") || me.starts_with("media/")) && !record::read(&project).iter().any(|e| rendered(e, &me))
}
/// Luma as a decoder of raea's export gives it to the check (BT.709, full range: FFmpeg's format=gray of the
/// encoder's limited-range picture), from 8-bit RGBA `width` wide, its top-left `w` x `h`
pub fn luma(rgba: &[u8], width: usize, w: usize, h: usize) -> Vec<u8> {
let mut y = Vec::with_capacity(w * h);
for r in 0..h {
for p in rgba[r * width * 4..][..w * 4].chunks_exact(4) {
y.push((0.2126 * p[0] as f32 + 0.7152 * p[1] as f32 + 0.0722 * p[2] as f32).round().clamp(0.0, 255.0) as u8);
}
}
y
}
/// `frames` as `comp` draws them, never encoded, as luma `w` x `h` (top-left): `raea render COMP --at F,... -o DIR/`
/// (PNG) run by `raea` from the project, kept out of its record as the quick check's stills are
pub fn unencoded(raea: &Path, project: &Path, comp: &Path, frames: &[i64], w: usize, h: usize) -> R<Vec<Vec<u8>>> {
let mut wanted: Vec<i64> = frames.to_vec();
wanted.sort_unstable();
wanted.dedup();
let tmp = std::env::temp_dir().join(format!("raea-unencoded-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&tmp);
std::fs::create_dir_all(&tmp).map_err(|e| format!("{}: {e}", tmp.display()))?;
let at = wanted.iter().map(|f| f.to_string()).collect::<Vec<_>>().join(",");
let read = (|| {
let run = Command::new(raea).arg("render").arg(comp).args(["--at", &at, "-o"]).arg(format!("{}/", tmp.display())).current_dir(project).env("RAEA_RECORD", "off").output().map_err(|e| e.to_string())?;
let mut pngs: Vec<PathBuf> = std::fs::read_dir(&tmp).map_err(|e| e.to_string())?.filter_map(|e| e.ok().map(|e| e.path())).filter(|p| p.extension().is_some_and(|x| x == "png")).collect();
pngs.sort();
if pngs.len() != wanted.len() {
let said = String::from_utf8_lossy(&run.stderr).lines().chain(String::from_utf8_lossy(&run.stdout).lines()).find(|l| l.contains("REFUSED") || l.contains("rror")).unwrap_or("").to_string();
return Err(format!("its render gave {} of {} frames {said}", pngs.len(), wanted.len()).trim_end().to_string());
}
let mut by_frame = std::collections::HashMap::new();
for (f, p) in wanted.iter().zip(&pngs) {
let img = image::open(p).map_err(|e| format!("{}: {e}", p.display()))?.to_rgba8();
let (iw, ih) = (img.width() as usize, img.height() as usize);
if iw < w || ih < h {
return Err(format!("it draws {iw}x{ih}, smaller than the export's {w}x{h}"));
}
by_frame.insert(*f, luma(img.as_raw(), iw, w, h));
}
Ok(frames.iter().map(|f| by_frame[f].clone()).collect())
})();
let _ = std::fs::remove_dir_all(&tmp);
read
}
/// The frame a check reads for each sample taken every `every` seconds from 0: the last frame before the sample's
/// middle, as ffmpeg's fps filter picks it (and raea-app-check-read's readers), held to the picture's `last` frame
pub fn sampled(samples: usize, every: f64, fps: f64, last: i64) -> Vec<i64> {
(0..samples).map(|k| (((k as f64 + 0.5) * every * fps).ceil() as i64 - 1).clamp(0, last.max(0))).collect()
}
/// A sampled measure of the export against the same measure of the unencoded frames.
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Against {
/// samples over the rule's line that the export made worse by more than its noise
pub worse: usize,
/// samples over the line before encoding: the picture's own
pub before: usize,
/// samples compared
pub of: usize,
/// the mean of the export's measure less the unencoded one's
pub added: f64,
}
impl Against {
/// Whether the export added to it, beyond what a clean encode moves: at least three samples (and a tenth) worse,
/// and more than half the noise on average
pub fn by_encode(&self, noise: f64) -> bool {
self.worse >= 3usize.max(self.of / 10) && self.added > noise / 2.0
}
/// The first sample the export made worse
pub fn first(out: &[Option<f64>], before: &[Option<f64>], line: f64, noise: f64) -> Option<usize> {
out.iter().zip(before).position(|(o, b)| o.unwrap_or(0.0) > line && o.unwrap_or(0.0) - b.unwrap_or(0.0) > noise)
}
}
/// Per sample, the export's measure against the unencoded frames' (None: nothing to measure, read as 0), over a
/// rule's `line`, where a clean encode moves it at most `noise`
pub fn against(out: &[Option<f64>], before: &[Option<f64>], line: f64, noise: f64) -> Against {
let n = out.len().min(before.len());
let at = |s: &[Option<f64>], i: usize| s[i].unwrap_or(0.0);
let worse = (0..n).filter(|&i| at(out, i) > line && at(out, i) - at(before, i) > noise).count();
let was = (0..n).filter(|&i| at(before, i) > line).count();
let added = (0..n).map(|i| at(out, i) - at(before, i)).sum::<f64>() / n.max(1) as f64;
Against { worse, before: was, of: n, added }
}
/// The newest check, in the project's record, of an earlier export of the composition `video` was rendered from
pub fn earlier(video: &Path) -> Option<record::Entry> {
let project = record::up(video, ".raea/project")?;
let me = record::rel(&project, video);
let entries = record::read(&project);
let made = entries.iter().rposition(|e| rendered(e, &me))?;
// the composition's exports rendered before this one; a versioned copy (NAME-v2.tsx) is the same piece
let stem = |of: &str| piece(&Path::new(of).file_stem().map(|s| s.to_string_lossy().to_string()).unwrap_or_default());
let comp = stem(&entries[made].of);
let exports: Vec<String> = entries[..made].iter().filter(|e| e.by == "raea render" && e.kind == "video" && stem(&e.of) == comp).filter_map(|e| e.out.clone()).filter(|o| *o != me).collect();
entries.into_iter().rev().find(|e| e.by == "raea check" && exports.contains(&e.of))
}
/// A composition's name without its version: walkaround-v2 is walkaround
pub fn piece(stem: &str) -> String {
match stem.rfind("-v") {
Some(i) if i + 2 < stem.len() && stem[i + 2..].bytes().all(|b| b.is_ascii_digit()) => stem[..i].to_string(),
_ => stem.to_string(),
}
}
/// The same finding in another export: the same rule, about the same thing, at the same moment (within a second; a
/// finding about the whole piece matches one about the whole piece). Its words may differ ("worst 13%", "worst 15%").
pub fn alike(a: &Finding, b: &Finding, fps: f64) -> bool {
let about = |f: &Finding| f.about.iter().map(|a| a.key.clone().unwrap_or_else(|| a.name.clone())).collect::<Vec<_>>();
a.check == b.check && about(a) == about(b) && match (a.frames, b.frames) {
(Some([x, _]), Some([y, _])) => ((x - y).abs() as f64) <= fps.max(1.0),
(None, None) => true,
_ => false,
}
}
/// Each finding an earlier check had at the same moment says so, and that its fix hasn't moved it: rank and words
/// otherwise as measured
pub fn carried(now: &mut [Finding], before: &record::Entry, fps: f64) {
for f in now.iter_mut() {
if before.findings.iter().any(|b| alike(b, f, fps)) {
f.says.push_str(&format!(" [also in {} ({}): what changed between them didn't move it]", before.of, before.id));
}
}
}
#[cfg(test)]
mod tests;
+107
View File
@@ -0,0 +1,107 @@
use super::*;
use raea_core_facts::Level;
// The 28 samples `raea check` takes of the 11-16 Telluride walkaround (55.8 s, 24 fps, phone footage), as its
// blotching measures them: rendered to PNG with no encoding (BEFORE), those PNGs through x264 crf 12, and raea's own
// exports at --quality high and master. Blotching's line is 0.009; x264 moved a sample at most 0.005.
const BEFORE: [Option<f64>; 28] = [Some(0.0), None, Some(0.052), Some(0.062), None, Some(0.062), None, None, Some(0.076), Some(0.009), Some(0.03), Some(0.039), Some(0.068), None, None, None, None, Some(0.077), Some(0.062), None, None, Some(0.0), Some(0.0), Some(0.0), Some(0.0), Some(0.0), Some(0.0), Some(0.0)];
const X264: [Option<f64>; 28] = [Some(0.0), None, Some(0.052), Some(0.062), None, Some(0.059), None, None, Some(0.078), Some(0.008), Some(0.028), Some(0.034), Some(0.071), None, None, None, None, Some(0.078), Some(0.062), None, Some(0.039), Some(0.0), Some(0.0), Some(0.0), Some(0.0), Some(0.0), Some(0.0), Some(0.0)];
const HIGH: [Option<f64>; 28] = [Some(0.0), None, Some(0.042), Some(0.024), Some(0.052), Some(0.064), Some(0.05), None, Some(0.126), Some(0.063), Some(0.061), Some(0.122), Some(0.088), Some(0.04), Some(0.029), Some(0.047), Some(0.044), Some(0.096), Some(0.09), None, Some(0.029), Some(0.0), Some(0.0), Some(0.0), Some(0.0), Some(0.0), Some(0.0), Some(0.0)];
const MASTER: [Option<f64>; 28] = [Some(0.0), None, Some(0.026), Some(0.002), None, Some(0.03), None, None, Some(0.022), None, None, None, None, None, None, None, None, Some(0.071), Some(0.053), None, None, Some(0.0), Some(0.0), Some(0.0), Some(0.0), Some(0.0), Some(0.0), Some(0.0)];
const LINE: f64 = 0.009;
const NOISE: f64 = 0.005;
/// What the picture already held is told from what the encode added: a clean encode and raea's master add nothing,
/// its high adds to 14 of 28 samples, and 9 samples hold the footage's own either way
#[test]
fn the_picture_s_own_is_told_from_the_encode_s() {
let clean = against(&X264, &BEFORE, LINE, NOISE);
assert!(!clean.by_encode(NOISE), "{clean:?}");
assert!(clean.added.abs() < 0.002, "{clean:?}");
let high = against(&HIGH, &BEFORE, LINE, NOISE);
assert!(high.by_encode(NOISE), "{high:?}");
assert_eq!((high.worse, high.before, high.of), (14, 9, 28));
assert_eq!(Against::first(&HIGH, &BEFORE, LINE, NOISE), Some(4));
let master = against(&MASTER, &BEFORE, LINE, NOISE);
assert!(!master.by_encode(NOISE), "{master:?}");
assert_eq!(master.worse, 0);
// a small, even addition over a clean picture still counts (VideoToolbox over a dark render, 10-25)
assert!(against(&[Some(0.013); 16], &[Some(0.003); 16], LINE, NOISE).by_encode(NOISE));
}
/// The frame read for each sample is the last before its middle, as the fps filter picks it
#[test]
fn the_sampled_frames_are_the_check_s() {
assert_eq!(sampled(3, 2.0, 24.0, 1338), vec![23, 71, 119]);
assert_eq!(sampled(2, 2.0, 30.0, 1000), vec![29, 89]);
assert_eq!(sampled(2, 2.0, 30000.0 / 1001.0, 1000), vec![29, 89]);
assert_eq!(sampled(2, 2.0, 24.0, 50), vec![23, 50]);
}
/// Luma as the check reads raea's export: BT.709 weights, full range, cropped to the top-left
#[test]
fn luma_is_bt709_cropped() {
let px = |r: u8, g: u8, b: u8| [r, g, b, 255];
let rgba: Vec<u8> = [px(255, 255, 255), px(0, 0, 0), px(255, 0, 0), px(0, 255, 0)].concat();
assert_eq!(luma(&rgba, 2, 2, 2), vec![255, 0, 54, 182]);
assert_eq!(luma(&rgba, 2, 1, 2), vec![255, 54]);
}
fn finding(check: &str, frame: Option<i64>, says: &str) -> Finding {
let f = Finding::new(check, Level::Error, says, "raea check");
match frame {
Some(n) => f.frames(n, n + 1),
None => f,
}
}
/// A finding is carried when the same rule finds the same thing at the same moment, whatever its numbers say
#[test]
fn a_carried_finding_is_the_same_rule_at_the_same_moment() {
let fps = 24.0;
assert!(alike(&finding("blotching", Some(96), "worst 13%"), &finding("blotching", Some(96), "worst 15%"), fps));
assert!(alike(&finding("clipping", Some(624), "9 runs"), &finding("clipping", Some(640), "6 runs"), fps));
assert!(!alike(&finding("clipping", Some(624), "9 runs"), &finding("clipping", Some(1104), "11 runs"), fps));
assert!(!alike(&finding("clipping", Some(624), "x"), &finding("dropout", Some(624), "x"), fps));
assert!(alike(&finding("brand", None, "a"), &finding("brand", None, "b"), fps));
assert_eq!(piece("walkaround-v2"), "walkaround");
assert_eq!(piece("edit-video"), "edit-video");
assert_eq!(piece("telluride-v12"), "telluride");
}
/// A project whose record holds two renders of one composition and a check of the first: the second's check finds
/// that one, its blotching carried and its clipping new; a take under assets/ is a source, an export isn't
#[test]
fn the_earlier_check_is_of_the_composition_s_other_export() {
let dir = std::env::temp_dir().join(format!("raea-cause-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
for d in [".raea/record", "out", "assets/footage", "compositions"] {
std::fs::create_dir_all(dir.join(d)).unwrap();
}
std::fs::write(dir.join(".raea/project"), "[project]\n\tid = pj_test\n").unwrap();
for f in ["out/a-v1.mp4", "out/a-v2.mp4", "assets/footage/take.mov", "compositions/a.tsx", "compositions/a-v2.tsx"] {
std::fs::write(dir.join(f), b"").unwrap();
}
let entry = |id: &str, by: &str, of: &str, out: Option<&str>, kind: &str, findings: Vec<Finding>| record::Entry { id: id.into(), at: 0, by: by.into(), of: of.into(), out: out.map(Into::into), kind: kind.into(), commit: None, findings, despite: vec![] };
let entries = [
entry("20261116-170223-a", "raea render", "compositions/a.tsx", Some("out/a-v1.mp4"), "video", vec![]),
entry("20261116-170252-a-v1", "raea check", "out/a-v1.mp4", None, "check", vec![finding("blotching", Some(96), "worst 13%")]),
entry("20261116-171601-a-v2", "raea render", "compositions/a-v2.tsx", Some("out/a-v2.mp4"), "video", vec![]),
];
for e in &entries {
std::fs::write(dir.join(format!(".raea/record/{}.json", e.id)), serde_json::to_vec(e).unwrap()).unwrap();
}
let v2 = dir.join("out/a-v2.mp4");
assert_eq!(composition_of(&v2).map(|(_, c)| c.ends_with("compositions/a-v2.tsx")), Some(true));
let before = earlier(&v2).expect("the check of a-v1");
assert_eq!(before.of, "out/a-v1.mp4");
let mut now = vec![finding("blotching", Some(96), "worst 15%"), finding("clipping", Some(624), "9 runs")];
carried(&mut now, &before, 24.0);
assert!(now[0].says.contains("also in out/a-v1.mp4 (20261116-170252-a-v1)"), "{}", now[0].says);
assert_eq!(now[1].says, "9 runs");
// nothing was rendered before a-v1, so its check has no earlier one, even with a-v2's check in the record
assert!(earlier(&dir.join("out/a-v1.mp4")).is_none());
assert!(is_source(&dir.join("assets/footage/take.mov")));
assert!(!is_source(&v2));
let _ = std::fs::remove_dir_all(&dir);
}
+6
View File
@@ -11,5 +11,11 @@ serde_json = "1"
raea-io-home = { path = "../../../io/home" }
raea-io-media = { path = "../../../io/media", default-features = false }
raea-app-media = { path = "../../media" }
# ffmpeg's flag for every decoded frame, by its version (the one read's flashing frames)
raea-io-ffmpeg = { path = "../../../io/ffmpeg" }
# caption contrast, as `raea world` measures it (DR2)
raea-sys-measure = { path = "../../../systems/measure" }
[target.'cfg(unix)'.dependencies]
# the one read's named pipes
libc = "0.2"
+35 -4
View File
@@ -3,12 +3,14 @@
//! loudness` do, with nothing to install. 0.1.7 refused any video without FFmpeg, which Windows never has (Shane 11-18:
//! "can we make it so ffmpeg does work the way we need it?"). RAEA_CHECK_NATIVE=1 reads natively with FFmpeg there too;
//! tests/parity.rs holds the two to the same answers. Each reader names the FFmpeg command it stands in for.
pub mod once;
pub use once::{log_level, showinfo_base, showinfo_frame};
use raea_io_media::VideoDecoder;
use serde_json::Value;
use std::path::Path;
use std::process::Command;
type R<T> = Result<T, String>;
pub type R<T> = Result<T, String>;
/// Whether to read natively: FFmpeg's ffmpeg or ffprobe isn't on the PATH, or RAEA_CHECK_NATIVE is on
pub fn native() -> bool {
@@ -41,6 +43,8 @@ pub struct Probe {
/// past the picture, and the container's duration counts that
pub picture: f64,
pub audio: bool,
/// the picture's frames a second (0 when it doesn't say)
pub fps: f64,
}
/// The picture's size, the file's duration, where the picture ends and whether there's sound: ffprobe's stream and
@@ -50,7 +54,7 @@ pub fn probe(video: &str) -> R<Probe> {
let p = raea_app_media::probe_of(Path::new(video))?;
let v = p.video.as_ref().ok_or("no video stream")?;
let picture = p.track.as_ref().map_or(v.duration, |t| t.duration);
return Ok(Probe { w: v.width as f64, h: v.height as f64, duration: p.duration.max(picture), picture, audio: p.audio.is_some() });
return Ok(Probe { w: v.width as f64, h: v.height as f64, duration: p.duration.max(picture), picture, audio: p.audio.is_some(), fps: v.fps });
}
let entries = "stream=codec_type,width,height,r_frame_rate,duration,start_time:format=duration,start_time";
let out = Command::new("ffprobe").args(["-v", "error", "-show_entries", entries, "-of", "json", video]).output().map_err(|e| format!("ffprobe: {e}"))?;
@@ -65,7 +69,11 @@ pub fn probe(video: &str) -> R<Probe> {
None => last_packet_end(video).map_or(duration, |end| end - origin),
};
let audio = streams.iter().any(|s| s["codec_type"] == "audio");
Ok(Probe { w: vid["width"].as_f64().unwrap_or(1920.0), h: vid["height"].as_f64().unwrap_or(1080.0), duration, picture, audio })
let fps = vid["r_frame_rate"].as_str().and_then(|r| {
let (n, d) = r.split_once('/').unwrap_or((r, "1"));
Some(n.parse::<f64>().ok()? / d.parse::<f64>().ok().filter(|d| *d > 0.0)?)
});
Ok(Probe { w: vid["width"].as_f64().unwrap_or(1920.0), h: vid["height"].as_f64().unwrap_or(1080.0), duration, picture, audio, fps: fps.unwrap_or(0.0) })
}
/// Where the picture's last packet ends, for a container that doesn't state the video stream's own length (Matroska)
@@ -146,7 +154,30 @@ pub fn flash_frames(video: &str, w: usize, h: usize, mut each: impl FnMut(f64, &
/// `ffmpeg -i V -vn -ac 1 -ar RATE -f f32le -` (sound.rs sound): the sound folded to mono at `rate`
pub fn mono(video: &str, rate: u32) -> R<Vec<f32>> {
Ok(raea_app_media::audio_folded(Path::new(video), rate, true, None, None, false)?.channels.swap_remove(0))
if native() {
return Ok(raea_app_media::audio_folded(Path::new(video), rate, true, None, None, false)?.channels.swap_remove(0));
}
ffmpeg_f32(video, 1, rate)
}
/// `ffmpeg -i V -vn -ac N -ar R -f f32le -`: the sound as N interleaved channels of floats
fn ffmpeg_f32(video: &str, channels: u32, rate: u32) -> R<Vec<f32>> {
let out = Command::new("ffmpeg").args(["-v", "error", "-i", video, "-vn", "-ac", &channels.to_string(), "-ar", &rate.to_string(), "-f", "f32le", "-"]).output().map_err(|e| format!("ffmpeg: {e}"))?;
if !out.status.success() {
return Err(format!("ffmpeg couldn't read the sound of {video}: {}", String::from_utf8_lossy(&out.stderr).trim()));
}
Ok(out.stdout.chunks_exact(4).map(|b| f32::from_le_bytes([b[0], b[1], b[2], b[3]])).collect())
}
/// `ffmpeg -i V -vn -ac 2 -ar R -f f32le -` (defects.rs clipping): each channel at its own level. Clipping is a
/// channel's: on the mono fold (L + R) * 0.707 a centred voice reads 3 dB hotter than either side, and a master at
/// -1.6 dBTP read as full scale (11-19, the walkaround's flat tops).
pub fn channels(video: &str, rate: u32) -> R<Vec<Vec<f32>>> {
if native() {
return Ok(raea_app_media::audio_folded(Path::new(video), rate, false, None, None, false)?.channels);
}
let x = ffmpeg_f32(video, 2, rate)?;
Ok(vec![x.iter().step_by(2).copied().collect(), x.iter().skip(1).step_by(2).copied().collect()])
}
/// `ffmpeg -i V -vn -af ebur128=metadata=1,ametadata=print:key=lavfi.r128.M:file=- -f null -` (sound.rs sound): the
+205
View File
@@ -0,0 +1,205 @@
//! The picture read once for four of raea check's rules (11-19: flashing, freezes, flash frames and blotching each
//! decoded the whole file, 3.7 s apiece on a 56 s export, and decoding is the machine's whole CPU, so reading them at
//! the same time saved nothing). One FFmpeg decodes it and splits the frames into the four filter chains the rules
//! were tuned on, each to its own output with its own options as when it ran alone, so each rule reads the same bytes:
//!
//! - the flashing screen's area- and point-sampled frames (showinfo, rgb24, passthrough) to stdout, their times on stderr;
//! - freezedetect into a null output, its findings on stderr;
//! - each frame's 32x18 grey (the flash-frame rule) to a named pipe;
//! - every 2 s the grey crop blotching scores, to another.
//!
//! Unix only (named pipes); elsewhere, and where FFmpeg isn't installed, the rules read on their own as before.
#[cfg(unix)]
use std::io::{BufRead, Read};
#[cfg(unix)]
use std::path::Path;
#[cfg(unix)]
use std::process::{Command, Stdio};
use crate::R;
/// What the one read gave the rules beside the frames it handed on
pub struct Once {
/// the flashing screen's frames read, and whether one came without its time (the read was stopped)
pub frames: usize,
pub lost: bool,
/// FFmpeg ran to its end
pub ok: bool,
/// errors decoding the picture, and the first of them
pub errors: usize,
pub first: String,
/// freezedetect's lines
pub freezes: String,
/// each frame's mean brightness, 0 to 1 (defects.rs lumas)
pub lumas: Vec<f32>,
}
/// A frame's number and time from showinfo's log, exact: its `pts` in ticks of the time base. `pts_time` is rounded to six
/// significant digits, which is enough to push a legal third flash across the one-second line.
pub fn showinfo_frame(line: &str, base: Option<(i64, i64)>) -> Option<(usize, f64)> {
let rest = line.split(" n:").nth(1)?;
let n = rest.split_whitespace().next()?.parse().ok()?;
let pts: i64 = rest.split("pts:").nth(1)?.split_whitespace().next()?.parse().ok()?;
let (num, den) = base?;
Some((n, pts as f64 * num as f64 / den as f64))
}
pub fn showinfo_base(line: &str) -> Option<(i64, i64)> {
let (num, den) = line.split("config in time_base:").nth(1)?.split(',').next()?.trim().split_once('/')?;
Some((num.parse().ok()?, den.parse().ok()?))
}
/// A line's severity under `-loglevel level+`: the first bracket after any `[context @ address]`. Searching the whole line
/// would take a file's own metadata for an error when its title happens to say one.
pub fn log_level(line: &str) -> Option<&str> {
let mut rest = line.trim_start();
if rest.starts_with('[') && rest[..rest.find(']')?].contains(" @ ") {
rest = rest[rest.find(']')? + 1..].trim_start();
}
let rest = rest.strip_prefix('[')?;
Some(&rest[..rest.find(']')?])
}
/// Each 32x18 grey frame's mean brightness, 0 to 1 (`scale=32:18:flags=area,format=gray`, defects.rs lumas)
pub fn lumas_of(grey: &[u8]) -> Vec<f32> {
let mut out = Vec::with_capacity(grey.len() / (32 * 18));
for f in grey.as_chunks::<{ 32 * 18 }>().0 {
let mut sum = 0f32;
for &p in f {
sum += p as f32;
}
out.push(sum / (32.0 * 18.0 * 255.0));
}
out
}
/// Whether the four rules can read in one: FFmpeg is the reader, and the system has named pipes
pub fn can() -> bool {
cfg!(unix) && !crate::native()
}
/// The one read: the flashing screen's frames (`flash`, w x h each side) to `screen` with their times, the grey crop
/// (`crop`, w x h; None when blotching doesn't read) every 2 s to `crops`, freezedetect at `still` seconds
#[cfg(not(unix))]
pub fn picture(_: &str, _: (usize, usize), _: Option<(usize, usize)>, _: f64, _: impl FnMut(f64, &[u8]) + Send, _: impl FnMut(&[u8]) + Send) -> R<Once> {
Err("one read needs named pipes".into())
}
#[cfg(unix)]
pub fn picture(video: &str, flash: (usize, usize), crop: Option<(usize, usize)>, still: f64, mut screen: impl FnMut(f64, &[u8]) + Send, mut crops: impl FnMut(&[u8]) + Send) -> R<Once> {
let dir = std::env::temp_dir().join(format!("raea-once-{}-{}", std::process::id(), std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map_or(0, |d| d.as_nanos())));
std::fs::create_dir_all(&dir).map_err(|e| format!("{}: {e}", dir.display()))?;
let (lumas_at, crops_at) = (dir.join("lumas"), dir.join("crops"));
let read = (|| {
fifo(&lumas_at)?;
if crop.is_some() {
fifo(&crops_at)?;
}
let (w, h) = flash;
let mut graph = format!(
"[0:v:0]split={}[f][z][l]{};[f]showinfo,split=2[area][point];[area]scale={w}:{h}:flags=area[a];[point]scale={w}:{h}:flags=neighbor[p];[a][p]hstack=inputs=2,format=rgb24[fo];[z]freezedetect=n=-60dB:d={still}[zo];[l]scale=32:18:flags=area,format=gray[lo]",
if crop.is_some() { 4 } else { 3 },
if crop.is_some() { "[b]" } else { "" }
);
if let Some((cw, ch)) = crop {
graph.push_str(&format!(";[b]fps=0.5,crop={cw}:{ch}:0:0,format=gray[bo]"));
}
let sync = raea_io_ffmpeg::passthrough();
let mut args: Vec<String> = ["-hide_banner", "-nostats", "-nostdin", "-y", "-loglevel", "level+info", "-i", video, "-filter_complex", &graph].map(String::from).to_vec();
args.extend(["-map", "[fo]", sync[0], sync[1], "-f", "rawvideo", "pipe:1", "-map", "[zo]", "-f", "null", "-", "-map", "[lo]", "-f", "rawvideo"].map(String::from));
args.push(lumas_at.display().to_string());
if crop.is_some() {
args.extend(["-map", "[bo]", "-f", "rawvideo"].map(String::from));
args.push(crops_at.display().to_string());
}
let mut child = Command::new("ffmpeg").args(&args).stdin(Stdio::null()).stdout(Stdio::piped()).stderr(Stdio::piped()).spawn().map_err(|e| format!("ffmpeg: {e}"))?;
let (mut out, err) = (child.stdout.take().unwrap(), child.stderr.take().unwrap());
let (times, clock) = std::sync::mpsc::channel();
std::thread::scope(|s| {
// each output read apart from the others, so that none can fill while another is being waited on
let log = s.spawn(move || {
let (mut err, mut line) = (std::io::BufReader::new(err), Vec::new());
let (mut base, mut errors, mut first, mut freezes) = (None, 0usize, String::new(), String::new());
while err.read_until(b'\n', &mut line).is_ok_and(|n| n > 0) {
let text = String::from_utf8_lossy(&line);
if matches!(log_level(&text), Some("error" | "fatal" | "panic")) {
errors += 1;
if first.is_empty() {
first = text.trim().to_string();
}
} else if text.trim_start().starts_with("[Parsed_showinfo") {
base = showinfo_base(&text).or(base);
if let Some(frame) = showinfo_frame(&text, base) {
let _ = times.send(frame);
}
} else if text.contains("freezedetect") {
freezes.push_str(&text);
}
line.clear();
}
(errors, first, freezes)
});
let lumas = s.spawn(|| {
let mut b = Vec::new();
let _ = std::fs::File::open(&lumas_at).and_then(|mut f| f.read_to_end(&mut b));
lumas_of(&b)
});
let crop_reader = crop.map(|(cw, ch)| {
let at = &crops_at;
let crops = &mut crops;
s.spawn(move || {
if let Ok(mut f) = std::fs::File::open(at) {
let mut buf = vec![0u8; cw * ch];
while f.read_exact(&mut buf).is_ok() {
crops(&buf);
}
}
})
});
let mut buf = vec![0u8; w * 2 * h * 3];
let (mut frames, mut lost) = (0usize, false);
while out.read_exact(&mut buf).is_ok() {
// the frame's own line is written before its pixels, so one that doesn't come isn't going to
match clock.recv_timeout(std::time::Duration::from_secs(60)) {
Ok((n, t)) if n == frames => screen(t, &buf),
_ => {
lost = true;
let _ = child.kill();
break;
}
}
frames += 1;
}
drop(out);
let ok = child.wait().is_ok_and(|s| s.success());
// a pipe FFmpeg never opened (it stopped first) would hold its reader in open(): opening it to write lets go
for p in [&lumas_at, &crops_at] {
let _ = unblock(p);
}
let (errors, first, freezes) = log.join().unwrap_or_default();
let lumas = lumas.join().unwrap_or_default();
if let Some(c) = crop_reader {
let _ = c.join();
}
Ok(Once { frames, lost, ok, errors, first, freezes, lumas })
})
})();
let _ = std::fs::remove_dir_all(&dir);
read
}
#[cfg(unix)]
fn fifo(p: &Path) -> R<()> {
let c = std::ffi::CString::new(p.as_os_str().as_encoded_bytes()).map_err(|e| e.to_string())?;
// SAFETY: a NUL-terminated path, and mkfifo reads nothing else
if unsafe { libc::mkfifo(c.as_ptr(), 0o600) } != 0 {
return Err(format!("{}: {}", p.display(), std::io::Error::last_os_error()));
}
Ok(())
}
#[cfg(unix)]
fn unblock(p: &Path) -> std::io::Result<()> {
use std::os::unix::fs::OpenOptionsExt;
std::fs::OpenOptions::new().write(true).custom_flags(libc::O_NONBLOCK).open(p).map(drop)
}
+39
View File
@@ -124,3 +124,42 @@ fn the_native_reads_match_ffmpeg_s() {
}
assert!(off.0.iter().all(|(_, by, most)| by < most), "a native read is further from FFmpeg's than a rule allows");
}
/// The one read (once.rs) against the four reads it stands in for, each run alone as raea check ran it: each rule gets
/// the same bytes, frames and log lines. Away from Unix the rules read alone (no named pipes), and this is skipped.
#[test]
fn one_read_gives_each_rule_what_its_own_read_gave() {
if !raea_app_check_read::once::can() {
eprintln!("skipped: the rules read alone here");
return;
}
let dir = std::env::temp_dir().join(format!("raea-once-test-{}", std::process::id()));
std::fs::create_dir_all(&dir).unwrap();
let file = dir.join("clip.mp4").to_string_lossy().into_owned();
ffmpeg(&["-y", "-f", "lavfi", "-i", "testsrc2=size=320x180:rate=30:duration=5,tpad=stop_mode=clone:stop_duration=4", "-c:v", "libx264", "-pix_fmt", "yuv420p", &file]);
let (w, h, cw, ch) = (192usize, 108usize, 320usize, 176usize);
let (mut frames, mut crops) = (Vec::new(), Vec::new());
let once = raea_app_check_read::once::picture(&file, (w, h), Some((cw, ch)), 3.0, |t, b| frames.push((t, b.to_vec())), |b| crops.extend_from_slice(b)).unwrap();
assert!(once.ok && !once.lost && once.errors == 0);
// the flashing screen's frames, as flash.rs read them alone
let sync = raea_io_ffmpeg::passthrough();
let graph = format!("showinfo,split=2[area][point];[area]scale={w}:{h}:flags=area[a];[point]scale={w}:{h}:flags=neighbor[b];[a][b]hstack=inputs=2,format=rgb24");
let (alone, log) = ffmpeg(&["-loglevel", "level+info", "-i", &file, "-map", "0:v:0", "-vf", &graph, sync[0], sync[1], "-f", "rawvideo", "-"]);
assert_eq!(frames.len(), alone.len() / (w * 2 * h * 3));
assert_eq!(frames.iter().flat_map(|f| f.1.iter().copied()).collect::<Vec<u8>>(), alone);
let base = log.lines().find_map(raea_app_check_read::showinfo_base);
let times: Vec<f64> = log.lines().filter(|l| l.trim_start().starts_with("[Parsed_showinfo")).filter_map(|l| raea_app_check_read::showinfo_frame(l, base)).map(|f| f.1).collect();
assert_eq!(frames.iter().map(|f| f.0).collect::<Vec<f64>>(), times);
// each frame's brightness, as defects.rs read it
let (grey, _) = ffmpeg(&["-v", "error", "-i", &file, "-map", "0:v:0", "-vf", "scale=32:18:flags=area,format=gray", "-f", "rawvideo", "-"]);
assert_eq!(once.lumas, raea_app_check_read::once::lumas_of(&grey));
// blotching's crops, as picture.rs read them
let (alone, _) = ffmpeg(&["-v", "error", "-i", &file, "-vf", &format!("fps=0.5,crop={cw}:{ch}:0:0,format=gray"), "-f", "rawvideo", "-"]);
assert_eq!(crops, alone);
// and freezedetect's freeze, as sound.rs read it
let (_, log) = ffmpeg(&["-i", &file, "-an", "-vf", "freezedetect=n=-60dB:d=3", "-f", "null", "-"]);
let starts = |s: &str| s.lines().filter_map(|l| l.split("freeze_start: ").nth(1).map(|x| x.trim().to_string())).collect::<Vec<_>>();
assert_eq!(starts(&once.freezes), starts(&log));
assert!(!starts(&log).is_empty());
let _ = std::fs::remove_dir_all(&dir);
}
+27 -11
View File
@@ -11,8 +11,12 @@ pub(crate) const FULL: f32 = 0.999;
pub(crate) const FLAT_LEVEL: f32 = 0.05;
pub(crate) const CLIP_RUNS: usize = 3;
pub(crate) fn clipped(x: &[f32]) -> Vec<(f64, String)> {
let mut per: Vec<usize> = vec![0; x.len() / SR + 1];
pub(crate) fn clipped(channels: &[Vec<f32>]) -> Vec<(f64, String)> {
let len = channels.iter().map(Vec::len).max().unwrap_or(0);
let mut per: Vec<usize> = vec![0; len / SR + 1];
// each channel's runs, a second's count the most any channel had: clipping is a channel's
for x in channels {
let mut own: Vec<usize> = vec![0; len / SR + 1];
let mut i = 0;
while i < x.len() {
let v = x[i];
@@ -22,18 +26,22 @@ pub(crate) fn clipped(x: &[f32]) -> Vec<(f64, String)> {
j += 1;
}
if j - i >= 3 {
per[i / SR] += 1;
own[i / SR] += 1;
}
} else if v.abs() >= FLAT_LEVEL {
while j < x.len() && x[j].to_bits() == v.to_bits() {
j += 1;
}
if j - i >= 4 {
per[i / SR] += 1;
own[i / SR] += 1;
}
}
i = j;
}
for (p, o) in per.iter_mut().zip(own) {
*p = (*p).max(o);
}
}
let mut out = Vec::new();
let mut s = 0;
while s < per.len() {
@@ -123,20 +131,28 @@ fn lumas(video: &str) -> R<(Vec<f32>, f64)> {
if !out.status.success() {
return Err(format!("ffmpeg couldn't read the picture of {video}: {}", String::from_utf8_lossy(&out.stderr).trim()));
}
let l = out.stdout.as_chunks::<{ 32 * 18 }>().0.iter().map(|f| f.iter().map(|&p| p as f32).sum::<f32>() / (32.0 * 18.0 * 255.0)).collect();
Ok((crate::read::once::lumas_of(&out.stdout), ffmpeg_rate(video)?))
}
/// The frame rate `ffmpeg -i` says
pub(crate) fn ffmpeg_rate(video: &str) -> R<f64> {
let rate = ffmpeg_stderr(&["-hide_banner", "-i", video])?;
let fps = rate.split(" fps").next().and_then(|s| s.rsplit(", ").next()).and_then(|s| s.trim().parse().ok()).unwrap_or(30.0);
Ok((l, fps))
Ok(rate.split(" fps").next().and_then(|s| s.rsplit(", ").next()).and_then(|s| s.trim().parse().ok()).unwrap_or(30.0))
}
pub(crate) fn flash_frame_rule(video: &str, issues: &mut Vec<Issue>, passed: &mut Vec<String>) -> R<()> {
let (l, fps) = lumas(video)?;
let found = flash_frames(&l, fps);
flash_frame_from(&l, fps, issues, passed);
Ok(())
}
/// The stray frames each frame's brightness shows
pub(crate) fn flash_frame_from(l: &[f32], fps: f64, issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
let found = flash_frames(l, fps);
if found.is_empty() {
passed.push("flash-frame: no stray black or white frame".into());
}
issues.extend(moments("flash-frame", 1, found));
Ok(())
}
/// Each moment a rule found, as an issue of that priority
@@ -145,8 +161,8 @@ pub(crate) fn moments(rule: &'static str, p: u8, found: Vec<(f64, String)>) -> i
}
/// The sound's defects on the decoded mix (sound.rs decodes it once)
pub(crate) fn sound_defects(x: &[f32], issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
for (rule, found, ok) in [("clipping", clipped(x), "clipping: no flat-topped runs"), ("dropout", dropouts(x), "dropout: the sound never drops to silence and back")] {
pub(crate) fn sound_defects(x: &[f32], channels: &[Vec<f32>], issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
for (rule, found, ok) in [("clipping", clipped(channels), "clipping: no flat-topped runs"), ("dropout", dropouts(x), "dropout: the sound never drops to silence and back")] {
if found.is_empty() {
passed.push(ok.into());
}
+34 -23
View File
@@ -5,35 +5,46 @@ use raea_app_check_flash::FlashScreen;
/// the area sample and the point sample side by side
const FLASH_W: usize = 192;
/// A frame's number and time from showinfo's log, exact: its `pts` in ticks of the time base. `pts_time` is rounded to six
/// significant digits, which is enough to push a legal third flash across the one-second line.
pub(crate) fn showinfo_frame(line: &str, base: Option<(i64, i64)>) -> Option<(usize, f64)> {
let rest = line.split(" n:").nth(1)?;
let n = rest.split_whitespace().next()?.parse().ok()?;
let pts: i64 = rest.split("pts:").nth(1)?.split_whitespace().next()?.parse().ok()?;
let (num, den) = base?;
Some((n, pts as f64 * num as f64 / den as f64))
pub(crate) use crate::read::{log_level, showinfo_base, showinfo_frame};
/// The flashing screen's frame height for the picture's shape
fn flash_h(probe: &Probe) -> usize {
(((FLASH_W as f64 * probe.h / probe.w.max(1.0)) / 2.0).round() as usize * 2).max(6)
}
pub(crate) fn showinfo_base(line: &str) -> Option<(i64, i64)> {
let (num, den) = line.split("config in time_base:").nth(1)?.split(',').next()?.trim().split_once('/')?;
Some((num.parse().ok()?, den.parse().ok()?))
}
/// A line's severity under `-loglevel level+`: the first bracket after any `[context @ address]`. Searching the whole line
/// would take a file's own metadata for an error when its title happens to say one.
pub(crate) fn log_level(line: &str) -> Option<&str> {
let mut rest = line.trim_start();
if rest.starts_with('[') && rest[..rest.find(']')?].contains(" @ ") {
rest = rest[rest.find(']')? + 1..].trim_start();
/// Freezes, flashing, flash frames and blotching, in that order, from one read of the picture (raea-app-check-read
/// once.rs: one decode where there were four); each reads on its own where one read can't be had
pub(crate) fn picture_rules(video: &str, probe: &Probe, taste: Option<&Taste>, issues: &mut Vec<Issue>, passed: &mut Vec<String>) -> R<()> {
if !crate::read::once::can() {
freezes(video, probe, taste, issues, passed)?;
flashing(video, probe, issues, passed)?;
flash_frame_rule(video, issues, passed)?;
return blotching(video, probe, issues, passed);
}
let rest = rest.strip_prefix('[')?;
Some(&rest[..rest.find(']')?])
let (w, h) = (FLASH_W, flash_h(probe));
let kept = x264_kept(video);
let (cw, ch) = (probe.w as usize / 8 * 8, probe.h as usize / 8 * 8);
let mut screen = FlashScreen::new(w, h);
let mut scores = Vec::new();
let once = crate::read::once::picture(video, (w, h), kept.is_none().then_some((cw, ch)), taste.map_or(3.0, |t| t.value), |t, buf| screen.push(buf, t), scorer(&mut scores, cw, ch))?;
freezes_from(&once.freezes, probe, taste, issues, passed);
if once.lost {
return Err(format!("{video}: flashing can't be screened, frame {} has no timestamp of its own", once.frames));
}
if !once.ok || once.frames == 0 {
return Err(format!("{video}: flashing can't be screened, FFmpeg decoded {} frames ({})", once.frames, once.first));
}
screened(screen, once.errors, &once.first, issues, passed);
flash_frame_from(&once.lumas, ffmpeg_rate(video)?, issues, passed);
match kept {
Some(crf) => passed.push(format!("blotching: encoded by x264 at crf {crf}, which keeps the darks")),
None => blotching_from(video, probe, &scores, issues, passed),
}
Ok(())
}
pub(crate) fn flashing(video: &str, probe: &Probe, issues: &mut Vec<Issue>, passed: &mut Vec<String>) -> R<()> {
let w = FLASH_W;
let h = (((w as f64 * probe.h / probe.w.max(1.0)) / 2.0).round() as usize * 2).max(6);
let (w, h) = (FLASH_W, flash_h(probe));
if crate::read::native() {
let mut screen = FlashScreen::new(w, h);
if crate::read::flash_frames(video, w, h, |t, buf| screen.push(buf, t))? == 0 {
+17 -23
View File
@@ -22,8 +22,10 @@ mod flash;
use flash::*;
mod defects;
use defects::*;
mod text;
use text::*;
/// what a render's text breaks, from its manifest (split out: a render holds its own text to it)
use raea_app_check_text::*;
/// who can fix what it finds: the encode's or the picture's own, carried from an earlier export, a source
use raea_app_check_cause as cause;
/// a video read through FFmpeg, or raea's own decoders where it isn't installed
use raea_app_check_read::{self as read, Probe};
pub mod quick;
@@ -32,15 +34,6 @@ pub use raea_app_check_inbox as inbox;
#[cfg(test)]
mod tests;
type R<T> = Result<T, String>;
#[derive(Clone)]
struct Issue {
rule: &'static str,
p: u8,
at: Option<f64>,
says: String,
}
/// `raea check …` with the person's taste, none or more (taste.ts and the kinds beside it, which the raea CLI evaluates: it owns the engine):
/// its rules' checks hold the export to the person's own lines.
@@ -159,14 +152,17 @@ fn measured(args: &[String], taste: Vec<Taste>) -> R<(String, Vec<Issue>, Vec<St
loudness(&video, taste_of(&taste, "loudness"), &mut issues, &mut passed)?;
sound(&video, words.as_deref(), &mut issues, &mut passed)?;
}
freezes(&video, &probe, taste_of(&taste, "still-max"), &mut issues, &mut passed)?;
flashing(&video, &probe, &mut issues, &mut passed)?;
flash_frame_rule(&video, &mut issues, &mut passed)?;
blotching(&video, &probe, &mut issues, &mut passed)?;
picture_rules(&video, &probe, taste_of(&taste, "still-max"), &mut issues, &mut passed)?;
brand_kit(&[flag(args, "--manifest").unwrap_or(""), video.as_str()], &mut issues, &mut passed);
if let Some(p) = flag(args, "--things") {
things(p, &mut issues, &mut passed)?;
}
// a take or a download isn't a delivery: the mix sets the delivery's level, so its own is said, not held to the target
if cause::is_source(std::path::Path::new(&video)) {
for i in issues.iter_mut().filter(|i| i.rule == "loudness") {
(i.p, i.says) = (3, format!("a source, not a delivery: {} (the mix sets the delivery's level)", i.says));
}
}
if let Some(manifest) = &manifest {
let runs = text_runs(manifest);
let (w, h) = (manifest["width"].as_f64().unwrap_or(probe.w), manifest["height"].as_f64().unwrap_or(probe.h));
@@ -204,19 +200,17 @@ fn things(p: &str, issues: &mut Vec<Issue>, passed: &mut Vec<String>) -> R<()> {
/// `fps`), with `more` (a render's own), worst first then by time.
fn findings_of(mut issues: Vec<Issue>, more: Vec<Finding>, fps: f64) -> Vec<Finding> {
issues.sort_by(|a, b| a.p.cmp(&b.p).then(a.at.unwrap_or(0.0).total_cmp(&b.at.unwrap_or(0.0))));
let mut found = Vec::new();
for i in &issues {
// an issue at a second is about the frame it falls on
let (f, fr) = (Finding::new(i.rule, Level::of_rank(i.p), &i.says, "raea check"), (i.at.unwrap_or(0.0) * fps).round() as i64);
found.push(if i.at.is_some() { f.frames(fr, fr + 1) } else { f });
}
finding::ranked(found.into_iter().chain(more).collect())
finding::ranked(issues.iter().map(|i| i.finding("raea check", fps)).chain(more).collect())
}
/// The findings (`findings_of`), written to -o as JSON when asked, and the report's text with the count last. True
/// when an error is among them.
fn report(video: &str, issues: Vec<Issue>, more: Vec<Finding>, passed: Vec<String>, out: Option<&str>, fps: f64) -> R<(String, bool)> {
let found = findings_of(issues, more, fps);
let mut found = findings_of(issues, more, fps);
// what an earlier export of the same composition already had says so: the change between them didn't move it
if let Some(e) = cause::earlier(std::path::Path::new(video)) {
cause::carried(&mut found, &e, fps);
}
let bad = found.iter().any(|f| f.level == Level::Error);
if let Some(out) = out {
let j = json!({"file": video, "fps": fps, "findings": found, "passed": passed});
+94 -27
View File
@@ -101,30 +101,41 @@ pub(crate) fn x264_crf(head: &[u8]) -> Option<f64> {
/// in its darks is the picture's own (8-bit glows and faint panels), which blotch_score can't always tell apart
pub(crate) const X264_KEEPS: f64 = 16.0;
pub(crate) fn blotching(video: &str, probe: &Probe, issues: &mut Vec<Issue>, passed: &mut Vec<String>) -> R<()> {
/// How far a clean encode moves a sample's blotching (x264 crf 12 over the walkaround's unencoded frames, 11-19: at most 0.005)
pub(crate) const BLOTCH_NOISE: f64 = 0.005;
/// Blotching's samples against the same frames of the composition drawn without encoding (raea-app-check-cause): None
/// when the video isn't a render in a raea project's record
fn blotching_cause(video: &str, probe: &Probe, scores: &[Option<f64>], w: usize, h: usize) -> Option<R<(cause::Against, Vec<Option<f64>>)>> {
let (project, comp) = cause::composition_of(std::path::Path::new(video))?;
Some((|| {
if probe.fps <= 0.0 {
return Err("the video doesn't say its frame rate".to_string());
}
let frames = cause::sampled(scores.len(), 2.0, probe.fps, (probe.picture * probe.fps).round() as i64 - 1);
let me = std::env::current_exe().map_err(|e| e.to_string())?;
let before: Vec<Option<f64>> = cause::unencoded(&me, &project, &comp, &frames, w, h)?.iter().map(|y| blotch_score(y, w, h)).collect();
Ok((cause::against(scores, &before, BLOTCHY, BLOTCH_NOISE), before))
})())
}
/// The crf an x264 encode that keeps the darks was made at: blotching isn't read for it
pub(crate) fn x264_kept(video: &str) -> Option<f64> {
let mut head = Vec::new();
if let Ok(f) = std::fs::File::open(video) {
let _ = std::io::Read::read_to_end(&mut std::io::Read::take(f, 8 << 20), &mut head);
}
if let Some(crf) = x264_crf(&head).filter(|c| *c <= X264_KEEPS) {
x264_crf(&head).filter(|c| *c <= X264_KEEPS)
}
pub(crate) fn blotching(video: &str, probe: &Probe, issues: &mut Vec<Issue>, passed: &mut Vec<String>) -> R<()> {
if let Some(crf) = x264_kept(video) {
passed.push(format!("blotching: encoded by x264 at crf {crf}, which keeps the darks"));
return Ok(());
}
let (w, h) = (probe.w as usize / 8 * 8, probe.h as usize / 8 * 8);
let (mut bad, mut seen, mut worst, mut t) = (Vec::new(), 0, 0f64, 0.0);
let mut frame = |buf: &[u8]| {
if let Some(s) = blotch_score(buf, w, h) {
seen += 1;
worst = worst.max(s);
if std::env::var_os("RAEA_CHECK_DEBUG").is_some() {
eprintln!("blotch {t:6.1}s {s:.3}");
}
if s > BLOTCHY {
bad.push((t, s));
}
}
t += 2.0;
};
let mut scores: Vec<Option<f64>> = Vec::new();
let mut frame = scorer(&mut scores, w, h);
if crate::read::native() {
crate::read::crops(video, w, h, &mut frame)?;
} else {
@@ -140,21 +151,77 @@ pub(crate) fn blotching(video: &str, probe: &Probe, issues: &mut Vec<Issue>, pas
}
let _ = child.wait();
}
drop(frame);
blotching_from(video, probe, &scores, issues, passed);
Ok(())
}
/// Each grey crop's blotching, kept in `scores`
pub(crate) fn scorer(scores: &mut Vec<Option<f64>>, w: usize, h: usize) -> impl FnMut(&[u8]) + Send + '_ {
move |buf| scores.push(blotch_score(buf, w, h))
}
/// What blotching's samples (one every 2 s) found
pub(crate) fn blotching_from(video: &str, probe: &Probe, scores: &[Option<f64>], issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
let (w, h) = (probe.w as usize / 8 * 8, probe.h as usize / 8 * 8);
let (mut bad, mut seen, mut worst) = (Vec::new(), 0, 0f64);
for (k, s) in scores.iter().enumerate() {
let Some(s) = *s else { continue };
let t = k as f64 * 2.0;
seen += 1;
worst = worst.max(s);
if std::env::var_os("RAEA_CHECK_DEBUG").is_some() {
eprintln!("blotch {t:6.1}s {s:.3}");
}
if s > BLOTCHY {
bad.push((t, s));
}
}
if !bad.is_empty() {
let at = bad[0].0;
let share = bad.len() as f64 / seen.max(1) as f64;
issues.push(Issue {
rule: "blotching",
p: if share > 0.2 { 1 } else { 2 },
at: Some(at),
says: format!(
"blocky patches in dark areas in {} of {seen} sampled frames (worst {:.0}% of dark blocks stepping); the encoder starved the near-blacks: export as PNG frames and encode with more bits for darks",
bad.len(),
worst * 100.0
),
});
let found = format!("blocky patches in dark areas in {} of {seen} sampled frames (worst {:.0}% of dark blocks stepping)", bad.len(), worst * 100.0);
let (p, at, says) = match blotching_cause(video, probe, scores, w, h) {
// what the composition draws before any encoding is the picture's own (a phone's compression): no render
// setting removes it, so it's said, not worked on
Some(Ok(a)) if !a.0.by_encode(BLOTCH_NOISE) => (3, Some(at), format!("{found}: the picture's own, there as the composition draws them before any encoding (the footage's compression); the encode added none, so no render setting removes them")),
Some(Ok(a)) => {
let first = cause::Against::first(scores, &a.1, BLOTCHY, BLOTCH_NOISE).map(|i| i as f64 * 2.0);
let own = if a.0.before > 0 { format!("; {} of the samples show the footage's own too, which stays", a.0.before) } else { String::new() };
(if a.0.worse as f64 / a.0.of.max(1) as f64 > 0.2 { 1 } else { 2 }, first.or(Some(at)), format!("the encode added blocky patches in dark areas: {} of {} samples are blotchier than the composition draws them unencoded; render with --quality master, which gives the darks the bits they need{own}", a.0.worse, a.0.of))
}
Some(Err(why)) => (if share > 0.2 { 1 } else { 2 }, Some(at), format!("{found}; whether the encode made them or the picture holds them couldn't be told ({why}): render with --quality master if the encode starved the darks")),
None => (if share > 0.2 { 1 } else { 2 }, Some(at), format!("{found}: the encode starved the near-blacks, or the footage holds them; render with --quality master, and check a render made in a raea project to tell which")),
};
issues.push(Issue { rule: "blotching", p, at, says });
} else if seen > 0 {
passed.push(format!("blotching: dark areas clean in {seen} sampled frames"));
}
Ok(())
}
/// Caption contrast: at each text's middle frame, the pixels behind it against its colour, at least 3:1. The pixels
/// behind are the half of the box least like the text.
pub(crate) fn contrast(video: &str, runs: &[Run], w: f64, h: f64, probe: &Probe, issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
let (sx, sy) = (probe.w / w, probe.h / h);
let mut low = 0;
let mut measured = 0;
for r in runs.iter().filter(|r| r.size >= 20.0).take(80) {
let [x, y, bw, bh] = r.box_;
let crop = [(x * sx).max(0.0) as u32, (y * sy).max(0.0) as u32, (bw * sx) as u32, (bh * sy) as u32];
if crop[0] + crop[2] > probe.w as u32 || crop[1] + crop[3] > probe.h as u32 {
continue;
}
let t = (r.from + r.to) / 2.0;
// the same measure `raea world` joins to a text from its render (raea-sys-measure, DR2)
let ratio = if crate::read::native() { crate::read::contrast(video, t, crop, &r.color) } else { raea_sys_measure::contrast(std::path::Path::new(video), t, crop, &r.color) };
let Some(ratio) = ratio else { continue };
measured += 1;
if ratio < 3.0 {
low += 1;
issues.push(Issue { rule: "contrast", p: 1, at: Some(t), says: format!("{} is {ratio:.1}:1 against what's behind it; make it at least 3:1 (a band, a shadow for separation, or another colour)", quote(&r.text)) });
}
}
if measured > 0 && low == 0 {
passed.push(format!("contrast: {measured} texts at 3:1 or better against their pixels"));
}
}
+10 -12
View File
@@ -162,17 +162,9 @@ pub(crate) fn bed_up(rms: &[f64], speak: &[bool]) -> Vec<(f64, String)> {
/// The sound's rules on an export: dead stops always; with the voice's words, a stretch with no voice over it and a bed
/// too close under it
pub(crate) fn sound(video: &str, words: Option<&[Word]>, issues: &mut Vec<Issue>, passed: &mut Vec<String>) -> R<()> {
let x = if crate::read::native() {
crate::read::mono(video, SR as u32)?
} else {
let out = Command::new("ffmpeg").args(["-v", "error", "-i", video, "-vn", "-ac", "1", "-ar", &SR.to_string(), "-f", "f32le", "-"]).output().map_err(|e| format!("ffmpeg: {e}"))?;
if !out.status.success() {
return Err(format!("ffmpeg couldn't read the sound of {video}: {}", String::from_utf8_lossy(&out.stderr).trim()));
}
out.stdout.chunks_exact(4).map(|b| f32::from_le_bytes([b[0], b[1], b[2], b[3]])).collect()
};
let x = crate::read::mono(video, SR as u32)?;
let (rms, bands) = levels(&x);
sound_defects(&x, issues, passed);
sound_defects(&x, &crate::read::channels(video, SR as u32)?, issues, passed);
let found = |list: Vec<(f64, String)>, p: u8| crate::defects::moments("sound", p, list);
let stops = dead_stops(&rms, &bands);
if stops.is_empty() {
@@ -273,7 +265,14 @@ pub(crate) fn freezes(video: &str, probe: &Probe, taste: Option<&Taste>, issues:
} else {
ffmpeg_stderr(&["-hide_banner", "-nostats", "-i", video, "-an", "-vf", &format!("freezedetect=n=-60dB:d={most}"), "-f", "null", "-"])?
};
let stretches = frozen_stretches(&err, probe.picture);
freezes_from(&err, probe, taste, issues, passed);
Ok(())
}
/// The freezes freezedetect's lines found (`taste`'s still-max when the person set one, else 3 s)
pub(crate) fn freezes_from(err: &str, probe: &Probe, taste: Option<&Taste>, issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
let most = taste.map_or(3.0, |t| t.value);
let stretches = frozen_stretches(err, probe.picture);
for &(s, d) in &stretches {
let says = format!("nothing changes for {d:.1} s; give it a reason to hold, or cut it shorter");
issues.push(match taste {
@@ -284,5 +283,4 @@ pub(crate) fn freezes(video: &str, probe: &Probe, taste: Option<&Taste>, issues:
if stretches.is_empty() {
passed.push(format!("frozen: nothing holds still for {most} s"));
}
Ok(())
}
+12 -4
View File
@@ -356,15 +356,23 @@ fn a_card_sharing_one_word_with_another_line_isnt_held_to_it() {
fn clipping_is_found_and_a_loud_clean_tone_isnt() {
// a clean tone near full scale, then the same tone clamped (a limiter's flat tops), then pushed past full scale
let loud = tone(3.0, &[(0.0, 3.0, -1.0)]);
assert!(clipped(&loud).is_empty(), "{:?}", clipped(&loud));
let one = |x: &[f32]| clipped(&[x.to_vec()]);
assert!(one(&loud).is_empty(), "{:?}", one(&loud));
let clamped: Vec<f32> = loud.iter().map(|v| (v * 10.0).clamp(-0.3, 0.3)).collect();
assert_eq!(clipped(&clamped).len(), 1);
assert_eq!(one(&clamped).len(), 1);
let over: Vec<f32> = loud.iter().map(|v| (v * 2.0).clamp(-1.0, 1.0)).collect();
assert_eq!(clipped(&over).len(), 1);
assert_eq!(one(&over).len(), 1);
// one transient hitting full scale once isn't clipping
let mut once = tone(3.0, &[(0.0, 3.0, -20.0)]);
once[SR] = 1.0;
assert!(clipped(&once).is_empty());
assert!(one(&once).is_empty());
// clipping is a channel's: one side clipped is found; a centred voice at -1.6 dBFS a side is clean, though the mono
// fold (L + R) * 0.707 takes it past full scale (11-19: the walkaround's master read as clipping)
assert_eq!(clipped(&[loud.clone(), over.clone()]).len(), 1);
let centred: Vec<f32> = loud.iter().map(|v| v * 0.92).collect();
assert!(clipped(&[centred.clone(), centred.clone()]).is_empty());
let folded: Vec<f32> = centred.iter().map(|v| (v + v) * 0.7071).collect();
assert_eq!(one(&folded).len(), 1);
}
#[test]
+13
View File
@@ -0,0 +1,13 @@
[package]
name = "raea-app-check-text"
version = "0.1.0"
edition = "2024"
license = "FSL-1.1-ALv2"
publish = false
description = "raea check's text rules on a render's manifest: clipped, UI zones, reading time, face, cues, brand kit"
[dependencies]
dunce = "1"
serde_json = "1"
# a transcript's words, read as `raea world` reads them (docs/direction.feature DR1)
raea-core-facts = { path = "../../../core/facts" }
@@ -1,25 +1,56 @@
use super::*;
//! What a render's text breaks, from its manifest alone: clipped, in the platform's UI zones, too brief to read, over
//! the face, off its cue, and the brand kit it was styled from. raea check's text rules, split out of raea-app-check so
//! `raea render --manifest` holds its own text to them as it finishes, a check's round sooner.
use serde_json::Value;
pub type R<T> = Result<T, String>;
use raea_core_facts::{Finding, Level};
/// One thing a rule found: its rule, its rank (P0 breaks the piece to P3 polish), when (seconds) and what to do.
#[derive(Clone, Debug)]
pub struct Issue {
pub rule: &'static str,
pub p: u8,
pub at: Option<f64>,
pub says: String,
}
impl Issue {
/// As a Finding `by` a command (docs/direction.feature DR3: P0 and P1 errors, P2 a warn, P3 a note), about the
/// frame its second falls on at `fps`
pub fn finding(&self, by: &str, fps: f64) -> Finding {
let f = Finding::new(self.rule, Level::of_rank(self.p), &self.says, by);
match self.at {
Some(t) => {
let n = (t * fps).round() as i64;
f.frames(n, n + 1)
}
None => f,
}
}
}
/// A text as it stays on screen: from the frame it comes on to the frame it leaves. Typing (a text growing into the
/// next) and counting (only its digits changing) are one run, judged by its last text.
#[derive(Clone)]
pub(crate) struct Run {
pub(crate) text: String,
pub(crate) from: f64,
pub(crate) to: f64,
pub(crate) box_: [f64; 4],
pub struct Run {
pub text: String,
pub from: f64,
pub to: f64,
pub box_: [f64; 4],
/// where its letters are on every frame it shows its whole text (the manifest's `ink`, else its box: a centred line in
/// a full-width box is nowhere near x = 0, #89): a text the camera carries (a sign on a panning street) moves
/// through the frame's edges and zones, which only counts against it when no frame shows it clear
pub(crate) boxes: Vec<[f64; 4]>,
pub(crate) color: String,
pub(crate) size: f64,
pub boxes: Vec<[f64; 4]>,
pub color: String,
pub size: f64,
}
/// The brand kit the cut was styled from (brand/ at or above the manifest's or the video's folder, as render finds
/// brand.css): a kit `raea brand` read from a thin fetch that nobody corrected by hand is a placeholder, P1; a brand.css
/// with no brand.json beside it wasn't read from the brand at all, P2
pub(crate) fn brand_kit(near: &[&str], issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
pub fn brand_kit(near: &[&str], issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
let mut seen = std::collections::HashSet::new();
for start in near.iter().filter(|p| !p.is_empty()) {
let abs = dunce::canonicalize(&std::path::Path::new(start)).unwrap_or_else(|_| std::path::PathBuf::from(start));
@@ -50,7 +81,7 @@ pub(crate) fn brand_kit(near: &[&str], issues: &mut Vec<Issue>, passed: &mut Vec
}
}
pub(crate) fn text_runs(manifest: &Value) -> Vec<Run> {
pub fn text_runs(manifest: &Value) -> Vec<Run> {
let fps = manifest["fps"].as_f64().unwrap_or(30.0);
let frames = manifest["frames"].as_array().cloned().unwrap_or_default();
let mut open: Vec<Run> = Vec::new();
@@ -95,11 +126,11 @@ pub(crate) fn text_runs(manifest: &Value) -> Vec<Run> {
}
/// The share of the face's area a text may cover before it's a fault (@raea/video's proofBoxes keeps the same 8%)
pub(crate) const FACE_COVER: f64 = 0.08;
pub const FACE_COVER: f64 = 0.08;
/// The face over time from a perception.json (`raea cut`: each clip's first frame, the face at its middle in the
/// edit's px): [from, to) in seconds and the face's box, for the stretches that have one
pub(crate) fn faces_of(perception: &Value, fps: f64) -> Vec<(f64, f64, [f64; 4])> {
pub fn faces_of(perception: &Value, fps: f64) -> Vec<(f64, f64, [f64; 4])> {
let mut keys: Vec<(f64, Option<[f64; 4]>)> = perception.as_object().into_iter().flatten().filter_map(|(k, v)| {
let face = v["face"].as_object().map(|f| ["x", "y", "w", "h"].map(|n| f.get(n).and_then(Value::as_f64).unwrap_or(0.0)));
Some((k.parse::<f64>().ok()? / fps, face))
@@ -110,7 +141,7 @@ pub(crate) fn faces_of(perception: &Value, fps: f64) -> Vec<(f64, f64, [f64; 4])
/// Text over the face: a run that covers more than FACE_COVER of the face's area while that face is up, on every frame
/// that shows it whole (a text the camera carries counts only when no frame shows it clear)
pub(crate) fn face_cover(runs: &[Run], faces: &[(f64, f64, [f64; 4])], issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
pub fn face_cover(runs: &[Run], faces: &[(f64, f64, [f64; 4])], issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
let share = |b: &[f64; 4], f: &[f64; 4]| {
let ox = (b[0] + b[2]).min(f[0] + f[2]) - b[0].max(f[0]);
let oy = (b[1] + b[3]).min(f[1] + f[3]) - b[1].max(f[1]);
@@ -134,7 +165,7 @@ pub(crate) fn face_cover(runs: &[Run], faces: &[(f64, f64, [f64; 4])], issues: &
}
/// the zones where text can't go, as [top, right, bottom, left] at 1080 wide (sdk/guides/craft/floor.md)
pub(crate) fn zones(w: f64, h: f64, shape: Option<&str>, platform: Option<&str>) -> [f64; 4] {
pub fn zones(w: f64, h: f64, shape: Option<&str>, platform: Option<&str>) -> [f64; 4] {
let r = w / h;
let shape = shape.unwrap_or(if r < 0.7 { "9:16" } else if r < 0.9 { "4:5" } else if r < 1.2 { "1:1" } else { "16:9" });
let z = match (shape, platform) {
@@ -153,12 +184,12 @@ pub(crate) fn zones(w: f64, h: f64, shape: Option<&str>, platform: Option<&str>)
/// A caption the voice reads out: every word of the text is said while it's on screen (from a little before it comes
/// on). The viewer hears it as it shows, so it needs no reading time of its own (karaoke groups are up for as long as
/// they take to say).
pub(crate) fn spoken(r: &Run, words: &[Word]) -> bool {
pub fn spoken(r: &Run, words: &[Word]) -> bool {
let tokens: Vec<String> = r.text.split_whitespace().map(norm).filter(|t| !t.is_empty()).collect();
!tokens.is_empty() && tokens.iter().all(|t| words.iter().any(|w| norm(&w.text) == *t && w.start >= r.from - 0.3 && w.start <= r.to + 0.1))
}
pub(crate) fn text_rules(runs: &[Run], heard: Option<&[Word]>, w: f64, h: f64, shape: Option<&str>, platform: Option<&str>, issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
pub fn text_rules(runs: &[Run], heard: Option<&[Word]>, w: f64, h: f64, shape: Option<&str>, platform: Option<&str>, issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
let [zt, zr, zb, zl] = zones(w, h, shape, platform);
let (mut clipped, mut unsafe_, mut brief) = (0, 0, 0);
for r in runs {
@@ -194,57 +225,30 @@ pub(crate) fn text_rules(runs: &[Run], heard: Option<&[Word]>, w: f64, h: f64, s
}
}
pub(crate) fn quote(s: &str) -> String {
pub fn quote(s: &str) -> String {
let s: String = s.chars().take(40).collect();
format!("\u{201c}{s}\u{201d}")
}
/// Caption contrast: at each text's middle frame, the pixels behind it against its colour, at least 3:1. The pixels
/// behind are the half of the box least like the text.
pub(crate) fn contrast(video: &str, runs: &[Run], w: f64, h: f64, probe: &Probe, issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
let (sx, sy) = (probe.w / w, probe.h / h);
let mut low = 0;
let mut measured = 0;
for r in runs.iter().filter(|r| r.size >= 20.0).take(80) {
let [x, y, bw, bh] = r.box_;
let crop = [(x * sx).max(0.0) as u32, (y * sy).max(0.0) as u32, (bw * sx) as u32, (bh * sy) as u32];
if crop[0] + crop[2] > probe.w as u32 || crop[1] + crop[3] > probe.h as u32 {
continue;
}
let t = (r.from + r.to) / 2.0;
// the same measure `raea world` joins to a text from its render (raea-sys-measure, DR2)
let ratio = if crate::read::native() { crate::read::contrast(video, t, crop, &r.color) } else { raea_sys_measure::contrast(std::path::Path::new(video), t, crop, &r.color) };
let Some(ratio) = ratio else { continue };
measured += 1;
if ratio < 3.0 {
low += 1;
issues.push(Issue { rule: "contrast", p: 1, at: Some(t), says: format!("{} is {ratio:.1}:1 against what's behind it; make it at least 3:1 (a band, a shadow for separation, or another colour)", quote(&r.text)) });
}
}
if measured > 0 && low == 0 {
passed.push(format!("contrast: {measured} texts at 3:1 or better against their pixels"));
}
}
/// A transcript's word: its text, start and end in seconds (its end is its start when the transcript doesn't say).
pub(crate) use raea_core_facts::Word;
pub use raea_core_facts::Word;
/// A transcript's words (raea_core_facts::transcript_words: {text, start} in seconds, or t, start_ms, or {text, from}
/// in frames at `fps`), as the app's words.json and `raea render --words` have them.
pub(crate) fn transcript(path: &str, fps: f64) -> R<Vec<Word>> {
pub fn transcript(path: &str, fps: f64) -> R<Vec<Word>> {
let v: Value = serde_json::from_str(&std::fs::read_to_string(path).map_err(|e| format!("{path}: {e}"))?).map_err(|e| format!("{path}: {e}"))?;
v.as_array().ok_or_else(|| format!("{path}: expected an array of words ({{text, start}} in seconds or {{text, from}} in frames)"))?;
Ok(raea_core_facts::transcript_words(&v, fps))
}
pub(crate) use raea_core_facts::word_key as norm;
pub use raea_core_facts::word_key as norm;
pub(crate) const SMALL: [&str; 24] = ["the", "and", "you", "your", "for", "with", "that", "this", "its", "it's", "are", "was", "our", "out", "from", "into", "then", "than", "but", "not", "all", "can", "has", "have"];
pub const SMALL: [&str; 24] = ["the", "and", "you", "your", "for", "with", "that", "this", "its", "it's", "are", "was", "our", "out", "from", "into", "then", "than", "but", "not", "all", "can", "has", "have"];
/// Cues land on their words: a text whose words the voice says nearby comes on with the first of them, not after it.
/// The text is found by its first word of weight, and then measured from the first word it shows: a caption "of the
/// spend" comes on with "of", when the voice says "of the" just before "spend".
pub(crate) fn cues(runs: &[Run], words: &[Word], issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
pub fn cues(runs: &[Run], words: &[Word], issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
let (mut checked, mut off) = (0, 0);
for r in runs {
let shown: Vec<String> = r.text.split_whitespace().map(norm).filter(|t| !t.is_empty()).collect();
+2
View File
@@ -19,6 +19,8 @@ serde_json = "1"
# project's compositions
raea-core-brief = { path = "../../core/brief" }
raea-app-check = { path = "../check" }
# the check's text rules, held to a video render's manifest as it ends
raea-app-check-text = { path = "../check/text" }
raea-app-registry = { path = "../workspace/registry" }
# the project's notes, whose asks' checks raea check runs beside its rules (DR6)
raea-app-notes = { path = "../notes" }
+45 -1
View File
@@ -38,7 +38,7 @@ pub fn rendered(args: &[String]) -> i32 {
if args.first().map(String::as_str) != Some("render") {
return 0;
}
let found = finding::taken();
let mut found = finding::taken();
let through = despite(args, std::env::var("RAEA_DESPITE").ok());
let excused: Vec<Despite> = through.iter().map(|(c, w)| Despite { check: c.clone(), why: w.clone() }).collect();
let out = raea_runtime_bundle::flag(args, "-o").or_else(|| raea_runtime_bundle::flag(args, "--review")).map(PathBuf::from);
@@ -46,6 +46,13 @@ pub fn rendered(args: &[String]) -> i32 {
let manifest = raea_runtime_bundle::flag(args, "--manifest").map(PathBuf::from).or_else(|| Some(raea_runtime_world::manifest_for(out.as_deref()?, std::path::Path::new(args.get(1)?))));
if let Some(m) = manifest {
if let Some(mut v) = std::fs::read(&m).ok().and_then(|b| serde_json::from_slice::<Value>(&b).ok()) {
// a video's text, held to the check's text rules as it finishes, a check's round sooner
if out.as_deref().and_then(|o| o.extension()).is_some_and(|x| x == "mp4" || x == "mov") {
for f in text_found(&v) {
println!("{}", f.line());
found.push(f);
}
}
v["findings"] = json!(found);
if !excused.is_empty() {
v["despite"] = json!(excused);
@@ -63,6 +70,26 @@ pub fn rendered(args: &[String]) -> i32 {
code
}
/// What a video render's text breaks, from its manifest (raea-app-check-text, the rules `raea check` holds it to): text
/// off the frame is an error, as the check has it; text in a UI zone a warn, by the default zones, since the platform's
/// are the check's to decide (`--platform`); reading time waits for the check, which has the transcript to tell a
/// caption the voice reads out from one that has to be read.
fn text_found(manifest: &Value) -> Vec<Finding> {
let runs = raea_app_check_text::text_runs(manifest);
let (w, h, fps) = (manifest["width"].as_f64().unwrap_or(1080.0), manifest["height"].as_f64().unwrap_or(1920.0), manifest["fps"].as_f64().unwrap_or(30.0));
let (mut issues, mut passed) = (Vec::new(), Vec::new());
raea_app_check_text::text_rules(&runs, None, w, h, None, None, &mut issues, &mut passed);
let mut found = Vec::new();
for mut i in issues.into_iter().filter(|i| i.rule != "reading") {
if i.rule == "safe-area" {
i.p = 2;
i.says.push_str(" (by the default zones: `raea check --platform P` holds it to the platform's)");
}
found.push(i.finding("raea render", fps));
}
found
}
#[cfg(test)]
mod tests {
use super::*;
@@ -71,6 +98,23 @@ mod tests {
v.iter().map(|a| a.to_string()).collect()
}
/// A video's text off the frame fails its render, as the check fails it; text in a UI zone is a warn by the
/// default zones; a word on screen too briefly is left to the check, which has the transcript
#[test]
fn a_video_render_holds_its_text_to_the_check_s_rules() {
let text = |t: &str, b: [f64; 4]| json!({"text": t, "box": b, "opacity": 1.0, "size": 60.0, "color": "rgb(255, 255, 255)"});
let frames: Vec<Value> = (0..48).map(|f| json!({"frame": f, "videos": [], "text": [
text("OFF THE EDGE", [900.0, 800.0, 400.0, 80.0]),
text("Per month", [700.0, 1233.0, 318.0, 44.0]),
if f < 3 { text("Two words", [200.0, 900.0, 300.0, 80.0]) } else { json!({"text": "", "box": [0, 0, 0, 0]}) },
]})).collect();
let found = text_found(&json!({"width": 1080, "height": 1920, "fps": 24, "frames": frames}));
let got: Vec<(&str, Level)> = found.iter().map(|f| (f.check.as_str(), f.level)).collect();
assert_eq!(got, vec![("clipped", Level::Error), ("safe-area", Level::Warn)], "{found:?}");
assert!(found[1].says.contains("--platform"));
assert_eq!(found[0].frames, Some([0, 1]));
}
#[test]
fn an_error_fails_the_render_unless_it_is_let_through_and_says_by_what() {
let found = vec![Finding::new("clips", Level::Error, "rider in seat", "raea render"), Finding::new("tilted", Level::Warn, "vase leans", "raea render")];
+5
View File
@@ -32,6 +32,11 @@ pub const USAGE: &str = "raea export-game EDIT.tsx -o OUT [--target mac-app|mac-
/// `raea export-game EDIT.tsx -o OUT ...`
pub fn export(args: &[String]) -> R<String> {
// its targets are a Mac's, signed with codesign, and raea's Windows and Linux releases carry no game player: there
// it said "no player ... (build it: cargo build ...)", which a person can't act on
if !cfg!(target_os = "macos") {
return Err("raea export-game makes a Mac game (an .app or a command) and runs on a Mac; Windows and Linux games aren't there yet (sdk/react/docs/game-export.md)".into());
}
let usage = USAGE;
let tsx = PathBuf::from(args.get(1).filter(|a| !a.starts_with("--")).ok_or(usage)?);
let tsx = dunce::canonicalize(&tsx).map_err(|e| format!("{}: {e}", tsx.display()))?;
+1 -1
View File
@@ -145,7 +145,7 @@ pub fn export(args: &[String]) -> R<(Layers, String)> {
let tsx = args.first().filter(|a| !a.starts_with('-')).ok_or(USAGE)?;
let tsx = dunce::canonicalize(PathBuf::from(tsx)).map_err(|e| format!("{tsx}: {e}"))?;
let edit_dir = tsx.parent().unwrap().to_path_buf();
let codec = flag(args, "--alpha-codec").map_or(Ok(raea_io_alpha::Codec::default_here()), |c| raea_io_alpha::Codec::parse(&c))?;
let codec = raea_io_alpha::Codec::chosen(flag(args, "--alpha-codec").as_deref())?;
let name = named(args, &tsx);
let dir = flag(args, "-o").map_or_else(|| edit_dir.join("out/layers").join(&name), PathBuf::from);
std::fs::create_dir_all(&dir).map_err(|e| format!("{}: {e}", dir.display()))?;
+16
View File
@@ -402,3 +402,19 @@ fn a_pan_inside_its_box_is_keyed() {
let dw = 3840.0 * 1920.0 / 2160.0;
assert!(near(centre(&from), (dw / 2.0 - 540.0) / 1080.0) && near(centre(&to), -(dw / 2.0 - 540.0) / 1080.0));
}
#[test]
fn a_windows_path_is_a_file_url_an_editor_opens() {
// #195: 0.1.8-rc8 wrote file://localhostD%3A%5CWork%5C... for D:\Work\...; Resolve imported the same XML at once with
// file:///D:/Work/...
use crate::xml::pathurl;
use std::path::Path;
assert_eq!(pathurl(Path::new(r"D:\Work\_research\raea\xmltest\public\clip.mp4")), "file:///D:/Work/_research/raea/xmltest/public/clip.mp4");
assert_eq!(pathurl(Path::new(r"\\?\C:\Users\Jürgen\my clip.mp4")), "file:///C:/Users/J%C3%BCrgen/my%20clip.mp4");
assert_eq!(pathurl(Path::new("C:/Users/me/out/xml/edit/graphics.rle.mov")), "file:///C:/Users/me/out/xml/edit/graphics.rle.mov");
assert_eq!(pathurl(Path::new(r"\\nas\clips\a.mp4")), "file://nas/clips/a.mp4");
assert_eq!(pathurl(Path::new(r"\\?\UNC\nas\clips\a.mp4")), "file://nas/clips/a.mp4");
// a Mac's or Linux's as before, a backslash there being part of a name
assert_eq!(pathurl(Path::new("/Users/me/my clip.mp4")), "file://localhost/Users/me/my%20clip.mp4");
assert_eq!(pathurl(Path::new(r"/tmp/a\b.mp4")), "file://localhost/tmp/a%5Cb.mp4");
}
+25 -7
View File
@@ -57,14 +57,32 @@ fn esc(s: &str) -> String {
}
/// A file's path as xmeml's pathurl: file://localhost and the absolute path, each byte outside the unreserved set
/// percent-encoded.
fn pathurl(p: &Path) -> String {
let mut out = String::from("file://localhost");
for b in p.to_string_lossy().bytes() {
if b.is_ascii_alphanumeric() || b"/-_.~".contains(&b) {
out.push(b as char);
/// percent-encoded. A Windows path is made a URL as a path, not as text (#195: 0.1.8-rc8 wrote
/// file://localhostD%3A%5CWork%5C..., which Resolve refused): a drive's is file:///D:/Work/clip.mp4, the form Resolve
/// opened, and a share's file://nas/clips/clip.mp4, each with its separators as slashes and Windows' \\?\ prefix off.
pub(crate) fn pathurl(p: &Path) -> String {
let s = p.to_string_lossy();
let s = match (s.strip_prefix(r"\\?\UNC\"), s.strip_prefix(r"\\?\")) {
(Some(share), _) => format!(r"\\{share}"),
(None, Some(local)) => local.to_string(),
_ => s.into_owned(),
};
let b = s.as_bytes();
let drive = b.len() >= 3 && b[0].is_ascii_alphabetic() && b[1] == b':' && matches!(b[2], b'\\' | b'/');
let (mut out, rest, windows) = if drive {
(format!("file:///{}:", b[0] as char), &b[2..], true)
} else if let Some(share) = s.strip_prefix(r"\\") {
(String::from("file://"), share.as_bytes(), true)
} else {
(String::from("file://localhost"), b, false)
};
for &c in rest {
if windows && c == b'\\' {
out.push('/');
} else if c.is_ascii_alphanumeric() || b"/-_.~".contains(&c) {
out.push(c as char);
} else {
let _ = write!(out, "%{b:02X}");
let _ = write!(out, "%{c:02X}");
}
}
out
+2
View File
@@ -10,6 +10,8 @@ description = "A person's notes on a project as files the work is held to (docs/
# Note and Ask, the project found by its .raea/project, and the world a note is an entity in
raea-core-facts = { path = "../../core/facts" }
raea-io-home = { path = "../../io/home" }
# the H.264 encoder this machine's ffmpeg has, for a clip a person plays (raea_io_ffmpeg::h264)
raea-io-ffmpeg = { path = "../../io/ffmpeg" }
# when a run of an ask's check was (UTC), as raea check stamps its record
raea-io-trace = { path = "../../io/trace" }
# what each ask has been through, kept as JSON (state.rs)
+2 -1
View File
@@ -131,7 +131,8 @@ fn cut(out: &Path, [a, b]: [i64; 2], fps: f64, to: &Path) -> R<()> {
}
let (from, len) = (format!("{:.4}", a as f64 / fps), format!("{:.4}", (b - a) as f64 / fps));
let args = ["-hide_banner", "-loglevel", "error", "-y", "-ss", &from, "-i"];
let o = std::process::Command::new("ffmpeg").args(args).arg(out).args(["-t", &len, "-c:v", "libx264", "-pix_fmt", "yuv420p", "-c:a", "aac"]).arg(to).output().map_err(|e| format!("ffmpeg: {e}"))?;
let h264 = raea_io_ffmpeg::h264().ok_or("ffmpeg here has no H.264 encoder (libx264, Windows' h264_mf or VideoToolbox's) to cut the clip with")?;
let o = std::process::Command::new("ffmpeg").args(args).arg(out).args(["-t", &len]).args(h264).args(["-c:a", "aac"]).arg(to).output().map_err(|e| format!("ffmpeg: {e}"))?;
if !o.status.success() {
return Err(format!("ffmpeg: {}", String::from_utf8_lossy(&o.stderr).trim()));
}
+2
View File
@@ -11,6 +11,8 @@ dunce = "1"
# the controller schema (core/brief controller.rs): a controller file is checked and normalized against it
raea-core-brief = { path = "../../core/brief" }
raea-io-home = { path = "../../io/home" }
# git, which a workspace is: the PATH's, else on Windows the app's or raea's own (raea_io_assets::git)
raea-io-assets = { path = "../../io/assets" }
serde_json = "1"
# a project's compositions, components and controllers read from their source (docs/projects.feature PJ8)
raea-app-registry = { path = "registry" }
+3 -3
View File
@@ -62,10 +62,10 @@ pub(crate) fn overrides(from: &Path) -> Vec<(String, String)> {
}
fn commit(ws: &Path, paths: &[&Path], what: &str, by: &str) -> R<()> {
let mut add = Command::new("git");
let mut add = Command::new(workspace::program());
add.arg("-C").arg(ws).args(["add", "-A", "--"]).args(paths);
add.status().map_err(|e| format!("git: {e}"))?;
let ok = workspace::git_cmd().arg("-C").arg(ws).args(["-c", &format!("user.name={by}"), "commit", "-q", "-m", &format!("{by}: {what}"), "--"]).args(paths).status().map_err(|e| format!("git: {e}"))?;
add.status().map_err(workspace::missing)?;
let ok = workspace::git_cmd().arg("-C").arg(ws).args(["-c", &format!("user.name={by}"), "commit", "-q", "-m", &format!("{by}: {what}"), "--"]).args(paths).status().map_err(workspace::missing)?;
if ok.success() { Ok(()) } else { Err(format!("couldn't commit {what}")) }
}
+26 -6
View File
@@ -13,7 +13,7 @@ const USAGE: &str = "usage: raea workspace [--json] | raea workspace init [NAME]
/// full name (a CI runner's, a container's) has no name either ("empty ident name ... not allowed"), and git has no
/// fallback below user.name to give it, so when no user.name is set the author and committer are named for the account.
pub(crate) fn git_cmd() -> Command {
let mut c = Command::new("git");
let mut c = Command::new(program());
let user = std::env::var("USER").unwrap_or_else(|_| "raea".into());
if std::env::var_os("EMAIL").is_none() {
c.env("EMAIL", format!("{user}@raea.local"));
@@ -24,14 +24,33 @@ pub(crate) fn git_cmd() -> Command {
c
}
/// The git raea runs (raea_io_assets::git: the PATH's, else on Windows the app's or raea's own, fetched once), found
/// once a process; "git" when there's none, its spawn then failing as `missing` says.
fn found() -> &'static Result<std::path::PathBuf, String> {
static GIT: std::sync::OnceLock<Result<std::path::PathBuf, String>> = std::sync::OnceLock::new();
GIT.get_or_init(raea_io_assets::git)
}
pub(crate) fn program() -> std::path::PathBuf {
found().clone().unwrap_or_else(|_| "git".into())
}
/// A git that didn't start, said as why: there's no git here (and how to get one), or what the system said
pub(crate) fn missing(e: std::io::Error) -> String {
match found() {
Err(why) if e.kind() == std::io::ErrorKind::NotFound => why.clone(),
_ => format!("git: {e}"),
}
}
/// Whether git has a user.name to sign commits with (asked once a process).
fn has_name() -> bool {
static HAS: std::sync::OnceLock<bool> = std::sync::OnceLock::new();
*HAS.get_or_init(|| Command::new("git").args(["config", "--get", "user.name"]).output().is_ok_and(|o| o.status.success() && !o.stdout.trim_ascii().is_empty()))
*HAS.get_or_init(|| Command::new(program()).args(["config", "--get", "user.name"]).output().is_ok_and(|o| o.status.success() && !o.stdout.trim_ascii().is_empty()))
}
pub(crate) fn git(dir: &Path, args: &[&str]) -> R<String> {
let out = git_cmd().arg("-C").arg(dir).args(args).output().map_err(|e| format!("git: {e}"))?;
let out = git_cmd().arg("-C").arg(dir).args(args).output().map_err(missing)?;
if !out.status.success() {
return Err(format!("git {}: {}", args.join(" "), String::from_utf8_lossy(&out.stderr).trim()));
}
@@ -40,12 +59,12 @@ pub(crate) fn git(dir: &Path, args: &[&str]) -> R<String> {
/// `git config` on a file (or the global config when `file` is None), its output trimmed; Err when git says no.
pub(crate) fn config(file: Option<&Path>, args: &[&str]) -> R<String> {
let mut c = Command::new("git");
let mut c = Command::new(program());
c.arg("config");
if let Some(f) = file {
c.arg("-f").arg(f);
}
let out = c.args(args).output().map_err(|e| format!("git: {e}"))?;
let out = c.args(args).output().map_err(missing)?;
if !out.status.success() {
return Err(format!("git config {}: {}", args.join(" "), String::from_utf8_lossy(&out.stderr).trim()));
}
@@ -111,7 +130,8 @@ pub fn default_root(home: &Path) -> PathBuf {
if home.join("Library/Mobile Documents/com~apple~CloudDocs/Documents").is_dir() {
home.join("raea")
} else {
home.join("Documents/raea")
// a folder at a time: on Windows "Documents/raea" printed as C:\Users\you\Documents/raea\...
home.join("Documents").join("raea")
}
}
+7
View File
@@ -7,3 +7,10 @@ pub mod color;
pub mod easing;
pub mod interpolate;
pub mod spring;
/// 0 below `a`, 1 above `b`, and between them the cubic Hermite ease (WGSL's smoothstep), for a value that fades in
/// over a range rather than a key's time.
pub fn smoothstep(a: f32, b: f32, x: f32) -> f32 {
let t = ((x - a) / (b - a)).clamp(0.0, 1.0);
t * t * (3.0 - 2.0 * t)
}
+2
View File
@@ -176,6 +176,8 @@ the adopt-0.20 pass (2026-10-22); stills in that pass's report. Anything not lis
its formats), so a base colour would be averaged in gamma, not linear light; panels need premultiplied averages; and
CompressedImageSaver runs only in Bevy's asset processing (lossy BC7/ASTC through ctt), not on images loaded at run
time. Goes for baked assets once lightspeed's bake (F5) runs CompressedImageSaver; mip_chain stays for run-time images.
Its feature (compressed_image_saver) is out of the build since 0.1.8: ctt's AVX2 encoders run C++ initializers before
main on any CPU, so the bake has to bring it back without them (sdk/raea/docs/bevy-plugins.md).
- rt.rs (the traced-AO and passes' BLAS/TLAS) beside bevy_solari's scene layer. Solari's binder skips any mesh that
isn't u32-indexed with exactly position, normal, UV0 and tangent and `enable_raytracing` (raea's own shapes are
unindexed), and writes ray mask 0xFF on every instance (rt.rs's CASTS bit keeps NotShadowCaster stand-ins out of sun
+11
View File
@@ -353,3 +353,14 @@ notes and is worth shipping without it: a person gets word scores, checks and bo
5. **CLAP joins the stack** (Shane, 11-12: "include clap if we can if its not too much work"). It is about 300 lines
of Rust on ort: the 48 kHz log-mel front end and the audio session (200), and the text tower with its tokenizer
(100), run only when an axis's words change. Both are checked against the spike's vectors at cosine 0.999.
6. **Pro and Studio include checks and content intelligence** (Shane, 11-20). Each month's pool (about 8,000 frames
checked on Pro, ten times that on Studio) stops when it's spent and is never billed past. It pays for two things:
- **clef-omni answering the fingerprint's questions** about a render's frames (`POST /v1/clef/ask`), so the agent
reads answers in words and opens only the frames they flag. Its verdicts are another eye's (FP6d), and it serves
the axes with no labels yet.
- **content intelligence for references** (`GET /v1/intel/...`): public posts, videos, transcripts and ads, to find
a videoform's references by what performs and keep them current (docs/videoform.md). A source's views and
engagement are another eye's evidence too, never the person's taste. A reference found this way is still read
once, as VF1 reads any link, and VF1's rights confirmation still applies.
Without a pool, everything here still works locally, and clef runs on the person's own Cloudflare account.
+13 -4
View File
@@ -54,8 +54,11 @@ By default the bitrate follows the size and frame rate: about 20 Mbit/s at 1080p
`--quality` asks for constant quality: each frame gets the bits it needs, so a flat motion graphic stays small and a
busy one stays clean.
Blotchy dark areas come from the encoder, not the composition. Export dark material as PNG frames and encode them
with more bits for the darks:
Blotchy dark areas come from the encoder, or from the footage itself: a phone's own compression shows in its darks.
When `raea check` finds them on a render made in a raea project, it draws the composition again at the frames it
sampled, without encoding, and tells the two apart. The picture's own is a note, since no render setting removes it.
What the encode added is the error, and `--quality master` gives the darks the bits they need. To hand dark material on
as frames instead, export PNG frames:
```sh
RAEA_READBACK=rgba raea render piece.tsx -o frames/
@@ -106,8 +109,14 @@ out of order, a phrase `word()` can't find, or a missing prop.
## Loudness
When the composition has a `<Mix>`, the export comes out at -14 LUFS integrated (within 1) with true peak at or below
-1 dBTP, which is what the major platforms play back at.
raea mixes and masters every render's sound. First the mix: each line of dialogue (a clip on the `voice` bus, or
footage's own sound on no bus) is measured over the part of its take it plays and brought to the same level, so no line
is louder or quieter than the next. Room tone and silent takes keep their level, and so do music, effects and anything
on another bus, which sit under the dialogue as their buses set them. A clip's `gainDb` is an offset on top of the
level. Then the master: a leveller rounds the loud passages, the whole piece comes up to its loudness, and a true-peak
limiter holds it at the ceiling. A join that drops into dead silence gets the room's own tone. The export comes out at
-14 LUFS integrated (within 1) with true peak at or below -1 dBTP, which is what the major platforms play back at;
`<Mix lufs={…} ceiling={…}>` sets another target.
## Mistakes to avoid
+7
View File
@@ -27,6 +27,13 @@ the platform's buttons, captions held too briefly and caption contrast. The tran
word and music fighting the voice; the perception adds text over a face. A taste file adds the person's own rules,
each an error when broken, since their rule beats the floor's default.
On a render made in a raea project, the check also uses the project's record. A finding an earlier export of the
same composition had at the same moment ends `[also in …]`: the change between them didn't move it, so don't do that
again; try something else, or say why it stands. A rule an encode can cause (blotching) is measured again on the
composition drawn without encoding, so what the footage already holds is a note and only what the encode added is an
error. A take or a download under the project's `assets/` or `media/` is a source, not a delivery: its loudness is
reported as a note, since the mix sets the delivery's level.
## Every rule a project holds
On a project, or a composition's file, with no `--quick`, `raea check` runs every rule that applies to each
+3 -4
View File
@@ -271,9 +271,8 @@ Used in: [3d/fog_volumes](https://github.com/shinyobjectz/raea/blob/main/sdk/rae
### `WearExtension`
raea's chips, grime and rust over a StandardMaterial, as an ExtendedMaterial's extension (systems/wear):
Bevy: `bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_wear::Wear>>`.
raea's chips, grime and rust over a StandardMaterial, as an ExtendedMaterial's extension: a surface shader of
raea's own (worn.ts) on the hook a ShaderExtension uses, so its Bevy type is ShaderExtension's.
| Prop | Type | What it does |
| --- | --- | --- |
@@ -792,7 +791,7 @@ where density and heat come in: a burner, or an engine moving `at` -> `to` (a co
### `WearExtensionProps`
raea's extension of StandardMaterial that wears it (the engine's Wear MaterialExtension, systems/wear): its paint
raea's extension of StandardMaterial that wears it (a surface shader of raea's own, worn.ts): its paint
mottled, chipped back to `chip_color` on edges and a few spots, `grime` gathered low and underneath and `rust` run
down in streaks, fixed in the part's own space as it moves. `amount` 0-1; `chips`, `grime` and `rust` each 0-1 of it
(0.6, 0.5, 0.25); `scale` a blotch's size in metres (0.08); `seed` moves the pattern. It goes in an
+2 -2
View File
@@ -127,8 +127,8 @@ cargo build --release -p raea-cli # the binary is target/release/raea
| System | Status |
|---|---|
| macOS on Apple Silicon | Supported |
| Linux on x86_64 | Supported. raea needs ALSA and fontconfig (Ubuntu 24.04 and Debian: `apt install libasound2t64 libfontconfig1`; `libasound2` before 24.04). An app's window needs a display (X11, Wayland, or Xvfb on a server) |
| Windows 10 and 11 on x86_64 | Supported through `install.ps1` |
| Linux on x86_64 | Supported, on a processor with AVX (most from 2011 on) and glibc 2.39 or newer (Ubuntu 24.04, Debian 13, Fedora 40 and later). raea needs ALSA and fontconfig (Ubuntu 24.04 and Debian: `apt install libasound2t64 libfontconfig1`; `libasound2` before 24.04). An app's window needs a display (X11, Wayland, or Xvfb on a server) |
| Windows 10 and 11 on x86_64 | Supported through `install.ps1`, on any x86_64 processor |
| Intel Macs, Linux on ARM | Not yet |
raea draws on the GPU through Metal on the Mac, Vulkan on Linux, and DirectX 12 or Vulkan on Windows. Intel graphics
+36 -11
View File
@@ -1,7 +1,7 @@
---
title: "raea 0.1.8"
version: "0.1.8"
date: "2026-11-18"
date: "2026-11-19"
summary: "raea on Windows works: agents install and connect, phone and camera video plays, the local models set themselves up, and the installer asks where to go. Also your edit as layers for CapCut, Premiere and Resolve, labels on what agents show you, and a lighter app."
sources: ["https://github.com/shinyobjectz/raea/releases/tag/v0.1.8"]
---
@@ -24,8 +24,11 @@ On Windows, in PowerShell: `irm https://raea.io/install.ps1 | iex`.
## What changed since 0.1.7
**raea on Windows works.**
- ChatGPT, Claude, Gemini, OpenCode and Kimi install and connect on a Windows PC. A workspace is made even when Git
isn't installed.
- Nothing needs installing first, and nothing has to download. The app carries what raea needs from outside it:
Git, FFmpeg, uv (which sets up the local models) and Microsoft's Visual C++ runtime, so it works on a work PC
that blocks downloads. Before, raea.exe wouldn't start without the Visual C++ Redistributable, and a workspace
couldn't be made without Git.
- ChatGPT, Claude, Gemini, OpenCode and Kimi install and connect on a Windows PC.
- The app calls your PC a PC: Ctrl, not ⌘, everywhere, the whiteboard too.
- The installer asks where raea goes. It suggests a folder in your own profile, takes any empty folder you can
write to (or the folder raea is already in), and says why it won't use one that already holds other files. An update goes
@@ -35,14 +38,31 @@ On Windows, in PowerShell: `irm https://raea.io/install.ps1 | iex`.
(#155) and on Intel's integrated graphics. 3D on DirectX 12 is now drawn as on a Mac; with `WGPU_BACKEND=dx12`
set by hand, 0.1.7 drew a scene's shapes into one another.
- A phone's or a camera's video plays, probes and checks. raea's own decoders read H.264 without B-frames, which is
what raea writes. The first time you open a video they can't read (most phone and camera footage: H.264 with
B-frames, HEVC, VP9), raea fetches FFmpeg once, about 114 MB, and checks it before use. Nothing needs installing
first.
what raea writes, and the FFmpeg in the app reads the rest (most phone and camera footage: H.264 with B-frames,
HEVC, VP9). It's built from FFmpeg's own source with no GPL part (FFmpeg's code and libvpx's decoders, for
WebM with transparency), so its licence is the LGPL, and its source is published beside raea's releases. A clip
raea cuts for you to play, such as `raea notes check`'s, uses Windows' own H.264 encoder. With raea from the zip and no FFmpeg on the PC, raea fetches
the same build once and checks it before use.
- Agents' npm tools and MCP servers start without a shell, and their arguments arrive as written in folders with
spaces or letters outside ASCII.
- raea starts on a PC whose processor has no AVX2, such as an Intel Core from 2011 or 2012 (#110). The ONNX Runtime
raea linked was built for newer processors and stopped raea.exe before it did anything. raea now loads Microsoft's
own build when a model first runs, and it picks its code for the processor it finds.
- Workspaces work (#169). raea wrote Windows' `\\?\` form of a folder's path into a workspace's `.git/config`, so
every Git command in it failed and the app couldn't finish its first run, and a workspace's folder came out
doubled when `raea.root` wasn't set. On a PC whose only Git is the app's, or none at all, `raea workspace`,
`project` and `controller` use the app's Git or Git for Windows, or fetch raea's own once.
- The app no longer crashes at launch with a stack overflow (#112, #124). Its page host has the 8 MB stack it has on a
Mac, and turns a file's bytes into text a piece at a time.
- What your agent runs through raea understands Windows. `raea show` finds the app wherever the installer put it,
starts it, opens files in Explorer, and no longer says it opened them "in the Mac's own viewer". `raea init`,
`show`, `cut` and `brand` take `C:\` and `\\server\share` paths, which they used to treat as relative ones.
- Numbers, money and dates format on Windows and Linux. `toLocaleString` and `Intl` in a composition threw "Intl is
not defined" there; they now give the Mac's answers, in English and 40 other languages.
- `--quality master` keeps a dark background that changes slowly, such as a glow drifting over black, clean. It came
out blotchy before.
- raea starts on a PC whose processor has no AVX2, such as an Intel Core from 2011 or 2012 (#110), or no AVX at all,
such as a Celeron or Pentium from 2016 to 2019 or a Core from 2008 to 2010. Two things stopped raea.exe before it
did anything. The ONNX Runtime raea linked was built for newer processors: raea now loads Microsoft's own build when
a model first runs, and it picks its code for the processor it finds. And Bevy's texture compressors, which raea
never used, set up their AVX2 tables at start on every processor: they're no longer in raea.
**Local models with nothing installed first.** Stable Audio Open's sound effects, matchmove (`raea track`),
Gaussian splats (`raea splat train`), liquids and TokenSynth's instruments set themselves up on a Mac, Windows or
@@ -87,7 +107,10 @@ frame, on Windows too.
- raea/wear weathers a model by what weathers it. `wearBake` (and `raea wear bake`) works out once where rain
reaches and runs, where the sun falls, what people touch and how high each point stands over the street.
`wearShader` draws soot, stains, damp, rust, peeling paint and worn edges by material (plaster, brick, stone, wood,
iron and nine more), with the season's rain, snow, dust or leaves over them.
iron and nine more), with the season's rain, snow, dust or leaves over them. `WEAR_CONDITIONS` holds eight ready
ones, from spring's damp to a thunderstorm's soaking, and `weatherAt` changes the weather during a shot: a front
darkens over the minutes rain takes to soak it and dries over the hour after, snow settles and frost forms, and any
frame can be drawn alone. examples/materials/wear shows each condition by day and at dusk.
- `raea check` reads a video without FFmpeg. Where FFmpeg isn't installed, raea's own readers stand in, held to
FFmpeg's answers.
- `raea gen`: a fal step sends the resolution and aspect ratio its model takes, an image edit's mask reaches the
@@ -99,9 +122,11 @@ frame, on Windows too.
(MIT).
**Known**
- On Linux, raea needs a processor with AVX (most from 2011 on) and glibc 2.39 or newer (Ubuntu 24.04, Debian 13,
Fedora 40 and later).
- On Windows with Intel or AMD graphics, DirectX 12 compiles 3D shaders more slowly, so a 3D render can take
about 15 seconds longer to start.
- TokenSynth installs on Windows but hasn't been run end to end there yet, and it runs on the CPU there.
- On Windows, TokenSynth runs on the CPU, so each note takes a minute or more to make.
- A seek while a film plays in the timeline can show one frame from before the seek (about 33 ms) before it jumps.
- A long 4K `raea render` can still hang before its first frame (#158).
- Characters (the Character SDK) come in a later release.
+3 -4
View File
@@ -14,7 +14,7 @@ reaches it yet).
| area | kind | tier 1 | tier 2 | tier 3 | not rendered | SVG attribute only | blocked upstream | excluded | unmapped | total |
|---|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|
| bevy | asset | 9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 9 |
| bevy | component | 61 | 869 | 0 | 0 | 0 | 0 | 1 | 0 | 931 |
| bevy | component | 60 | 869 | 0 | 0 | 0 | 0 | 1 | 0 | 930 |
| bevy | event | 0 | 13 | 0 | 0 | 0 | 0 | 0 | 0 | 13 |
| bevy | message | 0 | 40 | 0 | 0 | 0 | 0 | 0 | 0 | 40 |
| bevy | resource | 4 | 86 | 0 | 0 | 0 | 0 | 1 | 0 | 91 |
@@ -23,9 +23,9 @@ reaches it yet).
| css | shorthand | 60 | 0 | 0 | 11 | 0 | 0 | 0 | 0 | 71 |
| element | html | 113 | 0 | 0 | 0 | 0 | 0 | 18 | 0 | 131 |
| plugin | declared | 0 | 0 | 53 | 0 | 0 | 21 | 0 | 3 | 77 |
| **all** | | **495** | **1009** | **53** | **55** | **14** | **21** | **21** | **3** | **1671** |
| **all** | | **494** | **1009** | **53** | **55** | **14** | **21** | **21** | **3** | **1670** |
Reached (tiers 1-3): **1557**. The ratchet (`tools/sdk-coverage --check`, in tools/agents/check) keeps it from dropping.
Reached (tiers 1-3): **1556**. The ratchet (`tools/sdk-coverage --check`, in tools/agents/check) keeps it from dropping.
## Bevy types (the plugin build's TypeRegistry)
@@ -624,7 +624,6 @@ Reached (tiers 1-3): **1557**. The ratchet (`tools/sdk-coverage --check`, in too
| `bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_look::paint::Paint>>` | component | 2 | bevy.MeshMaterial3dExtendedMaterialStandardMaterialPaint (raea/plugins/bevy) |
| `bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_material::toon::ToonExt>>` | component | 2 | bevy.MeshMaterial3dExtendedMaterialStandardMaterialToonExt (raea/plugins/bevy) |
| `bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_shader::ShaderExt>>` | component | 1 | SurfaceShader (sdk/render/src/3d/materials.tsx) |
| `bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_wear::Wear>>` | component | 1 | WearExtension (sdk/render/src/bevy3d/extensions.tsx) |
| `bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::pbr_material::StandardMaterial>` | component | 1 | Mesh3d (sdk/render/src/bevy3d/core.tsx) |
| `bevy_pbr::mesh_material::MeshMaterial3d<bevy_trenchbroom::special_textures::QuakeSkyMaterial>` | component | 2 | bevy.MeshMaterial3dQuakeSkyMaterial (raea/plugins/bevy) |
| `bevy_pbr::mesh_material::MeshMaterial3d<raea_sys_fog::fire::FireMaterial>` | component | 2 | bevy.MeshMaterial3dFireMaterial (raea/plugins/bevy) |
-1
View File
@@ -593,7 +593,6 @@ bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMat
bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_look::paint::Paint>> component
bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_material::toon::ToonExt>> component
bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_shader::ShaderExt>> component
bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_wear::Wear>> component
bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::pbr_material::StandardMaterial> component
bevy_pbr::mesh_material::MeshMaterial3d<bevy_trenchbroom::special_textures::QuakeSkyMaterial> component
bevy_pbr::mesh_material::MeshMaterial3d<raea_sys_fog::fire::FireMaterial> component
1 # The plugin build's TypeRegistry: every component, resource, event, message, state and asset (tools/sdk-coverage --registry)
593 bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_look::paint::Paint>>
594 bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_material::toon::ToonExt>>
595 bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_shader::ShaderExt>>
bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_wear::Wear>>
596 bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::pbr_material::StandardMaterial>
597 bevy_pbr::mesh_material::MeshMaterial3d<bevy_trenchbroom::special_textures::QuakeSkyMaterial>
598 bevy_pbr::mesh_material::MeshMaterial3d<raea_sys_fog::fire::FireMaterial>
+252
View File
@@ -0,0 +1,252 @@
@spec
Feature: Videoform: the kind of video a person makes again and again, read once from their own finished videos, followed and checked on every cut
The person, 2026-11-19: an agency or creator "making the same type of video over and over again can drop in a bunch
of those videos, and raea codifies that style so the user can then drop a bucket of raw footage and raea with great
accuracy and intent edits the raw footage into the exact style it has learned ... and it all needs to happen FAST".
Then: the embedding route, on the models raea ships; "the point is to embed them, store the embeds, and be able to
repeat the style without having to go back to the references themselves"; a videoform is "a kind of fingerprint,
flowing into what has already been built". The plan, its decisions and why: docs/videoform.md.
The model this file sets:
1. A videoform is a fingerprint (docs/fingerprint.feature FP14) with a `videoform` section: its context, its
references, its vocabulary, its template and its rules. It's found, inherited, taught and shared as a
fingerprint is.
2. Each part flows into the part of raea that does that job already: its ranges into its profile (FP6e), its rules
into the section's `rules`, each in a taste line's shape (words, a check, its values, a level; DR4, DR8), its
structure into a NAME.script.ts template, its references into brief.ts's `references` shape.
3. A reference is read once, from the local drive or streamed from a URL, and never needed again: its per-shot rows,
its vocabulary's vectors, its ranges, its structure and its rules are all that following and checking read.
4. What stays the same across the references is the videoform; what varies is content. A rule's strength is its
consistency, and every videoform is tested leave one out.
5. What ships runs on the models raea ships, on the person's machine. The domain vocabulary is written by the
person's own AI. No paid model API is in the product.
6. Checks start from the composition: a videoform's rules run in `raea check PROJECT` before any render, and
embeddings only for shots that changed.
Start here (the order of work, and where it touches what exists):
- The order: VF1 and VF2 (a reference in, a videoform made), VF3 (each reference read once into the kept rows), then
VF4 with VF12 (the ranges, judged on the test bench). That pair is the gate: it passes on at least five of the
person's sets before VF1b's platform pages or anything in VF9-VF11 is built.
- New crates hold the work: raea-app-videoform (apps/videoform: ingest, rights, reading, the verbs, the bench),
raea-sys-videoform (systems/videoform: the maths over kept rows) and raea-io-resolve (io/resolve, VF1b). The
videoform section's types are core/brief's videoform.rs.
- Three small hooks into what exists: fingerprint.ts's optional `videoform` field (systems/fingerprint taxonomy.rs,
VF2), `raea context` printing a project's videoform (engine/cli guide.rs, VF2), and `raea check PROJECT` holding
the rules of the fingerprint that judges the piece (apps/direction check.rs, VF8).
- The bench (VF12) runs after every step, on every set, from the kept files alone; its numbers are the progress.
Background:
Given the readers raea has: footage perception (systems/footage), Fingerprint's columns (systems/columns: SigLIP 2,
CLAP, YAMNet, cached by content hash), Parakeet's words, Beat This!, HTDemucs and Silero VAD (systems/song), OCR,
Depth Anything 3, and raea check's one decode of the picture (raea-app-check-read once.rs)
And Fingerprint's fingerprint.ts (`about`, `extends`, `applies`, axes, encoder pins), its profiles (FP6e: ranges by
measure name, critique, leave-one-out), `which` (FP14c) and evidence rows (FP2c)
And taste lines' checks (raea's six forms, a check by name, a `.ts` check written with raea/check over the world;
DR4), run by `raea check PROJECT`
And the crate limits (a file at most 500 lines, a crate at most 2,000): raea-sys-fingerprint, -fingerprint-use and
raea-app-fingerprint are each within 150 lines of theirs, so a videoform's code is its own crates, and the
fingerprint crates grow only by a field and a map
And the layers: a systems crate depends sideways only on a facility, so reading (which uses footage, columns and
song) is apps' (raea-app-videoform), and the maths over kept rows is systems' (raea-sys-videoform)
Rule: VF1. Videos in: from the local drive, or streamed from a URL, read once
@needs:VF2
Scenario: VF1. A reference from the drive or a URL, with nothing downloaded
Given the plan
| crate | file | lines | job |
| raea-app-videoform | apps/videoform/src/ingest.rs | 220 | paths, folders and URLs to sources: content hash, source URL, title, creator, date; a source read before is recognised and not read again |
| raea-app-videoform | apps/videoform/src/rights.rs | 80 | the rights prompt, once per account, and its answer kept with the account |
When the person runs `raea videoform add NAME PATH|URL...`
Then a file or a folder on the drive is read where it is, with no copy made
And a direct link to a media file is decoded straight from the network, and a platform page, a playlist or a
channel (`--last N`) is resolved (VF1b) into stream URLs that are decoded the same way
And nothing but the readings is written: no video file is kept, in a cache or anywhere else
And each source is known by the content hash of its decoded picture and sound, beside its URL, title, creator
and date, so adding it again reads nothing
And before the first source from a URL, once per account, the person confirms they have the right to use what
they add; raea says a videoform keeps measurements and vectors, never the video, and that a platform's terms
are the person's to keep
And a login-only or private link is refused with the site's reason, and streams are read at 1080p at most
@needs:VF1
Scenario: VF1b. The resolver: yt-dlp, kept current by raea
Given the plan
| crate | file | lines | job |
| raea-io-resolve | io/resolve/src/lib.rs | 60 | a page URL to its videos' stream URLs and headers |
| raea-io-resolve | io/resolve/src/fetch.rs | 220 | the standalone yt-dlp for this platform fetched into ~/.raea/bin, checked against the release's SHA-256 sums; the pinned version, the daily move forward, the one before kept |
| raea-io-resolve | io/resolve/src/formats.rs | 140 | `yt-dlp -J` read: the best stream at 1080p or under, its URL and headers; a playlist's or channel's entries |
Then yt-dlp (Unlicense) is used only to resolve, never to download, and is fetched on first use as FFmpeg is on
Windows
And each raea release pins the version it was tested with; between releases raea checks the latest at most once
a day when a URL is added, checks it against its sums, and keeps the version before
And when resolving fails with an extractor error, raea fetches the latest and tries once more; if the new one
fails where the old one worked, it goes back and says which site failed
And a site that needs JavaScript run (YouTube) gets a runtime raea ships or fetches, named to yt-dlp
And `raea doctor` prints the yt-dlp in use, its date and the last site that failed
Rule: VF2. A videoform is a kind of fingerprint
Scenario: VF2. `videoform` in fingerprint.ts, and `raea videoform new`
Given the plan
| crate | file | lines | job |
| raea-core-brief | core/brief/src/videoform.rs | 140 | the videoform section's types (context, references, vocabulary, template, rules), with their TypeScript |
| raea-sys-fingerprint | systems/fingerprint/src/taxonomy.rs | 20 | the optional `videoform` field on a fingerprint |
| raea-app-videoform | apps/videoform/src/lib.rs | 120 | `raea videoform`: its usage, flags and the verbs' dispatch |
| raea-app-videoform | apps/videoform/src/verbs.rs | 240 | new, add, report and refresh |
When the person runs `raea videoform new NAME --context "…" [--extends FP] [--kinds K] [--tags T] [SOURCE...]`
Then a fingerprint folder is made with a `videoform` section, `extends` the person's fingerprint by default, and
`applies` from --kinds and --tags, where fingerprints are kept (the project's, the workspace's or the person's)
And `raea fingerprint which PATH` finds it for a piece as it finds any fingerprint, and says why
And `raea context` prints a project's videoform with its brief: its context, template, rules and ranges
And its references use brief.ts's `references` shape, `{ target, note }`, the target the source's hash and URL
Rule: VF3. Each reference read once, into the rows a videoform keeps
@needs:VF1
Scenario: VF3. One pass, every reader on its share
Given the plan
| crate | file | lines | job |
| raea-app-videoform | apps/videoform/src/pass.rs | 300 | one decode of a file or a stream: shot bounds from the same pass, each shot's frames held until it ends, each reader fed |
| raea-app-videoform | apps/videoform/src/readers.rs | 260 | perception, columns, words, the voice's pauses, beats, stems, OCR and depth into per-shot rows |
| raea-sys-videoform | systems/videoform/src/rows.rs | 160 | the kept rows: per shot its SigLIP 2 vector, its CLAP vector and its measures, f16, with the encoders' pins |
Then each reference is decoded once, whether from the drive or a stream, and every reader takes its share
And each shot gets its SigLIP 2 vector (a few frames pooled), its CLAP vector over its sound, and its measures:
length, scale, camera move, caption boxes, light and colour, words, pauses at its edges, its place in the video
And reading runs at about real time or faster, measured on the test sets
@needs:VF3
Scenario: VF3b. What's kept is enough
Then a videoform keeps its per-shot rows, its vocabulary's vectors, its profile, its structure and rules, a small
still for each shot kind, and the person's evidence, and no reference video
And ten one-minute references come to about 1.5 MB, small enough to load at once and keep in git
And every test on the test sets (VF12) reads a set's references once, then runs on the kept files alone, with the
references moved away, and passes the same
Rule: VF4-VF8. Writing the videoform from the kept rows
@needs:VF3
Scenario: VF4. The ranges, in the videoform's profile
Given the plan
| crate | file | lines | job |
| raea-sys-videoform | systems/videoform/src/ranges.rs | 220 | the measures across the references: shot lengths, cuts a minute, pauses inside a line, between lines and between sections, words a minute, cuts against beats and sentence ends, music under voice, caption size, place and words at once, talking head against cutaway |
| raea-sys-fingerprint-use | systems/fingerprint-use/src/profile.rs | 30 | a profile's measures beyond the fixed ones, by name, ranged and critiqued like the rest |
Then the videoform's profile holds every measure's range across the references, leave one out as FP6e checks it
And `raea fingerprint score --profile NAME` critiques a cut against the new measures as against the old
And a measure whose range is wide is recorded as free, not as part of the videoform
@needs:VF2,VF3
Scenario: VF5. The vocabulary, written by the person's AI
Given the plan
| crate | file | lines | job |
| raea-sys-videoform | systems/videoform/src/vocab.rs | 180 | vocabulary.ts's terms against the kept rows: never fires, fires everywhere, confused pairs, recurring shots no term names |
When the person's AI writes vocabulary.ts from the context (places, things in them with several phrasings,
near-misses, OCR patterns for text on screen, things to ignore)
Then its terms become the videoform's word heads (FP2e), embedded once by the text towers
And `raea videoform report NAME` says what each term did on the references, and the AI revises it from that
@needs:VF5
Scenario: VF6. The shot vocabulary
Given the plan
| crate | file | lines | job |
| raea-sys-videoform | systems/videoform/src/kinds.rs | 220 | the reference shots clustered on vectors and measures; each cluster named from the vocabulary, its ranges and how many references have it |
Then every reference shot belongs to a shot kind, named in the vocabulary's words, with its scale, move and length
ranges and the share of references that have it
@needs:VF6
Scenario: VF7. The structure, as a script template
Given the plan
| crate | file | lines | job |
| raea-sys-videoform | systems/videoform/src/structure.rs | 300 | the references aligned by their run of shot kinds and their script's meaning, into slots with their lengths and kinds; the template as NAME.script.ts |
Then the videoform's slots (open, sections, close) each have a length range, their shot kinds and what's on screen
And the template is a NAME.script.ts a project made to the videoform starts from, checked by `raea spec`
@needs:VF6,VF7
Scenario: VF8. Rules, with their strength, in the videoform's rules
Given the plan
| crate | file | lines | job |
| raea-sys-videoform | systems/videoform/src/rules.rs | 240 | coverage, order and event rules from the kept rows, each with how strongly it holds; written into the section's `rules`, each a taste line with its check and values |
| raea-app-direction | apps/direction/src/check.rs | 15 | tastes(): the rules of the fingerprint `which` names for the project, after the person's, the workspace's and the project's taste |
Then a rule that holds in most references (a punch-in when a number is said; a close-up of the counters in every
kitchen) is a line in the section's `rules`, with its strength and its check
And `raea check PROJECT` holds a piece to the rules of the fingerprint that judges it (raea-sys-fingerprint-use
`which`), beside the person's, the workspace's and the project's taste
And the person confirms the strongest rules once, on a contact sheet of shot-kind stills, and each answer is
evidence in the videoform
@needs:VF4,VF6
Scenario: VF8b. When it doesn't hold together
Given the plan
| crate | file | lines | job |
| raea-sys-videoform | systems/videoform/src/groups.rs | 180 | too few references, references in groups, traits that vary, outliers |
Then under five references every rule and range is weak, and nothing gates on it
And references that fall into clear groups are reported, with a videoform offered for each, never averaged
And one reference far from the others on several measures is named, for the person to keep or drop
@needs:VF3
Scenario: VF8c. References added and removed; encoders upgraded
Given the plan
| crate | file | lines | job |
| raea-sys-videoform | systems/videoform/src/pins.rs | 100 | the encoders' pins on the kept rows; what carries over an upgrade and what waits for refresh |
Then adding a reference reads only it and makes the videoform again from the kept rows, in seconds; removing one
drops its rows; the person's evidence stays through both
And a new encoder in raea leaves the videoform on its rows' pins, working as it was; the measures carry over; `raea
videoform refresh NAME SOURCE...` reads the references again for the new encoder, the one time they're needed
Rule: VF9-VF11. Following it, and checking it fast
@needs:VF7,VF8
Scenario: VF9. Following: the footage matched, what's missing said, the cut planned to the template
Given the plan
| crate | file | lines | job |
| raea-app-videoform | apps/videoform/src/follow.rs | 200 | new footage read and matched to shot kinds; what the footage lacks; the plan slot by slot |
Then new raw footage is read as references are, and each shot matched to a shot kind against the kept rows
And before any cut the agent says what the footage lacks ("no close-up of the counters, which every kitchen in the
references has"), a shot list for the person
And the agent plans the cut from the template, slot by slot, and edits to the ranges
@needs:VF8
Scenario: VF10. A videoform's rules checked on the composition, before any render
Given the plan
| crate | file | lines | job |
| raea-app-videoform | apps/videoform/src/checks.rs | 220 | the videoform's checks by name over the world: order, slot lengths, coverage, shot lengths, pauses, caption places and sizes |
| raea-app-direction | apps/direction/src/check.rs | 15 | the videoform's checks run with the project's rules |
Then `raea check PROJECT` runs the videoform's rules with raea's floor and the person's taste, in milliseconds
And each finding is routed as raea-app-check-cause routes any: a footage's own fault a note, a carried one said
@needs:VF6,VF10
Scenario: VF11. Embedding checks, only for shots that changed
Then each changed shot is held against its slot's shot kind, one SigLIP 2 frame a shot, and the run of shots
against the structure
And a shot that didn't change since the last check is not embedded again
Rule: VF12-VF13. Judged on the person's test sets
@needs:VF4
Scenario: VF12. The test bench
Given the plan
| crate | file | lines | job |
| raea-app-videoform | apps/videoform/src/bench.rs | 200 | the person's sets as fixtures: leave one out, telling sets apart, edit to it, the verdicts kept |
Given the person's sets, 8 to 10 videos each from one creator or one format, some with raw footage
Then for each set, a videoform built from all but one reference holds the one left out (its rules pass, its
measures in range) more often than other sets' videos do, and rejects other sets' videos
And where raw footage for a held-out reference exists, the agent edits it to the videoform, set beside the original
And the bench runs after every step of this file, on every set, from the kept files alone
And the first proof that matters: on at least five sets, each videoform built leave one out holds its left-out
video's pacing and shot lengths and rejects other sets' videos, more often than chance by a clear margin
@needs:VF12
Scenario: VF13. The person's blind judging, kept as evidence
Given the plan
| crate | file | lines | job |
| raea-app-videoform | apps/videoform/src/judge.rs | 150 | a pair shown unlabelled in a random order; the pick, the scores and the words kept, and as evidence |
Then the person sees the original and raea's edit side by side, unlabelled, in a random order, picks which they'd
post, scores pacing, shot choice, structure, graphics, sound and overall feel from 1 to 5, and says what's wrong
And each verdict is kept in the bench's record and is evidence in the videoform: a pick a pair (FP6b), a note a
label (FP5)
Rule: Deferred
Scenario: Not in this file yet
Then an automatic judge for the test bench (a video-capable language model, paid by the person, in the bench only,
never shipped: fidelity, pairs, and gaps between what the references show and what the videoform holds)
And the order of the test sets
+318
View File
@@ -0,0 +1,318 @@
# Videoform: the plan
An agency or a creator makes the same kind of video again and again: a listing walkthrough, a recipe short, a podcast
clip, a product unboxing. They give raea five to ten finished videos of that kind, from their own drive or by link, and
a line of context ("real estate walkthroughs for agents' Reels"). raea reads them and writes down what makes them that
kind of video: its **videoform**. From then on raea cuts new raw footage to it, and checks every pass against it,
quickly.
This is the one plan for videoforms: what one is, how it flows into what raea already has (a videoform is a kind of
fingerprint), how videos come in (from the local drive, or streamed from a URL with nothing downloaded), how each is
read once into embeddings and measures that are all a videoform ever needs again, how it's followed and checked, how
it holds up when references disagree or encoders change, how it's judged, and the build order with a confidence for
each step. The rask tasks follow in `videoform.feature` once this plan is agreed.
## Why a videoform is read from approved work, not written from notes
A style written by hand from a person's corrections records only what went wrong once. What was right from the start
is never said, so it's never written down. Pacing is the plainest case: if the first cut's voice was tight, nobody
leaves a note about it, the written style never mentions it, and the next cut made from that style can be slack while
satisfying every line of it. The approved videos already hold the answer, in numbers: how long the pauses are, how
long the shots are, how fast the words come, where the cuts fall. A videoform read from them carries what was approved,
not only what was corrected. Notes still matter. They teach what the numbers can't (DR6-DR8, FP5), on top of it.
## Decisions taken
- **The name is videoform.** The spec is `videoform` (raea/brief), and the command is `raea videoform`.
- **A videoform is a kind of fingerprint,** flowing into what's built. It's a fingerprint (FP14) that `extends` the
person's own and adds what a kind of video needs: its context, its references, its vocabulary, its structure and its
rules. Everything Fingerprint already does applies to it: finding the one that applies, inheriting evidence, being
taught by notes, being shared with a team and keeping its evidence when an encoder upgrades.
- **What ships runs on shipped models, on the person's machine.** Reading, embedding, storing and building new videos
from a videoform use only the models raea ships, plus at most one or two light additions. There are no paid language
model APIs in the product.
- **The domain vocabulary comes from the person's own AI.** The agent already in raea (Claude, Kimi, any of them) turns
the context line into the things to look for. That adds no new bill and no shipped domain packs.
- **What stays the same across the references is the videoform; what varies is the content.** A rule's strength is
its consistency across the references. Every videoform is checked by building it from all references but one and
testing it on the one left out.
- **A reference is read once, and never needed again.** Its embeddings and measures are what the videoform keeps, and
they're enough to follow it and check against it forever after. Following and checking never open a reference, so
they stay fast, and the references can be deleted, offline or behind a dead link without the videoform noticing.
- **Checks start from the composition.** Most of a videoform's rules are measured on what raea knows it put where,
before any render. Embeddings run only on shots that changed.
## What raea already has, and what this builds on
| Already in raea | What it gives a videoform | Gap this plan fills |
|---|---|---|
| Fingerprint: `fingerprint.ts` with `about`, `extends`, `applies` kinds and tags; `which` finds one by project, workspace and account; a child inherits its parent's evidence, its own counted more; notes teach the one that judged (FP14a-e) | the home: a videoform is one of these | the fields a kind of video needs |
| Fingerprint's frozen encoders (SigLIP 2, CLAP, YAMNet, EmbeddingGemma 2, Depth Anything 3), columns cached by content hash, word and learned heads, evidence in f16 rows (FP1-FP4) | the per-shot vectors and measures, and where they're kept | no shot vocabulary, no structure |
| Fingerprint profiles: ranges from admired work, critique against them, a leave-one-out test (FP6e, `raea fingerprint profile`) | a videoform's ranges, and its validation | few measures (loudness, tilt, cut rate, motion, light, colour, sharpness) |
| Notes become checks, and climb to project, workspace and taste (DR5-DR8, `raea notes keep`) | the path a correction takes to becoming a rule | a videoform's rules start from evidence, not notes |
| `raea check`: findings and the record (DR3); who can fix what, carried findings, one decode (raea-app-check-cause, PR #205) | the check every pass runs | a videoform's rules join it as more rules |
| `NAME.script.ts` (scenes, beats, lines, cut); `brief.ts` (`references`, `look`, `mode`, `deliver`) | a storyboard spec, and a brief that names references | no template made from references; references named, never read |
| `taste.ts` lines: words, and a check that holds them (one of six forms, a check by name, or a `.ts` check on raea/check's world; DR4) | the person's, the workspace's and the project's standing lines, which `raea check PROJECT` and every agent hold work to | none written from references |
| Footage perception (`systems/footage`: shots, cuts, camera, faces, words on screen, scene labels, performance, facts.json) | what each reference shot is | read for raw footage, not for references |
| Transcription (Parakeet), beats, stems and voice activity (`raea song`, HTDemucs, Silero VAD), OCR | words, pauses, cuts against beats, music under voice, captions | not gathered into a videoform |
| Index and libraries (SigLIP over a person's media; turbopuffer in the cloud) | finding footage by meaning; vector storage for teams | — |
| video2raea sound, img2raea | reverse engineering a piece, with answer keys from our own films | — |
| The video-decompiler skill (raea-skills): one admired film taken apart into a written dossier (`REFERENCE.md`), `vd pin` writing a film's numbers as targets | holding a piece to a reference, and measured targets | one reference, read by hand; product films made from code, not footage cuts |
| raea's URL cache (`io/net`): a direct file URL fetched once into a cache | reading a media link | it saves the file; no platform pages, playlists or channels |
## A videoform is a kind of fingerprint
`fingerprint.ts` gains an optional `videoform` section. A fingerprint with one is a videoform. It's found by `which`
like any other (its `applies` names the kinds and tags of piece it judges), it `extends` the person's fingerprint, so
their general taste carries in, and it's kept and shared where fingerprints are (`.raea/fingerprints/NAME`, a
project's, a workspace's or the person's own).
```
.raea/fingerprints/listing-walkthrough/
fingerprint.ts about, extends, applies, axes; and videoform: { context, references, vocabulary, template, rules }
vocabulary.ts what to look for, written by the person's AI from the context
profiles/ the videoform's ranges (FP6e's profile, measures added)
read/ the references' per-shot rows, in the f16 format Fingerprint's evidence uses; the structure; the report
evidence.jsonl as any fingerprint: the person's notes, picks and verdicts on pieces it judged
```
Each part of a videoform flows into the part of raea that already does that job:
| A videoform's... | Flows into | So that |
|---|---|---|
| ranges (pace, pauses, shot lengths, loudness, colour, captions) | its own profile (FP6e) | `raea fingerprint score --profile` critiques a cut against them, and leave-one-out is already built |
| the taste taught later | its own evidence and heads (FP2, FP14b-d) | a note on a piece it judged teaches it, never the person's general fingerprint unless they move it up |
| rules (coverage, order, event rules, limits) | the section's `rules`, each in a taste line's shape (words, check, values, level) | `raea check PROJECT` runs them for a piece the videoform judges (`which`), beside the taste |
| structure (slots, their order and lengths) | a `NAME.script.ts` template, which `videoform.template` names | a project made to the videoform starts from it, and agents plan from it as from any storyboard |
| references | `brief.ts`'s existing `references` shape, `{ target, note }`, with the source kept by content hash | a reference is named the way a brief already names one |
`raea videoform new NAME --context "…" REF...` makes one, as `raea fingerprint new` does. `raea fingerprint which` on a
piece names the videoform that judges it and why, and `raea context` prints it with the brief.
## Bringing videos in, with nothing downloaded
- **From the local drive.** A file or a folder (`raea videoform add NAME ~/Videos/listings/`), or a library's files, is
read where it is. No copy is made.
- **From a URL, streamed.** `raea videoform add NAME URL...` reads the video over the network in one pass and keeps only
what was measured:
- **A direct link to a file** (an `.mp4` on a server, S3, a share link that serves the file) is decoded straight from
the network.
- **A platform page** (YouTube, TikTok, Instagram, Vimeo, X), a playlist or a creator's channel with `--last N`
isn't a video file: it's a page with a player, and the video sits behind it as short-lived, signed stream URLs,
often in segments. A resolver (yt-dlp, Unlicense, fetched on first use as raea fetches FFmpeg on Windows) turns
the page into those stream URLs, and raea streams them. Nothing is written to disk.
- **One pass.** A streamed video can't be sought cheaply, so every reader takes its share of the one decode, as raea
check's picture rules now do. Shot bounds come from the same pass, and the per-shot reads hold a shot's frames until
it ends.
- **What's kept.** Each video's readings (below), by content hash of the decoded stream, with its source URL, title,
creator and date. The video itself is not kept. A video already read is recognised by its hash and never read twice.
- **Rights.** Once per account, before the first reference is read from a URL, raea asks the person to confirm they have
the right to use what they add (their own work, a client's, or licensed), says that a videoform keeps measurements and
vectors and never the video, and that a platform's terms are theirs to keep. The answer is kept with the account.
- **Limits.** Login-only and private links are refused, with the reason given. Streams are read at 1080p at most;
reading never needs more.
## The resolver, and keeping it current
A platform page is resolved by **yt-dlp** (Unlicense): the most widely used and most actively kept page resolver, with
extractors for over a thousand sites and releases every week or two. raea uses it only to resolve, never to download:
`yt-dlp -J URL` (a playlist or channel: `--flat-playlist`, `--playlist-end N`) gives each video's formats as JSON, with
their stream URLs and the headers they need, and raea picks the best stream at 1080p or under and decodes it itself.
Sites change their pages often, and an old resolver stops working within weeks, so it's kept current by raea, not by
the person:
- **Fetched, not installed.** The official standalone binary for the platform (`yt-dlp_macos`, `yt-dlp_linux`,
`yt-dlp.exe`) is fetched on first use into `~/.raea/bin`, as raea fetches FFmpeg on Windows, and checked against the
release's published SHA-256 sums before it runs.
- **Pinned, then moved forward.** Each raea release pins the yt-dlp version it was tested with. Between raea releases,
raea checks yt-dlp's latest release at most once a day when a URL is added, fetches it, checks its sums, and keeps the
one before it.
- **Updated when a site breaks.** When resolving fails with an extractor error, raea fetches the latest release and
tries once more. If the new one fails where the old one worked, it goes back to the old one and says which site
failed.
- **Said, not hidden.** `raea doctor` prints the yt-dlp in use, its date, and the last site that failed. A link that
can't be resolved is refused with the site's reason, and the person can add the file from their drive instead.
- **Its needs.** Some sites' pages (YouTube's) make yt-dlp run JavaScript, for which it uses a JavaScript runtime on the
machine. raea gives it one: yt-dlp is pointed at a runtime raea ships or fetches, and the bench checks it against
each site raea names as supported.
- **Tested.** The test bench resolves one public video from each supported site each night, so a broken site is known
before a person finds it.
## Reading a reference
Each video is read into rows by what raea already runs:
- footage perception: shots, cuts, camera, faces, words on screen, scene labels;
- Fingerprint's columns: SigLIP 2 per shot, CLAP and YAMNet over the sound;
- Parakeet's words, and the voice's pauses;
- beats and stems;
- OCR's caption boxes;
- depth, for shot scale.
All of it is keyed by content hash, as Fingerprint's columns are, so a reference read for one videoform serves every
videoform that uses it.
## What a videoform keeps, and why it's enough
Following and checking need four kinds of thing from the references, and a videoform keeps exactly those:
| Kept | What it is | What uses it |
|---|---|---|
| per-shot rows | each reference shot's SigLIP 2 vector (one pooled vector, a few frames averaged), its CLAP vector over the shot's sound, and its measures (length, scale, camera move, caption boxes, light and colour, words, pauses at its edges, its place in the video) | the shot vocabulary; matching new footage to shot kinds; the embedding checks |
| the vocabulary's vectors | each term's phrasings through the text towers, as word heads store them (FP2e) | naming shot kinds; finding domain things in new footage |
| the profile | the ranges of every measure across the references (FP6e) | the critique, and composition-first range checks |
| the structure and the rules | the slots with their lengths and shot kinds; the event and coverage rules with their strength | the template, and the rules `raea check` runs |
Also kept: one small still for each shot kind (a thumbnail, a few kilobytes), so the person can see what a kind is when
confirming rules, and the evidence the person adds over time. The reference videos aren't kept.
**Sizes.** A videoform of ten one-minute references, about 50 shots each, keeps about 500 per-shot rows of about 3 KB
each (SigLIP 2's 768 values and CLAP's 512, in f16, with the measures): about 1.5 MB with its profile, structure, rules
and stills. That's small enough to load at once, keep in git with the project, and share with a team.
**Times, measured and held to.** Reading a reference is once only, at about real time or faster: one decode, every
reader on its share of it. Making the videoform's ranges, shot vocabulary, structure and rules from its rows takes
seconds. Following and checking read only what's kept: the composition-first checks in milliseconds, matching a new
shot to its kind in well under a millisecond against ~500 rows, and one SigLIP frame for each changed shot.
## When it doesn't hold together
- **Too few references.** Under five, every rule and range is reported as weak, and nothing gates on it. Leave one out
needs at least five to mean anything.
- **References that aren't one kind of video.** If the references fall into two or more clear groups (by structure, by
shot kinds, by pace), raea says so and offers a videoform for each, rather than averaging them into one that fits
none.
- **A trait that varies.** A measure whose range across the references is wide, or a rule that holds in few of them, is
a free choice, not part of the videoform. It's recorded as free, so the agent knows it may decide.
- **An outlier.** One reference far from the others on several measures is named ("number 7 runs twice as fast as the
rest"), and the person decides whether it belongs.
## Adding and removing references
Adding a reference reads only the new one, then makes the ranges, shot vocabulary, structure and rules again from the
kept rows, in seconds. Removing one drops its rows, and the same. The person's evidence (their notes, picks and
verdicts) stays through both, as a fingerprint's does.
## When an encoder changes
A videoform records the encoders its rows came from (their pins, as `fingerprint.ts` does). A raea that ships a new
encoder keeps using the videoform's rows with the old encoder's pin, for matching and checking against it. The measures
(lengths, pauses, captions, light) don't depend on an encoder and carry over as they are. To move a videoform to the new
encoder, its references are read again (`raea videoform refresh NAME`, given the files or links). Until then it keeps
working as it was. This is the one time a reference is needed again, and it's the person's choice.
## Writing the videoform
1. **The vocabulary.** The person's AI expands the context line into `vocabulary.ts`:
- places, then the things in each place, each with several phrasings;
- near-misses (a kitchen against a dining room);
- OCR patterns for text on screen (prices, addresses);
- things to ignore.
These become the videoform's word heads (FP2e), scored by SigLIP's and CLAP's text towers. raea reports what each
did on the references: never fires, fires everywhere, confused with another, or a recurring shot no term names. The
AI revises the vocabulary, and two or three rounds is usually enough.
2. **The ranges,** across the references, into the videoform's profile:
- shot lengths, and cuts a minute;
- the voice's pauses: inside a line, between lines, between sections;
- words a minute, and cuts against beats and sentence ends;
- loudness, and music under voice;
- caption size, place and words on screen at once;
- colour and grade;
- talking head against cutaway.
3. **The shot vocabulary.** Every reference shot is clustered on its vectors and measures. Each cluster gets its terms
from the vocabulary, its measured ranges (scale, move, length) and how many references have it.
4. **The structure.** The references are aligned by their run of shot kinds and their script's meaning, into slots
(open, sections, close), each with its length range, its shot kinds and what's on screen. This becomes the script
template.
5. **The event rules.** How often one thing comes with another across the references ("a punch-in when a number is
said", "a close-up of the counters in every kitchen"). Those that hold in most references become the videoform's
rules, each stating how strongly it holds.
6. **The person confirms the strongest rules once,** on a contact sheet ("countertop close-up in every kitchen: 9 of
10"). Each yes or no is evidence in the videoform, as any label is in a fingerprint.
## Following it
- `raea context` prints the videoform: its template, its rules and its ranges.
- New raw footage is read the same way, and each shot is matched to the videoform's shot kinds.
- Before any cut, the agent is told what the footage lacks: "no close-up of the counters, which every kitchen in the
references has". That's a shot list for the person.
- The agent plans the cut to the template, slot by slot, and edits to the ranges (cut points, pauses, shot lengths).
## Checking it, fast
1. **On the composition, before any render, in milliseconds:**
- order and slot lengths;
- coverage;
- shot lengths and pauses (the voice's cut points are in the composition);
- caption places and sizes.
These are the videoform's rules, run by `raea check PROJECT` with the taste.
2. **On the render manifest and measures, in seconds:** loudness, light and colour against the profile (`raea
fingerprint score --profile`).
3. **On embeddings, only for shots that changed:** each shot against its slot's shot kind (one SigLIP frame a shot);
the run of shots against the structure.
The routing from raea-app-check-cause (PR #205) applies unchanged: the footage's own faults are notes, carried findings
say so, and a round goes only to what another render can change.
## Judging
Judging is for testing the build, set by set. The person's verdict is the judge; a second, automatic judge for the
test bench is deferred (see the end).
**The person's judgement (the one that decides).** For each test, raea shows the original and its own edit side by side,
unlabelled, in a random order (a feed artifact, or `raea show --question`). The person:
- picks which they'd post;
- scores pacing, shot choice, structure, graphics, sound and overall feel, 1 to 5;
- writes what's wrong in their own words.
Each verdict is kept in the test bench's record, and is also evidence in the videoform (a pick is a pair, FP6b; a note
is a label, FP5). The judging trains the videoform as well as grading it.
## The test sets
The person provides the sets: 8 to 10 videos each, from one creator or one format, with raw footage for a few where it
exists. Every test reads a set's references once, then runs only on what the videoform kept, so the tests also prove
that a videoform is enough without its references. For each set:
- **Leave one out:** a videoform built from all but one reference must hold the one left out (its rules pass, its
measures fall in range) more often than other sets' videos do.
- **Tells sets apart:** each videoform must reject other sets' videos. This is profile FP6e's test, extended to rules
and structure.
- **Edit to it:** where raw footage for a held-out reference exists, the agent edits it to the videoform, and the cut is
set beside the original.
- **Judged:** by the person, as above.
The sets, their answers and their verdicts are kept as fixtures, so each step of the build is measured on all of them.
## Build order, with confidence
| Phase | Step | What | Confidence | Why |
|---|---|---|---|---|
| 1, in | VF1 | ingest from the local drive, and streamed from direct links, platform pages, playlists and channels; read once, nothing kept but the readings; the rights prompt, once per account | high, medium for platform pages |
| | VF1b | the resolver: yt-dlp fetched and checked against its sums, pinned per release, moved forward daily, updated and retried when a site breaks, rolled back when the new one is worse, a nightly site check | high to build, medium to keep | the sites change; the update loop is what keeps it working | decoding over the network is standard; platform pages depend on the resolver keeping up with the sites |
| | VF2 | `videoform` in `fingerprint.ts`, found, inherited and taught as a fingerprint; `raea videoform new` and `add` | high | FP14's machinery exists |
| | VF3 | reading references in one pass: perception, columns, words, pauses, beats, stems, OCR, depth, into the kept rows | high | every reader exists; one decode is already done for raea check |
| | VF3b | what a videoform keeps, its sizes and times, and the proof that following and checking never open a reference | high | the rows are Fingerprint's format; the test sets prove it |
| 2, read | VF4 | ranges into the videoform's profile, measures added (pauses, words a minute, shot lengths, captions, cuts against beats) | high | FP6e computes ranges and leave-one-out already |
| | VF5 | the vocabulary loop with the person's AI, as word heads | medium-high | word heads already score from text; the report is new |
| | VF6 | the shot vocabulary (clusters named from the vocabulary) | medium | clustering is plain; naming quality varies by domain |
| | VF7 | the structure template | medium | alignment across varied videos is the hard part |
| | VF8 | event rules into the videoform's rules, with strength, confirmed by the person; `raea check` holds them | medium | co-occurrence is plain; telling habit from style needs the person |
| | VF8b | when it doesn't hold together: too few, mixed kinds (split into videoforms), traits that vary, outliers | medium-high | groups and spreads come from the kept rows |
| | VF8c | adding and removing references from kept rows; encoder pins and `refresh` | high | Fingerprint keeps evidence across upgrades the same way (FP8c) |
| 3, use | VF9 | following: context, coverage gaps, planning to the template | medium-high | context and scripts exist |
| | VF10 | composition-first checks for the videoform's rules | high | rules as `.ts` checks over the world exist (DR4) |
| | VF11 | embedding checks on changed shots | medium | per-shot SigLIP is cheap; thresholds need the test sets |
| 4, judge | VF12 | the test bench: the sets as fixtures, leave-one-out and telling sets apart, run after every step | high | the measures are defined above |
| | VF13 | the person's blind judging, kept as evidence | high to build | an artifact and the evidence rows exist |
**The first proof that matters is VF4 with VF12.** On at least five of the person's sets, each videoform, built leave
one out, holds its left-out video's pacing and shot lengths, and rejects other sets' videos, more often than chance by
a clear margin. If the numbers alone can't tell videoforms apart, nothing built above them will.
## Deferred
- **An automatic judge for the test bench:** a video-capable language model, paid for by the person, in the bench only
(never shipped), answering fidelity, pairs and gaps (what the references show that the videoform doesn't hold),
calibrated against the person's verdicts.
- **The order of the test sets.**
+53 -4
View File
@@ -5,7 +5,7 @@ Feature: raea/wear, weathering that has a cause
version, "realistic procedural and highly intelligent seeding ... for what makes sense on wear, wear by material,
crumbling infrastructure, doors, walls, plates", and the same for how textures are built and made cheap.
raea's wear so far is shader-only (systems/wear: noise, screen-space curvature, grime on faces turned down;
raea's wear was shader-only (systems/wear: noise, screen-space curvature, grime on faces turned down;
systems/procmat: a pattern with dust, dirt and edges). Nothing in it knows where water runs, what is sheltered, where
hands touch or what a surface is made of, so the marks are scattered evenly rather than caused. The fix is the
method of the literature: the agents of wear are traced through the geometry from their sources, and they leave
@@ -246,14 +246,28 @@ Feature: raea/wear, weathering that has a cause
faded, the railing rusted; rain, snow with a storm and autumn render; an unbaked sphere under the same shader is
unchanged. The corner house with stills of every cause and condition is WR7's
@needs:WR5,WR3
@needs:WR5,WR3 @done
Scenario: WR6. Crumbling
Then where damage is high (ground band, edges, sheltered damp, neglect), plaster is gone to the brick 2 cm behind
it under a shadowed lip, paint to primer and wood, enamel to iron; cracks run from the corners of openings;
panes are broken or boarded by neglect; slates are missing; and spots.json puts debris under the losses
And the cracked-road fracture of the kit waits for a piece that needs it
And as built (11-19)
| crate | file | lines | job |
| raea-sys-damage | systems/damage/src/lib.rs | 241 | an opening's corners, a crack from about half of them (by a seed per corner), each point's loss potential (damp foot, soaked faces, knocked arrises, along a crack), debris under the losses where the rain falls, landed on the walk below; version 3 |
| raea-sys-damage | systems/damage/src/tests.rs | 190 | an opening's four corners and no others, cracks along the wall, what loosens a coat, debris under the foot (none indoors, none on a plinth), about half the corners cracking |
| raea-sys-weathering | src/lib.rs, rays.rs, touch.rs | +33 | causes3 a's crack, the loss potential and the debris spots from raea-sys-damage |
| raea-sys-touch | src/lib.rs, spots.rs | +18 | a spot's loss, the seed shared with damage |
| raea/wear | sdk/wear/src/causes.ts | 159 | neglect = (1 - e^(-years / 25)) x (1.15 - upkeep); abandon, the share of a house past what a lived-in one lets go (smoothstep from 0.85 of neglect at its base upkeep) |
| raea/wear | sdk/wear/src/recipes.ts | 303 | plaster off to the brick under its lip, paint to primer and wood, enamel flaked to iron, cracks opening by neglect (stepped through brick's joints), panes broken (38%) and boarded (16%) by abandon, slates gone by neglect and abandon |
| raea/wear | sdk/wear/src/index.ts | 257 | wearDebris: the bake's debris spots where loss x abandon reaches 0.3 |
And proof: `cargo test -p raea-sys-damage` (5 tests) and `-p raea-sys-weathering`; `bun test` in sdk/wear (22
tests: neglect and upkeep, abandonment's threshold in the shader's text, debris none at upkeep 0.35, all at 90
years and 0.05, some at 80 and 0.2); the corner house (WR7) rendered after 80 years and as a ruin: plaster off
the rusticated foot and around the openings, cracks from the window corners, the ruin's panes broken and
boarded and slates gone, heaps on the walk under the losses and none inside or on the plinth
@needs:WR5
@needs:WR5 @done
Scenario: WR9. Every season and weather, from uniforms over the causes
Given the look's date and weather, the values the realism lane's sets carry: `day` (the day of the year, 1-366)
and `hour`, from which the season's phase (day / 365.25) and the sun follow; snow, wet and ice as weather of
@@ -297,10 +311,18 @@ Feature: raea/wear, weathering that has a cause
posted as i-acp-mwlb9fb4-110
And still open: the mapping from the look's `day` and weather to these values is WR5's (the prototype takes
storm, leaves, dust and melt as values of their own); frost and algae; the flash of thunder is the light's
And the shader's half as built (11-19): the eight conditions are WR5's recipes over these causes (spring's damp
and algae, summer's dust, autumn's leaves, frost where December's sun misses, snow lying and driven, rain
wetting, streaming and puddling), named once, and weather that changes during a shot eases toward the sky's
| crate | file | lines | job |
| raea/wear | sdk/wear/src/weather.ts | 79 | WEAR_CONDITIONS (the eight as weather), weatherAt(base, spells, minutes): each value eased exactly toward the sky's per spell, so any frame draws alone; WEATHER_RATES (wetting in about 3 minutes, drying over an hour, snow settling over 20 and melting over 2 hours, driven snow in 10 and off in 30, frost over 30 and gone in 20; ASSUMED until measured) |
| raea/wear | sdk/wear/test/wear.test.ts | 216 | rain soaks and dries at its rates, frames stand alone with no jump at a spell, snow, storm and frost, spells out of order refused, each condition in its season |
And proof: `bun test` in sdk/wear; the corner house under all eight by day and at dusk, and a shower crossing it
(WR7's rain-passes: dry, soaked and drying at frames 0, 40 and 119)
Rule: 3. Shown, then cheap
@needs:WR5
@needs:WR5 @done
Scenario: WR7. The demo, and EX9
Then examples/materials/wear/ is a corner house made in code (plinth, rusticated ground floor, plastered storeys,
sills, string course, cornice on consoles, door, iron balcony, zinc gutter and downpipe, an enamel street
@@ -308,6 +330,22 @@ Feature: raea/wear, weathering that has a cause
colour and the house under each of WR9's eight conditions, by day and at dusk
And `wear` on MeshStandardMaterial and <WearExtension> are raea/wear's, and systems/wear, its spawn branch and
its row columns are deleted in the same landing (docs/examples.feature EX9)
And as built (11-19)
| crate | file | lines | job |
| example | examples/materials/wear/house.ts | 260 | the corner house as solids (each 8 corners), a hip roof, openings cut through each band, one .glb material per class |
| example | examples/materials/wear/make-house.ts | 11 | writes media/house.glb |
| example | examples/materials/wear/wear.tsx | 179 | before, new, after (80 sooty years), ruin, ruin-near, door; debug-CAUSE for all 16; the eight conditions and their -dusk; rain-passes (120 frames, half a minute each); paint (worn paint with no bake) |
| example | examples/materials/wear/wear.test.ts | 85 | every part WR7 names, the openings through the walls, the .glb, every cause and condition listed, the paint still |
| raea/render | sdk/render/src/worn.ts | 119 | worn paint as a surface shader on the public hook (WORN_WESL, wornShader): systems/wear's shader ported, same noise, curvature edges, grime, rust and chips in the mesh's own space |
| raea/render | sdk/render/src/3d/materials.tsx | +12 | a material's `wear` becomes that shader (none at amount 0; refused beside `shader` or `grid`) |
| deleted | systems/wear, spawn.rs, raea_plugins.rs, runtime/scene parts.rs | -480 | raea-sys-wear, its WearPlugin, spawn branch and row columns; its type out of the registry snapshot, bevy.gen.tsx and sdk-coverage |
And worn paint's shader lives in raea/render beside the material that takes it, not in raea/wear: raea/wear is
built on raea/render, so the other way would be a cycle. <WearExtension> and `wear` keep their props, and the
guides are unchanged
And proof: `bun test` in examples/materials/wear (7 tests) and conformance bevy3d.test.tsx (wear's shader, its
uniforms, none at amount 0, alone); a parity scene of worn paint (sharp, turned and round parts, every setting)
rendered through systems/wear and through worn.ts matches (RMSE 3.8e-5 of full scale); every still, and
rain-passes at frames 0, 40 and 119, render with 0 errors on the Mac. Clay now draws worn paint as it draws any custom surface shader
@needs:WR7
Scenario: WR8. Detail textures from mask stacks, and what they cost
@@ -315,3 +353,14 @@ Feature: raea/wear, weathering that has a cause
rendered by raea once into tiling layers, instead of noise evaluated per pixel per frame
And texture arrays get mips (SH9 arrays have none, so a tiling layer shimmers far off) and maps can be BC
compressed into KTX2, with the memory and frame time each saves measured
And measured first (11-19, M5 Pro, the corner house at 4K, 121-127 frames each, plain and worn interleaved): with
the machine quiet, 17.2 ms a frame plain and 17.2 worn, 17.6 and 17.7; under other sessions' load both rise
together (18-75 ms). The recipes' per-pixel noise costs no frame time a render can see, so detail layers
would save nothing yet; a live scene at 60 fps with many baked buildings is where to measure again
And the maps' memory: four RGBA8 maps of 2048 x 1108 for the house, 36 MB on the GPU; BC7 would take that to
about 9 MB, but causes2's alpha is the class code read exactly by textureLoad (it needs a map of its own
before the rest compress), and an iPhone has no BC (ASTC there). Worth it for a city of baked buildings, not
one house
And still open, so not done: the detail layers, mips on arrays (they come with the detail layers: adding them
now would grow the city's 40-layer room atlas by a third for no wear user), and BC/KTX2 maps with the class
split out and a fallback where BC isn't
+1 -1
View File
@@ -74,7 +74,7 @@ aseprite = ["dep:bevy_aseprite_ultra"]
asset_loader = ["dep:bevy_asset_loader"]
avian = ["dep:avian3d"]
avian2d = ["dep:avian2d"]
bevy = ["bevy/bevy_gilrs", "bevy/gamepad", "bevy/area_light_luts", "bevy/experimental_pbr_pcss", "bevy/dfg_lut", "bevy/smaa_luts", "bevy/tonemapping_luts", "bevy/bluenoise_texture", "bevy/bevy_gizmos", "bevy/bevy_gizmos_render", "bevy/bevy_dev_tools", "bevy/debug", "bevy/bevy_ui_debug", "bevy/file_watcher", "bevy/embedded_watcher", "bevy/asset_processor", "bevy/png", "bevy/jpeg", "bevy/ktx2", "bevy/zstd_rust", "bevy/basis-universal", "bevy/exr", "bevy/hdr", "bevy/webp", "bevy/dds", "bevy/tga", "bevy/bmp", "bevy/gif", "bevy/ico", "bevy/qoi", "bevy/pnm", "bevy/tiff", "bevy/compressed_image_saver", "bevy/picking", "bevy/bevy_picking", "bevy/mesh_picking", "bevy/sprite_picking", "bevy/ui_picking", "bevy/meshlet", "bevy/meshlet_processor", "bevy/bevy_solari", "bevy/bevy_animation", "bevy/gltf_animation", "bevy/morph", "bevy/morph_animation", "bevy/bevy_gltf", "bevy/bevy_sprite", "bevy/bevy_sprite_render", "bevy/2d_bevy_render", "bevy/3d_bevy_render", "bevy/ui_bevy_render", "bevy/bevy_ui_widgets", "bevy/bevy_feathers", "bevy/custom_cursor", "bevy/bevy_input_focus", "bevy/bevy_camera_controller", "bevy/free_camera", "bevy/pan_camera", "bevy/bevy_text", "bevy/system_font_discovery", "bevy/scene", "bevy/bevy_state", "bevy/serialize", "bevy/reflect_functions", "bevy/reflect_documentation", "bevy/sysinfo_plugin", "bevy/bevy_clipboard", "bevy/system_clipboard", "bevy/clipboard_image", "bevy/ghost_nodes", "bevy/bevy_settings", "bevy/shader_format_spirv", "bevy/bevy_debug_stepping", "bevy/bevy_world_serialization", "bevy/bevy_audio", "bevy/mp3", "bevy/flac", "bevy/vorbis", "bevy/wav", "bevy/aac", "bevy/mp4", "bevy/http", "bevy/https", "bevy/web_asset_cache", "bevy/bevy_curve", "bevy/complex_script_segmentation", "bevy/compressed_image_saver_universal", "bevy/pan_orbit_camera", "bevy/pan_orbit_gizmo", "bevy/render_dev_tools", "dep:symphonia"]
bevy = ["bevy/bevy_gilrs", "bevy/gamepad", "bevy/area_light_luts", "bevy/experimental_pbr_pcss", "bevy/dfg_lut", "bevy/smaa_luts", "bevy/tonemapping_luts", "bevy/bluenoise_texture", "bevy/bevy_gizmos", "bevy/bevy_gizmos_render", "bevy/bevy_dev_tools", "bevy/debug", "bevy/bevy_ui_debug", "bevy/file_watcher", "bevy/embedded_watcher", "bevy/asset_processor", "bevy/png", "bevy/jpeg", "bevy/ktx2", "bevy/zstd_rust", "bevy/basis-universal", "bevy/exr", "bevy/hdr", "bevy/webp", "bevy/dds", "bevy/tga", "bevy/bmp", "bevy/gif", "bevy/ico", "bevy/qoi", "bevy/pnm", "bevy/tiff", "bevy/picking", "bevy/bevy_picking", "bevy/mesh_picking", "bevy/sprite_picking", "bevy/ui_picking", "bevy/meshlet", "bevy/meshlet_processor", "bevy/bevy_solari", "bevy/bevy_animation", "bevy/gltf_animation", "bevy/morph", "bevy/morph_animation", "bevy/bevy_gltf", "bevy/bevy_sprite", "bevy/bevy_sprite_render", "bevy/2d_bevy_render", "bevy/3d_bevy_render", "bevy/ui_bevy_render", "bevy/bevy_ui_widgets", "bevy/bevy_feathers", "bevy/custom_cursor", "bevy/bevy_input_focus", "bevy/bevy_camera_controller", "bevy/free_camera", "bevy/pan_camera", "bevy/bevy_text", "bevy/system_font_discovery", "bevy/scene", "bevy/bevy_state", "bevy/serialize", "bevy/reflect_functions", "bevy/reflect_documentation", "bevy/sysinfo_plugin", "bevy/bevy_clipboard", "bevy/system_clipboard", "bevy/clipboard_image", "bevy/ghost_nodes", "bevy/bevy_settings", "bevy/shader_format_spirv", "bevy/bevy_debug_stepping", "bevy/bevy_world_serialization", "bevy/bevy_audio", "bevy/mp3", "bevy/flac", "bevy/vorbis", "bevy/wav", "bevy/aac", "bevy/mp4", "bevy/http", "bevy/https", "bevy/web_asset_cache", "bevy/bevy_curve", "bevy/complex_script_segmentation", "bevy/compressed_image_saver_universal", "bevy/pan_orbit_camera", "bevy/pan_orbit_gizmo", "bevy/render_dev_tools", "dep:symphonia"]
big_space = ["dep:big_space"]
common_assets = ["dep:bevy_common_assets"]
console = ["dep:bevy_console", "raea-bevy-calls/console", "egui"]
+190
View File
@@ -0,0 +1,190 @@
// `raea show` and its app on a Mac, Windows and Linux (src/app.ts), each system faked (a Here): where the running
// app's host is, which app is installed, how files open without it, how it's started, and the harness found up the
// processes. #169: on Windows `raea show` asked `kill` whether the app ran, looked only in /Applications, and said
// it had opened the files "in the Mac's own viewer".
import { afterAll, describe, expect, test } from "bun:test";
import { appHost, computer, harness, installedApp, openFiles, show, type Here } from "../src/app";
import { pixelsOf } from "../src/brand";
import { absolute, fromCwd } from "../src/show";
const WIN_KEY = "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\raea";
/** A system: `platform`, its files (path → text), and its programs' answers; every run is kept in `ran`. */
function here(platform: string, files: Record<string, string> = {}, answer: (cmd: string, args: string[]) => { status?: number; stdout?: string } = () => ({})) {
const ran: string[][] = [];
const h: Here & { ran: string[][] } = {
platform,
ran,
run: (cmd, args) => {
ran.push([cmd, ...args]);
const a = answer(cmd, args);
return { status: a.status ?? 0, stdout: a.stdout ?? "" };
},
exists: (p) => p in files,
read: (p) => {
if (!(p in files)) throw new Error(`ENOENT ${p}`);
return files[p];
},
env: { RAEA_NO_OPEN: undefined },
home: platform === "win32" ? "C:/Users/me" : "/home/you",
};
return h;
}
// the app's host, as the window's (apps/app host/show.ts): an item's link for a show, and /host/shown to say it finds it.
// Its own process: show() posts with a synchronous curl, which a server in this one couldn't answer
const host = Bun.spawn(["bun", "-e", `const s = Bun.serve({ port: 0, fetch: (r) => { const p = new URL(r.url).pathname; return p === "/host/show" ? Response.json({ url: "raea://item/7" }) : p === "/host/shown" ? Response.json({}) : new Response("not found", { status: 404 }); } }); console.log(s.port);`], { stdout: "pipe" });
afterAll(() => host.kill());
/** its first line: the port it listens on */
async function portOf(out: ReadableStream<Uint8Array>) {
const r = out.getReader();
let text = "";
while (!text.includes("\n")) {
const { value, done } = await r.read();
if (done) throw new Error(`the test's host stopped before it listened: ${text}`);
text += new TextDecoder().decode(value);
}
r.releaseLock();
return Number(text.trim());
}
const HOST = `http://127.0.0.1:${await portOf(host.stdout)}`;
describe("the running app's host", () => {
test("on Windows, its pid is asked of tasklist (Windows has no kill)", () => {
const file = { "C:/Users/me/.raea/app-host.json": JSON.stringify({ url: HOST, pid: 4321 }) };
const up = here("win32", file, (cmd, args) => (cmd === "tasklist" && args.includes("PID eq 4321") ? { stdout: '"raea.exe","4321","Console","1","80,000 K"\r\n' } : {}));
expect(appHost(up)).toBe(HOST);
expect(up.ran.some(([c]) => c === "kill")).toBe(false);
// a file a stopped app left: tasklist finds no such process ("INFO: No tasks are running...")
const gone = here("win32", file, () => ({ stdout: "INFO: No tasks are running which match the specified criteria.\r\n" }));
expect(appHost(gone)).toBeNull();
});
test("on a Mac or Linux, kill -0", () => {
const file = { "/home/you/.raea/app-host.json": JSON.stringify({ url: HOST, pid: 99 }) };
expect(appHost(here("linux", file, (cmd) => ({ status: cmd === "kill" ? 0 : 1 })))).toBe(HOST);
expect(appHost(here("linux", file, (cmd) => ({ status: cmd === "kill" ? 1 : 0 })))).toBeNull();
});
});
describe("the installed app", () => {
test("on Windows, raea.exe in the folder its installer was given (Settings > Apps keeps it)", () => {
const reg = `\r\nHKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\raea\r\n InstallLocation REG_SZ D:\\Apps\\raea\r\n\r\n`;
const up = here("win32", { "D:\\Apps\\raea\\raea.exe": "" }, (cmd, args) => (cmd === "reg" && args[1] === WIN_KEY ? { stdout: reg } : {}));
expect(installedApp(up)).toBe("D:\\Apps\\raea\\raea.exe");
});
test("on Windows with no InstallLocation, the default folder", () => {
const up = here("win32", { "C:\\Users\\me\\AppData\\Local\\Programs\\raea\\raea.exe": "" }, () => ({ status: 1 }));
up.env.LOCALAPPDATA = "C:\\Users\\me\\AppData\\Local";
expect(installedApp(up)).toBe("C:\\Users\\me\\AppData\\Local\\Programs\\raea\\raea.exe");
});
test("on a Mac, raea.app in Applications; on Linux, the launcher raea.desktop runs", () => {
expect(installedApp(here("darwin", { "/Applications/raea.app": "" }))).toBe("/Applications/raea.app");
const desktop = "[Desktop Entry]\nName=raea\nExec=\"/home/you/.local/share/raea-app/launch.sh\"\n";
expect(installedApp(here("linux", { "/home/you/.local/share/applications/raea.desktop": desktop, "/home/you/.local/share/raea-app/launch.sh": "" }))).toBe("/home/you/.local/share/raea-app/launch.sh");
expect(installedApp(here("linux"))).toBeUndefined();
});
});
describe("raea show without the app", () => {
test("on Windows, each file opens in Windows' own viewer through Explorer, its path in Windows' slashes", () => {
const up = here("win32", {}, () => ({ status: 1 }));
const r = show({ files: ["C:/Users/me/cut & keep/a.mp4", "C:/Users/me/b.png"] }, up) as { opened: string[]; viewer: string };
expect(r.viewer).toBe("Windows' own viewer");
expect(up.ran.filter(([c]) => c === "explorer.exe")).toEqual([["explorer.exe", "C:\\Users\\me\\cut & keep\\a.mp4"], ["explorer.exe", "C:\\Users\\me\\b.png"]]);
expect(up.ran.some(([c]) => c === "open")).toBe(false);
});
test("a question needs the app, said for the system it runs on", () => {
expect(() => show({ files: [], question: "Which?" }, here("win32", {}, () => ({ status: 1 })))).toThrow("isn't on this PC");
expect(() => show({ files: [], question: "Which?" }, here("darwin"))).toThrow("isn't on this Mac");
expect(computer(here("linux")).name).toBe("this computer");
});
test("on Linux, xdg-open", () => {
const up = here("linux");
openFiles(["/home/you/a.mp4"], up);
expect(up.ran).toEqual([["xdg-open", "/home/you/a.mp4"]]);
});
});
describe("raea show starting the app", () => {
test("on Windows: raea.exe started through Explorer, its host waited for, the item posted, no raea:// link", () => {
const files: Record<string, string> = { "C:\\Users\\me\\AppData\\Local\\Programs\\raea\\raea.exe": "" };
const up = here("win32", files, (cmd, args) => {
// the app, once started, writes its host's address
if (cmd === "explorer.exe" && args[0].endsWith("raea.exe")) files["C:/Users/me/.raea/app-host.json"] = JSON.stringify({ url: HOST, pid: 77 });
if (cmd === "tasklist") return { stdout: '"raea.exe","77","Console","1","1 K"' };
return { status: cmd === "reg" ? 1 : 0 };
});
up.env.LOCALAPPDATA = "C:\\Users\\me\\AppData\\Local";
const r = show({ files: ["C:/Users/me/a.mp4"] }, up) as { url: string; brought: boolean };
expect(r).toEqual({ url: "raea://item/7", brought: false });
expect(up.ran.some(([c]) => c === "open" || c === "pgrep")).toBe(false);
});
test("on a Mac: open -a, and the window brought up on the item it was started for", () => {
const files: Record<string, string> = { "/Applications/raea.app": "" };
const up = here("darwin", files, (cmd, args) => {
if (cmd === "open" && args[0] === "-a") files["/home/you/.raea/app-host.json"] = JSON.stringify({ url: HOST, pid: 77 });
return { status: cmd === "pgrep" ? 1 : 0 };
});
expect(show({ files: ["/tmp/a.mp4"] }, up)).toEqual({ url: "raea://item/7", brought: true });
expect(up.ran.at(-1)).toEqual(["open", "raea://item/7"]);
});
});
describe("the harness that ran raea show", () => {
test("on Windows, found up every process's record from one PowerShell call, claude.exe as claude", () => {
const list = [`${process.pid}\t500\t"C:\\Users\\me\\raea\\bin\\raea.exe" show a.mp4`, `500\t400\t"C:\\Users\\me\\.local\\bin\\claude.exe" --resume`, `400\t1\tC:\\Windows\\explorer.exe`].join("\r\n");
const up = here("win32", {}, (cmd) => (cmd === "powershell" ? { stdout: list } : { status: 1 }));
expect(harness(up)).toEqual({ name: "Claude Code", pid: 500 });
expect(up.ran.filter(([c]) => c === "powershell")).toHaveLength(1);
});
test("a runtime's script by its name, the quoted path's spaces kept", () => {
const list = [`${process.pid}\t600\traea.exe show`, `600\t1\t"C:\\Program Files\\nodejs\\node.exe" C:\\Users\\me\\AppData\\Roaming\\npm\\gemini.cmd`].join("\n");
expect(harness(here("win32", {}, () => ({ stdout: list })))).toEqual({ name: "Gemini", pid: 600 });
});
test("on a Mac or Linux, ps up from the parent", () => {
const up = here("linux", {}, (cmd, args) => (cmd === "ps" && args.at(-1) === String(process.ppid) ? { stdout: " 1 /usr/local/bin/codex exec" } : { stdout: "" }));
expect(harness(up)).toEqual({ name: "Codex", pid: process.ppid });
});
});
describe("a path from the cwd", () => {
test("a Windows one is absolute, with either slash, a share's too", () => {
for (const p of ["C:\\Users\\me\\a.mp4", "c:/x", "\\\\nas\\clips\\a.mp4", "\\x", "/x"]) expect(absolute(p)).toBe(true);
for (const p of ["a.mp4", "cuts\\a.mp4", "C:a.mp4", "./a"]) expect(absolute(p)).toBe(false);
expect(fromCwd("C:/Users/me/proj", "D:\\clips\\a.mp4")).toBe("D:\\clips\\a.mp4");
expect(fromCwd("C:/Users/me/proj/", "out\\a.png")).toBe("C:/Users/me/proj/out\\a.png");
expect(fromCwd("/home/you", "a.png")).toBe("/home/you/a.png");
});
});
describe("a logo's pixels, on any system", () => {
// until 0.1.8 asked of sips, a Mac's: on Windows and Linux every raster logo in brand.json had no size. Each is the
// head of a 37x23 image from a real encoder (ffmpeg's PNG, GIF and ICO; cwebp's lossy and lossless; Pillow's WebP with
// alpha, VP8X; sips's JPEG, an Exif and a Photoshop block before its frame; ImageMagick's progressive JPEG)
const HEADS: Record<string, string> = {
png: "iVBORw0KGgoAAAANSUhEUgAAACUAAAAX",
gif: "R0lGODlhJQAXAA==",
"webp lossy": "UklGRiACAABXRUJQVlA4IBQCAAAwDwCdASolABcA",
"webp lossless": "UklGRrIAAABXRUJQVlA4TKUAAAAvJIAF",
"webp with alpha": "UklGRkwCAABXRUJQVlA4IEACAABQDwCdASolABcA",
ico: "AAABAAEAJRc=",
jpeg: "/9j/4AAQSkZJRgABAQAASABIAAD/4QBMRXhpZgAATU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAJaADAAQAAAABAAAAFwAAAAD/7QA4UGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAAA4QklNBCUAAAAAABDUHYzZjwCyBOmACZjs+EJ+/8AAEQgAFwAlAw==",
"jpeg progressive": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/2wBDAQMDAwQDBAgEBAgQCwkLEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBD/wgARCAAXACUD",
};
for (const [kind, head] of Object.entries(HEADS)) {
test(kind, () => expect(pixelsOf(Buffer.from(head, "base64"))).toEqual({ width: 37, height: 23 }));
}
test("anything else, or a header cut short, has none", () => {
expect(pixelsOf(new TextEncoder().encode("II*\0 a TIFF"))).toBeUndefined();
expect(pixelsOf(Buffer.from(HEADS.png, "base64").subarray(0, 18))).toBeUndefined();
expect(pixelsOf(new Uint8Array())).toBeUndefined();
});
});
+134 -28
View File
@@ -1,25 +1,104 @@
// The raea app's host, as the native `raea` reaches it (native.ts): where the running app listens, and the verbs that
// post to it: `raea show` (and its --on tasks), `raea library`, and the agent harness a show names as its poster.
// post to it: `raea show` (and its --on tasks), `raea library`, and the agent harness a show names as its poster. On a
// Mac, Windows or Linux (#169: on Windows `raea show` never found the running app, since it asked `kill`, and said it
// had opened the files "in the Mac's own viewer", which it hadn't).
import { spawnSync } from "node:child_process";
import { existsSync, readFileSync } from "node:fs";
import { homedir } from "node:os";
import { basename } from "node:path";
import { HARNESSES } from "./show";
/** What these verbs ask of the computer they run on (a test gives its own: conformance/app.test.ts). */
export interface Here {
platform: string;
run: (cmd: string, args: string[]) => { status: number | null; stdout: string };
exists: (path: string) => boolean;
read: (path: string) => string;
env: Record<string, string | undefined>;
home: string;
}
export const HERE: Here = {
platform: process.platform,
run: (cmd, args) => {
const r = spawnSync(cmd, args, { encoding: "utf8" });
return { status: r.status, stdout: r.stdout ?? "" };
},
exists: existsSync,
read: (p) => readFileSync(p, "utf8"),
env: process.env,
home: homedir(),
};
/** This computer as raea names it, and the viewer files open in without the app. */
export function computer(h: Here = HERE): { name: string; viewer: string } {
if (h.platform === "darwin") return { name: "this Mac", viewer: "the Mac's own viewer" };
if (h.platform === "win32") return { name: "this PC", viewer: "Windows' own viewer" };
return { name: "this computer", viewer: "the desktop's own viewer" };
}
/** Whether process `pid` is running: `kill -0`, or on Windows (which has no kill) tasklist. */
function alive(pid: number, h: Here): boolean {
if (h.platform !== "win32") return h.run("kill", ["-0", String(pid)]).status === 0;
return h.run("tasklist", ["/FI", `PID eq ${pid}`, "/NH", "/FO", "CSV"]).stdout.includes(`"${pid}"`);
}
/** The running raea app's host: RAEA_FEED_HOST for an agent the app started, else the address the installed app leaves
* in ~/.raea/app-host.json while it runs (apps/app host/host-file.ts), if its process is still there. */
function appHost(): string | null {
if (process.env.RAEA_FEED_HOST) return process.env.RAEA_FEED_HOST;
const file = process.env.RAEA_HOST_FILE || `${homedir()}/.raea/app-host.json`;
export function appHost(h: Here = HERE): string | null {
if (h.env.RAEA_FEED_HOST) return h.env.RAEA_FEED_HOST;
const file = h.env.RAEA_HOST_FILE || `${h.home}/.raea/app-host.json`;
try {
const h = JSON.parse(readFileSync(file, "utf8")) as { url?: string; pid?: number };
if (h.url && h.pid && spawnSync("kill", ["-0", String(h.pid)]).status === 0) return h.url;
const x = JSON.parse(h.read(file)) as { url?: string; pid?: number };
if (x.url && x.pid && alive(x.pid, h)) return x.url;
} catch {
// no app running, or a file left by one that stopped
}
return null;
}
/** The installed raea app, RAEA_APP first: on a Mac raea.app in Applications; on Windows raea.exe in the folder its
* installer put it in (the person picks it, #178; Settings > Apps keeps it as InstallLocation), else the default; on
* Linux the launch.sh that linux/install.sh's raea.desktop runs. */
export function installedApp(h: Here = HERE): string | undefined {
const at: (string | undefined)[] = [h.env.RAEA_APP];
if (h.platform === "darwin") at.push("/Applications/raea.app", `${h.home}/Applications/raea.app`);
else if (h.platform === "win32") {
const q = h.run("reg", ["query", "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\raea", "/v", "InstallLocation"]).stdout;
const dir = /InstallLocation\s+REG_\w+\s+(.+?)\s*$/m.exec(q)?.[1];
if (dir) at.push(`${dir.replace(/[\\/]$/, "")}\\raea.exe`);
if (h.env.LOCALAPPDATA) at.push(`${h.env.LOCALAPPDATA}\\Programs\\raea\\raea.exe`);
} else {
try {
const entry = h.read(`${h.env.XDG_DATA_HOME || `${h.home}/.local/share`}/applications/raea.desktop`);
at.push(/^Exec="?([^"\n]+?)"?\s*$/m.exec(entry)?.[1]);
} catch {
// not in the desktop's app list
}
}
return at.find((p) => p && h.exists(p));
}
/** Files opened as the system opens them (a double-click's app): open, Windows' Explorer, xdg-open. */
export function openFiles(files: string[], h: Here = HERE) {
if (h.platform === "darwin") h.run("open", files);
// Explorer, not cmd's start: start reads its line as cmd does, so a folder named with & or ^ breaks it
else if (h.platform === "win32") for (const f of files) h.run("explorer.exe", [f.replace(/\//g, "\\")]);
else for (const f of files) h.run("xdg-open", [f]);
}
/** The installed app started: open -a on a Mac, Explorer on Windows, its launch.sh in the background on Linux. */
export function startApp(app: string, h: Here = HERE) {
if (h.platform === "darwin") h.run("open", ["-a", app]);
else if (h.platform === "win32") h.run("explorer.exe", [app]);
else h.run("sh", ["-c", 'nohup "$0" >/dev/null 2>&1 &', app]);
}
/** A quarter of a second between looks for the app's host (Windows has no sleep command: PowerShell's). */
function pause(h: Here) {
if (h.platform === "win32") h.run("powershell", ["-NoProfile", "-Command", "Start-Sleep -Milliseconds 250"]);
else h.run("/bin/sleep", ["0.25"]);
}
/** POST a host route of the raea app at `at`, answering its JSON; its refusal is thrown as it says it. */
function postHost(at: string, route: string, a: Record<string, unknown>): any {
const r = spawnSync("curl", ["-sS", "--max-time", "120", "-w", "\n%{http_code}", "-H", "content-type: application/json", "--data-binary", "@-", `${at.replace(/\/$/, "")}${route}`], { input: JSON.stringify(a), encoding: "utf8", maxBuffer: 64 << 20 });
@@ -33,24 +112,26 @@ function postHost(at: string, route: string, a: Record<string, unknown>): any {
/** `raea show` (show.ts): the item made by the raea app's host (apps/app host/show.ts), the app started first when it's
* installed and not running. The window is brought up on it by its raea:// link only with --open or when the app was
* just started; otherwise the page finds it and says so. Without the app, the files open in the Mac's own viewer. */
export function show(a: Record<string, unknown>): unknown {
let at = appHost();
* just started (on a Mac or Linux: Windows' app has no raea:// link, so there the post lands as its notice); otherwise
* the page finds it and says so. Without the app, the files open in the system's own viewer. */
export function show(a: Record<string, unknown>, h: Here = HERE): unknown {
let at = appHost(h);
let launched = false;
if (!at) {
const app = [process.env.RAEA_APP, "/Applications/raea.app", `${homedir()}/Applications/raea.app`].find((p) => p && existsSync(p));
const app = installedApp(h);
const files = (a.files as string[]) ?? [];
if (!app) {
if (a.question || a.questions) throw new Error("a question needs the raea app, and it isn't on this Mac (raea.io)");
spawnSync("open", files);
return { opened: files };
if (a.question || a.questions) throw new Error(`a question needs the raea app, and it isn't on ${computer(h).name} (raea.io)`);
openFiles(files, h);
return { opened: files, ...computer(h) };
}
if (spawnSync("pgrep", ["-f", `${app}/Contents/MacOS/raea-window`]).status === 0)
if (h.platform === "darwin" && h.run("pgrep", ["-f", `${app}/Contents/MacOS/raea-window`]).status === 0)
throw new Error("the raea app running here is older than raea show (it leaves no ~/.raea/app-host.json); quit it and open it again to update, then show it again");
spawnSync("open", ["-a", app]);
startApp(app, h);
launched = true;
// the window's host writes its address once it listens: a minute at most, in quarter seconds
for (let i = 0; i < 240 && !(at = appHost()); i++) spawnSync("/bin/sleep", ["0.25"]);
// the window's host writes its address once it listens: a minute at most
const until = Date.now() + 60_000;
while (!(at = appHost(h)) && Date.now() < until) pause(h);
if (!at) throw new Error(`the raea app didn't start (no ~/.raea/app-host.json after a minute); open ${app} and show it again`);
}
let shown: { url: string };
@@ -72,23 +153,48 @@ export function show(a: Record<string, unknown>): unknown {
return false;
}
})();
const brought = !process.env.RAEA_NO_OPEN && (a.open === true || launched || !finds);
if (brought) spawnSync("open", [shown.url]);
const brought = !h.env.RAEA_NO_OPEN && h.platform !== "win32" && (a.open === true || launched || !finds);
if (brought) h.run(h.platform === "darwin" ? "open" : "xdg-open", [shown.url]);
return { ...shown, brought };
}
/** A process's parent and command line: ps, or on Windows every process's at once from PowerShell (one call, not one
* per step up: each takes a good part of a second there). */
function processes(h: Here): { start: number; of: (pid: number) => { ppid: number; args: string } | undefined } {
if (h.platform !== "win32") {
return {
start: process.ppid,
of: (pid) => {
const m = /^\s*(\d+)\s+(.*)$/.exec(h.run("ps", ["-o", "ppid=,args=", "-p", String(pid)]).stdout);
return m ? { ppid: Number(m[1]), args: m[2] } : undefined;
},
};
}
const all = new Map<number, { ppid: number; args: string }>();
const list = h.run("powershell", ["-NoProfile", "-NonInteractive", "-Command", "Get-CimInstance Win32_Process | ForEach-Object { '{0}`t{1}`t{2}' -f $_.ProcessId, $_.ParentProcessId, $_.CommandLine }"]).stdout;
for (const line of list.split(/\r?\n/)) {
const [pid, ppid, ...args] = line.split("\t");
if (Number(pid) > 0) all.set(Number(pid), { ppid: Number(ppid), args: args.join("\t") });
}
return { start: all.get(process.pid)?.ppid ?? 0, of: (pid) => all.get(pid) };
}
/** The agent harness that started this command (show.ts HARNESSES), found up its parent processes: a program's own
* name, or the script a runtime runs (`node .../gemini`). Nothing when no harness is up there. */
export function harness(): { name: string; pid: number } | undefined {
let pid = process.ppid;
* name (claude, or on Windows claude.exe), or the script a runtime runs (`node .../gemini`). Nothing when no harness
* is up there. (Until 0.1.8 raea's engine had no process.ppid, so this found none anywhere.) */
export function harness(h: Here = HERE): { name: string; pid: number } | undefined {
const up = processes(h);
let pid = up.start;
for (let i = 0; i < 16 && pid > 1; i++) {
const m = /^\s*(\d+)\s+(.*)$/.exec(spawnSync("ps", ["-o", "ppid=,args=", "-p", String(pid)], { encoding: "utf8" }).stdout ?? "");
if (!m) return undefined;
for (const w of m[2].split(/\s+/).slice(0, 2).map((w) => basename(w).toLowerCase())) {
const p = up.of(pid);
if (!p) return undefined;
// a Windows command line quotes a path with spaces in it: "C:\Program Files\nodejs\node.exe" ...
const words = (p.args.match(/"[^"]*"|\S+/g) ?? []).slice(0, 2).map((w) => w.replace(/^"|"$/g, ""));
for (const w of words.map((w) => w.split(/[\\/]/).pop()!.toLowerCase().replace(/\.(exe|cmd|bat|ps1)$/, ""))) {
const hit = HARNESSES.find(([re]) => re.test(w));
if (hit) return { name: hit[1], pid };
}
pid = Number(m[1]);
pid = p.ppid;
}
return undefined;
}
@@ -109,7 +215,7 @@ export function task(a: Record<string, unknown>): unknown {
/** An op of the feed host's libraries (apps/app host/library/service.ts): POST <the app's host>/host/library. */
export function library(a: Record<string, unknown>): unknown {
const at = appHost();
if (!at) throw new Error("libraries live in the raea app: open it on this Mac (or set RAEA_FEED_HOST to its address)");
if (!at) throw new Error(`libraries live in the raea app: open it on ${computer().name} (or set RAEA_FEED_HOST to its address)`);
return postHost(at, "/host/library", a);
}
+29
View File
@@ -251,3 +251,32 @@ export function brandKit(input: BrandInput, date = new Date().toISOString().slic
];
return { files, said: said.join("\n") };
}
/** A raster's pixels from its header: PNG, GIF, JPEG, WebP or ICO (a logo's formats), on any system */
export function pixelsOf(b: Uint8Array): { width: number; height: number } | undefined {
const v = new DataView(b.buffer, b.byteOffset, b.byteLength);
const tag = (at: number, s: string) => String.fromCharCode(...b.subarray(at, at + s.length)) === s;
const wh = (width: number, height: number) => (width > 0 && height > 0 ? { width, height } : undefined);
try {
if (tag(1, "PNG")) return wh(v.getUint32(16), v.getUint32(20));
if (tag(0, "GIF8")) return wh(v.getUint16(6, true), v.getUint16(8, true));
if (tag(0, "RIFF") && tag(8, "WEBP")) {
if (tag(12, "VP8 ")) return wh(v.getUint16(26, true) & 0x3fff, v.getUint16(28, true) & 0x3fff);
if (tag(12, "VP8L")) return wh(1 + (((b[22] & 0x3f) << 8) | b[21]), 1 + (((b[24] & 0xf) << 10) | (b[23] << 2) | ((b[22] & 0xc0) >> 6)));
if (tag(12, "VP8X")) return wh(1 + (b[24] | (b[25] << 8) | (b[26] << 16)), 1 + (b[27] | (b[28] << 8) | (b[29] << 16)));
}
if (b[0] === 0 && b[1] === 0 && b[2] === 1 && b[3] === 0) return wh(b[6] || 256, b[7] || 256);
if (b[0] === 0xff && b[1] === 0xd8) {
// JPEG: its segments up to the first frame header (SOF0-15, not DHT, JPG or DAC)
for (let i = 2; i + 9 < b.length; ) {
if (b[i] !== 0xff) return undefined;
const m = b[i + 1];
if (m >= 0xc0 && m <= 0xcf && m !== 0xc4 && m !== 0xc8 && m !== 0xcc) return wh(v.getUint16(i + 7), v.getUint16(i + 5));
i += 2 + v.getUint16(i + 2);
}
}
} catch {
// a header cut short
}
return undefined;
}
+9 -5
View File
@@ -24,7 +24,7 @@ const out = (stdout: string, exitCode = 0, stderr = "") => ({ stdout, stderr, ex
// `raea library` (library.ts), kept apart from the imports above
import { libraryVerb } from "./library";
// `raea show` (show.ts): what a session shows the person, in the raea app
import { labelsIn, showVerb } from "./show";
import { absolute, fromCwd, labelsIn, showVerb } from "./show";
// `raea clothes` (clothes.ts): garments for SOMA's body from words
import { clothesVerb } from "./clothes";
// `raea bug` (bug.ts): an agent's report of a bug in raea, to raea's server
@@ -113,8 +113,12 @@ Not there: React hooks come from "react" (useMemo, useState), not from raea.
/** The workspace a folder is in: the nearest folder at or above it holding .raea/workspace, through the shell's fs. */
async function workspaceAbove(c: Ctx, from: string): Promise<string | undefined> {
for (let d = from.replace(/\/$/, ""); d; d = d.slice(0, d.lastIndexOf("/"))) {
// up to the root, / or on Windows C:
for (let d = from.replace(/[\\/]+$/, ""); d; ) {
if (await c.fs.exists(`${d}/.raea/workspace`)) return d;
const up = Math.max(d.lastIndexOf("/"), d.lastIndexOf("\\"));
if (up < 0) break;
d = d.slice(0, up);
}
return undefined;
}
@@ -123,7 +127,7 @@ async function workspaceAbove(c: Ctx, from: string): Promise<string | undefined>
export function raeaHandler(host?: Host, engine?: Engine) {
return async (args: string[], ctx: unknown) => {
const c = ctx as unknown as Ctx;
const p = (rel: string) => (rel.startsWith("/") ? rel : `${c.cwd.replace(/\/$/, "")}/${rel}`);
const p = (rel: string) => fromCwd(c.cwd, rel);
const ask = (op: string, a: Record<string, unknown> = {}) => {
if (!host) throw new Error(`raea ${op} needs a host (the native raea's src/native.ts); this shell has none`);
return host(op, a);
@@ -163,7 +167,7 @@ export function raeaHandler(host?: Host, engine?: Engine) {
if (args.includes("--layout") && args[args.indexOf("--layout") + 1] !== "feature") return out("", 2, "raea init [--layout feature]\n");
if (args.includes("--layout")) {
for (const d of FEATURE_DIRS) await c.fs.mkdir(p(d), { recursive: true });
const name = c.cwd.replace(/\/$/, "").split("/").pop() || "project";
const name = c.cwd.replace(/[\\/]$/, "").split(/[\\/]/).pop() || "project";
for (const [f, body] of Object.entries(featureLayout(name, shape))) await put(f, body);
return out(made.length ? `made ${made.join(", ")}; render it with raea render src/main.tsx\n` : "nothing to make: the project's files are here\n");
}
@@ -205,7 +209,7 @@ export function raeaHandler(host?: Host, engine?: Engine) {
}
await c.fs.mkdir(p(home), { recursive: true });
const done: string[] = [];
const shown = (rel: string) => (home.startsWith("/") ? `shared/components/${rel.slice(home.length + 1)}` : rel);
const shown = (rel: string) => (absolute(home) ? `shared/components/${rel.slice(home.length + 1)}` : rel);
for (const n of names) {
const set = REGISTRY[n];
if (set) {
+9 -3
View File
@@ -7,16 +7,17 @@ import { spawnSync } from "node:child_process";
import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { basename, delimiter, dirname, extname } from "node:path";
import { brandKit } from "./brand";
import { brandKit, pixelsOf } from "./brand";
import { readSite, stylesOf } from "./scrape";
import { wordsOf } from "./heard";
import { harness, library, show, task } from "./app";
import { fromCwd } from "./show";
import { clothesHost } from "./wardrobe";
import { raeaHandler, type Engine, type Host } from "./index";
const [raea, ...args] = process.argv.slice(2);
const cwd = process.cwd();
const at = (p: string) => (p.startsWith("/") ? p : `${cwd}/${p}`);
const at = (p: string) => fromCwd(cwd, p);
/** The project's shape: its cut's (cuts.json's edit), else a 1080x1920 vertical at 30 fps */
function shape() {
@@ -98,6 +99,9 @@ function ensure(name: string): string {
}
function hearTake(take: string, out: string) {
// parakeet-mlx is Apple silicon's (MLX); elsewhere raea has no transcriber yet, so the two ways that work there
if (process.platform !== "darwin")
throw new Error(`cutting ${take} by its words needs its transcript, and raea transcribes only on a Mac so far: give it one as ${basename(out)} ([{ "text", "start_ms", "end_ms" }], beside it), or cut it by time: --at A-B`);
const dir = mkdtempSync(`${tmpdir()}/raea-hear-`);
try {
const wav = `${dir}/take.wav`;
@@ -339,13 +343,15 @@ function curl(url: string, o: { out?: string; secs?: number } = {}): { body: str
return { body, url: final || url };
}
/** A logo's size: an SVG's viewBox or width/height, a raster's pixels by sips */
/** A logo's size: an SVG's viewBox or width/height, a raster's pixels from its header (else, on a Mac, by sips) */
function sizeOf(file: string): { width?: number; height?: number } {
if (file.endsWith(".svg")) {
const head = readFileSync(file, "utf8").slice(0, 2000);
const vb = /viewBox\s*=\s*["']\s*[-\d.]+[\s,]+[-\d.]+[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(head);
return vb ? { width: Math.round(+vb[1]), height: Math.round(+vb[2]) } : {};
}
const own = pixelsOf(readFileSync(file));
if (own || process.platform !== "darwin") return own ?? {};
const r = spawnSync("sips", ["-g", "pixelWidth", "-g", "pixelHeight", file], { encoding: "utf8" });
const n = (k: string) => Number(new RegExp(`${k}: (\\d+)`).exec(r.stdout ?? "")?.[1]) || undefined;
return { width: n("pixelWidth"), height: n("pixelHeight") };
+10 -2
View File
@@ -50,6 +50,14 @@ const FLAGS = new Set(["--open"]);
/** The harness an agent runs in, named as the feed shows it, from the program that started this command (native.ts
* walks up its parents): any harness, not only the ones that mark their shells. */
/** Whether a path is absolute: POSIX's /..., and Windows' C:\... (or C:/...), \\server\share\... and \... Until 0.1.8
* only a POSIX one was, so on Windows `raea show C:\...\cut.mp4` named a file under the cwd (#169). Here, not node:path:
* index.ts runs in the app's own shell too, with no Node. */
export const absolute = (f: string) => /^(?:[\\/]|[A-Za-z]:[\\/])/.test(f);
/** `f` from `cwd`: itself when it's absolute */
export const fromCwd = (cwd: string, f: string) => (absolute(f) ? f : `${cwd.replace(/[\\/]$/, "")}/${f}`);
export const HARNESSES: [RegExp, string][] = [
[/^claude$/, "Claude Code"], [/^codex/, "Codex"], [/^gemini$/, "Gemini"], [/^kimi$/, "Kimi"], [/^opencode$/, "OpenCode"],
[/^goose$/, "Goose"], [/^cursor-agent$/, "Cursor"], [/^amp$/, "Amp"], [/^qwen$/, "Qwen Code"], [/^crush$/, "Crush"], [/^aider$/, "Aider"],
@@ -80,7 +88,7 @@ export function parseShow(args: string[], cwd: string) {
const choices = many("--choice");
const unknown = args.find((a, i) => a.startsWith("--") && !WITH_VALUE.has(a) && !FLAGS.has(a) && !WITH_VALUE.has(args[i - 1] ?? ""));
if (unknown) throw new Error(`no ${unknown} here\n${SHOW_USAGE}`);
const abs = (f: string) => (f.startsWith("/") ? f : `${cwd.replace(/\/$/, "")}/${f}`);
const abs = (f: string) => fromCwd(cwd, f);
const files = args.filter((a, i) => !a.startsWith("--") && !WITH_VALUE.has(args[i - 1] ?? "")).map(abs);
// the questions in order: each --question starts one and its --choice's follow; a --preview after a --choice is that
// choice's, after the --question (before any choice) the question's own
@@ -151,7 +159,7 @@ export function showVerb(ask: Ask, args: string[], cwd: string, env: Record<stri
if (a.sign !== undefined && (a.working.length !== 1 || a.done.length || !a.clip || !a.render)) throw new Error(`--sign N shows one comment's clip: raea show --on ITEM --working ID --sign N --clip FILE --render HASH\n${SHOW_USAGE}`);
if ((a.clip || a.render) && a.sign === undefined) throw new Error(`--clip and --render go with --sign N, the ask the clip is for\n${SHOW_USAGE}`);
if (a.states && a.asks.length && a.states.length !== a.asks.length) throw new Error(`--states says one state for each --ask: ${a.asks.length} asks, ${a.states.length} states\n${SHOW_USAGE}`);
const sign = a.sign === undefined ? undefined : { ask: Number(a.sign), clip: a.clip!.startsWith("/") ? a.clip : `${cwd.replace(/\/$/, "")}/${a.clip}`, render: a.render };
const sign = a.sign === undefined ? undefined : { ask: Number(a.sign), clip: fromCwd(cwd, a.clip!), render: a.render };
const mark = (item: string, comments: string[], state: "working" | "done", version?: string) =>
ask("task", { item, comments, state, by, sub: a.sub, note: state === "done" ? a.note : undefined, asks: state === "working" && a.asks.length ? a.asks : undefined, version, ...(state === "working" ? { status: a.status, states: a.states, sign } : {}) }) as { item: string; comments: string[] };
const said = (m: { item: string; comments: string[] }, state: string) => `Marked ${m.comments.join(", ")} ${state} on ${m.item}: the person sees ${a.sub ? `${by.name} · ${a.sub}` : by.name} ${state === "working" ? "on them" : "finished them"}${state === "working" && a.status ? `; it reads "${a.status}"${a.states?.length ? ` (its asks: ${a.states.join(", ")})` : ""}` : ""}.`;
+3 -1
View File
@@ -186,7 +186,9 @@ fn run_here(root: &Path, cwd: &Path, entry: Entry, argv: Vec<String>, env: serde
let globals = [
("__raea_argv", json!(argv)),
("__raea_env", Value::Object(env)),
("__raea_platform", json!(if cfg!(target_os = "ios") { "ios" } else { std::env::consts::OS })),
// process.platform in Node's words (darwin, win32, linux): until 0.1.8 Rust's (macos, windows), so the agent
// shell's every test for a Mac or a Windows PC was false (#169)
("__raea_platform", json!(match std::env::consts::OS { "macos" => "darwin", "windows" => "win32", os => os })),
("__raea_stdin", json!(stdin)),
("__raea_cwd", json!(cwd.display().to_string())),
];
+106 -53
View File
@@ -97,7 +97,12 @@
return encoding ? b.toString(encoding) : b;
};
// ---- path (POSIX) -------------------------------------------------------------------------------------------------
// ---- path ---------------------------------------------------------------------------------------------------------
// POSIX's, and on Windows Windows' parsing: a drive's root (C:\), a share's (\\server\share\) and the cwd's drive's
// (\) start an absolute path, and \ separates as / does. A Windows path comes out with / (which Windows' calls all
// take), so the tools' own "a/b" joins, splits and prefix tests hold there too. Until 0.1.8 every Windows path was a
// relative one here: resolve(".") named "/C:\Users\...", no folder at all, and isAbsolute("C:\x") was false (#169).
const win = g.process.platform === "win32";
const normalizeParts = (parts, abs) => {
const out = [];
for (const p of parts) {
@@ -107,48 +112,79 @@
}
return out;
};
const path = {
sep: "/", delimiter: ":",
normalize(p) {
if (p === "") return ".";
const abs = p.startsWith("/"), trail = p.endsWith("/");
let s = normalizeParts(p.split("/"), abs).join("/");
if (!s && !abs) s = ".";
if (s && trail) s += "/";
return (abs ? "/" : "") + s;
},
join(...a) { const s = a.filter((x) => x !== "").join("/"); return s ? path.normalize(s) : "."; },
resolve(...a) {
let r = "";
for (let i = a.length - 1; i >= 0 && !r.startsWith("/"); i--) if (a[i]) r = a[i] + (r ? "/" + r : "");
if (!r.startsWith("/")) r = proc.cwd() + (r ? "/" + r : "");
const s = "/" + normalizeParts(r.split("/"), true).join("/");
return s;
},
isAbsolute: (p) => p.startsWith("/"),
dirname(p) {
if (!p) return ".";
const s = p.replace(/\/+$/, "");
if (!s) return "/";
const i = s.lastIndexOf("/");
return i < 0 ? "." : i === 0 ? "/" : s.slice(0, i);
},
basename(p, ext) {
let b = p.replace(/\/+$/, "");
b = b.slice(b.lastIndexOf("/") + 1);
return ext && b.endsWith(ext) && b !== ext ? b.slice(0, -ext.length) : b;
},
extname(p) { const b = path.basename(p); const i = b.lastIndexOf("."); return i <= 0 ? "" : b.slice(i); },
relative(from, to) {
const f = path.resolve(from).split("/").filter(Boolean), t = path.resolve(to).split("/").filter(Boolean);
let i = 0;
while (i < f.length && i < t.length && f[i] === t[i]) i++;
return [...Array(f.length - i).fill(".."), ...t.slice(i)].join("/");
},
parse(p) { const base = path.basename(p), ext = path.extname(p); return { root: p.startsWith("/") ? "/" : "", dir: path.dirname(p), base, ext, name: ext ? base.slice(0, -ext.length) : base }; },
format(o) { return (o.dir ? o.dir + "/" : o.root || "") + (o.base || (o.name || "") + (o.ext || "")); },
/** path for POSIX or (`windows`) Windows, its paths written with / */
const pathFor = (windows) => {
const slash = windows ? (x) => String(x).replace(/\\/g, "/") : (x) => String(x);
// the root an absolute path starts with, "" for a relative one: "/", and on Windows "C:/" or "//server/share/"
const rootOf = (x) => {
if (!windows) return x.startsWith("/") ? "/" : "";
const share = /^\/\/[^/]+\/[^/]+(?:\/|$)/.exec(x);
if (share) return share[0].endsWith("/") ? share[0] : share[0] + "/";
const drive = /^[A-Za-z]:\//.exec(x);
return drive ? drive[0] : x.startsWith("/") ? "/" : "";
};
// Windows' names don't care about case
const same = windows ? (a, b) => a.toLowerCase() === b.toLowerCase() : (a, b) => a === b;
const P = {
sep: "/", delimiter: windows ? ";" : ":",
normalize(x) {
x = slash(x);
if (x === "") return ".";
const root = rootOf(x), trail = x.endsWith("/") && x.length > root.length;
let s = normalizeParts(x.slice(root.length).split("/"), !!root).join("/");
if (!s && !root) s = ".";
if (s && trail) s += "/";
return root + s;
},
join(...a) { const s = a.filter((x) => x !== "").join("/"); return s ? P.normalize(s) : "."; },
resolve(...a) {
let r = "";
for (let i = a.length - 1; i >= 0 && !rootOf(r); i--) if (a[i]) r = slash(a[i]) + (r ? "/" + r : "");
const here = slash(proc.cwd());
if (!rootOf(r)) r = here + (r ? "/" + r : "");
// a bare \ on Windows is the cwd's drive's root
if (windows && rootOf(r) === "/") r = (/^[A-Za-z]:/.exec(here) || [""])[0] + r;
const root = rootOf(r);
return root + normalizeParts(r.slice(root.length).split("/"), true).join("/");
},
isAbsolute: (x) => rootOf(slash(x)) !== "",
dirname(x) {
if (!x) return ".";
x = slash(x);
const root = rootOf(x), s = x.replace(/\/+$/, "");
if (s.length < root.length) return root;
const i = s.lastIndexOf("/");
return i < 0 ? "." : i < root.length ? root : s.slice(0, i);
},
basename(x, ext) {
x = slash(x);
let b = x.replace(/\/+$/, "");
b = b.length < rootOf(x).length ? "" : b.slice(b.lastIndexOf("/") + 1);
return ext && b.endsWith(ext) && b !== ext ? b.slice(0, -ext.length) : b;
},
extname(x) { const b = P.basename(x); const i = b.lastIndexOf("."); return i <= 0 ? "" : b.slice(i); },
relative(from, to) {
const a = P.resolve(from), b = P.resolve(to);
// another drive (or share) on Windows: no way there but the whole path
if (!same(rootOf(a), rootOf(b))) return b;
const f = a.slice(rootOf(a).length).split("/").filter(Boolean), t = b.slice(rootOf(b).length).split("/").filter(Boolean);
let i = 0;
while (i < f.length && i < t.length && same(f[i], t[i])) i++;
return [...Array(f.length - i).fill(".."), ...t.slice(i)].join("/");
},
parse(x) { const base = P.basename(x), ext = P.extname(x); return { root: rootOf(slash(x)), dir: P.dirname(x), base, ext, name: ext ? base.slice(0, -ext.length) : base }; },
format(o) { return (o.dir ? o.dir + "/" : o.root || "") + (o.base || (o.name || "") + (o.ext || "")); },
};
return P;
};
path.posix = path;
const path = pathFor(win);
path.posix = win ? pathFor(false) : path;
// Windows' parsing on any system (Node's path.win32 writes \; this one /, as raea's Windows does)
path.win32 = win ? path : pathFor(true);
path.posix.posix = path.win32.posix = path.posix;
path.posix.win32 = path.win32.win32 = path.win32;
/** a path a native gave, as path writes it: / on Windows */
const fwd = win ? (x) => String(x).replace(/\\/g, "/") : (x) => x;
// ---- fs ---------------------------------------------------------------------------------------------------------------
const stats = (s) => ({
@@ -171,8 +207,8 @@
rmdirSync(p, o) { call("rm", pathOf(p), !!(o && o.recursive), false); },
renameSync: (a, b) => call("rename", pathOf(a), pathOf(b)),
copyFileSync: (a, b) => call("copyFile", pathOf(a), pathOf(b)),
realpathSync: (p) => call("realpath", pathOf(p)),
mkdtempSync: (prefix) => call("mkdtemp", String(prefix)),
realpathSync: (p) => fwd(call("realpath", pathOf(p))),
mkdtempSync: (prefix) => fwd(call("mkdtemp", String(prefix))),
constants: { F_OK: 0, R_OK: 4, W_OK: 2, X_OK: 1 },
createWriteStream(p) { fs.writeFileSync(p, ""); return { write(d) { fs.appendFileSync(p, d); return true; }, end(d) { if (d) fs.appendFileSync(p, d); }, on() { return this; } }; },
};
@@ -186,9 +222,11 @@
fs.promises = promises;
// ---- os, crypto, child_process --------------------------------------------------------------------------------------
// the system's own words, as Node gives them (until 0.1.8 every system here was an arm64 Mac's)
const os = {
tmpdir: () => call("tmpdir"), homedir: () => call("homedir"), platform: () => "darwin", arch: () => "arm64", EOL: "\n",
cpus: () => Array.from({ length: 8 }, () => ({ model: "", speed: 0 })), type: () => "Darwin", release: () => "", hostname: () => "raea", endianness: () => "LE",
tmpdir: () => fwd(call("tmpdir")), homedir: () => fwd(call("homedir")), platform: () => proc.platform, arch: () => proc.arch, EOL: win ? "\r\n" : "\n",
cpus: () => Array.from({ length: 8 }, () => ({ model: "", speed: 0 })), type: () => ({ darwin: "Darwin", win32: "Windows_NT", linux: "Linux" })[proc.platform] || proc.platform,
release: () => "", hostname: () => "raea", endianness: () => "LE",
};
const crypto = {
createHash(alg) {
@@ -226,18 +264,23 @@
if (r.status !== 0) { const e = new Error(`Command failed: ${cmd} ${(args || []).join(" ")}\n${r.stderr}`); e.status = r.status; e.stdout = r.stdout; e.stderr = r.stderr; throw e; }
return r.stdout;
},
execSync(command, o) { return childProcess.execFileSync("/bin/sh", ["-c", String(command)], o); },
// a command line through the system's shell, as Node's: sh, or on Windows cmd
execSync(command, o) { return win ? childProcess.execFileSync(g.process.env.ComSpec || "cmd.exe", ["/d", "/s", "/c", String(command)], o) : childProcess.execFileSync("/bin/sh", ["-c", String(command)], o); },
};
// ---- process, url, util, events, module ---------------------------------------------------------------------------
const proc = g.process;
let cwd = call("cwd");
let cwd = fwd(call("cwd"));
proc.cwd = () => cwd;
proc.chdir = (d) => { cwd = path.resolve(d); };
proc.version = "v22.0.0";
proc.versions = { node: "22.0.0", raea: "1" };
proc.arch = "arm64";
proc.pid = 1;
// the process's own (until 0.1.8 a pid of 1 and no ppid, so `raea show` never found the harness that ran it)
const own = call("process");
proc.arch = own.arch;
proc.pid = own.pid;
let parent;
Object.defineProperty(proc, "ppid", { get: () => (parent === undefined ? (parent = call("ppid")) : parent), configurable: true });
proc.execPath = "raea";
proc.exitCode = undefined;
proc.nextTick = (fn, ...a) => queueMicrotask(() => fn(...a));
@@ -249,9 +292,19 @@
proc.memoryUsage = () => ({ rss: 0, heapTotal: 0, heapUsed: 0, external: 0, arrayBuffers: 0 });
proc.on = proc.once = proc.off = () => proc;
proc.emitWarning = () => {};
// file:///C:/x on Windows is C:/x, and file://server/share/x is //server/share/x
const url = {
fileURLToPath: (u) => decodeURIComponent(new URL(String(u)).pathname),
pathToFileURL: (p) => new URL("file://" + encodeURI(path.resolve(String(p)))),
fileURLToPath(u) {
const x = new URL(String(u));
const p = decodeURIComponent(x.pathname);
if (!win) return p;
return x.hostname ? "//" + x.hostname + p : /^\/[A-Za-z]:(\/|$)/.test(p) ? p.slice(1) : p;
},
pathToFileURL(p) {
const r = path.resolve(String(p));
const share = win && r.startsWith("//");
return new URL("file:" + (share ? "" : win ? "///" : "//") + encodeURI(r).replace(/[?#]/g, encodeURIComponent));
},
URL: g.URL, URLSearchParams: g.URLSearchParams,
};
const inspect = (x) => { try { return typeof x === "string" ? x : JSON.stringify(x); } catch { return String(x); } };
@@ -304,7 +357,7 @@
req.cache = cache;
return req;
};
builtins.module = { createRequire: (from) => requireFrom(path.dirname(pathOf(from).replace(/^file:\/\//, ""))), builtinModules: Object.keys(builtins) };
builtins.module = { createRequire: (from) => { const f = String(from instanceof URL ? from.href : from); return requireFrom(path.dirname(f.startsWith("file:") ? url.fileURLToPath(f) : f)); }, builtinModules: Object.keys(builtins) };
g.__raea_node_builtins = builtins;
g.__raea_node_require = requireFrom;
g.Buffer = Buffer;
+8 -3
View File
@@ -10,7 +10,7 @@ use base64::Engine as _;
use serde_json::{json, Value};
mod os;
use os::{mode_ctime, signal};
use os::{mode_ctime, node_arch, parent_pid, signal};
/// The builtins node.js defines, by the names an import or require gives them (with or without `node:`)
@@ -181,7 +181,8 @@ fn js_string(s: &str) -> String {
/// looked for packages from "."
pub fn load(path: &Path, entry: bool) -> Result<String, String> {
let abs = std::path::absolute(path).unwrap_or_else(|_| path.to_path_buf());
let url = js_string(&format!("file://{}", abs.display()));
// file:///C:/... on Windows (until 0.1.8 file://C:\..., a URL with no path a fileURLToPath could read)
let url = js_string(&url::Url::from_file_path(&abs).map(String::from).unwrap_or_else(|_| format!("file://{}", abs.display())));
load_module(path).map(|s| s.replace("import.meta.main", if entry { "true" } else { "false" }).replace("import.meta.url", &url))
}
@@ -358,7 +359,11 @@ pub fn call(op: &str, a: &[Value]) -> Value {
json!(b64(&v))
}
"spawn" => spawn(&s(0), a.get(1), a.get(2).unwrap_or(&Value::Null)),
"tmpdir" => json!(std::env::temp_dir().display().to_string().trim_end_matches('/')),
// without its last separator, as Node's (Windows' TEMP ends in \\)
"tmpdir" => json!(std::env::temp_dir().display().to_string().trim_end_matches(['/', '\\'])),
// process.arch and process.pid, in Node's words (x64, arm64)
"process" => json!({"arch": node_arch(), "pid": std::process::id()}),
"ppid" => parent_pid().map(Value::from).unwrap_or(Value::Null),
"homedir" => json!(raea_io_home::user_home().unwrap_or_default().display().to_string()),
"cwd" => json!(std::env::current_dir().map(|p| p.display().to_string()).unwrap_or_default()),
"resolve" => resolve_file(&s(0), Path::new(&s(1)), false).map(|p| json!(p.display().to_string())).unwrap_or_else(|e| err("MODULE_NOT_FOUND", e)),
+30
View File
@@ -38,3 +38,33 @@ fn signal_name(n: i32) -> String {
n => format!("SIG{n}"),
}
}
/// process.arch: Node's word for the CPU this was built for
pub(super) fn node_arch() -> &'static str {
match std::env::consts::ARCH {
"x86_64" => "x64",
"aarch64" => "arm64",
"x86" => "ia32",
other => other,
}
}
/// process.ppid: the process that started this one. Windows keeps it in a process's own record, read here through
/// PowerShell (once, when asked: the agent shell asks only to find the harness that ran `raea show`).
pub(super) fn parent_pid() -> Option<u32> {
#[cfg(unix)]
{
// SAFETY: getppid takes nothing and can't fail
Some(unsafe { libc::getppid() } as u32)
}
#[cfg(windows)]
{
let q = format!("(Get-CimInstance Win32_Process -Filter 'ProcessId={}').ParentProcessId", std::process::id());
let o = std::process::Command::new("powershell").args(["-NoProfile", "-NonInteractive", "-Command", &q]).stdin(std::process::Stdio::null()).output().ok()?;
String::from_utf8_lossy(&o.stdout).trim().parse().ok()
}
#[cfg(not(any(unix, windows)))]
{
None
}
}
+52
View File
@@ -93,3 +93,55 @@ fn a_script_that_sets_exit_code_exits_with_it() {
assert_eq!((set.exit, set.stderr.as_str()), (3, "refused\n"));
assert_eq!((plain.exit, plain.stdout.as_str()), (0, "ok"));
}
/// The system as Node names it, and Windows' paths parsed as Windows does (#169: on a Windows PC raea's Node core said
/// it was an arm64 Mac, process.platform was Rust's "windows", resolve(".") named "/C:\Users\...", no folder at all, and
/// there was no process.ppid on any system, so `raea show` never found the harness that ran it). path.win32 parses
/// Windows' paths on any system, as the Windows path does there, writing them with /. Each answer is Node 22's, its \
/// written as /.
#[test]
fn names_the_system_as_node_does_and_parses_windows_paths() {
let d = std::env::temp_dir().join(format!("raea-node-system-{}", std::process::id()));
std::fs::create_dir_all(&d).unwrap();
std::fs::write(d.join("system.ts"), r#"
import { arch, platform, type, tmpdir, homedir } from "os";
import path from "path";
import { fileURLToPath, pathToFileURL } from "url";
const w = path.win32;
process.stdout.write(JSON.stringify({
system: [process.platform === platform(), process.arch === arch(), process.pid > 1, process.ppid > 1 && process.ppid !== process.pid, type()],
here: [path.isAbsolute(process.cwd()), path.resolve(".") === process.cwd(), path.isAbsolute(tmpdir()), !/[\\/]$/.test(tmpdir()), path.isAbsolute(homedir())],
resolve: [w.resolve("C:\\a", "b\\..\\c"), w.resolve("C:\\a", "D:\\x", "y"), w.resolve("\\\\nas\\clips\\", "a.mp4"), w.resolve("C:/a/", "..", "..")],
absolute: ["C:\\x", "c:/x", "\\\\nas\\clips", "\\x", "x", "C:x"].map((p) => w.isAbsolute(p)),
parts: [w.dirname("C:\\a\\b.txt"), w.dirname("C:\\a"), w.dirname("C:\\"), w.basename("C:\\a\\b.txt", ".txt"), w.extname("C:\\a.b\\c.mp4"), w.basename("C:\\")],
join: [w.join("C:\\Users\\me", ".raea", "app-host.json"), w.normalize("C:\\a\\.\\b\\..\\c\\"), w.parse("C:\\a\\b.txt").root],
relative: [w.relative("C:\\a\\b", "C:\\a\\c\\d"), w.relative("C:\\A\\b", "c:\\a\\B\\x"), w.relative("C:\\a", "D:\\b")],
delimiter: [w.delimiter, path.posix.delimiter, path.posix.resolve("/a", "b"), path.posix.isAbsolute("C:\\x")],
url: [fileURLToPath(pathToFileURL(path.resolve("a b#1.txt"))) === path.resolve("a b#1.txt"), pathToFileURL("/x y").href.startsWith("file:///")],
}));
"#).unwrap();
let r = raea_native::js::run_node(&d.join("system.ts"), &[], String::new(), Duration::from_secs(20));
let _ = std::fs::remove_dir_all(&d);
let got: serde_json::Value = serde_json::from_str(&r.stdout).unwrap_or_else(|e| panic!("{e}: {} / {}", r.stdout, r.stderr));
let kind = match std::env::consts::OS { "macos" => "Darwin", "windows" => "Windows_NT", "linux" => "Linux", os => os };
let want = serde_json::json!({
"system": [true, true, true, true, kind],
"here": [true, true, true, true, true],
"resolve": ["C:/a/c", "D:/x/y", "//nas/clips/a.mp4", "C:/"],
"absolute": [true, true, true, true, false, false],
"parts": ["C:/a", "C:/", "C:/", "b", ".mp4", ""],
"join": ["C:/Users/me/.raea/app-host.json", "C:/a/c/", "C:/"],
"relative": ["../c/d", "x", "D:/b"],
"delimiter": [";", ":", "/a/b", false],
"url": [true, true],
});
assert_eq!(got, want);
// and Node's own words for this system
let platform = match std::env::consts::OS { "macos" => "darwin", "windows" => "win32", os => os };
let probe = d.with_extension("platform.ts");
std::fs::write(&probe, "process.stdout.write(process.platform + ' ' + process.arch);\n").unwrap();
let r = raea_native::js::run_node(&probe, &[], String::new(), Duration::from_secs(20));
let _ = std::fs::remove_file(&probe);
let arch = match std::env::consts::ARCH { "x86_64" => "x64", "aarch64" => "arm64", a => a };
assert_eq!(r.stdout, format!("{platform} {arch}"));
}
+3 -3
View File
@@ -21,8 +21,6 @@ bevy = { version = "=0.20.0", default-features = false, features = ["std", "defa
image = { version = "0.25", default-features = false, features = ["png", "jpeg", "hdr"] }
# an edit as rows keyed per frame, and 3D shapes as values (docs/media.feature M2)
raea-core-program = { path = "../../core/program" }
# worn surfaces on a mesh row (`wear`)
raea-sys-wear = { path = "../../systems/wear" }
# procedural surfaces on a mesh row (`proc`)
raea-sys-procmat = { path = "../../systems/procmat" }
raea-core-shape = { path = "../../core/shape" }
@@ -97,7 +95,9 @@ network = ["native"]
# every Bevy feature a game developer or animator might use: the plugin catalog's "bevy" declaration
# (sdk/raea/bench/bevy-plugins/package.json, 0.20). Measured beside the default build before it joins `default`
# (the adopt-0.20 pass, docs/bevy-upgrade.md); native only, so the web build goes without
bevy-all = ["bevy/bevy_gilrs", "bevy/gamepad", "bevy/area_light_luts", "bevy/experimental_pbr_pcss", "bevy/dfg_lut", "bevy/smaa_luts", "bevy/tonemapping_luts", "bevy/bluenoise_texture", "bevy/bevy_gizmos", "bevy/bevy_gizmos_render", "bevy/bevy_dev_tools", "bevy/debug", "bevy/bevy_ui_debug", "bevy/file_watcher", "bevy/embedded_watcher", "bevy/asset_processor", "bevy/png", "bevy/jpeg", "bevy/ktx2", "bevy/zstd_rust", "bevy/basis-universal", "bevy/exr", "bevy/hdr", "bevy/webp", "bevy/dds", "bevy/tga", "bevy/bmp", "bevy/gif", "bevy/ico", "bevy/qoi", "bevy/pnm", "bevy/tiff", "bevy/compressed_image_saver", "bevy/picking", "bevy/bevy_picking", "bevy/mesh_picking", "bevy/sprite_picking", "bevy/ui_picking", "bevy/meshlet", "bevy/meshlet_processor", "bevy/bevy_solari", "bevy/bevy_animation", "bevy/gltf_animation", "bevy/morph", "bevy/morph_animation", "bevy/bevy_gltf", "bevy/bevy_sprite", "bevy/bevy_sprite_render", "bevy/2d_bevy_render", "bevy/3d_bevy_render", "bevy/ui_bevy_render", "bevy/bevy_ui_widgets", "bevy/bevy_feathers", "bevy/custom_cursor", "bevy/bevy_input_focus", "bevy/bevy_camera_controller", "bevy/free_camera", "bevy/pan_camera", "bevy/bevy_text", "bevy/system_font_discovery", "bevy/scene", "bevy/bevy_state", "bevy/serialize", "bevy/reflect_functions", "bevy/reflect_documentation", "bevy/sysinfo_plugin", "bevy/bevy_clipboard", "bevy/system_clipboard", "bevy/clipboard_image", "bevy/ghost_nodes", "bevy/bevy_settings", "bevy/shader_format_spirv", "bevy/bevy_debug_stepping", "bevy/bevy_world_serialization", "bevy/bevy_audio", "bevy/mp3", "bevy/flac", "bevy/vorbis", "bevy/wav", "bevy/aac", "bevy/mp4", "bevy/http", "bevy/https", "bevy/web_asset_cache", "bevy/bevy_curve", "bevy/complex_script_segmentation", "bevy/compressed_image_saver_universal", "bevy/pan_orbit_camera", "bevy/pan_orbit_gizmo", "bevy/render_dev_tools"]
# (but compressed_image_saver: ctt's AVX2 encoders set up C++ tables before main on any CPU, so raea.exe stopped at
# start on a PC without AVX; sdk/raea/docs/bevy-plugins.md)
bevy-all = ["bevy/bevy_gilrs", "bevy/gamepad", "bevy/area_light_luts", "bevy/experimental_pbr_pcss", "bevy/dfg_lut", "bevy/smaa_luts", "bevy/tonemapping_luts", "bevy/bluenoise_texture", "bevy/bevy_gizmos", "bevy/bevy_gizmos_render", "bevy/bevy_dev_tools", "bevy/debug", "bevy/bevy_ui_debug", "bevy/file_watcher", "bevy/embedded_watcher", "bevy/asset_processor", "bevy/png", "bevy/jpeg", "bevy/ktx2", "bevy/zstd_rust", "bevy/basis-universal", "bevy/exr", "bevy/hdr", "bevy/webp", "bevy/dds", "bevy/tga", "bevy/bmp", "bevy/gif", "bevy/ico", "bevy/qoi", "bevy/pnm", "bevy/tiff", "bevy/picking", "bevy/bevy_picking", "bevy/mesh_picking", "bevy/sprite_picking", "bevy/ui_picking", "bevy/meshlet", "bevy/meshlet_processor", "bevy/bevy_solari", "bevy/bevy_animation", "bevy/gltf_animation", "bevy/morph", "bevy/morph_animation", "bevy/bevy_gltf", "bevy/bevy_sprite", "bevy/bevy_sprite_render", "bevy/2d_bevy_render", "bevy/3d_bevy_render", "bevy/ui_bevy_render", "bevy/bevy_ui_widgets", "bevy/bevy_feathers", "bevy/custom_cursor", "bevy/bevy_input_focus", "bevy/bevy_camera_controller", "bevy/free_camera", "bevy/pan_camera", "bevy/bevy_text", "bevy/system_font_discovery", "bevy/scene", "bevy/bevy_state", "bevy/serialize", "bevy/reflect_functions", "bevy/reflect_documentation", "bevy/sysinfo_plugin", "bevy/bevy_clipboard", "bevy/system_clipboard", "bevy/clipboard_image", "bevy/ghost_nodes", "bevy/bevy_settings", "bevy/shader_format_spirv", "bevy/bevy_debug_stepping", "bevy/bevy_world_serialization", "bevy/bevy_audio", "bevy/mp3", "bevy/flac", "bevy/vorbis", "bevy/wav", "bevy/aac", "bevy/mp4", "bevy/http", "bevy/https", "bevy/web_asset_cache", "bevy/bevy_curve", "bevy/complex_script_segmentation", "bevy/compressed_image_saver_universal", "bevy/pan_orbit_camera", "bevy/pan_orbit_gizmo", "bevy/render_dev_tools"]
# per-system spans as a chrome trace (RUST_LOG=info, trace-*.json in the working directory)
trace = ["bevy/trace", "bevy/trace_chrome"]
-1
View File
@@ -55,7 +55,6 @@ raea_plugin! {
Draws2dPlugin: raea_sys_sprite::install, "Plugins' 2D drawing brings up the scene's 2D camera (raea-sys-sprite's Draws2d).";
ScreenPlugin: super::screen::install, "Live pictures on surfaces, drawn as CRTs (screen.rs).";
GridPlugin: super::grid::install, "Greybox surfaces: graph paper and outlines (grid.rs).";
WearPlugin: raea_sys_wear::install, "Worn surfaces: chipped paint, grime and rust (systems/wear).";
ProcMatPlugin: raea_sys_procmat::install, "Procedural surfaces: wood, stone, brick, tiles and the rest, with dust and dirt (systems/procmat).";
PaintPlugin: super::paint::install, "The paint and cartoon looks' surfaces (paint.rs).";
PassesPlugin: super::passes::install, "Render passes per view (passes.rs).";
-3
View File
@@ -281,9 +281,6 @@ pub(crate) fn spawn_3d(world: &mut World, e: Entity, t: &Tup, inserted: &[Tup],
} else if let Some(extension) = raea_sys_procmat::of(vals).filter(|_| !scene3d::clay::on()) {
// a procedural surface (systems/procmat): its pattern, bump and use made on the GPU; clay draws it plain
grid::put(world, e, mesh, raea_sys_procmat::ProcMaterial { base: mat, extension }, vals);
} else if let Some(extension) = raea_sys_wear::of(vals).filter(|_| !scene3d::clay::on()) {
// worn paint (systems/wear): chipped edges, grime and rust, fixed in the part's own space
grid::put(world, e, mesh, raea_sys_wear::WearMaterial { base: mat, extension }, vals);
} else if vals.get("shader").is_none() {
// a plain surface, see-through too: one material per value, shared by the parts that have it (share.rs;
// froxel_glass's fog copy is per material, so equal panes share it; mesh_ray_cast's six walls are one)
+260
View File
@@ -0,0 +1,260 @@
// The corner house raea/wear's demo weathers (docs/wear.feature WR7), made in code: a four-storey block on a street
// corner, its south front on x = 0..12 facing +z, its east front on z = -10..0 facing +x, the corner at (12, 0).
// A sandstone plinth, a rusticated ground floor, plastered storeys, sandstone sills and a string course, a cornice
// on consoles under a slate roof, a door in a sandstone surround up granite steps, an iron balcony, a zinc gutter and
// downpipe, an enamel street plate on each face of the corner, a cellar hatch in the walk, a brick firewall on the
// west, and the walk all round. The openings go through the walls (glass 15 cm in, frames in the reveals), so cracks
// can start at their corners. One glTF material per wear class, named for it. y up, metres.
// houseGlb() the .glb's bytes (make-house.ts writes assets/house.glb)
type V3 = [number, number, number];
/** a hexahedron: its eight corners, corner (i, j, k) at index i + 2j + 4k */
type Solid = V3[];
export const CLASSES = ["plaster", "brick", "sandstone", "granite", "wood", "iron", "zinc", "copper", "slate", "felt", "glass", "enamel", "brass", "ground"] as const;
export type HouseClass = (typeof CLASSES)[number];
const LOOK: Record<HouseClass, { color: V3; rough: number; metal: number }> = {
plaster: { color: [0.8, 0.72, 0.56], rough: 0.85, metal: 0 },
brick: { color: [0.45, 0.2, 0.13], rough: 0.9, metal: 0 },
sandstone: { color: [0.68, 0.57, 0.4], rough: 0.85, metal: 0 },
granite: { color: [0.46, 0.46, 0.47], rough: 0.7, metal: 0 },
wood: { color: [0.17, 0.28, 0.21], rough: 0.6, metal: 0 },
iron: { color: [0.06, 0.07, 0.065], rough: 0.5, metal: 0.6 },
zinc: { color: [0.55, 0.58, 0.6], rough: 0.4, metal: 0.9 },
copper: { color: [0.62, 0.33, 0.18], rough: 0.35, metal: 1 },
slate: { color: [0.2, 0.21, 0.24], rough: 0.7, metal: 0 },
felt: { color: [0.08, 0.08, 0.08], rough: 0.9, metal: 0 },
glass: { color: [0.07, 0.09, 0.11], rough: 0.05, metal: 0.2 },
enamel: { color: [0.08, 0.16, 0.5], rough: 0.25, metal: 0 },
brass: { color: [0.75, 0.58, 0.25], rough: 0.3, metal: 1 },
ground: { color: [0.33, 0.32, 0.3], rough: 0.9, metal: 0 },
};
export const SOUTH = { x0: 0, x1: 12 };
export const EAST = { z0: -10, z1: 0 };
export const TOP = 14.2;
/** the storeys' floor heights and their windows' sill and head */
export const STOREYS = [
{ floor: 0.6, sill: 1.5, head: 3.4 },
{ floor: 4.2, sill: 5.1, head: 7.2 },
{ floor: 7.6, sill: 8.5, head: 10.5 },
{ floor: 10.9, sill: 11.7, head: 13.5 },
];
/** the windows' middles along each front (metres from its west or south end), 1.2 m wide; the door's bay is 6 on the south */
export const BAYS = { south: [1.5, 4.0, 6.0, 8.5, 10.6], east: [1.6, 4.4, 7.2, 9.0] };
export const DOOR = { at: 6.0, w: 1.4, h: 2.9 };
const WIN = 1.2;
const T = 0.5;
const parts = new Map<HouseClass, Solid[]>(CLASSES.map((c) => [c, []]));
/** a parallelepiped from a corner and its three edges */
const add = (c: HouseClass, [o, u, v, w]: [V3, V3, V3, V3]) => {
const s: Solid = [];
for (let n = 0; n < 8; n++) {
const [i, j, k] = [n & 1, (n >> 1) & 1, (n >> 2) & 1];
s.push([o[0] + u[0] * i + v[0] * j + w[0] * k, o[1] + u[1] * i + v[1] * j + w[1] * k, o[2] + u[2] * i + v[2] * j + w[2] * k]);
}
parts.get(c)!.push(s);
};
/** a slab `t` thick upward from a planar quad (its corners in order round it) */
const slab = (c: HouseClass, q: [V3, V3, V3, V3], t: number) => {
const base = [q[0], q[1], q[3], q[2]];
parts.get(c)!.push([...base, ...base.map((p): V3 => [p[0], p[1] + t, p[2]])]);
};
/** an axis-aligned box from its two corners */
const box = (c: HouseClass, a: V3, b: V3) => add(c, [a, [b[0] - a[0], 0, 0], [0, b[1] - a[1], 0], [0, 0, b[2] - a[2]]]);
/** A front: `along` and `out` its axes, `at` where it starts; a wall of `c` from y0 to y1 with rectangular openings
* (u0, u1, v0, v1 along it and up) cut through, as boxes round them. */
function wall(c: HouseClass, at: V3, along: V3, out: V3, len: number, y0: number, y1: number, holes: [number, number, number, number][], depth = T, proud = 0) {
const cuts = [...new Set([0, len, ...holes.flatMap((h) => [h[0], h[1]])])].sort((a, b) => a - b);
for (let i = 0; i + 1 < cuts.length; i++) {
const [u0, u1] = [cuts[i], cuts[i + 1]];
const mid = (u0 + u1) / 2;
// the openings in this column, clipped to the wall's own height
const cut = holes.filter((h) => h[0] <= mid && mid <= h[1] && h[3] > y0 && h[2] < y1).flatMap((h) => [Math.max(h[2], y0), Math.min(h[3], y1)]);
const ys = [y0, y1, ...cut].sort((a, b) => a - b);
for (let j = 0; j + 1 < ys.length; j += 2) {
if (ys[j + 1] - ys[j] < 1e-4) continue;
const o: V3 = [at[0] + along[0] * u0 - out[0] * (depth - proud), ys[j], at[2] + along[2] * u0 - out[2] * (depth - proud)];
add(c, [o, [along[0] * (u1 - u0), 0, along[2] * (u1 - u0)], [0, ys[j + 1] - ys[j], 0], [out[0] * depth, 0, out[2] * depth]]);
}
}
}
/** A window in the opening (u0..u1, v0..v1) of the front at `at`: glass 15 cm in, a frame round it in the reveal and a
* transom, a sandstone sill below standing out 8 cm. */
function window(at: V3, along: V3, out: V3, u0: number, u1: number, v0: number, v1: number, sill = true) {
const p = (u: number, v: number, o: number): V3 => [at[0] + along[0] * u + out[0] * o, v, at[2] + along[2] * u + out[2] * o];
const piece = (cl: HouseClass, ua: number, ub: number, va: number, vb: number, oa: number, ob: number) => {
const o = p(ua, va, oa);
add(cl, [o, [along[0] * (ub - ua), 0, along[2] * (ub - ua)], [0, vb - va, 0], [out[0] * (ob - oa), 0, out[2] * (ob - oa)]]);
};
piece("glass", u0 + 0.06, u1 - 0.06, v0 + 0.06, v1 - 0.06, -0.17, -0.15);
piece("wood", u0, u0 + 0.06, v0, v1, -0.2, -0.1);
piece("wood", u1 - 0.06, u1, v0, v1, -0.2, -0.1);
piece("wood", u0, u1, v0, v0 + 0.06, -0.2, -0.1);
piece("wood", u0, u1, v1 - 0.06, v1, -0.2, -0.1);
const tr = v0 + (v1 - v0) * 0.72;
piece("wood", u0, u1, tr - 0.03, tr + 0.03, -0.2, -0.12);
piece("wood", (u0 + u1) / 2 - 0.03, (u0 + u1) / 2 + 0.03, v0, tr, -0.2, -0.12);
if (sill) piece("sandstone", u0 - 0.08, u1 + 0.08, v0 - 0.08, v0, -0.12, 0.08);
}
function build() {
for (const v of parts.values()) v.length = 0;
const S: V3 = [SOUTH.x0, 0, 0];
const E: V3 = [SOUTH.x1, 0, EAST.z1];
const X: V3 = [1, 0, 0];
const Z: V3 = [0, 0, 1];
const NZ: V3 = [0, 0, -1];
const fronts = [
{ at: S, along: X, out: Z, len: SOUTH.x1 - SOUTH.x0, bays: BAYS.south, door: true },
{ at: E, along: NZ, out: X, len: EAST.z1 - EAST.z0, bays: BAYS.east, door: false },
];
for (const f of fronts) {
const holes: [number, number, number, number][] = [];
for (const [k, st] of STOREYS.entries()) {
for (const b of f.bays) {
if (f.door && k === 0 && b === DOOR.at) continue;
holes.push([b - WIN / 2, b + WIN / 2, st.sill, st.head]);
}
}
if (f.door) holes.push([DOOR.at - DOOR.w / 2, DOOR.at + DOOR.w / 2, 0.6, 0.6 + DOOR.h]);
// the ground floor rendered in rusticated bands (a 2 cm groove every 0.4 m), the storeys above plain
const ground = holes.filter((h) => h[2] < 4.2);
for (let y = 0.6; y < 4.2 - 1e-6; y += 0.4) {
const top = Math.min(y + 0.38, 4.2);
wall("plaster", f.at, f.along, f.out, f.len, y, top, ground);
wall("plaster", f.at, f.along, f.out, f.len, top, Math.min(y + 0.4, 4.2), ground, T, -0.02);
}
wall("plaster", f.at, f.along, f.out, f.len, 4.2, TOP, holes.filter((h) => h[2] >= 4.2));
// the plinth, standing 8 cm out, the string course over the ground floor and the cornice's frieze
wall("sandstone", f.at, f.along, f.out, f.len, 0, 0.6, f.door ? [[DOOR.at - DOOR.w / 2, DOOR.at + DOOR.w / 2, 0, 0.6]] : [], T, 0.08);
wall("sandstone", f.at, f.along, f.out, f.len, 4.05, 4.25, [], T, 0.14);
for (const h of holes) {
if (f.door && h[0] === DOOR.at - DOOR.w / 2) continue;
window(f.at, f.along, f.out, h[0], h[1], h[2], h[3]);
}
// the cornice on its consoles, every 0.9 m
wall("sandstone", f.at, f.along, f.out, f.len + 0.6, TOP, TOP + 0.4, [], T, 0.6);
for (let u = 0.45; u < f.len; u += 0.9) {
const p: V3 = [f.at[0] + f.along[0] * u, TOP - 0.45, f.at[2] + f.along[2] * u];
add("sandstone", [[p[0] - f.along[0] * 0.09, p[1], p[2] - f.along[2] * 0.09], [f.along[0] * 0.18, 0, f.along[2] * 0.18], [0, 0.45, 0], [f.out[0] * 0.45, 0, f.out[2] * 0.45]]);
}
// the zinc gutter along the cornice's lip
add("zinc", [[f.at[0] + f.out[0] * 0.6 - f.along[0] * 0.0, TOP + 0.4, f.at[2] + f.out[2] * 0.6], [f.along[0] * (f.len + 0.6), 0, f.along[2] * (f.len + 0.6)], [0, 0.14, 0], [f.out[0] * 0.16, 0, f.out[2] * 0.16]]);
}
// the door: wood in a sandstone surround, granite steps up to it, a brass handle and bell plate, a copper canopy
const d0 = DOOR.at - DOOR.w / 2, d1 = DOOR.at + DOOR.w / 2;
box("wood", [d0, 0.6, -0.2], [d1, 0.6 + DOOR.h, -0.12]);
box("sandstone", [d0 - 0.25, 0.6, 0], [d0, 0.6 + DOOR.h + 0.3, 0.1]);
box("sandstone", [d1, 0.6, 0], [d1 + 0.25, 0.6 + DOOR.h + 0.3, 0.1]);
box("sandstone", [d0, 0.6 + DOOR.h, 0], [d1, 0.6 + DOOR.h + 0.3, 0.1]);
for (const [k, w] of [0.2, 0.4, 0.6].entries()) box("granite", [d0 - 0.4 + k * 0.05, 0, 0.1], [d1 + 0.4 - k * 0.05, w, 0.1 + 0.9 - k * 0.3]);
box("brass", [d1 - 0.22, 1.55, -0.12], [d1 - 0.12, 1.62, -0.07]);
box("brass", [d1 + 0.05, 1.75, 0.1], [d1 + 0.2, 1.95, 0.115]);
add("copper", [[d0 - 0.4, 0.6 + DOOR.h + 0.4, 0], [DOOR.w + 0.8, 0, 0], [0, -0.25, 0.8], [0, 0.04, 0]]);
// the iron balcony at the first floor's corner bay on the south front: a stone slab, balusters and a rail
const bx = BAYS.south[4];
box("sandstone", [bx - 1.1, 4.25, 0], [bx + 1.1, 4.4, 0.95]);
for (let i = 0; i <= 14; i++) box("iron", [bx - 1.05 + i * 0.15, 4.4, 0.86], [bx - 1.03 + i * 0.15, 5.35, 0.88]);
box("iron", [bx - 1.08, 5.35, 0.84], [bx + 1.08, 5.4, 0.9]);
// the downpipe down the south front's west end, from the gutter to the walk
box("zinc", [0.25, 0.05, 0.62], [0.35, TOP + 0.45, 0.72]);
box("zinc", [0.25, 0.05, 0.0], [0.35, 0.15, 0.72]);
// an enamel street plate on each face of the corner, 2.6-2.9 m up
box("enamel", [SOUTH.x1 - 0.9, 2.6, 0], [SOUTH.x1 - 0.2, 2.9, 0.012]);
box("enamel", [SOUTH.x1, 2.6, -0.9], [SOUTH.x1 + 0.012, 2.9, -0.2]);
// the cellar hatch: iron plates in the walk by the east front
box("iron", [SOUTH.x1 + 0.3, -0.01, -6.5], [SOUTH.x1 + 1.1, 0.03, -5.3]);
// the slate roof: a slope up from each front's cornice to a ridge 3 m higher, meeting on a hip over the corner,
// and a felt flat behind them
const [r, d, e, ex, ez] = [3.0, 3.2, TOP + 0.5, SOUTH.x1 + 0.1, EAST.z1 + 0.1];
slab("slate", [[SOUTH.x0, e, ez], [ex, e, ez], [ex - d, e + r, ez - d], [SOUTH.x0, e + r, ez - d]], 0.06);
slab("slate", [[ex, e, EAST.z0], [ex - d, e + r, EAST.z0], [ex - d, e + r, ez - d], [ex, e, ez]], 0.06);
box("felt", [SOUTH.x0, e + r, EAST.z0], [ex - d, e + r + 0.05, ez - d]);
// the house's own back and its neighbour: a brick firewall on the west, standing above the roof
box("brick", [SOUTH.x0 - 0.4, 0, EAST.z0], [SOUTH.x0, TOP + 4.2, -T]);
box("plaster", [SOUTH.x0, 0, EAST.z0 - 0.1], [SOUTH.x1, TOP + 0.4, EAST.z0]);
box("plaster", [SOUTH.x0, 0, EAST.z0], [SOUTH.x1 - T, TOP + 0.4, -T]);
// the walk round the corner, a granite kerb and the road 15 cm below it
box("ground", [-6, -0.2, -16], [SOUTH.x1 + 3.5, 0, 3.5]);
box("granite", [-6, -0.2, 3.5], [SOUTH.x1 + 3.8, 0, 3.8]);
box("granite", [SOUTH.x1 + 3.5, -0.2, -16], [SOUTH.x1 + 3.8, 0, 3.5]);
box("ground", [-6, -0.5, 3.8], [SOUTH.x1 + 12, -0.15, 14]);
box("ground", [SOUTH.x1 + 3.8, -0.5, -16], [SOUTH.x1 + 12, -0.15, 3.8]);
}
/** Each class's solids (after `houseGlb` or `solids` builds them). */
export function solids(): Map<HouseClass, Solid[]> {
build();
return parts;
}
/** The corner house as a .glb: one primitive and one material per class, each solid's six faces with flat normals. */
export function houseGlb(): Uint8Array {
build();
const pos: number[] = [], nrm: number[] = [], idx: number[] = [];
const prims: { first: number; count: number; mat: number }[] = [];
const mats: unknown[] = [];
const sub = (a: V3, b: V3): V3 => [a[0] - b[0], a[1] - b[1], a[2] - b[2]];
const cross = (a: V3, b: V3): V3 => [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];
const norm = (a: V3): V3 => { const l = Math.hypot(...a) || 1; return [a[0] / l, a[1] / l, a[2] / l]; };
for (const c of CLASSES) {
const first = idx.length;
for (const s of parts.get(c)!) {
const at = (i: number, j: number, k: number): V3 => s[i + 2 * j + 4 * k];
const mid: V3 = [0, 1, 2].map((a) => s.reduce((t, p) => t + p[a], 0) / 8) as V3;
const quads: V3[][] = [
[at(0, 0, 0), at(0, 1, 0), at(0, 1, 1), at(0, 0, 1)], [at(1, 0, 0), at(1, 0, 1), at(1, 1, 1), at(1, 1, 0)],
[at(0, 0, 0), at(0, 0, 1), at(1, 0, 1), at(1, 0, 0)], [at(0, 1, 0), at(1, 1, 0), at(1, 1, 1), at(0, 1, 1)],
[at(0, 0, 0), at(1, 0, 0), at(1, 1, 0), at(0, 1, 0)], [at(0, 0, 1), at(0, 1, 1), at(1, 1, 1), at(1, 0, 1)],
];
for (let q of quads) {
let n = norm(cross(sub(q[1], q[0]), sub(q[2], q[0])));
const centre: V3 = [(q[0][0] + q[2][0]) / 2, (q[0][1] + q[2][1]) / 2, (q[0][2] + q[2][2]) / 2];
const away = sub(centre, mid);
if (n[0] * away[0] + n[1] * away[1] + n[2] * away[2] < 0) { q = [q[0], q[3], q[2], q[1]]; n = [-n[0], -n[1], -n[2]]; }
const b = pos.length / 3;
for (const p of q) { pos.push(...p); nrm.push(...n); }
idx.push(b, b + 1, b + 2, b, b + 2, b + 3);
}
}
if (idx.length > first) {
prims.push({ first, count: idx.length - first, mat: mats.length });
const l = LOOK[c];
mats.push({ name: c, pbrMetallicRoughness: { baseColorFactor: [...l.color, 1], roughnessFactor: l.rough, metallicFactor: l.metal } });
}
}
const f32 = new Float32Array([...pos, ...nrm]);
const u32 = new Uint32Array(idx);
const bin = new Uint8Array(f32.byteLength + u32.byteLength);
bin.set(new Uint8Array(f32.buffer), 0);
bin.set(new Uint8Array(u32.buffer), f32.byteLength);
const n = pos.length / 3;
const lo = [0, 1, 2].map((k) => Math.min(...pos.filter((_, i) => i % 3 === k)));
const hi = [0, 1, 2].map((k) => Math.max(...pos.filter((_, i) => i % 3 === k)));
const json = {
asset: { version: "2.0", generator: "raea examples/materials/wear/house.ts" }, scene: 0, scenes: [{ nodes: [0] }], nodes: [{ mesh: 0, name: "corner-house" }],
meshes: [{ primitives: prims.map((p, i) => ({ attributes: { POSITION: 0, NORMAL: 1 }, indices: 2 + i, material: p.mat })) }],
materials: mats,
buffers: [{ byteLength: bin.byteLength }],
bufferViews: [{ buffer: 0, byteOffset: 0, byteLength: n * 12 }, { buffer: 0, byteOffset: n * 12, byteLength: n * 12 }, { buffer: 0, byteOffset: n * 24, byteLength: u32.byteLength }],
accessors: [
{ bufferView: 0, componentType: 5126, count: n, type: "VEC3", min: lo, max: hi },
{ bufferView: 1, componentType: 5126, count: n, type: "VEC3" },
...prims.map((p) => ({ bufferView: 2, byteOffset: p.first * 4, componentType: 5125, count: p.count, type: "SCALAR" })),
],
};
const pad = (b: Uint8Array, fill: number) => { const out = new Uint8Array(Math.ceil(b.length / 4) * 4).fill(fill); out.set(b); return out; };
const j = pad(new TextEncoder().encode(JSON.stringify(json)), 0x20);
const bb = pad(bin, 0);
const glb = new Uint8Array(12 + 8 + j.length + 8 + bb.length);
const dv = new DataView(glb.buffer);
dv.setUint32(0, 0x46546c67, true); dv.setUint32(4, 2, true); dv.setUint32(8, glb.length, true);
dv.setUint32(12, j.length, true); dv.setUint32(16, 0x4e4f534a, true); glb.set(j, 20);
dv.setUint32(20 + j.length, bb.length, true); dv.setUint32(24 + j.length, 0x004e4942, true); glb.set(bb, 28 + j.length);
return glb;
}
+11
View File
@@ -0,0 +1,11 @@
// Writes the corner house (house.ts) to media/house.glb, where wear.tsx's staticFile reads it.
// bun examples/materials/wear/make-house.ts
import { mkdirSync, writeFileSync } from "node:fs";
import { join } from "node:path";
import { houseGlb } from "./house";
const dir = join(import.meta.dir, "media");
mkdirSync(dir, { recursive: true });
const glb = houseGlb();
writeFileSync(join(dir, "house.glb"), glb);
console.log(`make-house: ${join(dir, "house.glb")} (${glb.length} bytes)`);
+85
View File
@@ -0,0 +1,85 @@
// The corner house (house.ts) and raea/wear's demo (wear.tsx): every part docs/wear.feature WR7 lists, openings cut
// through the walls (where cracks start), a valid .glb with one material per class, a still for every cause and for
// each of WR9's eight conditions by day and at dusk, and worn paint (docs/examples.feature EX9).
import { describe, expect, test } from "bun:test";
import { readFileSync } from "node:fs";
import { join } from "node:path";
import { DEBUG_CAUSES, WEAR_CLASSES, WEAR_CONDITIONS } from "raea/wear";
import { BAYS, CLASSES, DOOR, houseGlb, solids, SOUTH, STOREYS } from "./house";
type V3 = [number, number, number];
const box = (s: V3[]) => [0, 1, 2].map((a) => [Math.min(...s.map((p) => p[a])), Math.max(...s.map((p) => p[a]))]);
const parts = solids();
/** Whether any solid of `cls` holds the point. */
const solidAt = (p: V3, cls = [...parts.keys()]) =>
cls.some((c) => parts.get(c)!.some((s) => box(s).every(([lo, hi], a) => p[a] > lo + 1e-6 && p[a] < hi - 1e-6)));
describe("the corner house", () => {
test("its classes are raea/wear's, every one used", () => {
const names = WEAR_CLASSES.map((c) => c.name);
for (const c of CLASSES) expect(names).toContain(c);
for (const c of CLASSES) expect(parts.get(c)!.length).toBeGreaterThan(0);
});
test("has every part WR7 names", () => {
const n = (c: string) => parts.get(c as (typeof CLASSES)[number])!.length;
// plinth, string course, sills, cornice and consoles, the door's surround; steps; balcony and hatch; gutter and
// downpipe; the two street plates; the roof
expect(n("sandstone")).toBeGreaterThan(40);
expect(n("granite")).toBeGreaterThanOrEqual(3);
expect(n("iron")).toBeGreaterThan(10);
expect(n("zinc")).toBeGreaterThanOrEqual(4);
expect(n("enamel")).toBe(2);
expect(n("slate")).toBe(2);
expect(n("copper")).toBe(1);
// the ground floor rusticated: bands set back 2 cm every 0.4 m up to the string course
const grooves = parts.get("plaster")!.filter((s) => { const b = box(s); return b[1][0] < 4.2 && Math.abs(b[2][1] + 0.02) < 1e-6; });
expect(grooves.length).toBeGreaterThan(20);
});
test("its windows and door go through the walls, their glass 15 cm in", () => {
for (const st of STOREYS) {
for (const x of BAYS.south) {
if (st === STOREYS[0] && x === DOOR.at) continue;
const mid: V3 = [x, (st.sill + st.head) / 2 + 0.3, -0.05];
expect(solidAt(mid, ["plaster"])).toBe(false);
expect(solidAt([x - 0.3, (st.sill + st.head) / 2 + 0.3, -0.16], ["glass"])).toBe(true);
}
for (const z of BAYS.east) expect(solidAt([SOUTH.x1 - 0.05, (st.sill + st.head) / 2 + 0.3, -z], ["plaster"])).toBe(false);
}
expect(solidAt([DOOR.at, 1.5, -0.05], ["plaster"])).toBe(false);
// and the wall between them is solid
expect(solidAt([(BAYS.south[0] + BAYS.south[1]) / 2, 2.5, -0.25], ["plaster"])).toBe(true);
});
test("is a .glb with one material per class, named for it", () => {
const glb = houseGlb();
const dv = new DataView(glb.buffer, glb.byteOffset);
expect(dv.getUint32(0, true)).toBe(0x46546c67);
expect(dv.getUint32(8, true)).toBe(glb.length);
const len = dv.getUint32(12, true);
const json = JSON.parse(new TextDecoder().decode(glb.subarray(20, 20 + len)));
expect(json.materials.map((m: { name: string }) => m.name)).toEqual([...CLASSES]);
expect(json.meshes[0].primitives).toHaveLength(CLASSES.length);
expect(houseGlb()).toEqual(glb);
});
});
describe("the demo", () => {
const src = readFileSync(join(import.meta.dir, "wear.tsx"), "utf8");
test("has a still of every cause in false colour", () => {
const listed = src.match(/const CAUSES: WearCause\[\] = \[([^\]]+)\]/)![1].match(/"(\w+)"/g)!.map((s) => s.slice(1, -1));
expect(listed.sort()).toEqual(Object.keys(DEBUG_CAUSES).sort());
});
test("draws worn paint with no bake, as <WearExtension> (EX9), from light to heavy", () => {
expect(src).toContain("paint: () => <Paint />");
const amounts = [...src.matchAll(/shape: "\w+", wear: \{ amount: ([\d.]+)/g)].map((m) => Number(m[1]));
expect(amounts).toEqual([0.5, 0.8, 1]);
expect(src).toContain("extension={<WearExtension {...wear} />}");
});
test("draws each of WR9's eight conditions by day and at dusk", () => {
expect(Object.keys(WEAR_CONDITIONS)).toHaveLength(8);
expect(src).toContain("CONDITIONS.flatMap((c) => [");
expect(src).toContain("[`${c}-dusk`, () => <House look={{ ...old, weather: WEAR_CONDITIONS[c] }} sky={SKY[c]} dusk />]");
});
});
+179
View File
@@ -0,0 +1,179 @@
// raea/wear's demo (docs/wear.feature WR7): the corner house (house.ts) baked once and shaded. It is drawn new,
// after 80 years of a coal-burning city, and as a ruin. Each cause appears in false colour, and the house stands
// under each of WR9's eight conditions by day and at dusk. A shower crosses it as a timelapse (rain-passes). `paint`
// is the other wear, worn paint with no bake (<WearExtension>, a material's `wear`; docs/examples.feature EX9).
// bun examples/materials/wear/make-house.ts (once: writes media/house.glb)
// raea render examples/materials/wear/wear.tsx --composition after
// The south front faces +z and the east front +x, so north is -z. The corner stands at (12, 0, 0).
import { AbsoluteFill, Composition, registerRoot, staticFile, useCurrentFrame } from "raea";
import { Cuboid, Cylinder, Model, ToneMapping } from "raea/3d";
import { ExtendedMaterial, ShaderExtension, StandardMaterial, WearExtension, type WearExtensionProps } from "raea/pbr";
import { Camera3d } from "raea/camera";
import { AmbientLight, DirectionalLight } from "raea/light";
import { Mesh3d } from "raea/mesh";
import { Quat, Transform } from "raea/transform";
import { WEAR_CONDITIONS, wearBake, wearDebris, wearShader, weatherAt, type WearAge, type WearCause, type WearCondition, type WearShaderOptions, type WearSpell } from "raea/wear";
import { CLASSES, SOUTH } from "./house";
type V3 = [number, number, number];
/** The house's bake: each material is its own class, Berlin's latitude, the walk round the corner trodden. */
export function bakeHouse() {
return wearBake({
src: staticFile("house.glb"),
env: { up: [0, 1, 0], north: [0, 0, -1], density: 16, walk: ["ground"], sun: { lat: 52.5 } },
classes: Object.fromEntries(CLASSES.map((c) => [c, c])),
});
}
/** The ages the demo shows: a fresh coat, 80 years in a coal-burning city, and 90 years left to go. */
export const AGES = {
new: { years: 0 },
old: { years: 80, soot: 0.85, upkeep: 0.35 },
ruin: { years: 90, soot: 0.85, upkeep: 0.05 },
} as const satisfies Record<string, WearAge>;
/** The light for a time of day and the sky's weather: the sun and its colour, the sky's fill, the backdrop. */
function lightOf(dusk: boolean, sky: "clear" | "overcast" | "storm") {
// the sun from the south-west, so the south front is lit and the east one in shade; at dusk low in the west
const sun: V3 = dusk ? [-30, 4, 12] : [-8, 14, 20];
const dim = sky === "clear" ? 1 : sky === "overcast" ? 0.25 : 0.1;
return {
sun,
lux: (dusk ? 1800 : 9000) * dim,
color: dusk ? "#ffb070" : "#f2ece0",
fill: (dusk ? 140 : 500) * (sky === "clear" ? 1 : 1.4),
fillColor: dusk ? "#5a6890" : sky === "clear" ? "#c4ccd6" : "#a9b0b8",
backdrop: dusk ? (sky === "clear" ? "#3a4568" : "#2a2f3a") : sky === "clear" ? "#aab8c8" : "#8c939b",
};
}
const SKY: Record<WearCondition, "clear" | "overcast" | "storm"> = { spring: "clear", summer: "clear", autumn: "overcast", winter: "clear", snow: "overcast", blizzard: "storm", rain: "overcast", thunder: "storm" };
interface HouseProps {
look?: Omit<WearShaderOptions, "baked">;
debug?: WearCause;
dusk?: boolean;
sky?: "clear" | "overcast" | "storm";
eye?: V3;
at?: V3;
fov?: number;
}
/** The corner house from across the junction, weathered by `look` (or a cause in false colour), with the debris its
* age has brought down on the walk. */
export function House({ look, debug, dusk = false, sky = "clear", eye = [24, 4, 17], at = [9, 6.5, -2], fov = 52 }: HouseProps) {
const baked = bakeHouse();
const shader = look || debug ? wearShader({ baked, ...look, debug }) : undefined;
const debris = look?.age && !debug ? wearDebris(baked, look.age) : [];
const l = lightOf(dusk, sky);
const flat = debug !== undefined;
return (
<AbsoluteFill style={{ background: flat ? "#202020" : l.backdrop }}>
<>
<Camera3d transform={Transform.fromXyz(...eye).lookingAt(at)} projection={{ Perspective: { fov: (fov * Math.PI) / 180, near: 0.1, far: 300 } }} />
<ToneMapping mode={flat ? "none" : "agx"} />
<AmbientLight brightness={flat ? 0 : l.fill} color={l.fillColor} />
<DirectionalLight transform={Transform.fromXyz(...l.sun).lookingAt([6, 4, -4])} illuminance={flat ? 0 : l.lux} color={l.color} shadow_maps_enabled />
<Model name={`corner-house-${debug ?? "look"}`} src={baked.file}>
{shader ? <ExtendedMaterial base={<StandardMaterial />} extension={<ShaderExtension {...shader} />} /> : null}
</Model>
{debris.flatMap((d, i) =>
// a heap is a few lumps of render lying along its front's foot (the east front's runs along z), more and
// bigger under a looser coat; each rests on the walk, which the clipping check reads as passing into the house
lumps(d.loss ?? 0.5, i).map(([u, w, size, yaw], k) => {
const alongX = d.at[0] <= SOUTH.x1;
const half: V3 = [size * (alongX ? 1.6 : 1), size * 0.5, size * (alongX ? 1 : 1.6)];
return (
<Mesh3d key={`${i}-${k}`} allowOverlap transform={Transform.fromXyz(d.at[0] + (alongX ? u : w), d.at[1] + half[1], d.at[2] + (alongX ? w : u)).withRotation(Quat.fromEuler("XYZ", 0, yaw, 0))}>
<Cuboid half_size={half} />
<StandardMaterial base_color={k % 2 ? "#b8ab92" : "#8f8270"} perceptual_roughness={0.95} />
</Mesh3d>
);
}),
)}
</>
</AbsoluteFill>
);
}
/** A heap's lumps: [along the wall, out from it, size, yaw], three to five by its loss potential, placed by its index. */
function lumps(loss: number, seed: number): [number, number, number, number][] {
const r = (k: number) => {
const x = Math.sin(seed * 12.9898 + k * 78.233) * 43758.5453;
return x - Math.floor(x);
};
const n = 3 + Math.round(2 * loss);
return Array.from({ length: n }, (_, k) => [(r(4 * k) - 0.5) * 0.5, (r(4 * k + 1) - 0.5) * 0.18, 0.025 + 0.04 * r(4 * k + 2) * loss, (r(4 * k + 3) - 0.5) * 1.4]);
}
const old = { age: AGES.old };
/** Where the losses are easiest to read: the east front's ground floor and its foot, up close from the walk. */
const NEAR = { eye: [16.8, 1.7, -0.8] as V3, at: [12, 1.2, -4.6] as V3, fov: 50 };
const DOOR = { eye: [8.5, 1.8, 6.5] as V3, at: [6, 1.9, 0] as V3, fov: 50 };
/** A shower crossing the house: dry, raining from minute 6 to 40, drying after. A frame is half a minute. */
export const SHOWER: WearSpell[] = [{ at: 0 }, { at: 6, rain: 1 }, { at: 40 }];
function RainPasses() {
const minutes = useCurrentFrame() * 0.5;
const weather = weatherAt({ day: 130 }, SHOWER, minutes);
const raining = minutes >= 6 && minutes < 40;
return <House look={{ ...old, weather }} sky={raining ? "overcast" : "clear"} />;
}
/** Worn paint with no bake: street iron painted green, its edges chipped to the metal, grime low and rust run down,
* by how worn each is (a bollard, a cabinet turned on the walk, a railing post). */
export const PAINTED: { at: V3; yaw: number; shape: "bollard" | "cabinet" | "post"; wear: WearExtensionProps }[] = [
{ at: [-1.4, 0, 0], yaw: 0, shape: "bollard", wear: { amount: 0.5 } },
{ at: [0.2, 0, -0.3], yaw: 0.6, shape: "cabinet", wear: { amount: 0.8, grime: 0.7, seed: 3 } },
{ at: [1.6, 0, 0.2], yaw: 0, shape: "post", wear: { amount: 1, chips: 0.9, rust: 0.7, rust_color: "#7e4220", seed: 5 } },
];
function Paint() {
const green = <StandardMaterial base_color="#2e5a3c" perceptual_roughness={0.45} metallic={0.1} />;
return (
<AbsoluteFill style={{ background: "#b9c2cc" }}>
<>
<Camera3d transform={Transform.fromXyz(0.4, 1.6, 4.6).lookingAt([0.2, 0.6, 0])} projection={{ Perspective: { fov: 0.7, near: 0.05, far: 50 } }} />
<ToneMapping mode="agx" />
<AmbientLight brightness={500} color="#c4ccd6" />
<DirectionalLight transform={Transform.fromXyz(-3, 5, 4).lookingAt([0, 0, 0])} illuminance={9000} color="#f2ece0" shadow_maps_enabled />
{PAINTED.map(({ at, yaw, shape, wear }) => (
<Mesh3d key={shape} transform={Transform.fromXyz(at[0], at[1] + (shape === "cabinet" ? 0.6 : shape === "post" ? 0.55 : 0.45), at[2]).withRotation(Quat.fromEuler("XYZ", 0, yaw, 0))}>
{shape === "cabinet" ? <Cuboid half_size={[0.4, 0.6, 0.22]} /> : <Cylinder radius={shape === "post" ? 0.06 : 0.11} half_height={shape === "post" ? 0.55 : 0.45} />}
<ExtendedMaterial base={green} extension={<WearExtension {...wear} />} />
</Mesh3d>
))}
<Mesh3d transform={Transform.fromXyz(0, -0.05, 0)}><Cuboid half_size={[4, 0.05, 3]} /><StandardMaterial base_color="#8d8a84" perceptual_roughness={0.9} /></Mesh3d>
</>
</AbsoluteFill>
);
}
const CAUSES: WearCause[] = ["class", "sky", "sun", "cavity", "edge", "flow", "deposit", "touch", "ground", "element", "open", "winter", "drift", "litter", "crack", "loss"];
const CONDITIONS = Object.keys(WEAR_CONDITIONS) as WearCondition[];
export const SHOTS: Record<string, () => JSX.Element> = {
before: () => <House />,
new: () => <House look={{ age: AGES.new }} />,
after: () => <House look={{ ...old, weather: { day: 172 } }} />,
ruin: () => <House look={{ age: AGES.ruin, weather: { day: 172 } }} />,
"ruin-near": () => <House look={{ age: AGES.ruin, weather: { day: 172 } }} {...NEAR} />,
door: () => <House look={{ ...old, weather: { day: 172 } }} {...DOOR} />,
paint: () => <Paint />,
...Object.fromEntries(CAUSES.map((c) => [`debug-${c}`, () => <House debug={c} />])),
...Object.fromEntries(CONDITIONS.flatMap((c) => [
[c, () => <House look={{ ...old, weather: WEAR_CONDITIONS[c] }} sky={SKY[c]} />],
[`${c}-dusk`, () => <House look={{ ...old, weather: WEAR_CONDITIONS[c] }} sky={SKY[c]} dusk />],
])),
};
registerRoot(() => (
<>
{Object.entries(SHOTS).map(([id, Shot]) => (
<Composition key={id} id={id} width={1280} height={800} fps={30} durationInFrames={1} component={Shot} />
))}
<Composition id="rain-passes" width={1280} height={800} fps={30} durationInFrames={120} component={RainPasses} />
</>
));
+13 -3
View File
@@ -59,6 +59,18 @@ impl Codec {
pub fn here(self) -> bool {
cfg!(target_vendor = "apple") || matches!(self, Codec::Rle | Codec::Png)
}
/// It, or what to use instead where this build can't write it.
pub fn usable(self) -> R<Codec> {
if self.here() { Ok(self) } else { Err(format!("{} is written through VideoToolbox, on a Mac: --alpha-codec rle (QuickTime Animation) or png here", self.name())) }
}
/// The codec `--alpha-codec` names (this machine's own when it names none), refused when it can't be written here:
/// what an export asks for before it renders anything, so a Windows PC told prores hears so before the reference
/// render, not after it (#196).
pub fn chosen(flag: Option<&str>) -> R<Codec> {
flag.map_or(Ok(Codec::default_here()), Codec::parse)?.usable()
}
}
/// A transparent movie being written: frames in, `finish` makes the file.
@@ -79,9 +91,7 @@ enum Inner {
impl Writer {
/// A movie of `codec` at `out`; `quality` (0..1) is HEVC's, which the others don't take.
pub fn create(out: &Path, codec: Codec, width: u32, height: u32, fps: f64, quality: f32) -> R<Writer> {
if !codec.here() {
return Err(format!("{} is written through VideoToolbox, on a Mac: use --alpha-codec rle or png here", codec.name()));
}
codec.usable()?;
if width == 0 || height == 0 || width > 0xFFFF || height > 0xFFFF {
return Err(format!("a {width}x{height} movie can't be written"));
}
+1 -4
View File
@@ -11,10 +11,7 @@ use crate::{Codec, R, encode_dir};
/// --manifest, HEVC's quality 0..1), from the frames `render` writes when given the same arguments with -o FOLDER/ and
/// --manifest in place of -o OUT.mov; what it said, APPLIED as the movie.
pub fn render_movie(args: &[String], out: &Path, codec: Option<&str>, manifest: Option<PathBuf>, quality: f32, render: impl Fn(&[String]) -> R<String>) -> R<String> {
let codec = codec.map_or(Ok(Codec::default_here()), Codec::parse)?;
if !codec.here() {
return Err(format!("{} is written through VideoToolbox, on a Mac: --alpha-codec rle (QuickTime Animation) or png here", codec.name()));
}
let codec = Codec::chosen(codec)?;
if let Some(d) = out.parent().filter(|d| !d.as_os_str().is_empty()) {
std::fs::create_dir_all(d).map_err(|e| format!("{}: {e}", d.display()))?;
}
+1 -1
View File
@@ -25,7 +25,7 @@ pub use splat::{ensure_splat, splat_dir, splat_params};
mod local;
use local::*;
mod setup;
pub use setup::{ffmpeg_tool, run_setup, setup_how, uv, venv_python};
pub use setup::{ffmpeg_tool, git, run_setup, setup_how, uv, venv_python};
#[cfg(test)]
mod tests;
+114 -20
View File
@@ -30,18 +30,32 @@ fn on_path(name: &str) -> Option<PathBuf> {
std::env::split_paths(&std::env::var_os("PATH")?).map(|d| d.join(&exe)).find(|p| p.is_file())
}
/// The FFmpeg raea fetches on Windows when none is installed: GyanD's essentials build (the one winget's
/// Gyan.FFmpeg.Essentials installs), kept on GitHub for each release; its SHA-256 is GitHub's digest for the asset
const FFMPEG: &str = "9.0.2";
const FFMPEG_SUM: &str = "60f467265b1e312373dbcd92200c2618a74850f98d3d078e94296bb3fa2047ba";
/// The tool shipped beside raea's own executable: on Windows the release puts FFmpeg and uv in raea.exe's bin/// (tools/release/win-bundle.sh), so raea finds them however it was started and fetches nothing
fn beside_exe(name: &str) -> Option<PathBuf> {
beside(&std::env::current_exe().ok()?, name)
}
/// `ffmpeg` or `ffprobe` as raea runs it: the one on the PATH; else raea's own in $RAEA_TOOLS_CACHE (else
/// ~/.cache/raea-tools)/ffmpeg/bin. On Windows, where FFmpeg is rarely installed, raea's own is fetched there once
/// (114 MB; ffmpeg.exe, ffprobe.exe and its LICENSE kept, about 210 MB) the first time a video raea's own decoders
/// can't read needs it, when `fetch`: H.264 with B-frames, HEVC, VP9 (a phone's or a camera's). Elsewhere FFmpeg is
/// the system's: a Mac reads those on VideoToolbox, and Linux has FFmpeg in its package manager.
fn beside(exe_path: &Path, name: &str) -> Option<PathBuf> {
Some(exe_path.parent()?.join(exe(name))).filter(|p| p.is_file())
}
/// The FFmpeg raea ships beside raea.exe on Windows and fetches where it isn't: raea's own build of FFmpeg's release,
/// LGPL 2.1 or later: FFmpeg's own code, zlib and libvpx's decoders, its H.264 encoder Windows' own (Media
/// Foundation) (tools/release/ffmpeg-win.sh, published with its source as the prerelease tools-ffmpeg-9.0.2-lgpl). Until 0.1.8 raea fetched GyanD's essentials build, GPLv3 with GPL libraries
/// linked in, which raea couldn't ship. tools/release/win-bundle.sh reads these pins.
const FFMPEG: &str = "9.0.2";
const FFMPEG_TOP: &str = "ffmpeg-9.0.2-lgpl-win64";
const FFMPEG_URL: &str = "https://github.com/shinyobjectz/raea/releases/download/tools-ffmpeg-9.0.2-lgpl/ffmpeg-9.0.2-lgpl-win64.zip";
const FFMPEG_SUM: &str = "d3a3d8cdcd3ee488a94328200293a312e9c81923902b9fc3c9fa5dd18779ba8c";
/// `ffmpeg` or `ffprobe` as raea runs it: the one on the PATH; else the one beside raea's executable (the Windows
/// release ships it there); else raea's own in $RAEA_TOOLS_CACHE (else ~/.cache/raea-tools)/ffmpeg/bin. On Windows,
/// where FFmpeg is rarely installed, raea's own is fetched there once the first time a video raea's own decoders
/// can't read needs it, when `fetch`, if the release's copy is missing: H.264 with B-frames, HEVC, VP9 (a phone's or a
/// camera's). Elsewhere FFmpeg is the system's: a Mac reads those on VideoToolbox, and Linux has FFmpeg in its package
/// manager.
pub fn ffmpeg_tool(name: &str, fetch: bool) -> Result<PathBuf, String> {
if let Some(p) = on_path(name) {
if let Some(p) = on_path(name).or_else(|| beside_exe(name)) {
return Ok(p);
}
let dir = raea_io_home::env_path("RAEA_TOOLS_CACHE", ".cache/raea-tools").join("ffmpeg");
@@ -63,13 +77,11 @@ pub fn ffmpeg_tool(name: &str, fetch: bool) -> Result<PathBuf, String> {
return Ok(bin);
}
raea_io_home::offline(&format!("fetching FFmpeg {FFMPEG} to read a video raea's own decoders can't"))?;
eprintln!("raea: this video needs FFmpeg, which isn't installed; fetching FFmpeg {FFMPEG} (114 MB, once) into {}", dir.display());
let name_zip = format!("ffmpeg-{FFMPEG}-essentials_build.zip");
let url = format!("https://github.com/GyanD/codexffmpeg/releases/download/{FFMPEG}/{name_zip}");
let top = format!("ffmpeg-{FFMPEG}-essentials_build");
let members = [format!("{top}/bin/ffmpeg.exe"), format!("{top}/bin/ffprobe.exe"), format!("{top}/LICENSE")];
eprintln!("raea: this video needs FFmpeg, which isn't installed; fetching FFmpeg {FFMPEG} (once) into {}", dir.display());
let name_zip = format!("{FFMPEG_TOP}.zip");
let members = [format!("{FFMPEG_TOP}/bin/ffmpeg.exe"), format!("{FFMPEG_TOP}/bin/ffprobe.exe"), format!("{FFMPEG_TOP}/LICENSE")];
let part = dir.with_file_name(format!("ffmpeg.part{}", std::process::id()));
let fetched = fetch_archive(&part, &url, &name_zip, FFMPEG_SUM, true, &members.each_ref().map(String::as_str));
let fetched = fetch_archive(&part, FFMPEG_URL, &name_zip, FFMPEG_SUM, true, &members.each_ref().map(String::as_str));
settle(&part, &dir, &bin, fetched, "FFmpeg")
}
@@ -78,13 +90,14 @@ pub fn venv_python(dir: &Path) -> PathBuf {
if cfg!(windows) { dir.join(".venv").join("Scripts").join("python.exe") } else { dir.join(".venv").join("bin").join("python") }
}
/// uv: $RAEA_UV, the one on the PATH, or raea's own, fetched the first time (about 20 MB) into $RAEA_TOOLS_CACHE (else
/// ~/.cache/raea-tools)/uv, as tools/ensure.sh does
/// uv: $RAEA_UV, the one on the PATH, the one beside raea's executable (the Windows release ships it there), or
/// raea's own, fetched the first time (about 20 MB) into $RAEA_TOOLS_CACHE (else ~/.cache/raea-tools)/uv, as
/// tools/ensure.sh does
pub fn uv() -> Result<PathBuf, String> {
if let Some(p) = std::env::var_os("RAEA_UV").map(PathBuf::from).filter(|p| p.is_file()) {
return Ok(p);
}
if let Some(p) = on_path("uv") {
if let Some(p) = on_path("uv").or_else(|| beside_exe("uv")) {
return Ok(p);
}
let dir = raea_io_home::env_path("RAEA_TOOLS_CACHE", ".cache/raea-tools").join("uv");
@@ -111,6 +124,62 @@ pub fn uv() -> Result<PathBuf, String> {
settle(&part, &dir, &bin, fetched, "uv")
}
/// The Git for Windows raea fetches where there's none (the app's host, apps/app host/tools.ts WIN_GIT, fetches the same
/// into the same folder, so either finds the other's): dugite-native's portable build with git-lfs, GitHub Desktop's
const WIN_GIT_URL: &str = "https://github.com/desktop/dugite-native/releases/download/v2.56.0-2/dugite-native-v2.56.0-a44aeca-windows-x64.tar.gz";
const WIN_GIT_DIR: &str = "git-v2.56.0-2-windows-x64";
const WIN_GIT_SUM: &str = "f1e17876337d7be143e5d51976da36643d65528125cfbc14d57f171de0fd5f14";
/// git, which a workspace is (raea workspace, project, controller): $RAEA_GIT, else the one on the PATH. On Windows,
/// where Git is rarely installed, then the raea app's (its installer puts Git in its folder, which Settings > Apps
/// keeps as InstallLocation), a Git for Windows that isn't on the PATH, and raea's own in $RAEA_TOOLS_CACHE (else
/// ~/.cache/raea-tools), fetched there the first time (47 MB). Until 0.1.8 raea.exe took git from the PATH only, and on
/// a PC with only the app's every workspace command failed with "git: program not found" (#169).
pub fn git() -> Result<PathBuf, String> {
if let Some(p) = std::env::var_os("RAEA_GIT").map(PathBuf::from).filter(|p| p.is_file()) {
return Ok(p);
}
if let Some(p) = on_path("git") {
return Ok(p);
}
if !cfg!(windows) {
let how = if cfg!(target_os = "macos") { "xcode-select --install" } else { "apt install git, or dnf install git" };
return Err(format!("raea's workspaces are git repos, and git isn't installed: {how}"));
}
let cache = raea_io_home::env_path("RAEA_TOOLS_CACHE", ".cache/raea-tools").join(WIN_GIT_DIR);
let bin = cache.join("cmd").join("git.exe");
if let Some(p) = windows_gits().into_iter().chain([bin.clone()]).find(|p| p.is_file()) {
return Ok(p);
}
static FETCHING: std::sync::Mutex<()> = std::sync::Mutex::new(());
let _one = FETCHING.lock().unwrap_or_else(|e| e.into_inner());
if bin.is_file() {
return Ok(bin);
}
raea_io_home::offline("fetching Git for Windows: raea's workspaces are git repos")?;
eprintln!("raea: a workspace is a git repo, and this PC has no Git; fetching raea's own (Git for Windows, once, 47 MB) into {}", cache.display());
let part = cache.with_file_name(format!("{WIN_GIT_DIR}.part{}", std::process::id()));
let fetched = fetch_archive(&part, WIN_GIT_URL, "git.tar.gz", WIN_GIT_SUM, false, &[]);
// it runs before it's taken, as the app's host checks it
let runs = |p: &Path| std::process::Command::new(p).arg("--version").output().is_ok_and(|o| o.status.success());
let fetched = fetched.and_then(|()| if runs(&part.join("cmd").join("git.exe")) { Ok(()) } else { Err("the Git raea fetched doesn't run".into()) });
settle(&part, &cache, &bin, fetched, "Git for Windows")
}
/// The gits a Windows PC may have off its PATH: the raea app's (its install folder's git\cmd), else in the folder its
/// installer uses by default, and Git for Windows' own for everyone and for the one account.
fn windows_gits() -> Vec<PathBuf> {
let key = r"HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\raea";
let reg = std::process::Command::new("reg").args(["query", key, "/v", "InstallLocation"]).output().ok();
let app = reg.and_then(|o| String::from_utf8_lossy(&o.stdout).lines().find_map(|l| l.trim().strip_prefix("InstallLocation").map(|v| v.trim().trim_start_matches("REG_EXPAND_SZ").trim_start_matches("REG_SZ").trim().to_string())));
let env = |k: &str| std::env::var_os(k).map(PathBuf::from);
let mut at: Vec<PathBuf> = app.filter(|d| !d.is_empty()).map(|d| PathBuf::from(d).join("git")).into_iter().collect();
at.extend(env("LOCALAPPDATA").map(|d| d.join("Programs").join("raea").join("git")));
at.extend(env("ProgramFiles").map(|d| d.join("Git")));
at.extend(env("LOCALAPPDATA").map(|d| d.join("Programs").join("Git")));
at.into_iter().map(|d| d.join("cmd").join("git.exe")).collect()
}
/// A fetch's end: its `part` folder moved in as `dir` when it's whole and nothing got there first, the part removed,
/// and, once the tool is in place, the parts stopped fetches left beside it swept (`NAME.part<pid>`, from a Ctrl+C or
/// a killed process: FFmpeg's held a 114 MB zip, and each run made a new one). A part another process is still
@@ -192,6 +261,31 @@ pub fn run_setup(script: &Path, var: &str, dir: &Path) -> Result<std::process::E
mod tests {
use super::*;
// the release's own copy beside the executable is found; a missing one isn't
#[test]
fn a_tool_beside_the_executable_is_found() {
let root = std::env::temp_dir().join(format!("raea-beside-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&root);
std::fs::create_dir_all(root.join("bin")).unwrap();
std::fs::write(root.join("bin").join(exe("ffmpeg")), b"").unwrap();
let raea = root.join("bin").join(exe("raea"));
assert_eq!(beside(&raea, "ffmpeg"), Some(root.join("bin").join(exe("ffmpeg"))));
assert_eq!(beside(&raea, "uv"), None);
let _ = std::fs::remove_dir_all(&root);
}
// the pins tools/release/win-bundle.sh reads: one line each, as its sed expects
#[test]
fn the_bundle_reads_these_pins() {
let src = include_str!("setup.rs");
for c in ["FFMPEG_URL", "FFMPEG_SUM", "FFMPEG_TOP", "UV"] {
assert_eq!(src.lines().filter(|l| l.starts_with(&format!("const {c}: &str = \""))).count(), 1, "{c}");
}
assert!(FFMPEG_URL.ends_with(&format!("/{FFMPEG_TOP}.zip")) && FFMPEG_TOP.contains(FFMPEG));
assert!(FFMPEG_SUM.len() == 64 && FFMPEG_SUM.bytes().all(|b| b.is_ascii_hexdigit()), "FFMPEG_SUM is a sha256");
assert!(src.contains(" (\"x86_64-pc-windows-msvc\", \""));
}
// a fetch's end sweeps the parts stopped fetches left beside its tool, and only those
#[test]
fn settle_sweeps_stopped_fetches() {
@@ -203,7 +297,7 @@ mod tests {
std::fs::write(p.join(f), b"x").unwrap();
};
// two stopped fetches (one with its zip), another tool's part, and this run's finished part
mk(&root.join("ffmpeg.part111"), "ffmpeg-9.0.2-essentials_build.zip");
mk(&root.join("ffmpeg.part111"), "ffmpeg-9.0.2-lgpl-win64.zip");
mk(&root.join("ffmpeg.part222"), "x");
mk(&root.join("uv.part333"), "x");
let part = root.join("ffmpeg.part444");
+12
View File
@@ -46,6 +46,18 @@ fn says(option: &str) -> String {
String::from_utf8_lossy(&out).into_owned()
}
/// The H.264 encoder this machine's ffmpeg has, as its arguments, for a clip a person plays (in a browser or on a
/// phone): libx264 where ffmpeg was built with it (Homebrew's, Linux distributions'), else the system's own (Windows'
/// Media Foundation, h264_mf, in the LGPL build raea ships there; macOS's VideoToolbox) at 8 Mb/s; None without one.
pub fn h264() -> Option<Vec<&'static str>> {
static ENCODERS: std::sync::OnceLock<String> = std::sync::OnceLock::new();
let have = ENCODERS.get_or_init(|| says("-encoders"));
let has = |c: &str| have.split_whitespace().any(|w| w == c);
let enc = ["libx264", "h264_mf", "h264_videotoolbox"].into_iter().find(|c| has(c))?;
let rate: &[&'static str] = if enc == "libx264" { &[] } else { &["-b:v", "8M"] };
Some([&["-c:v", enc][..], rate, &["-pix_fmt", "yuv420p"]].concat())
}
/// The facts, the presentation times, whether the colour matrix is untagged, and the decoder a VP8 or VP9 stream with
/// alpha needs (libvpx: ffmpeg's own VP9 decoder drops the alpha WebM keeps beside the picture, #113).
fn probe(path: &Path) -> R<(Info, Vec<f64>, bool, Option<&'static str>)> {
+43 -2
View File
@@ -4,10 +4,33 @@
pub mod sdk;
pub mod shared;
/// What a folder takes on disk, as `du -sh` says it (`links`: through a link to its files), or "?".
/// What a folder takes on disk, as `du -sh` says it (`links`: through a link to its files). Windows has no du (raea
/// setup-audio said "(?)" for every model there): its files' sizes are added up instead, in du's units.
pub fn disk_use(dir: &std::path::Path, links: bool) -> String {
let o = std::process::Command::new("du").arg(if links { "-shL" } else { "-sh" }).arg(dir).output();
o.ok().and_then(|o| String::from_utf8_lossy(&o.stdout).split_whitespace().next().map(str::to_string)).unwrap_or_else(|| "?".into())
o.ok().and_then(|o| String::from_utf8_lossy(&o.stdout).split_whitespace().next().map(str::to_string)).unwrap_or_else(|| du_units(bytes_in(dir, links, 0)))
}
/// The bytes of the files under `p` (through links when `links`, 64 folders deep at most, so a link's loop ends).
fn bytes_in(p: &std::path::Path, links: bool, depth: u32) -> u64 {
let md = if links { std::fs::metadata(p) } else { std::fs::symlink_metadata(p) };
match md {
Ok(m) if m.is_dir() && depth < 64 => std::fs::read_dir(p).map(|d| d.flatten().map(|e| bytes_in(&e.path(), links, depth + 1)).sum()).unwrap_or(0),
Ok(m) if m.is_file() => m.len(),
_ => 0,
}
}
/// `n` bytes as `du -h` writes them: 1024s, one decimal under 10 ("1.9G", "512M", "0B").
fn du_units(n: u64) -> String {
let mut v = n as f64;
let mut unit = 0;
while v >= 1024.0 && unit < 4 {
v /= 1024.0;
unit += 1;
}
let u = ["B", "K", "M", "G", "T"][unit];
if unit == 0 { format!("{n}B") } else if v < 10.0 { format!("{v:.1}{u}") } else { format!("{v:.0}{u}") }
}
/// Where raea's own files are (the SDK's TypeScript, the lite runtime and its packages, the shell's sources, the
@@ -173,6 +196,24 @@ pub fn from_url_path_on(s: &str, windows: bool) -> &str {
#[cfg(test)]
mod tests {
#[test]
fn a_folder_is_sized_without_du() {
assert_eq!(super::du_units(0), "0B");
assert_eq!(super::du_units(1023), "1023B");
assert_eq!(super::du_units(1536), "1.5K");
assert_eq!(super::du_units(512 << 20), "512M");
assert_eq!(super::du_units((19 << 30) / 10), "1.9G");
let d = std::env::temp_dir().join(format!("raea-du-{}", std::process::id()));
std::fs::create_dir_all(d.join("a/b")).unwrap();
std::fs::write(d.join("x"), vec![0u8; 1000]).unwrap();
std::fs::write(d.join("a/b/y"), vec![0u8; 2500]).unwrap();
assert_eq!(super::bytes_in(&d, false, 0), 3500);
assert_eq!(super::bytes_in(&d, true, 0), 3500);
assert_eq!(super::bytes_in(&d.join("none"), false, 0), 0);
assert_ne!(super::disk_use(&d, false), "?");
std::fs::remove_dir_all(&d).unwrap();
}
#[test]
fn a_src_is_a_file_url_on_windows() {
assert_eq!(super::src_on("/Users/a/assets/m.png", false), "/Users/a/assets/m.png");
+6
View File
@@ -282,6 +282,12 @@ pub fn h264_encoder(out: &Path, o: &EncodeOpts, intra_qp: Option<u8>) -> R<Box<d
.rate_control_mode(RateControlMode::Bitrate)
// every frame is a sample: rate control may not drop one (the edit has a frame for every tick)
.skip_frames(false)
// no background detection: it takes a slowly changing dark ground (a night scene's sky, a glow drifting over
// black) for still and copies its old blocks forward, which undoes the bits adaptive quantization gives flat
// darks. A dim glow drifting at --quality master blotched in every sampled frame (6-8% of dark blocks
// stepping, raea check) at any bitrate or quantiser; without it, 0.1%, as a lossless encode of the same
// frames (#169). Adaptive quantization stays on: off, the darks blotch with or without this.
.background_detection(false)
// BT.709 limited range, as raea_io_codec::yuv converts the frames and as the Mac's encoder tags them (vt.rs):
// untagged, ffmpeg and other players read it as BT.601 and shift reds and greens
.vui(openh264::encoder::VuiConfig::bt709());
+41
View File
@@ -75,3 +75,44 @@ fn a_quantiser_below_openh264s_floor_is_its_floor() {
// openh264 refuses a pinned QP under 14 with rate control on (Native:3); asked for less, it gets 14
assert!(gop(4) == gop(14));
}
/// A dim glow drifting over near-black, frame `k` of a slow move: the flat darks of a night scene, which openh264's
/// background detection took for still ground and copied forward from earlier frames (#169, "the encoder starved the
/// near-blacks" at --quality master on Windows)
fn glow(w: u32, h: u32, k: u32) -> Vec<u8> {
let (cx, cy, r) = (w as f32 * (0.3 + k as f32 * 0.004), h as f32 * 0.45, w as f32 * 0.8);
(0..w * h).flat_map(|i| {
let (dx, dy) = ((i % w) as f32 - cx, (i / w) as f32 - cy);
let v = (2.0 + 36.0 * (1.0 - (dx * dx + dy * dy).sqrt() / r).max(0.0).powi(2)).round() as u8;
[v, v, v, 255]
}).collect()
}
/// The share of 8x8 blocks whose mean red is more than a level off between two RGBA pictures
fn blocks_off(a: &[u8], b: &[u8], w: u32, h: u32) -> f64 {
let (bw, bh) = (w as usize / 8, h as usize / 8);
let mean = |p: &[u8], bx: usize, by: usize| (0..64).map(|k| p[((by * 8 + k / 8) * w as usize + bx * 8 + k % 8) * 4] as f32).sum::<f32>() / 64.0;
let off = (0..bw * bh).filter(|i| (mean(a, i % bw, i / bw) - mean(b, i % bw, i / bw)).abs() > 1.0).count();
off as f64 / (bw * bh) as f64
}
#[test]
fn a_dark_glow_drifting_keeps_every_block_at_master() {
use raea_io_codec::Backend;
let (w, h, n) = (640, 360, 45);
let o = EncodeOpts { width: w, height: h, fps: 30.0, kbps: 10_000, quality: Some(0.95), nv12: false, realtime: false };
let out = std::env::temp_dir().join(format!("raea-soft-darks-{}.mp4", std::process::id()));
let mut enc = h264_encoder(&out, &o, None).unwrap();
for k in 0..n {
enc.push(&glow(w, h, k)).unwrap();
}
enc.finish(None).unwrap();
let mut dec = raea_io_soft::Soft.open_video(&out).unwrap();
let last = dec.frame_at((n - 1) as f64 / 30.0).unwrap();
let _ = std::fs::remove_file(&out);
let off = blocks_off(&last.rgba, &glow(w, h, n - 1), w, h);
eprintln!("blocks off by more than a level: {:.2}%", off * 100.0);
// with background detection on, the ground lagged the glow: blocks stood where earlier frames had left them, 5.3% of
// them more than a level off by frame 44; without it 1.6% (the rest is the quantiser's)
assert!(off < 0.03, "{:.1}% of 8x8 blocks more than a level off the picture at frame {}", off * 100.0, n - 1);
}
+2
View File
@@ -188,6 +188,8 @@ fn push_sound(cx: &mut Ctx, props: &Map<String, Value>, skey: &str) {
// a sound track with samples: a short window says so (decoding the whole take for it held a long take whole)
let audible = *cx.audible.entry(file.clone()).or_insert_with(|| raea_io_media::decode_audio_window(&file, 0.0, 0.05).is_ok_and(|a| a.len() > 0));
if !muted && volume > 0.0 && audible {
// raea's mix: dialogue at one level, gainDb an offset on it (raea-sys-mix level.rs), as live play has it
let volume = volume * raea_sys_mix::level::gain(&file, num(props, "data-clip-from").unwrap_or(0.0), num(props, "data-clip-to"), props.get("data-bus").and_then(|v| v.as_str())) as f64;
cx.sounds.push(Sound { src: file.display().to_string(), at, volume, rate: num(props, "data-playback-rate").unwrap_or(1.0), key: skey.to_string(), fade_in: num(props, "data-fade-in"), fade_out: num(props, "data-fade-out"), bus: props.get("data-bus").and_then(|v| v.as_str()).map(str::to_string) });
}
}
+27 -7
View File
@@ -150,15 +150,35 @@ fn with_exposure(said: String, out: &Path, manifest: Option<&Path>) -> String {
return said;
}
match raea_sys_light_meter::exposure::of_pngs(&pngs) {
Ok((e, v)) => {
let fs = raea_sys_light_meter::exposure::said(&v); // counted with the render's other findings (DR3)
if let Some(m) = manifest {
if let Ok(mut doc) = std::fs::read_to_string(m).map_err(|e| e.to_string()).and_then(|t| serde_json::from_str::<serde_json::Value>(&t).map_err(|e| e.to_string())) {
if let Some(o) = doc.as_object_mut() {
o.insert("exposure".into(), v.clone());
let _ = std::fs::write(m, doc.to_string());
Ok((e, mut v)) => {
// a frame of the page's own fill (no 3D, no footage: a brand card's ground) is lit by design, so the 3D lighting
// advice is measured, not said; a frame with footage keeps it (a clip that drew black). 11-19: a logo card's warn
let doc: Option<serde_json::Value> = manifest.and_then(|m| std::fs::read_to_string(m).ok()).and_then(|t| serde_json::from_str(&t).ok());
if let Some(d) = doc.as_ref().filter(|d| d["has3d"] == false) {
let frames = d["frames"].as_array().cloned().unwrap_or_default();
fn fill(f: &serde_json::Value) -> bool {
f["videos"].as_array().is_none_or(Vec::is_empty)
}
let mut names: Vec<String> = Vec::new();
if pngs.len() == 1 && frames.len() == 1 && fill(&frames[0]) {
names.push("the frame".into());
} else if pngs.len() == frames.len() {
for (p, f) in pngs.iter().zip(&frames) {
if let (true, Some(n)) = (fill(f), p.file_name()) {
names.push(n.to_string_lossy().into_owned());
}
}
}
if let Some(found) = v["found"].as_array_mut() {
found.retain(|f| !names.iter().any(|n| f["says"].as_str().is_some_and(|s| s.starts_with(&format!("{n}:")))));
}
}
let fs = raea_sys_light_meter::exposure::said(&v); // counted with the render's other findings (DR3)
if let (Some(m), Some(mut doc)) = (manifest, doc)
&& let Some(o) = doc.as_object_mut()
{
o.insert("exposure".into(), v.clone());
let _ = std::fs::write(m, doc.to_string());
}
let mut msg = format!("{said}\nEXPOSURE {}", e.line());
for f in &fs {
Loaded 100 of 172 files, more files were not shown because too many files have changed in this diff. Show more