Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

raea check says who can fix what it finds, so a round goes only to what another render can change

Zachary Guglin1899d29dff9e
diff --git a/Cargo.lock b/Cargo.lock
index 97b0f7cc..be3d26e6 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -13654,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",
@@ -13667,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"
@@ -13690,6 +13700,15 @@ dependencies = [
"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"
diff --git a/Cargo.toml b/Cargo.toml
index a9c85e6e..fb321c6e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -187,9 +187,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",
diff --git a/apps/check/Cargo.toml b/apps/check/Cargo.toml
index 4b914bd8..45c00524 100644
--- a/apps/check/Cargo.toml
+++ b/apps/check/Cargo.toml
@@ -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)
diff --git a/apps/check/cause/Cargo.toml b/apps/check/cause/Cargo.toml
new file mode 100644
index 00000000..0ec6c8c4
--- /dev/null
+++ b/apps/check/cause/Cargo.toml
@@ -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"
diff --git a/apps/check/cause/src/lib.rs b/apps/check/cause/src/lib.rs
new file mode 100644
index 00000000..9f5ec8e3
--- /dev/null
+++ b/apps/check/cause/src/lib.rs
@@ -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;
diff --git a/apps/check/cause/src/tests.rs b/apps/check/cause/src/tests.rs
new file mode 100644
index 00000000..3ffc78f5
--- /dev/null
+++ b/apps/check/cause/src/tests.rs
@@ -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);
+}
diff --git a/apps/check/read/src/lib.rs b/apps/check/read/src/lib.rs
index 2cbcf4f3..ac56a8d8 100644
--- a/apps/check/read/src/lib.rs
+++ b/apps/check/read/src/lib.rs
@@ -41,6 +41,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 +52,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 +67,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)
diff --git a/apps/check/src/lib.rs b/apps/check/src/lib.rs
index c7f3577f..4e632b4f 100644
--- a/apps/check/src/lib.rs
+++ b/apps/check/src/lib.rs
@@ -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.
@@ -167,6 +160,12 @@ fn measured(args: &[String], taste: Vec<Taste>) -> R<(String, Vec<Issue>, Vec<St
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));
@@ -216,7 +215,11 @@ fn findings_of(mut issues: Vec<Issue>, more: Vec<Finding>, fps: f64) -> Vec<Find
/// 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});
diff --git a/apps/check/src/picture.rs b/apps/check/src/picture.rs
index 074f4fc1..f0737d28 100644
--- a/apps/check/src/picture.rs
+++ b/apps/check/src/picture.rs
@@ -101,6 +101,24 @@ 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;
+/// 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))
+ })())
+}
+
pub(crate) fn blotching(video: &str, probe: &Probe, issues: &mut Vec<Issue>, passed: &mut Vec<String>) -> R<()> {
let mut head = Vec::new();
if let Ok(f) = std::fs::File::open(video) {
@@ -112,8 +130,11 @@ pub(crate) fn blotching(video: &str, probe: &Probe, issues: &mut Vec<Issue>, pas
}
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 scores: Vec<Option<f64>> = Vec::new();
let mut frame = |buf: &[u8]| {
- if let Some(s) = blotch_score(buf, w, h) {
+ let score = blotch_score(buf, w, h);
+ scores.push(score);
+ if let Some(s) = score {
seen += 1;
worst = worst.max(s);
if std::env::var_os("RAEA_CHECK_DEBUG").is_some() {
@@ -143,18 +164,49 @@ pub(crate) fn blotching(video: &str, probe: &Probe, issues: &mut Vec<Issue>, pas
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"));
+ }
+}
diff --git a/apps/check/text/Cargo.toml b/apps/check/text/Cargo.toml
new file mode 100644
index 00000000..41ac9482
--- /dev/null
+++ b/apps/check/text/Cargo.toml
@@ -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" }
diff --git a/apps/check/src/text.rs b/apps/check/text/src/lib.rs
similarity index 82%
rename from apps/check/src/text.rs
rename to apps/check/text/src/lib.rs
index 2cd4110d..a653a68a 100644
--- a/apps/check/src/text.rs
+++ b/apps/check/text/src/lib.rs
@@ -1,25 +1,39 @@
-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>;
+
+/// 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,
+}
/// 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 +64,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 +109,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 +124,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 +148,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 +167,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 +208,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();
diff --git a/docs/manual/concepts/rendering.md b/docs/manual/concepts/rendering.md
index 77f6aa01..91d57d37 100644
--- a/docs/manual/concepts/rendering.md
+++ b/docs/manual/concepts/rendering.md
@@ -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/
diff --git a/docs/manual/reference/cli/check.md b/docs/manual/reference/cli/check.md
index 33bd904e..7e2d5a9b 100644
--- a/docs/manual/reference/cli/check.md
+++ b/docs/manual/reference/cli/check.md
@@ -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
diff --git a/sdk/guides/craft/motion/rendering.md b/sdk/guides/craft/motion/rendering.md
index cbae3d7d..67d03113 100644
--- a/sdk/guides/craft/motion/rendering.md
+++ b/sdk/guides/craft/motion/rendering.md
@@ -8,7 +8,10 @@
It measures clipped text, text under a platform's buttons, text over the face, captions on too briefly to read,
caption contrast against the pixels behind them, frozen stretches, flashing past the limit, cues that miss their word, loudness, a sound that
stops dead or (with `--words`) fights the voice, and encoder blotching in the darks. Each finding is ranked P0 to P3
- with its fix; it exits 1 while a P0 or P1 stands, and `-o check.json` writes them for the critique. An
+ with its fix; it exits 1 while a P0 or P1 stands, and `-o check.json` writes them for the critique. Fix every error
+ in one pass before rendering again. A finding that ends `[also in …]` was in the earlier export too: what you changed
+ didn't move it, so don't repeat that change; try another, or say why it stands. A note is for the person, not a
+ reason to render again. An
exception in the composition (an unclamped value going NaN, keyframes out of order, a phrase `word()` can't find, a
missing prop) fails the render and names the line.
- **Watch it as a viewer would once the piece is close.** `raea check` measures; it can't judge a frame cropped too
@@ -45,9 +48,10 @@ looking again, finds more than a still per change and costs less.
A video's bitrate follows its size and frame rate (about 20 Mbit/s at 1080p30, 80 at 4K30; VideoToolbox spends less on
flat pictures), and `--kbps N` sets it. `--quality draft|high|master` (or 0..1: 0.6, 0.85, 0.95) asks for constant
quality instead, each frame getting the bits it needs: `master` keeps thin type and hard vector edges clean at 4K
-(about 31 Mbit/s on flat motion graphics). Blotching in dark areas is the encoder, not the composition: export dark
-material as PNG frames (`RAEA_READBACK=rgba raea render piece.tsx -o piece.frames/`) and encode them with more bits for
-the darks. A `NAME.frames/` folder is never committed, and raea's storage dry run lists it a day after
+(about 31 Mbit/s on flat motion graphics). Blotching in dark areas is the encoder's or the footage's own, and on a
+render made in a project `raea check` says which: the footage's is a note to pass on, never a reason to render again;
+for the encode's, render with `--quality master`. Dark material can also go out as PNG frames
+(`RAEA_READBACK=rgba raea render piece.tsx -o piece.frames/`). A `NAME.frames/` folder is never committed, and raea's storage dry run lists it a day after
the render unless something names it.
Which to ask for. A version made for notes (a cut to review, a shot that will be joined, a preview) takes no
diff --git a/tools/layers.toml b/tools/layers.toml
index d6cb16eb..bc4ca261 100644
--- a/tools/layers.toml
+++ b/tools/layers.toml
@@ -178,9 +178,11 @@ raea-runtime-scene2d = "runtime"
raea-runtime-shared = "runtime"
raea-page = "runtime"
raea-app-check = "apps"
+raea-app-check-cause = "apps"
raea-app-check-flash = "apps"
raea-app-check-inbox = "apps"
raea-app-check-read = "apps"
+raea-app-check-text = "apps"
raea-app-direction = "apps"
raea-app-notes = "apps"
# `raea fingerprint`: its verbs and the resident service that keeps the encoders loaded