Merge "Camera: Add new hidden tag for multiResolutionStream support" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
29ebb3033c
@@ -3165,6 +3165,33 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
|
|||||||
public static final Key<android.hardware.camera2.params.MandatoryStreamCombination[]> SCALER_MANDATORY_MAXIMUM_RESOLUTION_STREAM_COMBINATIONS =
|
public static final Key<android.hardware.camera2.params.MandatoryStreamCombination[]> SCALER_MANDATORY_MAXIMUM_RESOLUTION_STREAM_COMBINATIONS =
|
||||||
new Key<android.hardware.camera2.params.MandatoryStreamCombination[]>("android.scaler.mandatoryMaximumResolutionStreamCombinations", android.hardware.camera2.params.MandatoryStreamCombination[].class);
|
new Key<android.hardware.camera2.params.MandatoryStreamCombination[]>("android.scaler.mandatoryMaximumResolutionStreamCombinations", android.hardware.camera2.params.MandatoryStreamCombination[].class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Whether the camera device supports multi-resolution input or output streams</p>
|
||||||
|
* <p>A logical multi-camera or an ultra high resolution camera may support multi-resolution
|
||||||
|
* input or output streams. With multi-resolution output streams, the camera device is able
|
||||||
|
* to output different resolution images depending on the current active physical camera or
|
||||||
|
* pixel mode. With multi-resolution input streams, the camera device can reprocess images
|
||||||
|
* of different resolutions from different physical cameras or sensor pixel modes.</p>
|
||||||
|
* <p>When set to TRUE:
|
||||||
|
* * For a logical multi-camera, the camera framework derives
|
||||||
|
* {@link CameraCharacteristics#SCALER_MULTI_RESOLUTION_STREAM_CONFIGURATION_MAP android.scaler.multiResolutionStreamConfigurationMap} by combining the
|
||||||
|
* android.scaler.physicalCameraMultiResolutionStreamConfigurations from its physical
|
||||||
|
* cameras.
|
||||||
|
* * For an ultra-high resolution sensor camera, the camera framework directly copies
|
||||||
|
* the value of android.scaler.physicalCameraMultiResolutionStreamConfigurations to
|
||||||
|
* {@link CameraCharacteristics#SCALER_MULTI_RESOLUTION_STREAM_CONFIGURATION_MAP android.scaler.multiResolutionStreamConfigurationMap}.</p>
|
||||||
|
* <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
|
||||||
|
* <p><b>Limited capability</b> -
|
||||||
|
* Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
|
||||||
|
* {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
|
||||||
|
*
|
||||||
|
* @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
|
||||||
|
* @see CameraCharacteristics#SCALER_MULTI_RESOLUTION_STREAM_CONFIGURATION_MAP
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final Key<Boolean> SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED =
|
||||||
|
new Key<Boolean>("android.scaler.multiResolutionStreamSupported", boolean.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>The area of the image sensor which corresponds to active pixels after any geometric
|
* <p>The area of the image sensor which corresponds to active pixels after any geometric
|
||||||
* distortion correction has been applied.</p>
|
* distortion correction has been applied.</p>
|
||||||
|
|||||||
@@ -379,17 +379,36 @@ public final class CameraManager {
|
|||||||
* <p>For a logical multi-camera, query the map between physical camera id and
|
* <p>For a logical multi-camera, query the map between physical camera id and
|
||||||
* the physical camera's multi-resolution stream configuration. This map is in turn
|
* the physical camera's multi-resolution stream configuration. This map is in turn
|
||||||
* combined to form the logical camera's multi-resolution stream configuration map.</p>
|
* combined to form the logical camera's multi-resolution stream configuration map.</p>
|
||||||
|
*
|
||||||
|
* <p>For an ultra high resolution camera, directly use
|
||||||
|
* android.scaler.physicalCameraMultiResolutionStreamConfigurations as the camera device's
|
||||||
|
* multi-resolution stream configuration map.</p>
|
||||||
*/
|
*/
|
||||||
private Map<String, StreamConfiguration[]> getPhysicalCameraMultiResolutionConfigs(
|
private Map<String, StreamConfiguration[]> getPhysicalCameraMultiResolutionConfigs(
|
||||||
CameraMetadataNative info, ICameraService cameraService)
|
String cameraId, CameraMetadataNative info, ICameraService cameraService)
|
||||||
throws CameraAccessException {
|
throws CameraAccessException {
|
||||||
HashMap<String, StreamConfiguration[]> multiResolutionStreamConfigurations =
|
HashMap<String, StreamConfiguration[]> multiResolutionStreamConfigurations =
|
||||||
new HashMap<String, StreamConfiguration[]>();
|
new HashMap<String, StreamConfiguration[]>();
|
||||||
|
|
||||||
|
Boolean multiResolutionStreamSupported = info.get(
|
||||||
|
CameraCharacteristics.SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED);
|
||||||
|
if (multiResolutionStreamSupported == null || !multiResolutionStreamSupported) {
|
||||||
|
return multiResolutionStreamConfigurations;
|
||||||
|
}
|
||||||
|
|
||||||
// Query the characteristics of all physical sub-cameras, and combine the multi-resolution
|
// Query the characteristics of all physical sub-cameras, and combine the multi-resolution
|
||||||
// stream configurations. Note that framework derived formats such as HEIC and DEPTH_JPEG
|
// stream configurations. Alternatively, for ultra-high resolution camera, direclty use
|
||||||
// aren't supported as multi-resolution input or output formats.
|
// its multi-resolution stream configurations. Note that framework derived formats such as
|
||||||
|
// HEIC and DEPTH_JPEG aren't supported as multi-resolution input or output formats.
|
||||||
Set<String> physicalCameraIds = info.getPhysicalCameraIds();
|
Set<String> physicalCameraIds = info.getPhysicalCameraIds();
|
||||||
|
if (physicalCameraIds.size() == 0 && info.isUltraHighResolutionSensor()) {
|
||||||
|
StreamConfiguration[] configs = info.get(CameraCharacteristics.
|
||||||
|
SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS);
|
||||||
|
if (configs != null) {
|
||||||
|
multiResolutionStreamConfigurations.put(cameraId, configs);
|
||||||
|
}
|
||||||
|
return multiResolutionStreamConfigurations;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
for (String physicalCameraId : physicalCameraIds) {
|
for (String physicalCameraId : physicalCameraIds) {
|
||||||
CameraMetadataNative physicalCameraInfo =
|
CameraMetadataNative physicalCameraInfo =
|
||||||
@@ -401,9 +420,6 @@ public final class CameraManager {
|
|||||||
multiResolutionStreamConfigurations.put(physicalCameraId, configs);
|
multiResolutionStreamConfigurations.put(physicalCameraId, configs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: If this is an ultra high resolution sensor camera, combine the multi-resolution
|
|
||||||
// stream combination from "info" as well.
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
ServiceSpecificException sse = new ServiceSpecificException(
|
ServiceSpecificException sse = new ServiceSpecificException(
|
||||||
ICameraService.ERROR_DISCONNECTED,
|
ICameraService.ERROR_DISCONNECTED,
|
||||||
@@ -468,7 +484,7 @@ public final class CameraManager {
|
|||||||
info.setDisplaySize(displaySize);
|
info.setDisplaySize(displaySize);
|
||||||
|
|
||||||
Map<String, StreamConfiguration[]> multiResolutionSizeMap =
|
Map<String, StreamConfiguration[]> multiResolutionSizeMap =
|
||||||
getPhysicalCameraMultiResolutionConfigs(info, cameraService);
|
getPhysicalCameraMultiResolutionConfigs(cameraId, info, cameraService);
|
||||||
if (multiResolutionSizeMap.size() > 0) {
|
if (multiResolutionSizeMap.size() > 0) {
|
||||||
info.setMultiResolutionStreamConfigurationMap(multiResolutionSizeMap);
|
info.setMultiResolutionStreamConfigurationMap(multiResolutionSizeMap);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -265,8 +265,18 @@ public class MultiResolutionImageReader implements AutoCloseable {
|
|||||||
* @return a {@link Surface} to use as the target for a capture request.
|
* @return a {@link Surface} to use as the target for a capture request.
|
||||||
*/
|
*/
|
||||||
public @NonNull Surface getSurface() {
|
public @NonNull Surface getSurface() {
|
||||||
//TODO: Pick the surface from the reader for default mode stream.
|
// Pick the surface of smallest size. This is necessary for an ultra high resolution
|
||||||
return mReaders[0].getSurface();
|
// camera not to default to maximum resolution pixel mode.
|
||||||
|
int minReaderSize = mReaders[0].getWidth() * mReaders[0].getHeight();
|
||||||
|
Surface candidateSurface = mReaders[0].getSurface();
|
||||||
|
for (int i = 1; i < mReaders.length; i++) {
|
||||||
|
int readerSize = mReaders[i].getWidth() * mReaders[i].getHeight();
|
||||||
|
if (readerSize < minReaderSize) {
|
||||||
|
minReaderSize = readerSize;
|
||||||
|
candidateSurface = mReaders[i].getSurface();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return candidateSurface;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1322,7 +1322,10 @@ public class CameraMetadataNative implements Parcelable {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isUltraHighResolutionSensor() {
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public boolean isUltraHighResolutionSensor() {
|
||||||
return isCapabilitySupported(
|
return isCapabilitySupported(
|
||||||
CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR);
|
CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR);
|
||||||
|
|
||||||
|
|||||||
@@ -90,7 +90,6 @@ public final class InputConfiguration {
|
|||||||
public InputConfiguration(@NonNull Collection<MultiResolutionStreamInfo> multiResolutionInputs,
|
public InputConfiguration(@NonNull Collection<MultiResolutionStreamInfo> multiResolutionInputs,
|
||||||
@Format int format) {
|
@Format int format) {
|
||||||
checkCollectionNotEmpty(multiResolutionInputs, "Input multi-resolution stream info");
|
checkCollectionNotEmpty(multiResolutionInputs, "Input multi-resolution stream info");
|
||||||
//TODO: Pick the default mode stream info for ultra-high resolution sensor camera
|
|
||||||
MultiResolutionStreamInfo info = multiResolutionInputs.iterator().next();
|
MultiResolutionStreamInfo info = multiResolutionInputs.iterator().next();
|
||||||
mWidth = info.getWidth();
|
mWidth = info.getWidth();
|
||||||
mHeight = info.getHeight();
|
mHeight = info.getHeight();
|
||||||
|
|||||||
@@ -353,7 +353,10 @@ public final class OutputConfiguration implements Parcelable {
|
|||||||
config.setPhysicalCameraId(streamInfo.getPhysicalCameraId());
|
config.setPhysicalCameraId(streamInfo.getPhysicalCameraId());
|
||||||
config.setMultiResolutionOutput();
|
config.setMultiResolutionOutput();
|
||||||
configs.add(config);
|
configs.add(config);
|
||||||
// TODO: Set sensor pixel mode for ultra high resolution sensor camera.
|
|
||||||
|
// No need to call addSensorPixelModeUsed for ultra high resolution sensor camera,
|
||||||
|
// because regular and max resolution output configurations are used for DEFAULT mode
|
||||||
|
// and MAX_RESOLUTION mode respectively by default.
|
||||||
}
|
}
|
||||||
|
|
||||||
return configs;
|
return configs;
|
||||||
|
|||||||
Reference in New Issue
Block a user