diff options
author | Jayant Chowdhary <jchowdhary@google.com> | 2021-09-24 23:59:09 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-09-24 23:59:09 +0000 |
commit | 291b7e7a8fa2e1292f817eba1a4ec27352a74ef0 (patch) | |
tree | 6f4254c5aeef219c2e42e470374629b51dfcbbc3 | |
parent | a8471122ab052bc0344e2ff8094aeee473aa861e (diff) | |
parent | 0d13d96db23c7ac1d243f096ab6b3324780ceae2 (diff) | |
download | camera-android12-qpr1-d-s2-release.tar.gz |
Merge "EmulatedCamera: Fix scaler crop region default for maximum resolution sensor pixel mode results." into sc-qpr1-devandroid-12.0.0_r32android-12.0.0_r29android-12.0.0_r27android-12.0.0_r21android-12.0.0_r20android-12.0.0_r19android-12.0.0_r18android12-qpr1-d-s3-releaseandroid12-qpr1-d-s2-releaseandroid12-qpr1-d-s1-releaseandroid12-qpr1-d-release
-rw-r--r-- | devices/EmulatedCamera/hwl/EmulatedRequestState.cpp | 24 | ||||
-rw-r--r-- | devices/EmulatedCamera/hwl/EmulatedRequestState.h | 1 |
2 files changed, 23 insertions, 2 deletions
diff --git a/devices/EmulatedCamera/hwl/EmulatedRequestState.cpp b/devices/EmulatedCamera/hwl/EmulatedRequestState.cpp index a1e553a..e7c62f9 100644 --- a/devices/EmulatedCamera/hwl/EmulatedRequestState.cpp +++ b/devices/EmulatedCamera/hwl/EmulatedRequestState.cpp @@ -969,8 +969,11 @@ std::unique_ptr<HwlPipelineResult> EmulatedRequestState::InitializeResult( } if (zoom_ratio_supported_) { result->result_metadata->Set(ANDROID_CONTROL_ZOOM_RATIO, &zoom_ratio_, 1); - result->result_metadata->Set(ANDROID_SCALER_CROP_REGION, - scaler_crop_region_default_, + int32_t* chosen_crop_region = scaler_crop_region_default_; + if (sensor_pixel_mode_ == ANDROID_SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION) { + chosen_crop_region = scaler_crop_region_max_resolution_; + } + result->result_metadata->Set(ANDROID_SCALER_CROP_REGION, chosen_crop_region, ARRAY_SIZE(scaler_crop_region_default_)); } if (report_extended_scene_mode_) { @@ -2285,6 +2288,23 @@ status_t EmulatedRequestState::InitializeScalerDefaults() { return BAD_VALUE; } + if (SupportsCapability( + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR)) { + ret = static_metadata_->Get( + ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION, &entry); + if ((ret == OK) && (entry.count == 4)) { + scaler_crop_region_max_resolution_[0] = entry.data.i32[0]; + scaler_crop_region_max_resolution_[1] = entry.data.i32[1]; + scaler_crop_region_max_resolution_[2] = entry.data.i32[2]; + scaler_crop_region_max_resolution_[3] = entry.data.i32[3]; + } else { + ALOGE( + "%s: Sensor pixel array size maximum resolution is not available!", + __FUNCTION__); + return BAD_VALUE; + } + } + if (available_requests_.find(ANDROID_SCALER_CROP_REGION) == available_requests_.end()) { ALOGE( diff --git a/devices/EmulatedCamera/hwl/EmulatedRequestState.h b/devices/EmulatedCamera/hwl/EmulatedRequestState.h index 1591422..1987bfa 100644 --- a/devices/EmulatedCamera/hwl/EmulatedRequestState.h +++ b/devices/EmulatedCamera/hwl/EmulatedRequestState.h @@ -262,6 +262,7 @@ class EmulatedRequestState { bool report_rotate_and_crop_ = false; uint8_t rotate_and_crop_ = ANDROID_SCALER_ROTATE_AND_CROP_NONE; int32_t scaler_crop_region_default_[4] = {0, 0, 0, 0}; + int32_t scaler_crop_region_max_resolution_[4] = {0, 0, 0, 0}; std::set<uint8_t> available_rotate_crop_modes_; // android.statistics.* |