mirror of
https://github.com/androidx/media.git
synced 2025-05-04 14:10:40 +08:00
Effect: Decouple GlEffectsFrameProcessorTestRunner from GLEffects.
This is necessary in order to move HDR to SDR tone-mapping tests to transformer/mh, and to move the test runner to androidx.media3.test-utils, which should not have to include androidx.media3.effects. PiperOrigin-RevId: 504607929
This commit is contained in:
parent
2d7ddccebb
commit
a2521bff07
@ -50,7 +50,6 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -107,21 +106,20 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
/** Input PQ video of which we only use the first frame. */
|
/** Input PQ video of which we only use the first frame. */
|
||||||
private static final String INPUT_PQ_MP4_ASSET_STRING = "media/mp4/hdr10-1080p.mp4";
|
private static final String INPUT_PQ_MP4_ASSET_STRING = "media/mp4/hdr10-1080p.mp4";
|
||||||
|
|
||||||
private @MonotonicNonNull GlEffectsFrameProcessorTestRunner glEffectsFrameProcessorTestRunner;
|
private @MonotonicNonNull FrameProcessorTestRunner frameProcessorTestRunner;
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void release() {
|
public void release() {
|
||||||
checkNotNull(glEffectsFrameProcessorTestRunner).release();
|
checkNotNull(frameProcessorTestRunner).release();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void noEffects_matchesGoldenFile() throws Exception {
|
public void noEffects_matchesGoldenFile() throws Exception {
|
||||||
String testId = "noEffects_matchesGoldenFile";
|
String testId = "noEffects_matchesGoldenFile";
|
||||||
glEffectsFrameProcessorTestRunner =
|
frameProcessorTestRunner = getDefaultFrameProcessorTestRunnerBuilder(testId).build();
|
||||||
new GlEffectsFrameProcessorTestRunner.Builder(testId).build();
|
|
||||||
Bitmap expectedBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH);
|
Bitmap expectedBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH);
|
||||||
|
|
||||||
Bitmap actualBitmap = glEffectsFrameProcessorTestRunner.processFirstFrameAndEnd();
|
Bitmap actualBitmap = frameProcessorTestRunner.processFirstFrameAndEnd();
|
||||||
|
|
||||||
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
||||||
float averagePixelAbsoluteDifference =
|
float averagePixelAbsoluteDifference =
|
||||||
@ -132,13 +130,13 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
@Test
|
@Test
|
||||||
public void noEffects_withFrameCache_matchesGoldenFile() throws Exception {
|
public void noEffects_withFrameCache_matchesGoldenFile() throws Exception {
|
||||||
String testId = "noEffects_withFrameCache_matchesGoldenFile";
|
String testId = "noEffects_withFrameCache_matchesGoldenFile";
|
||||||
glEffectsFrameProcessorTestRunner =
|
frameProcessorTestRunner =
|
||||||
new GlEffectsFrameProcessorTestRunner.Builder(testId)
|
getDefaultFrameProcessorTestRunnerBuilder(testId)
|
||||||
.setEffects(new FrameCache(/* capacity= */ 5))
|
.setEffects(new FrameCache(/* capacity= */ 5))
|
||||||
.build();
|
.build();
|
||||||
Bitmap expectedBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH);
|
Bitmap expectedBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH);
|
||||||
|
|
||||||
Bitmap actualBitmap = glEffectsFrameProcessorTestRunner.processFirstFrameAndEnd();
|
Bitmap actualBitmap = frameProcessorTestRunner.processFirstFrameAndEnd();
|
||||||
|
|
||||||
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
||||||
float averagePixelAbsoluteDifference =
|
float averagePixelAbsoluteDifference =
|
||||||
@ -149,11 +147,11 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
@Test
|
@Test
|
||||||
public void setPixelWidthHeightRatio_matchesGoldenFile() throws Exception {
|
public void setPixelWidthHeightRatio_matchesGoldenFile() throws Exception {
|
||||||
String testId = "setPixelWidthHeightRatio_matchesGoldenFile";
|
String testId = "setPixelWidthHeightRatio_matchesGoldenFile";
|
||||||
glEffectsFrameProcessorTestRunner =
|
frameProcessorTestRunner =
|
||||||
new GlEffectsFrameProcessorTestRunner.Builder(testId).setPixelWidthHeightRatio(2f).build();
|
getDefaultFrameProcessorTestRunnerBuilder(testId).setPixelWidthHeightRatio(2f).build();
|
||||||
Bitmap expectedBitmap = readBitmap(SCALE_WIDE_PNG_ASSET_PATH);
|
Bitmap expectedBitmap = readBitmap(SCALE_WIDE_PNG_ASSET_PATH);
|
||||||
|
|
||||||
Bitmap actualBitmap = glEffectsFrameProcessorTestRunner.processFirstFrameAndEnd();
|
Bitmap actualBitmap = frameProcessorTestRunner.processFirstFrameAndEnd();
|
||||||
|
|
||||||
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
||||||
float averagePixelAbsoluteDifference =
|
float averagePixelAbsoluteDifference =
|
||||||
@ -166,13 +164,13 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
String testId = "matrixTransformation_matchesGoldenFile";
|
String testId = "matrixTransformation_matchesGoldenFile";
|
||||||
Matrix translateRightMatrix = new Matrix();
|
Matrix translateRightMatrix = new Matrix();
|
||||||
translateRightMatrix.postTranslate(/* dx= */ 1, /* dy= */ 0);
|
translateRightMatrix.postTranslate(/* dx= */ 1, /* dy= */ 0);
|
||||||
glEffectsFrameProcessorTestRunner =
|
frameProcessorTestRunner =
|
||||||
new GlEffectsFrameProcessorTestRunner.Builder(testId)
|
getDefaultFrameProcessorTestRunnerBuilder(testId)
|
||||||
.setEffects((MatrixTransformation) (long presentationTimeNs) -> translateRightMatrix)
|
.setEffects((MatrixTransformation) (long presentationTimeNs) -> translateRightMatrix)
|
||||||
.build();
|
.build();
|
||||||
Bitmap expectedBitmap = readBitmap(TRANSLATE_RIGHT_PNG_ASSET_PATH);
|
Bitmap expectedBitmap = readBitmap(TRANSLATE_RIGHT_PNG_ASSET_PATH);
|
||||||
|
|
||||||
Bitmap actualBitmap = glEffectsFrameProcessorTestRunner.processFirstFrameAndEnd();
|
Bitmap actualBitmap = frameProcessorTestRunner.processFirstFrameAndEnd();
|
||||||
|
|
||||||
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
||||||
float averagePixelAbsoluteDifference =
|
float averagePixelAbsoluteDifference =
|
||||||
@ -185,15 +183,15 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
String testId = "matrixAndScaleToFitTransformation_matchesGoldenFile";
|
String testId = "matrixAndScaleToFitTransformation_matchesGoldenFile";
|
||||||
Matrix translateRightMatrix = new Matrix();
|
Matrix translateRightMatrix = new Matrix();
|
||||||
translateRightMatrix.postTranslate(/* dx= */ 1, /* dy= */ 0);
|
translateRightMatrix.postTranslate(/* dx= */ 1, /* dy= */ 0);
|
||||||
glEffectsFrameProcessorTestRunner =
|
frameProcessorTestRunner =
|
||||||
new GlEffectsFrameProcessorTestRunner.Builder(testId)
|
getDefaultFrameProcessorTestRunnerBuilder(testId)
|
||||||
.setEffects(
|
.setEffects(
|
||||||
(MatrixTransformation) (long presentationTimeUs) -> translateRightMatrix,
|
(MatrixTransformation) (long presentationTimeUs) -> translateRightMatrix,
|
||||||
new ScaleToFitTransformation.Builder().setRotationDegrees(45).build())
|
new ScaleToFitTransformation.Builder().setRotationDegrees(45).build())
|
||||||
.build();
|
.build();
|
||||||
Bitmap expectedBitmap = readBitmap(TRANSLATE_THEN_ROTATE_PNG_ASSET_PATH);
|
Bitmap expectedBitmap = readBitmap(TRANSLATE_THEN_ROTATE_PNG_ASSET_PATH);
|
||||||
|
|
||||||
Bitmap actualBitmap = glEffectsFrameProcessorTestRunner.processFirstFrameAndEnd();
|
Bitmap actualBitmap = frameProcessorTestRunner.processFirstFrameAndEnd();
|
||||||
|
|
||||||
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
||||||
float averagePixelAbsoluteDifference =
|
float averagePixelAbsoluteDifference =
|
||||||
@ -206,15 +204,15 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
String testId = "scaleToFitAndMatrixTransformation_matchesGoldenFile";
|
String testId = "scaleToFitAndMatrixTransformation_matchesGoldenFile";
|
||||||
Matrix translateRightMatrix = new Matrix();
|
Matrix translateRightMatrix = new Matrix();
|
||||||
translateRightMatrix.postTranslate(/* dx= */ 1, /* dy= */ 0);
|
translateRightMatrix.postTranslate(/* dx= */ 1, /* dy= */ 0);
|
||||||
glEffectsFrameProcessorTestRunner =
|
frameProcessorTestRunner =
|
||||||
new GlEffectsFrameProcessorTestRunner.Builder(testId)
|
getDefaultFrameProcessorTestRunnerBuilder(testId)
|
||||||
.setEffects(
|
.setEffects(
|
||||||
new ScaleToFitTransformation.Builder().setRotationDegrees(45).build(),
|
new ScaleToFitTransformation.Builder().setRotationDegrees(45).build(),
|
||||||
(MatrixTransformation) (long presentationTimeUs) -> translateRightMatrix)
|
(MatrixTransformation) (long presentationTimeUs) -> translateRightMatrix)
|
||||||
.build();
|
.build();
|
||||||
Bitmap expectedBitmap = readBitmap(ROTATE_THEN_TRANSLATE_PNG_ASSET_PATH);
|
Bitmap expectedBitmap = readBitmap(ROTATE_THEN_TRANSLATE_PNG_ASSET_PATH);
|
||||||
|
|
||||||
Bitmap actualBitmap = glEffectsFrameProcessorTestRunner.processFirstFrameAndEnd();
|
Bitmap actualBitmap = frameProcessorTestRunner.processFirstFrameAndEnd();
|
||||||
|
|
||||||
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
||||||
float averagePixelAbsoluteDifference =
|
float averagePixelAbsoluteDifference =
|
||||||
@ -225,13 +223,13 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
@Test
|
@Test
|
||||||
public void presentation_createForHeight_matchesGoldenFile() throws Exception {
|
public void presentation_createForHeight_matchesGoldenFile() throws Exception {
|
||||||
String testId = "presentation_createForHeight_matchesGoldenFile";
|
String testId = "presentation_createForHeight_matchesGoldenFile";
|
||||||
glEffectsFrameProcessorTestRunner =
|
frameProcessorTestRunner =
|
||||||
new GlEffectsFrameProcessorTestRunner.Builder(testId)
|
getDefaultFrameProcessorTestRunnerBuilder(testId)
|
||||||
.setEffects(Presentation.createForHeight(480))
|
.setEffects(Presentation.createForHeight(480))
|
||||||
.build();
|
.build();
|
||||||
Bitmap expectedBitmap = readBitmap(REQUEST_OUTPUT_HEIGHT_PNG_ASSET_PATH);
|
Bitmap expectedBitmap = readBitmap(REQUEST_OUTPUT_HEIGHT_PNG_ASSET_PATH);
|
||||||
|
|
||||||
Bitmap actualBitmap = glEffectsFrameProcessorTestRunner.processFirstFrameAndEnd();
|
Bitmap actualBitmap = frameProcessorTestRunner.processFirstFrameAndEnd();
|
||||||
|
|
||||||
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
||||||
float averagePixelAbsoluteDifference =
|
float averagePixelAbsoluteDifference =
|
||||||
@ -242,8 +240,8 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
@Test
|
@Test
|
||||||
public void cropThenPresentation_matchesGoldenFile() throws Exception {
|
public void cropThenPresentation_matchesGoldenFile() throws Exception {
|
||||||
String testId = "cropThenPresentation_matchesGoldenFile";
|
String testId = "cropThenPresentation_matchesGoldenFile";
|
||||||
glEffectsFrameProcessorTestRunner =
|
frameProcessorTestRunner =
|
||||||
new GlEffectsFrameProcessorTestRunner.Builder(testId)
|
getDefaultFrameProcessorTestRunnerBuilder(testId)
|
||||||
.setEffects(
|
.setEffects(
|
||||||
new Crop(/* left= */ -.5f, /* right= */ .5f, /* bottom= */ -.5f, /* top= */ .5f),
|
new Crop(/* left= */ -.5f, /* right= */ .5f, /* bottom= */ -.5f, /* top= */ .5f),
|
||||||
Presentation.createForAspectRatio(
|
Presentation.createForAspectRatio(
|
||||||
@ -251,7 +249,7 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
.build();
|
.build();
|
||||||
Bitmap expectedBitmap = readBitmap(CROP_THEN_ASPECT_RATIO_PNG_ASSET_PATH);
|
Bitmap expectedBitmap = readBitmap(CROP_THEN_ASPECT_RATIO_PNG_ASSET_PATH);
|
||||||
|
|
||||||
Bitmap actualBitmap = glEffectsFrameProcessorTestRunner.processFirstFrameAndEnd();
|
Bitmap actualBitmap = frameProcessorTestRunner.processFirstFrameAndEnd();
|
||||||
|
|
||||||
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
||||||
float averagePixelAbsoluteDifference =
|
float averagePixelAbsoluteDifference =
|
||||||
@ -262,13 +260,13 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
@Test
|
@Test
|
||||||
public void scaleToFitTransformation_rotate45_matchesGoldenFile() throws Exception {
|
public void scaleToFitTransformation_rotate45_matchesGoldenFile() throws Exception {
|
||||||
String testId = "scaleToFitTransformation_rotate45_matchesGoldenFile";
|
String testId = "scaleToFitTransformation_rotate45_matchesGoldenFile";
|
||||||
glEffectsFrameProcessorTestRunner =
|
frameProcessorTestRunner =
|
||||||
new GlEffectsFrameProcessorTestRunner.Builder(testId)
|
getDefaultFrameProcessorTestRunnerBuilder(testId)
|
||||||
.setEffects(new ScaleToFitTransformation.Builder().setRotationDegrees(45).build())
|
.setEffects(new ScaleToFitTransformation.Builder().setRotationDegrees(45).build())
|
||||||
.build();
|
.build();
|
||||||
Bitmap expectedBitmap = readBitmap(ROTATE45_SCALE_TO_FIT_PNG_ASSET_PATH);
|
Bitmap expectedBitmap = readBitmap(ROTATE45_SCALE_TO_FIT_PNG_ASSET_PATH);
|
||||||
|
|
||||||
Bitmap actualBitmap = glEffectsFrameProcessorTestRunner.processFirstFrameAndEnd();
|
Bitmap actualBitmap = frameProcessorTestRunner.processFirstFrameAndEnd();
|
||||||
|
|
||||||
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
||||||
float averagePixelAbsoluteDifference =
|
float averagePixelAbsoluteDifference =
|
||||||
@ -279,8 +277,8 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
@Test
|
@Test
|
||||||
public void twoWrappedScaleToFitTransformations_matchesGoldenFile() throws Exception {
|
public void twoWrappedScaleToFitTransformations_matchesGoldenFile() throws Exception {
|
||||||
String testId = "twoWrappedScaleToFitTransformations_matchesGoldenFile";
|
String testId = "twoWrappedScaleToFitTransformations_matchesGoldenFile";
|
||||||
glEffectsFrameProcessorTestRunner =
|
frameProcessorTestRunner =
|
||||||
new GlEffectsFrameProcessorTestRunner.Builder(testId)
|
getDefaultFrameProcessorTestRunnerBuilder(testId)
|
||||||
.setEffects(
|
.setEffects(
|
||||||
new GlEffectWrapper(
|
new GlEffectWrapper(
|
||||||
new ScaleToFitTransformation.Builder().setRotationDegrees(45).build()),
|
new ScaleToFitTransformation.Builder().setRotationDegrees(45).build()),
|
||||||
@ -291,7 +289,7 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
.build();
|
.build();
|
||||||
Bitmap expectedBitmap = readBitmap(ROTATE_THEN_SCALE_PNG_ASSET_PATH);
|
Bitmap expectedBitmap = readBitmap(ROTATE_THEN_SCALE_PNG_ASSET_PATH);
|
||||||
|
|
||||||
Bitmap actualBitmap = glEffectsFrameProcessorTestRunner.processFirstFrameAndEnd();
|
Bitmap actualBitmap = frameProcessorTestRunner.processFirstFrameAndEnd();
|
||||||
|
|
||||||
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
||||||
float averagePixelAbsoluteDifference =
|
float averagePixelAbsoluteDifference =
|
||||||
@ -310,20 +308,20 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
}
|
}
|
||||||
full10StepRotationAndCenterCrop.add(centerCrop);
|
full10StepRotationAndCenterCrop.add(centerCrop);
|
||||||
|
|
||||||
glEffectsFrameProcessorTestRunner =
|
frameProcessorTestRunner =
|
||||||
new GlEffectsFrameProcessorTestRunner.Builder(testId)
|
getDefaultFrameProcessorTestRunnerBuilder(testId)
|
||||||
.setOutputFileLabel("centerCrop")
|
.setOutputFileLabel("centerCrop")
|
||||||
.setEffects(centerCrop)
|
.setEffects(centerCrop)
|
||||||
.build();
|
.build();
|
||||||
Bitmap centerCropResultBitmap = glEffectsFrameProcessorTestRunner.processFirstFrameAndEnd();
|
Bitmap centerCropResultBitmap = frameProcessorTestRunner.processFirstFrameAndEnd();
|
||||||
glEffectsFrameProcessorTestRunner.release();
|
frameProcessorTestRunner.release();
|
||||||
glEffectsFrameProcessorTestRunner =
|
frameProcessorTestRunner =
|
||||||
new GlEffectsFrameProcessorTestRunner.Builder(testId)
|
getDefaultFrameProcessorTestRunnerBuilder(testId)
|
||||||
.setOutputFileLabel("full10StepRotationAndCenterCrop")
|
.setOutputFileLabel("full10StepRotationAndCenterCrop")
|
||||||
.setEffects(full10StepRotationAndCenterCrop.build())
|
.setEffects(full10StepRotationAndCenterCrop.build())
|
||||||
.build();
|
.build();
|
||||||
Bitmap fullRotationAndCenterCropResultBitmap =
|
Bitmap fullRotationAndCenterCropResultBitmap =
|
||||||
glEffectsFrameProcessorTestRunner.processFirstFrameAndEnd();
|
frameProcessorTestRunner.processFirstFrameAndEnd();
|
||||||
|
|
||||||
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
||||||
float averagePixelAbsoluteDifference =
|
float averagePixelAbsoluteDifference =
|
||||||
@ -340,13 +338,11 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
new RgbAdjustment.Builder().setRedScale(5).build(),
|
new RgbAdjustment.Builder().setRedScale(5).build(),
|
||||||
new RgbAdjustment.Builder().setGreenScale(5).build(),
|
new RgbAdjustment.Builder().setGreenScale(5).build(),
|
||||||
new RgbAdjustment.Builder().setBlueScale(5).build());
|
new RgbAdjustment.Builder().setBlueScale(5).build());
|
||||||
glEffectsFrameProcessorTestRunner =
|
frameProcessorTestRunner =
|
||||||
new GlEffectsFrameProcessorTestRunner.Builder(testId)
|
getDefaultFrameProcessorTestRunnerBuilder(testId).setEffects(increaseBrightness).build();
|
||||||
.setEffects(increaseBrightness)
|
|
||||||
.build();
|
|
||||||
Bitmap expectedBitmap = readBitmap(INCREASE_BRIGHTNESS_PNG_ASSET_PATH);
|
Bitmap expectedBitmap = readBitmap(INCREASE_BRIGHTNESS_PNG_ASSET_PATH);
|
||||||
|
|
||||||
Bitmap actualBitmap = glEffectsFrameProcessorTestRunner.processFirstFrameAndEnd();
|
Bitmap actualBitmap = frameProcessorTestRunner.processFirstFrameAndEnd();
|
||||||
|
|
||||||
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
||||||
float averagePixelAbsoluteDifference =
|
float averagePixelAbsoluteDifference =
|
||||||
@ -370,24 +366,24 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
new RgbAdjustment.Builder().setBlueScale(5).build(),
|
new RgbAdjustment.Builder().setBlueScale(5).build(),
|
||||||
new Rotation(/* degrees= */ 90),
|
new Rotation(/* degrees= */ 90),
|
||||||
centerCrop);
|
centerCrop);
|
||||||
glEffectsFrameProcessorTestRunner =
|
frameProcessorTestRunner =
|
||||||
new GlEffectsFrameProcessorTestRunner.Builder(testId)
|
getDefaultFrameProcessorTestRunnerBuilder(testId)
|
||||||
.setOutputFileLabel("centerCrop")
|
.setOutputFileLabel("centerCrop")
|
||||||
.setEffects(
|
.setEffects(
|
||||||
new RgbAdjustment.Builder().setRedScale(5).setBlueScale(5).setGreenScale(5).build(),
|
new RgbAdjustment.Builder().setRedScale(5).setBlueScale(5).setGreenScale(5).build(),
|
||||||
centerCrop)
|
centerCrop)
|
||||||
.build();
|
.build();
|
||||||
Bitmap centerCropAndBrightnessIncreaseResultBitmap =
|
Bitmap centerCropAndBrightnessIncreaseResultBitmap =
|
||||||
glEffectsFrameProcessorTestRunner.processFirstFrameAndEnd();
|
frameProcessorTestRunner.processFirstFrameAndEnd();
|
||||||
|
|
||||||
glEffectsFrameProcessorTestRunner.release();
|
frameProcessorTestRunner.release();
|
||||||
glEffectsFrameProcessorTestRunner =
|
frameProcessorTestRunner =
|
||||||
new GlEffectsFrameProcessorTestRunner.Builder(testId)
|
getDefaultFrameProcessorTestRunnerBuilder(testId)
|
||||||
.setOutputFileLabel("full4StepRotationBrightnessIncreaseAndCenterCrop")
|
.setOutputFileLabel("full4StepRotationBrightnessIncreaseAndCenterCrop")
|
||||||
.setEffects(increaseBrightnessFullRotationCenterCrop)
|
.setEffects(increaseBrightnessFullRotationCenterCrop)
|
||||||
.build();
|
.build();
|
||||||
Bitmap fullRotationBrightnessIncreaseAndCenterCropResultBitmap =
|
Bitmap fullRotationBrightnessIncreaseAndCenterCropResultBitmap =
|
||||||
glEffectsFrameProcessorTestRunner.processFirstFrameAndEnd();
|
frameProcessorTestRunner.processFirstFrameAndEnd();
|
||||||
|
|
||||||
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
||||||
float averagePixelAbsoluteDifference =
|
float averagePixelAbsoluteDifference =
|
||||||
@ -417,24 +413,24 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
new Rotation(/* degrees= */ 90),
|
new Rotation(/* degrees= */ 90),
|
||||||
new FrameCache(/* capacity= */ 2),
|
new FrameCache(/* capacity= */ 2),
|
||||||
centerCrop);
|
centerCrop);
|
||||||
glEffectsFrameProcessorTestRunner =
|
frameProcessorTestRunner =
|
||||||
new GlEffectsFrameProcessorTestRunner.Builder(testId)
|
getDefaultFrameProcessorTestRunnerBuilder(testId)
|
||||||
.setOutputFileLabel("centerCrop")
|
.setOutputFileLabel("centerCrop")
|
||||||
.setEffects(
|
.setEffects(
|
||||||
new RgbAdjustment.Builder().setRedScale(5).setBlueScale(5).setGreenScale(5).build(),
|
new RgbAdjustment.Builder().setRedScale(5).setBlueScale(5).setGreenScale(5).build(),
|
||||||
centerCrop)
|
centerCrop)
|
||||||
.build();
|
.build();
|
||||||
Bitmap centerCropAndBrightnessIncreaseResultBitmap =
|
Bitmap centerCropAndBrightnessIncreaseResultBitmap =
|
||||||
glEffectsFrameProcessorTestRunner.processFirstFrameAndEnd();
|
frameProcessorTestRunner.processFirstFrameAndEnd();
|
||||||
glEffectsFrameProcessorTestRunner.release();
|
frameProcessorTestRunner.release();
|
||||||
glEffectsFrameProcessorTestRunner =
|
frameProcessorTestRunner =
|
||||||
new GlEffectsFrameProcessorTestRunner.Builder(testId)
|
getDefaultFrameProcessorTestRunnerBuilder(testId)
|
||||||
.setOutputFileLabel("full4StepRotationBrightnessIncreaseAndCenterCrop")
|
.setOutputFileLabel("full4StepRotationBrightnessIncreaseAndCenterCrop")
|
||||||
.setEffects(increaseBrightnessFullRotationCenterCrop)
|
.setEffects(increaseBrightnessFullRotationCenterCrop)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
Bitmap fullRotationBrightnessIncreaseAndCenterCropResultBitmap =
|
Bitmap fullRotationBrightnessIncreaseAndCenterCropResultBitmap =
|
||||||
glEffectsFrameProcessorTestRunner.processFirstFrameAndEnd();
|
frameProcessorTestRunner.processFirstFrameAndEnd();
|
||||||
|
|
||||||
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
||||||
float averagePixelAbsoluteDifference =
|
float averagePixelAbsoluteDifference =
|
||||||
@ -448,15 +444,15 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
@Test
|
@Test
|
||||||
public void grayscaleThenIncreaseRedChannel_matchesGoldenFile() throws Exception {
|
public void grayscaleThenIncreaseRedChannel_matchesGoldenFile() throws Exception {
|
||||||
String testId = "grayscaleThenIncreaseRedChannel_matchesGoldenFile";
|
String testId = "grayscaleThenIncreaseRedChannel_matchesGoldenFile";
|
||||||
glEffectsFrameProcessorTestRunner =
|
frameProcessorTestRunner =
|
||||||
new GlEffectsFrameProcessorTestRunner.Builder(testId)
|
getDefaultFrameProcessorTestRunnerBuilder(testId)
|
||||||
.setEffects(
|
.setEffects(
|
||||||
RgbFilter.createGrayscaleFilter(),
|
RgbFilter.createGrayscaleFilter(),
|
||||||
new RgbAdjustment.Builder().setRedScale(3).build())
|
new RgbAdjustment.Builder().setRedScale(3).build())
|
||||||
.build();
|
.build();
|
||||||
Bitmap expectedBitmap = readBitmap(GRAYSCALE_THEN_INCREASE_RED_CHANNEL_PNG_ASSET_PATH);
|
Bitmap expectedBitmap = readBitmap(GRAYSCALE_THEN_INCREASE_RED_CHANNEL_PNG_ASSET_PATH);
|
||||||
|
|
||||||
Bitmap actualBitmap = glEffectsFrameProcessorTestRunner.processFirstFrameAndEnd();
|
Bitmap actualBitmap = frameProcessorTestRunner.processFirstFrameAndEnd();
|
||||||
|
|
||||||
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
||||||
float averagePixelAbsoluteDifference =
|
float averagePixelAbsoluteDifference =
|
||||||
@ -481,15 +477,15 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
.setColorRange(C.COLOR_RANGE_LIMITED)
|
.setColorRange(C.COLOR_RANGE_LIMITED)
|
||||||
.setColorTransfer(C.COLOR_TRANSFER_GAMMA_2_2)
|
.setColorTransfer(C.COLOR_TRANSFER_GAMMA_2_2)
|
||||||
.build();
|
.build();
|
||||||
glEffectsFrameProcessorTestRunner =
|
frameProcessorTestRunner =
|
||||||
new GlEffectsFrameProcessorTestRunner.Builder(testId)
|
getDefaultFrameProcessorTestRunnerBuilder(testId)
|
||||||
.setVideoAssetPath(INPUT_HLG_MP4_ASSET_STRING)
|
.setVideoAssetPath(INPUT_HLG_MP4_ASSET_STRING)
|
||||||
.setInputColorInfo(hlgColor)
|
.setInputColorInfo(hlgColor)
|
||||||
.setOutputColorInfo(toneMapSdrColor)
|
.setOutputColorInfo(toneMapSdrColor)
|
||||||
.build();
|
.build();
|
||||||
Bitmap expectedBitmap = readBitmap(TONE_MAP_HLG_TO_SDR_PNG_ASSET_PATH);
|
Bitmap expectedBitmap = readBitmap(TONE_MAP_HLG_TO_SDR_PNG_ASSET_PATH);
|
||||||
|
|
||||||
Bitmap actualBitmap = glEffectsFrameProcessorTestRunner.processFirstFrameAndEnd();
|
Bitmap actualBitmap = frameProcessorTestRunner.processFirstFrameAndEnd();
|
||||||
|
|
||||||
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
||||||
float averagePixelAbsoluteDifference =
|
float averagePixelAbsoluteDifference =
|
||||||
@ -514,15 +510,15 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
.setColorRange(C.COLOR_RANGE_LIMITED)
|
.setColorRange(C.COLOR_RANGE_LIMITED)
|
||||||
.setColorTransfer(C.COLOR_TRANSFER_GAMMA_2_2)
|
.setColorTransfer(C.COLOR_TRANSFER_GAMMA_2_2)
|
||||||
.build();
|
.build();
|
||||||
glEffectsFrameProcessorTestRunner =
|
frameProcessorTestRunner =
|
||||||
new GlEffectsFrameProcessorTestRunner.Builder(testId)
|
getDefaultFrameProcessorTestRunnerBuilder(testId)
|
||||||
.setVideoAssetPath(INPUT_PQ_MP4_ASSET_STRING)
|
.setVideoAssetPath(INPUT_PQ_MP4_ASSET_STRING)
|
||||||
.setInputColorInfo(pqColor)
|
.setInputColorInfo(pqColor)
|
||||||
.setOutputColorInfo(toneMapSdrColor)
|
.setOutputColorInfo(toneMapSdrColor)
|
||||||
.build();
|
.build();
|
||||||
Bitmap expectedBitmap = readBitmap(TONE_MAP_PQ_TO_SDR_PNG_ASSET_PATH);
|
Bitmap expectedBitmap = readBitmap(TONE_MAP_PQ_TO_SDR_PNG_ASSET_PATH);
|
||||||
|
|
||||||
Bitmap actualBitmap = glEffectsFrameProcessorTestRunner.processFirstFrameAndEnd();
|
Bitmap actualBitmap = frameProcessorTestRunner.processFirstFrameAndEnd();
|
||||||
|
|
||||||
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
|
||||||
float averagePixelAbsoluteDifference =
|
float averagePixelAbsoluteDifference =
|
||||||
@ -533,41 +529,55 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
// TODO(b/227624622): Add a test for HDR input after BitmapPixelTestUtil can read HDR bitmaps,
|
// TODO(b/227624622): Add a test for HDR input after BitmapPixelTestUtil can read HDR bitmaps,
|
||||||
// using GlEffectWrapper to ensure usage of intermediate textures.
|
// using GlEffectWrapper to ensure usage of intermediate textures.
|
||||||
|
|
||||||
/* A test runner for {@link GlEffectsFrameProcessor} tests. */
|
/* A test runner for {@link FrameProcessor} tests. */
|
||||||
private static final class GlEffectsFrameProcessorTestRunner {
|
private static final class FrameProcessorTestRunner {
|
||||||
|
|
||||||
/** A builder for {@link GlEffectsFrameProcessorTestRunner} instances. */
|
/** A builder for {@link FrameProcessorTestRunner} instances. */
|
||||||
public static final class Builder {
|
public static final class Builder {
|
||||||
private final String testId;
|
private @MonotonicNonNull String testId;
|
||||||
private String outputFileLabel;
|
private FrameProcessor.@MonotonicNonNull Factory frameProcessorFactory;
|
||||||
private @Nullable ImmutableList<Effect> effects;
|
private @MonotonicNonNull String videoAssetPath;
|
||||||
private String videoAssetPath;
|
private @MonotonicNonNull String outputFileLabel;
|
||||||
|
private @MonotonicNonNull ImmutableList<Effect> effects;
|
||||||
private float pixelWidthHeightRatio;
|
private float pixelWidthHeightRatio;
|
||||||
private ColorInfo inputColorInfo;
|
private @MonotonicNonNull ColorInfo inputColorInfo;
|
||||||
private ColorInfo outputColorInfo;
|
private @MonotonicNonNull ColorInfo outputColorInfo;
|
||||||
|
|
||||||
/**
|
/** Creates a new instance with default values. */
|
||||||
* Creates a new instance with default values.
|
public Builder() {
|
||||||
*
|
|
||||||
* @param testId Test ID used to generate output files.
|
|
||||||
*/
|
|
||||||
public Builder(String testId) {
|
|
||||||
this.testId = testId;
|
|
||||||
outputFileLabel = "";
|
|
||||||
videoAssetPath = INPUT_SDR_MP4_ASSET_STRING;
|
|
||||||
pixelWidthHeightRatio = DEFAULT_PIXEL_WIDTH_HEIGHT_RATIO;
|
pixelWidthHeightRatio = DEFAULT_PIXEL_WIDTH_HEIGHT_RATIO;
|
||||||
inputColorInfo = ColorInfo.SDR_BT709_LIMITED;
|
|
||||||
outputColorInfo = ColorInfo.SDR_BT709_LIMITED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the effects used.
|
* Sets the test ID, used to generate output files.
|
||||||
*
|
*
|
||||||
* <p>The default value is an empty list.
|
* <p>This is a required value.
|
||||||
*/
|
*/
|
||||||
@CanIgnoreReturnValue
|
@CanIgnoreReturnValue
|
||||||
public Builder setEffects(List<Effect> effects) {
|
public Builder setTestId(String testId) {
|
||||||
this.effects = ImmutableList.copyOf(effects);
|
this.testId = testId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the {@link FrameProcessor.Factory}.
|
||||||
|
*
|
||||||
|
* <p>This is a required value.
|
||||||
|
*/
|
||||||
|
@CanIgnoreReturnValue
|
||||||
|
public Builder setFrameProcessorFactory(FrameProcessor.Factory frameProcessorFactory) {
|
||||||
|
this.frameProcessorFactory = frameProcessorFactory;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the input video asset path.
|
||||||
|
*
|
||||||
|
* <p>This is a required value.
|
||||||
|
*/
|
||||||
|
@CanIgnoreReturnValue
|
||||||
|
public Builder setVideoAssetPath(String videoAssetPath) {
|
||||||
|
this.videoAssetPath = videoAssetPath;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -590,19 +600,19 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
* <p>The default value is an empty list.
|
* <p>The default value is an empty list.
|
||||||
*/
|
*/
|
||||||
@CanIgnoreReturnValue
|
@CanIgnoreReturnValue
|
||||||
public Builder setEffects(Effect... effects) {
|
public Builder setEffects(List<Effect> effects) {
|
||||||
this.effects = ImmutableList.copyOf(effects);
|
this.effects = ImmutableList.copyOf(effects);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the input video asset path.
|
* Sets the effects used.
|
||||||
*
|
*
|
||||||
* <p>The default value is {@link #INPUT_SDR_MP4_ASSET_STRING}.
|
* <p>The default value is an empty list.
|
||||||
*/
|
*/
|
||||||
@CanIgnoreReturnValue
|
@CanIgnoreReturnValue
|
||||||
public Builder setVideoAssetPath(String videoAssetPath) {
|
public Builder setEffects(Effect... effects) {
|
||||||
this.videoAssetPath = videoAssetPath;
|
this.effects = ImmutableList.copyOf(effects);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -620,7 +630,7 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
/**
|
/**
|
||||||
* Sets the input color.
|
* Sets the input color.
|
||||||
*
|
*
|
||||||
* <p>The default value is {@link ColorInfo.SDR_BT709_LIMITED}.
|
* <p>The default value is {@link ColorInfo#SDR_BT709_LIMITED}.
|
||||||
*/
|
*/
|
||||||
@CanIgnoreReturnValue
|
@CanIgnoreReturnValue
|
||||||
public Builder setInputColorInfo(ColorInfo inputColorInfo) {
|
public Builder setInputColorInfo(ColorInfo inputColorInfo) {
|
||||||
@ -631,7 +641,7 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
/**
|
/**
|
||||||
* Sets the output color.
|
* Sets the output color.
|
||||||
*
|
*
|
||||||
* <p>The default value is {@link ColorInfo.SDR_BT709_LIMITED}.
|
* <p>The default value is {@link ColorInfo#SDR_BT709_LIMITED}.
|
||||||
*/
|
*/
|
||||||
@CanIgnoreReturnValue
|
@CanIgnoreReturnValue
|
||||||
public Builder setOutputColorInfo(ColorInfo outputColorInfo) {
|
public Builder setOutputColorInfo(ColorInfo outputColorInfo) {
|
||||||
@ -639,15 +649,20 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GlEffectsFrameProcessorTestRunner build() throws FrameProcessingException {
|
public FrameProcessorTestRunner build() throws FrameProcessingException {
|
||||||
return new GlEffectsFrameProcessorTestRunner(
|
checkStateNotNull(testId, "testId must be set.");
|
||||||
|
checkStateNotNull(frameProcessorFactory, "frameProcessorFactory must be set.");
|
||||||
|
checkStateNotNull(videoAssetPath, "videoAssetPath must be set.");
|
||||||
|
|
||||||
|
return new FrameProcessorTestRunner(
|
||||||
testId,
|
testId,
|
||||||
outputFileLabel,
|
frameProcessorFactory,
|
||||||
effects == null ? ImmutableList.of() : effects,
|
|
||||||
videoAssetPath,
|
videoAssetPath,
|
||||||
|
outputFileLabel == null ? "" : outputFileLabel,
|
||||||
|
effects == null ? ImmutableList.of() : effects,
|
||||||
pixelWidthHeightRatio,
|
pixelWidthHeightRatio,
|
||||||
inputColorInfo,
|
inputColorInfo == null ? ColorInfo.SDR_BT709_LIMITED : inputColorInfo,
|
||||||
outputColorInfo);
|
outputColorInfo == null ? ColorInfo.SDR_BT709_LIMITED : outputColorInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -661,68 +676,67 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
private static final int FRAME_PROCESSING_WAIT_MS = 5000;
|
private static final int FRAME_PROCESSING_WAIT_MS = 5000;
|
||||||
|
|
||||||
private final String testId;
|
private final String testId;
|
||||||
private final String outputFileLabel;
|
|
||||||
private final String videoAssetPath;
|
private final String videoAssetPath;
|
||||||
|
private final String outputFileLabel;
|
||||||
private final float pixelWidthHeightRatio;
|
private final float pixelWidthHeightRatio;
|
||||||
private final AtomicReference<FrameProcessingException> frameProcessingException;
|
private final AtomicReference<FrameProcessingException> frameProcessingException;
|
||||||
|
|
||||||
private final GlEffectsFrameProcessor glEffectsFrameProcessor;
|
private final FrameProcessor frameProcessor;
|
||||||
|
|
||||||
private volatile @MonotonicNonNull ImageReader outputImageReader;
|
private volatile @MonotonicNonNull ImageReader outputImageReader;
|
||||||
private volatile boolean frameProcessingEnded;
|
private volatile boolean frameProcessingEnded;
|
||||||
|
|
||||||
private GlEffectsFrameProcessorTestRunner(
|
private FrameProcessorTestRunner(
|
||||||
String testId,
|
String testId,
|
||||||
|
FrameProcessor.Factory frameProcessorFactory,
|
||||||
|
String videoAssetPath,
|
||||||
String outputFileLabel,
|
String outputFileLabel,
|
||||||
ImmutableList<Effect> effects,
|
ImmutableList<Effect> effects,
|
||||||
String videoAssetPath,
|
|
||||||
float pixelWidthHeightRatio,
|
float pixelWidthHeightRatio,
|
||||||
ColorInfo inputColorInfo,
|
ColorInfo inputColorInfo,
|
||||||
ColorInfo outputColorInfo)
|
ColorInfo outputColorInfo)
|
||||||
throws FrameProcessingException {
|
throws FrameProcessingException {
|
||||||
this.testId = testId;
|
this.testId = testId;
|
||||||
this.outputFileLabel = outputFileLabel;
|
|
||||||
this.videoAssetPath = videoAssetPath;
|
this.videoAssetPath = videoAssetPath;
|
||||||
|
this.outputFileLabel = outputFileLabel;
|
||||||
this.pixelWidthHeightRatio = pixelWidthHeightRatio;
|
this.pixelWidthHeightRatio = pixelWidthHeightRatio;
|
||||||
frameProcessingException = new AtomicReference<>();
|
frameProcessingException = new AtomicReference<>();
|
||||||
|
|
||||||
glEffectsFrameProcessor =
|
frameProcessor =
|
||||||
checkNotNull(
|
frameProcessorFactory.create(
|
||||||
new GlEffectsFrameProcessor.Factory()
|
getApplicationContext(),
|
||||||
.create(
|
effects,
|
||||||
getApplicationContext(),
|
DebugViewProvider.NONE,
|
||||||
effects,
|
inputColorInfo,
|
||||||
DebugViewProvider.NONE,
|
outputColorInfo,
|
||||||
inputColorInfo,
|
/* releaseFramesAutomatically= */ true,
|
||||||
outputColorInfo,
|
MoreExecutors.directExecutor(),
|
||||||
/* releaseFramesAutomatically= */ true,
|
new FrameProcessor.Listener() {
|
||||||
MoreExecutors.directExecutor(),
|
@Override
|
||||||
new FrameProcessor.Listener() {
|
public void onOutputSizeChanged(int width, int height) {
|
||||||
@Override
|
outputImageReader =
|
||||||
public void onOutputSizeChanged(int width, int height) {
|
ImageReader.newInstance(
|
||||||
outputImageReader =
|
width, height, PixelFormat.RGBA_8888, /* maxImages= */ 1);
|
||||||
ImageReader.newInstance(
|
checkNotNull(frameProcessor)
|
||||||
width, height, PixelFormat.RGBA_8888, /* maxImages= */ 1);
|
.setOutputSurfaceInfo(
|
||||||
checkNotNull(glEffectsFrameProcessor)
|
new SurfaceInfo(outputImageReader.getSurface(), width, height));
|
||||||
.setOutputSurfaceInfo(
|
}
|
||||||
new SurfaceInfo(outputImageReader.getSurface(), width, height));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onOutputFrameAvailable(long presentationTimeUs) {
|
public void onOutputFrameAvailable(long presentationTimeUs) {
|
||||||
// Do nothing as frames are released automatically.
|
// Do nothing as frames are released automatically.
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFrameProcessingError(FrameProcessingException exception) {
|
public void onFrameProcessingError(FrameProcessingException exception) {
|
||||||
frameProcessingException.set(exception);
|
frameProcessingException.set(exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFrameProcessingEnded() {
|
public void onFrameProcessingEnded() {
|
||||||
frameProcessingEnded = true;
|
frameProcessingEnded = true;
|
||||||
}
|
}
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bitmap processFirstFrameAndEnd() throws Exception {
|
public Bitmap processFirstFrameAndEnd() throws Exception {
|
||||||
@ -731,13 +745,13 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
new DecodeOneFrameUtil.Listener() {
|
new DecodeOneFrameUtil.Listener() {
|
||||||
@Override
|
@Override
|
||||||
public void onContainerExtracted(MediaFormat mediaFormat) {
|
public void onContainerExtracted(MediaFormat mediaFormat) {
|
||||||
glEffectsFrameProcessor.setInputFrameInfo(
|
frameProcessor.setInputFrameInfo(
|
||||||
new FrameInfo.Builder(
|
new FrameInfo.Builder(
|
||||||
mediaFormat.getInteger(MediaFormat.KEY_WIDTH),
|
mediaFormat.getInteger(MediaFormat.KEY_WIDTH),
|
||||||
mediaFormat.getInteger(MediaFormat.KEY_HEIGHT))
|
mediaFormat.getInteger(MediaFormat.KEY_HEIGHT))
|
||||||
.setPixelWidthHeightRatio(pixelWidthHeightRatio)
|
.setPixelWidthHeightRatio(pixelWidthHeightRatio)
|
||||||
.build());
|
.build());
|
||||||
glEffectsFrameProcessor.registerInputFrame();
|
frameProcessor.registerInputFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -745,8 +759,8 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
// Do nothing.
|
// Do nothing.
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
glEffectsFrameProcessor.getInputSurface());
|
frameProcessor.getInputSurface());
|
||||||
checkNotNull(glEffectsFrameProcessor).signalEndOfInput();
|
frameProcessor.signalEndOfInput();
|
||||||
Thread.sleep(FRAME_PROCESSING_WAIT_MS);
|
Thread.sleep(FRAME_PROCESSING_WAIT_MS);
|
||||||
|
|
||||||
assertThat(frameProcessingEnded).isTrue();
|
assertThat(frameProcessingEnded).isTrue();
|
||||||
@ -760,12 +774,19 @@ public final class GlEffectsFrameProcessorPixelTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void release() {
|
public void release() {
|
||||||
if (glEffectsFrameProcessor != null) {
|
if (frameProcessor != null) {
|
||||||
glEffectsFrameProcessor.release();
|
frameProcessor.release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FrameProcessorTestRunner.Builder getDefaultFrameProcessorTestRunnerBuilder(String testId) {
|
||||||
|
return new FrameProcessorTestRunner.Builder()
|
||||||
|
.setTestId(testId)
|
||||||
|
.setFrameProcessorFactory(new GlEffectsFrameProcessor.Factory())
|
||||||
|
.setVideoAssetPath(INPUT_SDR_MP4_ASSET_STRING);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies a counter-clockwise rotation while accounting for the aspect ratio difference between
|
* Specifies a counter-clockwise rotation while accounting for the aspect ratio difference between
|
||||||
* the input frame in pixel coordinates and NDC.
|
* the input frame in pixel coordinates and NDC.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user