summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEllie Yang <shusyuan@google.com>2020-05-28 12:33:50 +0800
committerEllie Yang <shusyuan@google.com>2020-06-02 14:13:19 +0800
commit727e09bab6c16e3888bce93d41c00c5281605cc0 (patch)
tree1722059fcc84f88794088fc636eee54609abfbee
parent729a6769bb845849bf21669edaa5044d978b5e0c (diff)
downloadcamera-727e09bab6c16e3888bce93d41c00c5281605cc0.tar.gz
camera: Add capability to limit zoom ratio in HWL
Framework mandate the zoom ratio range in concurrent mode to be at least [1, maxDigitalZoom]. Each project may have different capabilities and decide to extend the supported concurrent zoom ratio range up to the complete zoom range. Therefore the decision of adjusting zoom ratio regarding concurrent mode should be done in HWL. Bug: 152354541 Test: GCA, CTS Change-Id: Ieb3fa31420c9972df5afb6476374dc5965ec9567 Merged-In: Ieb3fa31420c9972df5afb6476374dc5965ec9567
-rw-r--r--common/hal/hwl_interface/zoom_ratio_mapper_hwl.h3
-rw-r--r--common/hal/utils/zoom_ratio_mapper.cc12
2 files changed, 14 insertions, 1 deletions
diff --git a/common/hal/hwl_interface/zoom_ratio_mapper_hwl.h b/common/hal/hwl_interface/zoom_ratio_mapper_hwl.h
index 019074c..edfc825 100644
--- a/common/hal/hwl_interface/zoom_ratio_mapper_hwl.h
+++ b/common/hal/hwl_interface/zoom_ratio_mapper_hwl.h
@@ -27,6 +27,9 @@ class ZoomRatioMapperHwl {
public:
virtual ~ZoomRatioMapperHwl() = default;
+ // Limit zoom ratio if concurrent mode is on
+ virtual void LimitZoomRatioIfConcurrent(float* zoom_ratio) const = 0;
+
// Apply zoom ratio to capture request
virtual void UpdateCaptureRequest(CaptureRequest* request) = 0;
diff --git a/common/hal/utils/zoom_ratio_mapper.cc b/common/hal/utils/zoom_ratio_mapper.cc
index a8f2f28..8171f0d 100644
--- a/common/hal/utils/zoom_ratio_mapper.cc
+++ b/common/hal/utils/zoom_ratio_mapper.cc
@@ -16,9 +16,11 @@
#define LOG_TAG "GCH_ZoomRatioMapper"
-#include "zoom_ratio_mapper.h"
#include <log/log.h>
+#include <cmath>
+
#include "utils.h"
+#include "zoom_ratio_mapper.h"
namespace android {
namespace google_camera_hal {
@@ -140,6 +142,14 @@ void ZoomRatioMapper::ApplyZoomRatio(const Dimension& active_array_dimension,
zoom_ratio = zoom_ratio_range_.max;
}
+ if (zoom_ratio_mapper_hwl_ != nullptr && is_request) {
+ zoom_ratio_mapper_hwl_->LimitZoomRatioIfConcurrent(&zoom_ratio);
+ }
+
+ if (fabs(zoom_ratio - entry.data.f[0]) > 1e-9) {
+ metadata->Set(ANDROID_CONTROL_ZOOM_RATIO, &zoom_ratio, entry.count);
+ }
+
for (auto tag_id : kRectToConvert) {
UpdateRects(zoom_ratio, tag_id, active_array_dimension, is_request,
metadata);