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 { ...@@ -97,7 +97,8 @@ public final class DefaultVideoFrameProcessor implements VideoFrameProcessor {
/** /**
* Sets the {@link TextureOutputListener}. * 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 @VisibleForTesting
@CanIgnoreReturnValue @CanIgnoreReturnValue
......
...@@ -458,7 +458,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; ...@@ -458,7 +458,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
} }
int outputTexId = int outputTexId =
GlUtil.createTexture( GlUtil.createTexture(
outputWidth, outputHeight, /* useHighPrecisionColorComponents= */ false); outputWidth,
outputHeight,
/* useHighPrecisionColorComponents= */ ColorInfo.isTransferHdr(outputColorInfo));
outputTexture = outputTexture =
glObjectsProvider.createBuffersForTexture(outputTexId, outputWidth, outputHeight); glObjectsProvider.createBuffersForTexture(outputTexId, outputWidth, outputHeight);
} }
......
...@@ -278,7 +278,12 @@ public final class VideoFrameProcessorTestRunner { ...@@ -278,7 +278,12 @@ public final class VideoFrameProcessorTestRunner {
new VideoFrameProcessor.Listener() { new VideoFrameProcessor.Listener() {
@Override @Override
public void onOutputSizeChanged(int width, int height) { 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) checkNotNull(videoFrameProcessor)
.setOutputSurfaceInfo(new SurfaceInfo(outputSurface, width, height)); .setOutputSurfaceInfo(new SurfaceInfo(outputSurface, width, height));
} }
...@@ -359,7 +364,7 @@ public final class VideoFrameProcessorTestRunner { ...@@ -359,7 +364,7 @@ public final class VideoFrameProcessorTestRunner {
public interface BitmapReader { public interface BitmapReader {
/** Returns the {@link VideoFrameProcessor} output {@link Surface}. */ /** 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}. */ /** Returns the output {@link Bitmap}. */
Bitmap getBitmap(); Bitmap getBitmap();
...@@ -378,7 +383,7 @@ public final class VideoFrameProcessorTestRunner { ...@@ -378,7 +383,7 @@ public final class VideoFrameProcessorTestRunner {
@Override @Override
@SuppressLint("WrongConstant") @SuppressLint("WrongConstant")
public Surface getSurface(int width, int height) { public Surface getSurface(int width, int height, boolean useHighPrecisionColorComponents) {
imageReader = imageReader =
ImageReader.newInstance(width, height, PixelFormat.RGBA_8888, /* maxImages= */ 1); ImageReader.newInstance(width, height, PixelFormat.RGBA_8888, /* maxImages= */ 1);
return imageReader.getSurface(); 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