* Add a craft-raw decoder comparison example
* Clean up RAW decoder report test fixtures
* craft-raw: say the report hashes decoded samples and which revisions build it
The digest covers RawImage::data, after any decoder linearization, so the
README now says "decoded samples" and explains that two stored codes that
map to the same value give the same digest.
The copy-into-an-older-checkout instructions now name the first main
revision the example builds on (ecee6933, #1171): older revisions have no
Cfa origin fields.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: FredApps <FredApps@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The DNG integration target also runs when JPEG XL decoding is disabled.
Gate the five JPEG XL cases and their fixture helpers on the jxl feature
so a DNG-only test run checks the codecs available in that build.
The full JPEG XL regressions remain enabled when jxl is selected.
Co-authored-by: pancake <pancake@nopcode.org>
* fix(mcp): validate JSON-RPC versions before dispatch
Reject malformed request envelopes before tool or lifecycle effects. Companion to storytold/gridcraft#4210 after the shared-server migration.
* test(mcp): cover invalid version markers across transports
Actual shared crate: baseline 18 passed and 3 new regressions failed; fixed 21 passed. Repository formatting and strict production Clippy pass.
craft-image-codecs reads and writes JPEG-LS since #1576, but the
format registry had no entry for it. A `.jls` name resolved to no
format, and a JPEG-LS file was reported as JPEG because both start
with `FF D8 FF`.
`Format::JpegLs` now has the `jls` extension, the `image/jls` media
type and the codec mapping, so its capabilities come from the codec.
A file that starts with `FF D8 FF` is JPEG-LS when its marker segments
lead to an SOF55 frame header (`FF F7`). The walk follows
`jpeg_frame_from` in craft-image-codecs, which a build without the
`raster-codecs` feature does not link, and reads at most the first
1 MiB. When the bytes end before any frame header, a `.jls` name gives
JPEG-LS and any other name gives JPEG.
craft-file-import routes `JpegLs` to its raster reader and lists `jls`
and `image/jls`, so a JPEG-LS file still imports as it did when it was
detected as JPEG.
Follows #1576.
The Linux leg restores the newest rolling cache entry of the workspace
crates (cache-workspace-crates), so a pull request rebuilds only the
crates its change reaches. Each main run saves an entry of its own and
cache-prune deletes the older ones; the midnight scheduled run builds from
source and starts the entry afresh.
gate.yml's cache-workspace-crates covers a whole call, so the macOS and
Windows legs move to a call of their own with dependency-only entries. A
select platforms job decides whether that call runs, since an empty leg
list would fail it.
To fit the 10 GB cache budget, the lint legs and the sonarcloud
instrumented build keep no cache.
Every workspace gate with `--all-features` has been failing since #2135 taught
craft-image-codecs to read JPEG XL behind a `jxl` feature. The capability test
asserted that JXL read is `Unsupported`, full stop. With that codec feature on,
`capabilities()` forwards the codec's own answer of `Available`. The assertion
then fails.
This crate cannot read that feature through `cfg!`. The feature belongs to a
dependency. A workspace build turns it on without this crate selecting
anything. An equality against either value is therefore wrong in some build.
The test now asks the codec the same question the code asks it. It compares
the two answers. A build whose codec reads JXL must report `Available`. One whose codec
does not must report `Unsupported`. The mapping has to exist either way. A missing
codec therefore fails an assertion of its own. The comparison is never quietly
skipped. Without `raster-codecs` there is no codec to ask. The answer is
`Unsupported`.
Verified at 1.100.0 on Linux. `cargo test -p craft-file-formats -p craft-image-codecs --all-features --locked` runs the case that was failing and passes. The same test passes with `-p craft-file-formats --all-features` and with `--no-default-features`. clippy with `--all-targets --all-features -D warnings` is clean. `cargo fmt --check` is clean. Making `capabilities()` ignore the codec's read flag fails the test. That is what the comparison is for. The HEIF and deep-EXR failures in that package need the pinned corpus. My checkout has not fetched it.
Follow-up to the brob budget:
- an over-cap or broken stream now charges the bytes it produced to the shared budget, so
a file of many such streams cannot inflate the whole budget once per box;
- a Brotli header that declares a large window is refused before decoding (the decoder reserves
its ring buffer up front, outside the output cap);
- boxes are walked one at a time instead of collected into a Vec of spans before the brob check.
image-codecs: document that JPEG XL ignores keep_orientation.
Excel 16 (en-US) reports #,##0_);(#,##0), #,##0_);[Red](#,##0),
#,##0.00_);(#,##0.00) and #,##0.00_);[Red](#,##0.00) for ids 37 to 40,
not the ECMA-376 Part 1 18.8.30 text the table held. It writes neither a
numFmt nor a FORMAT record for these ids, so the table is the only source
of their codes when a file Excel saved is read, as .xlsx or as .xls.
Co-authored-by: kiwi4boy <kiwi4boy@gmail.com>
Co-authored-by: Dylan M. Taylor <dylan@dylanmtaylor.com>
* craft-media: mpegts::mux writes MPEG-2 transport streams frame by frame to any io::Write
The mpegts feature gains a transport stream writer (ITU-T H.222.0 |
ISO/IEC 13818-1) next to the demuxer:
- PAT and PMT with the CRC-32 the demuxer checks (ts::crc32_mpeg), at
the start, every psi_interval, directly before video keyframes, and
after replace_writer and discontinuity; a PMT longer than one packet
spans packets.
- One PES packet per frame for H.264, HEVC, MPEG-1, MPEG-2 and MPEG-4
Part 2 video, AV1 (Carriage of AV1 in MPEG-2 TS), AAC (ADTS, or raw
frames given an ADTS header), Opus (Opus transport draft V0.1.3,
including explicit channel mappings and trims), AC-3, E-AC-3 and MPEG
audio, with PTS and DTS modulo 2^33.
- The PCR on a stream's PID or its own, at most pcr_interval apart
(100 ms at most), PCR-only packets in gaps, advance() for idle live
outputs, continuity counters, random access and discontinuity
indicators.
- Packets go out in batches of batch_packets (7 by default) built in
fixed buffers; replace_writer returns per-segment facts.
- Frames are checked before anything is written; video frames are
limited to MAX_UNIT_BYTES so the demuxer reads every one back.
Tests read every codec back with the demuxer (bytes, PTS, DTS, keyframes,
PCR range, no continuity or CRC warnings), check the PES header bits and
the refusals, and fuzz programs, timelines, idle gaps and output swaps.
* craft-media: mpegts::mux leaves out zero-ended AV1 padding and refuses 960-sample AAC configs
An AV1 padding OBU that ends with a zero byte, an empty one included, is
now left out like a temporal delimiter instead of failing the whole
temporal unit. Decoders ignore padding, and the trailing zero would
otherwise form a forbidden sequence with the next start code.
Codec::aac_from_asc refuses an AudioSpecificConfig with frameLengthFlag 1:
an ADTS header has no field for 960-sample frames, so decoders would read
the stream as 1024-sample frames.
* craft-media: the transport stream packet checker refuses a PCR flag in an adaptation field shorter than seven bytes
* craft-media: README states the multistream layout for 3 to 8 channel Opus
An Opus { channels } access unit is one Opus packet for 1 or 2 channels.
For 3 to 8 channels it holds the mapping family 1 streams in the order
of table 4-3 of the Opus transport draft, every stream but the last
self-delimited (RFC 6716 Appendix B). The README now says so, matching
the Codec::Opus doc comment.
* craft-video: TrackDecoder, codec-agnostic decoding for H.264, HEVC, VP9, AV1 and MPEG-2 (#1231)
Add `craft_video::TrackDecoder`, the counterpart of craft-audio's: built
from a track's `CodecParams`, it takes packets in decode order with
their timestamps and returns `VideoFrame`s in display order, with
`flush` and `reset`. Each codec is behind its decoder feature.
Configuration: an `avcC` / `hvcC` record, Annex B parameter sets (AVI
with global headers) or nothing (MPEG-TS) for H.264 and HEVC; the
`av1C` config OBUs for AV1; a sequence header for MPEG-2. Picture data
in the configuration is refused (or, for MPEG-2, dropped by the
decoder's reset). `reset` keeps the configuration: H.264 applies it
again, HEVC and AV1 build a new decoder from it.
A call that fails keeps the frames it finished for the next call.
Add `VideoError` (Unsupported, Malformed, Frame), into which each
decoder's error converts. `av1::decode::bits` becomes `pub(crate)` for
its LEB128 reader.
Tests: unit tests for codec selection, configuration checks, hostile
configuration and kept frames; `tests/track` decodes ffmpeg-made MP4,
MPEG-TS and AVI files and compares with ffmpeg's decode, then decodes
again after a reset and from a later key packet.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* craft-video: TrackDecoder review fixes (#1231)
- MPEG-2: configuration is checked before it is decoded. Every start
code must be a sequence header, extension, user data or GOP header;
a picture after a valid sequence header was decoded and then dropped
by a reset, so construction succeeded. It is now Malformed.
- The decode and flush docs and the README say what each codec keeps
after its own decoding error: H.264 keeps finished pictures, HEVC
only its newest 32 while calls keep failing, VP9 those of earlier
packets, MPEG-2 unless the packet made too many, and AV1 drops those
of the failing decode or flush. Frames that fail to convert are
still kept for the next call.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>