Rename "useHdr" to "useHighPrecisionColorComponents."

BaseGlShaderProgram and SingleFrameGlShaderProgram are technically color space agnostic. useHdr is passed to the TexturePool, which only uses the value to choose between high/regular precision. useHdr is therefore a bit misleading and should be generalized to "useHighPrecisionColorComponents."

PiperOrigin-RevId: 545726629
This commit is contained in:
Googler 2023-07-05 18:56:38 +01:00 committed by Rohit Singh
parent 2b8c01de47
commit 5050171ff6
8 changed files with 14 additions and 15 deletions

View File

@ -70,7 +70,7 @@ import java.io.IOException;
float maxInnerRadius, float maxInnerRadius,
float outerRadius) float outerRadius)
throws VideoFrameProcessingException { throws VideoFrameProcessingException {
super(useHdr); super(/* useHighPrecisionColorComponents= */ useHdr);
checkArgument(minInnerRadius <= maxInnerRadius); checkArgument(minInnerRadius <= maxInnerRadius);
checkArgument(maxInnerRadius <= outerRadius); checkArgument(maxInnerRadius <= outerRadius);
this.minInnerRadius = minInnerRadius; this.minInnerRadius = minInnerRadius;

View File

@ -51,14 +51,13 @@ public abstract class BaseGlShaderProgram implements GlShaderProgram {
/** /**
* Creates a {@code BaseGlShaderProgram} instance. * Creates a {@code BaseGlShaderProgram} instance.
* *
* @param useHdr Whether input textures come from an HDR source. If {@code true}, colors will be * @param useHighPrecisionColorComponents If {@code false}, uses colors with 8-bit unsigned bytes.
* in linear RGB BT.2020. If {@code false}, colors will be in linear RGB BT.709. * If {@code true}, use 16-bit (half-precision) floating-point.
* @param texturePoolCapacity The capacity of the texture pool. For example, if implementing a * @param texturePoolCapacity The capacity of the texture pool. For example, if implementing a
* texture cache, the size should be the number of textures to cache. * texture cache, the size should be the number of textures to cache.
*/ */
public BaseGlShaderProgram(boolean useHdr, int texturePoolCapacity) { public BaseGlShaderProgram(boolean useHighPrecisionColorComponents, int texturePoolCapacity) {
outputTexturePool = outputTexturePool = new TexturePool(useHighPrecisionColorComponents, texturePoolCapacity);
new TexturePool(/* useHighPrecisionColorComponents= */ useHdr, texturePoolCapacity);
inputListener = new InputListener() {}; inputListener = new InputListener() {};
outputListener = new OutputListener() {}; outputListener = new OutputListener() {};
errorListener = (frameProcessingException) -> {}; errorListener = (frameProcessingException) -> {};

View File

@ -45,7 +45,7 @@ import java.io.IOException;
*/ */
public ColorLutShaderProgram(Context context, ColorLut colorLut, boolean useHdr) public ColorLutShaderProgram(Context context, ColorLut colorLut, boolean useHdr)
throws VideoFrameProcessingException { throws VideoFrameProcessingException {
super(useHdr); super(/* useHighPrecisionColorComponents= */ useHdr);
// TODO(b/246315245): Add HDR support. // TODO(b/246315245): Add HDR support.
checkArgument(!useHdr, "ColorLutShaderProgram does not support HDR colors."); checkArgument(!useHdr, "ColorLutShaderProgram does not support HDR colors.");
this.colorLut = colorLut; this.colorLut = colorLut;

View File

@ -417,7 +417,7 @@ import java.util.List;
ImmutableList<RgbMatrix> rgbMatrices, ImmutableList<RgbMatrix> rgbMatrices,
int outputColorTransfer, int outputColorTransfer,
boolean useHdr) { boolean useHdr) {
super(useHdr); super(/* useHighPrecisionColorComponents= */ useHdr);
this.glProgram = glProgram; this.glProgram = glProgram;
this.outputColorTransfer = outputColorTransfer; this.outputColorTransfer = outputColorTransfer;
this.matrixTransformations = matrixTransformations; this.matrixTransformations = matrixTransformations;

View File

@ -40,7 +40,7 @@ import java.io.IOException;
/** Creates a new instance. */ /** Creates a new instance. */
public FrameCacheGlShaderProgram(Context context, int capacity, boolean useHdr) public FrameCacheGlShaderProgram(Context context, int capacity, boolean useHdr)
throws VideoFrameProcessingException { throws VideoFrameProcessingException {
super(useHdr, capacity); super(/* useHighPrecisionColorComponents= */ useHdr, capacity);
try { try {
this.copyProgram = this.copyProgram =

View File

@ -44,7 +44,7 @@ import java.io.IOException;
*/ */
public HslShaderProgram(Context context, HslAdjustment hslAdjustment, boolean useHdr) public HslShaderProgram(Context context, HslAdjustment hslAdjustment, boolean useHdr)
throws VideoFrameProcessingException { throws VideoFrameProcessingException {
super(useHdr); super(/* useHighPrecisionColorComponents= */ useHdr);
// TODO(b/241241680): Check if HDR <-> HSL works the same or not. // TODO(b/241241680): Check if HDR <-> HSL works the same or not.
checkArgument(!useHdr, "HDR is not yet supported."); checkArgument(!useHdr, "HDR is not yet supported.");

View File

@ -54,7 +54,7 @@ import com.google.common.collect.ImmutableList;
public OverlayShaderProgram( public OverlayShaderProgram(
Context context, boolean useHdr, ImmutableList<TextureOverlay> overlays) Context context, boolean useHdr, ImmutableList<TextureOverlay> overlays)
throws VideoFrameProcessingException { throws VideoFrameProcessingException {
super(useHdr); super(/* useHighPrecisionColorComponents= */ useHdr);
checkArgument(!useHdr, "OverlayShaderProgram does not support HDR colors yet."); checkArgument(!useHdr, "OverlayShaderProgram does not support HDR colors yet.");
// The maximum number of samplers allowed in a single GL program is 16. // The maximum number of samplers allowed in a single GL program is 16.
// We use one for every overlay and one for the video. // We use one for every overlay and one for the video.

View File

@ -35,10 +35,10 @@ public abstract class SingleFrameGlShaderProgram extends BaseGlShaderProgram {
/** /**
* Creates a {@code SingleFrameGlShaderProgram} instance. * Creates a {@code SingleFrameGlShaderProgram} instance.
* *
* @param useHdr Whether input textures come from an HDR source. If {@code true}, colors will be * @param useHighPrecisionColorComponents If {@code false}, uses colors with 8-bit unsigned bytes.
* in linear RGB BT.2020. If {@code false}, colors will be in linear RGB BT.709. * If {@code true}, use 16-bit (half-precision) floating-point.
*/ */
public SingleFrameGlShaderProgram(boolean useHdr) { public SingleFrameGlShaderProgram(boolean useHighPrecisionColorComponents) {
super(useHdr, /* texturePoolCapacity= */ 1); super(useHighPrecisionColorComponents, /* texturePoolCapacity= */ 1);
} }
} }