Skip to main content

Module gainmap

Module gainmap 

Source
Expand description

XMP serialization for Ultra HDR and related multi-image JPEG formats.

This module handles the Adobe/Google XMP metadata used by Ultra HDR:

  • hdrgm:* namespace — gain-map numerical parameters (min, max, gamma, offsets, HDR headroom). Generated by generate_xmp and friends; parsed by parse_xmp.
  • Container:Directory — GContainer item manifest used by Google Camera and Android Dynamic Depth Format. Emitted by generate_xmp_with_items; parsed alongside metadata by parse_xmp_full. See super::container for ContainerItem and ItemSemantic.

Physical packet framing belongs to the containing codec.

Enums§

XmpError
Errors from parse_xmp.

Constants§

CONTAINER_NAMESPACE
XMP namespace for GContainer directory.
HDRGM_NAMESPACE
XMP namespace for HDR gain-map metadata.
ITEM_NAMESPACE
XMP namespace for GContainer item.
MAX_XMP_LENGTH
Upper bound on XMP packet length accepted by parse_xmp. Guards against CPU exhaustion on crafted inputs.

Functions§

generate_gainmap_xmp
Generate XMP for the gain-map (secondary) JPEG: numeric metadata only (no Container:Directory).
generate_primary_xmp
Generate XMP for the primary JPEG: Container:Directory only.
generate_primary_xmp_with_items
Generate XMP for the primary JPEG with a custom item list (e.g. for depth-map containers alongside the gain map).
generate_xmp
Generate XMP for a 2-item Primary + GainMap Ultra HDR image.
generate_xmp_with_items
Generate XMP with both numeric metadata and a custom container directory. Used when carrying depth / confidence maps alongside the gain map.
parse_xmp
Parse Ultra HDR XMP numeric metadata + optional Item:Length for the gain map.
parse_xmp_full
Parse numeric parameters and container items. Invalid packets yield no metadata; use parse_xmp when a diagnostic error is required.