diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-10-14 23:06:31 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-10-14 23:06:31 +0000 |
commit | 6d76ff8bcf0c786c28d2a0f3e6aded0b4e39d497 (patch) | |
tree | a4b13fe9a8c4e71be7c2f052d818b57e655a7982 | |
parent | 1fb9d8846f0c9752351a16db4d556ea2d601b543 (diff) | |
parent | 366fac1e2ce02ccc7435eade0226ed70b44c01a3 (diff) | |
download | cts-android14-qpr1-s2-release.tar.gz |
Snap for 10950705 from 366fac1e2ce02ccc7435eade0226ed70b44c01a3 to udc-qpr1-releaseandroid-14.0.0_r27android-14.0.0_r26android-14.0.0_r25android-14.0.0_r24android-14.0.0_r23android-14.0.0_r22android-14.0.0_r21android-14.0.0_r20android-14.0.0_r19android-14.0.0_r18android-14.0.0_r17android-14.0.0_r16android14-qpr1-s2-releaseandroid14-qpr1-release
Change-Id: Ibcccffc8159006effeb1c4a6c5e5335c1f8bc20c
3 files changed, 45 insertions, 5 deletions
diff --git a/tests/camera/src/android/hardware/camera2/cts/LogicalCameraDeviceTest.java b/tests/camera/src/android/hardware/camera2/cts/LogicalCameraDeviceTest.java index e37e3117521..a9e0a58fa64 100644 --- a/tests/camera/src/android/hardware/camera2/cts/LogicalCameraDeviceTest.java +++ b/tests/camera/src/android/hardware/camera2/cts/LogicalCameraDeviceTest.java @@ -1035,9 +1035,16 @@ public final class LogicalCameraDeviceTest extends Camera2SurfaceViewTestCase { Rect activeArraySize = mStaticInfo.getActiveArraySizeChecked(); SizeF sensorSize = mStaticInfo.getValueFromKeyNonNull( CameraCharacteristics.SENSOR_INFO_PHYSICAL_SIZE); + Size logicalPixelArraySize = mStaticInfo.getValueFromKeyNonNull( + CameraCharacteristics.SENSOR_INFO_PIXEL_ARRAY_SIZE); + Rect logicalPreCorrActiveArraySize = mStaticInfo.getValueFromKeyNonNull( + CameraCharacteristics.SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE); + Float fovTransferRatio = logicalPreCorrActiveArraySize.width() * 1f / + logicalPixelArraySize.getWidth(); + Float logicalSensorWidth = sensorSize.getWidth() * fovTransferRatio; // Assume subject distance >> focal length, and subject distance >> camera baseline. - double fov = 2 * Math.toDegrees(Math.atan2(sensorSize.getWidth() * cropRegion.width() / + double fov = 2 * Math.toDegrees(Math.atan2(logicalSensorWidth * cropRegion.width() / (2 * zoomRatio * activeArraySize.width()), focalLength)); Map<String, CaptureResult> physicalResultsDual = @@ -1052,15 +1059,23 @@ public final class LogicalCameraDeviceTest extends Camera2SurfaceViewTestCase { SizeF physicalSensorSize = physicalStaticInfo.getValueFromKeyNonNull( CameraCharacteristics.SENSOR_INFO_PHYSICAL_SIZE); + Size physicalPixelArraySize = physicalStaticInfo.getValueFromKeyNonNull( + CameraCharacteristics.SENSOR_INFO_PIXEL_ARRAY_SIZE); + Rect physicalPreCorrActiveArraySize = physicalStaticInfo.getValueFromKeyNonNull( + CameraCharacteristics.SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE); + Float transferRatio = physicalPreCorrActiveArraySize.width() * 1f / + physicalPixelArraySize.getWidth(); + Float physicalSensorWidth = physicalSensorSize.getWidth() * transferRatio; + // Physical result metadata's ZOOM_RATIO is 1.0f. assertTrue("Physical result metadata ZOOM_RATIO should be 1.0f, but is " + physicalZoomRatio, Math.abs(physicalZoomRatio - 1.0f) < ZOOM_RATIO_THRESHOLD); double physicalFov = 2 * Math.toDegrees(Math.atan2( - physicalSensorSize.getWidth() * physicalCropRegion.width() / + physicalSensorWidth * physicalCropRegion.width() / (2 * physicalZoomRatio * physicalActiveArraySize.width()), physicalFocalLength)); - double maxPhysicalFov = 2 * Math.toDegrees(Math.atan2(physicalSensorSize.getWidth() / 2, + double maxPhysicalFov = 2 * Math.toDegrees(Math.atan2(physicalSensorWidth / 2, physicalFocalLength)); double expectedPhysicalFov = Math.min(maxPhysicalFov, fov); diff --git a/tests/media/common/src/android/mediav2/common/cts/CompareStreams.java b/tests/media/common/src/android/mediav2/common/cts/CompareStreams.java index 76745363f67..b6b906864a8 100644 --- a/tests/media/common/src/android/mediav2/common/cts/CompareStreams.java +++ b/tests/media/common/src/android/mediav2/common/cts/CompareStreams.java @@ -16,7 +16,9 @@ package android.mediav2.common.cts; +import static android.media.MediaCodecInfo.CodecCapabilities.COLOR_FormatYUVP010; import static android.mediav2.common.cts.DecodeStreamToYuv.findDecoderForStream; +import static android.mediav2.common.cts.DecodeStreamToYuv.getFormatInStream; import static android.mediav2.common.cts.DecodeStreamToYuv.getImage; import static android.mediav2.common.cts.VideoErrorManager.computeMSE; import static android.mediav2.common.cts.VideoErrorManager.computePSNR; @@ -31,6 +33,10 @@ import android.media.MediaExtractor; import android.media.MediaFormat; import android.util.Log; +import com.android.compatibility.common.util.MediaUtils; + +import org.junit.Assume; + import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -260,6 +266,21 @@ public class CompareStreams extends CodecDecoderTestBase { private void generateErrorStats() throws IOException, InterruptedException { if (!mGenerateStats) { + if (MediaUtils.isTv()) { + // Some TV devices support HDR10 display with VO instead of GPU. In this case, + // COLOR_FormatYUVP010 may not be supported. + MediaFormat format = mStreamFormat != null ? mStreamFormat : + getFormatInStream(mMediaType, mTestFile); + ArrayList<MediaFormat> formatList = new ArrayList<>(); + formatList.add(format); + boolean isHBD = doesAnyFormatHaveHDRProfile(mMediaType, formatList); + if (isHBD || mTestFile.contains("10bit")) { + if (!hasSupportForColorFormat(mCodecName, mMediaType, COLOR_FormatYUVP010)) { + Assume.assumeTrue("Could not validate the encoded output as" + + " COLOR_FormatYUVP010 is not supported by the decoder", false); + } + } + } if (mStreamFormat != null) { decodeToMemory(mStreamBuffer, mStreamBufferInfos, mStreamFormat, mCodecName); } else { diff --git a/tests/media/common/src/android/mediav2/common/cts/DecodeStreamToYuv.java b/tests/media/common/src/android/mediav2/common/cts/DecodeStreamToYuv.java index 97bcf73e316..5c3b741f1da 100644 --- a/tests/media/common/src/android/mediav2/common/cts/DecodeStreamToYuv.java +++ b/tests/media/common/src/android/mediav2/common/cts/DecodeStreamToYuv.java @@ -108,7 +108,7 @@ public class DecodeStreamToYuv extends CodecDecoderTestBase { .build(); } - static String findDecoderForStream(String mediaType, String file) throws IOException { + static MediaFormat getFormatInStream(String mediaType, String file) throws IOException { File tmp = new File(file); if (!tmp.exists()) { throw new FileNotFoundException("Test Setup Error, missing file: " + file); @@ -128,7 +128,11 @@ public class DecodeStreamToYuv extends CodecDecoderTestBase { throw new IllegalArgumentException( "No track with mediaType: " + mediaType + " found in file: " + file); } - return findDecoderForFormat(format); + return format; + } + + static String findDecoderForStream(String mediaType, String file) throws IOException { + return findDecoderForFormat(getFormatInStream(mediaType, file)); } static String findDecoderForFormat(MediaFormat format) { |