ColorInfo
@UnstableApi
public final class ColorInfo
Stores color info.
When a nullColorInfo instance is used, this often represents a generic SDR_BT709_LIMITED instance.
Summary
Nested types |
|---|
public final class ColorInfo.BuilderBuilds |
Constants |
|
|---|---|
static final ColorInfo |
Color info representing SDR BT.709 limited range, which is a common SDR video color format. |
static final ColorInfo |
Color info representing SDR sRGB in accordance with |
Public fields |
|
|---|---|
final int |
The bit depth of the chroma samples of the video, or |
final @C.ColorRange int |
The |
final int |
The |
final int |
The |
final @Nullable byte[] |
HdrStaticInfo as defined in CTA-861.3, or null if none specified. |
final int |
The bit depth of the luma samples of the video, or |
Public methods |
|
|---|---|
ColorInfo.Builder |
Returns a |
static int |
colorSpaceToIsoColorPrimaries(@C.ColorSpace int colorSpace)Returns the ISO color primary code corresponding to the given |
static int |
colorSpaceToIsoMatrixCoefficients(@C.ColorSpace int colorSpace)Returns the ISO matrix coefficients code corresponding to the given |
static int |
colorTransferToIsoTransferCharacteristics(Returns the ISO transfer characteristics code corresponding to the given |
boolean |
|
static ColorInfo |
fromBundle(Bundle bundle)Restores a |
int |
hashCode() |
boolean |
Returns whether this instance has valid bitdepths. |
boolean |
Returns whether this instance has valid DataSpace members. |
static boolean |
@EnsuresNonNullIf(result = false, expression = "#1")Returns whether the given color info is equivalent to values for a standard dynamic range video that could generally be assumed if no further information is given. |
static boolean |
isTransferHdr(@Nullable ColorInfo colorInfo)Returns whether the |
boolean |
isValid()Returns whether this instance is valid. |
static int |
@PureReturns the |
static int |
@PureReturns the |
Bundle |
toBundle() |
String |
Returns a prettier |
String |
toString() |
Constants
SDR_BT709_LIMITED
public static final ColorInfo SDR_BT709_LIMITED
Color info representing SDR BT.709 limited range, which is a common SDR video color format.
SRGB_BT709_FULL
public static final ColorInfo SRGB_BT709_FULL
Color info representing SDR sRGB in accordance with DATASPACE_SRGB, which is a common SDR image color format.
Public fields
chromaBitdepth
public final int chromaBitdepth
The bit depth of the chroma samples of the video, or NO_VALUE if not set. It may differ from the luma bit depth.
colorTransfer
@C.ColorTransfer
public final int colorTransfer
The C.ColorTransfer, or NO_VALUE if not set.
hdrStaticInfo
public final @Nullable byte[] hdrStaticInfo
HdrStaticInfo as defined in CTA-861.3, or null if none specified.
lumaBitdepth
public final int lumaBitdepth
The bit depth of the luma samples of the video, or NO_VALUE if not set.
Public methods
buildUpon
public ColorInfo.Builder buildUpon()
Returns a Builder initialized with the values of this instance.
colorSpaceToIsoColorPrimaries
public static int colorSpaceToIsoColorPrimaries(@C.ColorSpace int colorSpace)
Returns the ISO color primary code corresponding to the given C.ColorSpace, as per table A.7.21.1 in Rec. ITU-T T.832 (06/2019). made.
colorSpaceToIsoMatrixCoefficients
public static int colorSpaceToIsoMatrixCoefficients(@C.ColorSpace int colorSpace)
Returns the ISO matrix coefficients code corresponding to the given C.ColorSpace, as per table A.7.21.3 in Rec. ITU-T T.832 (06/2019).
colorTransferToIsoTransferCharacteristics
public static int colorTransferToIsoTransferCharacteristics(
@C.ColorTransfer int colorTransfer
)
Returns the ISO transfer characteristics code corresponding to the given C.ColorTransfer, as per table A.7.21.2 in Rec. ITU-T T.832 (06/2019).
isBitdepthValid
public boolean isBitdepthValid()
Returns whether this instance has valid bitdepths.
This instance has valid bitdepths if none of them is NO_VALUE.
isDataSpaceValid
public boolean isDataSpaceValid()
Returns whether this instance has valid DataSpace members.
This instance is valid if no DataSpace members are NO_VALUE.
isEquivalentToAssumedSdrDefault
@EnsuresNonNullIf(result = false, expression = "#1")
public static boolean isEquivalentToAssumedSdrDefault(@Nullable ColorInfo colorInfo)
Returns whether the given color info is equivalent to values for a standard dynamic range video that could generally be assumed if no further information is given.
The color info is deemed to be equivalent to SDR video if it either has unset values or values matching a 8-bit (chroma+luma), BT.709 or BT.601 color space, SDR transfer and Limited range color info.
| Returns | |
|---|---|
boolean |
Whether the given color info is equivalent to the assumed default SDR color info. |
isTransferHdr
public static boolean isTransferHdr(@Nullable ColorInfo colorInfo)
Returns whether the ColorInfo uses an HDR C.ColorTransfer.
COLOR_TRANSFER_LINEAR is not considered to be an HDR C.ColorTransfer, because it may represent either SDR or HDR contents.
isValid
public boolean isValid()
Returns whether this instance is valid.
This instance is valid if at least one between bitdepths and DataSpace info are valid.
isoColorPrimariesToColorSpace
@Pure
@C.ColorSpace
public static int isoColorPrimariesToColorSpace(int isoColorPrimaries)
Returns the C.ColorSpace corresponding to the given ISO color primary code, as per table A.7.21.1 in Rec. ITU-T T.832 (06/2019), or NO_VALUE if no mapping can be made.
isoTransferCharacteristicsToColorTransfer
@Pure
@C.ColorTransfer
public static int isoTransferCharacteristicsToColorTransfer(
int isoTransferCharacteristics
)
Returns the C.ColorTransfer corresponding to the given ISO transfer characteristics code, as per table A.7.21.2 in Rec. ITU-T T.832 (06/2019), or NO_VALUE if no mapping can be made.
toLogString
public String toLogString()
Returns a prettier String than toString, intended for logging.
| See also | |
|---|---|
toLogString |