diff --git a/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/MatrixShaderProgramPixelTest.java b/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/DefaultShaderProgramPixelTest.java similarity index 87% rename from library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/MatrixShaderProgramPixelTest.java rename to library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/DefaultShaderProgramPixelTest.java index 4b3e0bc130..8b681464af 100644 --- a/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/MatrixShaderProgramPixelTest.java +++ b/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/DefaultShaderProgramPixelTest.java @@ -42,7 +42,7 @@ import org.junit.Test; import org.junit.runner.RunWith; /** - * Pixel test for texture processing via {@link MatrixShaderProgram}. + * Pixel test for texture processing via {@link DefaultShaderProgram}. * *
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 @@ -50,7 +50,7 @@ import org.junit.runner.RunWith; * bitmaps as recommended in {@link DefaultVideoFrameProcessorPixelTest}. */ @RunWith(AndroidJUnit4.class) -public final class MatrixShaderProgramPixelTest { +public final class DefaultShaderProgramPixelTest { public static final String ORIGINAL_PNG_ASSET_PATH = "media/bitmap/sample_mp4_first_frame/electrical_colors/original.png"; public static final String TRANSLATE_RIGHT_PNG_ASSET_PATH = @@ -64,7 +64,7 @@ public final class MatrixShaderProgramPixelTest { private @MonotonicNonNull EGLDisplay eglDisplay; private @MonotonicNonNull EGLContext eglContext; - private @MonotonicNonNull SingleFrameGlShaderProgram matrixShaderProgram; + private @MonotonicNonNull SingleFrameGlShaderProgram defaultShaderProgram; private int inputTexId; private int inputWidth; private int inputHeight; @@ -88,8 +88,8 @@ public final class MatrixShaderProgramPixelTest { @After public void release() throws GlUtil.GlException, VideoFrameProcessingException { - if (matrixShaderProgram != null) { - matrixShaderProgram.release(); + if (defaultShaderProgram != null) { + defaultShaderProgram.release(); } if (eglContext != null && eglDisplay != null) { GlUtil.destroyEglContext(eglDisplay, eglContext); @@ -101,11 +101,11 @@ public final class MatrixShaderProgramPixelTest { String testId = "drawFrame_noEdits"; Matrix identityMatrix = new Matrix(); MatrixTransformation noEditsTransformation = (long presentationTimeUs) -> identityMatrix; - matrixShaderProgram = noEditsTransformation.toGlShaderProgram(context, /* useHdr= */ false); - matrixShaderProgram.configure(inputWidth, inputHeight); + defaultShaderProgram = noEditsTransformation.toGlShaderProgram(context, /* useHdr= */ false); + defaultShaderProgram.configure(inputWidth, inputHeight); Bitmap expectedBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH); - matrixShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); + defaultShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(inputWidth, inputHeight); maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); @@ -122,12 +122,12 @@ public final class MatrixShaderProgramPixelTest { translateRightMatrix.postTranslate(/* dx= */ 1, /* dy= */ 0); MatrixTransformation translateRightTransformation = (long presentationTimeUs) -> translateRightMatrix; - matrixShaderProgram = + defaultShaderProgram = translateRightTransformation.toGlShaderProgram(context, /* useHdr= */ false); - matrixShaderProgram.configure(inputWidth, inputHeight); + defaultShaderProgram.configure(inputWidth, inputHeight); Bitmap expectedBitmap = readBitmap(TRANSLATE_RIGHT_PNG_ASSET_PATH); - matrixShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); + defaultShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(inputWidth, inputHeight); maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); @@ -143,11 +143,12 @@ public final class MatrixShaderProgramPixelTest { Matrix scaleNarrowMatrix = new Matrix(); scaleNarrowMatrix.postScale(.5f, 1.2f); MatrixTransformation scaleNarrowTransformation = (long presentationTimeUs) -> scaleNarrowMatrix; - matrixShaderProgram = scaleNarrowTransformation.toGlShaderProgram(context, /* useHdr= */ false); - matrixShaderProgram.configure(inputWidth, inputHeight); + defaultShaderProgram = + scaleNarrowTransformation.toGlShaderProgram(context, /* useHdr= */ false); + defaultShaderProgram.configure(inputWidth, inputHeight); Bitmap expectedBitmap = readBitmap(SCALE_NARROW_PNG_ASSET_PATH); - matrixShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); + defaultShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(inputWidth, inputHeight); maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); @@ -163,11 +164,11 @@ public final class MatrixShaderProgramPixelTest { Matrix rotate90Matrix = new Matrix(); rotate90Matrix.postRotate(/* degrees= */ 90); MatrixTransformation rotate90Transformation = (long presentationTimeUs) -> rotate90Matrix; - matrixShaderProgram = rotate90Transformation.toGlShaderProgram(context, /* useHdr= */ false); - matrixShaderProgram.configure(inputWidth, inputHeight); + defaultShaderProgram = rotate90Transformation.toGlShaderProgram(context, /* useHdr= */ false); + defaultShaderProgram.configure(inputWidth, inputHeight); Bitmap expectedBitmap = readBitmap(ROTATE_90_PNG_ASSET_PATH); - matrixShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); + defaultShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(inputWidth, inputHeight); maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap); diff --git a/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/RgbAdjustmentPixelTest.java b/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/RgbAdjustmentPixelTest.java index 85879b6c99..01e017065a 100644 --- a/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/RgbAdjustmentPixelTest.java +++ b/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/RgbAdjustmentPixelTest.java @@ -69,7 +69,7 @@ public final class RgbAdjustmentPixelTest { private @MonotonicNonNull EGLDisplay eglDisplay; private @MonotonicNonNull EGLContext eglContext; - private @MonotonicNonNull SingleFrameGlShaderProgram matrixShaderProgram; + private @MonotonicNonNull SingleFrameGlShaderProgram defaultShaderProgram; private @MonotonicNonNull EGLSurface placeholderEglSurface; private int inputTexId; private int inputWidth; @@ -100,8 +100,8 @@ public final class RgbAdjustmentPixelTest { @After public void release() throws GlUtil.GlException, VideoFrameProcessingException { - if (matrixShaderProgram != null) { - matrixShaderProgram.release(); + if (defaultShaderProgram != null) { + defaultShaderProgram.release(); } GlUtil.destroyEglContext(eglDisplay, eglContext); } @@ -110,11 +110,11 @@ public final class RgbAdjustmentPixelTest { public void drawFrame_identityMatrix_leavesFrameUnchanged() throws Exception { String testId = "drawFrame_identityMatrix"; RgbMatrix identityMatrix = new RgbAdjustment.Builder().build(); - matrixShaderProgram = identityMatrix.toGlShaderProgram(context, /* useHdr= */ false); - Size outputSize = matrixShaderProgram.configure(inputWidth, inputHeight); + defaultShaderProgram = identityMatrix.toGlShaderProgram(context, /* useHdr= */ false); + Size outputSize = defaultShaderProgram.configure(inputWidth, inputHeight); Bitmap expectedBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH); - matrixShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); + defaultShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); @@ -129,13 +129,13 @@ public final class RgbAdjustmentPixelTest { String testId = "drawFrame_removeColors"; RgbMatrix removeColorMatrix = new RgbAdjustment.Builder().setRedScale(0).setGreenScale(0).setBlueScale(0).build(); - matrixShaderProgram = removeColorMatrix.toGlShaderProgram(context, /* useHdr= */ false); - Size outputSize = matrixShaderProgram.configure(inputWidth, inputHeight); + defaultShaderProgram = removeColorMatrix.toGlShaderProgram(context, /* useHdr= */ false); + Size outputSize = defaultShaderProgram.configure(inputWidth, inputHeight); Bitmap expectedBitmap = createArgb8888BitmapWithSolidColor( outputSize.getWidth(), outputSize.getHeight(), Color.BLACK); - matrixShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); + defaultShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); @@ -149,11 +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(); - matrixShaderProgram = redOnlyMatrix.toGlShaderProgram(context, /* useHdr= */ false); - Size outputSize = matrixShaderProgram.configure(inputWidth, inputHeight); + defaultShaderProgram = redOnlyMatrix.toGlShaderProgram(context, /* useHdr= */ false); + Size outputSize = defaultShaderProgram.configure(inputWidth, inputHeight); Bitmap expectedBitmap = readBitmap(ONLY_RED_CHANNEL_PNG_ASSET_PATH); - matrixShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); + defaultShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); @@ -167,11 +167,11 @@ public final class RgbAdjustmentPixelTest { public void drawFrame_increaseRedChannel_producesBrighterAndRedderFrame() throws Exception { String testId = "drawFrame_increaseRedChannel"; RgbMatrix increaseRedMatrix = new RgbAdjustment.Builder().setRedScale(5).build(); - matrixShaderProgram = increaseRedMatrix.toGlShaderProgram(context, /* useHdr= */ false); - Size outputSize = matrixShaderProgram.configure(inputWidth, inputHeight); + defaultShaderProgram = increaseRedMatrix.toGlShaderProgram(context, /* useHdr= */ false); + Size outputSize = defaultShaderProgram.configure(inputWidth, inputHeight); Bitmap expectedBitmap = readBitmap(INCREASE_RED_CHANNEL_PNG_ASSET_PATH); - matrixShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); + defaultShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); @@ -186,11 +186,11 @@ public final class RgbAdjustmentPixelTest { String testId = "drawFrame_increaseBrightness"; RgbMatrix increaseBrightnessMatrix = new RgbAdjustment.Builder().setRedScale(5).setGreenScale(5).setBlueScale(5).build(); - matrixShaderProgram = increaseBrightnessMatrix.toGlShaderProgram(context, /* useHdr= */ false); - Size outputSize = matrixShaderProgram.configure(inputWidth, inputHeight); + defaultShaderProgram = increaseBrightnessMatrix.toGlShaderProgram(context, /* useHdr= */ false); + Size outputSize = defaultShaderProgram.configure(inputWidth, inputHeight); Bitmap expectedBitmap = readBitmap(INCREASE_BRIGHTNESS_PNG_ASSET_PATH); - matrixShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); + defaultShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); @@ -206,18 +206,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(); - matrixShaderProgram = - MatrixShaderProgram.create( + defaultShaderProgram = + DefaultShaderProgram.create( context, /* matrixTransformations= */ ImmutableList.of(), /* rgbMatrices= */ ImmutableList.of(noRed, noGreen, noBlue), /* useHdr= */ false); - Size outputSize = matrixShaderProgram.configure(inputWidth, inputHeight); + Size outputSize = defaultShaderProgram.configure(inputWidth, inputHeight); Bitmap expectedBitmap = createArgb8888BitmapWithSolidColor( outputSize.getWidth(), outputSize.getHeight(), Color.BLACK); - matrixShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); + defaultShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); @@ -232,16 +232,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(); - matrixShaderProgram = - MatrixShaderProgram.create( + defaultShaderProgram = + DefaultShaderProgram.create( context, /* matrixTransformations= */ ImmutableList.of(), /* rgbMatrices= */ ImmutableList.of(noGreen, noBlue), /* useHdr= */ false); - Size outputSize = matrixShaderProgram.configure(inputWidth, inputHeight); + Size outputSize = defaultShaderProgram.configure(inputWidth, inputHeight); Bitmap expectedBitmap = readBitmap(ONLY_RED_CHANNEL_PNG_ASSET_PATH); - matrixShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); + defaultShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); @@ -258,16 +258,16 @@ public final class RgbAdjustmentPixelTest { RgbMatrix scaleRedMatrix = new RgbAdjustment.Builder().setRedScale(redScale).build(); RgbMatrix scaleRedByInverseMatrix = new RgbAdjustment.Builder().setRedScale(1 / redScale).build(); - matrixShaderProgram = - MatrixShaderProgram.create( + defaultShaderProgram = + DefaultShaderProgram.create( context, /* matrixTransformations= */ ImmutableList.of(), /* rgbMatrices= */ ImmutableList.of(scaleRedMatrix, scaleRedByInverseMatrix), /* useHdr= */ false); - Size outputSize = matrixShaderProgram.configure(inputWidth, inputHeight); + Size outputSize = defaultShaderProgram.configure(inputWidth, inputHeight); Bitmap expectedBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH); - matrixShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); + defaultShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); diff --git a/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/RgbFilterPixelTest.java b/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/RgbFilterPixelTest.java index 08064bc3bb..946740ee76 100644 --- a/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/RgbFilterPixelTest.java +++ b/library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/RgbFilterPixelTest.java @@ -64,7 +64,7 @@ public final class RgbFilterPixelTest { private @MonotonicNonNull EGLDisplay eglDisplay; private @MonotonicNonNull EGLContext eglContext; - private @MonotonicNonNull SingleFrameGlShaderProgram matrixShaderProgram; + private @MonotonicNonNull SingleFrameGlShaderProgram defaultShaderProgram; private @MonotonicNonNull EGLSurface placeholderEglSurface; private int inputTexId; private int inputWidth; @@ -95,8 +95,8 @@ public final class RgbFilterPixelTest { @After public void release() throws GlUtil.GlException, VideoFrameProcessingException { - if (matrixShaderProgram != null) { - matrixShaderProgram.release(); + if (defaultShaderProgram != null) { + defaultShaderProgram.release(); } GlUtil.destroyEglContext(eglDisplay, eglContext); } @@ -105,11 +105,11 @@ public final class RgbFilterPixelTest { public void drawFrame_grayscale_producesGrayscaleImage() throws Exception { String testId = "drawFrame_grayscale"; RgbMatrix grayscaleMatrix = RgbFilter.createGrayscaleFilter(); - matrixShaderProgram = grayscaleMatrix.toGlShaderProgram(context, /* useHdr= */ false); - Size outputSize = matrixShaderProgram.configure(inputWidth, inputHeight); + defaultShaderProgram = grayscaleMatrix.toGlShaderProgram(context, /* useHdr= */ false); + Size outputSize = defaultShaderProgram.configure(inputWidth, inputHeight); Bitmap expectedBitmap = readBitmap(GRAYSCALE_PNG_ASSET_PATH); - matrixShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); + defaultShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); @@ -123,11 +123,11 @@ public final class RgbFilterPixelTest { public void drawFrame_inverted_producesInvertedFrame() throws Exception { String testId = "drawFrame_inverted"; RgbMatrix invertedMatrix = RgbFilter.createInvertedFilter(); - matrixShaderProgram = invertedMatrix.toGlShaderProgram(context, /* useHdr= */ false); - Size outputSize = matrixShaderProgram.configure(inputWidth, inputHeight); + defaultShaderProgram = invertedMatrix.toGlShaderProgram(context, /* useHdr= */ false); + Size outputSize = defaultShaderProgram.configure(inputWidth, inputHeight); Bitmap expectedBitmap = readBitmap(INVERT_PNG_ASSET_PATH); - matrixShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); + defaultShaderProgram.drawFrame(inputTexId, /* presentationTimeUs= */ 0); Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight()); diff --git a/library/effect/src/main/java/com/google/android/exoplayer2/effect/MatrixShaderProgram.java b/library/effect/src/main/java/com/google/android/exoplayer2/effect/DefaultShaderProgram.java similarity index 97% rename from library/effect/src/main/java/com/google/android/exoplayer2/effect/MatrixShaderProgram.java rename to library/effect/src/main/java/com/google/android/exoplayer2/effect/DefaultShaderProgram.java index dc9cd34403..f8902a83df 100644 --- a/library/effect/src/main/java/com/google/android/exoplayer2/effect/MatrixShaderProgram.java +++ b/library/effect/src/main/java/com/google/android/exoplayer2/effect/DefaultShaderProgram.java @@ -50,7 +50,7 @@ import java.util.List; *
Can copy frames from an external texture and apply color transformations for HDR if needed.
*/
@SuppressWarnings("FunctionalInterfaceClash") // b/228192298
-/* package */ final class MatrixShaderProgram extends SingleFrameGlShaderProgram
+/* package */ final class DefaultShaderProgram extends SingleFrameGlShaderProgram
implements ExternalShaderProgram {
private static final String VERTEX_SHADER_TRANSFORMATION_PATH =
@@ -144,7 +144,7 @@ import java.util.List;
* @throws VideoFrameProcessingException If a problem occurs while reading shader files or an
* OpenGL operation fails or is unsupported.
*/
- public static MatrixShaderProgram create(
+ public static DefaultShaderProgram create(
Context context,
List This method must not be called on {@code MatrixShaderProgram} instances that output
+ * This method must not be called on {@code DefaultShaderProgram} instances that output
* {@linkplain C#COLOR_TRANSFER_LINEAR linear colors}.
*/
public void setOutputColorTransfer(@C.ColorTransfer int colorTransfer) {
diff --git a/library/effect/src/main/java/com/google/android/exoplayer2/effect/DefaultVideoFrameProcessor.java b/library/effect/src/main/java/com/google/android/exoplayer2/effect/DefaultVideoFrameProcessor.java
index 491d5ad678..2e63868729 100644
--- a/library/effect/src/main/java/com/google/android/exoplayer2/effect/DefaultVideoFrameProcessor.java
+++ b/library/effect/src/main/java/com/google/android/exoplayer2/effect/DefaultVideoFrameProcessor.java
@@ -229,14 +229,14 @@ public final class DefaultVideoFrameProcessor implements VideoFrameProcessor {
/**
* Combines consecutive {@link GlMatrixTransformation} and {@link RgbMatrix} instances into a
- * single {@link MatrixShaderProgram} and converts all other {@link GlEffect} instances to
+ * single {@link DefaultShaderProgram} and converts all other {@link GlEffect} instances to
* separate {@link GlShaderProgram} instances.
*
* All {@link Effect} instances must be {@link GlEffect} instances.
*
* @return A non-empty list of {@link GlShaderProgram} instances to apply in the given order. The
* first is an {@link ExternalShaderProgram} and the last is a {@link
- * FinalMatrixShaderProgramWrapper}.
+ * FinalShaderProgramWrapper}.
*/
private static ImmutableList The wrapped {@link GlShaderProgram} applies the {@link GlMatrixTransformation} and {@link
+ * The wrapped {@link DefaultShaderProgram} 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 GlShaderProgram} instance in the chain of {@link
- * GlShaderProgram} instances used by {@link VideoFrameProcessor}.
+ * This wrapper is used for the final {@link DefaultShaderProgram} instance in the chain of
+ * {@link DefaultShaderProgram} instances used by {@link VideoFrameProcessor}.
*/
-/* package */ final class FinalMatrixShaderProgramWrapper implements ExternalShaderProgram {
+/* package */ final class FinalShaderProgramWrapper implements ExternalShaderProgram {
private static final String TAG = "FinalShaderWrapper";
@@ -84,7 +84,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
private int inputWidth;
private int inputHeight;
- @Nullable private MatrixShaderProgram matrixShaderProgram;
+ @Nullable private DefaultShaderProgram defaultShaderProgram;
@Nullable private SurfaceViewWrapper debugSurfaceViewWrapper;
private InputListener inputListener;
private @MonotonicNonNull Size outputSizeBeforeSurfaceTransformation;
@@ -100,7 +100,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
@Nullable
private EGLSurface outputEglSurface;
- public FinalMatrixShaderProgramWrapper(
+ public FinalShaderProgramWrapper(
Context context,
EGLDisplay eglDisplay,
EGLContext eglContext,
@@ -197,8 +197,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
public void flush() {
// Drops all frames that aren't released yet.
availableFrames.clear();
- if (matrixShaderProgram != null) {
- matrixShaderProgram.flush();
+ if (defaultShaderProgram != null) {
+ defaultShaderProgram.flush();
}
inputListener.onFlush();
inputListener.onReadyToAcceptInputFrame();
@@ -207,8 +207,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
@Override
@WorkerThread
public synchronized void release() throws VideoFrameProcessingException {
- if (matrixShaderProgram != null) {
- matrixShaderProgram.release();
+ if (defaultShaderProgram != null) {
+ defaultShaderProgram.release();
}
try {
GlUtil.destroyEglSurface(eglDisplay, outputEglSurface);
@@ -226,8 +226,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
/* destPost= */ 0,
/* length= */ textureTransformMatrix.length);
- if (matrixShaderProgram != null) {
- matrixShaderProgram.setTextureTransformMatrix(textureTransformMatrix);
+ if (defaultShaderProgram != null) {
+ defaultShaderProgram.setTextureTransformMatrix(textureTransformMatrix);
}
}
@@ -296,7 +296,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
EGLSurface outputEglSurface = this.outputEglSurface;
SurfaceInfo outputSurfaceInfo = this.outputSurfaceInfo;
- MatrixShaderProgram matrixShaderProgram = this.matrixShaderProgram;
+ DefaultShaderProgram defaultShaderProgram = this.defaultShaderProgram;
GlUtil.focusEglSurface(
eglDisplay,
@@ -305,7 +305,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
outputSurfaceInfo.width,
outputSurfaceInfo.height);
GlUtil.clearOutputFrame();
- matrixShaderProgram.drawFrame(inputTexture.texId, presentationTimeUs);
+ defaultShaderProgram.drawFrame(inputTexture.texId, presentationTimeUs);
EGLExt.eglPresentationTimeANDROID(
eglDisplay,
@@ -317,7 +317,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
}
@EnsuresNonNullIf(
- expression = {"outputSurfaceInfo", "outputEglSurface", "matrixShaderProgram"},
+ expression = {"outputSurfaceInfo", "outputEglSurface", "defaultShaderProgram"},
result = true)
private synchronized boolean ensureConfigured(int inputWidth, int inputHeight)
throws VideoFrameProcessingException, GlUtil.GlException {
@@ -341,9 +341,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
}
if (outputSurfaceInfo == null) {
- if (matrixShaderProgram != null) {
- matrixShaderProgram.release();
- matrixShaderProgram = null;
+ if (defaultShaderProgram != null) {
+ defaultShaderProgram.release();
+ defaultShaderProgram = null;
}
GlUtil.destroyEglSurface(eglDisplay, outputEglSurface);
outputEglSurface = null;
@@ -373,13 +373,13 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
this.debugSurfaceView = debugSurfaceView;
}
- if (matrixShaderProgram != null && outputSizeOrRotationChanged) {
- matrixShaderProgram.release();
- matrixShaderProgram = null;
+ if (defaultShaderProgram != null && outputSizeOrRotationChanged) {
+ defaultShaderProgram.release();
+ defaultShaderProgram = null;
outputSizeOrRotationChanged = false;
}
- if (matrixShaderProgram == null) {
- matrixShaderProgram = createMatrixShaderProgramForOutputSurface(outputSurfaceInfo);
+ if (defaultShaderProgram == null) {
+ defaultShaderProgram = createDefaultShaderProgramForOutputSurface(outputSurfaceInfo);
}
this.outputSurfaceInfo = outputSurfaceInfo;
@@ -387,7 +387,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
return true;
}
- private MatrixShaderProgram createMatrixShaderProgramForOutputSurface(
+ private DefaultShaderProgram createDefaultShaderProgramForOutputSurface(
SurfaceInfo outputSurfaceInfo) throws VideoFrameProcessingException {
ImmutableList.Builder See {@code MatrixShaderProgramPixelTest} for pixel tests testing {@link MatrixShaderProgram}
+ * See {@code DefaultShaderProgramPixelTest} for pixel tests testing {@link DefaultShaderProgram}
* given a transformation matrix.
*/
@RunWith(AndroidJUnit4.class)