From ac404c12d51b607bdfcac0d94928ed9120bd8e4f Mon Sep 17 00:00:00 2001 From: Jayant Chowdhary Date: Tue, 11 Feb 2020 20:37:22 -0800 Subject: [PATCH] camera2: Update spec for mandatory concurrent stream combinations. Bug: 77960042 Test: atest ConcurrentCameraTest.java Change-Id: I01fd6c5eab1ed8bc716be98c24a93d45f2ddaed3 Signed-off-by: Jayant Chowdhary --- .../hardware/camera2/CameraDevice.java | 16 ++++--- .../params/MandatoryStreamCombination.java | 44 ++++++++++++++----- 2 files changed, 43 insertions(+), 17 deletions(-) diff --git a/core/java/android/hardware/camera2/CameraDevice.java b/core/java/android/hardware/camera2/CameraDevice.java index 24d9311545334..cc0c1a3090382 100644 --- a/core/java/android/hardware/camera2/CameraDevice.java +++ b/core/java/android/hardware/camera2/CameraDevice.java @@ -688,17 +688,19 @@ public abstract class CameraDevice implements AutoCloseable { * Concurrent stream guaranteed configurations * Target 1Target 2Sample use case(s) * TypeMax sizeTypeMax size - * {@code YUV}{@code MAXIMUM} In-app video / image processing. - * {@code PRIV}{@code MAXIMUM} In-app viewfinder analysis. - * {@code YUV}{@code MAXIMUM} {@code YUV }{@code MAXIMUM} In-app video / processing with preview. - * {@code YUV}{@code MAXIMUM} {@code PRIV }{@code MAXIMUM} In-app video / processing with preview. - * {@code PRIV}{@code MAXIMUM} {@code PRIV }{@code MAXIMUM} Standard Recording. + * {@code YUV}{@code s1440p} In-app video / image processing. + * {@code PRIV}{@code s1440p} In-app viewfinder analysis. + * {@code JPEG}{@code s1440p} No viewfinder still image capture. + * {@code YUV / PRIV}{@code s720p} {@code JPEG}{@code s1440p} Standard still imaging. + * {@code YUV / PRIV}{@code s720p} {@code YUV / PRIV }{@code s1440p} In-app video / processing with preview. *
*

* - *

For guaranteed concurrent stream configurations, MAXIMUM refers to the camera device's - * resolution for that format from {@link StreamConfigurationMap#getOutputSizes} or + *

For guaranteed concurrent stream configurations:

+ *

s720p refers to the camera device's resolution for that format from {@link StreamConfigurationMap#getOutputSizes} or * 720p(1280X720) whichever is lower.

+ *

s1440p refers to the camera device's resolution for that format from {@link StreamConfigurationMap#getOutputSizes} or + * 1440p(1920X1440) whichever is lower.

*

MONOCHROME-capability ({@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES} * includes {@link CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MONOCHROME MONOCHROME}) devices * supporting {@link android.graphics.ImageFormat#Y8 Y8} support substituting {@code YUV} diff --git a/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java b/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java index 41e1443d68665..f0fab6a99d146 100644 --- a/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java +++ b/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java @@ -267,7 +267,7 @@ public final class MandatoryStreamCombination { mStreamsInformation.hashCode()); } - private static enum SizeThreshold { VGA, PREVIEW, RECORD, MAXIMUM, s720p } + private static enum SizeThreshold { VGA, PREVIEW, RECORD, MAXIMUM, s720p, s1440p } private static enum ReprocessType { NONE, PRIVATE, YUV } private static final class StreamTemplate { public int mFormat; @@ -651,23 +651,38 @@ public final class MandatoryStreamCombination { private static StreamCombinationTemplate sConcurrentStreamCombinations[] = { new StreamCombinationTemplate(new StreamTemplate [] { - new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.s720p) }, + new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.s1440p) }, "In-app video / image processing"), new StreamCombinationTemplate(new StreamTemplate [] { - new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.s720p) }, + new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.s1440p) }, "preview / preview to GPU"), + new StreamCombinationTemplate(new StreamTemplate [] { + new StreamTemplate(ImageFormat.JPEG, SizeThreshold.s1440p) }, + "No view-finder still image capture"), new StreamCombinationTemplate(new StreamTemplate [] { new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.s720p), - new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.s720p)}, + new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.s1440p)}, + "Two-input in app video / image processing"), + new StreamCombinationTemplate(new StreamTemplate [] { + new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.s720p), + new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.s1440p)}, + "High resolution video recording with preview"), + new StreamCombinationTemplate(new StreamTemplate [] { + new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.s720p), + new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.s1440p)}, + "In-app video / image processing with preview"), + new StreamCombinationTemplate(new StreamTemplate [] { + new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.s720p), + new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.s1440p)}, "In-app video / image processing with preview"), new StreamCombinationTemplate(new StreamTemplate [] { new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.s720p), - new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.s720p)}, - "In-app video / image processing with preview"), + new StreamTemplate(ImageFormat.JPEG, SizeThreshold.s1440p)}, + "Standard stil image capture"), new StreamCombinationTemplate(new StreamTemplate [] { - new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.s720p), - new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.s720p)}, - "Standard Recording"), + new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.s720p), + new StreamTemplate(ImageFormat.JPEG, SizeThreshold.s1440p)}, + "Standard still image capture"), }; /** @@ -720,6 +735,7 @@ public final class MandatoryStreamCombination { + " cannot have mandatory concurrent streams"); } Size size720p = new Size(1280, 720); + Size size1440p = new Size(1920, 1440); ArrayList availableConcurrentStreamCombinations = new ArrayList(); @@ -732,8 +748,16 @@ public final class MandatoryStreamCombination { for (StreamTemplate template : combTemplate.mStreamTemplates) { MandatoryStreamInformation streamInfo; List sizes = new ArrayList(); + Size formatSize = null; + switch (template.mSizeThreshold) { + case s1440p: + formatSize = size1440p; + break; + default: + formatSize = size720p; + } Size sizeChosen = - getMinSize(size720p, + getMinSize(formatSize, getMaxSize(mStreamConfigMap.getOutputSizes(template.mFormat))); sizes.add(sizeChosen); try {