From 1bbc1c93b5db545e503dc27c262eef38685d0726 Mon Sep 17 00:00:00 2001 From: Chien-Yu Chen Date: Thu, 23 Oct 2014 17:15:19 -0700 Subject: CameraService: API1: fix picture FOV Fix the wrong assumption that active array size equals to pixel array size. bug 17918247 Change-Id: Ic308f281fb677332a74e95abb473c5b13063eeca --- .../camera/libcameraservice/api1/client2/Parameters.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'services') 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(fastInfo.arrayWidth) / fastInfo.arrayHeight; float stillAspect = static_cast(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(fastInfo.arrayWidth) / + pixelArraySize.data.i32[0]); + vertCropFactor *= (static_cast(fastInfo.arrayHeight) / + pixelArraySize.data.i32[1]); + ALOGV("Horiz crop factor: %f, vert crop fact: %f", horizCropFactor, vertCropFactor); /** -- cgit v1.1