diff --git a/libraries/effect/src/androidTest/java/androidx/media3/effect/MatrixTransformationProcessorPixelTest.java b/libraries/effect/src/androidTest/java/androidx/media3/effect/MatrixTextureProcessorPixelTest.java
similarity index 88%
rename from libraries/effect/src/androidTest/java/androidx/media3/effect/MatrixTransformationProcessorPixelTest.java
rename to libraries/effect/src/androidTest/java/androidx/media3/effect/MatrixTextureProcessorPixelTest.java
index 702390ac83..8fbab1d6d3 100644
--- a/libraries/effect/src/androidTest/java/androidx/media3/effect/MatrixTransformationProcessorPixelTest.java
+++ b/libraries/effect/src/androidTest/java/androidx/media3/effect/MatrixTextureProcessorPixelTest.java
@@ -36,7 +36,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
/**
- * Pixel test for texture processing via {@link MatrixTransformationProcessor}.
+ * Pixel test for texture processing via {@link MatrixTextureProcessor}.
*
*
Expected images are taken from an emulator, so tests on different emulators or physical
* devices may fail. To test on other devices, please increase the {@link
@@ -44,7 +44,7 @@ import org.junit.runner.RunWith;
* as recommended in {@link GlEffectsFrameProcessorPixelTest}.
*/
@RunWith(AndroidJUnit4.class)
-public final class MatrixTransformationProcessorPixelTest {
+public final class MatrixTextureProcessorPixelTest {
public static final String ORIGINAL_PNG_ASSET_PATH =
"media/bitmap/sample_mp4_first_frame/original.png";
public static final String TRANSLATE_RIGHT_PNG_ASSET_PATH =
@@ -58,7 +58,7 @@ public final class MatrixTransformationProcessorPixelTest {
private @MonotonicNonNull EGLDisplay eglDisplay;
private @MonotonicNonNull EGLContext eglContext;
- private @MonotonicNonNull SingleFrameGlTextureProcessor matrixTransformationFrameProcessor;
+ private @MonotonicNonNull SingleFrameGlTextureProcessor matrixTextureProcessor;
private int inputTexId;
private int outputTexId;
private int width;
@@ -82,8 +82,8 @@ public final class MatrixTransformationProcessorPixelTest {
@After
public void release() throws GlUtil.GlException, FrameProcessingException {
- if (matrixTransformationFrameProcessor != null) {
- matrixTransformationFrameProcessor.release();
+ if (matrixTextureProcessor != null) {
+ matrixTextureProcessor.release();
}
if (eglContext != null && eglDisplay != null) {
GlUtil.destroyEglContext(eglDisplay, eglContext);
@@ -95,12 +95,12 @@ public final class MatrixTransformationProcessorPixelTest {
String testId = "drawFrame_noEdits";
Matrix identityMatrix = new Matrix();
MatrixTransformation noEditsTransformation = (long presentationTimeUs) -> identityMatrix;
- matrixTransformationFrameProcessor =
+ matrixTextureProcessor =
noEditsTransformation.toGlTextureProcessor(context, /* useHdr= */ false);
- matrixTransformationFrameProcessor.configure(width, height);
+ matrixTextureProcessor.configure(width, height);
Bitmap expectedBitmap = BitmapTestUtil.readBitmap(ORIGINAL_PNG_ASSET_PATH);
- matrixTransformationFrameProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
+ matrixTextureProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
Bitmap actualBitmap =
BitmapTestUtil.createArgb8888BitmapFromCurrentGlFramebuffer(width, height);
@@ -120,12 +120,12 @@ public final class MatrixTransformationProcessorPixelTest {
translateRightMatrix.postTranslate(/* dx= */ 1, /* dy= */ 0);
MatrixTransformation translateRightTransformation =
(long presentationTimeUs) -> translateRightMatrix;
- matrixTransformationFrameProcessor =
+ matrixTextureProcessor =
translateRightTransformation.toGlTextureProcessor(context, /* useHdr= */ false);
- matrixTransformationFrameProcessor.configure(width, height);
+ matrixTextureProcessor.configure(width, height);
Bitmap expectedBitmap = BitmapTestUtil.readBitmap(TRANSLATE_RIGHT_PNG_ASSET_PATH);
- matrixTransformationFrameProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
+ matrixTextureProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
Bitmap actualBitmap =
BitmapTestUtil.createArgb8888BitmapFromCurrentGlFramebuffer(width, height);
@@ -144,12 +144,12 @@ public final class MatrixTransformationProcessorPixelTest {
Matrix scaleNarrowMatrix = new Matrix();
scaleNarrowMatrix.postScale(.5f, 1.2f);
MatrixTransformation scaleNarrowTransformation = (long presentationTimeUs) -> scaleNarrowMatrix;
- matrixTransformationFrameProcessor =
+ matrixTextureProcessor =
scaleNarrowTransformation.toGlTextureProcessor(context, /* useHdr= */ false);
- matrixTransformationFrameProcessor.configure(width, height);
+ matrixTextureProcessor.configure(width, height);
Bitmap expectedBitmap = BitmapTestUtil.readBitmap(SCALE_NARROW_PNG_ASSET_PATH);
- matrixTransformationFrameProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
+ matrixTextureProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
Bitmap actualBitmap =
BitmapTestUtil.createArgb8888BitmapFromCurrentGlFramebuffer(width, height);
@@ -168,12 +168,12 @@ public final class MatrixTransformationProcessorPixelTest {
Matrix rotate90Matrix = new Matrix();
rotate90Matrix.postRotate(/* degrees= */ 90);
MatrixTransformation rotate90Transformation = (long presentationTimeUs) -> rotate90Matrix;
- matrixTransformationFrameProcessor =
+ matrixTextureProcessor =
rotate90Transformation.toGlTextureProcessor(context, /* useHdr= */ false);
- matrixTransformationFrameProcessor.configure(width, height);
+ matrixTextureProcessor.configure(width, height);
Bitmap expectedBitmap = BitmapTestUtil.readBitmap(ROTATE_90_PNG_ASSET_PATH);
- matrixTransformationFrameProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
+ matrixTextureProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
Bitmap actualBitmap =
BitmapTestUtil.createArgb8888BitmapFromCurrentGlFramebuffer(width, height);
diff --git a/libraries/effect/src/androidTest/java/androidx/media3/effect/RgbAdjustmentPixelTest.java b/libraries/effect/src/androidTest/java/androidx/media3/effect/RgbAdjustmentPixelTest.java
index 3f11589190..4acd53a3d9 100644
--- a/libraries/effect/src/androidTest/java/androidx/media3/effect/RgbAdjustmentPixelTest.java
+++ b/libraries/effect/src/androidTest/java/androidx/media3/effect/RgbAdjustmentPixelTest.java
@@ -62,7 +62,7 @@ public final class RgbAdjustmentPixelTest {
private @MonotonicNonNull EGLDisplay eglDisplay;
private @MonotonicNonNull EGLContext eglContext;
- private @MonotonicNonNull SingleFrameGlTextureProcessor matrixTransformationProcessor;
+ private @MonotonicNonNull SingleFrameGlTextureProcessor matrixTextureProcessor;
private @MonotonicNonNull EGLSurface placeholderEglSurface;
private int inputTexId;
private int outputTexId;
@@ -94,8 +94,8 @@ public final class RgbAdjustmentPixelTest {
@After
public void release() throws GlUtil.GlException, FrameProcessingException {
- if (matrixTransformationProcessor != null) {
- matrixTransformationProcessor.release();
+ if (matrixTextureProcessor != null) {
+ matrixTextureProcessor.release();
}
GlUtil.destroyEglContext(eglDisplay, eglContext);
}
@@ -104,13 +104,11 @@ public final class RgbAdjustmentPixelTest {
public void drawFrame_identityMatrix_leavesFrameUnchanged() throws Exception {
String testId = "drawFrame_identityMatrix";
RgbMatrix identityMatrix = new RgbAdjustment.Builder().build();
- matrixTransformationProcessor =
- identityMatrix.toGlTextureProcessor(context, /* useHdr= */ false);
- Pair outputSize =
- matrixTransformationProcessor.configure(inputWidth, inputHeight);
+ matrixTextureProcessor = identityMatrix.toGlTextureProcessor(context, /* useHdr= */ false);
+ Pair outputSize = matrixTextureProcessor.configure(inputWidth, inputHeight);
Bitmap expectedBitmap = BitmapTestUtil.readBitmap(ORIGINAL_PNG_ASSET_PATH);
- matrixTransformationProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
+ matrixTextureProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
Bitmap actualBitmap =
BitmapTestUtil.createArgb8888BitmapFromCurrentGlFramebuffer(
outputSize.first, outputSize.second);
@@ -128,15 +126,13 @@ public final class RgbAdjustmentPixelTest {
String testId = "drawFrame_removeColors";
RgbMatrix removeColorMatrix =
new RgbAdjustment.Builder().setRedScale(0).setGreenScale(0).setBlueScale(0).build();
- matrixTransformationProcessor =
- removeColorMatrix.toGlTextureProcessor(context, /* useHdr= */ false);
- Pair outputSize =
- matrixTransformationProcessor.configure(inputWidth, inputHeight);
+ matrixTextureProcessor = removeColorMatrix.toGlTextureProcessor(context, /* useHdr= */ false);
+ Pair outputSize = matrixTextureProcessor.configure(inputWidth, inputHeight);
Bitmap expectedBitmap =
BitmapTestUtil.createArgb8888BitmapWithSolidColor(
outputSize.first, outputSize.second, Color.BLACK);
- matrixTransformationProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
+ matrixTextureProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
Bitmap actualBitmap =
BitmapTestUtil.createArgb8888BitmapFromCurrentGlFramebuffer(
outputSize.first, outputSize.second);
@@ -153,13 +149,11 @@ public final class RgbAdjustmentPixelTest {
public void drawFrame_redOnlyFilter_removeBlueAndGreenValues() throws Exception {
String testId = "drawFrame_redOnlyFilter";
RgbMatrix redOnlyMatrix = new RgbAdjustment.Builder().setBlueScale(0).setGreenScale(0).build();
- matrixTransformationProcessor =
- redOnlyMatrix.toGlTextureProcessor(context, /* useHdr= */ false);
- Pair outputSize =
- matrixTransformationProcessor.configure(inputWidth, inputHeight);
+ matrixTextureProcessor = redOnlyMatrix.toGlTextureProcessor(context, /* useHdr= */ false);
+ Pair outputSize = matrixTextureProcessor.configure(inputWidth, inputHeight);
Bitmap expectedBitmap = BitmapTestUtil.readBitmap(ONLY_RED_CHANNEL_PNG_ASSET_PATH);
- matrixTransformationProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
+ matrixTextureProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
Bitmap actualBitmap =
BitmapTestUtil.createArgb8888BitmapFromCurrentGlFramebuffer(
outputSize.first, outputSize.second);
@@ -176,13 +170,11 @@ public final class RgbAdjustmentPixelTest {
public void drawFrame_increaseRedChannel_producesBrighterAndRedderFrame() throws Exception {
String testId = "drawFrame_increaseRedChannel";
RgbMatrix increaseRedMatrix = new RgbAdjustment.Builder().setRedScale(5).build();
- matrixTransformationProcessor =
- increaseRedMatrix.toGlTextureProcessor(context, /* useHdr= */ false);
- Pair outputSize =
- matrixTransformationProcessor.configure(inputWidth, inputHeight);
+ matrixTextureProcessor = increaseRedMatrix.toGlTextureProcessor(context, /* useHdr= */ false);
+ Pair outputSize = matrixTextureProcessor.configure(inputWidth, inputHeight);
Bitmap expectedBitmap = BitmapTestUtil.readBitmap(INCREASE_RED_CHANNEL_PNG_ASSET_PATH);
- matrixTransformationProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
+ matrixTextureProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
Bitmap actualBitmap =
BitmapTestUtil.createArgb8888BitmapFromCurrentGlFramebuffer(
outputSize.first, outputSize.second);
@@ -200,13 +192,12 @@ public final class RgbAdjustmentPixelTest {
String testId = "drawFrame_increaseBrightness";
RgbMatrix increaseBrightnessMatrix =
new RgbAdjustment.Builder().setRedScale(5).setGreenScale(5).setBlueScale(5).build();
- matrixTransformationProcessor =
+ matrixTextureProcessor =
increaseBrightnessMatrix.toGlTextureProcessor(context, /* useHdr= */ false);
- Pair outputSize =
- matrixTransformationProcessor.configure(inputWidth, inputHeight);
+ Pair outputSize = matrixTextureProcessor.configure(inputWidth, inputHeight);
Bitmap expectedBitmap = BitmapTestUtil.readBitmap(INCREASE_BRIGHTNESS_PNG_ASSET_PATH);
- matrixTransformationProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
+ matrixTextureProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
Bitmap actualBitmap =
BitmapTestUtil.createArgb8888BitmapFromCurrentGlFramebuffer(
outputSize.first, outputSize.second);
@@ -225,19 +216,18 @@ public final class RgbAdjustmentPixelTest {
RgbMatrix noRed = new RgbAdjustment.Builder().setRedScale(0).build();
RgbMatrix noGreen = new RgbAdjustment.Builder().setGreenScale(0).build();
RgbMatrix noBlue = new RgbAdjustment.Builder().setBlueScale(0).build();
- matrixTransformationProcessor =
- MatrixTransformationProcessor.create(
+ matrixTextureProcessor =
+ MatrixTextureProcessor.create(
context,
/* matrixTransformations= */ ImmutableList.of(),
/* rgbMatrices= */ ImmutableList.of(noRed, noGreen, noBlue),
/* useHdr= */ false);
- Pair outputSize =
- matrixTransformationProcessor.configure(inputWidth, inputHeight);
+ Pair outputSize = matrixTextureProcessor.configure(inputWidth, inputHeight);
Bitmap expectedBitmap =
BitmapTestUtil.createArgb8888BitmapWithSolidColor(
outputSize.first, outputSize.second, Color.BLACK);
- matrixTransformationProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
+ matrixTextureProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
Bitmap actualBitmap =
BitmapTestUtil.createArgb8888BitmapFromCurrentGlFramebuffer(
outputSize.first, outputSize.second);
@@ -255,17 +245,16 @@ public final class RgbAdjustmentPixelTest {
String testId = "drawFrame_removeBlueAndGreenValuesInAChain";
RgbMatrix noGreen = new RgbAdjustment.Builder().setGreenScale(0).build();
RgbMatrix noBlue = new RgbAdjustment.Builder().setBlueScale(0).build();
- matrixTransformationProcessor =
- MatrixTransformationProcessor.create(
+ matrixTextureProcessor =
+ MatrixTextureProcessor.create(
context,
/* matrixTransformations= */ ImmutableList.of(),
/* rgbMatrices= */ ImmutableList.of(noGreen, noBlue),
/* useHdr= */ false);
- Pair outputSize =
- matrixTransformationProcessor.configure(inputWidth, inputHeight);
+ Pair outputSize = matrixTextureProcessor.configure(inputWidth, inputHeight);
Bitmap expectedBitmap = BitmapTestUtil.readBitmap(ONLY_RED_CHANNEL_PNG_ASSET_PATH);
- matrixTransformationProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
+ matrixTextureProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
Bitmap actualBitmap =
BitmapTestUtil.createArgb8888BitmapFromCurrentGlFramebuffer(
outputSize.first, outputSize.second);
@@ -285,17 +274,16 @@ public final class RgbAdjustmentPixelTest {
RgbMatrix scaleRedMatrix = new RgbAdjustment.Builder().setRedScale(redScale).build();
RgbMatrix scaleRedByInverseMatrix =
new RgbAdjustment.Builder().setRedScale(1 / redScale).build();
- matrixTransformationProcessor =
- MatrixTransformationProcessor.create(
+ matrixTextureProcessor =
+ MatrixTextureProcessor.create(
context,
/* matrixTransformations= */ ImmutableList.of(),
/* rgbMatrices= */ ImmutableList.of(scaleRedMatrix, scaleRedByInverseMatrix),
/* useHdr= */ false);
- Pair outputSize =
- matrixTransformationProcessor.configure(inputWidth, inputHeight);
+ Pair outputSize = matrixTextureProcessor.configure(inputWidth, inputHeight);
Bitmap expectedBitmap = BitmapTestUtil.readBitmap(ORIGINAL_PNG_ASSET_PATH);
- matrixTransformationProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
+ matrixTextureProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
Bitmap actualBitmap =
BitmapTestUtil.createArgb8888BitmapFromCurrentGlFramebuffer(
outputSize.first, outputSize.second);
diff --git a/libraries/effect/src/androidTest/java/androidx/media3/effect/RgbFilterPixelTest.java b/libraries/effect/src/androidTest/java/androidx/media3/effect/RgbFilterPixelTest.java
index 7468de9d40..75e453b6df 100644
--- a/libraries/effect/src/androidTest/java/androidx/media3/effect/RgbFilterPixelTest.java
+++ b/libraries/effect/src/androidTest/java/androidx/media3/effect/RgbFilterPixelTest.java
@@ -58,7 +58,7 @@ public final class RgbFilterPixelTest {
private @MonotonicNonNull EGLDisplay eglDisplay;
private @MonotonicNonNull EGLContext eglContext;
- private @MonotonicNonNull SingleFrameGlTextureProcessor matrixTransformationProcessor;
+ private @MonotonicNonNull SingleFrameGlTextureProcessor matrixTextureProcessor;
private @MonotonicNonNull EGLSurface placeholderEglSurface;
private int inputTexId;
private int outputTexId;
@@ -90,8 +90,8 @@ public final class RgbFilterPixelTest {
@After
public void release() throws GlUtil.GlException, FrameProcessingException {
- if (matrixTransformationProcessor != null) {
- matrixTransformationProcessor.release();
+ if (matrixTextureProcessor != null) {
+ matrixTextureProcessor.release();
}
GlUtil.destroyEglContext(eglDisplay, eglContext);
}
@@ -100,13 +100,11 @@ public final class RgbFilterPixelTest {
public void drawFrame_grayscale_producesGrayscaleImage() throws Exception {
String testId = "drawFrame_grayscale";
RgbMatrix grayscaleMatrix = RgbFilter.createGrayscaleFilter();
- matrixTransformationProcessor =
- grayscaleMatrix.toGlTextureProcessor(context, /* useHdr= */ false);
- Pair outputSize =
- matrixTransformationProcessor.configure(inputWidth, inputHeight);
+ matrixTextureProcessor = grayscaleMatrix.toGlTextureProcessor(context, /* useHdr= */ false);
+ Pair outputSize = matrixTextureProcessor.configure(inputWidth, inputHeight);
Bitmap expectedBitmap = BitmapTestUtil.readBitmap(GRAYSCALE_PNG_ASSET_PATH);
- matrixTransformationProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
+ matrixTextureProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
Bitmap actualBitmap =
BitmapTestUtil.createArgb8888BitmapFromCurrentGlFramebuffer(
outputSize.first, outputSize.second);
@@ -123,13 +121,11 @@ public final class RgbFilterPixelTest {
public void drawFrame_inverted_producesInvertedFrame() throws Exception {
String testId = "drawFrame_inverted";
RgbMatrix invertedMatrix = RgbFilter.createInvertedFilter();
- matrixTransformationProcessor =
- invertedMatrix.toGlTextureProcessor(context, /* useHdr= */ false);
- Pair outputSize =
- matrixTransformationProcessor.configure(inputWidth, inputHeight);
+ matrixTextureProcessor = invertedMatrix.toGlTextureProcessor(context, /* useHdr= */ false);
+ Pair outputSize = matrixTextureProcessor.configure(inputWidth, inputHeight);
Bitmap expectedBitmap = BitmapTestUtil.readBitmap(INVERT_PNG_ASSET_PATH);
- matrixTransformationProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
+ matrixTextureProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
Bitmap actualBitmap =
BitmapTestUtil.createArgb8888BitmapFromCurrentGlFramebuffer(
outputSize.first, outputSize.second);
diff --git a/libraries/effect/src/main/java/androidx/media3/effect/FinalMatrixTransformationProcessorWrapper.java b/libraries/effect/src/main/java/androidx/media3/effect/FinalMatrixTextureProcessorWrapper.java
similarity index 87%
rename from libraries/effect/src/main/java/androidx/media3/effect/FinalMatrixTransformationProcessorWrapper.java
rename to libraries/effect/src/main/java/androidx/media3/effect/FinalMatrixTextureProcessorWrapper.java
index e8c590df96..60bdaa7fc8 100644
--- a/libraries/effect/src/main/java/androidx/media3/effect/FinalMatrixTransformationProcessorWrapper.java
+++ b/libraries/effect/src/main/java/androidx/media3/effect/FinalMatrixTextureProcessorWrapper.java
@@ -52,15 +52,14 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
* Wrapper around a {@link GlTextureProcessor} that writes to the provided output surface and
* optional debug surface view.
*
- * The wrapped {@link GlTextureProcessor} applies the {@link GlMatrixTransformation} instances
- * passed to the constructor, followed by any transformations needed to convert the frames to the
- * dimensions specified by the provided {@link SurfaceInfo}.
+ *
The wrapped {@link GlTextureProcessor} applies the {@link GlMatrixTransformation} and {@link
+ * RgbMatrix} instances passed to the constructor, followed by any transformations needed to convert
+ * the frames to the dimensions specified by the provided {@link SurfaceInfo}.
*
*
This wrapper is used for the final {@link GlTextureProcessor} instance in the chain of {@link
* GlTextureProcessor} instances used by {@link FrameProcessor}.
*/
-/* package */ final class FinalMatrixTransformationProcessorWrapper
- implements ExternalTextureProcessor {
+/* package */ final class FinalMatrixTextureProcessorWrapper implements ExternalTextureProcessor {
private static final String TAG = "FinalProcessorWrapper";
@@ -80,7 +79,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
private int inputWidth;
private int inputHeight;
- @Nullable private MatrixTransformationProcessor matrixTransformationProcessor;
+ @Nullable private MatrixTextureProcessor matrixTextureProcessor;
@Nullable private SurfaceViewWrapper debugSurfaceViewWrapper;
private InputListener inputListener;
private @MonotonicNonNull Pair outputSizeBeforeSurfaceTransformation;
@@ -96,7 +95,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
@Nullable
private EGLSurface outputEglSurface;
- public FinalMatrixTransformationProcessorWrapper(
+ public FinalMatrixTextureProcessorWrapper(
Context context,
EGLDisplay eglDisplay,
EGLContext eglContext,
@@ -192,8 +191,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
@Override
@WorkerThread
public void release() throws FrameProcessingException {
- if (matrixTransformationProcessor != null) {
- matrixTransformationProcessor.release();
+ if (matrixTextureProcessor != null) {
+ matrixTextureProcessor.release();
}
}
@@ -206,8 +205,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
/* destPost= */ 0,
/* length= */ textureTransformMatrix.length);
- if (matrixTransformationProcessor != null) {
- matrixTransformationProcessor.setTextureTransformMatrix(textureTransformMatrix);
+ if (matrixTextureProcessor != null) {
+ matrixTextureProcessor.setTextureTransformMatrix(textureTransformMatrix);
}
}
@@ -271,8 +270,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
EGLSurface outputEglSurface = this.outputEglSurface;
SurfaceInfo outputSurfaceInfo = this.outputSurfaceInfo;
- MatrixTransformationProcessor matrixTransformationProcessor =
- this.matrixTransformationProcessor;
+ MatrixTextureProcessor matrixTextureProcessor = this.matrixTextureProcessor;
GlUtil.focusEglSurface(
eglDisplay,
@@ -281,7 +279,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
outputSurfaceInfo.width,
outputSurfaceInfo.height);
GlUtil.clearOutputFrame();
- matrixTransformationProcessor.drawFrame(inputTexture.texId, presentationTimeUs);
+ matrixTextureProcessor.drawFrame(inputTexture.texId, presentationTimeUs);
if (dropLateFrame && System.nanoTime() > releaseTimeNs) {
return;
@@ -291,7 +289,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
}
@EnsuresNonNullIf(
- expression = {"outputSurfaceInfo", "outputEglSurface", "matrixTransformationProcessor"},
+ expression = {"outputSurfaceInfo", "outputEglSurface", "matrixTextureProcessor"},
result = true)
private synchronized boolean ensureConfigured(int inputWidth, int inputHeight)
throws FrameProcessingException, GlUtil.GlException {
@@ -313,9 +311,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
}
if (outputSurfaceInfo == null) {
- if (matrixTransformationProcessor != null) {
- matrixTransformationProcessor.release();
- matrixTransformationProcessor = null;
+ if (matrixTextureProcessor != null) {
+ matrixTextureProcessor.release();
+ matrixTextureProcessor = null;
}
outputEglSurface = null;
return false;
@@ -342,14 +340,13 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
this.debugSurfaceView = debugSurfaceView;
}
- if (matrixTransformationProcessor != null && outputSizeOrRotationChanged) {
- matrixTransformationProcessor.release();
- matrixTransformationProcessor = null;
+ if (matrixTextureProcessor != null && outputSizeOrRotationChanged) {
+ matrixTextureProcessor.release();
+ matrixTextureProcessor = null;
outputSizeOrRotationChanged = false;
}
- if (matrixTransformationProcessor == null) {
- matrixTransformationProcessor =
- createMatrixTransformationProcessorForOutputSurface(outputSurfaceInfo);
+ if (matrixTextureProcessor == null) {
+ matrixTextureProcessor = createMatrixTextureProcessorForOutputSurface(outputSurfaceInfo);
}
this.outputSurfaceInfo = outputSurfaceInfo;
@@ -357,7 +354,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
return true;
}
- private MatrixTransformationProcessor createMatrixTransformationProcessorForOutputSurface(
+ private MatrixTextureProcessor createMatrixTextureProcessorForOutputSurface(
SurfaceInfo outputSurfaceInfo) throws FrameProcessingException {
ImmutableList.Builder matrixTransformationListBuilder =
new ImmutableList.Builder().addAll(matrixTransformations);
@@ -371,39 +368,37 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
Presentation.createForWidthAndHeight(
outputSurfaceInfo.width, outputSurfaceInfo.height, Presentation.LAYOUT_SCALE_TO_FIT));
- MatrixTransformationProcessor matrixTransformationProcessor;
+ MatrixTextureProcessor matrixTextureProcessor;
ImmutableList expandedMatrixTransformations =
matrixTransformationListBuilder.build();
if (sampleFromExternalTexture) {
- matrixTransformationProcessor =
- MatrixTransformationProcessor.createWithExternalSamplerApplyingEotfThenOetf(
+ matrixTextureProcessor =
+ MatrixTextureProcessor.createWithExternalSamplerApplyingEotfThenOetf(
context, expandedMatrixTransformations, rgbMatrices, colorInfo);
} else {
- matrixTransformationProcessor =
- MatrixTransformationProcessor.createApplyingOetf(
+ matrixTextureProcessor =
+ MatrixTextureProcessor.createApplyingOetf(
context, expandedMatrixTransformations, rgbMatrices, colorInfo);
}
- matrixTransformationProcessor.setTextureTransformMatrix(textureTransformMatrix);
- Pair outputSize =
- matrixTransformationProcessor.configure(inputWidth, inputHeight);
+ matrixTextureProcessor.setTextureTransformMatrix(textureTransformMatrix);
+ Pair outputSize = matrixTextureProcessor.configure(inputWidth, inputHeight);
checkState(outputSize.first == outputSurfaceInfo.width);
checkState(outputSize.second == outputSurfaceInfo.height);
- return matrixTransformationProcessor;
+ return matrixTextureProcessor;
}
private void maybeRenderFrameToDebugSurface(TextureInfo inputTexture, long presentationTimeUs) {
- if (debugSurfaceViewWrapper == null || matrixTransformationProcessor == null) {
+ if (debugSurfaceViewWrapper == null || this.matrixTextureProcessor == null) {
return;
}
- MatrixTransformationProcessor matrixTransformationProcessor =
- this.matrixTransformationProcessor;
+ MatrixTextureProcessor matrixTextureProcessor = this.matrixTextureProcessor;
try {
debugSurfaceViewWrapper.maybeRenderToSurfaceView(
() -> {
GlUtil.clearOutputFrame();
- matrixTransformationProcessor.drawFrame(inputTexture.texId, presentationTimeUs);
+ matrixTextureProcessor.drawFrame(inputTexture.texId, presentationTimeUs);
});
} catch (FrameProcessingException | GlUtil.GlException e) {
Log.d(TAG, "Error rendering to debug preview", e);
diff --git a/libraries/effect/src/main/java/androidx/media3/effect/GlEffectsFrameProcessor.java b/libraries/effect/src/main/java/androidx/media3/effect/GlEffectsFrameProcessor.java
index 5f32693040..ef057ead45 100644
--- a/libraries/effect/src/main/java/androidx/media3/effect/GlEffectsFrameProcessor.java
+++ b/libraries/effect/src/main/java/androidx/media3/effect/GlEffectsFrameProcessor.java
@@ -159,15 +159,15 @@ public final class GlEffectsFrameProcessor implements FrameProcessor {
}
/**
- * Combines consecutive {@link GlMatrixTransformation} instances into a single {@link
- * MatrixTransformationProcessor} and converts all other {@link GlEffect} instances to separate
- * {@link GlTextureProcessor} instances.
+ * Combines consecutive {@link GlMatrixTransformation} and {@link RgbMatrix} instances into a
+ * single {@link MatrixTextureProcessor} and converts all other {@link GlEffect} instances to
+ * separate {@link GlTextureProcessor} instances.
*
* All {@link Effect} instances must be {@link GlEffect} instances.
*
* @return A non-empty list of {@link GlTextureProcessor} instances to apply in the given order.
* The first is an {@link ExternalTextureProcessor} and the last is a {@link
- * FinalMatrixTransformationProcessorWrapper}.
+ * FinalMatrixTextureProcessorWrapper}.
*/
// TODO(b/239757183): Squash GlMatrixTransformation and RgbMatrix together.
private static ImmutableList getGlTextureProcessorsForGlEffects(
@@ -206,17 +206,17 @@ public final class GlEffectsFrameProcessor implements FrameProcessor {
matrixTransformationListBuilder.build();
ImmutableList rgbMatrices = rgbMatrixListBuilder.build();
if (!matrixTransformations.isEmpty() || !rgbMatrices.isEmpty() || sampleFromExternalTexture) {
- MatrixTransformationProcessor matrixTransformationProcessor;
+ MatrixTextureProcessor matrixTextureProcessor;
if (sampleFromExternalTexture) {
- matrixTransformationProcessor =
- MatrixTransformationProcessor.createWithExternalSamplerApplyingEotf(
+ matrixTextureProcessor =
+ MatrixTextureProcessor.createWithExternalSamplerApplyingEotf(
context, matrixTransformations, rgbMatrices, colorInfo);
} else {
- matrixTransformationProcessor =
- MatrixTransformationProcessor.create(
+ matrixTextureProcessor =
+ MatrixTextureProcessor.create(
context, matrixTransformations, rgbMatrices, ColorInfo.isTransferHdr(colorInfo));
}
- textureProcessorListBuilder.add(matrixTransformationProcessor);
+ textureProcessorListBuilder.add(matrixTextureProcessor);
matrixTransformationListBuilder = new ImmutableList.Builder<>();
rgbMatrixListBuilder = new ImmutableList.Builder<>();
sampleFromExternalTexture = false;
@@ -226,7 +226,7 @@ public final class GlEffectsFrameProcessor implements FrameProcessor {
}
textureProcessorListBuilder.add(
- new FinalMatrixTransformationProcessorWrapper(
+ new FinalMatrixTextureProcessorWrapper(
context,
eglDisplay,
eglContext,
@@ -271,7 +271,7 @@ public final class GlEffectsFrameProcessor implements FrameProcessor {
private final ExternalTextureManager inputExternalTextureManager;
private final Surface inputSurface;
private final boolean releaseFramesAutomatically;
- private final FinalMatrixTransformationProcessorWrapper finalTextureProcessorWrapper;
+ private final FinalMatrixTextureProcessorWrapper finalTextureProcessorWrapper;
private final ImmutableList allTextureProcessors;
private @MonotonicNonNull FrameInfo nextInputFrameInfo;
@@ -297,15 +297,14 @@ public final class GlEffectsFrameProcessor implements FrameProcessor {
checkState(!textureProcessors.isEmpty());
checkState(textureProcessors.get(0) instanceof ExternalTextureProcessor);
- checkState(getLast(textureProcessors) instanceof FinalMatrixTransformationProcessorWrapper);
+ checkState(getLast(textureProcessors) instanceof FinalMatrixTextureProcessorWrapper);
ExternalTextureProcessor inputExternalTextureProcessor =
(ExternalTextureProcessor) textureProcessors.get(0);
inputExternalTextureManager =
new ExternalTextureManager(inputExternalTextureProcessor, frameProcessingTaskExecutor);
inputExternalTextureProcessor.setInputListener(inputExternalTextureManager);
inputSurface = new Surface(inputExternalTextureManager.getSurfaceTexture());
- finalTextureProcessorWrapper =
- (FinalMatrixTransformationProcessorWrapper) getLast(textureProcessors);
+ finalTextureProcessorWrapper = (FinalMatrixTextureProcessorWrapper) getLast(textureProcessors);
allTextureProcessors = textureProcessors;
previousStreamOffsetUs = C.TIME_UNSET;
}
diff --git a/libraries/effect/src/main/java/androidx/media3/effect/GlMatrixTransformation.java b/libraries/effect/src/main/java/androidx/media3/effect/GlMatrixTransformation.java
index a4e8803bd7..59297829c9 100644
--- a/libraries/effect/src/main/java/androidx/media3/effect/GlMatrixTransformation.java
+++ b/libraries/effect/src/main/java/androidx/media3/effect/GlMatrixTransformation.java
@@ -55,7 +55,7 @@ public interface GlMatrixTransformation extends GlEffect {
@Override
default SingleFrameGlTextureProcessor toGlTextureProcessor(Context context, boolean useHdr)
throws FrameProcessingException {
- return MatrixTransformationProcessor.create(
+ return MatrixTextureProcessor.create(
context,
/* matrixTransformations= */ ImmutableList.of(this),
/* rgbMatrices= */ ImmutableList.of(),
diff --git a/libraries/effect/src/main/java/androidx/media3/effect/MatrixTransformationProcessor.java b/libraries/effect/src/main/java/androidx/media3/effect/MatrixTextureProcessor.java
similarity index 97%
rename from libraries/effect/src/main/java/androidx/media3/effect/MatrixTransformationProcessor.java
rename to libraries/effect/src/main/java/androidx/media3/effect/MatrixTextureProcessor.java
index c19b3b7b3b..7b6062e916 100644
--- a/libraries/effect/src/main/java/androidx/media3/effect/MatrixTransformationProcessor.java
+++ b/libraries/effect/src/main/java/androidx/media3/effect/MatrixTextureProcessor.java
@@ -50,10 +50,9 @@ import java.util.List;
*
* Can copy frames from an external texture and apply color transformations for HDR if needed.
*/
-// TODO(b/239757183): Rename Matrix to a more generic name.
@UnstableApi
@SuppressWarnings("FunctionalInterfaceClash") // b/228192298
-/* package */ final class MatrixTransformationProcessor extends SingleFrameGlTextureProcessor
+/* package */ final class MatrixTextureProcessor extends SingleFrameGlTextureProcessor
implements ExternalTextureProcessor {
private static final String VERTEX_SHADER_TRANSFORMATION_PATH =
@@ -142,7 +141,7 @@ import java.util.List;
* @throws FrameProcessingException If a problem occurs while reading shader files or an OpenGL
* operation fails or is unsupported.
*/
- public static MatrixTransformationProcessor create(
+ public static MatrixTextureProcessor create(
Context context,
List matrixTransformations,
List rgbMatrices,
@@ -153,7 +152,7 @@ import java.util.List;
context, VERTEX_SHADER_TRANSFORMATION_PATH, FRAGMENT_SHADER_TRANSFORMATION_PATH);
// No transfer functions needed, because input and output are both optical colors.
- return new MatrixTransformationProcessor(
+ return new MatrixTextureProcessor(
glProgram,
ImmutableList.copyOf(matrixTransformations),
ImmutableList.copyOf(rgbMatrices),
@@ -183,7 +182,7 @@ import java.util.List;
* @throws FrameProcessingException If a problem occurs while reading shader files or an OpenGL
* operation fails or is unsupported.
*/
- public static MatrixTransformationProcessor createWithExternalSamplerApplyingEotf(
+ public static MatrixTextureProcessor createWithExternalSamplerApplyingEotf(
Context context,
List matrixTransformations,
List rgbMatrices,
@@ -217,7 +216,7 @@ import java.util.List;
glProgram.setIntUniform("uEotfColorTransfer", colorTransfer);
}
- return new MatrixTransformationProcessor(
+ return new MatrixTextureProcessor(
glProgram,
ImmutableList.copyOf(matrixTransformations),
ImmutableList.copyOf(rgbMatrices),
@@ -243,7 +242,7 @@ import java.util.List;
* @throws FrameProcessingException If a problem occurs while reading shader files or an OpenGL
* operation fails or is unsupported.
*/
- public static MatrixTransformationProcessor createApplyingOetf(
+ public static MatrixTextureProcessor createApplyingOetf(
Context context,
List matrixTransformations,
List rgbMatrices,
@@ -264,7 +263,7 @@ import java.util.List;
glProgram.setIntUniform("uOetfColorTransfer", colorTransfer);
}
- return new MatrixTransformationProcessor(
+ return new MatrixTextureProcessor(
glProgram,
ImmutableList.copyOf(matrixTransformations),
ImmutableList.copyOf(rgbMatrices),
@@ -290,7 +289,7 @@ import java.util.List;
* @throws FrameProcessingException If a problem occurs while reading shader files or an OpenGL
* operation fails or is unsupported.
*/
- public static MatrixTransformationProcessor createWithExternalSamplerApplyingEotfThenOetf(
+ public static MatrixTextureProcessor createWithExternalSamplerApplyingEotfThenOetf(
Context context,
List matrixTransformations,
List rgbMatrices,
@@ -322,7 +321,7 @@ import java.util.List;
glProgram.setIntUniform("uEotfColorTransfer", Format.NO_VALUE);
}
- return new MatrixTransformationProcessor(
+ return new MatrixTextureProcessor(
glProgram,
ImmutableList.copyOf(matrixTransformations),
ImmutableList.copyOf(rgbMatrices),
@@ -340,7 +339,7 @@ import java.util.List;
* @param useHdr Whether to process the input as an HDR signal. Using HDR requires the {@code
* EXT_YUV_target} OpenGL extension.
*/
- private MatrixTransformationProcessor(
+ private MatrixTextureProcessor(
GlProgram glProgram,
ImmutableList matrixTransformations,
ImmutableList rgbMatrices,
diff --git a/libraries/effect/src/main/java/androidx/media3/effect/RgbFilter.java b/libraries/effect/src/main/java/androidx/media3/effect/RgbFilter.java
index 3452b00c3b..ca33e34525 100644
--- a/libraries/effect/src/main/java/androidx/media3/effect/RgbFilter.java
+++ b/libraries/effect/src/main/java/androidx/media3/effect/RgbFilter.java
@@ -91,7 +91,7 @@ public class RgbFilter implements RgbMatrix {
}
@Override
- public MatrixTransformationProcessor toGlTextureProcessor(Context context, boolean useHdr)
+ public MatrixTextureProcessor toGlTextureProcessor(Context context, boolean useHdr)
throws FrameProcessingException {
checkForConsistentHdrSetting(useHdr);
return RgbMatrix.super.toGlTextureProcessor(context, useHdr);
diff --git a/libraries/effect/src/main/java/androidx/media3/effect/RgbMatrix.java b/libraries/effect/src/main/java/androidx/media3/effect/RgbMatrix.java
index 1a5371695d..39a78e979a 100644
--- a/libraries/effect/src/main/java/androidx/media3/effect/RgbMatrix.java
+++ b/libraries/effect/src/main/java/androidx/media3/effect/RgbMatrix.java
@@ -40,9 +40,9 @@ public interface RgbMatrix extends GlEffect {
float[] getMatrix(long presentationTimeUs, boolean useHdr);
@Override
- default MatrixTransformationProcessor toGlTextureProcessor(Context context, boolean useHdr)
+ default MatrixTextureProcessor toGlTextureProcessor(Context context, boolean useHdr)
throws FrameProcessingException {
- return MatrixTransformationProcessor.create(
+ return MatrixTextureProcessor.create(
context,
/* matrixTransformations= */ ImmutableList.of(),
/* rgbMatrices= */ ImmutableList.of(this),
diff --git a/libraries/effect/src/test/java/androidx/media3/effect/ScaleToFitTransformationTest.java b/libraries/effect/src/test/java/androidx/media3/effect/ScaleToFitTransformationTest.java
index efc18b7741..134dc663e3 100644
--- a/libraries/effect/src/test/java/androidx/media3/effect/ScaleToFitTransformationTest.java
+++ b/libraries/effect/src/test/java/androidx/media3/effect/ScaleToFitTransformationTest.java
@@ -25,8 +25,8 @@ import org.junit.runner.RunWith;
/**
* Unit tests for {@link ScaleToFitTransformation}.
*
- * See {@code MatrixTransformationPixelTest} for pixel tests testing {@link
- * MatrixTransformationProcessor} given a transformation matrix.
+ *
See {@code MatrixTextureProcessorPixelTest} for pixel tests testing {@link
+ * MatrixTextureProcessor} given a transformation matrix.
*/
@RunWith(AndroidJUnit4.class)
public final class ScaleToFitTransformationTest {