Commit Graph
100 Commits
Author SHA1 Message Date
David MannandClaude Opus 5.5 1929e79ebb Merge storytold main into next (20 Nov, second sync)
Merges main at 8f92ed1334 (#2550 and the rest of main since the 20 Nov sync).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 16:38:55 +01:00
yoriswind 0596a975ae Reduce temporary memory when decoding DPX and Cineon
(cherry picked from commit f08789c7a6)
2026-11-20 07:00:55 +01:00
yoriswind 4f31e9c33a Avoid widened sample buffers in eight-bit DPX export
(cherry picked from commit 23393d1def)
2026-11-20 07:00:49 +01:00
FredApps 051ec4fd62 Merge pull request #2389 from yoriswind/codex/shared-dpx-export-u8-r1
Avoid widened sample buffers in eight-bit DPX export
2026-11-20 12:36:48 +07:00
FredApps 54cb4af7e1 Merge pull request #2396 from yoriswind/codex/shared-dpx-decode-widen-r1
Reduce temporary memory when decoding DPX and Cineon
2026-11-20 12:31:20 +07:00
Elvis33LE 4b4d5f7a9d fix(exr): stage contained data windows in display canvas (#2033) 2026-11-19 21:30:51 -05:00
aiongg b05c1c27f9 Merge storytold main into next (20 Nov sync) 2026-11-20 01:48:18 +00:00
Dylan M. Taylor 512a1b8e8b mesh, image-codecs: add clearcoat/sheen GLB, obj_with_mtl, and EXR chromaticities (#778) (#2466)
* mesh, image-codecs: add clearcoat/sheen GLB, obj_with_mtl, and EXR chromaticities (#778)

* fix(mesh): import Image and TextureRef in obj tests

* fix(mesh): construct Mesh via struct literal in gltf test
2026-11-19 19:50:59 -05:00
Dylan M. Taylor bc186ca719 image-codecs: keep first JFIF APP0 density in scan_metadata (#2422) 2026-11-19 14:51:45 -05:00
Dylan M. Taylor 41a9edd001 image-codecs: keep resolution probe fallback and container-only WebP EXIF scan (#2409) 2026-11-19 13:11:14 -05:00
aiongg ca58dfe6c9 Merge storytold main into next (19 Nov sync)
Merges main at d7c9632bfb.

- Cargo.toml: both sides' new workspace crates (next's font-subset, harfbuzz-subset-sys and
  host; main's gpu, gpu-null, gpu-providers and gpu-wgpu).
- crates/jpeg: next split lib.rs into modules; main's reduced-size decoding goes to them: the
  scaled IDCT, reconstruction and render_scaled to idct.rs, MAX_SHRINK, reduced_estimate and
  decode_reduced stay public in lib.rs. Main's new test added; the frame test next removed
  stays removed.
- crates/audio, crates/media: next builds the integration tests into the library's test
  executable (autotests off, tests/main.rs); main's new DSD and MPEG-TS mux tests are modules
  there behind their features instead of [[test]] targets, and the mux tests reach their shared
  helper module through the integration module.
- crates/media/src/matroska/track.rs: main's new FFV1 codec-parameter test added; the test
  modules next removed stay removed.
- crates/file-formats: main's JXL capability test, which asks the codec whether JXL reads,
  replaces next's interim check.
2026-11-19 16:22:24 +00:00
FredAppsandFredApps 30a568b97f image-codecs: expose raw BMP density probe (#2354) [skip ci]
Co-authored-by: FredApps <FredApps@users.noreply.github.com>
2026-11-19 21:26:09 +07:00
yoriswind f08789c7a6 Reduce temporary memory when decoding DPX and Cineon 2026-11-19 01:50:21 -08:00
yoriswind 23393d1def Avoid widened sample buffers in eight-bit DPX export 2026-11-19 01:50:13 -08:00
.CooCoo c39072d321 image-codecs: keep PrefixDetector tests within the prefix contract (#2277)
PrefixDetector::detect requires each call's bytes to start with the
previous call's bytes. Two integration tests passed a buffer that broke
that rule, so a detector that rechecks the SOI before resuming would
have failed them while still honoring the contract.

The tests now pass longer prefixes of one file and compare each answer
with detect_prefix on the same bytes. The check that a walk resumes at
the marker it stopped at stays in the jpegls unit tests, and a new unit
test checks that a walk that found a non-JPEG-LS frame header stays at
that marker.
2026-11-18 23:20:49 -05:00
aiongg e8e713ee26 Merge storytold main into next (18 Nov sync)
Merges main at 3b8e426a26.

- crates/ui: main's e-sign dialog (crates/ui/src/esign) moves to craft-cloud-ui beside the
  share dialog, behind craft-cloud-ui's esign feature; craft-ui forwards `esign` and
  re-exports the module.
- crates/proof: main's can_suggest_cased goes to affix/check.rs and its tests to
  affix/tests.rs (next split affix.rs); French wiring in lib.rs.
- crates/svg: main's validated resolver and raster validation stay under tree-render, which
  now also enables gif and image-webp; the shared image-codec helpers are gated on tree.
- craft-ai-agents: main's rev (craft-ai-integrations main), one entry.
- crates/craft: facade dependencies, features and re-exports for main's new crates.
2026-11-18 23:07:38 +00:00
.CooCoo b130ac1fa4 image-codecs: find the JPEG-LS frame header past 64 segments, and add detect_prefix (#2178)
* image-codecs: find the JPEG-LS frame header past 64 segments, and add detect_prefix

detect walked at most 64 marker segments looking for the SOF55 frame
header, so a JPEG-LS file with more segments before its frame header,
such as an ICC profile split over 255 APP2 segments, was reported as
JPEG. The walk now runs until it reaches a frame or scan header or the
end of the bytes. Each step moves forward at least one byte, so the walk
takes at most one step per byte.

detect also reported JPEG for a buffer that ended before the frame
header, which is what a caller that reads only the start of a file
passes. The new detect_prefix returns Detection::NeedBytes(n) in that
case, with the length the next step reads, and otherwise the answer
detect gives. The doc comment on detect now says that it needs the bytes
up to the frame header.

* image-codecs: walk each JPEG marker segment once when detecting in steps

detect_prefix walks the marker segments from the SOI on every call, so a
caller that reads exactly the length each Detection::NeedBytes asks for
walks the earlier segments again on each call. Over a file with many
small segments before its frame header, the total walk grows with the
square of the segment count.

The new PrefixDetector keeps the offset of the marker where its last
walk stopped and starts the next walk there. Its detect gives the same
answer and asks for the same lengths as detect_prefix, and
detect_prefix now runs a single step of a new PrefixDetector.

* image-codecs: read past a JPEG-LS restart interval segment and stop at FF 00

The JPEG-LS frame walk treated a DRI segment before the SOF55 frame header
as the end of the walk, so a file with one was detected and decoded as
JPEG. DRI now takes the length-prefixed path. The decoder accepts a 2-, 3-
or 4-byte interval of 0, reports a nonzero interval as unsupported, and
rejects other segment sizes as malformed.

`FF 00` after the SOI is a stuffed zero, not a marker, so the walk now ends
there instead of asking for a length field.

A PrefixDetector whose walk stopped at another frame header answers JPEG
for bytes that start with `FF D8 FF`, without walking from the SOI again.

* image-codecs: apply the JPEG-LS restart interval in effect at each scan

A later DRI with an interval of 0 turns restarts off again, and an
interval of at least the frame height puts a non-interleaved scan in
one interval with no restart marker. Both decode again. A nonzero
interval shorter than the frame height is still unsupported.

* image-codecs: reject a restart marker after a JPEG-LS scan of one interval

A restart marker comes only between two restart intervals. When the
interval in effect is at least the frame height, the scan is one
interval, so a restart marker after it, with or without fill bytes
before it, is now an error instead of being skipped.

Adds a test that a PrefixDetector starts each call at the marker where
its previous walk stopped.
2026-11-18 15:52:55 -05:00
.CooCoo 37724ad48d craft-image-codecs: lossy WebP encoding no longer copies the luma plane for every macroblock (#1975)
The VP8 encoder cloned the whole luma reconstruction before each
macroblock's B_PRED trial and restored it when a whole-block mode won,
so encoding P pixels copied about P^2/256 bytes. The trial writes only
the current macroblock, and the whole-block path writes every pixel of
that macroblock again without reading the trial's values, so the copy
and the restore are removed.

The output is byte-identical: a new test pins the SHA-256 of ten
encoded files (1x1 to 640x480, sizes that are not multiples of 16,
qualities 10 to 95) taken before the change, and decodes each with
image-webp. An ignored test prints encode times for 512 to 4096
squares; in release on one machine, 4096x4096 took 162.9 s before and
1.36 s after.
2026-11-18 15:51:10 -05:00
.CooCoo a19d58c5f6 dds: read R16G16 as red and green, and open 16-bit textures at 16 bits (#2124)
R16G16_UNORM stores a red and a green channel
(https://learn.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format),
but craft-dds read it as gray and alpha, so a two-channel normal map
opened with its green channel as transparency. It now reads as RGB with
blue 0, as BC5 and G16R16 channel masks already do. encode16 still
writes two-channel 16-bit pixels as R16G16; they read back as red and
green.

craft-image-codecs decoded every DDS at 8 bits. Texture::bits_per_channel
gives the widest stored channel, and textures wider than 8 bits (R16,
R16G16, R16G16B16A16, legacy FourCC 36, and channel masks with a 10- or
16-bit field) now open as U16 through decode16. craft-raster-codecs'
decode_levels does the same for every mip level.
2026-11-18 15:31:45 -05:00
Diego Chagas 7ff0f967db image-codecs: read JPEG XL through craft-jxl behind a jxl feature (#2135)
* image-codecs: read JPEG XL through craft-jxl behind a jxl feature

Format::Jxl reads when the non-default `jxl` feature is on (decode only, so the
encoder's jixel dependency is not built); without it JPEG XL is still detected and
opening one is an Unsupported error that says the build lacks it. Orientation is
applied by the decoder, so the Exif and XMP orientation become 1. ICC, Exif and XMP
come through; associated alpha is divided out; float files open as F32.

* image-codecs: skip JPEG XL in the one-pixel round trip

The encoder refuses images narrower than two pixels; with the jxl feature JPEG XL is a
read-and-write format, so the generic round trip reached it.
2026-11-18 15:26:57 -05:00
DJHoltkampandDJHoltkamp 0d8d8b9091 craft-image-codecs: refuse WebP animation frames that would panic image-webp (#2263)
For an animation frame that starts with an `ALPH` chunk, image-webp 0.2.4 decodes
the next chunk as VP8 whatever its FourCC, skips the size check it makes for frames
without alpha, and indexes the frame's buffers by the picture's own size. A picture
larger than its `ANMF` header, or a non-key frame (decoded as 0x0), panicked with
out-of-bounds indexing in `read_frame` and `fill_rgba`. image-webp also steps from one
frame to the next without the padding byte, so after an odd-sized `ANMF` chunk it
reads the next frame one byte early.

Before decoding, the container is walked for the first frame with alpha whose picture
is not a VP8 key frame of its header's size, and for the first odd-sized `ANMF` chunk.
That frame is refused like a damaged frame: `decode` (which reads frame 0) errors only
when it is the first, and `decode_webp_frames` keeps the frames before it with a
`Truncated` warning.

Found by fuzzing `decode_webp`; ported from storytold/photocraft#10473, which was
written before PhotoCraft's codecs moved here. The regression test panics without the
fix.

Co-authored-by: DJHoltkamp <4955429+DJHoltkamp@users.noreply.github.com>
2026-11-18 15:24:26 -05:00
82fc745154 image-codecs: PNG bounds its image on the IDAT data and reserves only what it can make (#2231)
* image-codecs: PNG bounds its image on the IDAT data and reserves only what it can make (lightcraft#3912)

The plausibility check measured the stored samples against the whole file
length, so ancillary chunks lifted the bound, and the decoder then reserved
the whole expanded output up front. A 1-bit 20000x20000 image is 50 MB
stored but 400 MB to 1.6 GB once expanded to 8-bit grey, RGB or RGBA, so
about 60 KB of IDAT reserved gigabytes.

- Bound the stored samples on the bytes of the first IDAT run (1032:1 plus
  1 MiB), not the file length.
- Reserve up front only what the IDAT data can inflate to; past that, grow
  the buffer as rows decode, at most doubling and never past the full
  output. A forged file fails on its first row; a real solid or sparse
  1-bit image that is past the ratio once expanded still decodes.
- Interlaced images decode into the whole zero-filled output in one go,
  so their expanded size is checked against the IDAT data.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fnx9MwPUug72xHRgg993uc

* Fix Adam7 palette expansion bounds without allocating unvalidated output

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Dylan M. Taylor <dylan@dylanmtaylor.com>
2026-11-18 15:14:45 -05:00
FredApps 7b8c1eccea Merge pull request #2041 from Terra854/codex/svg-integrity-hooks-review21
Share checked SVG image validation and DOM reuse
2026-11-18 09:15:11 +07:00
aiongg 4d22e6b958 Merge storytold main d6b5b16bbb into next (18 Nov sync)
- Workflows: main's per-crate layout, with next in the push triggers, Linux only for pushes to
  next, next's crate features (keymap egui, window and update ui) and test paths (crw samples and
  the pdf fixtures run inside the lib's test binary). The workspace gate keeps --keep-going and
  the facade-as-an-app clippy from next's ui.yml. Per-crate doc steps live in docs.yml, which also
  documents craft-ui, the ui-* crates, craft-doc and craft-pdf with every feature. docpath, i18n,
  print and ui workflows go, as on main. actions.lock lists docs.yml and theme.yml.
- Main's cloud and share UI (account, cloud, share, presence, the overflow menu and split button)
  lives in the new crate craft-cloud-ui as main wrote it; the craft-ui facade forwards share and
  cloud and re-exports account, cloud, share and presence, so craft-cloud-local builds unchanged.
- audio and media: main's new tests join tests/main.rs under their features.
- cms: main's new synth and FOGRA39 tests, with the fogra39() helper they use.
- nextest: no gpu group on unix; next's tests create no GPU device.
2026-11-18 01:22:22 +00:00
Terra854 6815dd6b7c Find JPEG sampling headers after marker padding 2026-11-18 04:58:02 +08:00
Terra854 6413cbb806 Guard SVG JPEG validation on panic-abort builds 2026-11-18 04:34:32 +08:00
Terra854 408ab93329 Preserve SVG siblings and share embedded-image validation 2026-11-18 04:01:51 +08:00
Martin BallandClaude Opus 5.5 ea02182945 image-codecs: add jpeg_worst_case_coefficients (#778) (#2063)
A conservative pre-decode coefficient budget for hostile JPEG headers: the
larger of JpegInfo::held_coefficients and a whole-picture estimate over every
progressive frame header (SOF2/6/10/14, any precision, sampling clamped to
1..=4), with the costliest frame charged at the first frame's size when the
header can't be followed. held_coefficients is unchanged.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 14:27:49 -05:00
aiongg ac3dfd1f53 Merge storytold main into next (17 Nov sync)
storytold main 83cb1133dd (291 commits) into the integration head bab1a99b85; 47 conflicted files.

- Domain test files (metafile, prepress, pdf plates, settings store, heif, media-testkit, atomic): tests next cut stay cut; tests new on main are kept, as trials where the crate's test target runs trials.
- atomic: main's group-bits test and Faulty::set_group go to src/tests.rs. audio: main's GSM and SBC oracles join tests/main.rs. cms constructors, pdf knockout_backdrop and testing_pdf join their crates' one test binary; timeline's preflight tests become src/preflight_tests.rs trials.
- update: main's changes to detect, install (linux, macos) and the tests land in next's split modules. The app's own offer is inspected on a thread of its own, picked up by tick's polling; settle_for_tests settles offers too. Later on a ready update drops the close it asked for. updater_pin_tests.rs stays deleted; its new pin test is in tests/it/update.rs.
- craft-color: main added a different crate at crates/color (the colour tags of compositor and display frames); it is next's craft-color module `tags`, re-exported at the root.
- Old crates/ui (combo, docking, testing, README) and keymap's ui/view.rs stay deleted; main's new crates/ui/src/testing files are dropped with them.
- New crates in the craft facade: ai, control, dds, frame, ipc, media-source, palette, press-print, score, ssip. testkit and xtask are listed outside it.
- Cargo.lock: the union of both locks, resolved by cargo metadata. Workflow: main's nextest Windows leg, with next's --keep-going clippy.
2026-11-17 12:44:52 +00:00
FredApps 28e1b05e3c Merge pull request #1774 from vangel76/perf/dds-bc45-1766
DDS textures: normal maps and grayscale maps save compressed (BC5/BC4), and DDS saves and opens faster
2026-11-16 19:55:31 +01:00
FredApps 808df4f186 dds: validate public boundaries and bound fallible decoding 2026-11-16 18:01:22 +01:00
FredApps a58989cae9 image-codecs: skip a SubIFDs array whose offset is cut off (#1889)
camera_raw_mode read a missing SubIFDs offset as 0, so it walked the TIFF
header as the pointer array and could classify a malformed TIFF as RAW.
Skip the entry instead, matching LightCraft's classifier.
2026-11-16 10:26:36 -05:00
aiongg 2df33d2f01 Merge remote-tracking branch 'upstream/main' into sync/main-1116
# Conflicts:
#	Cargo.lock
#	crates/audio/src/lib.rs
#	crates/exr/src/decode.rs
#	crates/font-catalog/src/lib.rs
#	crates/ps/src/lib.rs
#	crates/svg/Cargo.toml
#	crates/text/Cargo.toml
#	crates/text/src/lib.rs
#	crates/video/Cargo.toml
#	crates/video/src/lib.rs
2026-11-16 14:23:07 +00:00
Dylan M. Taylor 731c4f262a Merge pull request #1758 from dotCooCoo/fix/exr-deep-part-tables-end
craft-exr: deep chunk offsets start after every part's offset table
2026-11-16 05:46:49 -05:00
ljkx 7adcc9a6c2 image-codecs: BMP keeps its resolution in the header's pixels per metre
A BMP stores its resolution in biXPelsPerMeter and biYPelsPerMeter
(BITMAPINFOHEADER and later). The image crate writes 0 there and nothing
read the fields, so a 300 ppi image saved as BMP reopened at 72 ppi and an
opened BMP's resolution was lost (storytold/photocraft#13630).

decode now reads the fields into Metadata::dpi, encode writes
Metadata::dpi into them whatever embed_metadata says, and
caps(Format::Bmp).dpi is true. encode_bmp_indexed_with_dpi is the palette
writer with a resolution; encode_bmp_indexed keeps its signature and output.
2026-11-16 10:05:03 +01:00
FredApps a499742a93 Merge pull request #1779 from storytold/image-codecs/jpeg-stored-inks
feat(image-codecs): read four-component JPEGs as stored inks
2026-11-16 04:48:49 +01:00
aiongg 0835e114ca Fix CI lints: samples referenced in every build, missing docs, rustdoc links, deprecated Ui::id, unused manifest dependencies 2026-11-16 03:03:33 +00:00
FredApps 9baecfa4a1 Merge origin/main; route frames zune-jpeg may panic on to craft-jpeg where panics abort
On panic = "abort" targets (wasm32) the catch_unwind fallback can't run, so
frames whose first component is sampled below the frame's largest factors
go to craft-jpeg before zune-jpeg is called.
2026-11-16 02:54:50 +01:00
FredApps c28356d400 Merge pull request #1660 from storytold/codex/legacy-exif-orientation
Share legacy EXIF summary and preserve PNG orientation
2026-11-16 02:48:31 +01:00
FredApps 5b5f42961c Merge pull request #1672 from storytold/codex/sunraster-main-reconcile
craft-image-codecs: add opt-in Sun Raster reader and writer
2026-11-16 02:41:41 +01:00
FredApps 4a70763629 fix(image-codecs): refuse JPEG inks of frames too large for their scan data
zune-jpeg allocates its whole output before reading a scan, so
decode_jpeg_inks now applies decode's scan-data guard (one byte for every
2048 pixels, counted on scan data, not APP padding) first. The comparison
test's noise is computed in u64, so it doesn't overflow on 32-bit targets.
2026-11-16 02:39:34 +01:00
FredApps 832883b5b4 Merge pull request #1755 from storytold/image-codecs/probe-size-png-jpeg-tiff
image-codecs: probe PNG, JPEG and TIFF sizes from the header
2026-11-16 02:38:50 +01:00
vangel76 7c34335afb Merge remote-tracking branch 'upstream/main' into perf/dds-bc45-1766 2026-11-16 01:34:47 +01:00
FredApps fc1801a3aa Merge remote-tracking branch 'origin/main' into image-codecs/jpeg-zune-panic 2026-11-16 01:33:19 +01:00
FredApps 12fdc6571f Merge remote-tracking branch 'origin/main' into w1672 2026-11-16 01:27:27 +01:00
FredApps 1b71cd1c18 Merge pull request #1667 from storytold/codex/sgi-main-reconcile
Reconcile SGI codec with merged JPEG-LS support
2026-11-16 01:26:24 +01:00
FredApps 3d09cb9ab9 Merge remote-tracking branch 'origin/main' into w-r-codex/legacy-exif-orientation 2026-11-16 01:15:06 +01:00
FredApps 159d7134d0 fix(image-codecs): read the JPEGs zune-jpeg panics on with craft-jpeg
zune-jpeg 0.5 asserts in its upsampler on some subsampled four-component
frames whose first component isn't the largest. decode now catches that
panic and reads the file with craft-jpeg, as it reads arithmetic-coded and
12-bit files. Refs #778.
2026-11-16 01:13:19 +01:00
FredApps 2d4b8b8ecd Merge pull request #1679 from storytold/codex/avif-source-depth
Expose source bit depth from AVIF decode
2026-11-16 01:11:58 +01:00
FredApps a6c3feafd9 Merge remote-tracking branch 'origin/codex/legacy-exif-orientation' into w-1668 2026-11-16 00:50:40 +01:00