Use lower resolution bitmap for tests

The test file decompresses to about 48 MB, which can cause an
`OutOfMemoryError` on lower end devices.

Also, a test appears to apply a rotation to this bitmap without downscaling
first, leading to exceeding a maximum texture width/height of 4096 on some
devices.

Replace the test file with one that has a quarter of the original's
width/height so that these tests can pass reliably even on lower end
devices.

PiperOrigin-RevId: 554507185
This commit is contained in:
andrewlewis 2023-08-07 16:54:40 +00:00 committed by Tianyi Feng
parent 6e91f0d4c5
commit 691bf93032
11 changed files with 5 additions and 5 deletions

View File

@ -62,7 +62,7 @@ public final class DefaultVideoFrameProcessorPixelTest {
private static final String ORIGINAL_PNG_ASSET_PATH =
"media/bitmap/sample_mp4_first_frame/electrical_colors/original.png";
private static final String OVERLAY_PNG_ASSET_PATH = "media/bitmap/input_images/media3test.png";
private static final String IMAGE_PNG_ASSET_PATH = "media/bitmap/input_images/london.jpg";
private static final String IMAGE_JPG_ASSET_PATH = "media/bitmap/input_images/london.jpg";
private static final String IMAGE_TO_VIDEO_PNG_ASSET_PATH =
"media/bitmap/sample_mp4_first_frame/electrical_colors/london_image_to_video.png";
private static final String IMAGE_TO_CROPPED_VIDEO_PNG_ASSET_PATH =
@ -173,7 +173,7 @@ public final class DefaultVideoFrameProcessorPixelTest {
getDefaultFrameProcessorTestRunnerBuilder(testId)
.setInputColorInfo(ColorInfo.SRGB_BT709_FULL)
.build();
Bitmap originalBitmap = readBitmap(IMAGE_PNG_ASSET_PATH);
Bitmap originalBitmap = readBitmap(IMAGE_JPG_ASSET_PATH);
Bitmap expectedBitmap = readBitmap(IMAGE_TO_VIDEO_PNG_ASSET_PATH);
videoFrameProcessorTestRunner.queueInputBitmap(
@ -201,7 +201,7 @@ public final class DefaultVideoFrameProcessorPixelTest {
/* bottom= */ -0.5f,
/* top= */ 0.5f)))
.build();
Bitmap originalBitmap = readBitmap(IMAGE_PNG_ASSET_PATH);
Bitmap originalBitmap = readBitmap(IMAGE_JPG_ASSET_PATH);
Bitmap expectedBitmap = readBitmap(IMAGE_TO_CROPPED_VIDEO_PNG_ASSET_PATH);
videoFrameProcessorTestRunner.queueInputBitmap(
@ -228,7 +228,7 @@ public final class DefaultVideoFrameProcessorPixelTest {
.setInputColorInfo(ColorInfo.SRGB_BT709_FULL)
.setEffects(NO_OP_EFFECT)
.build();
Bitmap originalBitmap = readBitmap(IMAGE_PNG_ASSET_PATH);
Bitmap originalBitmap = readBitmap(IMAGE_JPG_ASSET_PATH);
videoFrameProcessorTestRunner.queueInputBitmap(
originalBitmap, C.MICROS_PER_SECOND, /* offsetToAddUs= */ 0L, /* frameRate= */ 1);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 MiB

After

Width:  |  Height:  |  Size: 235 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 MiB

After

Width:  |  Height:  |  Size: 885 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 MiB

After

Width:  |  Height:  |  Size: 255 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

@ -337,7 +337,7 @@ public class BitmapPixelTestUtil {
public static void maybeSaveTestBitmap(
String testId, String bitmapLabel, Bitmap bitmap, @Nullable String path) {
String fileName = testId + (bitmapLabel.isEmpty() ? "" : "_" + bitmapLabel) + ".png";
File file = null;
File file;
if (path != null) {
File folder = new File(path);