This commit is contained in:
Brandon Thomas committed 2026-10-14 22:32:07 -04:00
commit 75e0a6dd2a
9 files changed
+22 -37

No files matched your search

+6 -8
View File
@@ -75,14 +75,12 @@ pub(crate) fn parse_markers(b: &[u8]) -> Option<Markers> {
let end = (p + 2 + len).min(b.len());
let seg = &b[start..end];
match marker {
0xC0..=0xCF if marker != 0xC4 && marker != 0xC8 && marker != 0xCC => {
if seg.len() >= 6 && m.components == 0 {
m.precision = seg[0];
m.sof = marker;
m.height = u16::from_be_bytes([seg[1], seg[2]]) as u32;
m.width = u16::from_be_bytes([seg[3], seg[4]]) as u32;
m.components = seg[5];
}
0xC0..=0xCF if marker != 0xC4 && marker != 0xC8 && marker != 0xCC && seg.len() >= 6 && m.components == 0 => {
m.precision = seg[0];
m.sof = marker;
m.height = u16::from_be_bytes([seg[1], seg[2]]) as u32;
m.width = u16::from_be_bytes([seg[3], seg[4]]) as u32;
m.components = seg[5];
}
0xE1 => {
if seg.starts_with(b"Exif\0\0") && m.exif.is_none() {
+1 -1
View File
@@ -155,7 +155,7 @@ fn dng_colour(tags: &ColorData, t: &CameraTransform, look: Option<&CameraLook>)
// into the baseline exposure
let white = m.apply([1.0; 3]);
let k = (white[0] + white[1] + white[2]) / 3.0;
if !(k.is_finite() && k > 1e-6) || !t.wb.iter().all(|w| w.is_finite() && *w > 0.0) {
if !(k.is_finite() && k > 1e-6 && t.wb.iter().all(|w| w.is_finite() && *w > 0.0)) {
return None;
}
let m = Mat3(m.0.map(|r| r.map(|v| v / k)));
+1 -1
View File
@@ -1554,7 +1554,7 @@ impl crate::Session {
/// says and what a smart preview renders with. Only for raws edited in Kelvin.
fn learn_as_shot_wb(&mut self, id: PhotoId, info: &SourceInfo) {
let Some(p) = self.catalog.photo(id) else { return };
if !(info.raw && !info.relative_wb && p.develops_raw() && !p.relative_wb()) {
if !info.raw || info.relative_wb || !p.develops_raw() || p.relative_wb() {
return;
}
let read = (info.as_shot_temp, info.as_shot_tint);
+4 -4
View File
@@ -510,10 +510,10 @@ pub fn read_packet(original: &str, kind: MediaKind, naming: SidecarNaming) -> Op
/// Photo ids touched by an op (for auto-write).
pub(crate) fn op_photos(op: &Op, out: &mut Vec<PhotoId>) {
match op {
Op::SetRating { id, .. } | Op::SetFlag { id, .. } | Op::SetLabel { id, .. } | Op::SetDevelop { id, .. } | Op::SetMeta { id, .. } => {
if !out.contains(id) {
out.push(*id);
}
Op::SetRating { id, .. } | Op::SetFlag { id, .. } | Op::SetLabel { id, .. } | Op::SetDevelop { id, .. } | Op::SetMeta { id, .. }
if !out.contains(id) =>
{
out.push(*id);
}
Op::Batch { ops } => ops.iter().for_each(|o| op_photos(o, out)),
_ => {}
+1 -5
View File
@@ -186,11 +186,7 @@ pub(super) fn check(n: &Node, g: &Graph) -> Result<()> {
floats(n, g, 2)?;
}
}
"Dropout" => {
if !(0.0..1.0).contains(&float(n, "ratio", 0.5)) {
return shape_err("Dropout ratio is invalid");
}
}
"Dropout" if !(0.0..1.0).contains(&float(n, "ratio", 0.5)) => return shape_err("Dropout ratio is invalid"),
"MaxPool" => {
pair(n, "kernel_shape", 1)?;
pair(n, "strides", 1)?;
+1 -5
View File
@@ -114,11 +114,7 @@ pub fn parse_gpx(s: &str) -> Result<Tracklog, GpxError> {
match name.as_slice() {
b"gpx" if path.is_empty() => seen_gpx = true,
b"trk" if parent == Some(b"gpx") => log.tracks += 1,
b"trkseg" if parent == Some(b"trk") => {
if log.points.last().is_some_and(|p| p.segment == segment) {
segment += 1;
}
}
b"trkseg" if parent == Some(b"trk") && log.points.last().is_some_and(|p| p.segment == segment) => segment += 1,
b"trkpt" if parent == Some(b"trkseg") => {
let mut p = Pending::default();
for a in e.attributes().with_checks(false).flatten() {
+5 -7
View File
@@ -252,13 +252,11 @@ fn parse_tree(s: &str) -> Result<Node, XmpError> {
stack.push(node);
}
}
Event::End(_) => {
if stack.len() > 1 {
let n = stack.pop().expect("len > 1");
scopes.pop();
if let Some(parent) = stack.last_mut() {
parent.children.push(n);
}
Event::End(_) if stack.len() > 1 => {
let n = stack.pop().expect("len > 1");
scopes.pop();
if let Some(parent) = stack.last_mut() {
parent.children.push(n);
}
}
Event::Text(t) => {
+1 -1
View File
@@ -147,7 +147,7 @@ pub fn legacy_to_kelvin(temp: f64, tint: f64, as_shot: (f64, f64)) -> (f64, f64)
/// edited on a rendered photo or a raw without matrices never pass for Kelvin when pasted onto one that has them.
pub fn normalize_wb(d: &mut DevelopSettings, info: &SourceInfo) {
use lightcraft_develop::{WbMode, WbScale};
if !(info.raw && !info.relative_wb) {
if !info.raw || info.relative_wb {
d.wb.scale = WbScale::Legacy;
return;
}
+2 -5
View File
@@ -192,11 +192,8 @@ pub fn check(crates: &[Crate]) -> Vec<Violation> {
match classify(&d.name) {
// Unregistered deps are reported on their own entry.
None => {}
Some(Class::Testkit) => {
if d.kind != DepKind::Dev {
out.push(Violation::TestkitAsNormalDep { krate: c.name.clone() });
}
}
Some(Class::Testkit) if d.kind != DepKind::Dev => out.push(Violation::TestkitAsNormalDep { krate: c.name.clone() }),
Some(Class::Testkit) => {}
Some(dc) => {
let to = dc.layer().unwrap_or(u8::MAX);
if to >= layer && !(to == layer && intra_layer_allowed(&c.name, &d.name)) {