Table of Contents

Class GainMapInfo

Namespace
Egami.Colors
Assembly
Egami.dll

How a gain map turns its base image into another rendition, in ISO 21496-1's terms: for a gain map sample g (0 to 1) after gamma, the log2 boost is lerp(GainMapMin, GainMapMax, g), applied as (base + OffsetSdr) × 2^(boost × weight) − OffsetHdr, where the weight rises from 0 at a display headroom of HdrCapacityMin to 1 at HdrCapacityMax. Boosts and capacities are log2 values.

public sealed record GainMapInfo : IEquatable<GainMapInfo>
Inheritance
GainMapInfo
Implements
Inherited Members

Examples

// As stored: the SDR base image, with the gain map in the metadata.
using Raster sdr = Raster.Load("ultrahdr.jpg");
GainMap? map = sdr.Metadata.GainMap;                                     // null for a plain JPEG

// The HDR rendition for a display 4x as bright as SDR white: linear half floats, 1.0 = SDR white.
using Raster<RgbaF16> hdr = Raster.Load<RgbaF16>("ultrahdr.jpg", options: new ReaderOptions { Hdr = new HdrDecode { Headroom = 4 } });

// The same from a raster in hand, at the map's full capacity.
using Raster<RgbaF16> full = map!.Apply(sdr);

Properties

AlternateProfile

Gets the alternate rendition's color profile when it differs from the base's, or null.

public ColorProfile? AlternateProfile { get; init; }

Property Value

ColorProfile

BaseRenditionIsHdr

Gets whether the base image is the HDR rendition and the gain map turns it into SDR. Usually false.

public bool BaseRenditionIsHdr { get; init; }

Property Value

bool

Format

Gets which metadata the file gave.

public GainMapFormat Format { get; init; }

Property Value

GainMapFormat

GainMapMax

Gets the log2 boost a gain map sample of 1 gives.

public GainMapValues GainMapMax { get; init; }

Property Value

GainMapValues

GainMapMin

Gets the log2 boost a gain map sample of 0 gives. Defaults to 0 (no boost).

public GainMapValues GainMapMin { get; init; }

Property Value

GainMapValues

Gamma

Gets the gamma the gain map samples were encoded with. Defaults to 1.

public GainMapValues Gamma { get; init; }

Property Value

GainMapValues

HdrCapacityMax

Gets the log2 display headroom at and above which the gain map applies in full.

public double HdrCapacityMax { get; init; }

Property Value

double

HdrCapacityMin

Gets the log2 display headroom at and below which the base image shows unchanged. Defaults to 0.

public double HdrCapacityMin { get; init; }

Property Value

double

OffsetHdr

Gets the offset taken from the result after the boost. Defaults to 1/64.

public GainMapValues OffsetHdr { get; init; }

Property Value

GainMapValues

OffsetSdr

Gets the offset added to the base image before the boost. Defaults to 1/64.

public GainMapValues OffsetSdr { get; init; }

Property Value

GainMapValues

UseBaseColorSpace

Gets whether the gain map applies in the base image's color space (the usual case) rather than the alternate rendition's, which the gain map image's ICC profile then gives.

public bool UseBaseColorSpace { get; init; }

Property Value

bool

Methods

Weight(double)

Gets the weight the gain map applies with on a display of headroom (its peak over SDR white, linear).

public double Weight(double headroom)

Parameters

headroom double

The display headroom, 1 or more.

Returns

double

0 to 1, or −1 to 0 when the base is HDR.