Commit Graph
25 Commits
Author SHA1 Message Date
robmdunn 8eeb0f6777 Merge remote-tracking branch 'origin/main' into raw-negative-channels
# Conflicts:
#	crates/engine/src/export/tests.rs
2026-11-15 09:19:36 -05:00
FredApps 1f8e1ef1ad Merge branch 'main' into fix/1619-shutter-precision
# Conflicts:
#	crates/catalog/src/model.rs
#	crates/engine/src/files/tests.rs
#	docs/parity-checklist.md
2026-11-13 20:49:01 +01:00
Dylan M. Taylor 49c9d4e0ca security: bound token expansion, sanitize the name fallback, regular-file sidecar reads, recased sidecar guard
* engine: cap token expansion, clean the catalog-name fallback, bound sidecar and raw reads, protect recased sidecars, cap graphic pixels
2026-11-12 06:28:46 -05:00
Dylan M. Taylor d6ae2e9e7e security(engine): read user-named files through the opened regular file under a byte cap (#3703)
* security(engine): read user-named files through the opened regular file under a byte cap

* address review: compare the probe error with the std::fs::read error

* address review: open files for reading without waiting for a FIFO writer
2026-11-11 14:34:39 -05:00
robmdunn c82e898b0a Merge remote-tracking branch 'origin/main' into raw-negative-channels
# Conflicts:
#	crates/pipeline/src/tests.rs
2026-11-09 08:02:51 -05:00
a856df5f42 Write camera make and lens make to EXIF on export (#3828)
* Write camera make and lens make to EXIF on export

PTGui and similar stitching tools read EXIF Make/LensMake to identify camera and lens; without them, exported JPEGs from CR2 files are not recognized the same way as Adobe's export.

Add make and lens_make fields to catalog Meta, populate them from the raw's EXIF on import in meta_of, and write them as EXIF Make and LensMake tags in export_metadata.

Test: export_writes_camera_make_and_lens_make_to_exif failed before the change and passes after.

* Export: read Make and LensMake on import and write them, with Model on its own

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Export: strip the maker from Model only as a separate word

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: eliets2 <287273517+eliets2@users.noreply.github.com>
Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 10:56:51 +01:00
0429844cd9 never-crash: deny the panic lints in every crate root; GPU asserts become fail paths (#2137) (#2170)
* never-crash: deny the panic lints in every crate root; GPU asserts become fail paths (#2137)

The never-crash policy was documented but not machine-checked for the two largest crates:
engine and meta carried only #![forbid(unsafe_code)], so a future unwrap/expect/panic would
pass cargo xtask ci. Both crate roots now also carry
as does xtask (previously un-annotated); the guarded expects in meta/src/xmp.rs and xtask's
parity.rs / root() now use the documented #[allow(clippy::expect_used)] + invariant form.

crates/gpu: the three production asserts become fail(FailKind::Fatal, ..) + return, so a
binding-count mismatch, an over-long readback, or a wrong-length curve fails the render over
to the CPU instead of crashing (finish_and_read also early-returns on len == 0, which would
have issued a zero-size copy_buffer_to_buffer that wgpu rejects).

xtask: new roots check (in ci) verifies every workspace lib root and every binary main.rs
carries both attributes; crates/sysmem is the documented exception for forbid(unsafe_code)
only. A panic in placement or readback is a fail, not a crash.

* audit fixes: roots covers binary and cdylib/rlib roots; render gates on failed() after finish_block (#2137)

Two reviewers audited the first commit; both highs it found are fixed here:

- roots scanner: the by_ref().any()/any() pair consumed the kind iterator hunting for
  "lib", so every bin-only root (both app mains, the sam3-worker bin, xtask itself) and the
  cdylib/rlib web root was silently unchecked — the check covered 29 of the 33 real roots.
  Kind detection now collects the kinds once and matches lib/rlib/dylib/cdylib/staticlib,
  with a root_paths regression test over bin, lib and cdylib/rlib targets; unreadable root
  files now fail with the I/O error instead of a fake policy violation.
- render.rs: the caller gates on failed() right after finish_block, so the malformed-curve
  fail path can no longer reach the band loop's p[y0_at] index on the empty block.
- finish_and_read: the len == 0 path now submits the encoder before returning zeros, so a
  failure staged in the same render stays detectable (the old zero-size copy failed loudly
  via the error scopes; a bare return would have hidden it).
- docs: finish_block and finish_and_read state their failure contracts; USAGE and AGENTS.md
  name the new roots step in the ci enumeration.

* xtask: check a library root at the source path that cargo metadata reports

The roots check read src/lib.rs for every library target, so a package that sets its library path was checked on the wrong file. Libraries now use the reported source path, with the same default as binaries when none is given.

* xtask: match the crate-root deny lints by whole name, ignoring a trailing comment

A lint named only in a trailing comment, or a lint whose name contains another (clippy::panic inside clippy::panic_in_result_fn), satisfied the deny check. Lint names are now compared whole and a trailing comment is ignored.

* xtask: read the crate-root attributes from the header, not a fixed 30 lines

The roots check read only the first 30 lines of each crate root, so a root whose attributes came after a longer doc header was reported as missing them. The check now reads the inner attributes at the top of the file: it skips blank lines and comments, reads each attribute whole, and stops at the first item. A multi-line list is read in full and a commented-out attribute does not count.

* xtask: reword two comments in the roots check

Comments only: the lint-name match and the source-path default are described without naming a lint or a build tool. No code changes.

* xtask: report a root attribute that overrides the required denies

* xtask: accept a runtime manifest dir only when it has a parent

* xtask: render the overridden deny attribute without literal braces

The write! escaped the braces around the substituted attribute and lint,
so the violation printed `#![{allow}({clippy::panic})]`; assert the
rendered message in the allow-override test.

* Tests: new test helpers meet the crate-root panic lints

Main added test helpers after this branch; the deny at the crate root now
applies to them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* roots: crates/wincolor is the second crate allowed unsafe

Main added it for the Windows colour APIs after this branch; its module docs
already say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: eliets2 <287273517+eliets2@users.noreply.github.com>
Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 00:29:41 +01:00
84a6f5674c Give the pipeline one exact output size instead of re-fitting (#3749)
* Give the pipeline one exact output size instead of re-fitting

Export and the pipeline each compute the output size independently from two descriptions of the photo's shape, so an already-chosen export size can come back a pixel short when the pipeline re-fits against a reduced source whose aspect rounds differently.

Add an exact output size to RenderRequest, make plan take it unchanged via an exact Frame::sized mode, drop the aspect-tolerance guard, and have export resolve one canonical size before calling the pipeline; add a unit test asserting plan returns the requested size unchanged when it matches the frame aspect.

Test: plan_preserves_matching_box_size failed before the change and passes after.

* Honor exact output dimensions for exports

Assisted-by: OpenAI Codex

* Export: an exact size does not stretch a source of another shape

A raw whose decode failed can fall back to an embedded preview with a
different aspect. The exact box now stands only against a proxy that differs
by rounding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: eliets2 <287273517+eliets2@users.noreply.github.com>
Co-authored-by: FredApps <FredApps@users.noreply.github.com>
Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 21:42:13 +01:00
58da12bc5c Export: built-in presets for Instagram Feed, Story / Reel, Web / Portfolio, Full Resolution (#2104) (#2209)
* The named-export-preset system itself (export.presets / export.savePreset /
export.deletePreset, user presets saved with the library, the Export dialog
dropdown and File > Export with Preset) already existed; this adds the four
named built-ins the issue asks for, locks them in with an expand / round-trip /
apply test, and updates the LR-EXP-DIALOG and LR-EXP-PREVIOUS tracker rows
(the stale 'no named export presets yet' note goes away).

* #2104: test all four built-in export presets, not only Instagram Feed

The named built-in preset test expanded, validated and rendered Instagram Feed alone. It now runs the
same checks for each of the four names: the expanded settings, validation as app.export params, the
round trip through a user preset, and a render at the size the preset sets. Full Resolution Master
sets no long edge, so its render must be the photo's own size, with no resize. The rendered size is
also compared with output_size, the same calculation the exporter uses.

* The preset sets a 1920 px long edge and nothing about the shape, so a 3:2 photo exports at
1920 x 1280 and no 9:16 frame is made. The export options have no crop-to-aspect setting, and none
is added here. The preset's doc comment and the LR-EXP-DIALOG row of the parity checklist say so, and
the checklist has a revision line for this and for the translations.

* The Export dialog shows built-in preset names through builtin_label, which looks them up in the
language catalogs. Instagram Feed, Instagram Story / Reel, Web / Portfolio and Full Resolution Master
were in none of the catalogs, so every language showed them in English. Each catalog now carries the
four names next to the existing JPEG (Small) and JPEG (Large) entries. The translations are drafts
and need review by a native speaker of each language.

A new test checks that every catalog has an entry for each of the four names. The catalog comparison
only reports gaps, so without this test a missing name would pass silently.

* Address review for pull request 2209

* #2104: the four built-in export preset names in the catalogs main added after this branch was cut (Finnish, Indonesian, Swedish, Vietnamese). The i18n test that every catalog carries the four names failed on them after the rebase; each of the four now carries them next to the existing JPEG (Large) entry, in the same shape as the other thirteen catalogs. The translations are drafts and need review by a native speaker of each language.

* Say the Web / Portfolio preset keeps copyright and creator metadata

The copyright export metadata policy embeds the copyright notice, status,
usage terms and info URL together with the creator (export/encoding.rs fills
the artist field before the policy match returns), so the LR-EXP-DIALOG row
and the 2026-10-17 revision line understated the preset as keeping
copyright-only metadata. Both now say copyright and creator metadata.

* Docs: finish the parity-checklist merge

The merge left conflict markers in the revision history.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: eliets2 <287273517+eliets2@users.noreply.github.com>
Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 21:08:12 +01:00
robmdunn c4ed480d0c Merge remote-tracking branch 'origin/main' into raw-negative-channels
# Conflicts:
#	crates/engine/src/files.rs
#	crates/gpu/tests/it/equivalence.rs
#	docs/parity-checklist.md
2026-11-05 07:41:25 -05:00
stephen schureskoandFredApps 56d1cc2865 pipeline: apply 8x8 ordered Bayer dithering to prevent display banding (#3509)
* pipeline: apply 8x8 ordered Bayer dithering to prevent display banding

Quantizing float linear/display pixel values to 8-bit integers using
round-to-nearest produces noticeable Mach bands and contour stepping on
smooth gradients (skies, shallow depth-of-field backgrounds, skin tones).

This applies an 8x8 ordered Bayer dithering pattern centered around round-to-nearest
with sub-LSB amplitude in both CPU finish (crates/pipeline) and GPU compute
shader (crates/gpu/src/wgsl/finish.wgsl). Exact integer levels, pure black,
and white remain noise-free, while fractional gradients smoothly dissolve into
continuous gradations. Dithering coordinates account for window/tile view offsets
to maintain phase alignment across zoom tiles.

* pipeline, gpu: address review feedback on Bayer dithering

- Always pack VIG_VIEW in GPU params so windowed renders without a vignette
  maintain the correct absolute view origin for Bayer dithering coordinates.
- Restore the full Bayer threshold range (0..1) without deadzones, preserving
  float white via direct half-LSB rounding to prevent edge quantization drop.
- Return the true sampled bounds midpoint in geometry sub-pixel edge detector
  fallbacks.
- Add docstrings to satisfy coverage checks.

* pipeline, gpu: narrow highlight white guard to allow dithering on 254.5

* tests(pipeline): assert edge contrast in manual keystone tracking windows

* docs(pipeline): add docstrings to touched test functions

* Export tests: count distinct levels however the dither orders them

* Mask geometry tests ignore a level of 8-bit dither

---------

Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
2026-11-05 06:47:45 +01:00
robmdunn b9fd871d3c Merge remote-tracking branch 'origin/main' into raw-negative-channels
# Conflicts:
#	crates/engine/src/media/source.rs
2026-11-04 22:50:32 -05:00
robmdunn b119d4d2dc LR-PROF-CAMERACOLOR: a dark frame with negative channels exports in every format
A near-black frame with negative channels, pushed +4 EV, goes through the
export's render request and encoders (encode_rendered, the gain map JPEG)
for every rendered format, depth and HDR mode. Each file decodes to the
right size with finite samples (AVIF and the linear DNG by structure), and
a half-size JPEG comes out less tinted than the same frame clamped at
decoding.
2026-11-01 14:20:09 -05:00
FredApps 95455a73ce Merge main into branch, combining the parity checklist rows both sides edited 2026-10-31 07:28:20 +01:00
insideTheFluxandClaude Opus 5.5 f85915821d Merge storytold/main into fix/2571-export-subfolder
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CvoftM8ZqGRb62UWw9DAKP
2026-10-30 23:25:08 -07:00
aiongg 1765d19c20 Merge PR #2890: Export: note when LZW is picked for TIFF, 16-bit ZIP size test (#2882)
crates/engine/src/export.rs: main moved the code to export/; the 16-bit ZIP size test ported to export/tests.rs
crates/ui-egui/src/panels/dialogs.rs: main moved the dialog to dialogs.rs and dialogs/export.rs; the LZW note helpers, preset hover hint and tests ported there
crates/ui-egui/src/panels/grid.rs: calls crate::dialogs::preset_lzw_note
The doc comment of export_dialog_params stays directly above that function (review fix)
2026-10-31 02:08:09 +00:00
aiongg c0df71dde6 Merge PR #2849: LR-EXP-METADATA: refuse Originals with embedded place names
crates/engine/src/export.rs: main moved the code to export/prepare.rs; hunk ported there by hand
docs/gaps.md, docs/parity-checklist.md: header keeps the newer line, revision rows are the union
2026-10-31 02:07:23 +00:00
FredApps 1d7d188846 Reconcile shutter precision with split import/export modules
Preserve main's module boundaries and current metadata behavior. Move the shutter changes and regressions into the corresponding probe, encoding and test modules. Preserve both parity records. Hosted CI must validate this refreshed head.
2026-10-30 08:13:52 +01:00
Dylan M. Taylor c9d44f7804 style(engine): expand module imports explicitly 2026-10-28 03:24:18 +00:00
Dylan M. Taylor 4d8369b091 test(engine): factor complex regression scenarios 2026-10-28 03:24:18 +00:00
NetterSilverandClaude Opus 5.5 3ce8dbc55b Drop copies and libm calls from 8-bit export encoding
- finish_8bit/finish_deep hand back the render itself when there is no
  output sharpening and no watermark. Before, every export cloned the
  image (~100 MB at 24 MP) and output_sharpen built a ~290 MB float copy
  of it even for SharpenFor::None, all on one thread.
- Output sharpening's box blurs run row-parallel (par_rows); each pixel
  is computed as before.
- The parallel JPEG encoder converts each band's rows to YCbCr inside the
  band's task instead of first filling whole-image planes (~290 MB for
  4:4:4 at 24 MP, written once and read back).
- fdct_quant rounds with plain arithmetic (round_i16) instead of
  f32::round, a libm call per coefficient without SSE4.1; it equals
  `x.round() as i16` for all 2^32 inputs.

Output is byte-identical (pinned by encoded_bytes_are_pinned and
sharpened_pixels_are_pinned, whose hashes come from main).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 15:43:41 +01:00
insideTheFluxandClaude Opus 5.5 8702bcc356 Merge storytold/main into fix/2571-export-subfolder
main split export.rs into export/ (#3103): clean_subfolder sits beside join_path in export/place.rs,
where folder_for uses it, and export/params.rs imports it for from_json.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GfjNkJiMUagz3DN3zoV2rV
2026-10-26 18:45:27 -07:00
aiongg e3c594cab8 refactor(lightcraft-engine): split export.rs into export/ 2026-10-26 21:08:55 +00:00
aiongg d151df0149 style: cargo fmt the moved test modules 2026-10-26 18:30:36 +00:00
aiongg 50116167a6 refactor(lightcraft-engine): move export.rs tests to crates/engine/src/export/tests.rs 2026-10-26 18:15:51 +00:00