169 Commits
Author SHA1 Message Date
Dylan M. Taylor 928326271c RAW #587: choose the actual frame budget for shared CFA development (#16699) 2026-11-24 18:20:07 -05:00
FredApps f7fe0b1c89 raw: tell sensor clipping before lens shading; native-only worker test
- `sensor_clipped` and the rebuild's clip mask read the measured sample
  before the DNG gain map: a gain above one no longer makes an unclipped
  sample count as clipped, and a gain below one no longer hides a sample
  the sensor clipped. The rebuild applies the gain map after the mask,
  before white balance; the clamped path is unchanged.
- The worker-budget test runs only where `with_threads` can size a pool
  (not wasm32).
- New test: a sensor-clipped green disc under a 0.8 gain map is rebuilt
  neutral (fails without the fix: [28740, 27176, 29334]).

Part of storytold/craft-libs#778
2026-11-24 17:13:12 +01:00
FredApps e75657ae55 raw: answer the highlight-rebuild review (budget, CFA period, white)
- The rebuild's memory admission counts the AHD tile scratch of every
  worker the whole-frame demosaic runs, not one; a frame that no longer
  fits keeps the clip-after-balance fallback and its warning.
- `Cfa::is_bayer` requires an even period on both axes: a 3x2 RGR/GBG
  looked Bayer over two columns, and the rebuild then applied the green
  gain to a red sample at x = 3.
- The rebuild's white is the balanced camera RGB the active colour model
  renders neutral (a camera look may tint [1, 1, 1]); models that already
  render [1, 1, 1] neutral keep it exactly, so existing output is unchanged.
- Tests: the odd-strip AHD fixture stays below the sensor clip and says
  so; both clipped-disc tests require the disc brighter than its surround;
  new tests for the worker budget, the tinting look and the 3x2 CFA each
  fail without their fix.

Part of storytold/craft-libs#778
2026-11-24 15:47:00 +01:00
FredApps 9244d9494e Merge remote-tracking branch 'origin/main' into fix/16494-highlight-rebuild 2026-11-24 11:14:46 +07:00
FredApps a8d463fabc raw: rebuild sensor-clipped highlights instead of clipping after white balance
Develops a clipped Bayer frame unclamped and rebuilds the clipped
highlights with craft-develop's reconstruct_masked, so RAW Open matches
LightCraft before tone. Frames too large to rebuild within the memory
limit keep the clip and report a warning. Rebless the RAW Open baseline
corner pixels and Linux hashes.

Fixes #16494
Part of storytold/craft-libs#778
2026-11-23 15:13:08 +01:00
aiongg 9cf019ed37 Delete files no module compiles (widgets, point curve, brush controls, analysis_ui, old cursors, dead editors and tests, nefc tests) 2026-11-23 05:50:07 +00:00
FredApps 3c7bcd4734 Test cropped DNG gain-map parity across RAW Open strips (#16464) 2026-11-22 18:01:17 -05:00
Dylan M. Taylor 406ac677e1 raw: cap shared Bayer develop strip memory (#16420)
* Bound shared Bayer RAW development strip memory

* test(raw): check calibrated Bayer output across strip seams
2026-11-22 13:03:36 -05:00
Dylan M. Taylor 65fc546bba raw, camera_raw: adopt craft-develop 7631ed550 and add explicit parity tests (#587) (#16393)
* raw,camera_raw: bump craft-develop to 7631ed550 and add explicit parity tests (#587)

* raw,camera_raw: cut over develop_sensor demosaic and camera_raw::develop to craft_develop (#587)

* raw,camera_raw: fix craft_develop field names and test imports (#587)

* camera_raw: fix clippy excessive_precision and unnecessary cast lints

* raw,camera_raw: use exact gaussian_taps for sharpening, silence camera_raw_gpu dead_code, update post-cutover pins

* raw,camera_raw: fix highlights sign, <0.3px sharpen noop, non-Bayer/fused parity, and gpu test ignores

* engine: update camera_raw_filter_legacy_baseline_pixels to post-cutover craft_develop baseline

* raw,camera_raw: early-exit noop sharpen, exact full desat, PAD=6 fused margin

* raw,camera_raw: guard <0.3px texture/clarity blur and route fused band demosaic through craft_develop

* io: update default RAW Open baseline pins for craft_develop::sensor::demosaic reflect borders

* io: add Windows libm FNV-1a hash pins for RAW Open baselines
2026-11-22 10:36:03 -05:00
RickiNano eb809af5bb raw hostile tests: a fixed sample by default, the full sweep under PHOTOCRAFT_FULL_SWEEP=1 (#15938)
every_truncation_fails_cleanly tried every 3rd length of every seed and
random_corruption_never_panics 400 corruptions per seed. They now take the
first and last 16 lengths, every 7th length in the first 2 KiB and about
300 lengths per seed past it, and 40 corruptions per seed from a stream of
its own. PHOTOCRAFT_FULL_SWEEP=1 runs every length and 400 corruptions.

Most of the truncation time went to the RW2 seed, whose data is padded to
a 16 KiB block: about 2,300 cuts in the padding that decode the same zeros.
2026-11-21 11:31:13 +01:00
FredApps 3a28b6a25e raw: keep the U16 develop sample loop to one range comparison
The per-sample normalization in fill_samples called a helper that tested
range.is_finite() and range <= 0.0 for every sample, which made 24 MP
monochrome U16 develops ~30% slower than main. A single range > 0.0
test gives the same results (NaN, zero, negative and infinite ranges all
end at 0) and restores main's speed; output hashes are unchanged.
2026-11-16 09:57:19 +01:00
Dylan M. Taylor daf040eace test(raw): retain Hasselblad white-balance fixture coverage 2026-11-15 07:51:10 -05:00
Dylan M. Taylor dcbe68e718 Preserve RAW assertions and bound SVG text expansion after damaged children 2026-11-15 07:47:16 -05:00
Dylan M. Taylor 2a0e50526f Merge main CI repairs while preserving shared RAW and SVG adapters
Reconcile contributor #14595 fixes with #15036: retain bounded SVG refusal reclassification and shared preflight, distinguish corrupt reads from save I/O failures, preserve RAW calibration and stricter regression cases. Keep newer descendant shared pin and main GPU/test support fixes. Hosted validation required.
2026-11-15 07:43:37 -05:00
FredApps 8c8941a155 fix(raw): preserve decoder fallback notices and regression guards 2026-11-15 12:04:01 +01:00
FredApps 08837740f1 test(raw): expect disclosed CFA fallback in untagged Hasselblad fixture 2026-11-15 09:11:32 +01:00
Terra854 274c99f94d Complete shared-format migration and fix RAW/SVG review findings 2026-11-15 15:05:47 +08:00
FredApps f669d7612b fix(raw): preserve assumed CFA notice and restore CR2 consumer regressions 2026-11-15 07:58:39 +01:00
Terra854 926779cd2f Preserve RAW calibration, decoder notices and bounded admission 2026-11-15 12:00:01 +08:00
FredApps 37df507e60 test(raw): require hardened malformed-input contracts 2026-11-15 02:56:04 +01:00
FredApps fa8228698b Merge current main; retain strict SVG depth boundary regression 2026-11-15 01:46:11 +01:00
Dylan M. Taylor 6297515031 chore: cut over remaining resvg and roxmltree usages to craft-svg and craft-xml (#14320)
* chore: cut over remaining resvg and roxmltree usages to craft-svg and craft-xml

* Cut over remaining photocraft-io TIFF tests, rawinfo example, and move exr to dev-dependencies

* chore: remove unused zune-jpeg workspace dependency

* style: cargo fmt
2026-11-14 13:49:42 -05:00
David MannandClaude Opus 5.5 1d32304ad8 raw: the ignored ORF test names its reason without a local file
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-14 17:19:58 +01:00
David Mann 018134aaef Merge PR #14451 2026-11-14 17:18:19 +01:00
RickiNano b9e3107535 raw: the look-fit fixture comment names its 12-bit encoding scale 2026-11-14 11:33:17 +01:00
Hasan-Zayni 204f6555ab Bring the photocraft-raw integration tests back in line with craft-raw
Only DNG samples are lifted to the saturation plateau again, as before the
craft-raw migration. The testgen fixtures write what cameras write (Model in
IFD0, bit-packed deflate, word-aligned RAF rows, rotated RW2 fields), and the
tests follow craft-raw's behaviour: float DNG data, crop clipping, opcodes
handed to development, measured NEF layouts, RGGB Bayer RAF. Tests of
retired behaviour are removed; the ORF cut-in-IFD0 guard is kept ignored.
2026-11-14 13:14:03 +03:00
RickiNano 2c8fab58ef ui-egui, raw: fix the two main CI failures left by the craft-libs format migration
- ui-egui: the typed TIFF open path is taken on TIFF magic bytes again, not on a
  `.tif` name. `photocraft_formats::detect(name, ..)` falls back to the extension,
  so any `.tif` file bypassed the import service (#14236);
  `files_dropped_with_no_document_open_all_open` caught it.
- raw: `recovers_a_known_matrix_and_curve` pins its fixture's white level to the
  12-bit range. craft-raw's NEF reader ignores a WhiteLevel tag and read the
  synthetic image's flat brightest patch (2370) as a saturation plateau, which
  skewed the fitted tone curve.
2026-11-14 10:06:04 +01:00
Dylan M. Taylor b0e0bcc6c4 Merge pull request #14236 from storytold/codex/photocraft-format-migration
Move remaining file formats and codecs to craft-libs (#778)
2026-11-13 23:03:16 -05:00
Dylan M. Taylor 5d4b68f04c Use craft-heif from craft-libs for HEIC/HEIF (#13076)
* Use craft-heif from craft-libs; remove crates/heif

PhotoCraft's HEIF decoder had drifted from LightCraft's by about 700 lines;
both now use craft-heif (storytold/craft-libs#784), built from LightCraft's
copy. HEIC colours now follow the HEVC VUI's range and matrix and libheif's
chroma upsampling. 8-bit files still open as 8-bit documents; a colour
description the VUI specifies now tags the image as an nclx did.

The codecs -> heif standalone exception ends with the local crate, and the
HEIF nextest step drops -p photocraft-heif, which no longer exists.

* Pin craft-heif to the merge of storytold/craft-libs#794

* heif: count the decoder's 16-bit buffer against max_alloc

* heif: match Apple's chroma upsampling; pin craft-heif to storytold/craft-libs#799

* heif: free the decoder's buffer before the HDR conversion and count that conversion's peak

* heif: hold the canvas the decoder really allocates to max_alloc
2026-11-11 01:59:37 -05:00
6afd603e53 Merge main into #7377 (Fujifilm compressed RAF)
Only the doc status lines, histories and raw tables conflicted. The
status lines take main's with the #7377 entry kept first; histories keep
both sides. The RAF table row keeps this PR's compressed support next to
main's new Hasselblad 3FR row and its sidecar status, and points at the
moved test file tests/it/raf.rs. The Camera RAW row keeps main's 3FR and
Nikon text and no longer lists compressed RAF as open.

Co-Authored-By: Yorgos S. <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-08 20:35:13 +01:00
ba3ea95007 raw: honour ActiveArea in Hasselblad 3FR/FFF (PR #9058)
The decoder set the active area and the crop to the whole plane and never
read ActiveArea, so a file with masked borders and no DefaultCrop developed
with the borders in. Read ActiveArea like the DNG path, use it as the
initial crop, and place DefaultCrop relative to it as DNG does. Also give
3FR/FFF its own row in the camera raw table instead of "embedded preview
only".

Co-Authored-By: Gotya-OFFCIAL <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-07 19:39:30 +01:00
David Mann b8b539c845 Merge origin/main into PR #9058 (raw: Hasselblad 3FR/FFF) 2026-11-07 19:37:23 +01:00
FredApps 6ef1032f87 Merge pull request #9460 from vangel76/perf/9435-raw-linear-fill
raw: LinearRaw fill works out the black level once per row and phase (stacked on #9455)
2026-11-07 16:31:48 +01:00
David Mann f98218cbe8 Merge pull request #10529 from luben93/raw/nef-lossy-after-split-v2
raw: decode Nikon "lossy after split" NEFs
2026-11-07 16:06:23 +01:00
FredApps 5a05676a5e Merge main and retain raw row-fill and orientation regressions 2026-11-07 15:42:03 +01:00
FredApps 18123beecb Merge pull request #9464 from vangel76/perf/9435-raw-mhc-direct
raw: MHC and bilinear demosaic written out per row kind (stacked on #9455)
2026-11-07 15:39:40 +01:00
FredApps b33d2c6d82 Merge pull request #9459 from vangel76/perf/9435-raw-orient-transpose
raw: orientations 5-8 copy the frame in tiles (stacked on #9455)
2026-11-07 15:39:32 +01:00
FredApps 047a74f688 Merge pull request #9447 from vangel76/perf/9429-lift-clipped-histogram
raw: DNG saturation histogram per CFA row in parallel bands
2026-11-07 15:39:27 +01:00
b9323e117e Merge main into #7377 (Fujifilm compressed RAF)
Main moved crates/raw/src/testgen.rs into testgen/ and the integration
tests into tests/it/, and its preview fallback now also opens a larger
JPEG XL preview. The compressed RAF test generator moves to
testgen/raf.rs; the JPEG fallback and the damaged-data fallback both go
through preview_image (Adobe RGB tag from the EXIF) under the caller's
decode limits. Doc status lines and histories keep both sides; G14 and
the Camera Raw row no longer list compressed RAF as missing.

Co-Authored-By: Yorgos S. <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-07 13:43:08 +01:00
Gotya-OFFCIAL e7241d2e26 raw: decode Hasselblad 3FR/FFF (X2D II 100C, uncompressed)
The X2D II 100C's 3FR files develop at full sensor resolution instead of
falling back to the camera's embedded JPEG preview. A 3FR is a TIFF whose
IFD0 holds the camera's JPEG and whose CFA image sits in a SubIFD with
DNG-style tags but no DNGVersion and no CFA-pattern tag (neither the
TIFF/EP pair nor the EXIF one), which is why the generic TIFF/EP path
reported "CFA pattern not recorded". The new decoder reuses the shared
strip reader, takes BlackLevel, WhiteLevel, DefaultCropOrigin/Size and
AsShotNeutral from the file, and takes the Bayer phase from a measured
per-body table (the X2D II 100C: RGGB at the data origin, measured
against the camera's own embedded JPEG; unmeasured bodies warn).
Lossless-JPEG 3FR stays preview-only, like uncompressed-only ORF and RAF
before it.

Clean-room: the TIFF 6.0 and DNG specifications, the sample file's bytes
and its embedded JPEG; no code or tables from dcraw, LibRaw, rawspeed,
rawler or darktable.

Adds round-trip and hostile tests through a mirrored synthetic builder
(tests/it/hasselblad.rs, testgen::Hasselblad3frSpec) and updates the
support matrix (file-format-parity, gaps G14, target-app-parity).
2026-11-06 12:05:10 +08:00
texjer 7ce4804b76 Merge remote-tracking branch 'upstream/main' into feat/cr2-sraw
# Conflicts:
#	crates/raw/src/lib.rs
2026-11-04 22:01:15 -05:00
Dylan M. Taylor 4c33a7b8f2 raw: keep at most 64 GainMap opcodes from one list (#11023)
Development applies every gain map to every pixel it covers, so a list
of thousands of maps multiplied the work of an otherwise admissible
image. Cap them like MapPolynomial; the rest are named as not applied.
2026-11-03 20:50:37 -05:00
Dylan M. Taylor 87f0bb3942 raw: refuse JPEG XL tiles with compressed metadata boxes or splines (#11039)
jxl-oxide inflates Brotli-compressed auxiliary boxes (Exif, XMP) into
storage its allocation tracker doesn't see while it reads a container,
and samples spline geometry into an untracked vector with no bound on
the sample count. A raw tile needs neither: refuse a container holding a
brob box before reading it, and a codestream whose frames draw splines
before rendering.
2026-11-03 20:37:49 -05:00
Dylan M. Taylor c004e38e75 raw: decode a tile range once when several tiles share it (#11041)
read_plane decoded every segment separately, even when a file pointed
every tile at the same bytes. Each lossless JPEG decode rebuilds its
Huffman tables and each result is retained until assembly, so one small
range repeated across many tiles multiplied header work and memory by
the tile count.

Decode each distinct (offset, length, geometry) once and scatter the
shared samples into every tile that names it.
2026-11-03 20:37:28 -05:00
Dylan M. Taylor 06bedca787 raw: refuse lossy DNG tiles that carry Extended XMP (#11042)
* raw: refuse lossy DNG tiles that carry Extended XMP

zune-jpeg keeps every Extended XMP fragment until its set is complete
and re-sorts and re-checks all pending fragments after each marker, so a
lossy (compression 34892) tile of many small incomplete fragments costs
quadratic time before a pixel is decoded. A raw tile has no metadata:
refuse one with an Extended XMP APP1 segment before parsing it.

* address review: bound Extended XMP identifier to APP1 payload
2026-11-03 20:37:07 -05:00
Dylan M. Taylor 4367131008 raw: check retone's pixel count with checked multiplication (#11043)
retone compared the buffer length with an unchecked w * h. In a release
build a product that wraps passed the check for a tiny buffer, and the
banded passes then ran over the original, huge height.
2026-11-03 20:31:35 -05:00
lucas perssonandClaude Opus 5.5 dda8ac6281 [ai] raw: test split strips with up to four extra fixed-rate rows
The end-of-strip rule accepts whole fixed-rate rows past the image (up to 4),
but no test covered a valid strip with such rows. Encode 1 to 5 extra rows at
12 and 14 bit: up to 4 decode with the image rows unchanged, the fifth is
refused (preview fallback).

Suggested by CodeRabbit on #10529.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 18:10:56 +01:00
lucas perssonandClaude Opus 5.5 b15e914431 [ai] raw: decode Nikon "lossy after split" NEFs
Some lossy type 2 NEFs store a split row at byte 562 of maker note 0x0096.
They were refused ("lossy after split") and opened as the camera's preview.
The 11 such CC0 raw.pixls.us files come from the D3400, D5, D5000, D5200,
D5500, D5600, D7000, Nikon 1 J5 and Z 6_2.

Decode them following the rule LightCraft derived by black-box analysis of
those 11 files (storytold/lightcraft#633), the same route the Huffman tables
took. Rows above the split are Huffman coded as before. From the split row on,
every pixel is one MSB-first word of bits - 4 bits: a prefix code for the
difference category followed by the top bits of the T.81 additional bits,
dequantised to the centre of the kept bin (fixed_words, ported from
LightCraft's fixed_word_table), with the same predictor and an unclamped
running value. The section ends the strip: whole rows (up to 4 more than the
image), then 0-7 one-bits.

A split file that fails to decode for any reason (a section that does not end
the strip, the all-ones word, truncation, size limits, a split row past the
image, a curve long enough to cover byte 562) stays unsupported, so it keeps
the embedded-preview fallback it had before. Apart from the all-ones word and
the padding, the content of the fixed-rate section is not validated: a damaged
word inside a well-formed section decodes without an error, as in LightCraft.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 16:04:10 +01:00
FredApps fd3a12dfde Merge approved PhotoCraft PR #3142: Read applied Sony RAW metadata and crop ILCE-6000 images
Port behavior and regression coverage into current modules; preserve current upstream behavior.
Integrate bounded Sony SR2 metadata decoding and ILCE-6000 image area; preserve newer bit-depth-aware camera profile application and explicit file crop precedence. Keep current parity counts and original metadata/crop tests.
2026-10-29 06:38:44 +01:00
FredApps 71afe098ca Merge approved PhotoCraft PR #9457: raw: faster tone stage (Shadows, Highlights, Clarity, Texture, Dehaze), same bytes 2026-10-29 03:29:53 +01:00