diff --git a/google3/third_party/java_src/android_libs/media/libraries/effect/src/main/java/androidx/media3/effect/FinalMatrixTransformationProcessorWrapper.java b/google3/third_party/java_src/android_libs/media/libraries/effect/src/main/java/androidx/media3/effect/FinalMatrixTransformationProcessorWrapper.java index 7800e645fc3..555fa16cbf5 100644 --- a/google3/third_party/java_src/android_libs/media/libraries/effect/src/main/java/androidx/media3/effect/FinalMatrixTransformationProcessorWrapper.java +++ b/google3/third_party/java_src/android_libs/media/libraries/effect/src/main/java/androidx/media3/effect/FinalMatrixTransformationProcessorWrapper.java @@ -218,7 +218,7 @@ private synchronized boolean ensureConfigured(int inputWidth, int inputHeight) SurfaceInfo outputSurfaceInfo = this.outputSurfaceInfo; @Nullable EGLSurface outputEglSurface = this.outputEglSurface; if (outputEglSurface == null) { - boolean colorInfoIsHdr = ColorInfo.isHdr(colorInfo); + boolean colorInfoIsHdr = ColorInfo.isTransferHdr(colorInfo); if (colorInfoIsHdr) { outputEglSurface = GlUtil.getEglSurfaceRgba1010102(eglDisplay, outputSurfaceInfo.surface); } else { diff --git a/google3/third_party/java_src/android_libs/media/libraries/effect/src/main/java/androidx/media3/effect/GlEffectsFrameProcessor.java b/google3/third_party/java_src/android_libs/media/libraries/effect/src/main/java/androidx/media3/effect/GlEffectsFrameProcessor.java index 47fcaee91d8..c1b81e91fcc 100644 --- a/google3/third_party/java_src/android_libs/media/libraries/effect/src/main/java/androidx/media3/effect/GlEffectsFrameProcessor.java +++ b/google3/third_party/java_src/android_libs/media/libraries/effect/src/main/java/androidx/media3/effect/GlEffectsFrameProcessor.java @@ -117,7 +117,7 @@ private static GlEffectsFrameProcessor createOpenGlObjectsAndFrameProcessor( // TODO(b/237674316): Delay initialization of things requiring the colorInfo, to // configure based on the color info from the decoder output media format instead. - boolean useHdr = ColorInfo.isHdr(colorInfo); + boolean useHdr = ColorInfo.isTransferHdr(colorInfo); EGLDisplay eglDisplay = GlUtil.createEglDisplay(); EGLContext eglContext = useHdr @@ -195,7 +195,7 @@ private static ImmutableList getGlTextureProcessorsForGlEffe sampleFromExternalTexture = false; } textureProcessorListBuilder.add( - glEffect.toGlTextureProcessor(context, ColorInfo.isHdr(colorInfo))); + glEffect.toGlTextureProcessor(context, ColorInfo.isTransferHdr(colorInfo))); } textureProcessorListBuilder.add( new FinalMatrixTransformationProcessorWrapper( diff --git a/google3/third_party/java_src/android_libs/media/libraries/effect/src/main/java/androidx/media3/effect/MatrixTransformationProcessor.java b/google3/third_party/java_src/android_libs/media/libraries/effect/src/main/java/androidx/media3/effect/MatrixTransformationProcessor.java index 86542efb770..daadb222318 100644 --- a/google3/third_party/java_src/android_libs/media/libraries/effect/src/main/java/androidx/media3/effect/MatrixTransformationProcessor.java +++ b/google3/third_party/java_src/android_libs/media/libraries/effect/src/main/java/androidx/media3/effect/MatrixTransformationProcessor.java @@ -158,12 +158,12 @@ public MatrixTransformationProcessor( * the external texture. * @param opticalColorInfo The optical {@link ColorInfo}, only used to transform between color * spaces and transfers, when {@code inputOpticalColorsFromExternalTexture} or {@code - * outputOpticalColors} are {@code true}. If it {@link ColorInfo#isHdr(ColorInfo)}, + * outputOpticalColors} are {@code true}. If it {@link ColorInfo#isTransferHdr(ColorInfo)}, * intermediate {@link GlTextureProcessor} colors will be in linear RGB BT.2020. Otherwise, * these colors will be in gamma RGB BT.709. * @param outputOpticalColors If {@code true}, outputs {@code opticalColorInfo}. If {@code false}, * outputs intermediate colors of linear RGB BT.2020 if {@code opticalColorInfo} {@link - * ColorInfo#isHdr(ColorInfo)}, and gamma RGB BT.709 otherwise. + * ColorInfo#isTransferHdr(ColorInfo)}, and gamma RGB BT.709 otherwise. * @throws FrameProcessingException If a problem occurs while reading shader files or an OpenGL * operation fails or is unsupported. */ @@ -178,11 +178,11 @@ public MatrixTransformationProcessor( createGlProgram( context, inputOpticalColorsFromExternalTexture, - ColorInfo.isHdr(opticalColorInfo), + ColorInfo.isTransferHdr(opticalColorInfo), outputOpticalColors), matrixTransformations, - ColorInfo.isHdr(opticalColorInfo)); - if (!ColorInfo.isHdr(opticalColorInfo) || !inputOpticalColorsFromExternalTexture) { + ColorInfo.isTransferHdr(opticalColorInfo)); + if (!ColorInfo.isTransferHdr(opticalColorInfo) || !inputOpticalColorsFromExternalTexture) { return; } // TODO(b/227624622): Implement YUV to RGB conversions in COLOR_RANGE_LIMITED as well, using diff --git a/library/common/src/main/java/com/google/android/exoplayer2/video/ColorInfo.java b/library/common/src/main/java/com/google/android/exoplayer2/video/ColorInfo.java index b59b05b95c9..9215907a39b 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/video/ColorInfo.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/video/ColorInfo.java @@ -91,7 +91,7 @@ public final class ColorInfo implements Bundleable { } /** Returns whether the {@code ColorInfo} uses an HDR {@link C.ColorTransfer}. */ - public static boolean isHdr(@Nullable ColorInfo colorInfo) { + public static boolean isTransferHdr(@Nullable ColorInfo colorInfo) { return colorInfo != null && colorInfo.colorTransfer != Format.NO_VALUE && colorInfo.colorTransfer != C.COLOR_TRANSFER_SDR; diff --git a/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/DefaultEncoderFactory.java b/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/DefaultEncoderFactory.java index d86c9ac1cdf..2a986838297 100644 --- a/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/DefaultEncoderFactory.java +++ b/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/DefaultEncoderFactory.java @@ -281,7 +281,7 @@ public Codec createForVideoEncoding(Format format, List allowedMimeTypes } MediaFormatUtil.maybeSetColorInfo(mediaFormat, encoderSupportedFormat.colorInfo); - if (Util.SDK_INT >= 31 && ColorInfo.isHdr(format.colorInfo)) { + if (Util.SDK_INT >= 31 && ColorInfo.isTransferHdr(format.colorInfo)) { if (EncoderUtil.getSupportedColorFormats(encoderInfo, mimeType) .contains(MediaCodecInfo.CodecCapabilities.COLOR_Format32bitABGR2101010)) { mediaFormat.setInteger( diff --git a/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/TransformerVideoRenderer.java b/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/TransformerVideoRenderer.java index 82e6a60486e..1831cf84d4d 100644 --- a/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/TransformerVideoRenderer.java +++ b/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/TransformerVideoRenderer.java @@ -99,7 +99,7 @@ protected boolean ensureConfigured() throws TransformationException { return false; } Format inputFormat = checkNotNull(formatHolder.format); - if (SDK_INT < 31 && ColorInfo.isHdr(inputFormat.colorInfo)) { + if (SDK_INT < 31 && ColorInfo.isTransferHdr(inputFormat.colorInfo)) { throw TransformationException.createForCodec( new IllegalArgumentException("HDR editing not supported under API 31."), /* isVideo= */ true, diff --git a/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/VideoTranscodingSamplePipeline.java b/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/VideoTranscodingSamplePipeline.java index 236d2900a76..aca208750ee 100644 --- a/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/VideoTranscodingSamplePipeline.java +++ b/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/VideoTranscodingSamplePipeline.java @@ -156,8 +156,8 @@ public void onFrameProcessingEnded() { decodedWidth, decodedHeight, inputFormat.pixelWidthHeightRatio, streamOffsetUs)); boolean isToneMappingRequired = - ColorInfo.isHdr(inputFormat.colorInfo) - && !ColorInfo.isHdr(encoderWrapper.getSupportedInputColor()); + ColorInfo.isTransferHdr(inputFormat.colorInfo) + && !ColorInfo.isTransferHdr(encoderWrapper.getSupportedInputColor()); decoder = decoderFactory.createForVideoDecoding( inputFormat, frameProcessor.getInputSurface(), isToneMappingRequired); @@ -363,7 +363,8 @@ public ColorInfo getSupportedInputColor() { transformationRequest.enableHdrEditing && !transformationRequest.enableRequestSdrToneMapping && !supportedEncoderNamesForHdrEditing.isEmpty(); - boolean isInputToneMapped = !isHdrEditingEnabled && ColorInfo.isHdr(inputFormat.colorInfo); + boolean isInputToneMapped = + !isHdrEditingEnabled && ColorInfo.isTransferHdr(inputFormat.colorInfo); if (isInputToneMapped) { // When tone-mapping HDR to SDR is enabled, assume we get BT.709 to avoid having the encoder // populate default color info, which depends on the resolution. @@ -413,7 +414,7 @@ public SurfaceInfo getSurfaceInfo(int requestedWidth, int requestedHeight) encoderFactory.createForVideoEncoding(requestedEncoderFormat, allowedOutputMimeTypes); Format encoderSupportedFormat = encoder.getConfigurationFormat(); - if (ColorInfo.isHdr(requestedEncoderFormat.colorInfo)) { + if (ColorInfo.isTransferHdr(requestedEncoderFormat.colorInfo)) { if (!requestedOutputMimeType.equals(encoderSupportedFormat.sampleMimeType)) { throw createEncodingException( new IllegalStateException("MIME type fallback unsupported with HDR editing"), @@ -425,8 +426,8 @@ public SurfaceInfo getSurfaceInfo(int requestedWidth, int requestedHeight) } } boolean isInputToneMapped = - ColorInfo.isHdr(inputFormat.colorInfo) - && !ColorInfo.isHdr(requestedEncoderFormat.colorInfo); + ColorInfo.isTransferHdr(inputFormat.colorInfo) + && !ColorInfo.isTransferHdr(requestedEncoderFormat.colorInfo); fallbackListener.onTransformationRequestFinalized( createFallbackTransformationRequest( transformationRequest,