diff options
author | Minghui Tan <mhtan@google.com> | 2021-08-31 20:48:12 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-08-31 20:48:12 +0000 |
commit | 576893b7f47aa1a929f2e1cb9390864baee98420 (patch) | |
tree | bf3cfd4dc46924ec2e50615e4b266748f30d2600 | |
parent | 0c808bc945f4468674c2b19ba590de6785070b83 (diff) | |
parent | 8ab66269b7c01414852a552578e01062a329515f (diff) | |
download | camera-576893b7f47aa1a929f2e1cb9390864baee98420.tar.gz |
Add dimension requirement for software denoise. am: 8ab66269b7
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/google/camera/+/15717896
Change-Id: I706d6f72b0fa73a7bcbe78850641fcd756bb59ae
-rw-r--r-- | common/hal/google_camera_hal/realtime_zsl_request_processor.cc | 3 | ||||
-rw-r--r-- | common/hal/google_camera_hal/zsl_snapshot_capture_session.cc | 16 | ||||
-rw-r--r-- | common/hal/utils/utils.cc | 15 | ||||
-rw-r--r-- | common/hal/utils/utils.h | 1 |
4 files changed, 23 insertions, 12 deletions
diff --git a/common/hal/google_camera_hal/realtime_zsl_request_processor.cc b/common/hal/google_camera_hal/realtime_zsl_request_processor.cc index 1250496..c5db47d 100644 --- a/common/hal/google_camera_hal/realtime_zsl_request_processor.cc +++ b/common/hal/google_camera_hal/realtime_zsl_request_processor.cc @@ -195,8 +195,7 @@ status_t RealtimeZslRequestProcessor::ConfigureStreams( // checked the size is supported in capture session. if (pixel_format_ == android_pixel_format_t::HAL_PIXEL_FORMAT_YCBCR_420_888) { for (const auto& stream : stream_config.streams) { - if (utils::IsJPEGSnapshotStream(stream) || - utils::IsYUVSnapshotStream(stream)) { + if (utils::IsSoftwareDenoiseEligibleSnapshotStream(stream)) { if (SelectWidthAndHeight(stream.width, stream.height, *device_session_hwl_, active_array_width_, active_array_height_) != OK) { diff --git a/common/hal/google_camera_hal/zsl_snapshot_capture_session.cc b/common/hal/google_camera_hal/zsl_snapshot_capture_session.cc index 26aa27b..fa25403 100644 --- a/common/hal/google_camera_hal/zsl_snapshot_capture_session.cc +++ b/common/hal/google_camera_hal/zsl_snapshot_capture_session.cc @@ -163,28 +163,28 @@ bool ZslSnapshotCaptureSession::IsStreamConfigurationSupported( return false; } - bool has_jpeg_stream = false; + bool has_eligible_snapshot_stream = false; bool has_preview_stream = false; - bool has_yuv_stream = false; for (const auto& stream : stream_config.streams) { if (stream.is_physical_camera_stream) { ALOGE("%s: support logical camera only", __FUNCTION__); return false; } - if (utils::IsJPEGSnapshotStream(stream)) { - has_jpeg_stream = true; + if (utils::IsJPEGSnapshotStream(stream) || + utils::IsYUVSnapshotStream(stream)) { + if (utils::IsSoftwareDenoiseEligibleSnapshotStream(stream)) { + has_eligible_snapshot_stream = true; + } } else if (utils::IsPreviewStream(stream)) { has_preview_stream = true; - } else if (utils::IsYUVSnapshotStream(stream)) { - has_yuv_stream = true; } else { ALOGE("%s: only support preview + (snapshot and/or YUV) streams", __FUNCTION__); return false; } } - if (!has_jpeg_stream && !has_yuv_stream) { - ALOGE("%s: no JPEG or YUV stream", __FUNCTION__); + if (!has_eligible_snapshot_stream) { + ALOGE("%s: no eligible JPEG or YUV stream", __FUNCTION__); return false; } diff --git a/common/hal/utils/utils.cc b/common/hal/utils/utils.cc index 54b382a..7a41889 100644 --- a/common/hal/utils/utils.cc +++ b/common/hal/utils/utils.cc @@ -15,16 +15,16 @@ */ //#define LOG_NDEBUG 0 +#include <cstdint> #define LOG_TAG "GCH_Utils" -#include "utils.h" - #include <cutils/properties.h> #include <dirent.h> #include <dlfcn.h> #include <hardware/gralloc.h> #include <sys/stat.h> +#include "utils.h" #include "vendor_tag_defs.h" namespace android { @@ -34,6 +34,8 @@ namespace utils { constexpr char kRealtimeThreadSetProp[] = "persist.vendor.camera.realtimethread"; +constexpr uint32_t kMinSupportedSoftwareDenoiseDimension = 1000; + bool IsDepthStream(const Stream& stream) { if (stream.stream_type == StreamType::kOutput && stream.data_space == HAL_DATASPACE_DEPTH && @@ -121,6 +123,15 @@ bool IsYUVSnapshotStream(const Stream& stream) { return false; } +bool IsSoftwareDenoiseEligibleSnapshotStream(const Stream& stream) { + if (utils::IsYUVSnapshotStream(stream) || + utils::IsJPEGSnapshotStream(stream)) { + return stream.width >= kMinSupportedSoftwareDenoiseDimension || + stream.height >= kMinSupportedSoftwareDenoiseDimension; + } + return false; +} + status_t GetSensorPhysicalSize(const HalCameraMetadata* characteristics, float* width, float* height) { if (characteristics == nullptr || width == nullptr || height == nullptr) { diff --git a/common/hal/utils/utils.h b/common/hal/utils/utils.h index 4412908..a43e614 100644 --- a/common/hal/utils/utils.h +++ b/common/hal/utils/utils.h @@ -36,6 +36,7 @@ bool IsArbitraryDataSpaceRawStream(const Stream& stream); bool IsYUVSnapshotStream(const Stream& stream); bool IsDepthStream(const Stream& stream); bool IsOutputZslStream(const Stream& stream); +bool IsSoftwareDenoiseEligibleSnapshotStream(const Stream& stream); bool HasCapability(const HalCameraMetadata* metadata, uint8_t capability); |