Test: Rename getBitmap to getBitmapAtPresentationTimeUs

PiperOrigin-RevId: 567683139
This commit is contained in:
huangdarwin 2023-09-22 12:04:27 -07:00 committed by Copybara-Service
parent 8a40952e1b
commit 444cb3fb3a
3 changed files with 9 additions and 7 deletions

View file

@ -135,7 +135,7 @@ public class FrameDropTest {
throws IOException { throws IOException {
for (int i = 0; i < presentationTimesUs.size(); i++) { for (int i = 0; i < presentationTimesUs.size(); i++) {
long presentationTimeUs = presentationTimesUs.get(i); long presentationTimeUs = presentationTimesUs.get(i);
Bitmap actualBitmap = textureBitmapReader.getBitmap(presentationTimeUs); Bitmap actualBitmap = textureBitmapReader.getBitmapAtPresentationTimeUs(presentationTimeUs);
Bitmap expectedBitmap = Bitmap expectedBitmap =
readBitmap(Util.formatInvariant("%s/pts_%d.png", ASSET_PATH, presentationTimeUs)); readBitmap(Util.formatInvariant("%s/pts_%d.png", ASSET_PATH, presentationTimeUs));
maybeSaveTestBitmap( maybeSaveTestBitmap(

View file

@ -69,7 +69,7 @@ public final class TextureBitmapReader implements VideoFrameProcessorTestRunner.
* @return The output {@link Bitmap} at a given {@code presentationTimeUs}. * @return The output {@link Bitmap} at a given {@code presentationTimeUs}.
* @throws IllegalStateException If no such bitmap is produced. * @throws IllegalStateException If no such bitmap is produced.
*/ */
public Bitmap getBitmap(long presentationTimeUs) { public Bitmap getBitmapAtPresentationTimeUs(long presentationTimeUs) {
return checkStateNotNull(outputTimestampsToBitmaps.get(presentationTimeUs)); return checkStateNotNull(outputTimestampsToBitmaps.get(presentationTimeUs));
} }
@ -81,7 +81,8 @@ public final class TextureBitmapReader implements VideoFrameProcessorTestRunner.
/** /**
* Reads the given {@code outputTexture}. * Reads the given {@code outputTexture}.
* *
* <p>The read result can be fetched by calling one of the {@link #getBitmap} methods. * <p>The read result can be fetched by calling {@link #getBitmapAtPresentationTimeUs} or {@link
* #getBitmap}.
* *
* <p>This implementation incorrectly marks the output Bitmap as {@link Bitmap#isPremultiplied() * <p>This implementation incorrectly marks the output Bitmap as {@link Bitmap#isPremultiplied()
* premultiplied}, even though OpenGL typically outputs only non-premultiplied alpha. Use {@link * premultiplied}, even though OpenGL typically outputs only non-premultiplied alpha. Use {@link
@ -110,7 +111,8 @@ public final class TextureBitmapReader implements VideoFrameProcessorTestRunner.
/** /**
* Reads the given {@code outputTexture} as one with unpremultiplied alpha. * Reads the given {@code outputTexture} as one with unpremultiplied alpha.
* *
* <p>The read result can be fetched by calling one of the {@link #getBitmap} methods. * <p>The read result can be fetched by calling {@link #getBitmapAtPresentationTimeUs} or {@link
* #getBitmap}.
*/ */
@RequiresApi(19) // BitmapPixelTestUtil#createArgb8888BitmapFromFocusedGlFramebuffer. @RequiresApi(19) // BitmapPixelTestUtil#createArgb8888BitmapFromFocusedGlFramebuffer.
public void readBitmapUnpremultipliedAlpha(GlTextureInfo outputTexture, long presentationTimeUs) public void readBitmapUnpremultipliedAlpha(GlTextureInfo outputTexture, long presentationTimeUs)

View file

@ -78,7 +78,7 @@ public class DefaultVideoFrameProcessorMultipleTextureOutputPixelTest {
TextureBitmapReader textureBitmapReader = checkNotNull(this.textureBitmapReader); TextureBitmapReader textureBitmapReader = checkNotNull(this.textureBitmapReader);
Set<Long> outputTimestamps = textureBitmapReader.getOutputTimestamps(); Set<Long> outputTimestamps = textureBitmapReader.getOutputTimestamps();
assertThat(outputTimestamps).containsExactlyElementsIn(inputTimestamps).inOrder(); assertThat(outputTimestamps).containsExactlyElementsIn(inputTimestamps).inOrder();
Bitmap actualBitmap = textureBitmapReader.getBitmap(/* presentationTimeUs= */ 1_000_000L); Bitmap actualBitmap = textureBitmapReader.getBitmapAtPresentationTimeUs(1_000_000L);
maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null); maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null);
float averagePixelAbsoluteDifference = float averagePixelAbsoluteDifference =
BitmapPixelTestUtil.getBitmapAveragePixelAbsoluteDifferenceArgb8888( BitmapPixelTestUtil.getBitmapAveragePixelAbsoluteDifferenceArgb8888(
@ -103,9 +103,9 @@ public class DefaultVideoFrameProcessorMultipleTextureOutputPixelTest {
TextureBitmapReader textureBitmapReader = checkNotNull(this.textureBitmapReader); TextureBitmapReader textureBitmapReader = checkNotNull(this.textureBitmapReader);
Set<Long> actualOutputTimestamps = textureBitmapReader.getOutputTimestamps(); Set<Long> actualOutputTimestamps = textureBitmapReader.getOutputTimestamps();
assertThat(actualOutputTimestamps).containsExactlyElementsIn(outputTimestamps).inOrder(); assertThat(actualOutputTimestamps).containsExactlyElementsIn(outputTimestamps).inOrder();
Bitmap actualBitmap1 = textureBitmapReader.getBitmap(/* presentationTimeUs= */ 1_000_000L); Bitmap actualBitmap1 = textureBitmapReader.getBitmapAtPresentationTimeUs(1_000_000L);
maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual1", actualBitmap1, /* path= */ null); maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual1", actualBitmap1, /* path= */ null);
Bitmap actualBitmap2 = textureBitmapReader.getBitmap(/* presentationTimeUs= */ 2_000_000L); Bitmap actualBitmap2 = textureBitmapReader.getBitmapAtPresentationTimeUs(2_000_000L);
maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual2", actualBitmap2, /* path= */ null); maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual2", actualBitmap2, /* path= */ null);
float averagePixelAbsoluteDifference1 = float averagePixelAbsoluteDifference1 =
BitmapPixelTestUtil.getBitmapAveragePixelAbsoluteDifferenceArgb8888( BitmapPixelTestUtil.getBitmapAveragePixelAbsoluteDifferenceArgb8888(