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.
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.
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.
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.
The display conversion reads CICP primaries 2 (unspecified) as BT.709,
but the HLG gain in `to_display_rgba8` and in `cicp::linearize` took
BT.2020 luma weights for it, so a chromatic HLG pixel with unspecified
primaries was shown differently from the same pixel tagged BT.709, and
differently again after the HEIF and AVIF readers decoded it to linear
light. Both paths now read unspecified primaries as BT.709 when they
pick the weights. Explicit BT.2020 primaries keep BT.2020 weights.
While a restart interval is in effect, the decoder now rejects a restart
marker anywhere outside a scan's data, including one that comes after a
comment or another segment. Before, only a marker directly after the scan
was rejected, and one after a comment was skipped and the image decoded.
With an interval of 0 a stray restart marker is still skipped.
`detect` documents that a buffer of only `FF D8` matches no format, and
the tests check the error kind of a malformed DRI segment and a DRI change
between the component scans of an RGB file.
Image::to_rgba8 changes only the layout and sample type, so an app that
shows the result as sRGB draws a Display P3, Adobe RGB or BT.2020 picture
with the wrong colors.
With the new `cms` feature, Image::source_profile returns the profile
that describes the samples (the embedded ICC profile, or for an RGB
image without one, the profile of its CICP description), and
Image::to_display_rgba8 converts the pixels through craft-cms into a
display profile the caller passes. An image with neither is treated as
sRGB. PQ and HLG samples are decoded to linear light first and clipped
at diffuse white. The output is checked against Limits and reserved
before conversion, and 16-bit and float images are converted in bands.
Image::try_to_rgba8 and Image::try_to_rgba16 check the output against
Limits and reserve it with try_reserve_exact before any pixel is
converted, as Image::to_rgba_f32 does. A gray image is a quarter of its
RGBA8 copy, so a decode that fits the budget could still allocate past
it when converted. Sources other than U8 and U16 are converted one pixel
at a time, without the whole-image f32 buffers.
Image::into_rgba8 consumes the image and returns the pixel buffer of an
RGBA8 image as it is. A caller that decodes and then needs RGBA8 no
longer holds the decoded image and a copy at once.
to_rgba8 and to_rgba16 convert the pixel data only, without cloning the
image's metadata first.
encode_png_rgba8 writes interleaved 8-bit RGBA pixels as a PNG from a
borrowed slice. encode takes an Image, which owns its buffer, so a
caller holding pixels in a frame or a shared buffer had to copy the
whole image before saving it. The output is the same as encode of an
Image with the same pixels, no ICC profile and default metadata. A
buffer whose length is not width * height * 4 is rejected with
InvalidImage.
The decoders take a byte slice, and Limits bound only the decoded image,
so a caller had to cap and read the input itself. read_bounded(reader,
max_bytes) reads at most one byte past max_bytes and fails with
ErrorKind::FileTooLarge for longer input, including a file that grows
after its size was checked and a stream with no end.
* 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
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.