HeifGainMap

The HDR gain map of a HEIC or AVIF file (#153), as ImageKodec.decodeGainMap returns it: the decoded map and what the file says of it. It is returned, not applied. GainMap stays the gain map of an Ultra HDR JPEG, which holds JPEG bytes; this one holds decoded samples.

A file carries its map in one of two forms, which form names:

  • Form.Iso21496: a tone-mapped (tmap) derived item, ISO/IEC 23008-12 with ISO 21496-1, whose inputs are the base image and the gain map image and whose payload gives metadata.

  • Form.Apple: an auxiliary image of type urn:com:apple:photo:2020:aux:hdrgainmap, as an iPhone writes it: a 4:0:0 HEVC image, smaller than the photo. Its parameters are in the photo's EXIF, in tags 33 and 48 of Apple's MakerNote, which appleMakerNote33 and appleMakerNote48 give as stored.

Types

Link copied to clipboard
enum class Form : Enum<HeifGainMap.Form>

The two ways a HEIF file stores its gain map.

Properties

Link copied to clipboard

the headroom Apple derives from tags 33 and 48: the ratio of the brightest white of the HDR rendition to SDR white, from the formula of Apple's "Applying Apple HDR effect to your photos". Null unless both tags are present.

Link copied to clipboard

tag 33 (0x0021) of the Apple MakerNote in the primary image's EXIF, as a number, or null when the form is not Form.Apple or the tag is absent or not a number.

Link copied to clipboard

tag 48 (0x0030) of the same MakerNote, or null in the same cases.

Link copied to clipboard

the gain map image's samples at 16 bits, before its own clean aperture, rotation and mirror: one channel when the gain map image is monochrome, else three, red, green and blue. They are converted as ImageKodec.decode16 converts a picture, with the gain map image's own colour properties: a full-range 8-bit sample v is v * 257, a limited-range one is stretched to full range first, and a picture in colour is converted from YCbCr to RGB.

Link copied to clipboard

which of the two forms the file uses.

Link copied to clipboard

the parameters of Form.Iso21496, or null for Form.Apple.

Functions

Link copied to clipboard
open override fun toString(): String