v0.1.20
Added
ISO_21496_1_URN: &[u8; 28]— the ISO-defined namespace URN for gain-map payloads in URN-namespaced containers (most notably JPEG APP2). Byte-identical to libultrahdr'skIsoNameSpace.ISO_21496_1_PRIMARY_APP2_BODY: &[u8; 32]— the full JPEG APP2 body (URN +min_version=0, writer_version=0) that the primary image of a canonical Ultra HDR JPEG carries to advertise ISO 21496-1 awareness. Goes directly inside the APP2 segment after theFF E2marker + length header; detected by exact bytes match.Iso21496Format::JxlJhgm— canonical name for the bare ISO 21496-1 payload (no URN, no version byte). Naming parallelsAvifTmap: each variant names the container that consumes exactly those bytes.Iso21496Format::JpegApp2BodyWithUrn— full JPEG APP2 body (URN + bare payload), handled in oneparse_iso21496_fmt/serialize_iso21496_fmtcall. Does NOT include the JPEGFF E2marker oru16 BElength word (those stay with the caller as JPEG syntax).Iso21496Formatdiscriminants pinned with explicit= 0..3values plus aconst _: () = assert!(...)block, so accidental reorders/removals trip at compile time instead of silently shiftingas u8results.gainmap::serialize_iso21496_fmt_into(params, format, &mut Vec<u8>)— append-to-buffer partner forserialize_iso21496_fmt, lets callers embed the ISO payload inside a larger buffer (e.g., a JPEG APP2 marker + length + body) in one allocation.GainMapParseError::UrnMismatch— returned when parsing underIso21496Format::JpegApp2BodyWithUrnand the input does not begin withISO_21496_1_URN.
Deprecated
Iso21496Format::JpegApp2— misleading name. The bytes it produces are the bare ISO 21496-1 payload (no URN), not a standalone JPEG APP2 body. UseJxlJhgmfor the same bytes under a clearer name, orJpegApp2BodyWithUrnfor the full APP2 body including the URN. Kept at its original discriminant0so existingas u8casts keep working; it andJxlJhgmare distinct variants that serialize to identical bytes (Rust does not allow two variants to share a discriminant).
Fixed
- Formatting fixup so
cargo fmt --checkis clean (41f7162).
Why
The URN is ISO-defined, not JPEG-defined, and belongs next to Iso21496Format rather than duplicated across codec crates. Folding URN framing into the format enum collapses the API surface to one parse/serialize pair and each variant now names the container that consumes exactly those bytes. The FF E2 + u16 BE length envelope remains pure JPEG syntax and stays in zenjpeg.
Full changelog: https://github.com/imazen/zencodec/blob/v0.1.20/CHANGELOG.md#0120---2026-04-21