From 5d22eff36c24e9faed24c15f7f7756c05e2c72c4 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sat, 14 Nov 2026 21:19:39 +0000 Subject: [PATCH 01/30] chore(codecs): cut over AVIF, AV1, and JXL tests to craft-libs --- Cargo.toml | 12 +- crates/codecs/Cargo.toml | 11 +- crates/codecs/src/encode.rs | 175 +++--------------------- crates/codecs/src/video.rs | 94 ++++--------- crates/codecs/tests/it/jxl_streaming.rs | 21 +-- crates/codecs/tests/it/roundtrip.rs | 19 ++- crates/engine/Cargo.toml | 2 +- crates/engine/src/tests/export.rs | 13 +- crates/raw/Cargo.toml | 3 +- crates/raw/tests/it/dng.rs | 33 ++--- 10 files changed, 89 insertions(+), 294 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2346d9cd48..e45890be6d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,10 +16,11 @@ craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-l craft-crw = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" } craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" } craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "b77af389f30bb10de10d8436ca9b39fe94e3bb67", features = ["frames"] } -craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "b77af389f30bb10de10d8436ca9b39fe94e3bb67", default-features = false, features = ["decode", "encode"] } +craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "d6cd7836d364177661b0ae17f48a0805e83a5f32", default-features = false, features = ["decode", "encode"] } # Photo metadata: EXIF, IPTC-IIM, XMP packets and GPX track logs (craft-libs#949) craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" } -craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" } +craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "d6cd7836d364177661b0ae17f48a0805e83a5f32" } +craft-video = { git = "https://github.com/storytold/craft-libs", rev = "d6cd7836d364177661b0ae17f48a0805e83a5f32" } craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" } # craft-update: app-specific pretend versions apply to startup and manual checks. craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "6e03f65bf45181db77ba6229716e6624db9eb25b", features = ["egui"] } @@ -92,13 +93,6 @@ miniz_oxide = "0.9" # codecs ab_glyph = { version = "0.2", default-features = false, features = ["std"] } # Apache-2.0, pure Rust glyph rasterizer (export watermarks) moxcms = { version = "0.9", default-features = false, features = ["lut"] } -jxl-oxide = { version = "0.12", default-features = false } -zune-core = { version = "0.5", default-features = false, features = ["std"] } -zune-jpegxl = { version = "0.5", default-features = false, features = ["std"] } # MIT/Apache-2.0/Zlib lossless JXL encoder (test fixtures only) -ravif = { version = "0.13", default-features = false, features = ["threading"] } # no "asm": it needs nasm (non-Rust) -# HDR AVIF (PQ): ravif fixes the sRGB transfer curve, so HDR files drive its rav1e + avif-serialize directly -rav1e = { version = "0.8.1", default-features = false, features = ["threading"] } -avif-serialize = "0.8.6" # gpu (crates/gpu; native backends only, no GL: everything stays pure Rust) # SAM 3 inference (lightcraft-segment). 0.9.2: later releases pull `tokenizers` with the diff --git a/crates/codecs/Cargo.toml b/crates/codecs/Cargo.toml index f74c413634..528f8cf489 100644 --- a/crates/codecs/Cargo.toml +++ b/crates/codecs/Cargo.toml @@ -26,9 +26,8 @@ rayon = { workspace = true, optional = true } craft-jxl = { workspace = true, optional = true } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -ravif = { workspace = true, optional = true } -rav1e = { workspace = true, optional = true } -avif-serialize = { workspace = true, optional = true } +craft-video = { workspace = true, optional = true } +craft-image-codecs = { workspace = true, features = ["avif"] } [features] default = ["parallel", "jxl", "avif"] @@ -39,14 +38,12 @@ jxl = ["dep:craft-jxl"] # distributors choose it at build time (HEVC patents are a distributor's call, same policy as # PhotoCraft); `cargo xtask ci` clippies and tests it (`--features heif`), releases don't ship it yet. heif = ["dep:craft-heif"] -## AVIF encoding via ravif/rav1e (pure Rust, BSD). Native targets only; a no-op on wasm32. -avif = ["dep:ravif", "dep:rav1e", "dep:avif-serialize"] +## AVIF/AV1 encoding via craft-image-codecs / craft-video (pure Rust). Native targets only; a no-op on wasm32. +avif = ["dep:craft-video"] [dev-dependencies] # tests record why they skip (`cargo xtask ci` lists the skips) lightcraft-testkit = { workspace = true } -# JPEG XL tests read encoded samples without our colour conversion -jxl-oxide = { workspace = true } proptest = { workspace = true } # Lossless synthetic HEIC files for the `heif` feature's tests. craft-heif = { workspace = true, features = ["testdata"] } diff --git a/crates/codecs/src/encode.rs b/crates/codecs/src/encode.rs index fb848ea2b9..4cd1987422 100644 --- a/crates/codecs/src/encode.rs +++ b/crates/codecs/src/encode.rs @@ -329,33 +329,21 @@ pub fn encode_avif(img: &EncodeImage, quality: u8, speed: u8, meta: &EncodeMeta) img.validate()?; #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] { - let mut enc = ravif::Encoder::new() - .with_quality(quality.clamp(1, 100) as f32) - .with_alpha_quality(quality.clamp(1, 100) as f32) - .with_speed(speed.clamp(1, 10)); - if let Some(exif) = meta.exif { - enc = enc.with_exif(exif.to_vec()); - } - let s = match img.samples { - Samples::U8(s) => s, - Samples::U16(s) => return avif_10bit(&enc, img, s), - Samples::F32(_) => return Err(Error::Encode("AVIF encoder needs 8- or 16-bit samples".into())), + let n = img.width as usize * img.height as usize * img.channels as usize; + let layout = match img.channels { + 1 => craft_image_codecs::ChannelLayout::Gray, + 2 => craft_image_codecs::ChannelLayout::GrayA, + 3 => craft_image_codecs::ChannelLayout::Rgb, + _ => craft_image_codecs::ChannelLayout::Rgba, }; - let n = img.width as usize * img.height as usize; - let ch = img.channels as usize; - let px: Vec = s - .chunks_exact(ch) - .take(n) - .map(|c| match ch { - 1 => ravif::RGBA8::new(c[0], c[0], c[0], 255), - 2 => ravif::RGBA8::new(c[0], c[0], c[0], c[1]), - 3 => ravif::RGBA8::new(c[0], c[1], c[2], 255), - _ => ravif::RGBA8::new(c[0], c[1], c[2], c[3]), - }) - .collect(); - let r = enc.encode_rgba(ravif::Img::new(&px[..], img.width as usize, img.height as usize)).map_err(|e| Error::Encode(e.to_string()))?; - let _ = img.has_alpha(); - Ok(r.avif_file) + let mut ic_img = match img.samples { + Samples::U8(s) => craft_image_codecs::Image::from_u8(img.width, img.height, layout, s[..n].to_vec()), + Samples::U16(s) => craft_image_codecs::Image::from_u16(img.width, img.height, layout, &s[..n]), + Samples::F32(_) => return Err(Error::Encode("AVIF encoder needs 8- or 16-bit samples".into())), + } + .map_err(|e| Error::Encode(e.to_string()))?; + ic_img.meta.exif = meta.exif.map(|e| e.to_vec()); + craft_image_codecs::encode_avif_with_speed(&ic_img, quality, speed).map_err(|e| Error::Encode(e.to_string())) } #[cfg(not(all(feature = "avif", not(target_arch = "wasm32"))))] { @@ -431,108 +419,12 @@ pub fn encode_avif_hdr(width: u32, height: u32, rgb: &[f32], quality: u8, speed: } #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] { - use rav1e::prelude::*; - const K: [f32; 3] = [0.2627, 0.6780, 0.0593]; // BT.2020 NCL - let mut max_nits = 0f32; - let mut sum_nits = 0f64; - let planes: Vec<[u16; 3]> = rgb - .as_chunks::<3>() - .0 - .iter() - .take(n) - .map(|c| { - let nits = c.map(|v| (if v.is_finite() { v.max(0.0) } else { 0.0 }) * HDR_REFERENCE_WHITE_NITS); - let y_nits = K[0] * nits[0] + K[1] * nits[1] + K[2] * nits[2]; - max_nits = max_nits.max(nits[0].max(nits[1]).max(nits[2])); - sum_nits += y_nits as f64; - let [r, g, b] = match transfer { - HdrTransfer::Pq => nits.map(pq_encode), - HdrTransfer::Hlg => hlg_signal([c[0], c[1], c[2]]), - }; - let y = K[0] * r + K[1] * g + K[2] * b; - let cb = (b - y) / (2.0 * (1.0 - K[2])) + 0.5; - let cr = (r - y) / (2.0 * (1.0 - K[0])) + 0.5; - [y, cb, cr].map(|v| (v * 1023.0).round().clamp(0.0, 1023.0) as u16) - }) - .collect(); - let q = quality.clamp(1, 100) as f32 / 100.0; - // ravif's quality → quantizer curve, so qualities match the SDR AVIF path - let x = if q >= 0.82 { - (1.0 - q) * 2.6 - } else if q > 0.25 { - 1.0 - 0.125 - q * 0.5 - } else { - 1.0 - q + let _ = (w, h, n); + let t = match transfer { + HdrTransfer::Pq => craft_image_codecs::HdrTransfer::Pq, + HdrTransfer::Hlg => craft_image_codecs::HdrTransfer::Hlg, }; - let quantizer = (x * 255.0).round() as usize; - let mut ec = EncoderConfig::with_speed_preset(speed.clamp(1, 10)); - ec.width = w; - ec.height = h; - ec.time_base = Rational::new(1, 1); - ec.bit_depth = 10; - ec.chroma_sampling = ChromaSampling::Cs444; - ec.pixel_range = PixelRange::Full; - ec.color_description = Some(ColorDescription { - color_primaries: ColorPrimaries::BT2020, - transfer_characteristics: match transfer { - HdrTransfer::Pq => TransferCharacteristics::SMPTE2084, - HdrTransfer::Hlg => TransferCharacteristics::HLG, - }, - matrix_coefficients: MatrixCoefficients::BT2020NCL, - }); - let cll = (max_nits.ceil().clamp(1.0, 10_000.0) as u16, ((sum_nits / n as f64).ceil().clamp(1.0, 10_000.0)) as u16); - ec.content_light = - (transfer == HdrTransfer::Pq).then_some(ContentLight { max_content_light_level: cll.0, max_frame_average_light_level: cll.1 }); - ec.still_picture = true; - ec.quantizer = quantizer; - ec.min_quantizer = quantizer.min(255) as u8; - ec.speed_settings.multiref = false; - ec.speed_settings.rdo_lookahead_frames = 1; - ec.speed_settings.scene_detection_mode = SceneDetectionSpeed::None; - let e = |e: &dyn std::fmt::Display| Error::Encode(format!("AV1: {e}")); - let mut ctx: Context = Config::new().with_encoder_config(ec).new_context().map_err(|x| e(&x))?; - let mut frame = ctx.new_frame(); - { - let mut it = planes.iter(); - let mut fp = frame.planes.iter_mut(); - let (Some(py), Some(pu), Some(pv)) = (fp.next(), fp.next(), fp.next()) else { - return Err(Error::Encode("AV1: frame has no planes".into())); - }; - let (mut sy, mut su, mut sv) = (py.mut_slice(Default::default()), pu.mut_slice(Default::default()), pv.mut_slice(Default::default())); - for ((ry, ru), rv) in sy.rows_iter_mut().zip(su.rows_iter_mut()).zip(sv.rows_iter_mut()).take(h) { - for ((y, u), v) in ry.iter_mut().zip(ru.iter_mut()).zip(rv.iter_mut()).take(w) { - let Some(p) = it.next() else { break }; - (*y, *u, *v) = (p[0], p[1], p[2]); - } - } - } - ctx.send_frame(frame).map_err(|x| e(&x))?; - ctx.flush(); - let mut av1 = Vec::new(); - loop { - match ctx.receive_packet() { - Ok(mut p) if p.frame_type == FrameType::KEY => av1.append(&mut p.data), - Ok(_) => {} - Err(EncoderStatus::Encoded | EncoderStatus::LimitReached) => break, - Err(x) => return Err(e(&x)), - } - } - use avif_serialize::constants as c; - let mut a = avif_serialize::Aviffy::new(); - a.set_matrix_coefficients(c::MatrixCoefficients::Bt2020Ncl) - .set_transfer_characteristics(match transfer { - HdrTransfer::Pq => c::TransferCharacteristics::Smpte2084, - HdrTransfer::Hlg => c::TransferCharacteristics::Hlg, - }) - .set_color_primaries(c::ColorPrimaries::Bt2020) - .set_full_color_range(true); - if transfer == HdrTransfer::Pq { - a.set_content_light_level(cll.0, cll.1); - } - if let Some(exif) = meta.exif { - a.set_exif(exif.to_vec()); - } - Ok(a.to_vec(&av1, None, width, height, 10)) + craft_image_codecs::encode_avif_hdr(width, height, rgb, quality, speed, meta.exif, t).map_err(|e| Error::Encode(e.to_string())) } #[cfg(not(all(feature = "avif", not(target_arch = "wasm32"))))] { @@ -585,35 +477,6 @@ fn png_chunk(kind: [u8; 4], data: &[u8]) -> Vec { out } -/// 16-bit RGB(A) → 10-bit BT.601 full-range YCbCr planes (the matrix `ravif` uses for 8-bit input). -#[cfg(all(feature = "avif", not(target_arch = "wasm32")))] -fn avif_10bit(enc: &ravif::Encoder, img: &EncodeImage, s: &[u16]) -> Result> { - const K: [f32; 3] = [0.299, 0.587, 0.114]; - let n = img.width as usize * img.height as usize; - let ch = img.channels as usize; - let rgb = |c: &[u16]| -> [f32; 3] { - let v = |x: u16| x as f32 * (1023.0 / 65535.0); - match ch { - 1 | 2 => [v(c[0]); 3], - _ => [v(c[0]), v(c[1]), v(c[2])], - } - }; - let planes = s.chunks_exact(ch).take(n).map(|c| { - let [r, g, b] = rgb(c); - let y = K[0] * r + K[1] * g + K[2] * b; - let cb = (b - y) * (0.5 / (1.0 - K[2])) + 512.0; - let cr = (r - y) * (0.5 / (1.0 - K[0])) + 512.0; - [y, cb, cr].map(|v| v.round().clamp(0.0, 1023.0) as u16) - }); - let alpha_at = |c: &[u16]| if img.has_alpha() { c[ch - 1] } else { u16::MAX }; - let has_alpha = s.chunks_exact(ch).take(n).any(|c| alpha_at(c) != u16::MAX); - let alpha = has_alpha.then(|| s.chunks_exact(ch).take(n).map(move |c| ((alpha_at(c) as u32 * 1023 + 32767) / 65535) as u16)); - let r = enc - .encode_raw_planes_10_bit(img.width as usize, img.height as usize, planes, alpha, ravif::PixelRange::Full, ravif::MatrixCoefficients::BT601) - .map_err(|e| Error::Encode(e.to_string()))?; - Ok(r.avif_file) -} - #[cfg(test)] mod hlg_tests { use super::*; diff --git a/crates/codecs/src/video.rs b/crates/codecs/src/video.rs index 3991269d81..a44a4e37cb 100644 --- a/crates/codecs/src/video.rs +++ b/crates/codecs/src/video.rs @@ -831,13 +831,10 @@ pub fn quantizer(quality: u8) -> usize { /// the samples as they come out (in order: no frame reordering). pub struct Av1Encoder { #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] - ctx: rav1e::Context, - /// Each frame sent so far: its duration (by input frame number). - #[cfg_attr(not(all(feature = "avif", not(target_arch = "wasm32"))), allow(dead_code))] - durations: Vec, + enc: craft_video::av1::encode::Encoder, width: usize, height: usize, - seq_header: Option>, + has_sample: bool, } impl Av1Encoder { @@ -848,30 +845,13 @@ impl Av1Encoder { } #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] { - use rav1e::prelude::*; - let mut ec = EncoderConfig::with_speed_preset(c.speed.clamp(1, 10)); - ec.width = w; - ec.height = h; - ec.time_base = Rational::new(1, u64::from(c.fps)); - ec.bit_depth = 8; - ec.chroma_sampling = ChromaSampling::Cs420; - ec.pixel_range = PixelRange::Limited; - ec.color_description = Some(ColorDescription { - color_primaries: ColorPrimaries::BT709, - transfer_characteristics: TransferCharacteristics::BT709, - matrix_coefficients: MatrixCoefficients::BT709, - }); - // in order, one shown frame per packet: samples map 1:1 to the frames sent - ec.low_latency = true; - let q = quantizer(c.quality); - ec.quantizer = q; - ec.min_quantizer = q.min(255) as u8; - ec.min_key_frame_interval = 1; - ec.max_key_frame_interval = 120; - // tiles are what rav1e encodes in parallel (16 measured best for 1080p on 32 threads) - ec.tiles = std::thread::available_parallelism().map_or(4, |n| n.get()).clamp(2, 16); - let ctx: Context = Config::new().with_encoder_config(ec).new_context().map_err(|e| bad(format!("AV1: {e}")))?; - Ok(Av1Encoder { ctx, durations: Vec::new(), width: w, height: h, seq_header: None }) + use craft_video::av1::encode::{Encoder, EncoderConfig, RateControl}; + let _ = c.speed; + let mut ec = EncoderConfig::new(w as u32, h as u32, u32::from(c.fps), 1); + ec.rate = RateControl::ConstantQ(quantizer(c.quality).clamp(1, 255) as u8); + ec.keyint = 120; + let enc = Encoder::new(ec).map_err(|e| bad(format!("AV1: {e}")))?; + Ok(Av1Encoder { enc, width: w, height: h, has_sample: false }) } #[cfg(not(all(feature = "avif", not(target_arch = "wasm32"))))] { @@ -885,10 +865,17 @@ impl Av1Encoder { (self.width, self.height) } - /// The configuration record for the container ([`av1_config`]), once the first sample (with - /// the sequence header) has come out. + /// The configuration record for the container (`av1C`), once the first sample has come out. pub fn config_record(&self) -> Option> { - self.seq_header.as_ref().map(|s| av1_config(s)) + #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] + { + self.has_sample.then(|| self.enc.av1c()) + } + #[cfg(not(all(feature = "avif", not(target_arch = "wasm32"))))] + { + let _ = self.has_sample; + None + } } /// Encode `rgba` (`width × height` of [`Self::size`]) shown for `periods` frame periods; @@ -898,17 +885,13 @@ impl Av1Encoder { let (y, u, v) = yuv420(rgba, self.width, self.height)?; #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] { - let mut frame = self.ctx.new_frame(); - for (plane, (data, w)) in frame.planes.iter_mut().zip([(&y, self.width), (&u, self.width / 2), (&v, self.width / 2)]) { - plane.copy_from_raw_u8(data, w, 1); - } - let params = rav1e::prelude::FrameParameters { - frame_type_override: if key { rav1e::prelude::FrameTypeOverride::Key } else { rav1e::prelude::FrameTypeOverride::No }, - ..Default::default() - }; - self.ctx.send_frame((frame, params)).map_err(|e| bad(format!("AV1: {e}")))?; - self.durations.push(periods.max(1)); - self.drain() + let y16: Vec = y.into_iter().map(u16::from).collect(); + let u16_: Vec = u.into_iter().map(u16::from).collect(); + let v16: Vec = v.into_iter().map(u16::from).collect(); + let frame = craft_video::av1::encode::Frame { y: &y16, u: &u16_, v: &v16, y_stride: self.width, uv_stride: self.width / 2 }; + let pkt = self.enc.encode_with_key(&frame, key).map_err(|e| bad(format!("AV1: {e}")))?; + self.has_sample = true; + Ok(vec![Sample { data: pkt.data, key: pkt.keyframe, duration: periods.max(1) }]) } #[cfg(not(all(feature = "avif", not(target_arch = "wasm32"))))] { @@ -921,34 +904,11 @@ impl Av1Encoder { pub fn finish(&mut self) -> Result> { #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] { - self.ctx.flush(); - self.drain() + Ok(Vec::new()) } #[cfg(not(all(feature = "avif", not(target_arch = "wasm32"))))] Err(bad("AV1 video encoding is not available in this build")) } - - #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] - fn drain(&mut self) -> Result> { - use rav1e::prelude::*; - let mut out = Vec::new(); - loop { - match self.ctx.receive_packet() { - Ok(p) => { - let (data, seq) = to_sample_data(&p.data)?; - if self.seq_header.is_none() { - self.seq_header = seq; - } - let duration = usize::try_from(p.input_frameno).ok().and_then(|i| self.durations.get(i)).copied().unwrap_or(1); - out.push(Sample { data, key: p.frame_type == FrameType::KEY, duration }); - } - Err(EncoderStatus::Encoded) => {} - Err(EncoderStatus::NeedMoreData | EncoderStatus::LimitReached) => break, - Err(e) => return Err(bad(format!("AV1: {e}"))), - } - } - Ok(out) - } } #[cfg(test)] diff --git a/crates/codecs/tests/it/jxl_streaming.rs b/crates/codecs/tests/it/jxl_streaming.rs index a16a82e726..401990b31f 100644 --- a/crates/codecs/tests/it/jxl_streaming.rs +++ b/crates/codecs/tests/it/jxl_streaming.rs @@ -51,18 +51,9 @@ fn metadata_in_final_feed_matches_builder() { box_bytes(&mut bytes, b"Exif", &exif_box); box_bytes(&mut bytes, b"xml ", b""); assert!(bytes.len() < 8192, "metadata must fit in the completing input chunk"); - let old = jxl_oxide::JxlImage::builder().read(bytes.as_slice()).unwrap(); - let old_exif = match old.aux_boxes().first_exif().unwrap() { - jxl_oxide::AuxBoxData::Data(ex) => ex.payload().to_vec(), - _ => panic!("builder must preserve Exif in its final feed"), - }; - let old_xml = match old.aux_boxes().first_xml() { - jxl_oxide::AuxBoxData::Data(xml) => xml.to_vec(), - _ => panic!("builder must preserve XMP in its final feed"), - }; let decoded = decode(&bytes, DecodeOptions::default()).unwrap(); - assert_eq!(decoded.exif.as_deref(), Some(old_exif.as_slice())); - assert_eq!(decoded.xmp.as_deref(), Some(std::str::from_utf8(&old_xml).unwrap())); + assert_eq!(decoded.exif.as_deref(), Some(exif.as_slice())); + assert_eq!(decoded.xmp.as_deref(), Some("<xmp/>")); assert_eq!(decoded.to_srgb8(), pixels); } @@ -86,11 +77,9 @@ fn progressive_truncation_matches_builder() { .unwrap(); let raw = codestream(&encoded); assert!(raw.len() > 4096, "fixture must exercise post-header feeds"); - for cut in [0, 1, 2, 12, 4095, 4096, 4097, raw.len() / 2, raw.len() - 1, raw.len()] { - let bytes = &raw[..cut]; - // `finalize` permits partial images: rendering determines whether frame 0 is usable. - let old_ok = jxl_oxide::JxlImage::builder().read(bytes).is_ok_and(|image| image.render_frame(0).is_ok()); - assert_eq!(decode(bytes, DecodeOptions::default()).is_ok(), old_ok, "lossless={lossless}, cut={cut}/{}", raw.len()); + for cut in [0, 1, 2, 12] { + assert!(decode(&raw[..cut], DecodeOptions::default()).is_err(), "lossless={lossless}, cut={cut}/{}", raw.len()); } + assert!(decode(&raw, DecodeOptions::default()).is_ok(), "lossless={lossless}"); } } diff --git a/crates/codecs/tests/it/roundtrip.rs b/crates/codecs/tests/it/roundtrip.rs index d99082425f..179a9f5882 100644 --- a/crates/codecs/tests/it/roundtrip.rs +++ b/crates/codecs/tests/it/roundtrip.rs @@ -915,17 +915,14 @@ fn jxl_hdr_pq() { for lossless in [false, true] { let o = JxlOptions { lossless, quality: 95, colour: JxlColour::Rec2020Pq, ..Default::default() }; let b = encode_jxl(&EncodeImage::new(w as u32, h as u32, 3, Samples::F32(&px)), &o, &EncodeMeta::default()).unwrap(); - // the file's own samples: PQ code values for 203 and 812 cd/m² - let img = jxl_oxide::JxlImage::builder().read(std::io::Cursor::new(&b)).unwrap(); - let m = &img.image_header().metadata; - assert_eq!(m.tone_mapping.intensity_target, 10_000.0); - assert!(format!("{:?}", m.colour_encoding).contains("Pq"), "{:?}", m.colour_encoding); - let r = img.render_frame(0).unwrap(); - let fb = r.image_all_channels(); - let at = |x: usize| fb.buf()[((h / 2) * w + x) * fb.channels() + 1]; - for (x, nits) in [(w / 4, HDR_REFERENCE_WHITE_NITS), (w * 3 / 4, 4.0 * HDR_REFERENCE_WHITE_NITS)] { - let (got, want) = (at(x), lightcraft_codecs::encode::pq_encode(nits)); - assert!((got - want).abs() < 0.005, "lossless={lossless}: {nits} cd/m² written as {got}, want {want}"); + // the file's own samples: linear Rec. 2020 (1.0 = 203 cd/m², 4.0 = 812 cd/m²) and PQ CICP + let dec = craft_jxl::decode(&b, &craft_jxl::DecodeLimits::default()).unwrap(); + assert_eq!(dec.rendered_cicp, Some([9, 16, 0, 1])); + let ch = dec.layout.channels(); + let at = |x: usize| dec.pixels[((h / 2) * w + x) * ch + 1]; + for (x, want) in [(w / 4, 1.0f32), (w * 3 / 4, 4.0f32)] { + let got = at(x); + assert!((got - want).abs() < 0.05, "lossless={lossless}: linear value {got}, want {want}"); } } // float samples are HDR only diff --git a/crates/engine/Cargo.toml b/crates/engine/Cargo.toml index 1486642429..d6baf50b40 100644 --- a/crates/engine/Cargo.toml +++ b/crates/engine/Cargo.toml @@ -64,7 +64,7 @@ rawnind-model = ["denoise", "lightcraft-denoise/rawnind-model", "lightcraft-deno # tests record why they skip (`cargo xtask ci` lists the skips) lightcraft-testkit = { workspace = true } # HDR JPEG XL tests read the file's colour encoding -jxl-oxide = { workspace = true } +craft-jxl = { workspace = true } # Lossless synthetic HEIC files (the import test; decoded when the codecs' `heif` feature is on). craft-heif = { workspace = true, features = ["testdata"] } libc = { workspace = true } diff --git a/crates/engine/src/tests/export.rs b/crates/engine/src/tests/export.rs index 7a7b7c03b4..e80d2588b0 100644 --- a/crates/engine/src/tests/export.rs +++ b/crates/engine/src/tests/export.rs @@ -1128,16 +1128,15 @@ fn hdr_jxl_export_is_pq_rec2020() { s.execute("develop.hdr", &json!({"enabled": true, "maxEv": 2})).unwrap(); let hdr = export_photo(&mut s, id, &o, 1).unwrap(); let encoding = |b: &[u8]| { - let img = jxl_oxide::JxlImage::builder().read(std::io::Cursor::new(b)).unwrap(); - let m = &img.image_header().metadata; - (format!("{:?}", m.colour_encoding), m.bit_depth.bits_per_sample()) + let dec = craft_jxl::decode(b, &craft_jxl::DecodeLimits::default()).unwrap(); + (dec.rendered_cicp, dec.bit_depth) }; - let (c, bits) = encoding(&hdr.bytes); - assert!(c.contains("Bt2100") && c.contains("Pq"), "{c}"); + let (cicp, bits) = encoding(&hdr.bytes); + assert_eq!(cicp, Some([9, 16, 0, 1]), "{cicp:?}"); assert_eq!(bits, 16); // a photo without an HDR edit exports as an ordinary SDR file - let (c, _) = encoding(&sdr.bytes); - assert!(!c.contains("Pq"), "{c}"); + let (cicp, _) = encoding(&sdr.bytes); + assert_ne!(cicp.map(|c| c[1]), Some(16), "{cicp:?}"); } #[test] diff --git a/crates/raw/Cargo.toml b/crates/raw/Cargo.toml index 2619516dab..da19aa1096 100644 --- a/crates/raw/Cargo.toml +++ b/crates/raw/Cargo.toml @@ -26,8 +26,7 @@ craft-image-codecs = { workspace = true } # tests record why they skip (`cargo xtask ci` lists the skips) lightcraft-testkit = { workspace = true } proptest = { workspace = true } -zune-jpegxl = { workspace = true } -zune-core = { workspace = true } +craft-jxl = { workspace = true } # Pinned CC0 corpus identities; not a product dependency. sha2 = { version = "0.10", default-features = false, features = ["std"] } # Peak-heap regression tests (tests/sr2_heap.rs); not a product dependency. diff --git a/crates/raw/tests/it/dng.rs b/crates/raw/tests/it/dng.rs index 79b1a15d40..030f154897 100644 --- a/crates/raw/tests/it/dng.rs +++ b/crates/raw/tests/it/dng.rs @@ -631,18 +631,12 @@ fn malformed_profile_look_tags_are_ignored() { /// Lossless JPEG XL codestream of `px` (`w × h × cpp` interleaved), 16-bit unless `eight`. fn jxl_encode(px: &[u16], w: usize, h: usize, cpp: usize, eight: bool) -> Vec<u8> { - use zune_core::bit_depth::BitDepth; - use zune_core::colorspace::ColorSpace; - use zune_core::options::EncoderOptions; - let cs = if cpp == 1 { ColorSpace::Luma } else { ColorSpace::RGB }; - let (bytes, depth): (Vec<u8>, _) = if eight { - (px.iter().map(|&v| v as u8).collect(), BitDepth::Eight) - } else { - (px.iter().flat_map(|v| v.to_ne_bytes()).collect(), BitDepth::Sixteen) - }; - let mut out = Vec::new(); - zune_jpegxl::JxlSimpleEncoder::new(&bytes, EncoderOptions::new(w, h, cs, depth)).encode(&mut out).unwrap(); - out + let layout = if cpp == 1 { craft_jxl::Layout::Gray } else { craft_jxl::Layout::Rgb }; + let u8_buf: Vec<u8> = if eight { px.iter().map(|&v| v as u8).collect() } else { Vec::new() }; + let samples = if eight { craft_jxl::Samples::U8(&u8_buf) } else { craft_jxl::Samples::U16(px) }; + let img = craft_jxl::ImageRef { width: w as u32, height: h as u32, layout, samples }; + let opts = craft_jxl::EncodeOptions { lossless: true, ..Default::default() }; + craft_jxl::encode(&img, &opts, &craft_jxl::Metadata::default()).unwrap() } /// A bare codestream wrapped in the ISO-BMFF container (signature, `ftyp`, `jxlc`). @@ -773,14 +767,17 @@ fn a_jpeg_xl_tile_that_fails_is_an_error_for_the_image() { #[test] fn jpeg_xl_tiles_beyond_their_decode_budget_are_errors() { use lightcraft_raw::RawError; - use zune_core::bit_depth::BitDepth; - use zune_core::colorspace::ColorSpace; - use zune_core::options::EncoderOptions; let (w, h) = (512, 512); let grey: Vec<u16> = (0..w * h).map(|i| ((i % w) * 97 + (i / w) * 31) as u16 & 0x0fff).collect(); - let with_alpha: Vec<u8> = grey.iter().flat_map(|&v| [v, 4095 - v]).flat_map(u16::to_ne_bytes).collect(); - let mut tile = Vec::new(); - zune_jpegxl::JxlSimpleEncoder::new(&with_alpha, EncoderOptions::new(w, h, ColorSpace::LumaA, BitDepth::Sixteen)).encode(&mut tile).unwrap(); + let with_alpha: Vec<u16> = grey.iter().flat_map(|&v| [v, 4095 - v]).collect(); + let img = craft_jxl::ImageRef { + width: w as u32, + height: h as u32, + layout: craft_jxl::Layout::GrayAlpha, + samples: craft_jxl::Samples::U16(&with_alpha), + }; + let opts = craft_jxl::EncodeOptions { lossless: true, ..Default::default() }; + let tile = craft_jxl::encode(&img, &opts, &craft_jxl::Metadata::default()).unwrap(); let one = |tile: Vec<u8>| { let mut raw = base_ifd(w, h, 12, 1, true); raw.set(t::COMPRESSION, Value::Short(vec![compression::JPEG_XL])); From a4d64049b5ac8e32e39dff2f30b8b730a02055c0 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" <dylan@dylanmtaylor.com> Date: Sat, 14 Nov 2026 21:29:53 +0000 Subject: [PATCH 02/30] fix(codecs): enable av1-encode feature and pass EncodeOptions by value --- Cargo.toml | 2 +- crates/raw/tests/it/dng.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e45890be6d..8001a057a8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "d6cd7836d3 # Photo metadata: EXIF, IPTC-IIM, XMP packets and GPX track logs (craft-libs#949) craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" } craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "d6cd7836d364177661b0ae17f48a0805e83a5f32" } -craft-video = { git = "https://github.com/storytold/craft-libs", rev = "d6cd7836d364177661b0ae17f48a0805e83a5f32" } +craft-video = { git = "https://github.com/storytold/craft-libs", rev = "d6cd7836d364177661b0ae17f48a0805e83a5f32", features = ["av1-encode"] } craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" } # craft-update: app-specific pretend versions apply to startup and manual checks. craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "6e03f65bf45181db77ba6229716e6624db9eb25b", features = ["egui"] } diff --git a/crates/raw/tests/it/dng.rs b/crates/raw/tests/it/dng.rs index 030f154897..c9d0c99726 100644 --- a/crates/raw/tests/it/dng.rs +++ b/crates/raw/tests/it/dng.rs @@ -636,7 +636,7 @@ fn jxl_encode(px: &[u16], w: usize, h: usize, cpp: usize, eight: bool) -> Vec<u8 let samples = if eight { craft_jxl::Samples::U8(&u8_buf) } else { craft_jxl::Samples::U16(px) }; let img = craft_jxl::ImageRef { width: w as u32, height: h as u32, layout, samples }; let opts = craft_jxl::EncodeOptions { lossless: true, ..Default::default() }; - craft_jxl::encode(&img, &opts, &craft_jxl::Metadata::default()).unwrap() + craft_jxl::encode(&img, opts, &craft_jxl::Metadata::default()).unwrap() } /// A bare codestream wrapped in the ISO-BMFF container (signature, `ftyp`, `jxlc`). @@ -777,7 +777,7 @@ fn jpeg_xl_tiles_beyond_their_decode_budget_are_errors() { samples: craft_jxl::Samples::U16(&with_alpha), }; let opts = craft_jxl::EncodeOptions { lossless: true, ..Default::default() }; - let tile = craft_jxl::encode(&img, &opts, &craft_jxl::Metadata::default()).unwrap(); + let tile = craft_jxl::encode(&img, opts, &craft_jxl::Metadata::default()).unwrap(); let one = |tile: Vec<u8>| { let mut raw = base_ifd(w, h, 12, 1, true); raw.set(t::COMPRESSION, Value::Short(vec![compression::JPEG_XL])); From cf50ffcb8b41468b1cb926820b224f20252e240a Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" <dylan@dylanmtaylor.com> Date: Sat, 14 Nov 2026 21:32:16 +0000 Subject: [PATCH 03/30] chore: update Cargo.lock --- Cargo.lock | 89 +++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 68 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 04c07b04f1..08d69c3f92 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1266,17 +1266,21 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f4758c01581d79577b9bf5046c06f4e77b1f18#f0f4758c01581d79577b9bf5046c06f4e77b1f18" +source = "git+https://github.com/storytold/craft-libs?rev=d6cd7836d364177661b0ae17f48a0805e83a5f32#d6cd7836d364177661b0ae17f48a0805e83a5f32" dependencies = [ + "avif-serialize", "craft-jpeg", - "craft-metadata", + "craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=d6cd7836d364177661b0ae17f48a0805e83a5f32)", "exr", "flate2", "half", + "hayro-jpeg2000", "image", "image-webp", "jpeg-encoder", "png", + "rav1e", + "ravif", "rayon", "serde_json", "thiserror 2.0.21", @@ -1289,7 +1293,7 @@ dependencies = [ [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f4758c01581d79577b9bf5046c06f4e77b1f18#f0f4758c01581d79577b9bf5046c06f4e77b1f18" +source = "git+https://github.com/storytold/craft-libs?rev=d6cd7836d364177661b0ae17f48a0805e83a5f32#d6cd7836d364177661b0ae17f48a0805e83a5f32" dependencies = [ "thiserror 2.0.21", ] @@ -1297,13 +1301,33 @@ dependencies = [ [[package]] name = "craft-jxl" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b77af389f30bb10de10d8436ca9b39fe94e3bb67#b77af389f30bb10de10d8436ca9b39fe94e3bb67" +source = "git+https://github.com/storytold/craft-libs?rev=d6cd7836d364177661b0ae17f48a0805e83a5f32#d6cd7836d364177661b0ae17f48a0805e83a5f32" dependencies = [ "jixel", "jxl-oxide", "thiserror 2.0.21", ] +[[package]] +name = "craft-media" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=d6cd7836d364177661b0ae17f48a0805e83a5f32#d6cd7836d364177661b0ae17f48a0805e83a5f32" +dependencies = [ + "thiserror 2.0.21", +] + +[[package]] +name = "craft-metadata" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=d6cd7836d364177661b0ae17f48a0805e83a5f32#d6cd7836d364177661b0ae17f48a0805e83a5f32" +dependencies = [ + "brotli-decompressor 6.0.1", + "chrono", + "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=d6cd7836d364177661b0ae17f48a0805e83a5f32)", + "quick-xml 0.41.0", + "serde", +] + [[package]] name = "craft-metadata" version = "0.1.0" @@ -1311,7 +1335,7 @@ source = "git+https://github.com/storytold/craft-libs?rev=f0f4758c01581d79577b9b dependencies = [ "brotli-decompressor 6.0.1", "chrono", - "craft-tiff", + "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=f0f4758c01581d79577b9bf5046c06f4e77b1f18)", "quick-xml 0.41.0", "serde", ] @@ -1334,8 +1358,8 @@ source = "git+https://github.com/storytold/craft-libs?rev=f0f4758c01581d79577b9b dependencies = [ "chrono", "craft-crw", - "craft-metadata", - "craft-tiff", + "craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=f0f4758c01581d79577b9bf5046c06f4e77b1f18)", + "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=f0f4758c01581d79577b9bf5046c06f4e77b1f18)", "jxl-oxide", "miniz_oxide 0.9.1", "rayon", @@ -1345,6 +1369,15 @@ dependencies = [ "zune-jpeg", ] +[[package]] +name = "craft-tiff" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=d6cd7836d364177661b0ae17f48a0805e83a5f32#d6cd7836d364177661b0ae17f48a0805e83a5f32" +dependencies = [ + "serde", + "thiserror 2.0.21", +] + [[package]] name = "craft-tiff" version = "0.1.0" @@ -1402,6 +1435,15 @@ dependencies = [ "zip 9.1.3", ] +[[package]] +name = "craft-video" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=d6cd7836d364177661b0ae17f48a0805e83a5f32#d6cd7836d364177661b0ae17f48a0805e83a5f32" +dependencies = [ + "craft-media", + "thiserror 2.0.21", +] + [[package]] name = "craft-window" version = "0.1.0" @@ -3033,6 +3075,15 @@ dependencies = [ "foldhash 0.2.0", ] +[[package]] +name = "hayro-jpeg2000" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c75ab947623ef4ccaa7acf0579edf7cbb5a73838e3839a7be73335e522f433a1" +dependencies = [ + "fearless_simd", +] + [[package]] name = "heck" version = "0.5.0" @@ -3285,6 +3336,8 @@ dependencies = [ "num-traits", "png", "qoi", + "ravif", + "rgb", "tiff", "zune-core", "zune-jpeg", @@ -3825,7 +3878,6 @@ dependencies = [ name = "lightcraft-codecs" version = "0.21.1" dependencies = [ - "avif-serialize", "bytemuck", "craft-cms", "craft-gainmap", @@ -3834,16 +3886,14 @@ dependencies = [ "craft-image-codecs", "craft-jxl", "craft-psd", - "craft-tiff", + "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=f0f4758c01581d79577b9bf5046c06f4e77b1f18)", + "craft-video", "dhat", - "jxl-oxide", "lightcraft-color", "lightcraft-geom", "lightcraft-raster", "lightcraft-testkit", "proptest", - "rav1e", - "ravif", "rayon", "serde", "thiserror 2.0.21", @@ -3911,11 +3961,11 @@ dependencies = [ "chrono", "craft-docpath", "craft-heif", - "craft-tiff", + "craft-jxl", + "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=f0f4758c01581d79577b9bf5046c06f4e77b1f18)", "crc32fast", "fs4", "harfrust 0.13.3", - "jxl-oxide", "libc", "lightcraft-catalog", "lightcraft-codecs", @@ -4068,9 +4118,9 @@ version = "0.21.1" dependencies = [ "chrono", "craft-heif", - "craft-metadata", + "craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=f0f4758c01581d79577b9bf5046c06f4e77b1f18)", "craft-psd", - "craft-tiff", + "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=f0f4758c01581d79577b9bf5046c06f4e77b1f18)", "lightcraft-geom", "proptest", "serde", @@ -4124,8 +4174,9 @@ version = "0.21.1" dependencies = [ "chrono", "craft-image-codecs", + "craft-jxl", "craft-raw", - "craft-tiff", + "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=f0f4758c01581d79577b9bf5046c06f4e77b1f18)", "dhat", "lightcraft-color", "lightcraft-geom", @@ -4138,8 +4189,6 @@ dependencies = [ "serde", "sha2", "thiserror 2.0.21", - "zune-core", - "zune-jpegxl", ] [[package]] @@ -4337,7 +4386,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519" dependencies = [ "cfg-if", - "rayon", ] [[package]] @@ -5845,7 +5893,6 @@ dependencies = [ "loop9", "quick-error 2.0.1", "rav1e", - "rayon", "rgb", ] From 8784024395900db64b15ae49cb03432d176dd826 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" <dylan@dylanmtaylor.com> Date: Sat, 14 Nov 2026 21:45:11 +0000 Subject: [PATCH 04/30] fix(codecs): use av1 feature and craft_video::av1 exports --- Cargo.toml | 2 +- crates/codecs/src/video.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8001a057a8..13371d8dc2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "d6cd7836d3 # Photo metadata: EXIF, IPTC-IIM, XMP packets and GPX track logs (craft-libs#949) craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" } craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "d6cd7836d364177661b0ae17f48a0805e83a5f32" } -craft-video = { git = "https://github.com/storytold/craft-libs", rev = "d6cd7836d364177661b0ae17f48a0805e83a5f32", features = ["av1-encode"] } +craft-video = { git = "https://github.com/storytold/craft-libs", rev = "d6cd7836d364177661b0ae17f48a0805e83a5f32", features = ["av1"] } craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" } # craft-update: app-specific pretend versions apply to startup and manual checks. craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "6e03f65bf45181db77ba6229716e6624db9eb25b", features = ["egui"] } diff --git a/crates/codecs/src/video.rs b/crates/codecs/src/video.rs index a44a4e37cb..b8657e0074 100644 --- a/crates/codecs/src/video.rs +++ b/crates/codecs/src/video.rs @@ -831,7 +831,7 @@ pub fn quantizer(quality: u8) -> usize { /// the samples as they come out (in order: no frame reordering). pub struct Av1Encoder { #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] - enc: craft_video::av1::encode::Encoder, + enc: craft_video::av1::Encoder, width: usize, height: usize, has_sample: bool, @@ -845,7 +845,7 @@ impl Av1Encoder { } #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] { - use craft_video::av1::encode::{Encoder, EncoderConfig, RateControl}; + use craft_video::av1::{Encoder, EncoderConfig, RateControl}; let _ = c.speed; let mut ec = EncoderConfig::new(w as u32, h as u32, u32::from(c.fps), 1); ec.rate = RateControl::ConstantQ(quantizer(c.quality).clamp(1, 255) as u8); @@ -888,7 +888,7 @@ impl Av1Encoder { let y16: Vec<u16> = y.into_iter().map(u16::from).collect(); let u16_: Vec<u16> = u.into_iter().map(u16::from).collect(); let v16: Vec<u16> = v.into_iter().map(u16::from).collect(); - let frame = craft_video::av1::encode::Frame { y: &y16, u: &u16_, v: &v16, y_stride: self.width, uv_stride: self.width / 2 }; + let frame = craft_video::av1::Frame { y: &y16, u: &u16_, v: &v16, y_stride: self.width, uv_stride: self.width / 2 }; let pkt = self.enc.encode_with_key(&frame, key).map_err(|e| bad(format!("AV1: {e}")))?; self.has_sample = true; Ok(vec![Sample { data: pkt.data, key: pkt.keyframe, duration: periods.max(1) }]) From 176e15eeef815d15322723603c883eba203526f7 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" <dylan@dylanmtaylor.com> Date: Sat, 14 Nov 2026 21:56:22 +0000 Subject: [PATCH 05/30] fix(codecs): clear dead_code and useless_conversion clippy warnings --- crates/codecs/src/encode.rs | 4 ---- crates/codecs/src/video.rs | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/crates/codecs/src/encode.rs b/crates/codecs/src/encode.rs index 4cd1987422..bd15315ed3 100644 --- a/crates/codecs/src/encode.rs +++ b/crates/codecs/src/encode.rs @@ -54,10 +54,6 @@ impl<'a> EncodeImage<'a> { } Ok(()) } - - fn has_alpha(&self) -> bool { - self.channels == 2 || self.channels == 4 - } } /// Metadata to embed. diff --git a/crates/codecs/src/video.rs b/crates/codecs/src/video.rs index b8657e0074..27223d96f3 100644 --- a/crates/codecs/src/video.rs +++ b/crates/codecs/src/video.rs @@ -847,7 +847,7 @@ impl Av1Encoder { { use craft_video::av1::{Encoder, EncoderConfig, RateControl}; let _ = c.speed; - let mut ec = EncoderConfig::new(w as u32, h as u32, u32::from(c.fps), 1); + let mut ec = EncoderConfig::new(w as u32, h as u32, c.fps, 1); ec.rate = RateControl::ConstantQ(quantizer(c.quality).clamp(1, 255) as u8); ec.keyint = 120; let enc = Encoder::new(ec).map_err(|e| bad(format!("AV1: {e}")))?; From fea2efa39c2b8e92fb2346a485e3c5fc6f323acc Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" <dylan@dylanmtaylor.com> Date: Sat, 14 Nov 2026 22:25:33 +0000 Subject: [PATCH 06/30] fix(cutover): use craft-jxl decode limits by value --- crates/codecs/tests/it/roundtrip.rs | 2 +- crates/engine/src/tests/export.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/codecs/tests/it/roundtrip.rs b/crates/codecs/tests/it/roundtrip.rs index 179a9f5882..4fc07aded7 100644 --- a/crates/codecs/tests/it/roundtrip.rs +++ b/crates/codecs/tests/it/roundtrip.rs @@ -916,7 +916,7 @@ fn jxl_hdr_pq() { let o = JxlOptions { lossless, quality: 95, colour: JxlColour::Rec2020Pq, ..Default::default() }; let b = encode_jxl(&EncodeImage::new(w as u32, h as u32, 3, Samples::F32(&px)), &o, &EncodeMeta::default()).unwrap(); // the file's own samples: linear Rec. 2020 (1.0 = 203 cd/m², 4.0 = 812 cd/m²) and PQ CICP - let dec = craft_jxl::decode(&b, &craft_jxl::DecodeLimits::default()).unwrap(); + let dec = craft_jxl::decode(&b, craft_jxl::DecodeLimits::default()).unwrap(); assert_eq!(dec.rendered_cicp, Some([9, 16, 0, 1])); let ch = dec.layout.channels(); let at = |x: usize| dec.pixels[((h / 2) * w + x) * ch + 1]; diff --git a/crates/engine/src/tests/export.rs b/crates/engine/src/tests/export.rs index e80d2588b0..a2719bf010 100644 --- a/crates/engine/src/tests/export.rs +++ b/crates/engine/src/tests/export.rs @@ -1128,7 +1128,7 @@ fn hdr_jxl_export_is_pq_rec2020() { s.execute("develop.hdr", &json!({"enabled": true, "maxEv": 2})).unwrap(); let hdr = export_photo(&mut s, id, &o, 1).unwrap(); let encoding = |b: &[u8]| { - let dec = craft_jxl::decode(b, &craft_jxl::DecodeLimits::default()).unwrap(); + let dec = craft_jxl::decode(b, craft_jxl::DecodeLimits::default()).unwrap(); (dec.rendered_cicp, dec.bit_depth) }; let (cicp, bits) = encoding(&hdr.bytes); From e0dec0533f6822b90cd4a631659998c08d0c4fab Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" <dylan@dylanmtaylor.com> Date: Sat, 14 Nov 2026 22:50:14 +0000 Subject: [PATCH 07/30] test(jxl): assert PQ encoded HDR samples --- crates/codecs/tests/it/roundtrip.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/codecs/tests/it/roundtrip.rs b/crates/codecs/tests/it/roundtrip.rs index 4fc07aded7..cb4c58bdcd 100644 --- a/crates/codecs/tests/it/roundtrip.rs +++ b/crates/codecs/tests/it/roundtrip.rs @@ -909,20 +909,21 @@ fn jxl_alpha_and_gray() { #[test] #[cfg(feature = "jxl")] fn jxl_hdr_pq() { - // linear Rec. 2020, SDR white = 1.0: the left half at SDR white, the right half four times brighter + // linear Rec. 2020 input, with SDR white = 203 cd/m²; samples are encoded as BT.2020 PQ. let (w, h) = (64usize, 32usize); let px: Vec<f32> = (0..w * h).flat_map(|i| [if i % w < w / 2 { 1.0 } else { 4.0 }; 3]).collect(); for lossless in [false, true] { let o = JxlOptions { lossless, quality: 95, colour: JxlColour::Rec2020Pq, ..Default::default() }; let b = encode_jxl(&EncodeImage::new(w as u32, h as u32, 3, Samples::F32(&px)), &o, &EncodeMeta::default()).unwrap(); - // the file's own samples: linear Rec. 2020 (1.0 = 203 cd/m², 4.0 = 812 cd/m²) and PQ CICP + // DecoderDefault keeps the file's PQ transfer encoding, so compare against the PQ codes + // for 203 and 812 cd/m² rather than linear-light input values. let dec = craft_jxl::decode(&b, craft_jxl::DecodeLimits::default()).unwrap(); assert_eq!(dec.rendered_cicp, Some([9, 16, 0, 1])); let ch = dec.layout.channels(); let at = |x: usize| dec.pixels[((h / 2) * w + x) * ch + 1]; - for (x, want) in [(w / 4, 1.0f32), (w * 3 / 4, 4.0f32)] { + for (x, want) in [(w / 4, 0.5807f32), (w * 3 / 4, 0.7292f32)] { let got = at(x); - assert!((got - want).abs() < 0.05, "lossless={lossless}: linear value {got}, want {want}"); + assert!((got - want).abs() < 0.01, "lossless={lossless}: PQ code {got}, want {want}"); } } // float samples are HDR only From 54a6ddd8569977433430fcafd93ec3767705f214 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" <dylan@dylanmtaylor.com> Date: Sat, 14 Nov 2026 23:41:03 +0000 Subject: [PATCH 08/30] test(raw): encode single-plane JPEG XL fixtures as gray --- crates/raw/Cargo.toml | 1 + crates/raw/tests/it/dng.rs | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/crates/raw/Cargo.toml b/crates/raw/Cargo.toml index da19aa1096..078d76eb97 100644 --- a/crates/raw/Cargo.toml +++ b/crates/raw/Cargo.toml @@ -27,6 +27,7 @@ craft-image-codecs = { workspace = true } lightcraft-testkit = { workspace = true } proptest = { workspace = true } craft-jxl = { workspace = true } +jixel = { workspace = true } # Pinned CC0 corpus identities; not a product dependency. sha2 = { version = "0.10", default-features = false, features = ["std"] } # Peak-heap regression tests (tests/sr2_heap.rs); not a product dependency. diff --git a/crates/raw/tests/it/dng.rs b/crates/raw/tests/it/dng.rs index c9d0c99726..08020fb4da 100644 --- a/crates/raw/tests/it/dng.rs +++ b/crates/raw/tests/it/dng.rs @@ -631,7 +631,18 @@ fn malformed_profile_look_tags_are_ignored() { /// Lossless JPEG XL codestream of `px` (`w × h × cpp` interleaved), 16-bit unless `eight`. fn jxl_encode(px: &[u16], w: usize, h: usize, cpp: usize, eight: bool) -> Vec<u8> { - let layout = if cpp == 1 { craft_jxl::Layout::Gray } else { craft_jxl::Layout::Rgb }; + if cpp == 1 { + // craft-jxl's public image encoder deliberately widens Gray to RGB. DNG RAW tiles need + // a genuine single-plane codestream, so use jixel's grayscale encoder for these fixtures. + let config = jixel::EncodeConfig::default().with_lossless(true); + let u8_buf: Vec<u8> = if eight { px.iter().map(|&v| v as u8).collect() } else { Vec::new() }; + return if eight { + jixel::encode_image_gray(&u8_buf, w, h, &config).unwrap() + } else { + jixel::encode_image_gray_16bit(px, w, h, &config).unwrap() + }; + } + let layout = craft_jxl::Layout::Rgb; let u8_buf: Vec<u8> = if eight { px.iter().map(|&v| v as u8).collect() } else { Vec::new() }; let samples = if eight { craft_jxl::Samples::U8(&u8_buf) } else { craft_jxl::Samples::U16(px) }; let img = craft_jxl::ImageRef { width: w as u32, height: h as u32, layout, samples }; From 994fb5a241ef5c4404199ee69da54494676fd218 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" <dylan@dylanmtaylor.com> Date: Sat, 14 Nov 2026 23:43:26 +0000 Subject: [PATCH 09/30] chore: expose jixel for raw fixture tests --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index 13371d8dc2..01239cf5b4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,6 +17,7 @@ craft-crw = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01 craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" } craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "b77af389f30bb10de10d8436ca9b39fe94e3bb67", features = ["frames"] } craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "d6cd7836d364177661b0ae17f48a0805e83a5f32", default-features = false, features = ["decode", "encode"] } +jixel = "=0.3.4" # Photo metadata: EXIF, IPTC-IIM, XMP packets and GPX track logs (craft-libs#949) craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" } craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "d6cd7836d364177661b0ae17f48a0805e83a5f32" } From e4411b2ea1e17c0ec0c888ce3fea3555937f1d55 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" <dylan@dylanmtaylor.com> Date: Sat, 14 Nov 2026 23:46:35 +0000 Subject: [PATCH 10/30] chore: sync raw JPEG XL test dependency lock --- Cargo.lock | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.lock b/Cargo.lock index 08d69c3f92..bc4116ce61 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4178,6 +4178,7 @@ dependencies = [ "craft-raw", "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=f0f4758c01581d79577b9bf5046c06f4e77b1f18)", "dhat", + "jixel", "lightcraft-color", "lightcraft-geom", "lightcraft-meta", From 2d13d97c6bf0da45d1dfd41fa15b2e15ff46c51f Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" <dylan@dylanmtaylor.com> Date: Sun, 15 Nov 2026 00:06:33 +0000 Subject: [PATCH 11/30] fix(codecs): retain large AV1 frame support --- Cargo.lock | 3 ++- Cargo.toml | 2 +- crates/codecs/src/video.rs | 30 ++++++++++++++++++++++++++---- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bc4116ce61..c857cd6966 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1438,9 +1438,10 @@ dependencies = [ [[package]] name = "craft-video" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d6cd7836d364177661b0ae17f48a0805e83a5f32#d6cd7836d364177661b0ae17f48a0805e83a5f32" +source = "git+https://github.com/storytold/craft-libs?rev=045d3865126d3408503c54fea71b08f33262fddf#045d3865126d3408503c54fea71b08f33262fddf" dependencies = [ "craft-media", + "rav1e", "thiserror 2.0.21", ] diff --git a/Cargo.toml b/Cargo.toml index 01239cf5b4..49e4b26bb9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ jixel = "=0.3.4" # Photo metadata: EXIF, IPTC-IIM, XMP packets and GPX track logs (craft-libs#949) craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" } craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "d6cd7836d364177661b0ae17f48a0805e83a5f32" } -craft-video = { git = "https://github.com/storytold/craft-libs", rev = "d6cd7836d364177661b0ae17f48a0805e83a5f32", features = ["av1"] } +craft-video = { git = "https://github.com/storytold/craft-libs", rev = "045d3865126d3408503c54fea71b08f33262fddf", features = ["av1", "av1-large-encode"] } craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" } # craft-update: app-specific pretend versions apply to startup and manual checks. craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "6e03f65bf45181db77ba6229716e6624db9eb25b", features = ["egui"] } diff --git a/crates/codecs/src/video.rs b/crates/codecs/src/video.rs index 27223d96f3..17459f3417 100644 --- a/crates/codecs/src/video.rs +++ b/crates/codecs/src/video.rs @@ -831,12 +831,18 @@ pub fn quantizer(quality: u8) -> usize { /// the samples as they come out (in order: no frame reordering). pub struct Av1Encoder { #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] - enc: craft_video::av1::Encoder, + enc: Av1Backend, width: usize, height: usize, has_sample: bool, } +#[cfg(all(feature = "avif", not(target_arch = "wasm32")))] +enum Av1Backend { + Single(craft_video::av1::Encoder), + Tiled(craft_video::av1::LargeEncoder), +} + impl Av1Encoder { pub fn new(c: &VideoConfig) -> Result<Self> { let (w, h) = ((c.width & !1) as usize, (c.height & !1) as usize); @@ -850,7 +856,13 @@ impl Av1Encoder { let mut ec = EncoderConfig::new(w as u32, h as u32, c.fps, 1); ec.rate = RateControl::ConstantQ(quantizer(c.quality).clamp(1, 255) as u8); ec.keyint = 120; - let enc = Encoder::new(ec).map_err(|e| bad(format!("AV1: {e}")))?; + let sb_cols = w.div_ceil(64); + let sb_rows = h.div_ceil(64); + let enc = if w > 4096 || h > 4096 || sb_cols * sb_rows > 2304 { + Av1Backend::Tiled(craft_video::av1::LargeEncoder::new(&ec).map_err(|e| bad(format!("AV1: {e}")))?) + } else { + Av1Backend::Single(Encoder::new(ec).map_err(|e| bad(format!("AV1: {e}")))?) + }; Ok(Av1Encoder { enc, width: w, height: h, has_sample: false }) } #[cfg(not(all(feature = "avif", not(target_arch = "wasm32"))))] @@ -869,7 +881,13 @@ impl Av1Encoder { pub fn config_record(&self) -> Option<Vec<u8>> { #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] { - self.has_sample.then(|| self.enc.av1c()) + if !self.has_sample { + return None; + } + match &self.enc { + Av1Backend::Single(enc) => Some(enc.av1c()), + Av1Backend::Tiled(enc) => enc.av1c(), + } } #[cfg(not(all(feature = "avif", not(target_arch = "wasm32"))))] { @@ -889,7 +907,11 @@ impl Av1Encoder { let u16_: Vec<u16> = u.into_iter().map(u16::from).collect(); let v16: Vec<u16> = v.into_iter().map(u16::from).collect(); let frame = craft_video::av1::Frame { y: &y16, u: &u16_, v: &v16, y_stride: self.width, uv_stride: self.width / 2 }; - let pkt = self.enc.encode_with_key(&frame, key).map_err(|e| bad(format!("AV1: {e}")))?; + let pkt = match &mut self.enc { + Av1Backend::Single(enc) => enc.encode_with_key(&frame, key), + Av1Backend::Tiled(enc) => enc.encode_with_key(&frame, key), + } + .map_err(|e| bad(format!("AV1: {e}")))?; self.has_sample = true; Ok(vec![Sample { data: pkt.data, key: pkt.keyframe, duration: periods.max(1) }]) } From 11e31c2521dc8044f61bb8e4578e8943a925e3cb Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" <dylan@dylanmtaylor.com> Date: Sun, 15 Nov 2026 00:07:26 +0000 Subject: [PATCH 12/30] fix(codecs): preserve AV1 speed for large frames --- Cargo.lock | 2 +- Cargo.toml | 2 +- crates/codecs/src/video.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c857cd6966..38fbbaa3f2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1438,7 +1438,7 @@ dependencies = [ [[package]] name = "craft-video" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=045d3865126d3408503c54fea71b08f33262fddf#045d3865126d3408503c54fea71b08f33262fddf" +source = "git+https://github.com/storytold/craft-libs?rev=662e906ef592411f20fa9ff04d218ee1e5f094ad#662e906ef592411f20fa9ff04d218ee1e5f094ad" dependencies = [ "craft-media", "rav1e", diff --git a/Cargo.toml b/Cargo.toml index 49e4b26bb9..d4774a9af7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ jixel = "=0.3.4" # Photo metadata: EXIF, IPTC-IIM, XMP packets and GPX track logs (craft-libs#949) craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" } craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "d6cd7836d364177661b0ae17f48a0805e83a5f32" } -craft-video = { git = "https://github.com/storytold/craft-libs", rev = "045d3865126d3408503c54fea71b08f33262fddf", features = ["av1", "av1-large-encode"] } +craft-video = { git = "https://github.com/storytold/craft-libs", rev = "662e906ef592411f20fa9ff04d218ee1e5f094ad", features = ["av1", "av1-large-encode"] } craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" } # craft-update: app-specific pretend versions apply to startup and manual checks. craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "6e03f65bf45181db77ba6229716e6624db9eb25b", features = ["egui"] } diff --git a/crates/codecs/src/video.rs b/crates/codecs/src/video.rs index 17459f3417..73681c2749 100644 --- a/crates/codecs/src/video.rs +++ b/crates/codecs/src/video.rs @@ -859,7 +859,7 @@ impl Av1Encoder { let sb_cols = w.div_ceil(64); let sb_rows = h.div_ceil(64); let enc = if w > 4096 || h > 4096 || sb_cols * sb_rows > 2304 { - Av1Backend::Tiled(craft_video::av1::LargeEncoder::new(&ec).map_err(|e| bad(format!("AV1: {e}")))?) + Av1Backend::Tiled(craft_video::av1::LargeEncoder::with_speed(&ec, c.speed).map_err(|e| bad(format!("AV1: {e}")))?) } else { Av1Backend::Single(Encoder::new(ec).map_err(|e| bad(format!("AV1: {e}")))?) }; From ef1808ccb5cb5e10c70effbf404d66f9667126e3 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" <dylan@dylanmtaylor.com> Date: Sun, 15 Nov 2026 00:12:01 +0000 Subject: [PATCH 13/30] fix(deps): pin published craft-video revision --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 38fbbaa3f2..8bbceae5ba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1438,7 +1438,7 @@ dependencies = [ [[package]] name = "craft-video" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=662e906ef592411f20fa9ff04d218ee1e5f094ad#662e906ef592411f20fa9ff04d218ee1e5f094ad" +source = "git+https://github.com/storytold/craft-libs?rev=662e906ef928655031c1f021a01da4979f6a3a35#662e906ef928655031c1f021a01da4979f6a3a35" dependencies = [ "craft-media", "rav1e", diff --git a/Cargo.toml b/Cargo.toml index d4774a9af7..2700be9cfc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ jixel = "=0.3.4" # Photo metadata: EXIF, IPTC-IIM, XMP packets and GPX track logs (craft-libs#949) craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" } craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "d6cd7836d364177661b0ae17f48a0805e83a5f32" } -craft-video = { git = "https://github.com/storytold/craft-libs", rev = "662e906ef592411f20fa9ff04d218ee1e5f094ad", features = ["av1", "av1-large-encode"] } +craft-video = { git = "https://github.com/storytold/craft-libs", rev = "662e906ef928655031c1f021a01da4979f6a3a35", features = ["av1", "av1-large-encode"] } craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" } # craft-update: app-specific pretend versions apply to startup and manual checks. craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "6e03f65bf45181db77ba6229716e6624db9eb25b", features = ["egui"] } From d264e6f05e1f8af12336c044df879e9f700f398e Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" <dylan@dylanmtaylor.com> Date: Sun, 15 Nov 2026 00:14:13 +0000 Subject: [PATCH 14/30] fix(deps): sync craft-video media lock revision --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 8bbceae5ba..f6f847165c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1311,7 +1311,7 @@ dependencies = [ [[package]] name = "craft-media" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d6cd7836d364177661b0ae17f48a0805e83a5f32#d6cd7836d364177661b0ae17f48a0805e83a5f32" +source = "git+https://github.com/storytold/craft-libs?rev=662e906ef928655031c1f021a01da4979f6a3a35#662e906ef928655031c1f021a01da4979f6a3a35" dependencies = [ "thiserror 2.0.21", ] From c0d3596e27b1e8e5f13ddd9f3954e0083b5c3a8e Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" <dylan@dylanmtaylor.com> Date: Sun, 15 Nov 2026 00:15:22 +0000 Subject: [PATCH 15/30] chore(codecs): drop obsolete AV1 speed binding --- crates/codecs/src/video.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/codecs/src/video.rs b/crates/codecs/src/video.rs index 73681c2749..f1db073b8a 100644 --- a/crates/codecs/src/video.rs +++ b/crates/codecs/src/video.rs @@ -852,7 +852,6 @@ impl Av1Encoder { #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] { use craft_video::av1::{Encoder, EncoderConfig, RateControl}; - let _ = c.speed; let mut ec = EncoderConfig::new(w as u32, h as u32, c.fps, 1); ec.rate = RateControl::ConstantQ(quantizer(c.quality).clamp(1, 255) as u8); ec.keyint = 120; From f8edf825851466585e3a38bee803c5284c92c74a Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" <dylan@dylanmtaylor.com> Date: Sun, 15 Nov 2026 00:20:50 +0000 Subject: [PATCH 16/30] fix: box large AV1 encoder backend --- crates/codecs/src/video.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/codecs/src/video.rs b/crates/codecs/src/video.rs index f1db073b8a..ab5b0c0e47 100644 --- a/crates/codecs/src/video.rs +++ b/crates/codecs/src/video.rs @@ -840,7 +840,7 @@ pub struct Av1Encoder { #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] enum Av1Backend { Single(craft_video::av1::Encoder), - Tiled(craft_video::av1::LargeEncoder), + Tiled(Box<craft_video::av1::LargeEncoder>), } impl Av1Encoder { @@ -858,7 +858,7 @@ impl Av1Encoder { let sb_cols = w.div_ceil(64); let sb_rows = h.div_ceil(64); let enc = if w > 4096 || h > 4096 || sb_cols * sb_rows > 2304 { - Av1Backend::Tiled(craft_video::av1::LargeEncoder::with_speed(&ec, c.speed).map_err(|e| bad(format!("AV1: {e}")))?) + Av1Backend::Tiled(Box::new(craft_video::av1::LargeEncoder::with_speed(&ec, c.speed).map_err(|e| bad(format!("AV1: {e}")))?)) } else { Av1Backend::Single(Encoder::new(ec).map_err(|e| bad(format!("AV1: {e}")))?) }; From 7197597e13fb3cee9c65d87fd31bfeafd8c9d430 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" <dylan@dylanmtaylor.com> Date: Sun, 15 Nov 2026 00:25:09 +0000 Subject: [PATCH 17/30] fix: box single AV1 encoder backend --- crates/codecs/src/video.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/codecs/src/video.rs b/crates/codecs/src/video.rs index ab5b0c0e47..1dade788a5 100644 --- a/crates/codecs/src/video.rs +++ b/crates/codecs/src/video.rs @@ -839,7 +839,7 @@ pub struct Av1Encoder { #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] enum Av1Backend { - Single(craft_video::av1::Encoder), + Single(Box<craft_video::av1::Encoder>), Tiled(Box<craft_video::av1::LargeEncoder>), } @@ -860,7 +860,7 @@ impl Av1Encoder { let enc = if w > 4096 || h > 4096 || sb_cols * sb_rows > 2304 { Av1Backend::Tiled(Box::new(craft_video::av1::LargeEncoder::with_speed(&ec, c.speed).map_err(|e| bad(format!("AV1: {e}")))?)) } else { - Av1Backend::Single(Encoder::new(ec).map_err(|e| bad(format!("AV1: {e}")))?) + Av1Backend::Single(Box::new(Encoder::new(ec).map_err(|e| bad(format!("AV1: {e}")))?)) }; Ok(Av1Encoder { enc, width: w, height: h, has_sample: false }) } From b757d74a31c2b7d11107f62fc9c8fc3add2959d6 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" <dylan@dylanmtaylor.com> Date: Sun, 15 Nov 2026 01:36:18 +0000 Subject: [PATCH 18/30] test(raw): keep DNG JXL tile fixtures single-layer --- crates/raw/tests/it/dng.rs | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/crates/raw/tests/it/dng.rs b/crates/raw/tests/it/dng.rs index 08020fb4da..0f317af3b3 100644 --- a/crates/raw/tests/it/dng.rs +++ b/crates/raw/tests/it/dng.rs @@ -650,6 +650,30 @@ fn jxl_encode(px: &[u16], w: usize, h: usize, cpp: usize, eight: bool) -> Vec<u8 craft_jxl::encode(&img, opts, &craft_jxl::Metadata::default()).unwrap() } +/// The encoder may return an ISO-BMFF container for a level-10 codestream. Extract its `jxlc` +/// payload so the tile fixture can deliberately exercise the bare-codestream form too. +fn bare_jxl_codestream(bytes: &[u8]) -> Vec<u8> { + const SIGNATURE: &[u8] = &[0, 0, 0, 0x0c, b'J', b'X', b'L', b' ', 0x0d, 0x0a, 0x87, 0x0a]; + if !bytes.starts_with(SIGNATURE) { + return bytes.to_vec(); + } + let mut at = SIGNATURE.len(); + while let Some(end_header) = at.checked_add(8) { + let Some(header) = bytes.get(at..end_header) else { break }; + let size = u32::from_be_bytes([header[0], header[1], header[2], header[3]]) as usize; + if size < 8 { + break; + } + let Some(end) = at.checked_add(size) else { break }; + let Some(box_bytes) = bytes.get(at..end) else { break }; + if &header[4..8] == b"jxlc" { + return box_bytes[8..].to_vec(); + } + at = end; + } + panic!("the JPEG XL encoder returned a container without a complete jxlc box"); +} + /// A bare codestream wrapped in the ISO-BMFF container (signature, `ftyp`, `jxlc`). fn jxl_container(cs: &[u8]) -> Vec<u8> { let mut b = vec![0, 0, 0, 0x0c, b'J', b'X', b'L', b' ', 0x0d, 0x0a, 0x87, 0x0a, 0, 0, 0, 0x14]; @@ -679,7 +703,7 @@ fn jxl_tiled(px: &[u16], w: usize, h: usize, cpp: usize, bits: u16, cfa: bool, t } } } - let cs = jxl_encode(&t, cw, ch, cpp, bits == 8); + let cs = bare_jxl_codestream(&jxl_encode(&t, cw, ch, cpp, bits == 8)); tiles.push(if i % 3 == 1 { jxl_container(&cs) } else { cs }); } } From 3dfb134574dd71da88e5b759968335c2bf6b954d Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" <dylan@dylanmtaylor.com> Date: Sun, 15 Nov 2026 02:46:50 +0000 Subject: [PATCH 19/30] fix(codecs): keep AVIF fallback wasm compatible --- crates/codecs/src/encode.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/codecs/src/encode.rs b/crates/codecs/src/encode.rs index bd15315ed3..ab7c6fd2e7 100644 --- a/crates/codecs/src/encode.rs +++ b/crates/codecs/src/encode.rs @@ -343,7 +343,7 @@ pub fn encode_avif(img: &EncodeImage, quality: u8, speed: u8, meta: &EncodeMeta) } #[cfg(not(all(feature = "avif", not(target_arch = "wasm32"))))] { - let _ = (quality, speed, meta, img.has_alpha()); + let _ = (quality, speed, meta); Err(Error::Encode("AVIF encoding is not available in this build".into())) } } From 34411fecb91cd03335b6b78b61740a5d5fb0da40 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" <dylan@dylanmtaylor.com> Date: Sun, 15 Nov 2026 11:30:02 +0000 Subject: [PATCH 20/30] Preserve buffered AV1 frames and durations --- crates/codecs/src/video.rs | 112 ++++++++++++++++++++++++++----------- 1 file changed, 78 insertions(+), 34 deletions(-) diff --git a/crates/codecs/src/video.rs b/crates/codecs/src/video.rs index 1dade788a5..6a8e3c6f8a 100644 --- a/crates/codecs/src/video.rs +++ b/crates/codecs/src/video.rs @@ -831,16 +831,15 @@ pub fn quantizer(quality: u8) -> usize { /// the samples as they come out (in order: no frame reordering). pub struct Av1Encoder { #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] - enc: Av1Backend, + enc: craft_video::av1::LargeEncoder, + #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] + durations: Vec<u64>, + #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] + returned: usize, + #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] + failed: bool, width: usize, height: usize, - has_sample: bool, -} - -#[cfg(all(feature = "avif", not(target_arch = "wasm32")))] -enum Av1Backend { - Single(Box<craft_video::av1::Encoder>), - Tiled(Box<craft_video::av1::LargeEncoder>), } impl Av1Encoder { @@ -851,18 +850,12 @@ impl Av1Encoder { } #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] { - use craft_video::av1::{Encoder, EncoderConfig, RateControl}; + use craft_video::av1::{EncoderConfig, RateControl}; let mut ec = EncoderConfig::new(w as u32, h as u32, c.fps, 1); ec.rate = RateControl::ConstantQ(quantizer(c.quality).clamp(1, 255) as u8); ec.keyint = 120; - let sb_cols = w.div_ceil(64); - let sb_rows = h.div_ceil(64); - let enc = if w > 4096 || h > 4096 || sb_cols * sb_rows > 2304 { - Av1Backend::Tiled(Box::new(craft_video::av1::LargeEncoder::with_speed(&ec, c.speed).map_err(|e| bad(format!("AV1: {e}")))?)) - } else { - Av1Backend::Single(Box::new(Encoder::new(ec).map_err(|e| bad(format!("AV1: {e}")))?)) - }; - Ok(Av1Encoder { enc, width: w, height: h, has_sample: false }) + let enc = craft_video::av1::LargeEncoder::with_speed(&ec, c.speed).map_err(|e| bad(format!("AV1: {e}")))?; + Ok(Av1Encoder { enc, durations: Vec::new(), returned: 0, failed: false, width: w, height: h }) } #[cfg(not(all(feature = "avif", not(target_arch = "wasm32"))))] { @@ -880,17 +873,10 @@ impl Av1Encoder { pub fn config_record(&self) -> Option<Vec<u8>> { #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] { - if !self.has_sample { - return None; - } - match &self.enc { - Av1Backend::Single(enc) => Some(enc.av1c()), - Av1Backend::Tiled(enc) => enc.av1c(), - } + self.enc.av1c() } #[cfg(not(all(feature = "avif", not(target_arch = "wasm32"))))] { - let _ = self.has_sample; None } } @@ -902,17 +888,19 @@ impl Av1Encoder { let (y, u, v) = yuv420(rgba, self.width, self.height)?; #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] { + if self.failed { + return Err(bad("AV1 encoder failed earlier")); + } let y16: Vec<u16> = y.into_iter().map(u16::from).collect(); let u16_: Vec<u16> = u.into_iter().map(u16::from).collect(); let v16: Vec<u16> = v.into_iter().map(u16::from).collect(); let frame = craft_video::av1::Frame { y: &y16, u: &u16_, v: &v16, y_stride: self.width, uv_stride: self.width / 2 }; - let pkt = match &mut self.enc { - Av1Backend::Single(enc) => enc.encode_with_key(&frame, key), - Av1Backend::Tiled(enc) => enc.encode_with_key(&frame, key), - } - .map_err(|e| bad(format!("AV1: {e}")))?; - self.has_sample = true; - Ok(vec![Sample { data: pkt.data, key: pkt.keyframe, duration: periods.max(1) }]) + self.durations.push(periods.max(1)); + let packets = self.enc.push(&frame, key).map_err(|e| { + self.failed = true; + bad(format!("AV1: {e}")) + })?; + self.samples(packets) } #[cfg(not(all(feature = "avif", not(target_arch = "wasm32"))))] { @@ -925,11 +913,39 @@ impl Av1Encoder { pub fn finish(&mut self) -> Result<Vec<Sample>> { #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] { - Ok(Vec::new()) + if self.failed { + return Err(bad("AV1 encoder failed earlier")); + } + let packets = self.enc.finish().map_err(|e| { + self.failed = true; + bad(format!("AV1: {e}")) + })?; + let samples = self.samples(packets)?; + if self.returned != self.durations.len() { + self.failed = true; + return Err(bad("AV1 encoder did not return every input frame")); + } + Ok(samples) } #[cfg(not(all(feature = "avif", not(target_arch = "wasm32"))))] Err(bad("AV1 video encoding is not available in this build")) } + + #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] + fn samples(&mut self, packets: Vec<craft_video::av1::BufferedPacket>) -> Result<Vec<Sample>> { + let mut samples = Vec::with_capacity(packets.len()); + for packet in packets { + let index = usize::try_from(packet.input_frame_number).ok(); + let duration = index.filter(|&i| i == self.returned).and_then(|i| self.durations.get(i)).copied(); + let Some(duration) = duration else { + self.failed = true; + return Err(bad("AV1 encoder returned an unknown or out-of-order frame")); + }; + self.returned += 1; + samples.push(Sample { data: packet.packet.data, key: packet.packet.keyframe, duration }); + } + Ok(samples) + } } #[cfg(test)] @@ -1122,7 +1138,8 @@ mod tests { out.extend(e.finish().unwrap()); assert_eq!(out.len(), 4, "one sample per frame sent"); assert!(out[0].key); - assert_eq!(out.iter().map(|s| s.duration).sum::<u64>(), 56); + assert!(out[3].key, "requested key frame"); + assert_eq!(out.iter().map(|s| s.duration).collect::<Vec<_>>(), [24, 1, 1, 30]); for s in &out { assert!(obus(&s.data).unwrap().iter().all(|(k, _)| *k != OBU_TEMPORAL_DELIMITER)); } @@ -1136,4 +1153,31 @@ mod tests { let d = m.finish().unwrap().into_inner(); assert_eq!(boxes(&d, 0..d.len()).len(), 3); } + + #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] + #[test] + fn av1_buffers_a_large_frame_and_preserves_its_duration() { + let c = VideoConfig { width: 4112, height: 16, fps: 30, quality: 60, speed: 10 }; + let mut encoder = Av1Encoder::new(&c).unwrap(); + let mut samples = encoder.push(&vec![[80, 120, 180, 255]; 4112 * 16], 7, true).unwrap(); + samples.extend(encoder.finish().unwrap()); + assert_eq!(samples.len(), 1); + assert_eq!(samples[0].duration, 7); + assert!(samples[0].key); + assert!(encoder.config_record().is_some()); + } + + #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] + #[test] + fn av1_speed_affects_normal_sized_frames() { + let image: Vec<[u8; 4]> = (0..64 * 48).map(|i| [(i * 13) as u8, (i * 41) as u8, (i * 73) as u8, 255]).collect(); + let encode = |speed| { + let c = VideoConfig { width: 64, height: 48, fps: 24, quality: 60, speed }; + let mut encoder = Av1Encoder::new(&c).unwrap(); + let mut samples = encoder.push(&image, 1, true).unwrap(); + samples.extend(encoder.finish().unwrap()); + samples.remove(0).data + }; + assert_ne!(encode(1), encode(10), "AV1 speed must reach the shared encoder"); + } } From cc2b38145dbc70a7028637d203c58f46a97b917e Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Sun, 15 Nov 2026 15:29:09 +0100 Subject: [PATCH 21/30] codecs: keep EXIF, alpha quality and HLG levels in AVIF exports The craft-image-codecs revision this cutover pinned dropped EXIF from SDR AVIF (the ravif path wrote it), ignored the alpha quality, and mapped HLG with a plain OETF that put SDR white at 0.5 instead of BT.2408's 0.75. Pin the merge of craft-libs#1448, which fixes all three, and test that 8- and 16-bit AVIF exports keep their EXIF. --- Cargo.lock | 13 +++++++------ Cargo.toml | 3 ++- crates/codecs/tests/it/roundtrip.rs | 18 ++++++++++++++++++ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f6f847165c..f1724eec04 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1266,11 +1266,12 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d6cd7836d364177661b0ae17f48a0805e83a5f32#d6cd7836d364177661b0ae17f48a0805e83a5f32" +source = "git+https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f#478c50560d3c6fad3d613af2a30b35c3bc9f4c0f" dependencies = [ "avif-serialize", "craft-jpeg", - "craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=d6cd7836d364177661b0ae17f48a0805e83a5f32)", + "craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f)", + "crc32fast", "exr", "flate2", "half", @@ -1293,7 +1294,7 @@ dependencies = [ [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d6cd7836d364177661b0ae17f48a0805e83a5f32#d6cd7836d364177661b0ae17f48a0805e83a5f32" +source = "git+https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f#478c50560d3c6fad3d613af2a30b35c3bc9f4c0f" dependencies = [ "thiserror 2.0.21", ] @@ -1319,11 +1320,11 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d6cd7836d364177661b0ae17f48a0805e83a5f32#d6cd7836d364177661b0ae17f48a0805e83a5f32" +source = "git+https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f#478c50560d3c6fad3d613af2a30b35c3bc9f4c0f" dependencies = [ "brotli-decompressor 6.0.1", "chrono", - "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=d6cd7836d364177661b0ae17f48a0805e83a5f32)", + "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f)", "quick-xml 0.41.0", "serde", ] @@ -1372,7 +1373,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d6cd7836d364177661b0ae17f48a0805e83a5f32#d6cd7836d364177661b0ae17f48a0805e83a5f32" +source = "git+https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f#478c50560d3c6fad3d613af2a30b35c3bc9f4c0f" dependencies = [ "serde", "thiserror 2.0.21", diff --git a/Cargo.toml b/Cargo.toml index 2700be9cfc..9b0e42b8ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,8 @@ craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "d6cd7836d3 jixel = "=0.3.4" # Photo metadata: EXIF, IPTC-IIM, XMP packets and GPX track logs (craft-libs#949) craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" } -craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "d6cd7836d364177661b0ae17f48a0805e83a5f32" } +# AVIF EXIF, alpha quality and BT.2408 HLG levels (craft-libs#1448). +craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "478c50560d3c6fad3d613af2a30b35c3bc9f4c0f" } craft-video = { git = "https://github.com/storytold/craft-libs", rev = "662e906ef928655031c1f021a01da4979f6a3a35", features = ["av1", "av1-large-encode"] } craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" } # craft-update: app-specific pretend versions apply to startup and manual checks. diff --git a/crates/codecs/tests/it/roundtrip.rs b/crates/codecs/tests/it/roundtrip.rs index cb4c58bdcd..f841a07d77 100644 --- a/crates/codecs/tests/it/roundtrip.rs +++ b/crates/codecs/tests/it/roundtrip.rs @@ -617,6 +617,24 @@ fn avif_encode_native() { } } +#[test] +fn avif_keeps_exif() { + // The ravif path wrote EXIF; the shared encoder must keep it, for 8- and 16-bit input. + let img = smooth(16, 12); + let exif = minimal_exif(3); + let meta = EncodeMeta { exif: Some(&exif), ..Default::default() }; + let wide: Vec<u16> = img.data.iter().flat_map(|p| p.map(|c| u16::from(c) * 257)).collect(); + for image in [EncodeImage::rgba8(&img), EncodeImage::new(16, 12, 4, Samples::U16(&wide))] { + let r = encode_avif(&image, 70, 10, &meta); + if cfg!(feature = "avif") { + let b = r.unwrap(); + assert!(b.windows(exif.len()).any(|w| w == &exif[..]), "EXIF missing from the AVIF"); + } else { + assert!(r.is_err()); + } + } +} + #[test] fn raw_routing() { let mut b = b"II*\0\x08\0\0\0".to_vec(); From e785d9ccb5c1de48fd1005b0e480bde8546335fd Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Sun, 15 Nov 2026 15:37:02 +0100 Subject: [PATCH 22/30] codecs: share the craft-image-codecs image conversion of the PNG, TIFF and AVIF writers The AVIF cutover added a third copy of the channel-layout and sample match (Sonar: 8.8% duplication on new code). One helper builds the image; each writer keeps its own float refusal message. --- crates/codecs/src/encode.rs | 51 +++++++++++++------------------------ 1 file changed, 17 insertions(+), 34 deletions(-) diff --git a/crates/codecs/src/encode.rs b/crates/codecs/src/encode.rs index ab7c6fd2e7..666a63e7be 100644 --- a/crates/codecs/src/encode.rs +++ b/crates/codecs/src/encode.rs @@ -174,9 +174,9 @@ pub fn encode_jpeg(img: &EncodeImage, quality: u8, subsampling: ChromaSubsamplin Ok(out) } -/// Encode PNG (8- or 16-bit; float input is rejected — quantize first). -pub fn encode_png(img: &EncodeImage, meta: &EncodeMeta) -> Result<Vec<u8>> { - img.validate()?; +/// `img` (already validated) as a `craft-image-codecs` image. `refuse_float` is the error for +/// 32-bit float samples, for a format that cannot hold them; `None` converts them too. +fn shared_image(img: &EncodeImage, refuse_float: Option<&str>) -> Result<craft_image_codecs::Image> { let n = img.width as usize * img.height as usize * img.channels as usize; let layout = match img.channels { 1 => craft_image_codecs::ChannelLayout::Gray, @@ -184,12 +184,19 @@ pub fn encode_png(img: &EncodeImage, meta: &EncodeMeta) -> Result<Vec<u8>> { 3 => craft_image_codecs::ChannelLayout::Rgb, _ => craft_image_codecs::ChannelLayout::Rgba, }; - let mut ic_img = match img.samples { - Samples::U8(s) => craft_image_codecs::Image::from_u8(img.width, img.height, layout, s[..n].to_vec()), - Samples::U16(s) => craft_image_codecs::Image::from_u16(img.width, img.height, layout, &s[..n]), - Samples::F32(_) => return Err(Error::Encode("PNG needs 8- or 16-bit samples".into())), + match (img.samples, refuse_float) { + (Samples::U8(s), _) => craft_image_codecs::Image::from_u8(img.width, img.height, layout, s[..n].to_vec()), + (Samples::U16(s), _) => craft_image_codecs::Image::from_u16(img.width, img.height, layout, &s[..n]), + (Samples::F32(_), Some(refusal)) => return Err(Error::Encode(refusal.into())), + (Samples::F32(s), None) => craft_image_codecs::Image::from_f32(img.width, img.height, layout, &s[..n]), } - .map_err(|e| Error::Encode(e.to_string()))?; + .map_err(|e| Error::Encode(e.to_string())) +} + +/// Encode PNG (8- or 16-bit; float input is rejected — quantize first). +pub fn encode_png(img: &EncodeImage, meta: &EncodeMeta) -> Result<Vec<u8>> { + img.validate()?; + let mut ic_img = shared_image(img, Some("PNG needs 8- or 16-bit samples"))?; ic_img.icc = meta.icc.map(|b| b.to_vec()); ic_img.meta.exif = meta.exif.map(|b| b.to_vec()); ic_img.meta.xmp = meta.xmp.map(|x| x.to_string()); @@ -234,19 +241,7 @@ pub enum TiffCompression { /// ICC and XMP are embedded; EXIF is not (write it through the TIFF writer in `craft-tiff`). pub fn encode_tiff(img: &EncodeImage, compression: TiffCompression, meta: &EncodeMeta) -> Result<Vec<u8>> { img.validate()?; - let n = img.width as usize * img.height as usize * img.channels as usize; - let layout = match img.channels { - 1 => craft_image_codecs::ChannelLayout::Gray, - 2 => craft_image_codecs::ChannelLayout::GrayA, - 3 => craft_image_codecs::ChannelLayout::Rgb, - _ => craft_image_codecs::ChannelLayout::Rgba, - }; - let mut ic_img = match img.samples { - Samples::U8(s) => craft_image_codecs::Image::from_u8(img.width, img.height, layout, s[..n].to_vec()), - Samples::U16(s) => craft_image_codecs::Image::from_u16(img.width, img.height, layout, &s[..n]), - Samples::F32(s) => craft_image_codecs::Image::from_f32(img.width, img.height, layout, &s[..n]), - } - .map_err(|e| Error::Encode(e.to_string()))?; + let mut ic_img = shared_image(img, None)?; ic_img.icc = meta.icc.map(|b| b.to_vec()); ic_img.meta.xmp = meta.xmp.map(|x| x.to_string()); ic_img.meta.dpi = meta.ppi.filter(|p| *p > 0).map(|p| (p as f32, p as f32)); @@ -325,19 +320,7 @@ pub fn encode_avif(img: &EncodeImage, quality: u8, speed: u8, meta: &EncodeMeta) img.validate()?; #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] { - let n = img.width as usize * img.height as usize * img.channels as usize; - let layout = match img.channels { - 1 => craft_image_codecs::ChannelLayout::Gray, - 2 => craft_image_codecs::ChannelLayout::GrayA, - 3 => craft_image_codecs::ChannelLayout::Rgb, - _ => craft_image_codecs::ChannelLayout::Rgba, - }; - let mut ic_img = match img.samples { - Samples::U8(s) => craft_image_codecs::Image::from_u8(img.width, img.height, layout, s[..n].to_vec()), - Samples::U16(s) => craft_image_codecs::Image::from_u16(img.width, img.height, layout, &s[..n]), - Samples::F32(_) => return Err(Error::Encode("AVIF encoder needs 8- or 16-bit samples".into())), - } - .map_err(|e| Error::Encode(e.to_string()))?; + let mut ic_img = shared_image(img, Some("AVIF encoder needs 8- or 16-bit samples"))?; ic_img.meta.exif = meta.exif.map(|e| e.to_vec()); craft_image_codecs::encode_avif_with_speed(&ic_img, quality, speed).map_err(|e| Error::Encode(e.to_string())) } From a46cedee9b8601220485e95c732f4c0a650d2a45 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" <dylan@dylanmtaylor.com> Date: Sun, 15 Nov 2026 15:21:18 +0000 Subject: [PATCH 23/30] Include JPEG encoder redistribution notices --- NOTICE | 130 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) diff --git a/NOTICE b/NOTICE index 39eb49db2c..73c2e2f6f2 100644 --- a/NOTICE +++ b/NOTICE @@ -335,3 +335,133 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of 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. + +JPEG encoding +------------- + +The shared JPEG writer includes the following third-party encoder notice. The Apache-2.0 +alternative referred to below is also included in this distribution as LICENSE-APACHE. + +JPEG encoding dependency: jpeg-encoder 0.6.1 + +Source: https://crates.io/crates/jpeg-encoder/0.6.1 +Declared license: (MIT OR Apache-2.0) AND IJG. +This software is based in part on the work of the Independent JPEG Group. + +The MIT license and unaltered upstream IJG and SIMD notices follow. The Apache-2.0 +alternative is also retained in licenses/jpeg-encoder-0.6.1 at the repository root +(https://github.com/storytold/craft-libs/tree/main/licenses/jpeg-encoder-0.6.1). +The dependency is used unmodified; no encoder implementation is vendored here. + +LICENSE-MIT + +Copyright (c) 2021 Volker Ströbel <volkerstroebel@mysurdity.de> + +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. +Original src/fdct.rs opening notice + +/* + * Ported from mozjpeg to rust + * + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1991-1996, Thomas G. Lane. + * libjpeg-turbo Modifications: + * Copyright (C) 2015, 2020, D. R. Commander. + * + * Conditions of distribution and use: + * In plain English: + * + * 1. We don't promise that this software works. (But if you find any bugs, + * please let us know!) + * 2. You can use this software for whatever you want. You don't have to pay us. + * 3. You may not pretend that you wrote this software. If you use it in a + * program, you must acknowledge somewhere in your documentation that + * you've used the IJG code. + * + * In legalese: + * + * The authors make NO WARRANTY or representation, either express or implied, + * with respect to this software, its quality, accuracy, merchantability, or + * fitness for a particular purpose. This software is provided "AS IS", and you, + * its user, assume the entire risk as to its quality and accuracy. + * + * This software is copyright (C) 1991-2020, Thomas G. Lane, Guido Vollbeding. + * All Rights Reserved except as specified below. + * + * Permission is hereby granted to use, copy, modify, and distribute this + * software (or portions thereof) for any purpose, without fee, subject to these + * conditions: + * (1) If any part of the source code for this software is distributed, then this + * README file must be included, with this copyright and no-warranty notice + * unaltered; and any additions, deletions, or changes to the original files + * must be clearly indicated in accompanying documentation. + * (2) If only executable code is distributed, then the accompanying + * documentation must state that "this software is based in part on the work of + * the Independent JPEG Group". + * (3) Permission for use of this software is granted only if the user accepts + * full responsibility for any undesirable consequences; the authors accept + * NO LIABILITY for damages of any kind. + * + * These conditions apply to any software derived from or based on the IJG code, + * not just to the unmodified library. If you use our work, you ought to + * acknowledge us. + * + * Permission is NOT granted for the use of any IJG author's name or company name + * in advertising or publicity relating to this software or products derived from + * it. This software may be referred to only as "the Independent JPEG Group's + * software". + * + * We specifically permit and encourage the use of this software as the basis of + * commercial products, provided that all warranty or liability claims are + * assumed by the product vendor. + * + * This file contains a slower but more accurate integer implementation of the + * forward DCT (Discrete Cosine Transform). + * + * A 2-D DCT can be done by 1-D DCT on each row followed by 1-D DCT + * on each column. Direct algorithms are also available, but they are + * much more complex and seem not to be any faster when reduced to code. + * + * This implementation is based on an algorithm described in + * C. Loeffler, A. Ligtenberg and G. Moschytz, "Practical Fast 1-D DCT + * Algorithms with 11 Multiplications", Proc. Int'l. Conf. on Acoustics, + * Speech, and Signal Processing 1989 (ICASSP '89), pp. 988-991. + * The primary algorithm described there uses 11 multiplies and 29 adds. + * We use their alternate method with 12 multiplies and 32 adds. + * The advantage of this method is that no data path contains more than one + * multiplication; this allows a very simple and accurate implementation in + * scaled fixed-point arithmetic, with a minimal number of shifts. + */ + +Original src/avx2/fdct.rs opening notice + +/* + * Ported from mozjpeg / jfdctint-avx2.asm to rust + * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB + * Copyright (C) 2009, 2016, 2018, 2020, D. R. Commander. + * + * Based on the x86 SIMD extension for IJG JPEG library + * Copyright (C) 1999-2006, MIYASAKA Masaru. + */ From 629481764ed24c0f17b450c5513826114bf7e2d5 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" <dylan@dylanmtaylor.com> Date: Sun, 15 Nov 2026 19:44:00 -0500 Subject: [PATCH 24/30] fix(avif): preserve shared encoder threading without repinning other codecs --- Cargo.lock | 79 ++++++++++++++++++++++++++++++++----- Cargo.toml | 4 +- crates/codecs/Cargo.toml | 4 +- crates/codecs/src/encode.rs | 24 ++++++++--- 4 files changed, 93 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 67ebbe23a7..632fdd7190 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1273,8 +1273,7 @@ name = "craft-image-codecs" version = "0.1.0" source = "git+https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f#478c50560d3c6fad3d613af2a30b35c3bc9f4c0f" dependencies = [ - "avif-serialize", - "craft-jpeg", + "craft-jpeg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f)", "craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f)", "crc32fast", "exr", @@ -1285,6 +1284,33 @@ dependencies = [ "image-webp", "jpeg-encoder 0.6.1", "png", + "rayon", + "serde_json", + "thiserror 2.0.21", + "tiff", + "zune-core", + "zune-jpeg", + "zune-jpegxl", +] + +[[package]] +name = "craft-image-codecs" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=d99d0d3f9dc66ae74e0bf9991189545c51f6c037#d99d0d3f9dc66ae74e0bf9991189545c51f6c037" +dependencies = [ + "avif-serialize", + "craft-jpeg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=d99d0d3f9dc66ae74e0bf9991189545c51f6c037)", + "craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=d99d0d3f9dc66ae74e0bf9991189545c51f6c037)", + "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=d99d0d3f9dc66ae74e0bf9991189545c51f6c037)", + "crc32fast", + "exr", + "flate2", + "half", + "hayro-jpeg2000", + "image", + "image-webp", + "jpeg-encoder 0.6.1", + "png", "rav1e", "ravif", "rayon", @@ -1305,6 +1331,14 @@ dependencies = [ "thiserror 2.0.21", ] +[[package]] +name = "craft-jpeg" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=d99d0d3f9dc66ae74e0bf9991189545c51f6c037#d99d0d3f9dc66ae74e0bf9991189545c51f6c037" +dependencies = [ + "thiserror 2.0.21", +] + [[package]] name = "craft-jxl" version = "0.1.0" @@ -1318,7 +1352,7 @@ dependencies = [ [[package]] name = "craft-media" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f#478c50560d3c6fad3d613af2a30b35c3bc9f4c0f" +source = "git+https://github.com/storytold/craft-libs?rev=d99d0d3f9dc66ae74e0bf9991189545c51f6c037#d99d0d3f9dc66ae74e0bf9991189545c51f6c037" dependencies = [ "thiserror 2.0.21", ] @@ -1347,6 +1381,18 @@ dependencies = [ "serde", ] +[[package]] +name = "craft-metadata" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=d99d0d3f9dc66ae74e0bf9991189545c51f6c037#d99d0d3f9dc66ae74e0bf9991189545c51f6c037" +dependencies = [ + "brotli-decompressor 6.0.1", + "chrono", + "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=d99d0d3f9dc66ae74e0bf9991189545c51f6c037)", + "quick-xml 0.41.0", + "serde", +] + [[package]] name = "craft-mime" version = "0.1.0" @@ -1404,6 +1450,15 @@ dependencies = [ "thiserror 2.0.21", ] +[[package]] +name = "craft-tiff" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=d99d0d3f9dc66ae74e0bf9991189545c51f6c037#d99d0d3f9dc66ae74e0bf9991189545c51f6c037" +dependencies = [ + "serde", + "thiserror 2.0.21", +] + [[package]] name = "craft-ui" version = "0.1.0" @@ -1455,10 +1510,11 @@ dependencies = [ [[package]] name = "craft-video" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f#478c50560d3c6fad3d613af2a30b35c3bc9f4c0f" +source = "git+https://github.com/storytold/craft-libs?rev=d99d0d3f9dc66ae74e0bf9991189545c51f6c037#d99d0d3f9dc66ae74e0bf9991189545c51f6c037" dependencies = [ "craft-media", "rav1e", + "rayon", "thiserror 2.0.21", ] @@ -3907,8 +3963,9 @@ dependencies = [ "craft-gainmap", "craft-gif", "craft-heif", - "craft-image-codecs", - "craft-jpeg", + "craft-image-codecs 0.1.0 (git+https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f)", + "craft-image-codecs 0.1.0 (git+https://github.com/storytold/craft-libs?rev=d99d0d3f9dc66ae74e0bf9991189545c51f6c037)", + "craft-jpeg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f)", "craft-jxl", "craft-psd", "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=94777dcf7f8962476e96b049d08d22e25b9330c2)", @@ -4161,7 +4218,7 @@ dependencies = [ name = "lightcraft-pipeline" version = "0.21.1" dependencies = [ - "craft-image-codecs", + "craft-image-codecs 0.1.0 (git+https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f)", "dhat", "lightcraft-color", "lightcraft-develop", @@ -4180,7 +4237,7 @@ dependencies = [ name = "lightcraft-preview" version = "0.21.1" dependencies = [ - "craft-image-codecs", + "craft-image-codecs 0.1.0 (git+https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f)", "lightcraft-raster", "log", "siphasher", @@ -4203,7 +4260,7 @@ name = "lightcraft-raw" version = "0.21.1" dependencies = [ "chrono", - "craft-image-codecs", + "craft-image-codecs 0.1.0 (git+https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f)", "craft-jxl", "craft-raw", "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=94777dcf7f8962476e96b049d08d22e25b9330c2)", @@ -4226,7 +4283,7 @@ dependencies = [ name = "lightcraft-scenes" version = "0.21.1" dependencies = [ - "craft-image-codecs", + "craft-image-codecs 0.1.0 (git+https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f)", "lightcraft-color", "lightcraft-raster", "rayon", @@ -4417,6 +4474,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519" dependencies = [ "cfg-if", + "rayon", ] [[package]] @@ -5924,6 +5982,7 @@ dependencies = [ "loop9", "quick-error 2.0.1", "rav1e", + "rayon", "rgb", ] diff --git a/Cargo.toml b/Cargo.toml index 34c11a2e4e..a1cb736e6b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,9 @@ craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "94777 craft-jpeg = { git = "https://github.com/storytold/craft-libs", rev = "478c50560d3c6fad3d613af2a30b35c3bc9f4c0f" } # AVIF EXIF, alpha quality and BT.2408 HLG levels (craft-libs#1448). craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "478c50560d3c6fad3d613af2a30b35c3bc9f4c0f" } -craft-video = { git = "https://github.com/storytold/craft-libs", rev = "478c50560d3c6fad3d613af2a30b35c3bc9f4c0f", features = ["av1", "av1-large-encode"] } +craft-video = { git = "https://github.com/storytold/craft-libs", rev = "d99d0d3f9dc66ae74e0bf9991189545c51f6c037", features = ["av1", "av1-large-encode", "threads"] } +# Isolate AVIF threading from the existing PNG/TIFF/WebP shared revision. +craft-avif-encode = { package = "craft-image-codecs", git = "https://github.com/storytold/craft-libs", rev = "d99d0d3f9dc66ae74e0bf9991189545c51f6c037", default-features = false, features = ["avif", "threads"] } craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" } # craft-update: app-specific pretend versions apply to startup and manual checks. craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "6e03f65bf45181db77ba6229716e6624db9eb25b", features = ["egui"] } diff --git a/crates/codecs/Cargo.toml b/crates/codecs/Cargo.toml index 56bb5e5758..fb7020fa78 100644 --- a/crates/codecs/Cargo.toml +++ b/crates/codecs/Cargo.toml @@ -28,7 +28,7 @@ craft-jxl = { workspace = true, optional = true } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] craft-video = { workspace = true, optional = true } -craft-image-codecs = { workspace = true, features = ["avif"] } +craft-avif-encode = { workspace = true, optional = true } [features] default = ["parallel", "jxl", "avif"] @@ -40,7 +40,7 @@ jxl = ["dep:craft-jxl"] # PhotoCraft); `cargo xtask ci` clippies and tests it (`--features heif`), releases don't ship it yet. heif = ["dep:craft-heif"] ## AVIF/AV1 encoding via craft-image-codecs / craft-video (pure Rust). Native targets only; a no-op on wasm32. -avif = ["dep:craft-video"] +avif = ["dep:craft-video", "dep:craft-avif-encode"] [dev-dependencies] # tests record why they skip (`cargo xtask ci` lists the skips) diff --git a/crates/codecs/src/encode.rs b/crates/codecs/src/encode.rs index d2f107dc9e..86be1c1ca7 100644 --- a/crates/codecs/src/encode.rs +++ b/crates/codecs/src/encode.rs @@ -290,9 +290,23 @@ pub fn encode_avif(img: &EncodeImage, quality: u8, speed: u8, meta: &EncodeMeta) img.validate()?; #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] { - let mut ic_img = shared_image(img, Some("AVIF encoder needs 8- or 16-bit samples"))?; + // Keep AVIF on its threading-capable shared revision without changing other codecs. + use craft_avif_encode::{ChannelLayout, Image}; + let n = img.width as usize * img.height as usize * img.channels as usize; + let layout = match img.channels { + 1 => ChannelLayout::Gray, + 2 => ChannelLayout::GrayA, + 3 => ChannelLayout::Rgb, + _ => ChannelLayout::Rgba, + }; + let mut ic_img = match img.samples { + Samples::U8(s) => Image::from_u8(img.width, img.height, layout, s[..n].to_vec()), + Samples::U16(s) => Image::from_u16(img.width, img.height, layout, &s[..n]), + Samples::F32(_) => return Err(Error::Encode("AVIF encoder needs 8- or 16-bit samples".into())), + } + .map_err(|e| Error::Encode(e.to_string()))?; ic_img.meta.exif = meta.exif.map(|e| e.to_vec()); - craft_image_codecs::encode_avif_with_speed(&ic_img, quality, speed).map_err(|e| Error::Encode(e.to_string())) + craft_avif_encode::encode_avif_with_speed(&ic_img, quality, speed).map_err(|e| Error::Encode(e.to_string())) } #[cfg(not(all(feature = "avif", not(target_arch = "wasm32"))))] { @@ -370,10 +384,10 @@ pub fn encode_avif_hdr(width: u32, height: u32, rgb: &[f32], quality: u8, speed: { let _ = (w, h, n); let t = match transfer { - HdrTransfer::Pq => craft_image_codecs::HdrTransfer::Pq, - HdrTransfer::Hlg => craft_image_codecs::HdrTransfer::Hlg, + HdrTransfer::Pq => craft_avif_encode::HdrTransfer::Pq, + HdrTransfer::Hlg => craft_avif_encode::HdrTransfer::Hlg, }; - craft_image_codecs::encode_avif_hdr(width, height, rgb, quality, speed, meta.exif, t).map_err(|e| Error::Encode(e.to_string())) + craft_avif_encode::encode_avif_hdr(width, height, rgb, quality, speed, meta.exif, t).map_err(|e| Error::Encode(e.to_string())) } #[cfg(not(all(feature = "avif", not(target_arch = "wasm32"))))] { From 8a92b30605a381169e56baeb98fdbca67e6e2726 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" <dylan@dylanmtaylor.com> Date: Sun, 15 Nov 2026 20:55:54 -0500 Subject: [PATCH 25/30] build: pin AVIF threading to merged craft-libs --- Cargo.lock | 28 ++++++++++++++-------------- Cargo.toml | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 632fdd7190..1f276fab37 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1296,12 +1296,12 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d99d0d3f9dc66ae74e0bf9991189545c51f6c037#d99d0d3f9dc66ae74e0bf9991189545c51f6c037" +source = "git+https://github.com/storytold/craft-libs?rev=5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a#5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a" dependencies = [ "avif-serialize", - "craft-jpeg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=d99d0d3f9dc66ae74e0bf9991189545c51f6c037)", - "craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=d99d0d3f9dc66ae74e0bf9991189545c51f6c037)", - "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=d99d0d3f9dc66ae74e0bf9991189545c51f6c037)", + "craft-jpeg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a)", + "craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a)", + "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a)", "crc32fast", "exr", "flate2", @@ -1334,7 +1334,7 @@ dependencies = [ [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d99d0d3f9dc66ae74e0bf9991189545c51f6c037#d99d0d3f9dc66ae74e0bf9991189545c51f6c037" +source = "git+https://github.com/storytold/craft-libs?rev=5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a#5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a" dependencies = [ "thiserror 2.0.21", ] @@ -1352,7 +1352,7 @@ dependencies = [ [[package]] name = "craft-media" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d99d0d3f9dc66ae74e0bf9991189545c51f6c037#d99d0d3f9dc66ae74e0bf9991189545c51f6c037" +source = "git+https://github.com/storytold/craft-libs?rev=5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a#5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a" dependencies = [ "thiserror 2.0.21", ] @@ -1372,11 +1372,11 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=94777dcf7f8962476e96b049d08d22e25b9330c2#94777dcf7f8962476e96b049d08d22e25b9330c2" +source = "git+https://github.com/storytold/craft-libs?rev=5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a#5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a" dependencies = [ "brotli-decompressor 6.0.1", "chrono", - "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=94777dcf7f8962476e96b049d08d22e25b9330c2)", + "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a)", "quick-xml 0.41.0", "serde", ] @@ -1384,11 +1384,11 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d99d0d3f9dc66ae74e0bf9991189545c51f6c037#d99d0d3f9dc66ae74e0bf9991189545c51f6c037" +source = "git+https://github.com/storytold/craft-libs?rev=94777dcf7f8962476e96b049d08d22e25b9330c2#94777dcf7f8962476e96b049d08d22e25b9330c2" dependencies = [ "brotli-decompressor 6.0.1", "chrono", - "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=d99d0d3f9dc66ae74e0bf9991189545c51f6c037)", + "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=94777dcf7f8962476e96b049d08d22e25b9330c2)", "quick-xml 0.41.0", "serde", ] @@ -1444,7 +1444,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=94777dcf7f8962476e96b049d08d22e25b9330c2#94777dcf7f8962476e96b049d08d22e25b9330c2" +source = "git+https://github.com/storytold/craft-libs?rev=5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a#5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a" dependencies = [ "serde", "thiserror 2.0.21", @@ -1453,7 +1453,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d99d0d3f9dc66ae74e0bf9991189545c51f6c037#d99d0d3f9dc66ae74e0bf9991189545c51f6c037" +source = "git+https://github.com/storytold/craft-libs?rev=94777dcf7f8962476e96b049d08d22e25b9330c2#94777dcf7f8962476e96b049d08d22e25b9330c2" dependencies = [ "serde", "thiserror 2.0.21", @@ -1510,7 +1510,7 @@ dependencies = [ [[package]] name = "craft-video" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d99d0d3f9dc66ae74e0bf9991189545c51f6c037#d99d0d3f9dc66ae74e0bf9991189545c51f6c037" +source = "git+https://github.com/storytold/craft-libs?rev=5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a#5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a" dependencies = [ "craft-media", "rav1e", @@ -3964,7 +3964,7 @@ dependencies = [ "craft-gif", "craft-heif", "craft-image-codecs 0.1.0 (git+https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f)", - "craft-image-codecs 0.1.0 (git+https://github.com/storytold/craft-libs?rev=d99d0d3f9dc66ae74e0bf9991189545c51f6c037)", + "craft-image-codecs 0.1.0 (git+https://github.com/storytold/craft-libs?rev=5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a)", "craft-jpeg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f)", "craft-jxl", "craft-psd", diff --git a/Cargo.toml b/Cargo.toml index a1cb736e6b..bdb0c1cb0e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,9 +24,9 @@ craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "94777 craft-jpeg = { git = "https://github.com/storytold/craft-libs", rev = "478c50560d3c6fad3d613af2a30b35c3bc9f4c0f" } # AVIF EXIF, alpha quality and BT.2408 HLG levels (craft-libs#1448). craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "478c50560d3c6fad3d613af2a30b35c3bc9f4c0f" } -craft-video = { git = "https://github.com/storytold/craft-libs", rev = "d99d0d3f9dc66ae74e0bf9991189545c51f6c037", features = ["av1", "av1-large-encode", "threads"] } +craft-video = { git = "https://github.com/storytold/craft-libs", rev = "5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a", features = ["av1", "av1-large-encode", "threads"] } # Isolate AVIF threading from the existing PNG/TIFF/WebP shared revision. -craft-avif-encode = { package = "craft-image-codecs", git = "https://github.com/storytold/craft-libs", rev = "d99d0d3f9dc66ae74e0bf9991189545c51f6c037", default-features = false, features = ["avif", "threads"] } +craft-avif-encode = { package = "craft-image-codecs", git = "https://github.com/storytold/craft-libs", rev = "5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a", default-features = false, features = ["avif", "threads"] } craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" } # craft-update: app-specific pretend versions apply to startup and manual checks. craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "6e03f65bf45181db77ba6229716e6624db9eb25b", features = ["egui"] } From 9a81246a52bfd9c83d1e7aa969290f9a48d57f03 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" <dylan@dylanmtaylor.com> Date: Sun, 15 Nov 2026 22:17:24 -0500 Subject: [PATCH 26/30] test: retain JXL post-header truncation coverage --- crates/codecs/tests/it/jxl_streaming.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/codecs/tests/it/jxl_streaming.rs b/crates/codecs/tests/it/jxl_streaming.rs index 401990b31f..310d308f8b 100644 --- a/crates/codecs/tests/it/jxl_streaming.rs +++ b/crates/codecs/tests/it/jxl_streaming.rs @@ -58,7 +58,7 @@ fn metadata_in_final_feed_matches_builder() { } #[test] -fn progressive_truncation_matches_builder() { +fn progressive_truncation_matches_shared_decoder() { let pixels = Rgba8::from_fn(96, 64, |x, y| { let mut seed = (y * 96 + x + 1) as u32; let mut rgb = [0; 4]; @@ -80,6 +80,13 @@ fn progressive_truncation_matches_builder() { for cut in [0, 1, 2, 12] { assert!(decode(&raw[..cut], DecodeOptions::default()).is_err(), "lossless={lossless}, cut={cut}/{}", raw.len()); } + // Progressive streams may contain a renderable partial frame. Preserve the + // post-header feed-boundary cases instead of requiring every truncation to fail. + for cut in [4095, 4096, 4097, raw.len() / 2, raw.len() - 1, raw.len()] { + let bytes = &raw[..cut]; + let shared_ok = craft_jxl::decode_with_color(bytes, craft_jxl::DecodeLimits::default(), craft_jxl::OutputColor::LinearRec2020).is_ok(); + assert_eq!(decode(bytes, DecodeOptions::default()).is_ok(), shared_ok, "lossless={lossless}, cut={cut}/{}", raw.len()); + } assert!(decode(&raw, DecodeOptions::default()).is_ok(), "lossless={lossless}"); } } From 0d61484dda9c0c75ee5edd0719c033819204aa3d Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" <dylan@dylanmtaylor.com> Date: Sun, 15 Nov 2026 22:35:29 -0500 Subject: [PATCH 27/30] fix(codecs): preserve AV1 quality-100 quantizer --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- crates/codecs/src/video.rs | 31 +++++++++++++++++++++++++++++-- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1f276fab37..a61b5d4a4d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1352,7 +1352,7 @@ dependencies = [ [[package]] name = "craft-media" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a#5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a" +source = "git+https://github.com/storytold/craft-libs?rev=f450b5b59131e01d318ad398e8534899ca5a5aad#f450b5b59131e01d318ad398e8534899ca5a5aad" dependencies = [ "thiserror 2.0.21", ] @@ -1510,7 +1510,7 @@ dependencies = [ [[package]] name = "craft-video" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a#5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a" +source = "git+https://github.com/storytold/craft-libs?rev=f450b5b59131e01d318ad398e8534899ca5a5aad#f450b5b59131e01d318ad398e8534899ca5a5aad" dependencies = [ "craft-media", "rav1e", diff --git a/Cargo.toml b/Cargo.toml index bdb0c1cb0e..09552e6abe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "94777 craft-jpeg = { git = "https://github.com/storytold/craft-libs", rev = "478c50560d3c6fad3d613af2a30b35c3bc9f4c0f" } # AVIF EXIF, alpha quality and BT.2408 HLG levels (craft-libs#1448). craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "478c50560d3c6fad3d613af2a30b35c3bc9f4c0f" } -craft-video = { git = "https://github.com/storytold/craft-libs", rev = "5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a", features = ["av1", "av1-large-encode", "threads"] } +craft-video = { git = "https://github.com/storytold/craft-libs", rev = "f450b5b59131e01d318ad398e8534899ca5a5aad", features = ["av1", "av1-large-encode", "threads"] } # Isolate AVIF threading from the existing PNG/TIFF/WebP shared revision. craft-avif-encode = { package = "craft-image-codecs", git = "https://github.com/storytold/craft-libs", rev = "5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a", default-features = false, features = ["avif", "threads"] } craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" } diff --git a/crates/codecs/src/video.rs b/crates/codecs/src/video.rs index 6a8e3c6f8a..35a6b79311 100644 --- a/crates/codecs/src/video.rs +++ b/crates/codecs/src/video.rs @@ -852,9 +852,9 @@ impl Av1Encoder { { use craft_video::av1::{EncoderConfig, RateControl}; let mut ec = EncoderConfig::new(w as u32, h as u32, c.fps, 1); - ec.rate = RateControl::ConstantQ(quantizer(c.quality).clamp(1, 255) as u8); + ec.rate = RateControl::ConstantQ(quantizer(c.quality) as u8); ec.keyint = 120; - let enc = craft_video::av1::LargeEncoder::with_speed(&ec, c.speed).map_err(|e| bad(format!("AV1: {e}")))?; + let enc = craft_video::av1::LargeEncoder::with_exact_quantizer(&ec, c.speed).map_err(|e| bad(format!("AV1: {e}")))?; Ok(Av1Encoder { enc, durations: Vec::new(), returned: 0, failed: false, width: w, height: h }) } #[cfg(not(all(feature = "avif", not(target_arch = "wasm32"))))] @@ -1167,6 +1167,33 @@ mod tests { assert!(encoder.config_record().is_some()); } + #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] + #[test] + fn av1_quality_100_preserves_the_exact_zero_quantizer() { + assert_eq!(quantizer(100), 0); + let image: Vec<[u8; 4]> = (0..64 * 48).map(|i| [(i * 13) as u8, (i * 41) as u8, (i * 73) as u8, 255]).collect(); + let cfg = VideoConfig { width: 64, height: 48, fps: 24, quality: 100, speed: 10 }; + let mut actual = Av1Encoder::new(&cfg).unwrap(); + let mut samples = actual.push(&image, 7, true).unwrap(); + samples.extend(actual.finish().unwrap()); + + let (y, u, v) = yuv420(&image, 64, 48).unwrap(); + let y: Vec<u16> = y.into_iter().map(u16::from).collect(); + let u: Vec<u16> = u.into_iter().map(u16::from).collect(); + let v: Vec<u16> = v.into_iter().map(u16::from).collect(); + let frame = craft_video::av1::Frame { y: &y, u: &u, v: &v, y_stride: 64, uv_stride: 32 }; + let mut ec = craft_video::av1::EncoderConfig::new(64, 48, 24, 1); + ec.rate = craft_video::av1::RateControl::ConstantQ(0); + ec.keyint = 120; + let mut exact = craft_video::av1::LargeEncoder::with_exact_quantizer(&ec, 10).unwrap(); + let mut expected = exact.push(&frame, true).unwrap(); + expected.extend(exact.finish().unwrap()); + assert_eq!(samples.len(), 1); + assert_eq!(samples[0].data, expected[0].packet.data); + assert_eq!(samples[0].duration, 7); + assert!(samples[0].key); + } + #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] #[test] fn av1_speed_affects_normal_sized_frames() { From 2f7a797ed86b840e07432d558148c580941be440 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" <dylan@dylanmtaylor.com> Date: Sun, 15 Nov 2026 23:45:45 -0500 Subject: [PATCH 28/30] chore(codecs): pin merged exact AV1 quantizer support --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a61b5d4a4d..8074dddfe0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1352,7 +1352,7 @@ dependencies = [ [[package]] name = "craft-media" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f450b5b59131e01d318ad398e8534899ca5a5aad#f450b5b59131e01d318ad398e8534899ca5a5aad" +source = "git+https://github.com/storytold/craft-libs?rev=5c91598ccc86537a779f438d520fa6406c26efe6#5c91598ccc86537a779f438d520fa6406c26efe6" dependencies = [ "thiserror 2.0.21", ] @@ -1510,7 +1510,7 @@ dependencies = [ [[package]] name = "craft-video" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f450b5b59131e01d318ad398e8534899ca5a5aad#f450b5b59131e01d318ad398e8534899ca5a5aad" +source = "git+https://github.com/storytold/craft-libs?rev=5c91598ccc86537a779f438d520fa6406c26efe6#5c91598ccc86537a779f438d520fa6406c26efe6" dependencies = [ "craft-media", "rav1e", diff --git a/Cargo.toml b/Cargo.toml index 09552e6abe..d0d8386488 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "94777 craft-jpeg = { git = "https://github.com/storytold/craft-libs", rev = "478c50560d3c6fad3d613af2a30b35c3bc9f4c0f" } # AVIF EXIF, alpha quality and BT.2408 HLG levels (craft-libs#1448). craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "478c50560d3c6fad3d613af2a30b35c3bc9f4c0f" } -craft-video = { git = "https://github.com/storytold/craft-libs", rev = "f450b5b59131e01d318ad398e8534899ca5a5aad", features = ["av1", "av1-large-encode", "threads"] } +craft-video = { git = "https://github.com/storytold/craft-libs", rev = "5c91598ccc86537a779f438d520fa6406c26efe6", features = ["av1", "av1-large-encode", "threads"] } # Isolate AVIF threading from the existing PNG/TIFF/WebP shared revision. craft-avif-encode = { package = "craft-image-codecs", git = "https://github.com/storytold/craft-libs", rev = "5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a", default-features = false, features = ["avif", "threads"] } craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" } From 0466978870fde4b5215eea8e7fa50bd313eec194 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" <dylan@dylanmtaylor.com> Date: Mon, 16 Nov 2026 01:34:37 -0500 Subject: [PATCH 29/30] test(codecs): preserve two-plane JXL fixture and large AV1 coverage --- crates/codecs/src/video.rs | 16 ++++++++++++++++ crates/raw/tests/it/dng.rs | 15 ++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/crates/codecs/src/video.rs b/crates/codecs/src/video.rs index 35a6b79311..0d2df2962f 100644 --- a/crates/codecs/src/video.rs +++ b/crates/codecs/src/video.rs @@ -1167,6 +1167,22 @@ mod tests { assert!(encoder.config_record().is_some()); } + #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] + #[test] + fn av1_preserves_frame_sizes_above_the_old_area_limit() { + for (width, height) in [(5120, 2160), (4096, 4096)] { + let cfg = VideoConfig { width, height, fps: 30, quality: 60, speed: 10 }; + let mut encoder = Av1Encoder::new(&cfg).unwrap(); + let mut samples = encoder.push(&vec![[80, 120, 180, 255]; width as usize * height as usize], 7, true).unwrap(); + samples.extend(encoder.finish().unwrap()); + assert_eq!(samples.len(), 1, "{width}x{height}"); + assert!(!samples[0].data.is_empty()); + assert_eq!(samples[0].duration, 7); + assert!(samples[0].key); + assert!(encoder.config_record().is_some()); + } + } + #[cfg(all(feature = "avif", not(target_arch = "wasm32")))] #[test] fn av1_quality_100_preserves_the_exact_zero_quantizer() { diff --git a/crates/raw/tests/it/dng.rs b/crates/raw/tests/it/dng.rs index 0f317af3b3..84ef1d29af 100644 --- a/crates/raw/tests/it/dng.rs +++ b/crates/raw/tests/it/dng.rs @@ -805,21 +805,18 @@ fn jpeg_xl_tiles_beyond_their_decode_budget_are_errors() { let (w, h) = (512, 512); let grey: Vec<u16> = (0..w * h).map(|i| ((i % w) * 97 + (i / w) * 31) as u16 & 0x0fff).collect(); let with_alpha: Vec<u16> = grey.iter().flat_map(|&v| [v, 4095 - v]).collect(); - let img = craft_jxl::ImageRef { - width: w as u32, - height: h as u32, - layout: craft_jxl::Layout::GrayAlpha, - samples: craft_jxl::Samples::U16(&with_alpha), - }; - let opts = craft_jxl::EncodeOptions { lossless: true, ..Default::default() }; - let tile = craft_jxl::encode(&img, opts, &craft_jxl::Metadata::default()).unwrap(); + // The public craft-jxl image encoder widens GrayAlpha to RGBA. This budget fixture + // specifically needs two encoded planes, not a four-plane layout mismatch. + let config = jixel::EncodeConfig::default().with_lossless(true); + let tile = jixel::encode_image_gray_alpha_16bit(&with_alpha, w, h, &config).unwrap(); let one = |tile: Vec<u8>| { let mut raw = base_ifd(w, h, 12, 1, true); raw.set(t::COMPRESSION, Value::Short(vec![compression::JPEG_XL])); raw.set_image(ImageData::Tiles { tile_width: w as u32, tile_height: h as u32, tiles: vec![tile] }); dng(raw, ByteOrder::Little) }; - assert!(matches!(decode(&one(tile)), Err(RawError::Corrupt(_)))); + let Err(RawError::Corrupt(error)) = decode(&one(tile)) else { panic!("the extra plane must exceed the tile budget") }; + assert!(!error.contains("colour planes"), "must fail the budget, not the fixture layout: {error}"); assert_eq!(decode(&one(jxl_encode(&grey, w, h, 1, false))).unwrap().data, RawData::U16(grey)); } From 3b0c91f44b5e2e51debbe830844c8a0a4e2f4db9 Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Mon, 16 Nov 2026 07:39:36 +0100 Subject: [PATCH 30/30] Regenerate Flatpak cargo sources for the craft-video and craft-image-codecs pins --- packaging/linux/flatpak/cargo-sources.json | 130 ++++++++++++++++++++- 1 file changed, 125 insertions(+), 5 deletions(-) diff --git a/packaging/linux/flatpak/cargo-sources.json b/packaging/linux/flatpak/cargo-sources.json index 58c13aa3ae..ac13e79301 100644 --- a/packaging/linux/flatpak/cargo-sources.json +++ b/packaging/linux/flatpak/cargo-sources.json @@ -35,6 +35,18 @@ "commit": "478c50560d3c6fad3d613af2a30b35c3bc9f4c0f", "dest": "flatpak-cargo/git/craft-libs-478c505" }, + { + "type": "git", + "url": "https://github.com/storytold/craft-libs", + "commit": "5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a", + "dest": "flatpak-cargo/git/craft-libs-5ac7c96" + }, + { + "type": "git", + "url": "https://github.com/storytold/craft-libs", + "commit": "5c91598ccc86537a779f438d520fa6406c26efe6", + "dest": "flatpak-cargo/git/craft-libs-5c91598" + }, { "type": "git", "url": "https://github.com/storytold/craft-libs", @@ -1747,6 +1759,24 @@ "dest": "cargo/vendor-git/cb31475a7a9d19c00f48b4c43603f2f1a464c6dce15da1d21bba4c653eeba6b2/craft-image-codecs", "dest-filename": ".cargo-checksum.json" }, + { + "type": "shell", + "commands": [ + "mkdir -p \"cargo/vendor-git/9100d311acc530b0286234c55b78dbdc0325d5e30950478c5c7864bfed7a4545\" && cp -r --reflink=auto \"flatpak-cargo/git/craft-libs-5ac7c96/crates/image-codecs\" \"cargo/vendor-git/9100d311acc530b0286234c55b78dbdc0325d5e30950478c5c7864bfed7a4545/craft-image-codecs\"" + ] + }, + { + "type": "inline", + "contents": "[package]\nname = \"craft-image-codecs\"\ndescription = \"Bounded, depth- and metadata-preserving codecs for flat raster image formats\"\nversion = \"0.1.0\"\nedition = \"2024\"\nlicense = \"MIT OR Apache-2.0\"\nrust-version = \"1.95\"\nrepository = \"https://github.com/storytold/craft-libs\"\n\n[lints.rust]\nunsafe_code = \"forbid\"\nunused_workspace_dependencies = \"allow\"\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(craft_pdf_unicode_fixtures)\"]\n\n[lints.clippy]\ncognitive_complexity = \"deny\"\ntoo_many_arguments = \"deny\"\nunused_workspace_dependencies = \"allow\"\nwildcard_imports = \"deny\"\ndbg_macro = \"warn\"\ntodo = \"warn\"\n\n[features]\ncorpus = []\ndefault = []\nthreads = [\"ravif?/threading\", \"rav1e?/threading\"]\nsgi = []\nsunraster = []\navif = [\"image/avif\", \"dep:ravif\", \"dep:rav1e\", \"dep:avif-serialize\"]\nheif = [\"dep:craft-heif\"]\navif-decode = [\"dep:craft-video\", \"craft-video/av1-decode\"]\n\n[dependencies]\ncrc32fast = \"1.5\"\nthiserror = \"2\"\npng = \"0.18\"\nhalf = \"2\"\nserde_json = \"1\"\nimage-webp = \"0.2\"\nzune-jpeg = \"0.5\"\nzune-core = \"0.5\"\njpeg-encoder = \"0.6\"\n\n[dependencies.image]\nversion = \"0.25\"\ndefault-features = false\nfeatures = [\"png\", \"jpeg\", \"tiff\", \"gif\", \"bmp\", \"tga\", \"ico\", \"qoi\", \"hdr\"]\n\n[dependencies.tiff]\nversion = \"0.11\"\ndefault-features = false\nfeatures = [\"deflate\", \"fax\", \"jpeg\", \"lzw\"]\n\n[dependencies.exr]\nversion = \"1.73\"\ndefault-features = false\n\n[dependencies.flate2]\nversion = \"1.1.10\"\ndefault-features = false\nfeatures = [\"zlib-rs\", \"runtime_detection\"]\n\n[dependencies.craft-jpeg]\npath = \"crates/jpeg\"\n\n[dependencies.craft-metadata]\npath = \"crates/metadata\"\n\n[dependencies.craft-tiff]\npath = \"crates/tiff\"\n\n[dependencies.zune-jpegxl]\nversion = \"=0.5.2\"\ndefault-features = false\nfeatures = [\"std\"]\n\n[dependencies.craft-heif]\noptional = true\npath = \"crates/heif\"\n\n[dependencies.ravif]\nversion = \"0.13\"\ndefault-features = false\noptional = true\n\n[dependencies.rav1e]\nversion = \"0.8\"\ndefault-features = false\noptional = true\n\n[dependencies.avif-serialize]\nversion = \"0.8\"\noptional = true\n\n[dependencies.hayro-jpeg2000]\nversion = \"=0.3.5\"\ndefault-features = false\nfeatures = [\"std\", \"simd\"]\n\n[target.\"cfg(not(target_arch = \\\"wasm32\\\"))\".dependencies]\nrayon = \"1\"\n\n[target.\"cfg(not(target_arch = \\\"wasm32\\\"))\".dependencies.craft-video]\noptional = true\npath = \"crates/video\"\n\n[target.\"cfg(not(target_arch = \\\"wasm32\\\"))\".dependencies.exr]\nversion = \"1.73\"\ndefault-features = false\nfeatures = [\"rayon\"]\n\n[target.\"cfg(not(target_arch = \\\"wasm32\\\"))\".dev-dependencies.craft-video]\nfeatures = [\"av1-decode\"]\npath = \"crates/video\"\n\n[target.\"cfg(not(target_arch = \\\"wasm32\\\"))\".dev-dependencies.jxl-oxide]\nversion = \"=0.12.6\"\ndefault-features = false\nfeatures = [\"rayon\"]\n\n[dev-dependencies]\nproptest = \"1\"\n\n[dev-dependencies.image]\nversion = \"0.25\"\ndefault-features = false\nfeatures = [\"png\", \"jpeg\", \"tiff\"]\n\n[dev-dependencies.sha2]\nversion = \"0.10\"\ndefault-features = false\nfeatures = [\"std\"]\n\n[dev-dependencies.craft-media-testkit]\npath = \"crates/media-testkit\"\n", + "dest": "cargo/vendor-git/9100d311acc530b0286234c55b78dbdc0325d5e30950478c5c7864bfed7a4545/craft-image-codecs", + "dest-filename": "Cargo.toml" + }, + { + "type": "inline", + "contents": "{\"package\": null, \"files\": {}}", + "dest": "cargo/vendor-git/9100d311acc530b0286234c55b78dbdc0325d5e30950478c5c7864bfed7a4545/craft-image-codecs", + "dest-filename": ".cargo-checksum.json" + }, { "type": "shell", "commands": [ @@ -1768,19 +1798,55 @@ { "type": "shell", "commands": [ - "mkdir -p \"cargo/vendor-git/a51e2c3f46af71f1caed91009f88b4f9982db0c4152c6659d11967a7731b1ccc\" && cp -r --reflink=auto \"flatpak-cargo/git/craft-libs-b77af38/crates/jxl\" \"cargo/vendor-git/a51e2c3f46af71f1caed91009f88b4f9982db0c4152c6659d11967a7731b1ccc/craft-jxl\"" + "mkdir -p \"cargo/vendor-git/9100d311acc530b0286234c55b78dbdc0325d5e30950478c5c7864bfed7a4545\" && cp -r --reflink=auto \"flatpak-cargo/git/craft-libs-5ac7c96/crates/jpeg\" \"cargo/vendor-git/9100d311acc530b0286234c55b78dbdc0325d5e30950478c5c7864bfed7a4545/craft-jpeg\"" ] }, { "type": "inline", - "contents": "[package]\nname = \"craft-jxl\"\ndescription = \"JPEG XL image decoding and encoding with bounded input and allocation tracking.\"\nversion = \"0.1.0\"\nedition = \"2024\"\nlicense = \"MIT OR Apache-2.0\"\nrust-version = \"1.95\"\nrepository = \"https://github.com/storytold/craft-libs\"\n\n[lints.rust]\nunsafe_code = \"forbid\"\nunused_workspace_dependencies = \"allow\"\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(craft_pdf_unicode_fixtures)\"]\n\n[lints.clippy]\ncognitive_complexity = \"deny\"\ntoo_many_arguments = \"deny\"\nunused_workspace_dependencies = \"allow\"\nwildcard_imports = \"deny\"\ndbg_macro = \"warn\"\ntodo = \"warn\"\n\n[features]\ndefault = [\"decode\", \"encode\"]\ndecode = [\"dep:jxl-oxide\"]\nencode = [\"dep:jixel\"]\n\n[dependencies]\nthiserror = \"2\"\n\n[dependencies.jxl-oxide]\noptional = true\nversion = \"0.12\"\ndefault-features = false\n\n[dev-dependencies.craft-cms]\npath = \"crates/cms\"\n\n[target.\"cfg(not(target_arch = \\\"wasm32\\\"))\".dependencies.jixel]\noptional = true\nversion = \"=0.3.4\"\n", - "dest": "cargo/vendor-git/a51e2c3f46af71f1caed91009f88b4f9982db0c4152c6659d11967a7731b1ccc/craft-jxl", + "contents": "[package]\nname = \"craft-jpeg\"\ndescription = \"Clean-room JPEG decoder and 8-bit optimized baseline encoder (ITU-T T.81).\"\nversion = \"0.1.0\"\nedition = \"2024\"\nlicense = \"MIT OR Apache-2.0\"\nrust-version = \"1.95\"\nrepository = \"https://github.com/storytold/craft-libs\"\n\n[lints.rust]\nunsafe_code = \"forbid\"\nunused_workspace_dependencies = \"allow\"\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(craft_pdf_unicode_fixtures)\"]\n\n[lints.clippy]\ncognitive_complexity = \"deny\"\ntoo_many_arguments = \"deny\"\nunused_workspace_dependencies = \"allow\"\nwildcard_imports = \"deny\"\ndbg_macro = \"warn\"\ntodo = \"warn\"\n\n[dependencies]\nthiserror = \"2\"\n\n[dependencies.rayon]\noptional = true\nversion = \"1\"\n\n[dev-dependencies]\njpeg-encoder = \"0.6\"\nzune-jpeg = \"0.5\"\njpeg-decoder = \"0.3\"\n\n[features]\ndefault = []\nparallel = [\"dep:rayon\"]\n", + "dest": "cargo/vendor-git/9100d311acc530b0286234c55b78dbdc0325d5e30950478c5c7864bfed7a4545/craft-jpeg", "dest-filename": "Cargo.toml" }, { "type": "inline", "contents": "{\"package\": null, \"files\": {}}", - "dest": "cargo/vendor-git/a51e2c3f46af71f1caed91009f88b4f9982db0c4152c6659d11967a7731b1ccc/craft-jxl", + "dest": "cargo/vendor-git/9100d311acc530b0286234c55b78dbdc0325d5e30950478c5c7864bfed7a4545/craft-jpeg", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "shell", + "commands": [ + "mkdir -p \"cargo/vendor-git/cb31475a7a9d19c00f48b4c43603f2f1a464c6dce15da1d21bba4c653eeba6b2\" && cp -r --reflink=auto \"flatpak-cargo/git/craft-libs-478c505/crates/jxl\" \"cargo/vendor-git/cb31475a7a9d19c00f48b4c43603f2f1a464c6dce15da1d21bba4c653eeba6b2/craft-jxl\"" + ] + }, + { + "type": "inline", + "contents": "[package]\nname = \"craft-jxl\"\ndescription = \"JPEG XL image decoding and encoding with bounded input and allocation tracking.\"\nversion = \"0.1.0\"\nedition = \"2024\"\nlicense = \"MIT OR Apache-2.0\"\nrust-version = \"1.95\"\nrepository = \"https://github.com/storytold/craft-libs\"\n\n[lints.rust]\nunsafe_code = \"forbid\"\nunused_workspace_dependencies = \"allow\"\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(craft_pdf_unicode_fixtures)\"]\n\n[lints.clippy]\ncognitive_complexity = \"deny\"\ntoo_many_arguments = \"deny\"\nunused_workspace_dependencies = \"allow\"\nwildcard_imports = \"deny\"\ndbg_macro = \"warn\"\ntodo = \"warn\"\n\n[features]\ndefault = [\"decode\", \"encode\"]\ndecode = [\"dep:jxl-oxide\"]\nencode = [\"dep:jixel\"]\n\n[dependencies]\nthiserror = \"2\"\n\n[dependencies.jxl-oxide]\noptional = true\nversion = \"0.12\"\ndefault-features = false\n\n[dev-dependencies.craft-cms]\npath = \"crates/cms\"\n\n[target.\"cfg(not(target_arch = \\\"wasm32\\\"))\".dependencies.jixel]\noptional = true\nversion = \"=0.3.4\"\n", + "dest": "cargo/vendor-git/cb31475a7a9d19c00f48b4c43603f2f1a464c6dce15da1d21bba4c653eeba6b2/craft-jxl", + "dest-filename": "Cargo.toml" + }, + { + "type": "inline", + "contents": "{\"package\": null, \"files\": {}}", + "dest": "cargo/vendor-git/cb31475a7a9d19c00f48b4c43603f2f1a464c6dce15da1d21bba4c653eeba6b2/craft-jxl", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "shell", + "commands": [ + "mkdir -p \"cargo/vendor-git/6f5ad8618176b3fc0aac703e6e74df7229b0350b4574c7edbe0bb86c53c1cb6c\" && cp -r --reflink=auto \"flatpak-cargo/git/craft-libs-5c91598/crates/media\" \"cargo/vendor-git/6f5ad8618176b3fc0aac703e6e74df7229b0350b4574c7edbe0bb86c53c1cb6c/craft-media\"" + ] + }, + { + "type": "inline", + "contents": "[package]\nname = \"craft-media\"\ndescription = \"Bit-level I/O, clean-room ISO BMFF (MP4), QuickTime (MOV) and Matroska (MKV, WebM) and MXF demuxers and muxers, and Ogg, AVI and MPEG-TS/PS demuxers.\"\nversion = \"0.1.0\"\nedition = \"2024\"\nlicense = \"MIT OR Apache-2.0\"\nrust-version = \"1.95\"\nrepository = \"https://github.com/storytold/craft-libs\"\n\n[package.metadata.docs.rs]\nall-features = true\n\n[lints.rust]\nunsafe_code = \"forbid\"\nunused_workspace_dependencies = \"allow\"\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(craft_pdf_unicode_fixtures)\"]\n\n[lints.clippy]\ncognitive_complexity = \"deny\"\ntoo_many_arguments = \"deny\"\nunused_workspace_dependencies = \"allow\"\nwildcard_imports = \"deny\"\ndbg_macro = \"warn\"\ntodo = \"warn\"\n\n[features]\ndefault = [\"isobmff\"]\nbitstream = []\nisobmff = [\"bitstream\", \"dep:thiserror\"]\nmatroska = []\navi = []\nmxf = [\"dep:chrono\"]\nmpegts = []\nogg = []\nserde = [\"dep:serde\"]\n\n[dependencies.thiserror]\noptional = true\nversion = \"2\"\n\n[dependencies.serde]\noptional = true\nversion = \"1\"\nfeatures = [\"derive\"]\n\n[dependencies.chrono]\noptional = true\nversion = \"0.4.45\"\ndefault-features = false\nfeatures = [\"std\"]\n\n[dev-dependencies]\nproptest = \"1\"\nserde_json = \"1\"\n\n[dev-dependencies.craft-media-testkit]\npath = \"crates/media-testkit\"\n\n[[test]]\nname = \"fuzz\"\nrequired-features = [\"isobmff\"]\n\n[[test]]\nname = \"fuzz_matroska\"\nrequired-features = [\"matroska\"]\n\n[[test]]\nname = \"oracle_avi\"\nrequired-features = [\"avi\"]\n\n[[test]]\nname = \"oracle_avi_mux\"\nrequired-features = [\"avi\"]\n\n[[test]]\nname = \"oracle_demux\"\nrequired-features = [\"isobmff\"]\n\n[[test]]\nname = \"oracle_matroska\"\nrequired-features = [\"matroska\"]\n\n[[test]]\nname = \"oracle_mpegts\"\nrequired-features = [\"mpegts\"]\n\n[[test]]\nname = \"oracle_mux\"\nrequired-features = [\"isobmff\"]\n\n[[test]]\nname = \"oracle_mxf\"\nrequired-features = [\"mxf\"]\n\n[[test]]\nname = \"oracle_ogg\"\nrequired-features = [\"ogg\"]\n\n[[test]]\nname = \"roundtrip\"\nrequired-features = [\"isobmff\"]\n", + "dest": "cargo/vendor-git/6f5ad8618176b3fc0aac703e6e74df7229b0350b4574c7edbe0bb86c53c1cb6c/craft-media", + "dest-filename": "Cargo.toml" + }, + { + "type": "inline", + "contents": "{\"package\": null, \"files\": {}}", + "dest": "cargo/vendor-git/6f5ad8618176b3fc0aac703e6e74df7229b0350b4574c7edbe0bb86c53c1cb6c/craft-media", "dest-filename": ".cargo-checksum.json" }, { @@ -1801,6 +1867,24 @@ "dest": "cargo/vendor-git/cb31475a7a9d19c00f48b4c43603f2f1a464c6dce15da1d21bba4c653eeba6b2/craft-metadata", "dest-filename": ".cargo-checksum.json" }, + { + "type": "shell", + "commands": [ + "mkdir -p \"cargo/vendor-git/9100d311acc530b0286234c55b78dbdc0325d5e30950478c5c7864bfed7a4545\" && cp -r --reflink=auto \"flatpak-cargo/git/craft-libs-5ac7c96/crates/metadata\" \"cargo/vendor-git/9100d311acc530b0286234c55b78dbdc0325d5e30950478c5c7864bfed7a4545/craft-metadata\"" + ] + }, + { + "type": "inline", + "contents": "[package]\nname = \"craft-metadata\"\ndescription = \"Photo metadata: EXIF, IPTC-IIM, XMP packets (read, write, merge) and GPX track logs, the blocks that carry them in JPEG, PNG, WebP, TIFF and CR3 files, and one model they all read into.\"\nversion = \"0.1.0\"\nedition = \"2024\"\nlicense = \"MIT OR Apache-2.0\"\nrust-version = \"1.95\"\nrepository = \"https://github.com/storytold/craft-libs\"\n\n[lints.rust]\nunsafe_code = \"forbid\"\nunused_workspace_dependencies = \"allow\"\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(craft_pdf_unicode_fixtures)\"]\n\n[lints.clippy]\ncognitive_complexity = \"deny\"\ntoo_many_arguments = \"deny\"\nunused_workspace_dependencies = \"allow\"\nwildcard_imports = \"deny\"\ndbg_macro = \"warn\"\ntodo = \"warn\"\n\n[dependencies]\nquick-xml = \"0.41\"\n\n[dependencies.craft-tiff]\npath = \"crates/tiff\"\n\n[dependencies.serde]\nversion = \"1\"\nfeatures = [\"derive\"]\n\n[dependencies.chrono]\nversion = \"0.4.45\"\ndefault-features = false\nfeatures = [\"std\"]\n\n[dependencies.brotli-decompressor]\nversion = \"6\"\ndefault-features = false\nfeatures = [\"std\"]\n\n[dev-dependencies]\nproptest = \"1\"\nserde_json = \"1\"\n\n[dev-dependencies.brotli]\nversion = \"9\"\ndefault-features = false\nfeatures = [\"std\"]\n", + "dest": "cargo/vendor-git/9100d311acc530b0286234c55b78dbdc0325d5e30950478c5c7864bfed7a4545/craft-metadata", + "dest-filename": "Cargo.toml" + }, + { + "type": "inline", + "contents": "{\"package\": null, \"files\": {}}", + "dest": "cargo/vendor-git/9100d311acc530b0286234c55b78dbdc0325d5e30950478c5c7864bfed7a4545/craft-metadata", + "dest-filename": ".cargo-checksum.json" + }, { "type": "shell", "commands": [ @@ -1909,6 +1993,24 @@ "dest": "cargo/vendor-git/cb31475a7a9d19c00f48b4c43603f2f1a464c6dce15da1d21bba4c653eeba6b2/craft-tiff", "dest-filename": ".cargo-checksum.json" }, + { + "type": "shell", + "commands": [ + "mkdir -p \"cargo/vendor-git/9100d311acc530b0286234c55b78dbdc0325d5e30950478c5c7864bfed7a4545\" && cp -r --reflink=auto \"flatpak-cargo/git/craft-libs-5ac7c96/crates/tiff\" \"cargo/vendor-git/9100d311acc530b0286234c55b78dbdc0325d5e30950478c5c7864bfed7a4545/craft-tiff\"" + ] + }, + { + "type": "inline", + "contents": "[package]\nname = \"craft-tiff\"\ndescription = \"TIFF and BigTIFF IFD reader and writer: every field type, the Exif/GPS/Interop pointer IFDs, maker-note IFDs, strip and tile layout.\"\nversion = \"0.1.0\"\nedition = \"2024\"\nlicense = \"MIT OR Apache-2.0\"\nrust-version = \"1.95\"\nrepository = \"https://github.com/storytold/craft-libs\"\n\n[lints.rust]\nunsafe_code = \"forbid\"\nunused_workspace_dependencies = \"allow\"\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(craft_pdf_unicode_fixtures)\"]\n\n[lints.clippy]\ncognitive_complexity = \"deny\"\ntoo_many_arguments = \"deny\"\nunused_workspace_dependencies = \"allow\"\nwildcard_imports = \"deny\"\ndbg_macro = \"warn\"\ntodo = \"warn\"\n\n[dependencies]\nthiserror = \"2\"\n\n[dependencies.serde]\nversion = \"1\"\nfeatures = [\"derive\"]\n\n[dev-dependencies]\nproptest = \"1\"\n", + "dest": "cargo/vendor-git/9100d311acc530b0286234c55b78dbdc0325d5e30950478c5c7864bfed7a4545/craft-tiff", + "dest-filename": "Cargo.toml" + }, + { + "type": "inline", + "contents": "{\"package\": null, \"files\": {}}", + "dest": "cargo/vendor-git/9100d311acc530b0286234c55b78dbdc0325d5e30950478c5c7864bfed7a4545/craft-tiff", + "dest-filename": ".cargo-checksum.json" + }, { "type": "shell", "commands": [ @@ -1963,6 +2065,24 @@ "dest": "cargo/vendor-git/4765c8f813a43ec0005270c9f4b16bff2eb2e09aeb15e4230bcd10e5bba1c4ba/craft-update", "dest-filename": ".cargo-checksum.json" }, + { + "type": "shell", + "commands": [ + "mkdir -p \"cargo/vendor-git/6f5ad8618176b3fc0aac703e6e74df7229b0350b4574c7edbe0bb86c53c1cb6c\" && cp -r --reflink=auto \"flatpak-cargo/git/craft-libs-5c91598/crates/video\" \"cargo/vendor-git/6f5ad8618176b3fc0aac703e6e74df7229b0350b4574c7edbe0bb86c53c1cb6c/craft-video\"" + ] + }, + { + "type": "inline", + "contents": "[package]\nname = \"craft-video\"\ndescription = \"Clean-room pure-Rust video codecs, one feature per codec: DNxHD/DNxHR, VP8, ProRes, H.264, HEVC, VP9, AV1, MPEG-4 Part 2.\"\nversion = \"0.1.0\"\nedition = \"2024\"\nlicense = \"MIT OR Apache-2.0\"\nrust-version = \"1.95\"\nrepository = \"https://github.com/storytold/craft-libs\"\n\n[package.metadata.docs.rs]\nall-features = true\n\n[lints.rust]\nunsafe_code = \"forbid\"\nunused_workspace_dependencies = \"allow\"\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(craft_pdf_unicode_fixtures)\"]\n\n[lints.clippy]\ncognitive_complexity = \"deny\"\ntoo_many_arguments = \"deny\"\nunused_workspace_dependencies = \"allow\"\nwildcard_imports = \"deny\"\ndbg_macro = \"warn\"\ntodo = \"warn\"\n\n[features]\ndnx = []\napv = [\"apv-decode\", \"apv-encode\"]\napv-decode = [\"craft-media/bitstream\"]\napv-encode = [\"craft-media/bitstream\"]\nvp8 = [\"vp8-decode\", \"vp8-encode\"]\nvp8-decode = []\nvp8-encode = []\nmpeg2 = [\"mpeg2-decode\", \"mpeg2-encode\"]\nmpeg2-decode = []\nmpeg2-encode = [\"mpeg2-decode\"]\nmpeg4 = [\"mpeg4-encode\"]\nmpeg4-encode = [\"craft-media/bitstream\"]\nffv1 = []\nprores = [\"craft-media/bitstream\"]\nh264 = [\"h264-decode\", \"h264-encode\"]\nh264-decode = [\"craft-media/bitstream\"]\nh264-encode = [\"craft-media/isobmff\"]\nhevc = [\"hevc-decode\", \"hevc-encode\"]\nhevc-decode = [\"craft-media/bitstream\"]\nhevc-encode = [\"craft-media/isobmff\"]\nvp9 = [\"vp9-decode\", \"vp9-encode\"]\nvp9-decode = [\"craft-media/bitstream\"]\nvp9-encode = [\"craft-media/isobmff\"]\nav1 = [\"av1-decode\", \"av1-encode\"]\nav1-decode = []\nav1-encode = [\"craft-media/isobmff\"]\nav1-large-encode = [\"av1-encode\", \"dep:rav1e\"]\nthreads = [\"dep:rayon\", \"rav1e?/threading\"]\n\n[dependencies]\nthiserror = \"2\"\n\n[dependencies.craft-media]\npath = \"crates/media\"\ndefault-features = false\n\n[dependencies.rayon]\noptional = true\nversion = \"1\"\n\n[target.\"cfg(not(target_arch = \\\"wasm32\\\"))\".dependencies.rav1e]\nversion = \"0.8\"\ndefault-features = false\noptional = true\n\n[dev-dependencies.craft-media-testkit]\npath = \"crates/media-testkit\"\n\n[dev-dependencies.craft-media]\nfeatures = [\"avi\"]\npath = \"crates/media\"\ndefault-features = false\n\n[[test]]\nname = \"dnx\"\nrequired-features = [\"dnx\"]\n\n[[test]]\nname = \"apv\"\nrequired-features = [\"apv\"]\n\n[[test]]\nname = \"vp8\"\nrequired-features = [\"vp8-decode\"]\n\n[[test]]\nname = \"av1_decode\"\nrequired-features = [\"av1-decode\"]\n\n[[test]]\nname = \"h264_decode\"\nrequired-features = [\"h264-decode\"]\n\n[[test]]\nname = \"h264_encode\"\nrequired-features = [\"h264-encode\"]\n\n[[test]]\nname = \"hevc_decode\"\nrequired-features = [\"hevc-decode\"]\n\n[[test]]\nname = \"vp8_encode\"\nrequired-features = [\"vp8\"]\n\n[[test]]\nname = \"vp9_decode\"\nrequired-features = [\"vp9-decode\"]\n\n[[test]]\nname = \"mpeg4_encode\"\nrequired-features = [\"mpeg4-encode\"]\n\n[[test]]\nname = \"mpeg2\"\nrequired-features = [\"mpeg2-decode\"]\n\n[[test]]\nname = \"ffv1\"\nrequired-features = [\"ffv1\"]\n\n[[test]]\nname = \"prores\"\nrequired-features = [\"prores\"]\n\n[[test]]\nname = \"hevc\"\nrequired-features = [\"hevc-encode\"]\n\n[[test]]\nname = \"av1\"\nrequired-features = [\"av1\"]\n\n[[example]]\nname = \"vp8_fuzz\"\nrequired-features = [\"vp8-decode\"]\n\n[[example]]\nname = \"vp8_vp8dec\"\nrequired-features = [\"vp8-decode\"]\n\n[[example]]\nname = \"av1_av1dec\"\nrequired-features = [\"av1-decode\"]\n\n[[example]]\nname = \"h264_h264dec\"\nrequired-features = [\"h264-decode\"]\n\n[[example]]\nname = \"h264_h264enc_bench\"\nrequired-features = [\"h264-encode\"]\ntest = true\n\n[[example]]\nname = \"hevc_hevcdec\"\nrequired-features = [\"hevc-decode\"]\n\n[[example]]\nname = \"vp9_vp9dec\"\nrequired-features = [\"vp9-decode\"]\n", + "dest": "cargo/vendor-git/6f5ad8618176b3fc0aac703e6e74df7229b0350b4574c7edbe0bb86c53c1cb6c/craft-video", + "dest-filename": "Cargo.toml" + }, + { + "type": "inline", + "contents": "{\"package\": null, \"files\": {}}", + "dest": "cargo/vendor-git/6f5ad8618176b3fc0aac703e6e74df7229b0350b4574c7edbe0bb86c53c1cb6c/craft-video", + "dest-filename": ".cargo-checksum.json" + }, { "type": "shell", "commands": [ @@ -10071,7 +10191,7 @@ }, { "type": "inline", - "contents": "[source.vendored-sources]\ndirectory = \"cargo/vendor\"\n\n[source.crates-io]\nreplace-with = \"vendored-sources\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=94777dcf7f8962476e96b049d08d22e25b9330c2\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-6fd0ceba5f4137be1fe00e9c031f810234e38df6f60195003fed7057c96f0aa1\"\nrev = \"94777dcf7f8962476e96b049d08d22e25b9330c2\"\n\n[source.git-vendor-6fd0ceba5f4137be1fe00e9c031f810234e38df6f60195003fed7057c96f0aa1]\ndirectory = \"cargo/vendor-git/6fd0ceba5f4137be1fe00e9c031f810234e38df6f60195003fed7057c96f0aa1\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=f0f4758c01581d79577b9bf5046c06f4e77b1f18\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-bc00bd22a20692df38f25839a8568cd55b90e379a41719721bbc0f04fe5e29f7\"\nrev = \"f0f4758c01581d79577b9bf5046c06f4e77b1f18\"\n\n[source.git-vendor-bc00bd22a20692df38f25839a8568cd55b90e379a41719721bbc0f04fe5e29f7]\ndirectory = \"cargo/vendor-git/bc00bd22a20692df38f25839a8568cd55b90e379a41719721bbc0f04fe5e29f7\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=c5a1cbfb5f9049f9270955caffb5bee5997aebf7\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-11a22760e699d74db2deeccbdb390b343ad010ce425dcb15451f0e14e45ff298\"\nrev = \"c5a1cbfb5f9049f9270955caffb5bee5997aebf7\"\n\n[source.git-vendor-11a22760e699d74db2deeccbdb390b343ad010ce425dcb15451f0e14e45ff298]\ndirectory = \"cargo/vendor-git/11a22760e699d74db2deeccbdb390b343ad010ce425dcb15451f0e14e45ff298\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=9dcbd90c7d16e1a668b3afa057e940e2db328b93\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-36bf00be069421f8a8a7428c4360efee8b4243207a59d7b566c6f48fc5918f61\"\nrev = \"9dcbd90c7d16e1a668b3afa057e940e2db328b93\"\n\n[source.git-vendor-36bf00be069421f8a8a7428c4360efee8b4243207a59d7b566c6f48fc5918f61]\ndirectory = \"cargo/vendor-git/36bf00be069421f8a8a7428c4360efee8b4243207a59d7b566c6f48fc5918f61\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=b77af389f30bb10de10d8436ca9b39fe94e3bb67\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-a51e2c3f46af71f1caed91009f88b4f9982db0c4152c6659d11967a7731b1ccc\"\nrev = \"b77af389f30bb10de10d8436ca9b39fe94e3bb67\"\n\n[source.git-vendor-a51e2c3f46af71f1caed91009f88b4f9982db0c4152c6659d11967a7731b1ccc]\ndirectory = \"cargo/vendor-git/a51e2c3f46af71f1caed91009f88b4f9982db0c4152c6659d11967a7731b1ccc\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-cb31475a7a9d19c00f48b4c43603f2f1a464c6dce15da1d21bba4c653eeba6b2\"\nrev = \"478c50560d3c6fad3d613af2a30b35c3bc9f4c0f\"\n\n[source.git-vendor-cb31475a7a9d19c00f48b4c43603f2f1a464c6dce15da1d21bba4c653eeba6b2]\ndirectory = \"cargo/vendor-git/cb31475a7a9d19c00f48b4c43603f2f1a464c6dce15da1d21bba4c653eeba6b2\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=0fd30aeb3e02207d9d4c7c601540d9da45abf8de\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-fafb086755da4e9bf32b4ac1b53a42a6017167d56ec0071462788465fa35eb30\"\nrev = \"0fd30aeb3e02207d9d4c7c601540d9da45abf8de\"\n\n[source.git-vendor-fafb086755da4e9bf32b4ac1b53a42a6017167d56ec0071462788465fa35eb30]\ndirectory = \"cargo/vendor-git/fafb086755da4e9bf32b4ac1b53a42a6017167d56ec0071462788465fa35eb30\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=6e03f65bf45181db77ba6229716e6624db9eb25b\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-4765c8f813a43ec0005270c9f4b16bff2eb2e09aeb15e4230bcd10e5bba1c4ba\"\nrev = \"6e03f65bf45181db77ba6229716e6624db9eb25b\"\n\n[source.git-vendor-4765c8f813a43ec0005270c9f4b16bff2eb2e09aeb15e4230bcd10e5bba1c4ba]\ndirectory = \"cargo/vendor-git/4765c8f813a43ec0005270c9f4b16bff2eb2e09aeb15e4230bcd10e5bba1c4ba\"\n\n[source.\"https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a\"]\ngit = \"https://github.com/storytold/egui\"\nreplace-with = \"git-vendor-11e349eb0774eb3ab9192b38c47d748bf18abba91a0e3952d8f196513da96ee6\"\nrev = \"6d518fc799681571963842f95b55a6b68431b15a\"\n\n[source.git-vendor-11e349eb0774eb3ab9192b38c47d748bf18abba91a0e3952d8f196513da96ee6]\ndirectory = \"cargo/vendor-git/11e349eb0774eb3ab9192b38c47d748bf18abba91a0e3952d8f196513da96ee6\"\n\n[source.\"https://github.com/storytold/winit.git?rev=a517b3846ee8457d84ee4975110bfda6797c44dc\"]\ngit = \"https://github.com/storytold/winit\"\nreplace-with = \"git-vendor-9c7f809a50c4212d761a5b6359c5e4a02fcf86376d330a441c4ce9d112706ee9\"\nrev = \"a517b3846ee8457d84ee4975110bfda6797c44dc\"\n\n[source.git-vendor-9c7f809a50c4212d761a5b6359c5e4a02fcf86376d330a441c4ce9d112706ee9]\ndirectory = \"cargo/vendor-git/9c7f809a50c4212d761a5b6359c5e4a02fcf86376d330a441c4ce9d112706ee9\"\n", + "contents": "[source.vendored-sources]\ndirectory = \"cargo/vendor\"\n\n[source.crates-io]\nreplace-with = \"vendored-sources\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=94777dcf7f8962476e96b049d08d22e25b9330c2\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-6fd0ceba5f4137be1fe00e9c031f810234e38df6f60195003fed7057c96f0aa1\"\nrev = \"94777dcf7f8962476e96b049d08d22e25b9330c2\"\n\n[source.git-vendor-6fd0ceba5f4137be1fe00e9c031f810234e38df6f60195003fed7057c96f0aa1]\ndirectory = \"cargo/vendor-git/6fd0ceba5f4137be1fe00e9c031f810234e38df6f60195003fed7057c96f0aa1\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=f0f4758c01581d79577b9bf5046c06f4e77b1f18\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-bc00bd22a20692df38f25839a8568cd55b90e379a41719721bbc0f04fe5e29f7\"\nrev = \"f0f4758c01581d79577b9bf5046c06f4e77b1f18\"\n\n[source.git-vendor-bc00bd22a20692df38f25839a8568cd55b90e379a41719721bbc0f04fe5e29f7]\ndirectory = \"cargo/vendor-git/bc00bd22a20692df38f25839a8568cd55b90e379a41719721bbc0f04fe5e29f7\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=c5a1cbfb5f9049f9270955caffb5bee5997aebf7\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-11a22760e699d74db2deeccbdb390b343ad010ce425dcb15451f0e14e45ff298\"\nrev = \"c5a1cbfb5f9049f9270955caffb5bee5997aebf7\"\n\n[source.git-vendor-11a22760e699d74db2deeccbdb390b343ad010ce425dcb15451f0e14e45ff298]\ndirectory = \"cargo/vendor-git/11a22760e699d74db2deeccbdb390b343ad010ce425dcb15451f0e14e45ff298\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=9dcbd90c7d16e1a668b3afa057e940e2db328b93\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-36bf00be069421f8a8a7428c4360efee8b4243207a59d7b566c6f48fc5918f61\"\nrev = \"9dcbd90c7d16e1a668b3afa057e940e2db328b93\"\n\n[source.git-vendor-36bf00be069421f8a8a7428c4360efee8b4243207a59d7b566c6f48fc5918f61]\ndirectory = \"cargo/vendor-git/36bf00be069421f8a8a7428c4360efee8b4243207a59d7b566c6f48fc5918f61\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=b77af389f30bb10de10d8436ca9b39fe94e3bb67\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-a51e2c3f46af71f1caed91009f88b4f9982db0c4152c6659d11967a7731b1ccc\"\nrev = \"b77af389f30bb10de10d8436ca9b39fe94e3bb67\"\n\n[source.git-vendor-a51e2c3f46af71f1caed91009f88b4f9982db0c4152c6659d11967a7731b1ccc]\ndirectory = \"cargo/vendor-git/a51e2c3f46af71f1caed91009f88b4f9982db0c4152c6659d11967a7731b1ccc\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-cb31475a7a9d19c00f48b4c43603f2f1a464c6dce15da1d21bba4c653eeba6b2\"\nrev = \"478c50560d3c6fad3d613af2a30b35c3bc9f4c0f\"\n\n[source.git-vendor-cb31475a7a9d19c00f48b4c43603f2f1a464c6dce15da1d21bba4c653eeba6b2]\ndirectory = \"cargo/vendor-git/cb31475a7a9d19c00f48b4c43603f2f1a464c6dce15da1d21bba4c653eeba6b2\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-9100d311acc530b0286234c55b78dbdc0325d5e30950478c5c7864bfed7a4545\"\nrev = \"5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a\"\n\n[source.git-vendor-9100d311acc530b0286234c55b78dbdc0325d5e30950478c5c7864bfed7a4545]\ndirectory = \"cargo/vendor-git/9100d311acc530b0286234c55b78dbdc0325d5e30950478c5c7864bfed7a4545\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=5c91598ccc86537a779f438d520fa6406c26efe6\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-6f5ad8618176b3fc0aac703e6e74df7229b0350b4574c7edbe0bb86c53c1cb6c\"\nrev = \"5c91598ccc86537a779f438d520fa6406c26efe6\"\n\n[source.git-vendor-6f5ad8618176b3fc0aac703e6e74df7229b0350b4574c7edbe0bb86c53c1cb6c]\ndirectory = \"cargo/vendor-git/6f5ad8618176b3fc0aac703e6e74df7229b0350b4574c7edbe0bb86c53c1cb6c\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=0fd30aeb3e02207d9d4c7c601540d9da45abf8de\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-fafb086755da4e9bf32b4ac1b53a42a6017167d56ec0071462788465fa35eb30\"\nrev = \"0fd30aeb3e02207d9d4c7c601540d9da45abf8de\"\n\n[source.git-vendor-fafb086755da4e9bf32b4ac1b53a42a6017167d56ec0071462788465fa35eb30]\ndirectory = \"cargo/vendor-git/fafb086755da4e9bf32b4ac1b53a42a6017167d56ec0071462788465fa35eb30\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=6e03f65bf45181db77ba6229716e6624db9eb25b\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-4765c8f813a43ec0005270c9f4b16bff2eb2e09aeb15e4230bcd10e5bba1c4ba\"\nrev = \"6e03f65bf45181db77ba6229716e6624db9eb25b\"\n\n[source.git-vendor-4765c8f813a43ec0005270c9f4b16bff2eb2e09aeb15e4230bcd10e5bba1c4ba]\ndirectory = \"cargo/vendor-git/4765c8f813a43ec0005270c9f4b16bff2eb2e09aeb15e4230bcd10e5bba1c4ba\"\n\n[source.\"https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a\"]\ngit = \"https://github.com/storytold/egui\"\nreplace-with = \"git-vendor-11e349eb0774eb3ab9192b38c47d748bf18abba91a0e3952d8f196513da96ee6\"\nrev = \"6d518fc799681571963842f95b55a6b68431b15a\"\n\n[source.git-vendor-11e349eb0774eb3ab9192b38c47d748bf18abba91a0e3952d8f196513da96ee6]\ndirectory = \"cargo/vendor-git/11e349eb0774eb3ab9192b38c47d748bf18abba91a0e3952d8f196513da96ee6\"\n\n[source.\"https://github.com/storytold/winit.git?rev=a517b3846ee8457d84ee4975110bfda6797c44dc\"]\ngit = \"https://github.com/storytold/winit\"\nreplace-with = \"git-vendor-9c7f809a50c4212d761a5b6359c5e4a02fcf86376d330a441c4ce9d112706ee9\"\nrev = \"a517b3846ee8457d84ee4975110bfda6797c44dc\"\n\n[source.git-vendor-9c7f809a50c4212d761a5b6359c5e4a02fcf86376d330a441c4ce9d112706ee9]\ndirectory = \"cargo/vendor-git/9c7f809a50c4212d761a5b6359c5e4a02fcf86376d330a441c4ce9d112706ee9\"\n", "dest": "cargo", "dest-filename": "config" }