From 964414602e7559b486d499dd46e7c15871deb31e Mon Sep 17 00:00:00 2001 From: Eino-Ville Talvala Date: Tue, 6 Feb 2018 11:41:55 -0800 Subject: [PATCH] Camera: Revise MOTION_TRACKING capability Simplify the API for the P release. Test: Revised Camera CTS passes Bug: 63629224 Change-Id: Icf19d25f841a9e3bede77c39ea5f98c933d72871 --- camera/ndk/include/camera/NdkCameraDevice.h | 29 ------- .../include/camera/NdkCameraMetadataTags.h | 52 ++---------- .../device3/Camera3Device.cpp | 84 ++++++------------- 3 files changed, 31 insertions(+), 134 deletions(-) diff --git a/camera/ndk/include/camera/NdkCameraDevice.h b/camera/ndk/include/camera/NdkCameraDevice.h index c0eb5c173a..f425830f0f 100644 --- a/camera/ndk/include/camera/NdkCameraDevice.h +++ b/camera/ndk/include/camera/NdkCameraDevice.h @@ -252,35 +252,6 @@ typedef enum { */ TEMPLATE_MANUAL = 6, - /** - * A template for selecting camera parameters that match TEMPLATE_PREVIEW as closely as - * possible while improving the camera output for motion tracking use cases. - * - *

This template is best used by applications that are frequently switching between motion - * tracking use cases and regular still capture use cases, to minimize the IQ changes - * when swapping use cases.

- * - *

This template is guaranteed to be supported on camera devices that support the - * {@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_MOTION_TRACKING} capability.

- * - * @see ACameraDevice_createCaptureRequest - */ - TEMPLATE_MOTION_TRACKING_PREVIEW = 7, - - /** - * A template for selecting camera parameters that maximize the quality of camera output for - * motion tracking use cases. - * - *

This template is best used by applications dedicated to motion tracking applications, - * which aren't concerned about fast switches between motion tracking and other use cases.

- * - *

This template is guaranteed to be supported on camera devices that support the - * {@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_MOTION_TRACKING} capability.

- * - * @see ACameraDevice_createCaptureRequest - */ - TEMPLATE_MOTION_TRACKING_BEST = 8, - } ACameraDevice_request_template; /** diff --git a/camera/ndk/include/camera/NdkCameraMetadataTags.h b/camera/ndk/include/camera/NdkCameraMetadataTags.h index 588e96a41f..d35a52bae7 100644 --- a/camera/ndk/include/camera/NdkCameraMetadataTags.h +++ b/camera/ndk/include/camera/NdkCameraMetadataTags.h @@ -2453,9 +2453,6 @@ typedef enum acamera_metadata_tag { * *

Different calibration methods and use cases can produce better or worse results * depending on the selected coordinate origin.

- *

For devices designed to support the MOTION_TRACKING capability, the GYROSCOPE origin - * makes device calibration and later usage by applications combining camera and gyroscope - * information together simpler.

*/ ACAMERA_LENS_POSE_REFERENCE = // byte (acamera_metadata_enum_android_lens_pose_reference_t) ACAMERA_LENS_START + 12, @@ -4565,7 +4562,7 @@ typedef enum acamera_metadata_tag { ACAMERA_STATISTICS_LENS_SHADING_MAP_MODE = // byte (acamera_metadata_enum_android_statistics_lens_shading_map_mode_t) ACAMERA_STATISTICS_START + 16, /** - *

Whether the camera device outputs the OIS data in output + *

A control for selecting whether OIS position information is included in output * result metadata.

* *

Type: byte (acamera_metadata_enum_android_statistics_ois_data_mode_t)

@@ -4578,7 +4575,7 @@ typedef enum acamera_metadata_tag { * *

When set to ON, * ACAMERA_STATISTICS_OIS_TIMESTAMPS, android.statistics.oisShiftPixelX, - * android.statistics.oisShiftPixelY will provide OIS data in the output result metadata.

+ * and android.statistics.oisShiftPixelY provide OIS data in the output result metadata.

* * @see ACAMERA_STATISTICS_OIS_TIMESTAMPS */ @@ -6601,7 +6598,7 @@ typedef enum acamera_metadata_enum_acamera_lens_pose_reference { /** *

The value of ACAMERA_LENS_POSE_TRANSLATION is relative to the optical center of * the largest camera device facing the same direction as this camera.

- *

This default value for API levels before Android P.

+ *

This is the default value for API levels before Android P.

* * @see ACAMERA_LENS_POSE_TRANSLATION */ @@ -6610,7 +6607,6 @@ typedef enum acamera_metadata_enum_acamera_lens_pose_reference { /** *

The value of ACAMERA_LENS_POSE_TRANSLATION is relative to the position of the * primary gyroscope of this Android device.

- *

This is the value reported by all devices that support the MOTION_TRACKING capability.

* * @see ACAMERA_LENS_POSE_TRANSLATION */ @@ -6974,46 +6970,12 @@ typedef enum acamera_metadata_enum_acamera_request_available_capabilities { ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT = 8, /** - *

The device supports controls and metadata required for accurate motion tracking for - * use cases such as augmented reality, electronic image stabilization, and so on.

- *

This means this camera device has accurate optical calibration and timestamps relative - * to the inertial sensors.

- *

This capability requires the camera device to support the following:

- * + *

The camera device supports the MOTION_TRACKING value for + * ACAMERA_CONTROL_CAPTURE_INTENT, which limits maximum exposure time to 20 ms.

+ *

This limits the motion blur of capture images, resulting in better image tracking + * results for use cases such as image stabilization or augmented reality.

* - * @see ACAMERA_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES * @see ACAMERA_CONTROL_CAPTURE_INTENT - * @see ACAMERA_LENS_INTRINSIC_CALIBRATION - * @see ACAMERA_LENS_POSE_REFERENCE - * @see ACAMERA_LENS_POSE_ROTATION - * @see ACAMERA_LENS_POSE_TRANSLATION - * @see ACAMERA_LENS_RADIAL_DISTORTION - * @see ACAMERA_SENSOR_EXPOSURE_TIME - * @see ACAMERA_SENSOR_INFO_TIMESTAMP_SOURCE - * @see ACAMERA_SENSOR_ROLLING_SHUTTER_SKEW */ ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_MOTION_TRACKING = 10, diff --git a/services/camera/libcameraservice/device3/Camera3Device.cpp b/services/camera/libcameraservice/device3/Camera3Device.cpp index 324201bbcc..59bb2e291a 100644 --- a/services/camera/libcameraservice/device3/Camera3Device.cpp +++ b/services/camera/libcameraservice/device3/Camera3Device.cpp @@ -676,8 +676,6 @@ status_t Camera3Device::dump(int fd, const Vector &args) { "TEMPLATE_VIDEO_SNAPSHOT", "TEMPLATE_ZERO_SHUTTER_LAG", "TEMPLATE_MANUAL", - "TEMPLATE_MOTION_TRACKING_PREVIEW", - "TEMPALTE_MOTION_TRACKING_BEST" }; for (int i = 1; i < CAMERA3_TEMPLATE_COUNT; i++) { @@ -3435,65 +3433,31 @@ status_t Camera3Device::HalInterface::constructDefaultRequestSettings( } }; hardware::Return err; - if (mHidlSession_3_4 != nullptr) { - device::V3_4::RequestTemplate id; - switch (templateId) { - case CAMERA3_TEMPLATE_PREVIEW: - id = device::V3_4::RequestTemplate::PREVIEW; - break; - case CAMERA3_TEMPLATE_STILL_CAPTURE: - id = device::V3_4::RequestTemplate::STILL_CAPTURE; - break; - case CAMERA3_TEMPLATE_VIDEO_RECORD: - id = device::V3_4::RequestTemplate::VIDEO_RECORD; - break; - case CAMERA3_TEMPLATE_VIDEO_SNAPSHOT: - id = device::V3_4::RequestTemplate::VIDEO_SNAPSHOT; - break; - case CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG: - id = device::V3_4::RequestTemplate::ZERO_SHUTTER_LAG; - break; - case CAMERA3_TEMPLATE_MANUAL: - id = device::V3_4::RequestTemplate::MANUAL; - break; - case CAMERA3_TEMPLATE_MOTION_TRACKING_PREVIEW: - id = device::V3_4::RequestTemplate::MOTION_TRACKING_PREVIEW; - break; - case CAMERA3_TEMPLATE_MOTION_TRACKING_BEST: - id = device::V3_4::RequestTemplate::MOTION_TRACKING_BEST; - break; - default: - // Unknown template ID - return BAD_VALUE; - } - err = mHidlSession_3_4->constructDefaultRequestSettings_3_4(id, requestCallback); - } else { - RequestTemplate id; - switch (templateId) { - case CAMERA3_TEMPLATE_PREVIEW: - id = RequestTemplate::PREVIEW; - break; - case CAMERA3_TEMPLATE_STILL_CAPTURE: - id = RequestTemplate::STILL_CAPTURE; - break; - case CAMERA3_TEMPLATE_VIDEO_RECORD: - id = RequestTemplate::VIDEO_RECORD; - break; - case CAMERA3_TEMPLATE_VIDEO_SNAPSHOT: - id = RequestTemplate::VIDEO_SNAPSHOT; - break; - case CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG: - id = RequestTemplate::ZERO_SHUTTER_LAG; - break; - case CAMERA3_TEMPLATE_MANUAL: - id = RequestTemplate::MANUAL; - break; - default: - // Unknown template ID, or this HAL is too old to support it - return BAD_VALUE; - } - err = mHidlSession->constructDefaultRequestSettings(id, requestCallback); + RequestTemplate id; + switch (templateId) { + case CAMERA3_TEMPLATE_PREVIEW: + id = RequestTemplate::PREVIEW; + break; + case CAMERA3_TEMPLATE_STILL_CAPTURE: + id = RequestTemplate::STILL_CAPTURE; + break; + case CAMERA3_TEMPLATE_VIDEO_RECORD: + id = RequestTemplate::VIDEO_RECORD; + break; + case CAMERA3_TEMPLATE_VIDEO_SNAPSHOT: + id = RequestTemplate::VIDEO_SNAPSHOT; + break; + case CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG: + id = RequestTemplate::ZERO_SHUTTER_LAG; + break; + case CAMERA3_TEMPLATE_MANUAL: + id = RequestTemplate::MANUAL; + break; + default: + // Unknown template ID, or this HAL is too old to support it + return BAD_VALUE; } + err = mHidlSession->constructDefaultRequestSettings(id, requestCallback); if (!err.isOk()) { ALOGE("%s: Transaction error: %s", __FUNCTION__, err.description().c_str());