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
@ -62,7 +62,7 @@ public final class DefaultVideoFrameProcessorPixelTest {
|
|||||||
private static final String ORIGINAL_PNG_ASSET_PATH =
|
private static final String ORIGINAL_PNG_ASSET_PATH =
|
||||||
"media/bitmap/sample_mp4_first_frame/electrical_colors/original.png";
|
"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 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 =
|
private static final String IMAGE_TO_VIDEO_PNG_ASSET_PATH =
|
||||||
"media/bitmap/sample_mp4_first_frame/electrical_colors/london_image_to_video.png";
|
"media/bitmap/sample_mp4_first_frame/electrical_colors/london_image_to_video.png";
|
||||||
private static final String IMAGE_TO_CROPPED_VIDEO_PNG_ASSET_PATH =
|
private static final String IMAGE_TO_CROPPED_VIDEO_PNG_ASSET_PATH =
|
||||||
@ -173,7 +173,7 @@ public final class DefaultVideoFrameProcessorPixelTest {
|
|||||||
getDefaultFrameProcessorTestRunnerBuilder(testId)
|
getDefaultFrameProcessorTestRunnerBuilder(testId)
|
||||||
.setInputColorInfo(ColorInfo.SRGB_BT709_FULL)
|
.setInputColorInfo(ColorInfo.SRGB_BT709_FULL)
|
||||||
.build();
|
.build();
|
||||||
Bitmap originalBitmap = readBitmap(IMAGE_PNG_ASSET_PATH);
|
Bitmap originalBitmap = readBitmap(IMAGE_JPG_ASSET_PATH);
|
||||||
Bitmap expectedBitmap = readBitmap(IMAGE_TO_VIDEO_PNG_ASSET_PATH);
|
Bitmap expectedBitmap = readBitmap(IMAGE_TO_VIDEO_PNG_ASSET_PATH);
|
||||||
|
|
||||||
videoFrameProcessorTestRunner.queueInputBitmap(
|
videoFrameProcessorTestRunner.queueInputBitmap(
|
||||||
@ -201,7 +201,7 @@ public final class DefaultVideoFrameProcessorPixelTest {
|
|||||||
/* bottom= */ -0.5f,
|
/* bottom= */ -0.5f,
|
||||||
/* top= */ 0.5f)))
|
/* top= */ 0.5f)))
|
||||||
.build();
|
.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);
|
Bitmap expectedBitmap = readBitmap(IMAGE_TO_CROPPED_VIDEO_PNG_ASSET_PATH);
|
||||||
|
|
||||||
videoFrameProcessorTestRunner.queueInputBitmap(
|
videoFrameProcessorTestRunner.queueInputBitmap(
|
||||||
@ -228,7 +228,7 @@ public final class DefaultVideoFrameProcessorPixelTest {
|
|||||||
.setInputColorInfo(ColorInfo.SRGB_BT709_FULL)
|
.setInputColorInfo(ColorInfo.SRGB_BT709_FULL)
|
||||||
.setEffects(NO_OP_EFFECT)
|
.setEffects(NO_OP_EFFECT)
|
||||||
.build();
|
.build();
|
||||||
Bitmap originalBitmap = readBitmap(IMAGE_PNG_ASSET_PATH);
|
Bitmap originalBitmap = readBitmap(IMAGE_JPG_ASSET_PATH);
|
||||||
|
|
||||||
videoFrameProcessorTestRunner.queueInputBitmap(
|
videoFrameProcessorTestRunner.queueInputBitmap(
|
||||||
originalBitmap, C.MICROS_PER_SECOND, /* offsetToAddUs= */ 0L, /* frameRate= */ 1);
|
originalBitmap, C.MICROS_PER_SECOND, /* offsetToAddUs= */ 0L, /* frameRate= */ 1);
|
||||||
|
Before Width: | Height: | Size: 2.3 MiB After Width: | Height: | Size: 235 KiB |
Before Width: | Height: | Size: 11 MiB After Width: | Height: | Size: 885 KiB |
Before Width: | Height: | Size: 3.1 MiB After Width: | Height: | Size: 255 KiB |
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 47 KiB |
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 33 KiB |
@ -337,7 +337,7 @@ public class BitmapPixelTestUtil {
|
|||||||
public static void maybeSaveTestBitmap(
|
public static void maybeSaveTestBitmap(
|
||||||
String testId, String bitmapLabel, Bitmap bitmap, @Nullable String path) {
|
String testId, String bitmapLabel, Bitmap bitmap, @Nullable String path) {
|
||||||
String fileName = testId + (bitmapLabel.isEmpty() ? "" : "_" + bitmapLabel) + ".png";
|
String fileName = testId + (bitmapLabel.isEmpty() ? "" : "_" + bitmapLabel) + ".png";
|
||||||
File file = null;
|
File file;
|
||||||
|
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
File folder = new File(path);
|
File folder = new File(path);
|
||||||
|