Commit Graph
256 Commits
Author SHA1 Message Date
Codex b50522dc44 Respect missing decoders during source inspection and guard PNM tests 2026-11-29 21:11:53 +01:00
Codex 1cfe12fa7e Keep SVG raster validation from enabling unused codecs 2026-11-29 19:43:00 +01:00
Codex 17a339cd8f Integrate JPEG 2000 feature with backward-compatible codec defaults 2026-11-29 19:33:24 +01:00
Codex c0c6183e86 Merge main to validate optional codecs for FigCraft web release 2026-11-29 19:27:46 +01:00
dotCooCoo c58f543f18 image-codecs: zero TIFF buffers in pieces of at least 1 MiB
`zeroed` and `refill_zeroed` filled each image buffer with
`par_extend(repeat_n(0u8, len))`, which has no minimum piece length.
When workers stole from each other, rayon kept splitting the buffer,
and on a pool with 128 or more workers the nested splits overflowed a
worker's 2 MiB stack. The fax page test
`a_blank_fax_page_wider_than_4096_px_passes_the_bomb_guard` aborted
this way on a 192-core host.

Both functions now call `extend_zeros`, which sets `with_min_len` to
1 MiB. A unit test zeroes 64 MiB on a pool of 256 workers with 256 KiB
stacks; without the change it aborts with a stack overflow.
2026-11-28 17:53:23 -08:00
BFlat c78cb46b03 Merge pull request #4054 from dotCooCoo/fix/png-band-capacity
image-codecs: drop each PNG band's spare deflate buffer before joining
2026-11-29 03:01:57 +07:00
dotCooCoo e52817525e image-codecs: drop each PNG band's spare deflate buffer before joining
deflate_band compresses a band into a buffer reserved at its worst case,
about 1.125 times the band's filtered bytes, and every band is held until
the bands are joined into one zlib stream. Each band kept that whole
buffer, so encoding a large image held about 1.125 times the image's size
in reserved capacity on top of the compressed output. The band's buffer
is now shrunk to the bytes it holds once the single deflate call has
finished.

On a 31404 x 31403 RGB image (2.96 GB) encoded with the fast setting,
peak resident memory during encode drops from 7.69 GiB to 6.48 GiB.
2026-11-28 02:22:08 -08:00
dotCooCoo ac39a088e7 Merge main into feat/craft-texture-decode 2026-11-28 01:39:11 -08:00
FredApps c85c03b263 Merge pull request #3020 from yoriswind/codex/2224-default-feature-tests
tests: group feature-dependent codec and text cases
2026-11-27 23:06:31 +01:00
dotCooCoo ba2f2a8eda image-codecs: bound TIFF compressed chunks by the allocation limit 2026-11-26 17:03:28 -08:00
yoriswind 07a01d2572 Format the current contribution source 2026-11-26 11:03:21 -08:00
yoriswind 4a3d7e5d9a Retain current PNG matrix with distinct repeated row runs 2026-11-26 10:21:20 -08:00
yoriswind bf1dada9d6 Integrate current test registrations while preserving feature selectors 2026-11-26 08:15:16 -08:00
FredApps ce53079380 Merge branch 'main' into codex/2216-heif-metadata-reuse 2026-11-26 10:20:57 +01:00
BFlat ffdb249cbe Merge pull request #3322 from dotCooCoo/fix/png-borrow-icc-profile
image-codecs: borrow the ICC profile and EXIF in the PNG header
2026-11-26 10:27:00 +07:00
BFlat 4a078fdac1 Merge pull request #2723 from dotCooCoo/fix/jpegls-restart-marker-after-segment
image-codecs: reject a JPEG-LS restart marker that follows another segment
2026-11-26 10:11:33 +07:00
BFlat 273186cb47 Merge pull request #2709 from dotCooCoo/feat/image-codecs-display-srgb
image-codecs: convert an image's ICC or CICP colors for display
2026-11-26 10:11:11 +07:00
BFlat aa19b389ac Merge pull request #2616 from dotCooCoo/feat/image-codecs-into-rgba8
image-codecs: checked RGBA8 and RGBA16 conversions, and into_rgba8 without a copy
2026-11-26 10:05:47 +07:00
BFlat 4363011a8b Merge pull request #2607 from dotCooCoo/feat/image-codecs-encode-borrowed-rgba8
image-codecs: encode a PNG from borrowed RGBA8 pixels
2026-11-26 10:05:07 +07:00
BFlat 749f21db40 Merge pull request #2597 from dotCooCoo/feat/image-codecs-input-cap
image-codecs: read a file or stream into bytes with a size cap
2026-11-26 10:03:33 +07:00
dotCooCoo a409ba1f32 Merge main into fix/png-borrow-icc-profile 2026-11-25 14:17:24 -08:00
Elvis33LE 2b7d18f1fb deps: migrate craft-image-codecs to jpeg-encoder 0.7.1 2026-11-25 22:35:17 +01:00
aiongg 3a567445fe Merge remote-tracking branch 'upstream/next' into test-speed-3 2026-11-25 01:55:58 +00:00
aiongg d402a1d71b Gate-sized cases for slow non-UI tests; full sizes and every case nightly
Boundary tests set by a production constant check a small limit through a
private seam that takes it (b64 decode, drawingml table normalize, openpgp
verify), with the real constant nightly; captions and jbig2 check their
full-size boundaries nightly. Sweeps run every divisor-th case at the gate
(develop balanced highlights and thin line, jpeg low-memory tokens, png
streamed rows, mxf extreme fields, pdf crypt proptests), the fax bomb guard
page is wider and shorter, the resample bound pulls a shorter block, the nef
measured frames are read through probe_info, and local tone compares 64 and
256 pixels.
2026-11-25 01:32:48 +00:00
aiongg 878b4ee811 image-codecs tests: the gate flips and overwrites one value per sampled byte, rotating 2026-11-24 22:33:06 +00:00
aiongg 79c5c887ae tests: is_multiple_of for the gate-sample strides 2026-11-24 20:34:27 +00:00
aiongg cbe6812a02 craft-image-codecs tests: smaller bomb-guard, PNG and DDS inputs, sampled fidelity sweep 2026-11-24 19:48:38 +00:00
hikari b2f0fb9ffb fix(image-codecs): refuse left-out formats in source-data checks
has_unretained_source_data fell through to Ok(false) for a valid file
whose codec the build leaves out (Netpbm without pnm, EXR, DICOM and
others). It now returns the same Unsupported error naming the feature
as decode and encode, and the left-out-formats test covers it.

Tests that loop over several formats now gate only the WebP, OpenEXR
and Netpbm entries, so their PNG, JPEG and TIFF cases also run without
those features.
2026-11-24 11:49:55 +01:00
hikari 102f7c6204 feat(image-codecs): let builds leave out codecs they never use
Every codec dispatched by decode_as_with and encode was linked into any
binary that calls them, so a program reading PNG and JPEG also carried
OpenEXR, WebP, the JPEG XL encoder and a dozen rarer codecs.

Each of those now sits behind a default Cargo feature: dds, dicom, dpx,
exr, fits, iff, jpegls, jxl-encode, pnm, tga, webp and xpm. The default
build is unchanged. With a feature off its codec, its dependency (exr,
image-webp, zune-jpegxl, the image crate's TGA decoder) and its
format-specific functions are not compiled in; the format is still
detected, caps reports it neither readable nor writable, and decoding,
encoding or probing it returns CodecError::Unsupported naming the
feature. SGI and Sun Raster now give that same named reason.
2026-11-24 10:24:42 +01:00
hikari 3e3a40993c refactor(image-codecs): move format sniffers into format.rs
The DICOM, Cineon and IFF signature checks and the JPEG-LS marker walk
are what detect() and PrefixDetector use, so they now live beside them.
The codec modules call them from there. No behaviour change.

This lets a later change compile those codecs out while detection stays.
2026-11-24 09:41:42 +01:00
dotCooCoo d28ad274b3 image-codecs: borrow the ICC profile and EXIF in the PNG header
The PNG writer copied the caller's ICC profile, and the exported EXIF,
into new buffers before writing the header. Each tagged save allocated a
second profile-sized buffer that could abort the process when memory ran
short. The header now borrows the profile, and borrows the EXIF whenever
export_exif returns it unchanged.
2026-11-23 23:58:58 -08:00
aiongg cf35f7dbae Merge remote-tracking branch 'upstream/main' into next-sync-1123
# Conflicts:
#	Cargo.toml
#	crates/audio/src/track.rs
2026-11-23 01:29:52 +00:00
Terra854 1c137fea60 image-codecs: share bounded PNG sRGB metadata writing (#2941)
* image-codecs: share bounded PNG sRGB metadata writing

* png: reject legacy color chunks that conflict with sRGB
2026-11-23 03:38:34 +07:00
Dylan M. Taylor 49f38d0e30 tiff: expose plain RGBA16 without the raster facade (#3082) 2026-11-22 15:16:58 -05:00
Dylan M. Taylor e683cb299f Merge pull request #3067 from storytold/feat/778-strict-jpeg-orientation
jpeg: share strict EXIF orientation framing
2026-11-22 13:17:05 -05:00
DylanMTaylor 7e88389c8e Document legacy JPEG zero-marker handling 2026-11-22 12:20:57 -05:00
Dylan M. Taylor 983a116784 tiff: share the plain RGBA16 writer 2026-11-22 11:06:35 -05:00
Dylan M. Taylor e084f8c1f6 jpeg: share strict EXIF orientation framing 2026-11-22 11:04:24 -05:00
Terra854andFredApps 52d2560c18 image-codecs: share ISO-BMFF brand prefix framing (#2638)
Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
2026-11-22 18:45:42 +07:00
yoriswind 063d1951ac test(image-codecs): share the tagged HEIF metadata decode 2026-11-22 00:30:24 -08:00
yoriswind 3e22efd354 test: group feature-sensitive image and text cases 2026-11-21 23:35:01 -08:00
yoriswind a9ca8e42d2 Format the streamed PNG fixture construction 2026-11-21 14:37:17 -08:00
yoriswind a2e0d965e3 Keep distinct row runs in the streamed PNG fixture 2026-11-21 14:28:04 -08:00
yoriswind 9d7714dea0 Keep only independent streamed and large PNG fixture reductions 2026-11-21 13:32:27 -08:00
yoriswind 2b42b6591b image-codecs: trim redundant PNG encoder test passes 2026-11-21 13:05:38 -08:00
Terra854 e1d62d7e19 image-codecs: share PNG physical resolution writing (#2879) 2026-11-21 12:56:40 -05:00
Dylan M. Taylor c60e7a2006 image-codecs: expose raw PNG pHYs pixels_per_meter reader (#785) (#2865) 2026-11-21 11:39:45 -05:00
dotCooCoo 5d55b9994a image-codecs: convert untagged 16-bit and float RGB without rounding to 8 bits
For an RGB image with no source profile and a display other than sRGB,
`to_display_rgba8` rounded the samples to RGBA8 and then converted them
from sRGB, which lost precision and clipped float values before the
transform. It now converts the samples through the sRGB profile directly,
so the result matches the same image tagged with sRGB. Gray, CMYK and Lab
images without a profile still go through their `to_rgba8` values.
2026-11-20 17:55:32 -08:00
dotCooCoo fcf08f47ef image-codecs: correct the prefix length that detect documents for FF D8
For a buffer of only `FF D8`, `detect_prefix` answers `NeedBytes(4)`,
a 4-byte prefix that includes the SOI, not 4 bytes after it.
2026-11-20 17:16:57 -08:00
dotCooCoo 8b2268a898 image-codecs: AVIF matrix 12 reads unspecified primaries as BT.709
Chromaticity-derived reconstruction (matrix 12) took Kr and Kb from the
raw primaries code, so primaries 2 got BT.2020 weights while the HLG gain
in `cicp::linearize` read them as BT.709. Reconstruction now reads
unspecified primaries as BT.709 too, so a file tagged 2 decodes the same
as one tagged 1. Explicit BT.2020 keeps its weights.
2026-11-20 17:13:37 -08:00