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:
parent
2b8c01de47
commit
5050171ff6
@ -70,7 +70,7 @@ import java.io.IOException;
|
||||
float maxInnerRadius,
|
||||
float outerRadius)
|
||||
throws VideoFrameProcessingException {
|
||||
super(useHdr);
|
||||
super(/* useHighPrecisionColorComponents= */ useHdr);
|
||||
checkArgument(minInnerRadius <= maxInnerRadius);
|
||||
checkArgument(maxInnerRadius <= outerRadius);
|
||||
this.minInnerRadius = minInnerRadius;
|
||||
|
@ -51,14 +51,13 @@ public abstract class BaseGlShaderProgram implements GlShaderProgram {
|
||||
/**
|
||||
* Creates a {@code BaseGlShaderProgram} instance.
|
||||
*
|
||||
* @param useHdr Whether input textures come from an HDR source. If {@code true}, colors will be
|
||||
* in linear RGB BT.2020. If {@code false}, colors will be in linear RGB BT.709.
|
||||
* @param useHighPrecisionColorComponents If {@code false}, uses colors with 8-bit unsigned bytes.
|
||||
* If {@code true}, use 16-bit (half-precision) floating-point.
|
||||
* @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.
|
||||
*/
|
||||
public BaseGlShaderProgram(boolean useHdr, int texturePoolCapacity) {
|
||||
outputTexturePool =
|
||||
new TexturePool(/* useHighPrecisionColorComponents= */ useHdr, texturePoolCapacity);
|
||||
public BaseGlShaderProgram(boolean useHighPrecisionColorComponents, int texturePoolCapacity) {
|
||||
outputTexturePool = new TexturePool(useHighPrecisionColorComponents, texturePoolCapacity);
|
||||
inputListener = new InputListener() {};
|
||||
outputListener = new OutputListener() {};
|
||||
errorListener = (frameProcessingException) -> {};
|
||||
|
@ -45,7 +45,7 @@ import java.io.IOException;
|
||||
*/
|
||||
public ColorLutShaderProgram(Context context, ColorLut colorLut, boolean useHdr)
|
||||
throws VideoFrameProcessingException {
|
||||
super(useHdr);
|
||||
super(/* useHighPrecisionColorComponents= */ useHdr);
|
||||
// TODO(b/246315245): Add HDR support.
|
||||
checkArgument(!useHdr, "ColorLutShaderProgram does not support HDR colors.");
|
||||
this.colorLut = colorLut;
|
||||
|
@ -417,7 +417,7 @@ import java.util.List;
|
||||
ImmutableList<RgbMatrix> rgbMatrices,
|
||||
int outputColorTransfer,
|
||||
boolean useHdr) {
|
||||
super(useHdr);
|
||||
super(/* useHighPrecisionColorComponents= */ useHdr);
|
||||
this.glProgram = glProgram;
|
||||
this.outputColorTransfer = outputColorTransfer;
|
||||
this.matrixTransformations = matrixTransformations;
|
||||
|
@ -40,7 +40,7 @@ import java.io.IOException;
|
||||
/** Creates a new instance. */
|
||||
public FrameCacheGlShaderProgram(Context context, int capacity, boolean useHdr)
|
||||
throws VideoFrameProcessingException {
|
||||
super(useHdr, capacity);
|
||||
super(/* useHighPrecisionColorComponents= */ useHdr, capacity);
|
||||
|
||||
try {
|
||||
this.copyProgram =
|
||||
|
@ -44,7 +44,7 @@ import java.io.IOException;
|
||||
*/
|
||||
public HslShaderProgram(Context context, HslAdjustment hslAdjustment, boolean useHdr)
|
||||
throws VideoFrameProcessingException {
|
||||
super(useHdr);
|
||||
super(/* useHighPrecisionColorComponents= */ useHdr);
|
||||
// TODO(b/241241680): Check if HDR <-> HSL works the same or not.
|
||||
checkArgument(!useHdr, "HDR is not yet supported.");
|
||||
|
||||
|
@ -54,7 +54,7 @@ import com.google.common.collect.ImmutableList;
|
||||
public OverlayShaderProgram(
|
||||
Context context, boolean useHdr, ImmutableList<TextureOverlay> overlays)
|
||||
throws VideoFrameProcessingException {
|
||||
super(useHdr);
|
||||
super(/* useHighPrecisionColorComponents= */ useHdr);
|
||||
checkArgument(!useHdr, "OverlayShaderProgram does not support HDR colors yet.");
|
||||
// The maximum number of samplers allowed in a single GL program is 16.
|
||||
// We use one for every overlay and one for the video.
|
||||
|
@ -35,10 +35,10 @@ public abstract class SingleFrameGlShaderProgram extends BaseGlShaderProgram {
|
||||
/**
|
||||
* Creates a {@code SingleFrameGlShaderProgram} instance.
|
||||
*
|
||||
* @param useHdr Whether input textures come from an HDR source. If {@code true}, colors will be
|
||||
* in linear RGB BT.2020. If {@code false}, colors will be in linear RGB BT.709.
|
||||
* @param useHighPrecisionColorComponents If {@code false}, uses colors with 8-bit unsigned bytes.
|
||||
* If {@code true}, use 16-bit (half-precision) floating-point.
|
||||
*/
|
||||
public SingleFrameGlShaderProgram(boolean useHdr) {
|
||||
super(useHdr, /* texturePoolCapacity= */ 1);
|
||||
public SingleFrameGlShaderProgram(boolean useHighPrecisionColorComponents) {
|
||||
super(useHighPrecisionColorComponents, /* texturePoolCapacity= */ 1);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user