Expand description
Apple iOS MakerNote HDR gain-map metadata extraction.
Apple HEIC/JPEG captures encode their HDR gain-map headroom inside the
EXIF MakerNote (TIFF tag 0x927C), not in XMP — the embedded gain-map
image’s XMP carries only HDRGainMapVersion. The headroom is derived from
two Apple MakerNote tags, per exiftool’s Image::ExifTool::Apple:
| Tag | Name | Type | Role |
|---|---|---|---|
0x0021 | HDRHeadroom | rational64s | “maker33” |
0x0030 | HDRGain | rational64s | “maker48” |
0x000A | HDRImageType | int32s | 3 = HDR, 4 = SDR |
The headroom (in stops, i.e. log2 luminance ratio) is computed from
maker33 and maker48 with the community/Apple-derived piecewise formula
(see AppleHdrInfo::headroom_stops). The exact constants are not in a
published Apple specification; final fidelity is validated by the gain-map
round-trip test, not asserted to be bit-exact here.
References:
- exiftool
lib/Image/ExifTool/Apple.pm - https://juniperphoton.substack.com/p/decoding-some-hidden-magic-of-makerapple
- https://photoinvestigator.co/blog/the-mystery-of-maker-apple-metadata/
This module is pure byte parsing: no_std + alloc, no transcendental
math, zero new dependencies. The IFD-walk mechanics mirror the proven
reader in zenraw::apple, with the corrected exiftool tag IDs.
Modules§
- compatibility
- Compatibility with ultrahdr-core 0.6.0’s published Apple helpers.
- tags
- Apple MakerNote tag IDs (per exiftool
Apple.pm).
Structs§
- Apple
HdrInfo - HDR information recovered from an Apple MakerNote.
- Apple
Maker Note - Apple MakerNote inspection view. Other vendors remain opaque. No allocation or value copies; unknown entries are visible for audit/diff.
- Maker
Note Entry - One borrowed vendor entry, including unknown/private tags.
- Maker
Note Entry Error - An entry that could not be read. Inspection does not silently hide it.
Functions§
- from_
apple_ headroom - Map recovered Apple headroom to the canonical
GainMapMetadata(=zencodec::GainMapParams). - parse_
apple_ makernote - Parse an Apple iOS MakerNote blob (
"Apple iOS\0"+ version + byte-order marker + IFD) and pull out the HDR tags. - parse_
exif_ for_ apple_ hdr - Extract Apple HDR info directly from EXIF TIFF bytes (e.g. the payload of a
HEIF
Exifitem or a JPEGAPP1segment, with any leading TIFF-offset prefix tolerated).