次の方法で共有


Gainmap Class

Definition

Gainmap represents a mechanism for augmenting an SDR image to produce an HDR one with variable display adjustment capability.

[Android.Runtime.Register("android/graphics/Gainmap", ApiSince=34, DoNotGenerateAcw=true)]
public sealed class Gainmap : Java.Lang.Object, Android.OS.IParcelable, IDisposable, Java.Interop.IJavaPeerable
[<Android.Runtime.Register("android/graphics/Gainmap", ApiSince=34, DoNotGenerateAcw=true)>]
type Gainmap = class
    inherit Object
    interface IParcelable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Inheritance
Gainmap
Attributes
Implements

Remarks

Gainmap represents a mechanism for augmenting an SDR image to produce an HDR one with variable display adjustment capability. It is a combination of a set of metadata describing how to apply the gainmap, as well as either a 1 (such as android.graphics.Bitmap.Config#ALPHA_8 or 3 (such as android.graphics.Bitmap.Config#ARGB_8888 with the alpha channel ignored) channel Bitmap that represents the gainmap data itself.

When rendering to an android.content.pm.ActivityInfo#COLOR_MODE_HDR activity, the hardware accelerated Canvas will automatically apply the gainmap when sufficient HDR headroom is available.

<h3>Gainmap Structure</h3>

The logical whole of a gainmap'd image consists of a base Bitmap that represents the original image as would be displayed without gainmap support in addition to a gainmap with a second enhancement image. In the case of a JPEG, the base image would be the typical 8-bit SDR image that the format is commonly associated with. The gainmap image is embedded alongside the base image, often at a lower resolution (such as 1/4th), along with some metadata to describe how to apply the gainmap. The gainmap image itself is then a greyscale image representing the transformation to apply onto the base image to reconstruct an HDR rendition of it.

As such these "gainmap images" consist of 3 parts - a base Bitmap with a Bitmap#getGainmap() that returns an instance of this class which in turn contains the enhancement layer represented as another Bitmap, accessible via #getGainmapContents()<h3>Applying a gainmap manually</h3>

When doing custom rendering such as to an OpenGL ES or Vulkan context, the gainmap is not automatically applied. In such situations, the following steps are appropriate to render the gainmap in combination with the base image.

Suppose our display has HDR to SDR ratio of H, and we wish to display an image with gainmap on this display. Let B be the pixel value from the base image in a color space that has the primaries of the base image and a linear transfer function. Let G be the pixel value from the gainmap. Let D be the output pixel in the same color space as B. The value of D is computed as follows:

First, let W be a weight parameter determining how much the gainmap will be applied.

W = clamp((log(H)                      - log(minDisplayRatioForHdrTransition)) /
                        (log(displayRatioForFullHdr) - log(minDisplayRatioForHdrTransition), 0, 1)

Next, let L be the gainmap value in log space. We compute this from the value G that was sampled from the texture as follows:

L = mix(log(ratioMin), log(ratioMax), pow(G, gamma))

Finally, apply the gainmap to compute D, the displayed pixel. If the base image is SDR then compute:

D = (B + epsilonSdr) * exp(L * W) - epsilonHdr

In the above math, log() is a natural logarithm and exp() is natural exponentiation. The base for these functions cancels out and does not affect the result, so other bases may be used if preferred.

Java documentation for android.graphics.Gainmap.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

Gainmap(Bitmap)

Creates a gainmap from a given Bitmap.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Creator
DisplayRatioForFullHdr

Gets the hdr/sdr ratio at which point the gainmap is fully applied. -or- Sets the hdr/sdr ratio at which point the gainmap is fully applied.

GainmapContents

Sets the image data of the gainmap.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
MinDisplayRatioForHdrTransition

Gets the hdr/sdr ratio below which only the SDR image is displayed. -or- Sets the hdr/sdr ratio below which only the SDR image is displayed.

PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
DescribeContents()

No special parcel contents.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetEpsilonHdr()

Gets the hdr epsilon.

GetEpsilonSdr()

Gets the sdr epsilon.

GetGamma()

Gets the gainmap gamma.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetRatioMax()

Gets the gainmap ratio max.

GetRatioMin()

Gets the gainmap ratio max.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
SetEpsilonHdr(Single, Single, Single)

Sets the hdr epsilon which is used to avoid numerical instability.

SetEpsilonSdr(Single, Single, Single)

Sets the sdr epsilon which is used to avoid numerical instability.

SetGamma(Single, Single, Single)

Sets the gainmap gamma.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetRatioMax(Single, Single, Single)

Sets the gainmap ratio max.

SetRatioMin(Single, Single, Single)

Sets the gainmap ratio min.

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
WriteToParcel(Parcel, ParcelableWriteFlags)

Write the gainmap to the parcel.

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to