Commit d37cf341 by hschlueter Committed by Marc Baechinger

Rename GlFrameProcessor to SingleFrameGlTextureProcessor.

Also update names of implementations to match design doc.
In follow-ups, SingleFrameGlTextureProcessor will become
an abstract implementation of a new GlTextureProcessor
interface.

Texture processor makes sense as it processes OpenGL textures.
The term frame processor will be used for something else in
follow-ups.

PiperOrigin-RevId: 451142085
parent 53b44524
Showing with 94 additions and 97 deletions
......@@ -30,7 +30,7 @@ import android.opengl.GLUtils;
import android.util.Size;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.transformer.FrameProcessingException;
import com.google.android.exoplayer2.transformer.GlFrameProcessor;
import com.google.android.exoplayer2.transformer.SingleFrameGlTextureProcessor;
import com.google.android.exoplayer2.util.GlProgram;
import com.google.android.exoplayer2.util.GlUtil;
import java.io.IOException;
......@@ -38,13 +38,14 @@ import java.util.Locale;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
/**
* A {@link GlFrameProcessor} that overlays a bitmap with a logo and timer on each frame.
* A {@link SingleFrameGlTextureProcessor} that overlays a bitmap with a logo and timer on each
* frame.
*
* <p>The bitmap is drawn using an Android {@link Canvas}.
*/
// TODO(b/227625365): Delete this class and use a frame processor from the Transformer library, once
// overlaying a bitmap and text is supported in Transformer.
/* package */ final class BitmapOverlayFrameProcessor implements GlFrameProcessor {
// TODO(b/227625365): Delete this class and use a texture processor from the Transformer library,
// once overlaying a bitmap and text is supported in Transformer.
/* package */ final class BitmapOverlayProcessor implements SingleFrameGlTextureProcessor {
static {
GlUtil.glAssertionsEnabled = true;
}
......@@ -65,7 +66,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
private @MonotonicNonNull Bitmap logoBitmap;
private @MonotonicNonNull GlProgram glProgram;
public BitmapOverlayFrameProcessor() {
public BitmapOverlayProcessor() {
paint = new Paint();
paint.setTextSize(64);
paint.setAntiAlias(true);
......
......@@ -22,17 +22,17 @@ import android.content.Context;
import android.opengl.GLES20;
import android.util.Size;
import com.google.android.exoplayer2.transformer.FrameProcessingException;
import com.google.android.exoplayer2.transformer.GlFrameProcessor;
import com.google.android.exoplayer2.transformer.SingleFrameGlTextureProcessor;
import com.google.android.exoplayer2.util.GlProgram;
import com.google.android.exoplayer2.util.GlUtil;
import java.io.IOException;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
/**
* A {@link GlFrameProcessor} that periodically dims the frames such that pixels are darker the
* further they are away from the frame center.
* A {@link SingleFrameGlTextureProcessor} that periodically dims the frames such that pixels are
* darker the further they are away from the frame center.
*/
/* package */ final class PeriodicVignetteFrameProcessor implements GlFrameProcessor {
/* package */ final class PeriodicVignetteProcessor implements SingleFrameGlTextureProcessor {
static {
GlUtil.glAssertionsEnabled = true;
}
......@@ -67,7 +67,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
* @param maxInnerRadius The upper bound of the radius that is unaffected by the effect.
* @param outerRadius The radius after which all pixels are black.
*/
public PeriodicVignetteFrameProcessor(
public PeriodicVignetteProcessor(
float centerX, float centerY, float minInnerRadius, float maxInnerRadius, float outerRadius) {
checkArgument(minInnerRadius <= maxInnerRadius);
checkArgument(maxInnerRadius <= outerRadius);
......
......@@ -39,8 +39,8 @@ import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.transformer.DefaultEncoderFactory;
import com.google.android.exoplayer2.transformer.EncoderSelector;
import com.google.android.exoplayer2.transformer.GlEffect;
import com.google.android.exoplayer2.transformer.GlFrameProcessor;
import com.google.android.exoplayer2.transformer.ProgressHolder;
import com.google.android.exoplayer2.transformer.SingleFrameGlTextureProcessor;
import com.google.android.exoplayer2.transformer.TransformationException;
import com.google.android.exoplayer2.transformer.TransformationRequest;
import com.google.android.exoplayer2.transformer.TransformationResult;
......@@ -254,14 +254,13 @@ public final class TransformerActivity extends AppCompatActivity {
if (selectedEffects[1]) {
try {
Class<?> clazz =
Class.forName(
"com.google.android.exoplayer2.transformerdemo.MediaPipeFrameProcessor");
Class.forName("com.google.android.exoplayer2.transformerdemo.MediaPipeProcessor");
Constructor<?> constructor =
clazz.getConstructor(String.class, String.class, String.class);
effects.add(
() -> {
try {
return (GlFrameProcessor)
return (SingleFrameGlTextureProcessor)
constructor.newInstance(
/* graphName= */ "edge_detector_mediapipe_graph.binarypb",
/* inputStreamName= */ "input_video",
......@@ -278,7 +277,7 @@ public final class TransformerActivity extends AppCompatActivity {
if (selectedEffects[2]) {
effects.add(
() ->
new PeriodicVignetteFrameProcessor(
new PeriodicVignetteProcessor(
bundle.getFloat(ConfigurationActivity.PERIODIC_VIGNETTE_CENTER_X),
bundle.getFloat(ConfigurationActivity.PERIODIC_VIGNETTE_CENTER_Y),
/* minInnerRadius= */ bundle.getFloat(
......@@ -291,7 +290,7 @@ public final class TransformerActivity extends AppCompatActivity {
effects.add(MatrixTransformationFactory.createSpin3dEffect());
}
if (selectedEffects[4]) {
effects.add(BitmapOverlayFrameProcessor::new);
effects.add(BitmapOverlayProcessor::new);
}
if (selectedEffects[5]) {
effects.add(MatrixTransformationFactory.createZoomInTransition());
......
......@@ -23,7 +23,7 @@ import android.opengl.EGL14;
import android.opengl.GLES20;
import android.util.Size;
import com.google.android.exoplayer2.transformer.FrameProcessingException;
import com.google.android.exoplayer2.transformer.GlFrameProcessor;
import com.google.android.exoplayer2.transformer.SingleFrameGlTextureProcessor;
import com.google.android.exoplayer2.util.ConditionVariable;
import com.google.android.exoplayer2.util.GlProgram;
import com.google.android.exoplayer2.util.GlUtil;
......@@ -40,7 +40,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
* Runs a MediaPipe graph on input frames. The implementation is currently limited to graphs that
* can immediately produce one output frame per input frame.
*/
/* package */ final class MediaPipeFrameProcessor implements GlFrameProcessor {
/* package */ final class MediaPipeProcessor implements SingleFrameGlTextureProcessor {
private static final LibraryLoader LOADER =
new LibraryLoader("mediapipe_jni") {
......@@ -77,14 +77,13 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
private @MonotonicNonNull RuntimeException frameProcessorPendingError;
/**
* Creates a new frame processor that wraps a MediaPipe graph.
* Creates a new texture processor that wraps a MediaPipe graph.
*
* @param graphName Name of a MediaPipe graph asset to load.
* @param inputStreamName Name of the input video stream in the graph.
* @param outputStreamName Name of the input video stream in the graph.
*/
public MediaPipeFrameProcessor(
String graphName, String inputStreamName, String outputStreamName) {
public MediaPipeProcessor(String graphName, String inputStreamName, String outputStreamName) {
checkState(LOADER.isAvailable());
this.graphName = graphName;
this.inputStreamName = inputStreamName;
......@@ -141,7 +140,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
// Propagate the interrupted flag so the next blocking operation will throw.
// TODO(b/230469581): The next processor that runs will not have valid input due to returning
// early here. This could be fixed by checking for interruption in the outer loop that runs
// through the frame processors.
// through the texture processors.
Thread.currentThread().interrupt();
return;
}
......
......@@ -40,7 +40,7 @@ import java.nio.ByteBuffer;
/**
* Utilities for instrumentation tests for the {@link FrameProcessorChain} and {@link
* GlFrameProcessor GlFrameProcessors}.
* SingleFrameGlTextureProcessor SingleFrameGlTextureProcessors}.
*/
public class BitmapTestUtil {
......@@ -50,15 +50,15 @@ public class BitmapTestUtil {
* Maximum allowed average pixel difference between the expected and actual edited images in pixel
* difference-based tests. The value is chosen so that differences in decoder behavior across
* emulator versions don't affect whether the test passes for most emulators, but substantial
* distortions introduced by changes in the behavior of the {@link GlFrameProcessor
* GlFrameProcessors} will cause the test to fail.
* distortions introduced by changes in the behavior of the {@link SingleFrameGlTextureProcessor
* SingleFrameGlTextureProcessors} will cause the test to fail.
*
* <p>To run pixel difference-based tests on physical devices, please use a value of 5f, rather
* than 0.1f. This higher value will ignore some very small errors, but will allow for some
* differences caused by graphics implementations to be ignored. When the difference is close to
* the threshold, manually inspect expected/actual bitmaps to confirm failure, as it's possible
* this is caused by a difference in the codec or graphics implementation as opposed to a {@link
* GlFrameProcessor} issue.
* SingleFrameGlTextureProcessor} issue.
*/
public static final float MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE = 0.1f;
......
......@@ -41,10 +41,10 @@ public final class FrameProcessorChainTest {
public void getOutputSize_noOperation_returnsInputSize() throws Exception {
Size inputSize = new Size(200, 100);
FrameProcessorChain frameProcessorChain =
createFrameProcessorChainWithFakeFrameProcessors(
createFrameProcessorChainWithFakeTextureProcessors(
/* pixelWidthHeightRatio= */ 1f,
inputSize,
/* frameProcessorOutputSizes= */ ImmutableList.of());
/* textureProcessorOutputSizes= */ ImmutableList.of());
Size outputSize = frameProcessorChain.getOutputSize();
......@@ -56,10 +56,10 @@ public final class FrameProcessorChainTest {
public void getOutputSize_withWidePixels_returnsWiderOutputSize() throws Exception {
Size inputSize = new Size(200, 100);
FrameProcessorChain frameProcessorChain =
createFrameProcessorChainWithFakeFrameProcessors(
createFrameProcessorChainWithFakeTextureProcessors(
/* pixelWidthHeightRatio= */ 2f,
inputSize,
/* frameProcessorOutputSizes= */ ImmutableList.of());
/* textureProcessorOutputSizes= */ ImmutableList.of());
Size outputSize = frameProcessorChain.getOutputSize();
......@@ -71,10 +71,10 @@ public final class FrameProcessorChainTest {
public void getOutputSize_withTallPixels_returnsTallerOutputSize() throws Exception {
Size inputSize = new Size(200, 100);
FrameProcessorChain frameProcessorChain =
createFrameProcessorChainWithFakeFrameProcessors(
createFrameProcessorChainWithFakeTextureProcessors(
/* pixelWidthHeightRatio= */ .5f,
inputSize,
/* frameProcessorOutputSizes= */ ImmutableList.of());
/* textureProcessorOutputSizes= */ ImmutableList.of());
Size outputSize = frameProcessorChain.getOutputSize();
......@@ -83,32 +83,32 @@ public final class FrameProcessorChainTest {
}
@Test
public void getOutputSize_withOneFrameProcessor_returnsItsOutputSize() throws Exception {
public void getOutputSize_withOneTextureProcessor_returnsItsOutputSize() throws Exception {
Size inputSize = new Size(200, 100);
Size frameProcessorOutputSize = new Size(300, 250);
Size textureProcessorOutputSize = new Size(300, 250);
FrameProcessorChain frameProcessorChain =
createFrameProcessorChainWithFakeFrameProcessors(
createFrameProcessorChainWithFakeTextureProcessors(
/* pixelWidthHeightRatio= */ 1f,
inputSize,
/* frameProcessorOutputSizes= */ ImmutableList.of(frameProcessorOutputSize));
/* textureProcessorOutputSizes= */ ImmutableList.of(textureProcessorOutputSize));
Size frameProcessorChainOutputSize = frameProcessorChain.getOutputSize();
assertThat(frameProcessorChainOutputSize).isEqualTo(frameProcessorOutputSize);
assertThat(frameProcessorChainOutputSize).isEqualTo(textureProcessorOutputSize);
assertThat(frameProcessingException.get()).isNull();
}
@Test
public void getOutputSize_withThreeFrameProcessors_returnsLastOutputSize() throws Exception {
public void getOutputSize_withThreeTextureProcessors_returnsLastOutputSize() throws Exception {
Size inputSize = new Size(200, 100);
Size outputSize1 = new Size(300, 250);
Size outputSize2 = new Size(400, 244);
Size outputSize3 = new Size(150, 160);
FrameProcessorChain frameProcessorChain =
createFrameProcessorChainWithFakeFrameProcessors(
createFrameProcessorChainWithFakeTextureProcessors(
/* pixelWidthHeightRatio= */ 1f,
inputSize,
/* frameProcessorOutputSizes= */ ImmutableList.of(
/* textureProcessorOutputSizes= */ ImmutableList.of(
outputSize1, outputSize2, outputSize3));
Size frameProcessorChainOutputSize = frameProcessorChain.getOutputSize();
......@@ -117,12 +117,12 @@ public final class FrameProcessorChainTest {
assertThat(frameProcessingException.get()).isNull();
}
private FrameProcessorChain createFrameProcessorChainWithFakeFrameProcessors(
float pixelWidthHeightRatio, Size inputSize, List<Size> frameProcessorOutputSizes)
private FrameProcessorChain createFrameProcessorChainWithFakeTextureProcessors(
float pixelWidthHeightRatio, Size inputSize, List<Size> textureProcessorOutputSizes)
throws FrameProcessingException {
ImmutableList.Builder<GlEffect> effects = new ImmutableList.Builder<>();
for (Size element : frameProcessorOutputSizes) {
effects.add(() -> new FakeFrameProcessor(element));
for (Size element : textureProcessorOutputSizes) {
effects.add(() -> new FakeTextureProcessor(element));
}
return FrameProcessorChain.create(
getApplicationContext(),
......@@ -134,11 +134,11 @@ public final class FrameProcessorChainTest {
/* enableExperimentalHdrEditing= */ false);
}
private static class FakeFrameProcessor implements GlFrameProcessor {
private static class FakeTextureProcessor implements SingleFrameGlTextureProcessor {
private final Size outputSize;
private FakeFrameProcessor(Size outputSize) {
private FakeTextureProcessor(Size outputSize) {
this.outputSize = outputSize;
}
......
......@@ -34,7 +34,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Pixel test for frame processing via {@link MatrixTransformationFrameProcessor}.
* Pixel test for texture processing via {@link MatrixTransformationProcessor}.
*
* <p>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
......@@ -42,7 +42,7 @@ import org.junit.runner.RunWith;
* as recommended in {@link FrameProcessorChainPixelTest}.
*/
@RunWith(AndroidJUnit4.class)
public final class MatrixTransformationFrameProcessorPixelTest {
public final class MatrixTransformationProcessorPixelTest {
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 MatrixTransformationFrameProcessorPixelTest {
private final EGLDisplay eglDisplay = GlUtil.createEglDisplay();
private final EGLContext eglContext = GlUtil.createEglContext(eglDisplay);
private @MonotonicNonNull GlFrameProcessor matrixTransformationFrameProcessor;
private @MonotonicNonNull SingleFrameGlTextureProcessor matrixTransformationProcessor;
private int inputTexId;
private int outputTexId;
private int width;
......@@ -80,8 +80,8 @@ public final class MatrixTransformationFrameProcessorPixelTest {
@After
public void release() {
if (matrixTransformationFrameProcessor != null) {
matrixTransformationFrameProcessor.release();
if (matrixTransformationProcessor != null) {
matrixTransformationProcessor.release();
}
GlUtil.destroyEglContext(eglDisplay, eglContext);
}
......@@ -90,13 +90,12 @@ public final class MatrixTransformationFrameProcessorPixelTest {
public void drawFrame_noEdits_producesExpectedOutput() throws Exception {
String testId = "drawFrame_noEdits";
Matrix identityMatrix = new Matrix();
matrixTransformationFrameProcessor =
new MatrixTransformationFrameProcessor((long presentationTimeUs) -> identityMatrix);
matrixTransformationFrameProcessor.initialize(
getApplicationContext(), inputTexId, width, height);
matrixTransformationProcessor =
new MatrixTransformationProcessor((long presentationTimeUs) -> identityMatrix);
matrixTransformationProcessor.initialize(getApplicationContext(), inputTexId, width, height);
Bitmap expectedBitmap = BitmapTestUtil.readBitmap(ORIGINAL_PNG_ASSET_PATH);
matrixTransformationFrameProcessor.drawFrame(/* presentationTimeUs= */ 0);
matrixTransformationProcessor.drawFrame(/* presentationTimeUs= */ 0);
Bitmap actualBitmap =
BitmapTestUtil.createArgb8888BitmapFromCurrentGlFramebuffer(width, height);
......@@ -114,13 +113,12 @@ public final class MatrixTransformationFrameProcessorPixelTest {
String testId = "drawFrame_translateRight";
Matrix translateRightMatrix = new Matrix();
translateRightMatrix.postTranslate(/* dx= */ 1, /* dy= */ 0);
matrixTransformationFrameProcessor =
new MatrixTransformationFrameProcessor((long presentationTimeUs) -> translateRightMatrix);
matrixTransformationFrameProcessor.initialize(
getApplicationContext(), inputTexId, width, height);
matrixTransformationProcessor =
new MatrixTransformationProcessor((long presentationTimeUs) -> translateRightMatrix);
matrixTransformationProcessor.initialize(getApplicationContext(), inputTexId, width, height);
Bitmap expectedBitmap = BitmapTestUtil.readBitmap(TRANSLATE_RIGHT_PNG_ASSET_PATH);
matrixTransformationFrameProcessor.drawFrame(/* presentationTimeUs= */ 0);
matrixTransformationProcessor.drawFrame(/* presentationTimeUs= */ 0);
Bitmap actualBitmap =
BitmapTestUtil.createArgb8888BitmapFromCurrentGlFramebuffer(width, height);
......@@ -138,13 +136,12 @@ public final class MatrixTransformationFrameProcessorPixelTest {
String testId = "drawFrame_scaleNarrow";
Matrix scaleNarrowMatrix = new Matrix();
scaleNarrowMatrix.postScale(.5f, 1.2f);
matrixTransformationFrameProcessor =
new MatrixTransformationFrameProcessor((long presentationTimeUs) -> scaleNarrowMatrix);
matrixTransformationFrameProcessor.initialize(
getApplicationContext(), inputTexId, width, height);
matrixTransformationProcessor =
new MatrixTransformationProcessor((long presentationTimeUs) -> scaleNarrowMatrix);
matrixTransformationProcessor.initialize(getApplicationContext(), inputTexId, width, height);
Bitmap expectedBitmap = BitmapTestUtil.readBitmap(SCALE_NARROW_PNG_ASSET_PATH);
matrixTransformationFrameProcessor.drawFrame(/* presentationTimeUs= */ 0);
matrixTransformationProcessor.drawFrame(/* presentationTimeUs= */ 0);
Bitmap actualBitmap =
BitmapTestUtil.createArgb8888BitmapFromCurrentGlFramebuffer(width, height);
......@@ -162,13 +159,12 @@ public final class MatrixTransformationFrameProcessorPixelTest {
String testId = "drawFrame_rotate90";
Matrix rotate90Matrix = new Matrix();
rotate90Matrix.postRotate(/* degrees= */ 90);
matrixTransformationFrameProcessor =
new MatrixTransformationFrameProcessor((long presentationTimeUs) -> rotate90Matrix);
matrixTransformationFrameProcessor.initialize(
getApplicationContext(), inputTexId, width, height);
matrixTransformationProcessor =
new MatrixTransformationProcessor((long presentationTimeUs) -> rotate90Matrix);
matrixTransformationProcessor.initialize(getApplicationContext(), inputTexId, width, height);
Bitmap expectedBitmap = BitmapTestUtil.readBitmap(ROTATE_90_PNG_ASSET_PATH);
matrixTransformationFrameProcessor.drawFrame(/* presentationTimeUs= */ 0);
matrixTransformationProcessor.drawFrame(/* presentationTimeUs= */ 0);
Bitmap actualBitmap =
BitmapTestUtil.createArgb8888BitmapFromCurrentGlFramebuffer(width, height);
......
......@@ -19,7 +19,6 @@ import static com.google.android.exoplayer2.util.Assertions.checkArgument;
import static com.google.android.exoplayer2.util.Assertions.checkState;
import static com.google.android.exoplayer2.util.Assertions.checkStateNotNull;
import android.content.Context;
import android.graphics.Matrix;
import android.util.Size;
import com.google.android.exoplayer2.C;
......@@ -77,8 +76,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
*
* <p>Return values may be {@code 0} or {@code 90} degrees.
*
* <p>The frame processor must be {@linkplain GlFrameProcessor#initialize(Context, int, int, int)
* initialized}.
* <p>Should only be called after {@linkplain #configure(int, int) configuration}.
*/
public int getOutputRotationDegrees() {
checkState(
......
......@@ -27,7 +27,7 @@ import java.io.IOException;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
/** Copies frames from an external texture and applies color transformations for HDR if needed. */
/* package */ class ExternalCopyFrameProcessor implements GlFrameProcessor {
/* package */ class ExternalTextureProcessor implements SingleFrameGlTextureProcessor {
static {
GlUtil.glAssertionsEnabled = true;
......@@ -54,7 +54,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
private @MonotonicNonNull Size size;
private @MonotonicNonNull GlProgram glProgram;
public ExternalCopyFrameProcessor(boolean enableExperimentalHdrEditing) {
public ExternalTextureProcessor(boolean enableExperimentalHdrEditing) {
this.enableExperimentalHdrEditing = enableExperimentalHdrEditing;
}
......
......@@ -16,13 +16,15 @@
package com.google.android.exoplayer2.transformer;
/**
* Interface for a video frame effect with a {@link GlFrameProcessor} implementation.
* Interface for a video frame effect with a {@link SingleFrameGlTextureProcessor} implementation.
*
* <p>Implementations contain information specifying the effect and can be {@linkplain
* #toGlFrameProcessor() converted} to a {@link GlFrameProcessor} which applies the effect.
* #toGlTextureProcessor() converted} to a {@link SingleFrameGlTextureProcessor} which applies the
* effect.
*/
public interface GlEffect {
/** Returns a {@link GlFrameProcessor} that applies the the effect. */
GlFrameProcessor toGlFrameProcessor();
/** Returns a {@link SingleFrameGlTextureProcessor} that applies the effect. */
// TODO(b/227625423): use GlTextureProcessor here once this interface exists.
SingleFrameGlTextureProcessor toGlTextureProcessor();
}
......@@ -47,7 +47,7 @@ public interface GlMatrixTransformation extends GlEffect {
float[] getGlMatrixArray(long presentationTimeUs);
@Override
default GlFrameProcessor toGlFrameProcessor() {
return new MatrixTransformationFrameProcessor(this);
default SingleFrameGlTextureProcessor toGlTextureProcessor() {
return new MatrixTransformationProcessor(this);
}
}
......@@ -41,7 +41,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
* <p>The background color of the output frame will be black.
*/
@SuppressWarnings("FunctionalInterfaceClash") // b/228192298
/* package */ final class MatrixTransformationFrameProcessor implements GlFrameProcessor {
/* package */ final class MatrixTransformationProcessor implements SingleFrameGlTextureProcessor {
static {
GlUtil.glAssertionsEnabled = true;
......@@ -91,7 +91,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
* @param matrixTransformation A {@link MatrixTransformation} that specifies the transformation
* matrix to use for each frame.
*/
public MatrixTransformationFrameProcessor(MatrixTransformation matrixTransformation) {
public MatrixTransformationProcessor(MatrixTransformation matrixTransformation) {
this(ImmutableList.of(matrixTransformation));
}
......@@ -101,7 +101,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
* @param matrixTransformation A {@link GlMatrixTransformation} that specifies the transformation
* matrix to use for each frame.
*/
public MatrixTransformationFrameProcessor(GlMatrixTransformation matrixTransformation) {
public MatrixTransformationProcessor(GlMatrixTransformation matrixTransformation) {
this(ImmutableList.of(matrixTransformation));
}
......@@ -111,7 +111,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
* @param matrixTransformations The {@link GlMatrixTransformation GlMatrixTransformations} to
* apply to each frame in order.
*/
public MatrixTransformationFrameProcessor(
public MatrixTransformationProcessor(
ImmutableList<GlMatrixTransformation> matrixTransformations) {
this.matrixTransformations = matrixTransformations;
......
......@@ -32,7 +32,9 @@ import java.io.IOException;
* <li>{@link #release()}, upon conclusion of processing.
* </ol>
*/
public interface GlFrameProcessor {
// TODO(b/227625423): Add GlTextureProcessor interface for async texture processors and make this an
// abstract class with a default implementation of GlTextureProcessor methods.
public interface SingleFrameGlTextureProcessor {
/**
* Performs all initialization that requires OpenGL, such as, loading and compiling a GLSL shader
......@@ -52,7 +54,7 @@ public interface GlFrameProcessor {
/**
* Returns the output {@link Size} of frames processed through {@link #drawFrame(long)}.
*
* <p>This method may only be called after the frame processor has been {@link
* <p>This method may only be called after the texture processor has been {@link
* #initialize(Context, int, int, int) initialized}.
*/
Size getOutputSize();
......@@ -60,7 +62,7 @@ public interface GlFrameProcessor {
/**
* Draws one frame.
*
* <p>This method may only be called after the frame processor has been {@link
* <p>This method may only be called after the texture processor has been {@link
* #initialize(Context, int, int, int) initialized}. The caller is responsible for focussing the
* correct render target before calling this method.
*
......
......@@ -27,7 +27,7 @@ import org.junit.runner.RunWith;
/**
* Unit tests for {@link Presentation}.
*
* <p>See {@code PresentationFrameProcessorPixelTest} for pixel tests testing {@link Presentation}.
* <p>See {@code PresentationPixelTest} for pixel tests testing {@link Presentation}.
*/
@RunWith(AndroidJUnit4.class)
public final class PresentationTest {
......@@ -161,27 +161,27 @@ public final class PresentationTest {
@Test
public void configure_setAspectRatioAndCrop_throwsIllegalStateException() {
Presentation.Builder presentationFrameProcessor =
Presentation.Builder presentationBuilder =
new Presentation.Builder()
.setAspectRatio(/* aspectRatio= */ 2f, Presentation.LAYOUT_SCALE_TO_FIT);
assertThrows(
IllegalStateException.class,
() ->
presentationFrameProcessor.setCrop(
presentationBuilder.setCrop(
/* left= */ -.5f, /* right= */ .5f, /* bottom= */ .5f, /* top= */ 1f));
}
@Test
public void configure_setCropAndAspectRatio_throwsIllegalStateException() {
Presentation.Builder presentationFrameProcessor =
Presentation.Builder presentationBuilder =
new Presentation.Builder()
.setCrop(/* left= */ -.5f, /* right= */ .5f, /* bottom= */ .5f, /* top= */ 1f);
assertThrows(
IllegalStateException.class,
() ->
presentationFrameProcessor.setAspectRatio(
presentationBuilder.setAspectRatio(
/* aspectRatio= */ 2f, Presentation.LAYOUT_SCALE_TO_FIT));
}
}
......@@ -25,8 +25,8 @@ import org.junit.runner.RunWith;
/**
* Unit tests for {@link ScaleToFitTransformation}.
*
* <p>See {@code MatrixTransformationFrameProcessorPixelTest} for pixel tests testing {@link
* MatrixTransformationFrameProcessor} given a transformation matrix.
* <p>See {@code MatrixTransformationPixelTest} for pixel tests testing {@link
* MatrixTransformationProcessor} given a transformation matrix.
*/
@RunWith(AndroidJUnit4.class)
public final class ScaleToFitTransformationTest {
......
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