diff options
author | Chien-Yu Chen <cychen@google.com> | 2014-10-23 17:15:19 -0700 |
---|---|---|
committer | Chien-Yu Chen <cychen@google.com> | 2014-10-28 13:20:13 -0700 |
commit | 1bbc1c93b5db545e503dc27c262eef38685d0726 (patch) | |
tree | 8133609e752ea5bfffb6e438268f1e4709eee44c /services/camera | |
parent | 701b96474dc8afd16046e440975e00be57cc4874 (diff) | |
download | frameworks_av-1bbc1c93b5db545e503dc27c262eef38685d0726.zip frameworks_av-1bbc1c93b5db545e503dc27c262eef38685d0726.tar.gz frameworks_av-1bbc1c93b5db545e503dc27c262eef38685d0726.tar.bz2 |
CameraService: API1: fix picture FOV
Fix the wrong assumption that active array size equals to pixel array
size.
bug 17918247
Change-Id: Ic308f281fb677332a74e95abb473c5b13063eeca
Diffstat (limited to 'services/camera')
-rw-r--r-- | services/camera/libcameraservice/api1/client2/Parameters.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/services/camera/libcameraservice/api1/client2/Parameters.cpp b/services/camera/libcameraservice/api1/client2/Parameters.cpp index 7b90d28..42a5507 100644 --- a/services/camera/libcameraservice/api1/client2/Parameters.cpp +++ b/services/camera/libcameraservice/api1/client2/Parameters.cpp @@ -2954,6 +2954,10 @@ status_t Parameters::calculatePictureFovs(float *horizFov, float *vertFov) staticInfo(ANDROID_SENSOR_INFO_PHYSICAL_SIZE, 2, 2); if (!sensorSize.count) return NO_INIT; + camera_metadata_ro_entry_t pixelArraySize = + staticInfo(ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE, 2, 2); + if (!pixelArraySize.count) return NO_INIT; + float arrayAspect = static_cast<float>(fastInfo.arrayWidth) / fastInfo.arrayHeight; float stillAspect = static_cast<float>(pictureWidth) / pictureHeight; @@ -3003,6 +3007,16 @@ status_t Parameters::calculatePictureFovs(float *horizFov, float *vertFov) vertCropFactor = (arrayAspect < stillAspect) ? (arrayAspect / stillAspect) : 1.f; } + + /** + * Convert the crop factors w.r.t the active array size to the crop factors + * w.r.t the pixel array size. + */ + horizCropFactor *= (static_cast<float>(fastInfo.arrayWidth) / + pixelArraySize.data.i32[0]); + vertCropFactor *= (static_cast<float>(fastInfo.arrayHeight) / + pixelArraySize.data.i32[1]); + ALOGV("Horiz crop factor: %f, vert crop fact: %f", horizCropFactor, vertCropFactor); /** |