Commit Graph
91 Commits
Author SHA1 Message Date
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 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
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 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 010d1c1f00 Merge remote-tracking branch 'origin/main' into image-codecs/probe-size-png-jpeg-tiff
# Conflicts:
#	crates/image-codecs/src/lib.rs
2026-11-16 00:38:11 +01:00
FredApps 947dc5fb0e Merge pull request #1630 from storytold/codex/shared-tiff-inspection
Share first-directory TIFF inspection
2026-11-16 00:05:27 +01:00
FredApps f749643b01 Merge pull request #1603 from storytold/codex/raster-probe-limits
Expose bounded stored raster dimensions
2026-11-16 00:01:21 +01:00
FredApps cb3551ad3f Merge pull request #1680 from storytold/fix/jls-low-bit-budget
Fix JPEG-LS low-precision scaling and scan allocation limit
2026-11-15 23:56:48 +01:00
Dylan M. Taylor c28f200060 Integrate merged AVIF decoder safeguards into source-depth API 2026-11-15 17:31:11 -05:00
FredApps 59b4f1e8c2 image-codecs: decode AVIF pixels with the pure-Rust AV1 decoder (#778) (#1601)
* image-codecs: decode AVIF pixels with craft-video's pure-Rust AV1 decoder

New optional `avif-decode` feature (native targets) reads still AVIF
files: the HEIF/ISOBMFF item graph, grids, clap/irot/imir, alpha
auxiliary images (including premultiplied), 8/10/12-bit 4:0:0, 4:2:0,
4:2:2 and 4:4:4, nclx/ICC colour, Exif and XMP, and PQ/HLG to linear
F32 through cicp::linearize as the HEIF path does.

The container walk follows LightCraft #3017 by @emmertex. Every size is
checked against the caller's Limits before the AV1 decoder runs, the
decoder's memory budget is capped by max_alloc, and the decode is
wrapped in catch_unwind so a decoder panic becomes an error.

Fixtures are tiny ffmpeg/libaom files; the 4:2:0 planes match libdav1d
bit for bit. Adds a decode_avif fuzz target.

Part of storytold/craft-libs#778.

* image-codecs, video: address review on the AVIF decoder

- clap: width and height are unsigned fractions, the offsets have signed
  numerators, so 0x80000000/0x40000000 is a width of 2, not -2.
- An item with clap, irot or imir more than once (repeated ipma records)
  is refused before any canvas work, instead of rotating 261120 times.
- Matrix coefficients 10 (BT.2020 constant luminance) is refused rather
  than converted with the non-constant-luminance equations.
- An alpha plane whose own transforms differ from the colour's is refused
  rather than composed in the wrong place; none, or the colour's, still
  decode.
- craft-video: Decoder::set_shown_budget lowers the per-chunk byte cap on
  shown pictures (never above 1 GiB), and the AVIF decoder sets it to
  max_alloc, so a payload of many shown pictures is refused before they
  are built.
2026-11-15 23:25:25 +01:00
FredApps 048c93634a image-codecs: probe PNG, JPEG and TIFF sizes from the header
probe_size returned Unsupported for PNG, JPEG and TIFF, so callers sized
those images with a full decode. Each now reads only its header with the
checks decode runs: PNG's IHDR/fcTL, limits and plausibility; JPEG's
first frame header and EXIF; TIFF's default page directory, camera-raw
refusal and Orientation tag. The size is turned upright for 5-8, as
decode returns it.
2026-11-15 22:15:55 +01:00
Dylan M. Taylor cae7c1d8a6 Share Samsung SEF repair and JPEG EOI inspection (#1640)
* Expose tolerant JPEG marker inspection

* Export JPEG inspection API

* Factor JPEG inspection fields from shared walker

* Share ICC chunk collection between JPEG inspection modes

* Cover JPEG MPF and gain-map inspection

* Expose MPF index inspection for located payloads

* Cover located MPF index parity

* Preserve bounded MPF index directory validation

* Share Samsung SEF repair and JPEG EOI inspection

* Cover JPEG scan byte search
2026-11-15 13:57:49 -05:00
Dylan M. Taylor 4ed217f1bc Share TIFF first-directory preflight between inspection APIs 2026-11-15 18:43:11 +00:00
Dylan M. Taylor e56b4e3cd4 Deduplicate EXIF orientation and ColorSpace through craft-metadata (#1465)
Extract the remaining metadata delegation from #1198 after #1331 landed the raster facade changes. Preserve current image-codecs API, pixel transforms, docs and regression tests; omit unrelated resolution reexports and TIFF cleanup.

Original-change: 1d52e89405
2026-11-15 12:55:47 -05:00
Dylan M. Taylor a6493b48f0 Fix JPEG-LS low-precision expansion and scan allocation cap 2026-11-15 12:38:25 -05:00
Dylan M. Taylor 6325cd286b Test AVIF source depth and decoded-image parity 2026-11-15 17:37:54 +00:00
Dylan M. Taylor a05083e2f0 Expose original AVIF sample depth during decode 2026-11-15 17:37:40 +00:00
Dylan M. Taylor d7696c4c76 Format Sun Raster feature gates 2026-11-15 17:32:45 +00:00
Dylan M. Taylor 741323cbc3 Merge remote-tracking branch 'origin/codex/sgi-main-reconcile' into codex/sunraster-main-reconcile
# Conflicts:
#	crates/image-codecs/README.md
#	crates/image-codecs/src/codecs.rs
#	crates/image-codecs/src/format.rs
#	crates/image-codecs/src/lib.rs
#	crates/image-codecs/tests/it/detect_caps.rs
2026-11-15 17:32:32 +00:00
Dylan M. Taylor c9de09877b Share bounded BMP coverage inspection (#1610) 2026-11-15 12:29:34 -05:00
Dylan M. Taylor 418215d00a Count both merged JPEG-LS and SGI format entries 2026-11-15 17:29:03 +00:00
Dylan M. Taylor 90df9a4d99 Gate SGI codec support behind explicit feature 2026-11-15 17:28:29 +00:00
Dylan M. Taylor 9f18482853 Merge remote-tracking branch 'origin/main' into codex/sgi-main-reconcile
# Conflicts:
#	crates/image-codecs/README.md
#	crates/image-codecs/src/format.rs
#	crates/image-codecs/src/lib.rs
#	crates/image-codecs/tests/it/detect_caps.rs
2026-11-15 17:26:03 +00:00
Dylan M. Taylor b3b8521ab4 Initialize JPEG budget regression limits directly 2026-11-15 17:24:59 +00:00
Dylan M. Taylor f5a22a008c Merge pull request #1576 from el-j/feat/image-codecs-jpegls
craft-image-codecs: JPEG-LS reader and writer
2026-11-15 12:22:57 -05:00
Dylan M. Taylor 50c3053bbc Preserve raster probe format and bound JPEG header input 2026-11-15 17:12:12 +00:00
Dylan M. Taylor b84bce6ef6 Merge pull request #1607 from storytold/codex/shared-png-header
Share PNG header and color chunk inspection
2026-11-15 12:08:10 -05:00
Dylan M. Taylor b16c5908ae Cover TIFF decode preflight limits 2026-11-15 16:17:27 +00:00
Dylan M. Taylor c339a9e471 Share TIFF decode preflight fields 2026-11-15 16:16:52 +00:00
Dylan M. Taylor ee44af6a45 Share first-directory TIFF inspection 2026-11-15 16:14:00 +00:00
Dylan M. Taylor c393428049 Merge pull request #1461 from storytold/fix/png-bounded-row-stream
image-codecs: bound PNG row streaming without a full-frame allocation
2026-11-15 11:01:29 -05:00
el-j e9eaaf5641 craft-image-codecs: Sun Raster 1-bit colour maps, opaque standard 32-bit pixels, fallible output buffer
Addresses review findings: a 1-bit file with an RGB colour map reads as
colour; the unused first byte of standard 32-bit pixels is no longer read
as alpha; the writer's buffer is reserved with try_reserve_exact. README
lists the native layouts correctly.
2026-11-15 16:52:35 +01:00
el-j 5a36112af6 craft-image-codecs: SGI rows may share compressed data and must start after the offset tables
Addresses review findings: the RLE size check no longer demands separate
payload space for every row, and a row offset inside the offset tables is
refused. A row without its trailing zero count still reads, as in ffmpeg.
2026-11-15 16:51:49 +01:00
Dylan M. Taylor 188d935887 Cover bounded PNG header probing 2026-11-15 15:41:20 +00:00
Dylan M. Taylor e4cef773fc Enforce PNG probe pixel limit before chunk scanning 2026-11-15 15:40:50 +00:00
Dylan M. Taylor 1bce1af0eb Expose early PNG dimension preflight 2026-11-15 15:39:50 +00:00
Dylan M. Taylor 32eff39b74 Share PNG header and color chunk inspection 2026-11-15 15:39:23 +00:00
Dylan M. Taylor ae5020c1ed Use a BMP size supported by the baseline decoder 2026-11-15 15:23:57 +00:00
Dylan M. Taylor 373d36ea3f Expose bounded stored image dimensions 2026-11-15 15:18:47 +00:00
FredApps 9399c25341 image-codecs: decode AVIF pixels with craft-video's pure-Rust AV1 decoder
New optional `avif-decode` feature (native targets) reads still AVIF
files: the HEIF/ISOBMFF item graph, grids, clap/irot/imir, alpha
auxiliary images (including premultiplied), 8/10/12-bit 4:0:0, 4:2:0,
4:2:2 and 4:4:4, nclx/ICC colour, Exif and XMP, and PQ/HLG to linear
F32 through cicp::linearize as the HEIF path does.

The container walk follows LightCraft #3017 by @emmertex. Every size is
checked against the caller's Limits before the AV1 decoder runs, the
decoder's memory budget is capped by max_alloc, and the decode is
wrapped in catch_unwind so a decoder panic becomes an error.

Fixtures are tiny ffmpeg/libaom files; the 4:2:0 planes match libdav1d
bit for bit. Adds a decode_avif fuzz target.

Part of storytold/craft-libs#778.
2026-11-15 16:10:22 +01:00
el-j 3ce92b332d craft-image-codecs: JPEG-LS (ITU-T T.87) reader and writer
Adds Format::JpegLs: lossless and near-lossless gray and RGB, 2 to 16
bits. Reads scans that code one component each; writes lossless 8- and
16-bit gray and RGB. Line- and sample-interleaved scans, mapping tables
and colour transforms are reported as unsupported.

Closes #1558
2026-11-15 12:53:20 +01:00
Dylan M. Taylor 4780f75080 Merge remote-tracking branch 'origin/main' into fix/avif-exif-hlg
# Conflicts:
#	Cargo.lock
2026-11-15 11:39:31 +00:00
Dylan M. Taylor 55b1d7f3c5 Merge pull request #1501 from storytold/extract/apng-container
craft-image-codecs: extract bounded APNG container assembly
2026-11-15 06:30:57 -05:00
Dylan M. Taylor dab6a8ea21 Flush delayed AV1 frames in HLG regression 2026-11-15 11:13:51 +00:00
el-j 5628ad359d craft-image-codecs: Sun Raster image reader and writer
Adds Format::SunRaster: 1-, 8- (gray or colour-mapped), 24- and 32-bit
files, uncompressed or byte-encoded (RLE) on read, uncompressed on write.

Closes #1560
2026-11-15 11:49:53 +01:00
Dylan M. Taylor a8f2612c7c Test decoded HLG AVIF reference levels 2026-11-15 10:46:51 +00:00
el-j 2e3ff2162b craft-image-codecs: SGI image reader and writer
Adds Format::Sgi: 8- and 16-bit gray, gray+alpha, RGB and RGBA, verbatim
and run-length encoded on read, run-length encoded on write.
Palette-mapped files are reported as unsupported.

Closes #1559
2026-11-15 11:44:48 +01:00
Dylan M. Taylor 30b78d048a Preserve requested AVIF alpha quality 2026-11-15 10:41:10 +00:00
Dylan M. Taylor 14e4ef8e5c fix(apng): enforce PNG integer ranges and satisfy chunk lint 2026-11-15 04:01:54 -05:00