summaryrefslogtreecommitdiff
path: root/src/android/camera_device.cpp
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2020-10-08 16:01:35 +0200
committerJacopo Mondi <jacopo@jmondi.org>2020-10-26 17:51:56 +0100
commit0b5fecc74651cf3c4f551062f576bffbd1545d79 (patch)
treec3889047fbe0ef2240c643d7abcfb9cbf1fe680b /src/android/camera_device.cpp
parent5d91c8da5c41fafa42b844b8ec19f0c8fd95188b (diff)
android: camera_device: Handle NOISE_REDUCTION_MODES
Register the ANDROID_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES static metadata property inspecting the values retuned by the pipeline handler. Reserve in the static metadata pack enough space to support all the 5 available noise reduction modes Android defines. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/android/camera_device.cpp')
-rw-r--r--src/android/camera_device.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index cc25aae9..61d3ff8a 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -553,7 +553,7 @@ std::tuple<uint32_t, uint32_t> CameraDevice::calculateStaticMetadataSize()
* Currently: 51 entries, 687 bytes of static metadata
*/
uint32_t numEntries = 51;
- uint32_t byteSize = 687;
+ uint32_t byteSize = 691;
/*
* Calculate space occupation in bytes for dynamically built metadata
@@ -830,9 +830,18 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
&minFocusDistance, 1);
/* Noise reduction modes. */
- uint8_t noiseReductionModes = ANDROID_NOISE_REDUCTION_MODE_OFF;
- staticMetadata_->addEntry(ANDROID_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES,
- &noiseReductionModes, 1);
+ {
+ std::vector<uint8_t> data(5);
+ const auto &infoMap = controlsInfo.find(&controls::draft::NoiseReductionMode);
+ if (infoMap != controlsInfo.end()) {
+ for (const auto &value : infoMap->second.values())
+ data.push_back(value.get<int32_t>());
+ } else {
+ data.push_back(ANDROID_NOISE_REDUCTION_MODE_OFF);
+ }
+ staticMetadata_->addEntry(ANDROID_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES,
+ data.data(), data.size());
+ }
/* Scaler static metadata. */
float maxDigitalZoom = 1;