Software:Adobe Gain Map

From HandWiki

The concept of Adobe Gain Map involves storing both the Base rendition (primary image) and the Gain Map (secondary image and associated metadata). The Gain Map functions as the quotient between SDR and HDR renditions. When using an HDR base, applying the Gain Map generates an SDR rendition, and vice versa. This method ensures built-in compatibility with older image software and displays.[1][2]

Computing the Gain Map

The following steps describe how to compute the Gain Map:

1) Prepare Renditions

  • Ensure the authoring app has created both SDR and HDR renditions with linear gamma and the same colorimetry (e.g., Rec. 2020 or P3)

2) Downsample and Convert (Optional)

  • Downsample the renditions to a lower resolution
  • Convert the renditions to grayscale

3) Compute Gain Map

  • Compute the Gain Map  
  • G = log2 (HDR+khdr/SDR+ksdr)
  • This Gain Map can be a 1-plane or 3-plane map, where:
    • 0 = no change
    • Negative values = darken
    • Positive values = brighten

4) Analyze Gain Map Values

  • Determine the minimum, middle and maximum values for each color plane of G

5) Affine Transform

  • Remap each color plane of G, with an affine transform to map the minimum and maximum values to 0 and 1
  • Clip the resulting pixel values to the range [0, 1]

6) Gamma Mapping (Optional)

  • Optionally apply a gamma function to each color plane of G

7) Bit Depth Encoding

  • Choose a bit depth N for encoding (e.g., N = 8 bits)
  • Scale the normalized gain map data to the range 0 to 2N-1 (e.g., 255 for 8-bit): f(x)=floor(x*(2N−1)+0,5)

8) Metadata

  • Compute and store relevant metadata

9) Compression (Optional)

  • Compress the Gain Map for more efficient storage[3]

Applying the Gain Map

After computing the Gain Map, you can apply it according to the following paragraph:

1) Load Base and Gain Map

  • Import both the Base rendition and the Gain Map into the display system

2) Determine Display Capabilities

  • Assess the HDR capabilities of the display device

3) Interpolate Rendition

  • Use the Gain Map to interpolate between the SDR and HDR renditions

4) Tone Mapping

  • Apply tone mapping, so the image adapts to the display’s settings

5) Rendering

  • Render the final image on the display and ensure it aligns with HDR or SDR settings[4]

Advantages

  • Dynamic adaptation to the current display and viewing conditions  
  • Creative control over tone mapping for the image author, rather than relying on automated processes
  • Providing backward compatibility with the existing software  
  • Simple, GPU-friendly display logic  
  • Using it with existing formats (JPEG, HEIC, PNG, etc.), can prevent difficulties like compatibility breaking  

Disadvantages

  • Increased storage requirements.
  • Additional runtime display logic complexity.

Bit Depth

The bit depth depends mainly on the image source and also on the output. Gain Maps have 16-bit depth in general, in order to keep high dynamic range and accurate colours. It is relevant to mention, that the Gain Map bit depth does not have to be the same as the one of the Base. The ideal storing of Adobe Gain Map is at least 10 bits per component, but you can also use 8 bits. Storing it with 8bit components has its advantage of allowing backward compatibility with existing file formats with the same bit depth (like JPEG). However, when using less than 10bits per component, unwanted effects like banding can occur.[5]    

Gain Map Metadata

  • Minimal and maximal Gain Map values per channel  
  • Gamma values per channel  
  • Minimal and maximal HDR capacity values for interpolating the Gain Map  
  • Boolean flag (indicating if is the Base rendition SDR or HDR)  
  • A version tag[6]  

Colour and Gray Notes

Gain Map can be either colour (RGB) or grayscale. The colour allows contrast and saturation adjusting, whereas grayscale has its benefit in using less storage, but it cannot represent advanced colour mapping techniques.[7]

References

  1. Benz, Greg. "JPG HDR Gain Maps in Adobe Camera Raw" [online]. [cit. 2024-10-31]. Available online
  2. Adobe Systems Incorporated. "Using Gain Map in Camera Raw" [online]. [cit. 2024-10-31]. Available online
  3. Adobe Systems Incorporated. "Adobe Gain Map 1.0", p.2. [online]. [cit. 2024-10-31]. Available online
  4. Adobe Systems Incorporated. "Adobe Gain Map 1.0", p.3. [online]. [cit. 2024-10-31]. Available online
  5. Adobe Systems Incorporated. "Adobe Gain Map 1.0", p.7. [online]. [cit. 2024-10-31]. Available online
  6. Adobe Systems Incorporated. "Adobe Gain Map 1.0", p.3. [online]. [cit. 2024-10-31]. Available online
  7. Adobe Systems Incorporated. "Adobe Gain Map 1.0", p.6. [online]. [cit. 2024-10-31]. Available online