mirror of
https://github.com/storytold/lightcraft.git
synced 2026-11-25 03:53:53 +01:00
build: keep only craft-libs b2d2a1e94 pin bump in PR #4674
This commit is contained in:
4 files changed
+3
-43
No files matched your search
@@ -180,7 +180,7 @@ fn load_bytes_now(
|
||||
Some((img, mask)) => (img, Some(mask)),
|
||||
None => {
|
||||
let method = if max_edge <= 600 { lightcraft_raw::Method::Bilinear } else { lightcraft_raw::Method::Ahd };
|
||||
raw.take_develop_balanced_masked(method, t.wb, HIGHLIGHT_CLIP).map_err(|e| e.to_string())?
|
||||
(raw.develop(method).map_err(|e| e.to_string())?, None)
|
||||
}
|
||||
};
|
||||
// the same development from the denoised mosaic, when the photo has been denoised
|
||||
|
||||
@@ -588,11 +588,10 @@ fn cached_denoise_uses_the_same_white_balance_profile_and_orientation_as_plain_r
|
||||
raw.color.profile.look_table =
|
||||
Some(HsvTable { hue_divisions: 1, sat_divisions: 2, val_divisions: 1, data: vec![[23.0, 0.65, 0.8]; 2], srgb_value: false });
|
||||
let bytes = write_dng(&raw, &DngWriteOptions::default()).unwrap();
|
||||
let mut decoded = lightcraft_raw::decode(&bytes).unwrap();
|
||||
let decoded = lightcraft_raw::decode(&bytes).unwrap();
|
||||
assert!(decoded.color.profile.look_table.is_some());
|
||||
// A cache containing the ordinary demosaic must undergo the identical downstream finish.
|
||||
let (_, t, _) = crate::camera_preview::starting_colour(&mut decoded, &bytes, None, None);
|
||||
let (camera_rgb, _) = decoded.take_develop_balanced_masked(Method::Ahd, t.wb, super::HIGHLIGHT_CLIP).unwrap();
|
||||
let camera_rgb = decoded.develop(Method::Ahd).unwrap();
|
||||
let key = "synthetic-color-finish";
|
||||
let path = dir.join("same.lcdn");
|
||||
product::write(&path, &camera_rgb, key).unwrap();
|
||||
|
||||
@@ -390,32 +390,6 @@ impl RawImage {
|
||||
Ok(self.finish_demosaiced(rgb))
|
||||
}
|
||||
|
||||
/// [`Self::develop`] with white balance `wb` applied to the mosaic before directional demosaicing,
|
||||
/// then divided back to camera RGB.
|
||||
pub fn develop_balanced(&self, method: Method, wb: [f32; 3]) -> Result<Rgb32f> {
|
||||
let mut craft = bridge::to_craft_raw_header(self);
|
||||
craft.data = self.data.clone();
|
||||
craft_develop::sensor::RawDevelopExt::develop_balanced(&craft, method, wb).map(bridge::from_craft_rgb32f)
|
||||
}
|
||||
|
||||
/// [`Self::develop_balanced`] with a per-pixel sensor clip mask for [`highlight::reconstruct_masked`].
|
||||
pub fn develop_balanced_masked(&self, method: Method, wb: [f32; 3], clip: f32) -> Result<(Rgb32f, Option<Vec<u8>>)> {
|
||||
let mut craft = bridge::to_craft_raw_header(self);
|
||||
craft.data = self.data.clone();
|
||||
let (rgb, mask) = craft_develop::sensor::RawDevelopExt::develop_balanced_masked(&craft, method, wb, clip)?;
|
||||
Ok((bridge::from_craft_rgb32f(rgb), mask))
|
||||
}
|
||||
|
||||
/// Like [`Self::develop_balanced_masked`], moving `self.data` temporarily to avoid cloning raw samples.
|
||||
pub fn take_develop_balanced_masked(&mut self, method: Method, wb: [f32; 3], clip: f32) -> Result<(Rgb32f, Option<Vec<u8>>)> {
|
||||
let mut craft = bridge::to_craft_raw_header(self);
|
||||
craft.data = std::mem::replace(&mut self.data, RawData::U16(Vec::new()));
|
||||
let res = craft_develop::sensor::RawDevelopExt::develop_balanced_masked(&craft, method, wb, clip);
|
||||
self.data = craft.data;
|
||||
let (rgb, mask) = res?;
|
||||
Ok((bridge::from_craft_rgb32f(rgb), mask))
|
||||
}
|
||||
|
||||
/// The last steps of [`Self::develop`] for camera RGB made some other way (a denoiser that demosaics too) from
|
||||
/// [`Self::normalized`]'s mosaic: apply `OpcodeList3`, then the default crop.
|
||||
pub fn finish_demosaiced(&self, mut rgb: Rgb32f) -> Rgb32f {
|
||||
|
||||
@@ -600,16 +600,3 @@ fn probe_rejects_junk() {
|
||||
assert!(decode(b"FUJIFILMCCD-RAW 0201").is_err());
|
||||
assert_eq!(decode(b"junk"), Err(RawError::NotRaw));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn develop_balanced_and_masked_match_take_variant() {
|
||||
let bytes = plain_cfa_tiff(1, le_words(&cfa_samples()), None);
|
||||
let mut raw = decode(&bytes).expect("decode");
|
||||
let wb = [2.5, 1.0, 1.6];
|
||||
let balanced = raw.develop_balanced(Method::Ahd, wb).expect("develop_balanced");
|
||||
let (masked, mask_a) = raw.develop_balanced_masked(Method::Ahd, wb, 0.99).expect("develop_balanced_masked");
|
||||
let (taken, mask_b) = raw.take_develop_balanced_masked(Method::Ahd, wb, 0.99).expect("take_develop_balanced_masked");
|
||||
assert_eq!(balanced.data, masked.data);
|
||||
assert_eq!(masked.data, taken.data);
|
||||
assert_eq!(mask_a, mask_b);
|
||||
}
|
||||
Reference in new issue
Block a user