Add an SSIM test with 360p input

This test should run on all devices from API 21 (the media uses Baseline
profile level 3.0 H.264) to give us coverage of the full pipeline (forcing
re-encoding) and SSIM calculation on all devices.

PiperOrigin-RevId: 443650002
This commit is contained in:
andrewlewis 2022-04-22 14:31:09 +01:00 committed by Ian Baker
parent 0a378a4555
commit c8744ee9bd
3 changed files with 29 additions and 0 deletions

View File

@ -57,6 +57,10 @@ public final class AndroidTestUtil {
.setFrameRate(30.00f) .setFrameRate(30.00f)
.build(); .build();
/** Baseline profile level 3.0 H.264 stream, which should be supported on all devices. */
public static final String MP4_ASSET_WITH_INCREASING_TIMESTAMPS_360P_15S_URI_STRING =
"asset:///media/mp4/sample_with_increasing_timestamps_360p.mp4";
public static final String MP4_ASSET_SEF_URI_STRING = public static final String MP4_ASSET_SEF_URI_STRING =
"asset:///media/mp4/sample_sef_slow_motion.mp4"; "asset:///media/mp4/sample_sef_slow_motion.mp4";
public static final Format MP4_ASSET_SEF_FORMAT = public static final Format MP4_ASSET_SEF_FORMAT =

View File

@ -86,4 +86,29 @@ public final class TranscodeQualityTest {
assertThat(result.ssim).isGreaterThan(0.90); assertThat(result.ssim).isGreaterThan(0.90);
} }
@Test
public void transcodeAvcToAvc360p_ssimIsGreaterThan90Percent() throws Exception {
Context context = ApplicationProvider.getApplicationContext();
String testId = "transcodeAvcToAvc360p_ssim";
// Note: We never skip this test as the input and output formats should be within CDD
// requirements on all supported API versions.
Transformer transformer =
new Transformer.Builder(context)
.setTransformationRequest(
new TransformationRequest.Builder().setVideoMimeType(MimeTypes.VIDEO_H264).build())
.setEncoderFactory(AndroidTestUtil.FORCE_ENCODE_ENCODER_FACTORY)
.setRemoveAudio(true)
.build();
TransformationTestResult result =
new TransformerAndroidTestRunner.Builder(context, transformer)
.setCalculateSsim(true)
.build()
.run(testId, AndroidTestUtil.MP4_ASSET_WITH_INCREASING_TIMESTAMPS_360P_15S_URI_STRING);
assertThat(result.ssim).isGreaterThan(0.90);
}
} }