mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
HDR: Use human-readable values for ColorInfo.toString().
This should make debugging much easier as values will be more human-readable. Before this CL, one needed to reference MediaFormatUtil to check the colorSpace/colorTransfer/colorRange values and make sure values were as expected. PiperOrigin-RevId: 502367147
This commit is contained in:
parent
27d44e86fe
commit
9789b39c78
1 changed files with 53 additions and 3 deletions
|
|
@ -257,16 +257,66 @@ public final class ColorInfo implements Bundleable {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ColorInfo("
|
return "ColorInfo("
|
||||||
+ colorSpace
|
+ colorSpaceToString(colorSpace)
|
||||||
+ ", "
|
+ ", "
|
||||||
+ colorRange
|
+ colorRangeToString(colorRange)
|
||||||
+ ", "
|
+ ", "
|
||||||
+ colorTransfer
|
+ colorTransferToString(colorTransfer)
|
||||||
+ ", "
|
+ ", "
|
||||||
+ (hdrStaticInfo != null)
|
+ (hdrStaticInfo != null)
|
||||||
+ ")";
|
+ ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String colorSpaceToString(@C.ColorSpace int colorSpace) {
|
||||||
|
// LINT.IfChange(color_space)
|
||||||
|
switch (colorSpace) {
|
||||||
|
case Format.NO_VALUE:
|
||||||
|
return "Unset color space";
|
||||||
|
case C.COLOR_SPACE_BT601:
|
||||||
|
return "BT601";
|
||||||
|
case C.COLOR_SPACE_BT709:
|
||||||
|
return "BT709";
|
||||||
|
case C.COLOR_SPACE_BT2020:
|
||||||
|
return "BT2020";
|
||||||
|
default:
|
||||||
|
return "Undefined color space";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String colorTransferToString(@C.ColorTransfer int colorTransfer) {
|
||||||
|
// LINT.IfChange(color_transfer)
|
||||||
|
switch (colorTransfer) {
|
||||||
|
case Format.NO_VALUE:
|
||||||
|
return "Unset color transfer";
|
||||||
|
case C.COLOR_TRANSFER_LINEAR:
|
||||||
|
return "Linear";
|
||||||
|
case C.COLOR_TRANSFER_SDR:
|
||||||
|
return "SDR SMPTE 170M";
|
||||||
|
case C.COLOR_TRANSFER_GAMMA_2_2:
|
||||||
|
return "Gamma 2.2";
|
||||||
|
case C.COLOR_TRANSFER_ST2084:
|
||||||
|
return "ST2084 PQ";
|
||||||
|
case C.COLOR_TRANSFER_HLG:
|
||||||
|
return "HLG";
|
||||||
|
default:
|
||||||
|
return "Undefined color transfer";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String colorRangeToString(@C.ColorRange int colorRange) {
|
||||||
|
// LINT.IfChange(color_range)
|
||||||
|
switch (colorRange) {
|
||||||
|
case Format.NO_VALUE:
|
||||||
|
return "Unset color range";
|
||||||
|
case C.COLOR_RANGE_LIMITED:
|
||||||
|
return "Limited range";
|
||||||
|
case C.COLOR_RANGE_FULL:
|
||||||
|
return "Full range";
|
||||||
|
default:
|
||||||
|
return "Undefined color range";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
if (hashCode == 0) {
|
if (hashCode == 0) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue