diff --git a/Cargo.lock b/Cargo.lock index 222619ab31..c1169062ef 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1213,7 +1213,7 @@ source = "git+https://github.com/storytold/craft-libs?rev=f0f4758c01581d79577b9b [[package]] name = "craft-crw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845#c28356d400aed7575b04ec1551b4665107cfe845" +source = "git+https://github.com/storytold/craft-libs?rev=3a6613f058e355a4fd8d196b2f385260bd4b4a8e#3a6613f058e355a4fd8d196b2f385260bd4b4a8e" dependencies = [ "thiserror 2.0.21", ] @@ -1381,6 +1381,18 @@ name = "craft-media" version = "0.1.0" source = "git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845#c28356d400aed7575b04ec1551b4665107cfe845" +[[package]] +name = "craft-metadata" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=3a6613f058e355a4fd8d196b2f385260bd4b4a8e#3a6613f058e355a4fd8d196b2f385260bd4b4a8e" +dependencies = [ + "brotli-decompressor 6.0.1", + "chrono", + "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3a6613f058e355a4fd8d196b2f385260bd4b4a8e)", + "quick-xml 0.41.0", + "serde", +] + [[package]] name = "craft-metadata" version = "0.1.0" @@ -1446,12 +1458,12 @@ dependencies = [ [[package]] name = "craft-raw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845#c28356d400aed7575b04ec1551b4665107cfe845" +source = "git+https://github.com/storytold/craft-libs?rev=3a6613f058e355a4fd8d196b2f385260bd4b4a8e#3a6613f058e355a4fd8d196b2f385260bd4b4a8e" dependencies = [ "chrono", "craft-crw", - "craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845)", - "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845)", + "craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3a6613f058e355a4fd8d196b2f385260bd4b4a8e)", + "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3a6613f058e355a4fd8d196b2f385260bd4b4a8e)", "jxl-oxide", "miniz_oxide 0.9.1", "rayon", @@ -1461,6 +1473,15 @@ dependencies = [ "zune-jpeg", ] +[[package]] +name = "craft-tiff" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=3a6613f058e355a4fd8d196b2f385260bd4b4a8e#3a6613f058e355a4fd8d196b2f385260bd4b4a8e" +dependencies = [ + "serde", + "thiserror 2.0.21", +] + [[package]] name = "craft-tiff" version = "0.1.0" @@ -3997,9 +4018,9 @@ dependencies = [ "craft-image-codecs 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845)", "craft-jpeg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f)", "craft-jxl", - "craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845)", + "craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3a6613f058e355a4fd8d196b2f385260bd4b4a8e)", "craft-psd", - "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845)", + "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3a6613f058e355a4fd8d196b2f385260bd4b4a8e)", "craft-video 0.1.0 (git+https://github.com/storytold/craft-libs?rev=5c91598ccc86537a779f438d520fa6406c26efe6)", "dhat", "jpeg-encoder 0.7.1", @@ -4080,7 +4101,7 @@ dependencies = [ "craft-mime", "craft-pdf", "craft-plist", - "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845)", + "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3a6613f058e355a4fd8d196b2f385260bd4b4a8e)", "crc32fast", "fs4", "harfrust 0.13.3", @@ -4237,10 +4258,10 @@ version = "0.21.1" dependencies = [ "chrono", "craft-heif", - "craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845)", + "craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3a6613f058e355a4fd8d196b2f385260bd4b4a8e)", "craft-psd", "craft-raw", - "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845)", + "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3a6613f058e355a4fd8d196b2f385260bd4b4a8e)", "lightcraft-geom", "proptest", "serde", @@ -4297,7 +4318,7 @@ dependencies = [ "craft-image-codecs 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845)", "craft-jxl", "craft-raw", - "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845)", + "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3a6613f058e355a4fd8d196b2f385260bd4b4a8e)", "dhat", "jixel", "lightcraft-color", diff --git a/Cargo.toml b/Cargo.toml index 4b1402d458..1e74b863a5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "b77af389f3 craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "478c50560d3c6fad3d613af2a30b35c3bc9f4c0f", 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 = "c28356d400aed7575b04ec1551b4665107cfe845" } +craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "3a6613f058e355a4fd8d196b2f385260bd4b4a8e" } craft-jpeg = { git = "https://github.com/storytold/craft-libs", rev = "478c50560d3c6fad3d613af2a30b35c3bc9f4c0f" } craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "c28356d400aed7575b04ec1551b4665107cfe845" } craft-video = { git = "https://github.com/storytold/craft-libs", rev = "5c91598ccc86537a779f438d520fa6406c26efe6", features = ["av1", "av1-large-encode", "threads"] } @@ -48,8 +48,8 @@ lightcraft-wincolor = { path = "crates/wincolor" } lightcraft-color = { path = "crates/color" } lightcraft-raster = { path = "crates/raster" } # TIFF/IFD: the shared reader and writer (moved from crates/tiff; craft-libs#783). -craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "c28356d400aed7575b04ec1551b4665107cfe845" } -craft-raw = { git = "https://github.com/storytold/craft-libs", rev = "c28356d400aed7575b04ec1551b4665107cfe845" } +craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "3a6613f058e355a4fd8d196b2f385260bd4b4a8e" } +craft-raw = { git = "https://github.com/storytold/craft-libs", rev = "3a6613f058e355a4fd8d196b2f385260bd4b4a8e" } lightcraft-raw = { path = "crates/raw" } lightcraft-codecs = { path = "crates/codecs" } lightcraft-meta = { path = "crates/meta" } diff --git a/crates/raw/src/dngwrite.rs b/crates/raw/src/dngwrite.rs index c850a94d4d..d705f10c4a 100644 --- a/crates/raw/src/dngwrite.rs +++ b/crates/raw/src/dngwrite.rs @@ -1,11 +1,9 @@ //! Writing DNG files from a [`RawImage`] (uncompressed or lossless-JPEG tiles), used for DNG export and for //! bit-exact decoder round-trip tests. The raw image is stored in IFD0 (allowed by DNG 1.7 §"File Structure"). -use crate::{RawData, RawError, RawImage, Result, ljpeg, opcodes}; -use craft_tiff::tags::{self as t, compression, photometric}; -use craft_tiff::writer::{rational, srational}; -use craft_tiff::{ByteOrder, IfdBuilder, ImageData, TiffWriter, Value}; -use lightcraft_color::Mat3; +use crate::{RawData, RawError, RawImage, Result}; +pub use craft_raw::dngwrite::f32_to_f16; +use craft_tiff::ByteOrder; use rayon::prelude::*; #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -90,69 +88,6 @@ fn lossy_source(raw: &RawImage, long_edge: Option) -> Result { /// the sensor origin instead of the ActiveArea (the reader keeps their original reading). pub const SOFTWARE: &str = "LightCraft DNG 2"; -/// zlib level of Deflate tiles. On a 67 MP focus-stack merge (half floats) level 6 took 7× as long as level 1 -/// (3.9 s vs 0.55 s on 4 cores) to save 3 % of the file (266 vs 275 MB); 5–12 % on raw and rendered DNGs. -const DEFLATE_LEVEL: u8 = 1; - -/// Largest Deflate tile edge the writer pads to (`tile` is caller-supplied in [`DngCompression::Deflate`]): -/// square-tile buffers grow with the square, so an unclamped edge lets a request pad a tiny valid image into -/// a multi-gigabyte buffer and billions of edge-replicate iterations. 2048² samples (≤ 24 MB of f32) is far -/// above the 256 default and every real tile this writer makes. -const MAX_DEFLATE_TILE: u32 = 2048; - -/// `tile` aligned down to a multiple of 16 and clamped to [`MAX_DEFLATE_TILE`]. -fn deflate_tile(tile: u32) -> usize { - (tile.max(16) & !15).min(MAX_DEFLATE_TILE) as usize -} - -/// IEEE 754 binary32 → binary16 (round to nearest even; overflow → ±inf, NaN kept). -pub fn f32_to_f16(v: f32) -> u16 { - let b = v.to_bits(); - let sign = ((b >> 16) & 0x8000) as u16; - let exp = ((b >> 23) & 0xff) as i32; - let man = b & 0x7f_ffff; - if exp == 0xff { - return sign | 0x7c00 | if man != 0 { 0x200 } else { 0 }; - } - let e = exp - 127 + 15; - if e >= 0x1f { - return sign | 0x7c00; - } - if e <= 0 { - if e < -10 { - return sign; - } - // subnormal half - let m = man | 0x80_0000; - let shift = (14 - e) as u32; - let half = m >> shift; - let rem = m & ((1 << shift) - 1); - let mid = 1 << (shift - 1); - let r = if rem > mid || (rem == mid && half & 1 == 1) { half + 1 } else { half }; - return sign | r as u16; - } - let half = ((e as u32) << 10) | (man >> 13); - let rem = man & 0x1fff; - let r = if rem > 0x1000 || (rem == 0x1000 && half & 1 == 1) { half + 1 } else { half }; - sign | r as u16 -} - -/// Apply the floating-point predictor (inverse of `unpack::undo_float_predictor`) to one row of -/// `n` big-endian samples of `bytes_per` bytes: split into byte planes (most significant first), then -/// byte-difference with `stride` samples. -fn float_predict(row: &[u8], n: usize, bytes_per: usize, stride: usize) -> Vec { - let mut planes = vec![0u8; row.len()]; - for i in 0..n { - for b in 0..bytes_per { - planes[b * n + i] = row[i * bytes_per + b]; - } - } - for i in (stride..planes.len()).rev() { - planes[i] = planes[i].wrapping_sub(planes[i - stride]); - } - planes -} - #[derive(Clone, Debug, PartialEq)] pub struct DngWriteOptions { pub compression: DngCompression, @@ -167,15 +102,7 @@ impl Default for DngWriteOptions { } } -fn srat_mat(m: &Mat3) -> Value { - Value::SRational(m.0.iter().flatten().map(|&v| srational(v)).collect()) -} - -fn rat_vec(v: &[f64]) -> Value { - Value::Rational(v.iter().map(|&x| rational(x)).collect()) -} - -/// Serialise `raw` as a DNG. +/// Serialise `raw` as a DNG. Development, resize and the lossy transfer curve remain application policy. pub fn write_dng(raw: &RawImage, opts: &DngWriteOptions) -> Result> { raw.validate()?; let lossy; @@ -186,320 +113,66 @@ pub fn write_dng(raw: &RawImage, opts: &DngWriteOptions) -> Result> { } _ => raw, }; - let (w, h, cpp) = (raw.width, raw.height, raw.cpp); - let mut ifd = IfdBuilder::new(); - ifd.set(t::NEW_SUBFILE_TYPE, Value::Long(vec![0])); - ifd.set(t::IMAGE_WIDTH, Value::Long(vec![w as u32])); - ifd.set(t::IMAGE_LENGTH, Value::Long(vec![h as u32])); - ifd.set(t::SAMPLES_PER_PIXEL, Value::Short(vec![cpp as u16])); - ifd.set(t::PLANAR_CONFIGURATION, Value::Short(vec![1])); - ifd.set(t::PHOTOMETRIC, Value::Short(vec![if raw.cfa.is_some() { photometric::CFA } else { photometric::LINEAR_RAW }])); - ifd.set(t::DNG_VERSION, Value::Byte(vec![1, 4, 0, 0])); - ifd.set(t::DNG_BACKWARD_VERSION, Value::Byte(vec![1, 3, 0, 0])); - let make = raw.metadata.make.as_deref().unwrap_or_default(); - let model = raw.metadata.model.as_deref().unwrap_or_default(); - if !make.is_empty() { - ifd.set(t::MAKE, Value::Ascii(make.to_owned())); - } - if !model.is_empty() { - ifd.set(t::MODEL, Value::Ascii(model.to_owned())); - } - let model_includes_make = !make.is_empty() - && model.get(..make.len()).is_some_and(|prefix| prefix.eq_ignore_ascii_case(make)) - && model.get(make.len()..).is_some_and(|suffix| suffix.chars().next().is_none_or(|c| !c.is_alphanumeric() && c != '_')); - let unique = if model_includes_make || make.is_empty() { - model.to_owned() - } else if model.is_empty() { - make.to_owned() - } else { - format!("{make} {model}") + let color = &raw.color; + let matrices = |pair: &[Option; 2]| pair.map(|matrix| matrix.map(|m| m.0)); + let cinema = craft_raw::CinemaTags::default(); + let view = craft_raw::dngwrite::DngImage { + width: raw.width, + height: raw.height, + cpp: raw.cpp, + data: &raw.data, + cfa: raw.cfa.as_ref(), + bits: raw.bits, + linearized: raw.linearized, + // The app model stores already-decoded samples, not a pending source table. + linearization_table: None, + black: &raw.black, + white: &raw.white, + active_area: raw.active_area, + crop: raw.crop, + orientation: craft_raw::Orientation::from_exif(raw.orientation.to_exif()), + color: craft_raw::dngwrite::DngColor { + illuminant: color.illuminant, + color_matrix: matrices(&color.color_matrix), + forward_matrix: matrices(&color.forward_matrix), + camera_calibration: matrices(&color.camera_calibration), + analog_balance: color.analog_balance, + as_shot_neutral: color.as_shot_neutral, + as_shot_white_xy: color.as_shot_white_xy.map(|xy| [xy.x, xy.y]), + baseline_exposure: color.baseline_exposure, + baseline_sharpness: color.baseline_sharpness, + profile: &color.profile, + }, + wb_multipliers: raw.wb_multipliers, + opcodes: &raw.opcodes, + make: raw.metadata.make.as_deref(), + model: raw.metadata.model.as_deref(), + unique_model: None, + cinema: &cinema, + unknown_camera_model: Some("LightCraft"), }; - ifd.set(t::UNIQUE_CAMERA_MODEL, Value::Ascii(if unique.is_empty() { "LightCraft".into() } else { unique })); - ifd.set(t::ORIENTATION, Value::Short(vec![raw.orientation.to_exif()])); - ifd.set(t::SOFTWARE, Value::Ascii(SOFTWARE.into())); - let xmp = opts.xmp.clone().unwrap_or_else(|| lightcraft_meta::write_xmp(&raw.metadata, None)); - ifd.set(t::XMP, Value::Byte(xmp.into_bytes())); - - if let Some(cfa) = &raw.cfa { - ifd.set(t::CFA_REPEAT_PATTERN_DIM, Value::Short(vec![cfa.height as u16, cfa.width as u16])); - // the tag is anchored at the ActiveArea's top-left, `raw.cfa` at the sensor origin - let a = raw.active_area; - ifd.set(t::CFA_PATTERN_EP, Value::Byte(cfa.shifted(a.x, a.y).pattern)); - ifd.set(t::CFA_PLANE_COLOR, Value::Byte(vec![0, 1, 2])); - ifd.set(t::CFA_LAYOUT, Value::Short(vec![1])); - } - let b = &raw.black; - ifd.set(t::BLACK_LEVEL_REPEAT_DIM, Value::Short(vec![b.repeat_rows as u16, b.repeat_cols as u16])); - let mut bl: Vec = b.values.iter().map(|&v| v as f64).collect(); - if bl.len() == 1 && cpp > 1 { - bl = vec![bl[0]; cpp]; - } - ifd.set(t::BLACK_LEVEL, rat_vec(&bl)); - if !b.delta_h.is_empty() { - ifd.set(t::BLACK_LEVEL_DELTA_H, Value::SRational(b.delta_h.iter().map(|&v| srational(v as f64)).collect())); - } - if !b.delta_v.is_empty() { - ifd.set(t::BLACK_LEVEL_DELTA_V, Value::SRational(b.delta_v.iter().map(|&v| srational(v as f64)).collect())); - } - let white: Vec = (0..cpp).map(|s| raw.white_at(s).round().clamp(0.0, u32::MAX as f32) as u32).collect(); - if matches!(raw.data, RawData::F32(_)) { - ifd.set(t::WHITE_LEVEL, rat_vec(&(0..cpp).map(|s| raw.white_at(s) as f64).collect::>())); - } else { - ifd.set(t::WHITE_LEVEL, Value::Long(white)); - } - let a = raw.active_area; - ifd.set(t::ACTIVE_AREA, Value::Long(vec![a.y as u32, a.x as u32, (a.y + a.height) as u32, (a.x + a.width) as u32])); - ifd.set(t::DEFAULT_CROP_ORIGIN, Value::Long(vec![raw.crop.x as u32, raw.crop.y as u32])); - ifd.set(t::DEFAULT_CROP_SIZE, Value::Long(vec![raw.crop.width as u32, raw.crop.height as u32])); - - let c = &raw.color; - for (i, tag) in [t::CALIBRATION_ILLUMINANT_1, t::CALIBRATION_ILLUMINANT_2].into_iter().enumerate() { - if c.color_matrix[i].is_some() { - ifd.set(tag, Value::Short(vec![c.illuminant[i]])); - } - } - for (pair, tags) in [ - (&c.color_matrix, [t::COLOR_MATRIX_1, t::COLOR_MATRIX_2]), - (&c.forward_matrix, [t::FORWARD_MATRIX_1, t::FORWARD_MATRIX_2]), - (&c.camera_calibration, [t::CAMERA_CALIBRATION_1, t::CAMERA_CALIBRATION_2]), - ] { - for i in 0..2 { - if let Some(m) = &pair[i] { - ifd.set(tags[i], srat_mat(m)); - } - } - } - if let Some(v) = c.analog_balance { - ifd.set(t::ANALOG_BALANCE, rat_vec(&v)); - } - if let Some(v) = c.as_shot_neutral { - ifd.set(t::AS_SHOT_NEUTRAL, rat_vec(&v)); - } else if let Some(xy) = c.as_shot_white_xy { - ifd.set(t::AS_SHOT_WHITE_XY, rat_vec(&[xy.x, xy.y])); - } else if let Some(m) = raw.wb_multipliers.filter(|m| m.iter().all(|v| *v > 0.0 && v.is_finite())) { - // vendor raws (NEF, ARW…) carry white balance as multipliers: the DNG neutral is their reciprocal - ifd.set(t::AS_SHOT_NEUTRAL, rat_vec(&m.map(|v| 1.0 / v as f64))); - } - ifd.set(t::BASELINE_EXPOSURE, Value::SRational(vec![srational(c.baseline_exposure)])); - if let Some(v) = c.baseline_sharpness { - ifd.set(t::BASELINE_SHARPNESS, rat_vec(&[v])); - } - write_profile_tags(&mut ifd, raw, opts.order); - write_opcode_tags(&mut ifd, raw); - - match (&raw.data, opts.compression) { - (RawData::F32(v), DngCompression::Deflate { tile, half }) => { - let tile = deflate_tile(tile); - let bp = if half { 2 } else { 4 }; - ifd.set(t::BITS_PER_SAMPLE, Value::Short(vec![(bp * 8) as u16; cpp])); - ifd.set(t::SAMPLE_FORMAT, Value::Short(vec![3; cpp])); - ifd.set(t::COMPRESSION, Value::Short(vec![compression::ADOBE_DEFLATE])); - ifd.set(t::PREDICTOR, Value::Short(vec![3])); - let (ta, td) = (w.div_ceil(tile), h.div_ceil(tile)); - let tiles: Vec> = (0..ta * td) - .into_par_iter() - .map(|i| { - let (tx, ty) = (i % ta * tile, i / ta * tile); - let mut buf = Vec::with_capacity(tile * tile * cpp * bp); - let mut row = Vec::with_capacity(tile * cpp * bp); - for y in 0..tile { - let sy = (ty + y).min(h - 1); - row.clear(); - for x in 0..tile { - let sx = (tx + x).min(w - 1); - for s in 0..cpp { - let f = v[(sy * w + sx) * cpp + s]; - if half { - row.extend_from_slice(&f32_to_f16(f).to_be_bytes()); - } else { - row.extend_from_slice(&f.to_bits().to_be_bytes()); - } - } - } - buf.extend_from_slice(&float_predict(&row, tile * cpp, bp, cpp)); - } - miniz_oxide::deflate::compress_to_vec_zlib(&buf, DEFLATE_LEVEL) - }) - .collect(); - ifd.set_image(ImageData::Tiles { tile_width: tile as u32, tile_height: tile as u32, tiles }); - } - (RawData::F32(v), _) => { - ifd.set(t::BITS_PER_SAMPLE, Value::Short(vec![32; cpp])); - ifd.set(t::SAMPLE_FORMAT, Value::Short(vec![3; cpp])); - ifd.set(t::COMPRESSION, Value::Short(vec![compression::NONE])); - let mut bytes = Vec::with_capacity(v.len() * 4); - for &x in v { - let mut tmp = Vec::with_capacity(4); - opts.order.put_u32(&mut tmp, x.to_bits()); - bytes.extend_from_slice(&tmp); - } - ifd.set_image(ImageData::Strips { rows_per_strip: h as u32, strips: vec![bytes] }); - } - (RawData::U16(v), DngCompression::LossyJpeg { tile, quality, .. }) => { - // `lossy_source` made 3-sample 8-bit codes - let tile = (tile.clamp(16, 4096) & !15) as usize; - ifd.set(t::BITS_PER_SAMPLE, Value::Short(vec![8; cpp])); - ifd.set(t::COMPRESSION, Value::Short(vec![compression::LOSSY_JPEG])); - ifd.set(t::LINEARIZATION_TABLE, Value::Short(lossy_linearization())); - let quality = quality.clamp(1, 100); - let (ta, td) = (w.div_ceil(tile), h.div_ceil(tile)); - let tiles: Vec> = (0..ta * td) - .into_par_iter() - .map(|i| { - let (tx, ty) = (i % ta * tile, i / ta * tile); - let mut buf = Vec::with_capacity(tile * tile * 3); - for y in 0..tile { - let sy = (ty + y).min(h - 1); - for x in 0..tile { - let sx = (tx + x).min(w - 1); - for s in 0..3 { - buf.push(v.get((sy * w + sx) * cpp + s.min(cpp - 1)).map_or(0, |&c| c.min(255) as u8)); - } - } - } - let ic_img = craft_image_codecs::Image::from_u8(tile as u32, tile as u32, craft_image_codecs::ChannelLayout::Rgb, buf) - .map_err(|e| RawError::Corrupt(format!("lossy JPEG tile: {e}")))?; - let opts = craft_image_codecs::EncodeOptions { jpeg_quality: quality, ..Default::default() }; - craft_image_codecs::encode(&ic_img, craft_image_codecs::Format::Jpeg, &opts) - .map_err(|e| RawError::Corrupt(format!("lossy JPEG tile: {e}"))) - }) - .collect::>()?; - ifd.set_image(ImageData::Tiles { tile_width: tile as u32, tile_height: tile as u32, tiles }); - } - (RawData::U16(v), _) => { - let maxv = v.iter().copied().max().unwrap_or(0); - let bits = (16 - maxv.leading_zeros()).max(raw.bits.min(16)).max(2) as u8; - ifd.set( - t::BITS_PER_SAMPLE, - Value::Short(vec![if matches!(opts.compression, DngCompression::Uncompressed) { 16 } else { bits as u16 }; cpp]), - ); - match opts.compression { - DngCompression::Uncompressed => { - ifd.set(t::COMPRESSION, Value::Short(vec![compression::NONE])); - let rows = (65536 / (w * cpp * 2)).clamp(1, h); - let strips = v - .chunks(rows * w * cpp) - .map(|s| { - let mut b = Vec::with_capacity(s.len() * 2); - s.iter().for_each(|&x| opts.order.put_u16(&mut b, x)); - b - }) - .collect(); - ifd.set_image(ImageData::Strips { rows_per_strip: rows as u32, strips }); - } - DngCompression::Deflate { tile, .. } => { - let tile = deflate_tile(tile); - ifd.set(t::BITS_PER_SAMPLE, Value::Short(vec![16; cpp])); - ifd.set(t::COMPRESSION, Value::Short(vec![compression::ADOBE_DEFLATE])); - ifd.set(t::PREDICTOR, Value::Short(vec![2])); - let (ta, td) = (w.div_ceil(tile), h.div_ceil(tile)); - let tiles: Vec> = (0..ta * td) - .into_par_iter() - .map(|i| { - let (tx, ty) = (i % ta * tile, i / ta * tile); - let mut buf = Vec::with_capacity(tile * tile * cpp * 2); - let mut row = vec![0u16; tile * cpp]; - for y in 0..tile { - let sy = (ty + y).min(h - 1); - for x in 0..tile { - let sx = (tx + x).min(w - 1); - for s in 0..cpp { - row[x * cpp + s] = v[(sy * w + sx) * cpp + s]; - } - } - for i in (cpp..row.len()).rev() { - row[i] = row[i].wrapping_sub(row[i - cpp]); - } - row.iter().for_each(|&x| opts.order.put_u16(&mut buf, x)); - } - miniz_oxide::deflate::compress_to_vec_zlib(&buf, DEFLATE_LEVEL) - }) - .collect(); - ifd.set_image(ImageData::Tiles { tile_width: tile as u32, tile_height: tile as u32, tiles }); - } - // handled above (the data is converted first) - DngCompression::LossyJpeg { .. } => return Err(RawError::Unsupported("lossy DNG of this data".into())), - DngCompression::Lj92 { tile } => { - let tile = (tile.max(2) & !1) as usize; - if tile > 65534 { - return Err(RawError::Limit("tile too large")); - } - ifd.set(t::COMPRESSION, Value::Short(vec![compression::JPEG])); - let (ta, td) = (w.div_ceil(tile), h.div_ceil(tile)); - let tiles: Vec> = (0..ta * td) - .into_par_iter() - .map(|i| { - let (tx, ty) = (i % ta * tile, i / ta * tile); - let mut buf = Vec::with_capacity(tile * tile * cpp); - for y in 0..tile { - let sy = (ty + y).min(h - 1); - for x in 0..tile { - let sx = (tx + x).min(w - 1); - for s in 0..cpp { - buf.push(v[(sy * w + sx) * cpp + s]); - } - } - } - if cpp == 1 { - ljpeg::encode(&buf, tile / 2, tile, 2, bits, 1, 0) - } else { - ljpeg::encode(&buf, tile, tile, cpp, bits, 1, 0) - } - }) - .collect(); - ifd.set_image(ImageData::Tiles { tile_width: tile as u32, tile_height: tile as u32, tiles }); - } - } - } - } - Ok(TiffWriter::new(opts.order, false).write(&[ifd])?) -} - -fn write_profile_tags(ifd: &mut IfdBuilder, raw: &RawImage, order: ByteOrder) { - // The source's own profile look travels with its data (conversions, smart previews, merges). - let profile = &raw.color.profile; - let table_tags = |ifd: &mut IfdBuilder, table: &crate::profile::HsvTable, dims: u16, enc: u16| { - ifd.set(dims, Value::Long(vec![table.hue_divisions as u32, table.sat_divisions as u32, table.val_divisions as u32])); - if table.srgb_value { - ifd.set(enc, Value::Long(vec![1])); - } + let compression = match opts.compression { + DngCompression::Uncompressed | DngCompression::LossyJpeg { .. } => craft_raw::DngCompression::Uncompressed, + DngCompression::Lj92 { tile } => craft_raw::DngCompression::Lj92 { tile }, + DngCompression::Deflate { tile, half } => craft_raw::DngCompression::Deflate { tile, half }, }; - let flat = |table: &crate::profile::HsvTable| Value::Float(table.data.iter().flatten().copied().collect()); - match &profile.hue_sat_map { - [Some(first), second] => { - table_tags(ifd, first, t::PROFILE_HUE_SAT_MAP_DIMS, t::PROFILE_HUE_SAT_MAP_ENCODING); - ifd.set(t::PROFILE_HUE_SAT_MAP_DATA_1, flat(first)); - if let Some(second) = second.as_ref().filter(|second| { - (second.hue_divisions, second.sat_divisions, second.val_divisions) == (first.hue_divisions, first.sat_divisions, first.val_divisions) - }) { - ifd.set(t::PROFILE_HUE_SAT_MAP_DATA_2, flat(second)); - } - } - [None, Some(table)] => { - table_tags(ifd, table, t::PROFILE_HUE_SAT_MAP_DIMS, t::PROFILE_HUE_SAT_MAP_ENCODING); - ifd.set(t::PROFILE_HUE_SAT_MAP_DATA_1, flat(table)); - } - [None, None] => {} - } - if let Some(table) = &profile.look_table { - table_tags(ifd, table, t::PROFILE_LOOK_TABLE_DIMS, t::PROFILE_LOOK_TABLE_ENCODING); - ifd.set(t::PROFILE_LOOK_TABLE_DATA, flat(table)); - } - if let Some(curve) = &profile.tone_curve { - ifd.set(t::PROFILE_TONE_CURVE, Value::Float(curve.points.iter().flatten().copied().collect())); - } - if let Some(map) = &profile.gain_table_map { - // The raw IFD is IFD 0 here, where both tag versions are valid. - let (version2, bytes) = map.to_bytes(order); - ifd.set(if version2 { t::PROFILE_GAIN_TABLE_MAP_2 } else { t::PROFILE_GAIN_TABLE_MAP }, Value::Undefined(bytes)); - } -} - -fn write_opcode_tags(ifd: &mut IfdBuilder, raw: &RawImage) { - for (list, tag) in [(&raw.opcodes.list1, t::OPCODE_LIST_1), (&raw.opcodes.list2, t::OPCODE_LIST_2), (&raw.opcodes.list3, t::OPCODE_LIST_3)] { - if !list.is_empty() { - ifd.set(tag, Value::Undefined(opcodes::write_list(list))); - } + let options = craft_raw::DngWriteOptions { + compression, + order: opts.order, + software: SOFTWARE.into(), + xmp: Some(opts.xmp.clone().unwrap_or_else(|| lightcraft_meta::write_xmp(&raw.metadata, None))), + }; + if let DngCompression::LossyJpeg { tile, quality, .. } = opts.compression { + let encode = |pixels: Vec, tile: u32, quality: u8| { + let image = craft_image_codecs::Image::from_u8(tile, tile, craft_image_codecs::ChannelLayout::Rgb, pixels) + .map_err(|e| RawError::Corrupt(format!("lossy JPEG tile: {e}")))?; + let options = craft_image_codecs::EncodeOptions { jpeg_quality: quality, ..Default::default() }; + craft_image_codecs::encode(&image, craft_image_codecs::Format::Jpeg, &options) + .map_err(|e| RawError::Corrupt(format!("lossy JPEG tile: {e}"))) + }; + craft_raw::dngwrite::write_lossy_dng(&view, &options, tile, quality, &lossy_linearization(), &encode) + } else { + craft_raw::dngwrite::write_dng_view(&view, &options) } } @@ -566,11 +239,100 @@ pub fn write_rendered_dng( write_dng(&raw, &DngWriteOptions { compression: DngCompression::Deflate { tile: 256, half: true }, order, xmp }) } +#[cfg(test)] +#[path = "dngwrite_legacy_tests.rs"] +mod legacy; + #[cfg(test)] mod tests { use super::*; use crate::{BlackLevel, OpcodeLists, RawData, RawFormat, RawImage, Rect}; + use crate::{Cfa, ColorData, Mat3, Orientation}; + + fn mosaic(w: usize, h: usize) -> RawImage { + let data: Vec = (0..w * h) + .map(|i| { + let (x, y) = (i % w, i / w); + let c = (x % 2) + (y % 2); + (64.0 + 3000.0 * (x as f32 / w as f32) * (0.5 + c as f32 * 0.25) + 500.0 * (y as f32 / h as f32)) as u16 + }) + .collect(); + let color = ColorData { + illuminant: [21, 0], + color_matrix: [Some(Mat3([[0.7, -0.1, -0.05], [-0.4, 1.2, 0.2], [-0.1, 0.2, 0.6]])), None], + as_shot_neutral: Some([0.5, 1.0, 0.7]), + ..Default::default() + }; + RawImage { + format: RawFormat::Dng, + width: w, + height: h, + cpp: 1, + data: RawData::U16(data), + cfa: Some(Cfa::bayer("RGGB").unwrap()), + bits: 12, + black: BlackLevel::uniform(64.0), + white: vec![4095.0], + active_area: Rect::new(0, 0, w, h), + crop: Rect::new(2, 2, w - 4, h - 4), + orientation: Orientation::Rotate90, + color, + wb_multipliers: None, + linearized: false, + opcodes: OpcodeLists::default(), + metadata: Default::default(), + lens_metadata: Default::default(), + pixel_aspect: 1.0, + } + } + + #[test] + fn shared_writer_matches_frozen_application_bytes() { + let raw = mosaic(20, 16); + for order in [ByteOrder::Little, ByteOrder::Big] { + for (compression, old_compression) in [ + (DngCompression::Uncompressed, legacy::DngCompression::Uncompressed), + (DngCompression::Lj92 { tile: 16 }, legacy::DngCompression::Lj92 { tile: 16 }), + (DngCompression::Deflate { tile: 16, half: false }, legacy::DngCompression::Deflate { tile: 16, half: false }), + ( + DngCompression::LossyJpeg { tile: 32, quality: 95, long_edge: None }, + legacy::DngCompression::LossyJpeg { tile: 32, quality: 95, long_edge: None }, + ), + ( + DngCompression::LossyJpeg { tile: 32, quality: 95, long_edge: Some(8) }, + legacy::DngCompression::LossyJpeg { tile: 32, quality: 95, long_edge: Some(8) }, + ), + ] { + let options = DngWriteOptions { compression, order, xmp: None }; + let old_options = legacy::DngWriteOptions { compression: old_compression, order, xmp: None }; + assert_eq!(write_dng(&raw, &options).unwrap(), legacy::write_dng(&raw, &old_options).unwrap()); + } + } + let rgb = (0..4 * 4 * 3).map(|i| i as f32 / 48.0).collect::>(); + let metadata = lightcraft_meta::Metadata::default(); + for space in [lightcraft_color::SRGB, lightcraft_color::PROPHOTO] { + assert_eq!( + write_rendered_dng(4, 4, &rgb, &space, &metadata, None).unwrap(), + legacy::write_rendered_dng(4, 4, &rgb, &space, &metadata, None).unwrap() + ); + } + } + + #[test] + fn shared_writer_keeps_padding_and_declared_white_guards() { + let mut raw = mosaic(20, 16); + raw.white = vec![65535.0]; + let options = DngWriteOptions { compression: DngCompression::Lj92 { tile: 16 }, ..Default::default() }; + let bytes = write_dng(&raw, &options).unwrap(); + let tiff = craft_tiff::Tiff::parse(&bytes).unwrap(); + assert_eq!(tiff.all_ifds()[0].u16(craft_tiff::tags::BITS_PER_SAMPLE), Some(16)); + for tile in [2050, u32::MAX] { + let options = DngWriteOptions { compression: DngCompression::Lj92 { tile }, ..Default::default() }; + assert!(matches!(write_dng(&raw, &options), Err(RawError::Limit("tile too large")))); + } + } + /// Deflate tiles of `tile × tile` pad into a square buffer that grows with the square: a /// caller-supplied edge of `u32::MAX` would make the writer pad an 8 × 8 image into billions of /// edge-replicate iterations and a multi-gigabyte buffer. The clamp keeps the bounded shape — same diff --git a/crates/raw/src/dngwrite_legacy_tests.rs b/crates/raw/src/dngwrite_legacy_tests.rs new file mode 100644 index 0000000000..b5dc6a67fb --- /dev/null +++ b/crates/raw/src/dngwrite_legacy_tests.rs @@ -0,0 +1,571 @@ +// Frozen application writer, test-only parity oracle. +// Source: storytold/lightcraft main 2dcb258ba40738230a07484a95eb27dc84ed66fe. +// Original DNG writer: Brandon Thomas (05450c79); lossy/rendered paths: +// Andrew Frahn (cc3eb1c8, a1d7c488), with subsequent fixes preserved verbatim. +//! Writing DNG files from a [`RawImage`] (uncompressed or lossless-JPEG tiles), used for DNG export and for +//! bit-exact decoder round-trip tests. The raw image is stored in IFD0 (allowed by DNG 1.7 §"File Structure"). + +use crate::{RawData, RawError, RawImage, Result, ljpeg, opcodes}; +use craft_tiff::tags::{self as t, compression, photometric}; +use craft_tiff::writer::{rational, srational}; +use craft_tiff::{ByteOrder, IfdBuilder, ImageData, TiffWriter, Value}; +use lightcraft_color::Mat3; +use rayon::prelude::*; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum DngCompression { + Uncompressed, + /// Lossless JPEG tiles of `tile × tile` pixels (`tile` even). CFA tiles are encoded as two interleaved + /// components of half the tile width (the common DNG layout), linear data with one component per sample. + Lj92 { + tile: u32, + }, + /// Deflate (zlib) tiles of `tile × tile` pixels. Floating-point data is stored as 16-bit (`half`) or + /// 32-bit IEEE floats with the floating-point predictor (TIFF predictor 3, Adobe TIFF Technical Note 3); + /// integer data with horizontal differencing (predictor 2). 16-bit float is what HDR merges usually use. + Deflate { + tile: u32, + half: bool, + }, + /// Lossy DNG (DNG 1.4 compression 34892): the raw data demosaiced to linear camera RGB (with `OpcodeList3` + /// and the default crop applied), scaled down to at most `long_edge` pixels on the long side when given, + /// then stored as 8-bit baseline JPEG tiles of `tile × tile` pixels at JPEG `quality` (1–100). The 8-bit + /// codes follow a 1/2.2 power curve that a `LinearizationTable` maps back to linear 16-bit values, so + /// shadows keep their precision. The colour tags (matrices, white balance, profile look) are kept. + LossyJpeg { + tile: u32, + quality: u8, + long_edge: Option, + }, +} + +/// Gamma of the 8-bit codes in a lossy DNG (own choice: perceptually close to even steps, like sRGB). +const LOSSY_GAMMA: f64 = 2.2; + +/// The 256-entry `LinearizationTable` of a lossy DNG: code → linear 16-bit value. +fn lossy_linearization() -> Vec { + (0..256u32).map(|i| ((i as f64 / 255.0).powf(LOSSY_GAMMA) * 65535.0).round() as u16).collect() +} + +/// The image a lossy DNG stores: `raw` developed to linear camera RGB (white = 1), scaled to fit +/// `long_edge`, as 8-bit codes (in `u16` samples) on the [`LOSSY_GAMMA`] curve, with the levels, +/// geometry and opcode lists that this data needs (black 0, white 65535 after linearization). +fn lossy_source(raw: &RawImage, long_edge: Option) -> Result { + let mut rgb = raw.develop(crate::Method::Ahd)?; + if let Some(edge) = long_edge.map(|e| e.max(1) as usize) { + let long = rgb.width.max(rgb.height); + if long > edge { + let s = edge as f64 / long as f64; + let w = ((rgb.width as f64 * s).round() as usize).max(1); + let h = ((rgb.height as f64 * s).round() as usize).max(1); + rgb = lightcraft_raster::resample::resize(&rgb, w, h, lightcraft_raster::resample::Filter::Lanczos3); + } + } + let (w, h) = (rgb.width, rgb.height); + if w == 0 || h == 0 { + return Err(RawError::Corrupt("empty image".into())); + } + let inv = 1.0 / LOSSY_GAMMA as f32; + let data: Vec = rgb + .data + .par_iter() + .flat_map_iter(|px| px.map(|v| if v.is_finite() { (v.clamp(0.0, 1.0).powf(inv) * 255.0).round() as u16 } else { 0 })) + .collect(); + let full = crate::Rect::new(0, 0, w, h); + Ok(RawImage { + width: w, + height: h, + cpp: 3, + data: RawData::U16(data), + cfa: None, + bits: 8, + black: crate::BlackLevel::default(), + white: vec![65535.0], + active_area: full, + crop: full, + // list 1 and 2 work on the undemosaiced data and list 3 is applied by `develop` + opcodes: crate::OpcodeLists::default(), + linearized: true, + ..raw.clone() + }) +} + +/// Software tag of the DNGs this writer makes. A bare "LightCraft" marks older files, whose CFAPattern is anchored at +/// the sensor origin instead of the ActiveArea (the reader keeps their original reading). +pub const SOFTWARE: &str = "LightCraft DNG 2"; + +/// zlib level of Deflate tiles. On a 67 MP focus-stack merge (half floats) level 6 took 7× as long as level 1 +/// (3.9 s vs 0.55 s on 4 cores) to save 3 % of the file (266 vs 275 MB); 5–12 % on raw and rendered DNGs. +const DEFLATE_LEVEL: u8 = 1; + +/// Largest Deflate tile edge the writer pads to (`tile` is caller-supplied in [`DngCompression::Deflate`]): +/// square-tile buffers grow with the square, so an unclamped edge lets a request pad a tiny valid image into +/// a multi-gigabyte buffer and billions of edge-replicate iterations. 2048² samples (≤ 24 MB of f32) is far +/// above the 256 default and every real tile this writer makes. +const MAX_DEFLATE_TILE: u32 = 2048; + +/// `tile` aligned down to a multiple of 16 and clamped to [`MAX_DEFLATE_TILE`]. +fn deflate_tile(tile: u32) -> usize { + (tile.max(16) & !15).min(MAX_DEFLATE_TILE) as usize +} + +/// IEEE 754 binary32 → binary16 (round to nearest even; overflow → ±inf, NaN kept). +pub fn f32_to_f16(v: f32) -> u16 { + let b = v.to_bits(); + let sign = ((b >> 16) & 0x8000) as u16; + let exp = ((b >> 23) & 0xff) as i32; + let man = b & 0x7f_ffff; + if exp == 0xff { + return sign | 0x7c00 | if man != 0 { 0x200 } else { 0 }; + } + let e = exp - 127 + 15; + if e >= 0x1f { + return sign | 0x7c00; + } + if e <= 0 { + if e < -10 { + return sign; + } + // subnormal half + let m = man | 0x80_0000; + let shift = (14 - e) as u32; + let half = m >> shift; + let rem = m & ((1 << shift) - 1); + let mid = 1 << (shift - 1); + let r = if rem > mid || (rem == mid && half & 1 == 1) { half + 1 } else { half }; + return sign | r as u16; + } + let half = ((e as u32) << 10) | (man >> 13); + let rem = man & 0x1fff; + let r = if rem > 0x1000 || (rem == 0x1000 && half & 1 == 1) { half + 1 } else { half }; + sign | r as u16 +} + +/// Apply the floating-point predictor (inverse of `unpack::undo_float_predictor`) to one row of +/// `n` big-endian samples of `bytes_per` bytes: split into byte planes (most significant first), then +/// byte-difference with `stride` samples. +fn float_predict(row: &[u8], n: usize, bytes_per: usize, stride: usize) -> Vec { + let mut planes = vec![0u8; row.len()]; + for i in 0..n { + for b in 0..bytes_per { + planes[b * n + i] = row[i * bytes_per + b]; + } + } + for i in (stride..planes.len()).rev() { + planes[i] = planes[i].wrapping_sub(planes[i - stride]); + } + planes +} + +#[derive(Clone, Debug, PartialEq)] +pub struct DngWriteOptions { + pub compression: DngCompression, + pub order: ByteOrder, + /// XMP packet to embed (tag 700); defaults to one generated from the image metadata. + pub xmp: Option, +} + +impl Default for DngWriteOptions { + fn default() -> Self { + Self { compression: DngCompression::Lj92 { tile: 256 }, order: ByteOrder::Little, xmp: None } + } +} + +fn srat_mat(m: &Mat3) -> Value { + Value::SRational(m.0.iter().flatten().map(|&v| srational(v)).collect()) +} + +fn rat_vec(v: &[f64]) -> Value { + Value::Rational(v.iter().map(|&x| rational(x)).collect()) +} + +/// Serialise `raw` as a DNG. +pub fn write_dng(raw: &RawImage, opts: &DngWriteOptions) -> Result> { + raw.validate()?; + let lossy; + let raw = match opts.compression { + DngCompression::LossyJpeg { long_edge, .. } => { + lossy = lossy_source(raw, long_edge)?; + &lossy + } + _ => raw, + }; + let (w, h, cpp) = (raw.width, raw.height, raw.cpp); + let mut ifd = IfdBuilder::new(); + ifd.set(t::NEW_SUBFILE_TYPE, Value::Long(vec![0])); + ifd.set(t::IMAGE_WIDTH, Value::Long(vec![w as u32])); + ifd.set(t::IMAGE_LENGTH, Value::Long(vec![h as u32])); + ifd.set(t::SAMPLES_PER_PIXEL, Value::Short(vec![cpp as u16])); + ifd.set(t::PLANAR_CONFIGURATION, Value::Short(vec![1])); + ifd.set(t::PHOTOMETRIC, Value::Short(vec![if raw.cfa.is_some() { photometric::CFA } else { photometric::LINEAR_RAW }])); + ifd.set(t::DNG_VERSION, Value::Byte(vec![1, 4, 0, 0])); + ifd.set(t::DNG_BACKWARD_VERSION, Value::Byte(vec![1, 3, 0, 0])); + let make = raw.metadata.make.as_deref().unwrap_or_default(); + let model = raw.metadata.model.as_deref().unwrap_or_default(); + if !make.is_empty() { + ifd.set(t::MAKE, Value::Ascii(make.to_owned())); + } + if !model.is_empty() { + ifd.set(t::MODEL, Value::Ascii(model.to_owned())); + } + let model_includes_make = !make.is_empty() + && model.get(..make.len()).is_some_and(|prefix| prefix.eq_ignore_ascii_case(make)) + && model.get(make.len()..).is_some_and(|suffix| suffix.chars().next().is_none_or(|c| !c.is_alphanumeric() && c != '_')); + let unique = if model_includes_make || make.is_empty() { + model.to_owned() + } else if model.is_empty() { + make.to_owned() + } else { + format!("{make} {model}") + }; + ifd.set(t::UNIQUE_CAMERA_MODEL, Value::Ascii(if unique.is_empty() { "LightCraft".into() } else { unique })); + ifd.set(t::ORIENTATION, Value::Short(vec![raw.orientation.to_exif()])); + ifd.set(t::SOFTWARE, Value::Ascii(SOFTWARE.into())); + let xmp = opts.xmp.clone().unwrap_or_else(|| lightcraft_meta::write_xmp(&raw.metadata, None)); + ifd.set(t::XMP, Value::Byte(xmp.into_bytes())); + + if let Some(cfa) = &raw.cfa { + ifd.set(t::CFA_REPEAT_PATTERN_DIM, Value::Short(vec![cfa.height as u16, cfa.width as u16])); + // the tag is anchored at the ActiveArea's top-left, `raw.cfa` at the sensor origin + let a = raw.active_area; + ifd.set(t::CFA_PATTERN_EP, Value::Byte(cfa.shifted(a.x, a.y).pattern)); + ifd.set(t::CFA_PLANE_COLOR, Value::Byte(vec![0, 1, 2])); + ifd.set(t::CFA_LAYOUT, Value::Short(vec![1])); + } + let b = &raw.black; + ifd.set(t::BLACK_LEVEL_REPEAT_DIM, Value::Short(vec![b.repeat_rows as u16, b.repeat_cols as u16])); + let mut bl: Vec = b.values.iter().map(|&v| v as f64).collect(); + if bl.len() == 1 && cpp > 1 { + bl = vec![bl[0]; cpp]; + } + ifd.set(t::BLACK_LEVEL, rat_vec(&bl)); + if !b.delta_h.is_empty() { + ifd.set(t::BLACK_LEVEL_DELTA_H, Value::SRational(b.delta_h.iter().map(|&v| srational(v as f64)).collect())); + } + if !b.delta_v.is_empty() { + ifd.set(t::BLACK_LEVEL_DELTA_V, Value::SRational(b.delta_v.iter().map(|&v| srational(v as f64)).collect())); + } + let white: Vec = (0..cpp).map(|s| raw.white_at(s).round().clamp(0.0, u32::MAX as f32) as u32).collect(); + if matches!(raw.data, RawData::F32(_)) { + ifd.set(t::WHITE_LEVEL, rat_vec(&(0..cpp).map(|s| raw.white_at(s) as f64).collect::>())); + } else { + ifd.set(t::WHITE_LEVEL, Value::Long(white)); + } + let a = raw.active_area; + ifd.set(t::ACTIVE_AREA, Value::Long(vec![a.y as u32, a.x as u32, (a.y + a.height) as u32, (a.x + a.width) as u32])); + ifd.set(t::DEFAULT_CROP_ORIGIN, Value::Long(vec![raw.crop.x as u32, raw.crop.y as u32])); + ifd.set(t::DEFAULT_CROP_SIZE, Value::Long(vec![raw.crop.width as u32, raw.crop.height as u32])); + + let c = &raw.color; + for (i, tag) in [t::CALIBRATION_ILLUMINANT_1, t::CALIBRATION_ILLUMINANT_2].into_iter().enumerate() { + if c.color_matrix[i].is_some() { + ifd.set(tag, Value::Short(vec![c.illuminant[i]])); + } + } + for (pair, tags) in [ + (&c.color_matrix, [t::COLOR_MATRIX_1, t::COLOR_MATRIX_2]), + (&c.forward_matrix, [t::FORWARD_MATRIX_1, t::FORWARD_MATRIX_2]), + (&c.camera_calibration, [t::CAMERA_CALIBRATION_1, t::CAMERA_CALIBRATION_2]), + ] { + for i in 0..2 { + if let Some(m) = &pair[i] { + ifd.set(tags[i], srat_mat(m)); + } + } + } + if let Some(v) = c.analog_balance { + ifd.set(t::ANALOG_BALANCE, rat_vec(&v)); + } + if let Some(v) = c.as_shot_neutral { + ifd.set(t::AS_SHOT_NEUTRAL, rat_vec(&v)); + } else if let Some(xy) = c.as_shot_white_xy { + ifd.set(t::AS_SHOT_WHITE_XY, rat_vec(&[xy.x, xy.y])); + } else if let Some(m) = raw.wb_multipliers.filter(|m| m.iter().all(|v| *v > 0.0 && v.is_finite())) { + // vendor raws (NEF, ARW…) carry white balance as multipliers: the DNG neutral is their reciprocal + ifd.set(t::AS_SHOT_NEUTRAL, rat_vec(&m.map(|v| 1.0 / v as f64))); + } + ifd.set(t::BASELINE_EXPOSURE, Value::SRational(vec![srational(c.baseline_exposure)])); + if let Some(v) = c.baseline_sharpness { + ifd.set(t::BASELINE_SHARPNESS, rat_vec(&[v])); + } + write_profile_tags(&mut ifd, raw, opts.order); + write_opcode_tags(&mut ifd, raw); + + match (&raw.data, opts.compression) { + (RawData::F32(v), DngCompression::Deflate { tile, half }) => { + let tile = deflate_tile(tile); + let bp = if half { 2 } else { 4 }; + ifd.set(t::BITS_PER_SAMPLE, Value::Short(vec![(bp * 8) as u16; cpp])); + ifd.set(t::SAMPLE_FORMAT, Value::Short(vec![3; cpp])); + ifd.set(t::COMPRESSION, Value::Short(vec![compression::ADOBE_DEFLATE])); + ifd.set(t::PREDICTOR, Value::Short(vec![3])); + let (ta, td) = (w.div_ceil(tile), h.div_ceil(tile)); + let tiles: Vec> = (0..ta * td) + .into_par_iter() + .map(|i| { + let (tx, ty) = (i % ta * tile, i / ta * tile); + let mut buf = Vec::with_capacity(tile * tile * cpp * bp); + let mut row = Vec::with_capacity(tile * cpp * bp); + for y in 0..tile { + let sy = (ty + y).min(h - 1); + row.clear(); + for x in 0..tile { + let sx = (tx + x).min(w - 1); + for s in 0..cpp { + let f = v[(sy * w + sx) * cpp + s]; + if half { + row.extend_from_slice(&f32_to_f16(f).to_be_bytes()); + } else { + row.extend_from_slice(&f.to_bits().to_be_bytes()); + } + } + } + buf.extend_from_slice(&float_predict(&row, tile * cpp, bp, cpp)); + } + miniz_oxide::deflate::compress_to_vec_zlib(&buf, DEFLATE_LEVEL) + }) + .collect(); + ifd.set_image(ImageData::Tiles { tile_width: tile as u32, tile_height: tile as u32, tiles }); + } + (RawData::F32(v), _) => { + ifd.set(t::BITS_PER_SAMPLE, Value::Short(vec![32; cpp])); + ifd.set(t::SAMPLE_FORMAT, Value::Short(vec![3; cpp])); + ifd.set(t::COMPRESSION, Value::Short(vec![compression::NONE])); + let mut bytes = Vec::with_capacity(v.len() * 4); + for &x in v { + let mut tmp = Vec::with_capacity(4); + opts.order.put_u32(&mut tmp, x.to_bits()); + bytes.extend_from_slice(&tmp); + } + ifd.set_image(ImageData::Strips { rows_per_strip: h as u32, strips: vec![bytes] }); + } + (RawData::U16(v), DngCompression::LossyJpeg { tile, quality, .. }) => { + // `lossy_source` made 3-sample 8-bit codes + let tile = (tile.clamp(16, 4096) & !15) as usize; + ifd.set(t::BITS_PER_SAMPLE, Value::Short(vec![8; cpp])); + ifd.set(t::COMPRESSION, Value::Short(vec![compression::LOSSY_JPEG])); + ifd.set(t::LINEARIZATION_TABLE, Value::Short(lossy_linearization())); + let quality = quality.clamp(1, 100); + let (ta, td) = (w.div_ceil(tile), h.div_ceil(tile)); + let tiles: Vec> = (0..ta * td) + .into_par_iter() + .map(|i| { + let (tx, ty) = (i % ta * tile, i / ta * tile); + let mut buf = Vec::with_capacity(tile * tile * 3); + for y in 0..tile { + let sy = (ty + y).min(h - 1); + for x in 0..tile { + let sx = (tx + x).min(w - 1); + for s in 0..3 { + buf.push(v.get((sy * w + sx) * cpp + s.min(cpp - 1)).map_or(0, |&c| c.min(255) as u8)); + } + } + } + let ic_img = craft_image_codecs::Image::from_u8(tile as u32, tile as u32, craft_image_codecs::ChannelLayout::Rgb, buf) + .map_err(|e| RawError::Corrupt(format!("lossy JPEG tile: {e}")))?; + let opts = craft_image_codecs::EncodeOptions { jpeg_quality: quality, ..Default::default() }; + craft_image_codecs::encode(&ic_img, craft_image_codecs::Format::Jpeg, &opts) + .map_err(|e| RawError::Corrupt(format!("lossy JPEG tile: {e}"))) + }) + .collect::>()?; + ifd.set_image(ImageData::Tiles { tile_width: tile as u32, tile_height: tile as u32, tiles }); + } + (RawData::U16(v), _) => { + let maxv = v.iter().copied().max().unwrap_or(0); + let bits = (16 - maxv.leading_zeros()).max(raw.bits.min(16)).max(2) as u8; + ifd.set( + t::BITS_PER_SAMPLE, + Value::Short(vec![if matches!(opts.compression, DngCompression::Uncompressed) { 16 } else { bits as u16 }; cpp]), + ); + match opts.compression { + DngCompression::Uncompressed => { + ifd.set(t::COMPRESSION, Value::Short(vec![compression::NONE])); + let rows = (65536 / (w * cpp * 2)).clamp(1, h); + let strips = v + .chunks(rows * w * cpp) + .map(|s| { + let mut b = Vec::with_capacity(s.len() * 2); + s.iter().for_each(|&x| opts.order.put_u16(&mut b, x)); + b + }) + .collect(); + ifd.set_image(ImageData::Strips { rows_per_strip: rows as u32, strips }); + } + DngCompression::Deflate { tile, .. } => { + let tile = deflate_tile(tile); + ifd.set(t::BITS_PER_SAMPLE, Value::Short(vec![16; cpp])); + ifd.set(t::COMPRESSION, Value::Short(vec![compression::ADOBE_DEFLATE])); + ifd.set(t::PREDICTOR, Value::Short(vec![2])); + let (ta, td) = (w.div_ceil(tile), h.div_ceil(tile)); + let tiles: Vec> = (0..ta * td) + .into_par_iter() + .map(|i| { + let (tx, ty) = (i % ta * tile, i / ta * tile); + let mut buf = Vec::with_capacity(tile * tile * cpp * 2); + let mut row = vec![0u16; tile * cpp]; + for y in 0..tile { + let sy = (ty + y).min(h - 1); + for x in 0..tile { + let sx = (tx + x).min(w - 1); + for s in 0..cpp { + row[x * cpp + s] = v[(sy * w + sx) * cpp + s]; + } + } + for i in (cpp..row.len()).rev() { + row[i] = row[i].wrapping_sub(row[i - cpp]); + } + row.iter().for_each(|&x| opts.order.put_u16(&mut buf, x)); + } + miniz_oxide::deflate::compress_to_vec_zlib(&buf, DEFLATE_LEVEL) + }) + .collect(); + ifd.set_image(ImageData::Tiles { tile_width: tile as u32, tile_height: tile as u32, tiles }); + } + // handled above (the data is converted first) + DngCompression::LossyJpeg { .. } => return Err(RawError::Unsupported("lossy DNG of this data".into())), + DngCompression::Lj92 { tile } => { + let tile = (tile.max(2) & !1) as usize; + if tile > 65534 { + return Err(RawError::Limit("tile too large")); + } + ifd.set(t::COMPRESSION, Value::Short(vec![compression::JPEG])); + let (ta, td) = (w.div_ceil(tile), h.div_ceil(tile)); + let tiles: Vec> = (0..ta * td) + .into_par_iter() + .map(|i| { + let (tx, ty) = (i % ta * tile, i / ta * tile); + let mut buf = Vec::with_capacity(tile * tile * cpp); + for y in 0..tile { + let sy = (ty + y).min(h - 1); + for x in 0..tile { + let sx = (tx + x).min(w - 1); + for s in 0..cpp { + buf.push(v[(sy * w + sx) * cpp + s]); + } + } + } + if cpp == 1 { + ljpeg::encode(&buf, tile / 2, tile, 2, bits, 1, 0) + } else { + ljpeg::encode(&buf, tile, tile, cpp, bits, 1, 0) + } + }) + .collect(); + ifd.set_image(ImageData::Tiles { tile_width: tile as u32, tile_height: tile as u32, tiles }); + } + } + } + } + Ok(TiffWriter::new(opts.order, false).write(&[ifd])?) +} + +fn write_profile_tags(ifd: &mut IfdBuilder, raw: &RawImage, order: ByteOrder) { + // The source's own profile look travels with its data (conversions, smart previews, merges). + let profile = &raw.color.profile; + let table_tags = |ifd: &mut IfdBuilder, table: &crate::profile::HsvTable, dims: u16, enc: u16| { + ifd.set(dims, Value::Long(vec![table.hue_divisions as u32, table.sat_divisions as u32, table.val_divisions as u32])); + if table.srgb_value { + ifd.set(enc, Value::Long(vec![1])); + } + }; + let flat = |table: &crate::profile::HsvTable| Value::Float(table.data.iter().flatten().copied().collect()); + match &profile.hue_sat_map { + [Some(first), second] => { + table_tags(ifd, first, t::PROFILE_HUE_SAT_MAP_DIMS, t::PROFILE_HUE_SAT_MAP_ENCODING); + ifd.set(t::PROFILE_HUE_SAT_MAP_DATA_1, flat(first)); + if let Some(second) = second.as_ref().filter(|second| { + (second.hue_divisions, second.sat_divisions, second.val_divisions) == (first.hue_divisions, first.sat_divisions, first.val_divisions) + }) { + ifd.set(t::PROFILE_HUE_SAT_MAP_DATA_2, flat(second)); + } + } + [None, Some(table)] => { + table_tags(ifd, table, t::PROFILE_HUE_SAT_MAP_DIMS, t::PROFILE_HUE_SAT_MAP_ENCODING); + ifd.set(t::PROFILE_HUE_SAT_MAP_DATA_1, flat(table)); + } + [None, None] => {} + } + if let Some(table) = &profile.look_table { + table_tags(ifd, table, t::PROFILE_LOOK_TABLE_DIMS, t::PROFILE_LOOK_TABLE_ENCODING); + ifd.set(t::PROFILE_LOOK_TABLE_DATA, flat(table)); + } + if let Some(curve) = &profile.tone_curve { + ifd.set(t::PROFILE_TONE_CURVE, Value::Float(curve.points.iter().flatten().copied().collect())); + } + if let Some(map) = &profile.gain_table_map { + // The raw IFD is IFD 0 here, where both tag versions are valid. + let (version2, bytes) = map.to_bytes(order); + ifd.set(if version2 { t::PROFILE_GAIN_TABLE_MAP_2 } else { t::PROFILE_GAIN_TABLE_MAP }, Value::Undefined(bytes)); + } +} + +fn write_opcode_tags(ifd: &mut IfdBuilder, raw: &RawImage) { + for (list, tag) in [(&raw.opcodes.list1, t::OPCODE_LIST_1), (&raw.opcodes.list2, t::OPCODE_LIST_2), (&raw.opcodes.list3, t::OPCODE_LIST_3)] { + if !list.is_empty() { + ifd.set(tag, Value::Undefined(opcodes::write_list(list))); + } + } +} + +/// Exif `LightSource` code of a white point the rendered DNG writer knows (D65 = 21, D50 = 23). +fn illuminant_of(white: lightcraft_color::Xy) -> u16 { + if (white.x - lightcraft_color::D50.x).abs() < 1e-3 && (white.y - lightcraft_color::D50.y).abs() < 1e-3 { 23 } else { 21 } +} + +/// Render to DNG: a linear DNG (`LinearRaw`, 16-bit float Deflate tiles) of an already rendered, +/// oriented image. `rgb` is `width × height` interleaved linear RGB in `space` (white = 1; values +/// above 1 are kept up to the half-float maximum, negative and non-finite ones become 0). The colour tags describe `space` +/// exactly — `ColorMatrix1` = XYZ → space, `ForwardMatrix1` = space → XYZ D50, a neutral +/// `AsShotNeutral` — and an identity `ProfileToneCurve` keeps raw converters from adding their +/// default tone curve on top of the baked-in edit. +pub fn write_rendered_dng( + width: usize, + height: usize, + rgb: &[f32], + space: &lightcraft_color::RgbSpace, + metadata: &lightcraft_meta::Metadata, + xmp: Option, +) -> Result> { + let n = width.checked_mul(height).and_then(|p| p.checked_mul(3)).ok_or(RawError::Limit("image too large"))?; + if width == 0 || height == 0 || width > u32::MAX as usize || height > u32::MAX as usize { + return Err(RawError::Corrupt(format!("cannot write a {width}×{height} DNG"))); + } + let src = rgb.get(..n).ok_or_else(|| RawError::Corrupt(format!("{} samples for a {width}×{height} RGB image", rgb.len())))?; + let data: Vec = src.iter().map(|&v| if v.is_finite() { v.clamp(0.0, 65504.0) } else { 0.0 }).collect(); + let full = crate::Rect::new(0, 0, width, height); + let forward = lightcraft_color::bradford(space.white, lightcraft_color::D50).mul(&space.to_xyz()); + let color = crate::ColorData { + illuminant: [illuminant_of(space.white), 0], + color_matrix: [Some(space.from_xyz()), None], + forward_matrix: [Some(forward), None], + as_shot_neutral: Some([1.0; 3]), + profile: crate::profile::ProfileLook { + tone_curve: Some(crate::profile::ToneCurve { points: vec![[0.0, 0.0], [1.0, 1.0]] }), + ..Default::default() + }, + ..Default::default() + }; + let raw = RawImage { + format: crate::RawFormat::Dng, + width, + height, + cpp: 3, + data: RawData::F32(data), + cfa: None, + bits: 16, + black: crate::BlackLevel::uniform(0.0), + white: vec![1.0], + active_area: full, + crop: full, + orientation: lightcraft_geom::Orientation::Normal, + color, + wb_multipliers: None, + linearized: false, + pixel_aspect: 1.0, + opcodes: crate::OpcodeLists::default(), + metadata: metadata.clone(), + lens_metadata: Default::default(), + }; + let order = ByteOrder::Little; + write_dng(&raw, &DngWriteOptions { compression: DngCompression::Deflate { tile: 256, half: true }, order, xmp }) +} diff --git a/crates/raw/tests/it/dng.rs b/crates/raw/tests/it/dng.rs index 1b4909c366..71f5ca99cd 100644 --- a/crates/raw/tests/it/dng.rs +++ b/crates/raw/tests/it/dng.rs @@ -1038,6 +1038,9 @@ fn malformed_semantic_masks_are_skipped() { let mut short = mask_ifd(4, 4, "short strip", vec![200; 3]); short.set(t::MASK_SUB_AREA, Value::Long(vec![u32::MAX, u32::MAX, u32::MAX, u32::MAX])); ifd0.add_sub_ifd(short); + let mut overflow = mask_ifd(2, 2, "overflow sub area", vec![255; 4]); + overflow.set(t::MASK_SUB_AREA, Value::Long(vec![u32::MAX, u32::MAX, u32::MAX, u32::MAX])); + ifd0.add_sub_ifd(overflow); let mut outside = mask_ifd(2, 2, "sub area too small", vec![255; 4]); outside.set(t::MASK_SUB_AREA, Value::Long(vec![3, 0, 2, 4])); ifd0.add_sub_ifd(outside); @@ -1047,8 +1050,8 @@ fn malformed_semantic_masks_are_skipped() { let names: Vec<&str> = masks.iter().map(|m| m.name.as_str()).collect(); // A 4×4, 8-bit uncompressed mask needs 16 bytes: the three-byte strip // is truncated, not a valid mask with zero-filled missing pixels. Keep the - // separate complete mask to test invalid MaskSubArea handling. - assert_eq!(names, ["sub area too small"]); + // separate complete masks to test invalid and overflowing MaskSubArea handling. + assert_eq!(names, ["overflow sub area", "sub area too small"]); assert!(masks.iter().all(|m| m.sub_area.is_none()), "sub areas the mask doesn't fit are ignored"); for m in &masks { let d = m.developed(Rect::new(0, 0, 8, 6), Rect::new(0, 0, 8, 6)).unwrap(); diff --git a/crates/ui-egui/src/tests/find_similar.rs b/crates/ui-egui/src/tests/find_similar.rs index 71617007a4..ef70539578 100644 --- a/crates/ui-egui/src/tests/find_similar.rs +++ b/crates/ui-egui/src/tests/find_similar.rs @@ -226,6 +226,18 @@ fn a_photo_that_cannot_be_read_says_so() { let toast = h.app.ui.toast.as_ref().map(|t| t.0.clone()).unwrap_or_default(); assert!(toast.contains("can't read the photo"), "{toast}"); assert_eq!(h.app.session.filter, Default::default()); + + // Headless frames can start process-wide GPU warm-up. Keep the original assertions and + // GPU enabled, but do not let this one-test process exit while driver work is in flight. + #[cfg(not(target_arch = "wasm32"))] + { + let deadline = Instant::now() + Duration::from_secs(30); + while !lightcraft_engine::gpu::ready() && lightcraft_engine::gpu::enabled() && Instant::now() < deadline { + std::thread::sleep(Duration::from_millis(10)); + } + assert!(lightcraft_engine::gpu::ready() || !lightcraft_engine::gpu::enabled(), "GPU warm-up did not finish"); + assert!(lightcraft_engine::gpu::wait_idle(Duration::from_secs(30)), "GPU work did not finish"); + } } /// A control request is answered when the search ends, with the command's `{photos}`, and the window diff --git a/packaging/linux/flatpak/cargo-sources.json b/packaging/linux/flatpak/cargo-sources.json index d633cbcdbc..f9be07a0df 100644 --- a/packaging/linux/flatpak/cargo-sources.json +++ b/packaging/linux/flatpak/cargo-sources.json @@ -20,8 +20,8 @@ { "type": "git", "url": "https://github.com/storytold/craft-libs", - "commit": "c28356d400aed7575b04ec1551b4665107cfe845", - "dest": "flatpak-cargo/git/craft-libs-c28356d" + "commit": "3a6613f058e355a4fd8d196b2f385260bd4b4a8e", + "dest": "flatpak-cargo/git/craft-libs-3a6613f" }, { "type": "git", @@ -53,6 +53,12 @@ "commit": "5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a", "dest": "flatpak-cargo/git/craft-libs-5ac7c96" }, + { + "type": "git", + "url": "https://github.com/storytold/craft-libs", + "commit": "c28356d400aed7575b04ec1551b4665107cfe845", + "dest": "flatpak-cargo/git/craft-libs-c28356d" + }, { "type": "git", "url": "https://github.com/storytold/craft-libs", @@ -1672,19 +1678,19 @@ { "type": "shell", "commands": [ - "mkdir -p \"cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801\" && cp -r --reflink=auto \"flatpak-cargo/git/craft-libs-c28356d/crates/crw\" \"cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801/craft-crw\"" + "mkdir -p \"cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09\" && cp -r --reflink=auto \"flatpak-cargo/git/craft-libs-3a6613f/crates/crw\" \"cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09/craft-crw\"" ] }, { "type": "inline", "contents": "[package]\nname = \"craft-crw\"\ndescription = \"Clean-room Canon CRW (CIFF) raw decoder: the heap container, the derived entropy coding, sensor levels and as-shot white balance.\"\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[dev-dependencies]\nproptest = \"1\"\nserde_json = \"1\"\n\n[dev-dependencies.serde]\nversion = \"1\"\nfeatures = [\"derive\"]\n\n[dev-dependencies.sha2]\nversion = \"0.10\"\ndefault-features = false\nfeatures = [\"std\"]\n", - "dest": "cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801/craft-crw", + "dest": "cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09/craft-crw", "dest-filename": "Cargo.toml" }, { "type": "inline", "contents": "{\"package\": null, \"files\": {}}", - "dest": "cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801/craft-crw", + "dest": "cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09/craft-crw", "dest-filename": ".cargo-checksum.json" }, { @@ -1939,6 +1945,24 @@ "dest": "cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801/craft-media", "dest-filename": ".cargo-checksum.json" }, + { + "type": "shell", + "commands": [ + "mkdir -p \"cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09\" && cp -r --reflink=auto \"flatpak-cargo/git/craft-libs-3a6613f/crates/metadata\" \"cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09/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/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09/craft-metadata", + "dest-filename": "Cargo.toml" + }, + { + "type": "inline", + "contents": "{\"package\": null, \"files\": {}}", + "dest": "cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09/craft-metadata", + "dest-filename": ".cargo-checksum.json" + }, { "type": "shell", "commands": [ @@ -2050,19 +2074,37 @@ { "type": "shell", "commands": [ - "mkdir -p \"cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801\" && cp -r --reflink=auto \"flatpak-cargo/git/craft-libs-c28356d/crates/raw\" \"cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801/craft-raw\"" + "mkdir -p \"cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09\" && cp -r --reflink=auto \"flatpak-cargo/git/craft-libs-3a6613f/crates/raw\" \"cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09/craft-raw\"" ] }, { "type": "inline", "contents": "[package]\nname = \"craft-raw\"\ndescription = \"Camera raw files, the file-format layer: container parsing, decompression and the sensor data out as a neutral raw image with its levels, crop, orientation, colour tags and embedded previews. DNG (read and write), Hasselblad 3FR/FFF, MRW, ERF, MEF, Kodak DCS, Pentax PEF, Samsung SRW, Canon CR2, Nikon NEF/NRW, Panasonic RW2, Fujifilm RAF, Olympus ORF (uncompressed), Sony ARW, Canon CR3 and Canon CRW so far.\"\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 = [\"dng\", \"jxl\", \"crw\", \"hasselblad\", \"mrw\", \"erf\", \"mef\", \"kodak\", \"pef\", \"srw\", \"cr2\", \"nef\", \"rw2\", \"raf\", \"orf\", \"arw\", \"cr3\"]\ndng = [\"dep:miniz_oxide\", \"dep:zune-jpeg\", \"dep:zune-core\"]\njxl = [\"dng\", \"dep:jxl-oxide\"]\nhasselblad = [\"dng\"]\nmrw = []\nerf = []\nmef = []\nkodak = []\npef = []\nsrw = []\ncr2 = []\nnef = []\nrw2 = []\nraf = []\norf = []\narw = []\ncr3 = [\"dep:craft-metadata\"]\ncrw = [\"dep:craft-crw\", \"dep:chrono\"]\n\n[dependencies]\nthiserror = \"2\"\nrayon = \"1\"\n\n[dependencies.craft-tiff]\npath = \"crates/tiff\"\n\n[dependencies.craft-crw]\noptional = true\npath = \"crates/crw\"\n\n[dependencies.craft-metadata]\noptional = true\npath = \"crates/metadata\"\n\n[dependencies.serde]\nversion = \"1\"\nfeatures = [\"derive\"]\n\n[dependencies.chrono]\noptional = true\nversion = \"0.4.45\"\ndefault-features = false\nfeatures = [\"std\"]\n\n[dependencies.miniz_oxide]\nversion = \"0.9\"\noptional = true\n\n[dependencies.zune-jpeg]\nversion = \"0.5\"\ndefault-features = false\nfeatures = [\"std\", \"x86\", \"neon\"]\noptional = true\n\n[dependencies.zune-core]\nversion = \"0.5\"\ndefault-features = false\nfeatures = [\"std\"]\noptional = true\n\n[dependencies.jxl-oxide]\nversion = \"0.12\"\ndefault-features = false\noptional = true\n\n[dev-dependencies]\nproptest = \"1\"\n\n[dev-dependencies.sha2]\nversion = \"0.10\"\ndefault-features = false\nfeatures = [\"std\"]\n\n[dev-dependencies.jpeg-encoder]\nversion = \"0.7\"\ndefault-features = false\nfeatures = [\"std\"]\n\n[dev-dependencies.zune-jpegxl]\nversion = \"0.5\"\ndefault-features = false\nfeatures = [\"std\"]\n", - "dest": "cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801/craft-raw", + "dest": "cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09/craft-raw", "dest-filename": "Cargo.toml" }, { "type": "inline", "contents": "{\"package\": null, \"files\": {}}", - "dest": "cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801/craft-raw", + "dest": "cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09/craft-raw", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "shell", + "commands": [ + "mkdir -p \"cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09\" && cp -r --reflink=auto \"flatpak-cargo/git/craft-libs-3a6613f/crates/tiff\" \"cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09/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/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09/craft-tiff", + "dest-filename": "Cargo.toml" + }, + { + "type": "inline", + "contents": "{\"package\": null, \"files\": {}}", + "dest": "cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09/craft-tiff", "dest-filename": ".cargo-checksum.json" }, { @@ -10281,7 +10323,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=7f30d664695cd5ce14fc30659d36c3e32f234247\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-7afa30ca311804d863bbc144ec2c79a3a321ce72c30264402ae2c6af8a05da44\"\nrev = \"7f30d664695cd5ce14fc30659d36c3e32f234247\"\n\n[source.git-vendor-7afa30ca311804d863bbc144ec2c79a3a321ce72c30264402ae2c6af8a05da44]\ndirectory = \"cargo/vendor-git/7afa30ca311804d863bbc144ec2c79a3a321ce72c30264402ae2c6af8a05da44\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=eeb134def2daa7e03512b4946bd59d6b419b9484\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-92168c1af4f3f511076af4245ec3ce22c5c554b4cc78c215ddf71587aac87d85\"\nrev = \"eeb134def2daa7e03512b4946bd59d6b419b9484\"\n\n[source.git-vendor-92168c1af4f3f511076af4245ec3ce22c5c554b4cc78c215ddf71587aac87d85]\ndirectory = \"cargo/vendor-git/92168c1af4f3f511076af4245ec3ce22c5c554b4cc78c215ddf71587aac87d85\"\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=c28356d400aed7575b04ec1551b4665107cfe845\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801\"\nrev = \"c28356d400aed7575b04ec1551b4665107cfe845\"\n\n[source.git-vendor-547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801]\ndirectory = \"cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801\"\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=4ffa307f1a0a6fbd8897318cc719440ab06e9c63\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-ded75ace3b48131a7498b2ad3ce7884b178155a1ef794dda2327c20c2979a816\"\nrev = \"4ffa307f1a0a6fbd8897318cc719440ab06e9c63\"\n\n[source.git-vendor-ded75ace3b48131a7498b2ad3ce7884b178155a1ef794dda2327c20c2979a816]\ndirectory = \"cargo/vendor-git/ded75ace3b48131a7498b2ad3ce7884b178155a1ef794dda2327c20c2979a816\"\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=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=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=bea6ed1ff031b81df2d64be470485c1ca808847e\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-32c3b4109a3afdabed8bce488e027fa99fcc1b06e4fbe9ee85802b6b73337040\"\nrev = \"bea6ed1ff031b81df2d64be470485c1ca808847e\"\n\n[source.git-vendor-32c3b4109a3afdabed8bce488e027fa99fcc1b06e4fbe9ee85802b6b73337040]\ndirectory = \"cargo/vendor-git/32c3b4109a3afdabed8bce488e027fa99fcc1b06e4fbe9ee85802b6b73337040\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=16d838105b07965832bb43132880176f299634d5\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-879b5ad1e55c0c2de1d740528f2a8f8e2ffec953302517957e516331e9525f03\"\nrev = \"16d838105b07965832bb43132880176f299634d5\"\n\n[source.git-vendor-879b5ad1e55c0c2de1d740528f2a8f8e2ffec953302517957e516331e9525f03]\ndirectory = \"cargo/vendor-git/879b5ad1e55c0c2de1d740528f2a8f8e2ffec953302517957e516331e9525f03\"\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/craft-libs?rev=2d4b8b8ecd79f87c847961901c40305e7f448d6f\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-c00ae949c9fde60d3b15820cc243df0e52fa9adb7e8544da038f0df657e4bd99\"\nrev = \"2d4b8b8ecd79f87c847961901c40305e7f448d6f\"\n\n[source.git-vendor-c00ae949c9fde60d3b15820cc243df0e52fa9adb7e8544da038f0df657e4bd99]\ndirectory = \"cargo/vendor-git/c00ae949c9fde60d3b15820cc243df0e52fa9adb7e8544da038f0df657e4bd99\"\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=7f30d664695cd5ce14fc30659d36c3e32f234247\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-7afa30ca311804d863bbc144ec2c79a3a321ce72c30264402ae2c6af8a05da44\"\nrev = \"7f30d664695cd5ce14fc30659d36c3e32f234247\"\n\n[source.git-vendor-7afa30ca311804d863bbc144ec2c79a3a321ce72c30264402ae2c6af8a05da44]\ndirectory = \"cargo/vendor-git/7afa30ca311804d863bbc144ec2c79a3a321ce72c30264402ae2c6af8a05da44\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=eeb134def2daa7e03512b4946bd59d6b419b9484\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-92168c1af4f3f511076af4245ec3ce22c5c554b4cc78c215ddf71587aac87d85\"\nrev = \"eeb134def2daa7e03512b4946bd59d6b419b9484\"\n\n[source.git-vendor-92168c1af4f3f511076af4245ec3ce22c5c554b4cc78c215ddf71587aac87d85]\ndirectory = \"cargo/vendor-git/92168c1af4f3f511076af4245ec3ce22c5c554b4cc78c215ddf71587aac87d85\"\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=3a6613f058e355a4fd8d196b2f385260bd4b4a8e\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09\"\nrev = \"3a6613f058e355a4fd8d196b2f385260bd4b4a8e\"\n\n[source.git-vendor-fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09]\ndirectory = \"cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09\"\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=4ffa307f1a0a6fbd8897318cc719440ab06e9c63\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-ded75ace3b48131a7498b2ad3ce7884b178155a1ef794dda2327c20c2979a816\"\nrev = \"4ffa307f1a0a6fbd8897318cc719440ab06e9c63\"\n\n[source.git-vendor-ded75ace3b48131a7498b2ad3ce7884b178155a1ef794dda2327c20c2979a816]\ndirectory = \"cargo/vendor-git/ded75ace3b48131a7498b2ad3ce7884b178155a1ef794dda2327c20c2979a816\"\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=c28356d400aed7575b04ec1551b4665107cfe845\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801\"\nrev = \"c28356d400aed7575b04ec1551b4665107cfe845\"\n\n[source.git-vendor-547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801]\ndirectory = \"cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801\"\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=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=bea6ed1ff031b81df2d64be470485c1ca808847e\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-32c3b4109a3afdabed8bce488e027fa99fcc1b06e4fbe9ee85802b6b73337040\"\nrev = \"bea6ed1ff031b81df2d64be470485c1ca808847e\"\n\n[source.git-vendor-32c3b4109a3afdabed8bce488e027fa99fcc1b06e4fbe9ee85802b6b73337040]\ndirectory = \"cargo/vendor-git/32c3b4109a3afdabed8bce488e027fa99fcc1b06e4fbe9ee85802b6b73337040\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=16d838105b07965832bb43132880176f299634d5\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-879b5ad1e55c0c2de1d740528f2a8f8e2ffec953302517957e516331e9525f03\"\nrev = \"16d838105b07965832bb43132880176f299634d5\"\n\n[source.git-vendor-879b5ad1e55c0c2de1d740528f2a8f8e2ffec953302517957e516331e9525f03]\ndirectory = \"cargo/vendor-git/879b5ad1e55c0c2de1d740528f2a8f8e2ffec953302517957e516331e9525f03\"\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/craft-libs?rev=2d4b8b8ecd79f87c847961901c40305e7f448d6f\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-c00ae949c9fde60d3b15820cc243df0e52fa9adb7e8544da038f0df657e4bd99\"\nrev = \"2d4b8b8ecd79f87c847961901c40305e7f448d6f\"\n\n[source.git-vendor-c00ae949c9fde60d3b15820cc243df0e52fa9adb7e8544da038f0df657e4bd99]\ndirectory = \"cargo/vendor-git/c00ae949c9fde60d3b15820cc243df0e52fa9adb7e8544da038f0df657e4bd99\"\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" }