You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cross-codec audit of how decoders populate SourceColor and ImageInfo.
Result: PNG is best-in-class; most others have missing fields, hardcoded
defaults, or authority-mismatch bugs. This issue tracks the full set;
individual bugs can be split into per-codec issues as they're tackled.
High-impact bugs
1. HEIC: CICP authority not set when nclx box is the only color metadata
HEIF spec (ISO 23008-12) says nclx is the primary color authority. Code
sets cicp from nclx but never calls .with_color_authority(ColorAuthority::Cicp). Under the new SourceColor::to_color_context() drop-dupe logic, this means HEIC-decoded
pixels with only nclx get their CICP field dropped — ColorContext ends
up with no color metadata, and pipeline stages downstream assume sRGB.
Fix: add .with_color_authority(ColorAuthority::Cicp) when the only
color metadata came from nclx.
2. WebP / GIF: bit_depth hardcoded to 8
Locations:
zenwebp/src/.../codec.rs (~2376 area)
zengif/src/.../codec.rs (similar)
Actual source bits are available from the format (WebP VP8L can carry
8-bit only today, but the pattern is wrong for future containers; GIF is
always 8-bit indexed but bit_depth should be 8 because that's the
source, not because we hardcoded it). Real impact is on downstream
precision-aware negotiation — callers using source.bit_depth to pick
output f32 vs u8 see 8 everywhere.
Fix: parse from bitstream or set None when unknown. GIF's 8 is
correct-by-accident; WebP needs the source bits.
3. HEIC: gain map detected but metadata not parsed
Location: heic/src/codec.rs:1297, 1333-1336
Code sets GainMapPresence::Unknown even when the file declares has_gain_map=true. AVIF does this correctly via convert_gain_map_presence() at zenavif/src/.../codec.rs:2281-2305,
parsing dimensions and metadata into GainMapPresence::Available.
Fix: mirror AVIF's parser. Prerequisite for HEIC-sourced HDR in the HdrProvenance design (imazen/zenpixels#16).
4. is_progressive hardcoded false for several codecs
WebP: no detection
GIF: actually uses the probe interlace flag (codec.rs:1042/1010) — OK
TIFF: no detection of baseline/progressive TIFF
RAW: N/A (not progressive)
JXL: progressive-capable, not flagged
Impact: DecodePolicy::allow_progressive gate can't reject progressive
content from these codecs.
5. HDR metadata missing from UltraHDR JPEG
Location: zenjpeg/zenjpeg/src/codec.rs
JPEG can carry CLL/MDCV and gain maps via APP11 JUMBF (UltraHDR) or APP2
(ISO 21496-1 secondary image). Currently no content_light_level, mastering_display, or gain_map population for JPEG.
TIFF: CICP not populated (TIFF spec has no CICP; OK). bit_depth
correct. Missing is_progressive baseline-vs-progressive detection.
RAW/DNG: ICC from DCP/EXIF extracted but not consistently fed to
descriptor helper. channel_count assumed RGB.
PDF: fully rasterized; no source color metadata meaningful. OK as
assumed sRGB but could populate from embedded PDF color spaces when
they match CICP-expressible values.
Radiance HDR: hardcodes Cicp::SRGB but Radiance is scene-linear
BT.709, not sRGB transfer. Authority not explicitly set.
Non-integration
fax (CCITT): standalone, no zencodec integration. N/A.
Cross-codec audit of how decoders populate
SourceColorandImageInfo.Result: PNG is best-in-class; most others have missing fields, hardcoded
defaults, or authority-mismatch bugs. This issue tracks the full set;
individual bugs can be split into per-codec issues as they're tackled.
High-impact bugs
1. HEIC: CICP authority not set when nclx box is the only color metadata
Location:
heic/src/codec.rs:1286..1346(approximate,build_image_info_full)HEIF spec (ISO 23008-12) says
nclxis the primary color authority. Codesets
cicpfrom nclx but never calls.with_color_authority(ColorAuthority::Cicp). Under the newSourceColor::to_color_context()drop-dupe logic, this means HEIC-decodedpixels with only nclx get their CICP field dropped —
ColorContextendsup with no color metadata, and pipeline stages downstream assume sRGB.
Fix: add
.with_color_authority(ColorAuthority::Cicp)when the onlycolor metadata came from nclx.
2. WebP / GIF:
bit_depthhardcoded to 8Locations:
zenwebp/src/.../codec.rs(~2376 area)zengif/src/.../codec.rs(similar)Actual source bits are available from the format (WebP VP8L can carry
8-bit only today, but the pattern is wrong for future containers; GIF is
always 8-bit indexed but
bit_depthshould be 8 because that's thesource, not because we hardcoded it). Real impact is on downstream
precision-aware negotiation — callers using
source.bit_depthto pickoutput f32 vs u8 see 8 everywhere.
Fix: parse from bitstream or set
Nonewhen unknown. GIF's 8 iscorrect-by-accident; WebP needs the source bits.
3. HEIC: gain map detected but metadata not parsed
Location:
heic/src/codec.rs:1297, 1333-1336Code sets
GainMapPresence::Unknowneven when the file declareshas_gain_map=true. AVIF does this correctly viaconvert_gain_map_presence()atzenavif/src/.../codec.rs:2281-2305,parsing dimensions and metadata into
GainMapPresence::Available.Fix: mirror AVIF's parser. Prerequisite for HEIC-sourced HDR in the
HdrProvenancedesign (imazen/zenpixels#16).4.
is_progressivehardcoded false for several codecscodec.rs:1042/1010) — OKImpact:
DecodePolicy::allow_progressivegate can't reject progressivecontent from these codecs.
5. HDR metadata missing from UltraHDR JPEG
Location:
zenjpeg/zenjpeg/src/codec.rsJPEG can carry CLL/MDCV and gain maps via APP11 JUMBF (UltraHDR) or APP2
(ISO 21496-1 secondary image). Currently no
content_light_level,mastering_display, orgain_mappopulation for JPEG.Blocks: UltraHDR round-trip encoding (imazen/zenpixels#16).
Minor gaps
bit_depthcorrect. Missing
is_progressivebaseline-vs-progressive detection.descriptor helper.
channel_countassumed RGB.assumed sRGB but could populate from embedded PDF color spaces when
they match CICP-expressible values.
Cicp::SRGBbut Radiance is scene-linearBT.709, not sRGB transfer. Authority not explicitly set.
Non-integration
Tables
Table 1: SourceColor field population
Legend: ✅ correct ·⚠️ partial/suspect · ❌ not populated · ➖ N/A
Table 2: ImageInfo extras
Table 3: Descriptor derivation path
descriptor_for_decoded_pixels(deprecated)corrected_cicpcodec.rs:1644..1950. Migrate to_v2.native_descriptor(jxl_info_to_image_info)convert_image_infobuilds SourceColorbuild_image_info_fullTable 4: Format-spec authority compliance
Suggested fix order
is_progressivedetection for WebP/TIFF/JXLSourceColor::assert_spec_authority(format)tocatch these at decoder test time
Related
populating CLL/MDCV/gain-map metadata correctly.