summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJayant Chowdhary <jchowdhary@google.com>2022-09-07 09:09:07 -0700
committerMurtuza Raja <quic_mraja@quicinc.com>2023-02-17 20:01:45 +0530
commit5562ac7eb525c632774914eb2b1ee2152521e046 (patch)
treec7a72f54292d8b94afe4a84bb73303d7df5b1fd5
parent8bd9186f1db157471a8a2dd4390df04596c82c64 (diff)
camera2: Add non burst sizes to mandatory streams for ultra high resolution sensors
Bug: 240128812 Test: Vendor testing Test: RobustnessTest.java on cuttlefish CRs-Fixed: 3240337 Change-Id: I92047456a43d49c5354718ead10df2cbd60363e2 Signed-off-by: Jayant Chowdhary <jchowdhary@google.com> (cherry picked from commit 5a448c40c3af59d8e5e152cb31e9e70b0ec67e0c)
-rw-r--r--core/java/android/hardware/camera2/params/MandatoryStreamCombination.java27
1 files changed, 26 insertions, 1 deletions
diff --git a/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java b/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java
index e5b9cdb74d3b..956a474401ba 100644
--- a/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java
+++ b/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java
@@ -1723,7 +1723,17 @@ public final class MandatoryStreamCombination {
}
if (isUltraHighResolution) {
- sizes.add(getMaxSize(sm.getOutputSizes(formatChosen)));
+ Size [] outputSizes = sm.getOutputSizes(formatChosen);
+ Size [] highResolutionOutputSizes =
+ sm.getHighResolutionOutputSizes(formatChosen);
+ Size maxBurstSize = getMaxSizeOrNull(outputSizes);
+ Size maxHighResolutionSize = getMaxSizeOrNull(highResolutionOutputSizes);
+ Size chosenMaxSize =
+ maxBurstSize != null ? maxBurstSize : maxHighResolutionSize;
+ if (maxBurstSize != null && maxHighResolutionSize != null) {
+ chosenMaxSize = getMaxSize(maxBurstSize, maxHighResolutionSize);
+ }
+ sizes.add(chosenMaxSize);
} else {
if (formatChosen == ImageFormat.RAW_SENSOR) {
// RAW_SENSOR always has MAXIMUM threshold.
@@ -2126,6 +2136,21 @@ public final class MandatoryStreamCombination {
}
/**
+ * Get the largest size by area.
+ *
+ * @param sizes an array of sizes
+ *
+ * @return Largest Size or null if sizes was null or had 0 elements
+ */
+ public static @Nullable Size getMaxSizeOrNull(Size... sizes) {
+ if (sizes == null || sizes.length == 0) {
+ return null;
+ }
+
+ return getMaxSize(sizes);
+ }
+
+ /**
* Whether or not the hardware level reported by android.info.supportedHardwareLevel is
* at least the desired one (but could be higher)
*/