Commit fd9beb68 by huangdarwin Committed by Rohit Singh

HDR: Add HDR pixel tests.

Implement HDR input support for texture output, and add HDR pixel tests.

PiperOrigin-RevId: 523417701
parent b743ad9f
......@@ -97,7 +97,8 @@ public final class DefaultVideoFrameProcessor implements VideoFrameProcessor {
/**
* Sets the {@link TextureOutputListener}.
*
* <p>If set, the {@link VideoFrameProcessor} will output to an OpenGL texture.
* <p>If set, the {@link VideoFrameProcessor} will output to an OpenGL texture, accessible via
* {@link TextureOutputListener#onTextureRendered}. Otherwise, no texture will be rendered to.
*/
@VisibleForTesting
@CanIgnoreReturnValue
......
......@@ -458,7 +458,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
}
int outputTexId =
GlUtil.createTexture(
outputWidth, outputHeight, /* useHighPrecisionColorComponents= */ false);
outputWidth,
outputHeight,
/* useHighPrecisionColorComponents= */ ColorInfo.isTransferHdr(outputColorInfo));
outputTexture =
glObjectsProvider.createBuffersForTexture(outputTexId, outputWidth, outputHeight);
}
......
......@@ -278,7 +278,12 @@ public final class VideoFrameProcessorTestRunner {
new VideoFrameProcessor.Listener() {
@Override
public void onOutputSizeChanged(int width, int height) {
Surface outputSurface = bitmapReader.getSurface(width, height);
Surface outputSurface =
bitmapReader.getSurface(
width,
height,
/* useHighPrecisionColorComponents= */ ColorInfo.isTransferHdr(
outputColorInfo));
checkNotNull(videoFrameProcessor)
.setOutputSurfaceInfo(new SurfaceInfo(outputSurface, width, height));
}
......@@ -359,7 +364,7 @@ public final class VideoFrameProcessorTestRunner {
public interface BitmapReader {
/** Returns the {@link VideoFrameProcessor} output {@link Surface}. */
Surface getSurface(int width, int height);
Surface getSurface(int width, int height, boolean useHighPrecisionColorComponents);
/** Returns the output {@link Bitmap}. */
Bitmap getBitmap();
......@@ -378,7 +383,7 @@ public final class VideoFrameProcessorTestRunner {
@Override
@SuppressLint("WrongConstant")
public Surface getSurface(int width, int height) {
public Surface getSurface(int width, int height, boolean useHighPrecisionColorComponents) {
imageReader =
ImageReader.newInstance(width, height, PixelFormat.RGBA_8888, /* maxImages= */ 1);
return imageReader.getSurface();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment