Merge "camera2: Add mandatory stream combinations for depth only cameras." into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
a0637ae24b
@@ -680,7 +680,7 @@ public abstract class CameraDevice implements AutoCloseable {
|
|||||||
* </table><br>
|
* </table><br>
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
*<p>Devices capable of streaming concurrently with other devices as described by
|
*<p>BACKWARD_COMPATIBLE devices capable of streaming concurrently with other devices as described by
|
||||||
* {@link android.hardware.camera2.CameraManager#getConcurrentCameraIds} have the
|
* {@link android.hardware.camera2.CameraManager#getConcurrentCameraIds} have the
|
||||||
* following guaranteed streams (when streaming concurrently with other devices)</p>
|
* following guaranteed streams (when streaming concurrently with other devices)</p>
|
||||||
*
|
*
|
||||||
@@ -696,10 +696,14 @@ public abstract class CameraDevice implements AutoCloseable {
|
|||||||
* </table><br>
|
* </table><br>
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
|
* <p> Devices which are not backwards-compatible, support a mandatory single stream of size sVGA with image format {@code DEPTH16} during concurrent operation.
|
||||||
|
*
|
||||||
* <p> For guaranteed concurrent stream configurations:</p>
|
* <p> For guaranteed concurrent stream configurations:</p>
|
||||||
* <p> s720p refers to the camera device's resolution for that format from {@link StreamConfigurationMap#getOutputSizes} or
|
* <p> sVGA refers to the camera device's maximum resolution for that format from {@link StreamConfigurationMap#getOutputSizes} or
|
||||||
|
* VGA resolution (640X480) whichever is lower. </p>
|
||||||
|
* <p> s720p refers to the camera device's maximum resolution for that format from {@link StreamConfigurationMap#getOutputSizes} or
|
||||||
* 720p(1280X720) whichever is lower. </p>
|
* 720p(1280X720) whichever is lower. </p>
|
||||||
* <p> s1440p refers to the camera device's resolution for that format from {@link StreamConfigurationMap#getOutputSizes} or
|
* <p> s1440p refers to the camera device's maximum resolution for that format from {@link StreamConfigurationMap#getOutputSizes} or
|
||||||
* 1440p(1920X1440) whichever is lower. </p>
|
* 1440p(1920X1440) whichever is lower. </p>
|
||||||
* <p>MONOCHROME-capability ({@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES}
|
* <p>MONOCHROME-capability ({@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES}
|
||||||
* includes {@link CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MONOCHROME MONOCHROME}) devices
|
* includes {@link CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MONOCHROME MONOCHROME}) devices
|
||||||
@@ -707,6 +711,7 @@ public abstract class CameraDevice implements AutoCloseable {
|
|||||||
* streams with {@code Y8} in all guaranteed stream combinations for the device's hardware level
|
* streams with {@code Y8} in all guaranteed stream combinations for the device's hardware level
|
||||||
* and capabilities.</p>
|
* and capabilities.</p>
|
||||||
*
|
*
|
||||||
|
*
|
||||||
* <p>Devices capable of outputting HEIC formats ({@link StreamConfigurationMap#getOutputFormats}
|
* <p>Devices capable of outputting HEIC formats ({@link StreamConfigurationMap#getOutputFormats}
|
||||||
* contains {@link android.graphics.ImageFormat#HEIC}) will support substituting {@code JPEG}
|
* contains {@link android.graphics.ImageFormat#HEIC}) will support substituting {@code JPEG}
|
||||||
* streams with {@code HEIC} in all guaranteed stream combinations for the device's hardware
|
* streams with {@code HEIC} in all guaranteed stream combinations for the device's hardware
|
||||||
|
|||||||
@@ -685,6 +685,12 @@ public final class MandatoryStreamCombination {
|
|||||||
"Standard still image capture"),
|
"Standard still image capture"),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private static StreamCombinationTemplate sConcurrentDepthOnlyStreamCombinations[] = {
|
||||||
|
new StreamCombinationTemplate(new StreamTemplate [] {
|
||||||
|
new StreamTemplate(ImageFormat.DEPTH16, SizeThreshold.VGA) },
|
||||||
|
"Depth capture for mesh based object rendering"),
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper builder class to generate a list of available mandatory stream combinations.
|
* Helper builder class to generate a list of available mandatory stream combinations.
|
||||||
* @hide
|
* @hide
|
||||||
@@ -729,19 +735,21 @@ public final class MandatoryStreamCombination {
|
|||||||
getAvailableMandatoryConcurrentStreamCombinations() {
|
getAvailableMandatoryConcurrentStreamCombinations() {
|
||||||
// Since concurrent streaming support is optional, we mandate these stream
|
// Since concurrent streaming support is optional, we mandate these stream
|
||||||
// combinations regardless of camera device capabilities.
|
// combinations regardless of camera device capabilities.
|
||||||
|
|
||||||
|
StreamCombinationTemplate []chosenStreamCombinations = sConcurrentStreamCombinations;
|
||||||
if (!isColorOutputSupported()) {
|
if (!isColorOutputSupported()) {
|
||||||
Log.v(TAG, "Device is not backward compatible!");
|
Log.v(TAG, "Device is not backward compatible, depth streams are mandatory!");
|
||||||
throw new IllegalArgumentException("Camera device which is not BACKWARD_COMPATIBLE"
|
chosenStreamCombinations = sConcurrentDepthOnlyStreamCombinations;
|
||||||
+ " cannot have mandatory concurrent streams");
|
|
||||||
}
|
}
|
||||||
|
Size sizeVGAp = new Size(640, 480);
|
||||||
Size size720p = new Size(1280, 720);
|
Size size720p = new Size(1280, 720);
|
||||||
Size size1440p = new Size(1920, 1440);
|
Size size1440p = new Size(1920, 1440);
|
||||||
|
|
||||||
ArrayList<MandatoryStreamCombination> availableConcurrentStreamCombinations =
|
ArrayList<MandatoryStreamCombination> availableConcurrentStreamCombinations =
|
||||||
new ArrayList<MandatoryStreamCombination>();
|
new ArrayList<MandatoryStreamCombination>();
|
||||||
availableConcurrentStreamCombinations.ensureCapacity(
|
availableConcurrentStreamCombinations.ensureCapacity(
|
||||||
sConcurrentStreamCombinations.length);
|
chosenStreamCombinations.length);
|
||||||
for (StreamCombinationTemplate combTemplate : sConcurrentStreamCombinations) {
|
for (StreamCombinationTemplate combTemplate : chosenStreamCombinations) {
|
||||||
ArrayList<MandatoryStreamInformation> streamsInfo =
|
ArrayList<MandatoryStreamInformation> streamsInfo =
|
||||||
new ArrayList<MandatoryStreamInformation>();
|
new ArrayList<MandatoryStreamInformation>();
|
||||||
streamsInfo.ensureCapacity(combTemplate.mStreamTemplates.length);
|
streamsInfo.ensureCapacity(combTemplate.mStreamTemplates.length);
|
||||||
@@ -753,6 +761,9 @@ public final class MandatoryStreamCombination {
|
|||||||
case s1440p:
|
case s1440p:
|
||||||
formatSize = size1440p;
|
formatSize = size1440p;
|
||||||
break;
|
break;
|
||||||
|
case VGA:
|
||||||
|
formatSize = sizeVGAp;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
formatSize = size720p;
|
formatSize = size720p;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user