Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/crates/concat-effects/examples/previews.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ fn main() {

let mut failed = 0;
let kinds = [Kind::Filter, Kind::Effect, Kind::Transition];
for package in kinds.into_iter().flat_map(|k| Catalogue::builtin().of_kind(k)) {
for package in kinds
.into_iter()
.flat_map(|k| Catalogue::builtin().of_kind(k))
{
let id = package.id();
if !only.is_empty() && !only.iter().any(|want| want == id) {
continue;
Expand Down
74 changes: 61 additions & 13 deletions src/crates/concat-effects/src/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,16 +237,64 @@ pub struct Transition {
/// export fallback. Validated at load so a typo is a load error, not a
/// silent hard cut at export.
pub const XFADE_NAMES: &[&str] = &[
"fade", "fadeblack", "fadewhite", "fadegrays", "fadefast", "fadeslow",
"dissolve", "pixelize", "distance", "radial", "smoothleft", "smoothright",
"smoothup", "smoothdown", "circleopen", "circleclose", "circlecrop",
"rectcrop", "wipeleft", "wiperight", "wipeup", "wipedown", "wipetl",
"wipetr", "wipebl", "wipebr", "slideleft", "slideright", "slideup",
"slidedown", "vertopen", "vertclose", "horzopen", "horzclose", "diagtl",
"diagtr", "diagbl", "diagbr", "hlslice", "hrslice", "vuslice", "vdslice",
"hblur", "squeezeh", "squeezev", "zoomin", "hlwind", "hrwind", "vuwind",
"vdwind", "coverleft", "coverright", "coverup", "coverdown", "revealleft",
"revealright", "revealup", "revealdown",
"fade",
"fadeblack",
"fadewhite",
"fadegrays",
"fadefast",
"fadeslow",
"dissolve",
"pixelize",
"distance",
"radial",
"smoothleft",
"smoothright",
"smoothup",
"smoothdown",
"circleopen",
"circleclose",
"circlecrop",
"rectcrop",
"wipeleft",
"wiperight",
"wipeup",
"wipedown",
"wipetl",
"wipetr",
"wipebl",
"wipebr",
"slideleft",
"slideright",
"slideup",
"slidedown",
"vertopen",
"vertclose",
"horzopen",
"horzclose",
"diagtl",
"diagtr",
"diagbl",
"diagbr",
"hlslice",
"hrslice",
"vuslice",
"vdslice",
"hblur",
"squeezeh",
"squeezev",
"zoomin",
"hlwind",
"hrwind",
"vuwind",
"vdwind",
"coverleft",
"coverright",
"coverup",
"coverdown",
"revealleft",
"revealright",
"revealup",
"revealdown",
];

/// One render pass of a WGSL package.
Expand Down Expand Up @@ -395,9 +443,9 @@ impl Manifest {
return Err(self.invalid("a transition needs a [transition] table"));
};
if self.ffmpeg.is_some() || self.wgsl.is_some() {
return Err(self.invalid(
"a transition's backend is [transition], not [ffmpeg] or [wgsl]",
));
return Err(
self.invalid("a transition's backend is [transition], not [ffmpeg] or [wgsl]")
);
}
if let Some(xfade) = &transition.xfade
&& !XFADE_NAMES.contains(&xfade.as_str())
Expand Down
16 changes: 13 additions & 3 deletions src/crates/concat-effects/src/shader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -857,8 +857,13 @@ impl TransitionShader {
/// layout. Every declared parameter must be a field of the struct.
pub fn compile(manifest: &Manifest, body: &str) -> Result<TransitionShader, String> {
let prelude = format!("{TRANSITION_HEAD}{}", grading());
let (source, slots, span) =
stitch(manifest, body, Entry::Transition, &prelude, TRANSITION_POSTLUDE)?;
let (source, slots, span) = stitch(
manifest,
body,
Entry::Transition,
&prelude,
TRANSITION_POSTLUDE,
)?;
Ok(TransitionShader {
key: format!("{}@{}", manifest.effect.id, manifest.effect.version),
source,
Expand Down Expand Up @@ -1069,7 +1074,12 @@ fn transition(uv: vec2<f32>, progress: f32) -> vec4<f32> {
assert!(shader.source().contains("fn fs_main"));
assert!(shader.source().contains("frame.progress"));
assert!(shader.source().contains("to_texture"));
let pass = shader.pass(&BTreeMap::from([("softness".to_owned(), 0.5)]), &manifest.params, 0.25, None);
let pass = shader.pass(
&BTreeMap::from([("softness".to_owned(), 0.5)]),
&manifest.params,
0.25,
None,
);
assert_eq!(pass.progress, 0.25);
assert_eq!(pass.params.len(), 16);
}
Expand Down
5 changes: 4 additions & 1 deletion src/crates/concat-host/src/titles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,10 @@ impl Titles {
);
let mut live = self.live.lock().unwrap_or_else(|e| e.into_inner());
let (kept, order) = &mut *live;
if kept.insert(key, (art.clone(), Arc::clone(&frame))).is_none() {
if kept
.insert(key, (art.clone(), Arc::clone(&frame)))
.is_none()
{
order.push_back(key);
}
while order.len() > LIVE_KEPT {
Expand Down
20 changes: 13 additions & 7 deletions src/crates/concat-render/src/gpu/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,7 @@ fn output_size_changes_are_handled() {
#[test]
fn a_pass_reads_its_reveal_map_and_the_identity_everywhere() {
let Some(mut gpu) = gpu() else { return };
let body =
"fn effect(uv: vec2<f32>) -> vec4<f32> { let r = reveal_order(uv); return vec4<f32>(r, r, r, 1.0); }";
let body = "fn effect(uv: vec2<f32>) -> vec4<f32> { let r = reveal_order(uv); return vec4<f32>(r, r, r, 1.0); }";
let map = RevealMap::from_rects(4, 4, &[(0, 0, 2, 4), (2, 0, 2, 4)]);
let mut revealed = layer(solid(4, 4, [0, 0, 0, 255]));
let mut pass = package("test.reveal", body, "", &[], 1.0);
Expand Down Expand Up @@ -460,7 +459,9 @@ fn every_shader_package_renders_at_its_defaults() {
let source = solid(4, 4, [200, 120, 60, 255]);
let catalogue = concat_effects::Catalogue::builtin();
for package in catalogue.packages() {
let Some(shader) = package.shader() else { continue };
let Some(shader) = package.shader() else {
continue;
};
let values = package.resolve(&Default::default());
let pass = shader.pass(
&values,
Expand Down Expand Up @@ -491,7 +492,11 @@ fn a_pass_reads_its_layers_clip_relative_time() {
let mut p = plan(4, 4, vec![timed]);
p.time = concat_core::time::Rational::approximate(5.0).expect("a rational");
let out = gpu.render(&p);
assert_eq!(&out.pixels()[..3], &[0, 255, 0], "clip_time should read 3.0");
assert_eq!(
&out.pixels()[..3],
&[0, 255, 0],
"clip_time should read 3.0"
);
}

/// Every packaged transition's pipeline actually creates and runs on the
Expand All @@ -512,9 +517,10 @@ fn every_packaged_transition_combines_across_its_progress_range() {
let pass = catalogue
.transition_pass(package.id(), &Default::default(), progress)
.unwrap_or_else(|| panic!("{} has no transition pass", package.id()));
gpu.combine(4, 4, 0.0, &red, &blue, &pass).unwrap_or_else(|| {
panic!("{} failed to combine at progress {progress}", package.id())
});
gpu.combine(4, 4, 0.0, &red, &blue, &pass)
.unwrap_or_else(|| {
panic!("{} failed to combine at progress {progress}", package.id())
});
}
}
}
3 changes: 1 addition & 2 deletions src/crates/concat-speech/src/chatterbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -625,8 +625,7 @@ pub fn bundle_dir(models: &Path) -> PathBuf {
mod tests {
use super::*;

const UPSTREAM: &str =
"https://huggingface.co/ResembleAI/chatterbox-turbo-ONNX/resolve/main/";
const UPSTREAM: &str = "https://huggingface.co/ResembleAI/chatterbox-turbo-ONNX/resolve/main/";

#[test]
fn the_table_names_nine_distinct_files_with_the_bundle_in_front() {
Expand Down
Loading