decode_ccitt_raw shared decode_ccitt_within's heuristic of reading Group 3
rows with a leading end-of-line code unaligned even with EncodedByteAlign,
so it read other rows than PostScript's CCITTFaxDecode filter (an aligned
RTC became one more row, and fewer bytes were consumed). The raw API now
reads rows on bytes exactly when encoded_byte_align is set, as hayro-ccitt
does; decode_ccitt_within keeps its heuristic.
The package layer of DeckCraft's native format, moved from storytold/deckcraft
crates/format at 0d5c0b85 (lib.rs, finite.rs): the mimetype and legacy
SlideCraft type, sniffing, the presentation.json envelope (generic over the
app's presentation), the NaN-safe JSON writer (Finite), the reader that patches
null numbers in older files, member names and compression choice, and the
bounded, budget-charged member reads with the format's limits.
The presentation model, repair, media and chart-part mapping, and outline/RTF
stay in DeckCraft. Writes go through craft-zip's deterministic writer; the
consumer's golden test shows the package bytes are unchanged.
Part of #778.
Move LightCraft profile-reader semantics (origin 4a490db2) into the existing shared Cube engine. Preserve optional titles, finite endpoints and caller-selected limits; leave application interpolation and registry policies in the consumer. Integration and resource-bound adaptations by Dylan M. Taylor.
Adapt the strict-token correction from storytold/lightcraft#3464, original commit 77bb537552d59142814eaa65cfea4626c33d6dfc, to the existing shared Cube reader.
* 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.
* audio: pure-Rust Vorbis encoder, and an Ogg page writer in craft-media
Replace the libvorbis wrapper (vorbis_rs, C, desktop only) behind
`vorbis-encode` with FilmCraft's clean-room Vorbis I encoder by
@JordyUSA (storytold/filmcraft#4481), and move its Ogg page writer into
craft-media's `ogg` module.
craft-audio:
- `vorbis::encoder::{Encoder, EncoderConfig, Error}`: 1-8 channels in
Vorbis order, any sample rate, quality -1 to 10 (VBR), streaming
packets with granule positions.
- `encode_ogg_vorbis` with `OggVorbisOptions` (quality, vendor, tags,
serial) writes a whole Ogg Vorbis file with a comment header.
- `encode_ogg(buf, kbps)` and `OGG_BITRATES` keep working: the bit rate
picks the quality whose nominal rate it is (`quality_for_bitrate`).
- `encode` with `EncodeFormat::Ogg` takes 1-8 channel WAV-order layouts
and writes them in Vorbis order, and `RateControl::Quality`.
- Ogg is built on wasm32 too.
- Residue partitions hold whole sample frames (48, 40, 48 or 56 values
for 3, 5, 6 and 7 channels): libvorbis decodes each partition from
channel 0, so 32-value partitions came out scrambled for those counts.
- The first audio packet gets a page of its own, so a short file's
first audio page is never also its last (ffmpeg then kept the padding).
craft-media: `ogg::PageWriter`, `opus_tags`, `vorbis_comment`.
Part of storytold/craft-libs#778.
* audio, media: address review on the Vorbis encoder and Ogg writer
- Encoder: read cursor into the pending input, compacted once per call,
so a large encode() call no longer moves the tail on every block.
- Tests: check ffmpeg's libvorbis decoder only when ffmpeg has it.
- PageWriter::finish: the end granule replaces the last page's only when
a packet completes on it (RFC 7845 4.4); documented and tested.
- README: Ogg Opus packet granules are the samples decoded so far.
* audio: pick Ogg by extension on wasm32 too
The Vorbis encoder is pure Rust now, so encode_format_for("ogg") follows
the vorbis-encode feature alone, as EncodeFormat::Ogg.is_built() and
ENCODE_EXTENSIONS already do.
Port reusable DCP wire parsing/writing and synthetic tests from LightCraft e87f92fe crates/raw/src/dcp.rs, originally introduced by OneSlip in 8972565249b496ccdf3a7f23321c84622615a353. Reuse existing craft-raw DNG color/profile tag reader and craft-tiff writer instead of copying helpers. App applied_to policy stays in LightCraft.
Adapt TextureCraft bdbb52c9b66b221a55b370105b42f485a76e6fc7 integer writer with exact wire oracle. Preserve common-delta tie-breaking and signed wrapping; cap combined output and scratch reservations and reserve fallibly.
Co-authored-by: Dylan M. Taylor <dylan@dylanmtaylor.com>
DNG chapter 7 runs OpcodeList1 on the stored codes, then the
LinearizationTable maps them to sensor values. decode was applying the
table first, so a develop pipeline that later applied list 1 saw already
linearized samples.
When list 1 is present the table is now carried on RawImage and left
unapplied (`linearized` stays false). apply_linearization maps it after
the list. Files without list 1 are unchanged.
The dng-only build already compiles on main (d16ee792 gated
cr3::orientation). A comment at that gate records the E0433 failure
mode.
Part of #778.