diff options
author | Raghuram Subramani <raghus2247@gmail.com> | 2024-10-18 19:36:10 +0530 |
---|---|---|
committer | Raghuram Subramani <raghus2247@gmail.com> | 2024-10-18 19:36:10 +0530 |
commit | 45e5c8966fa30051c4e8bb7cafbec7c339a5040c (patch) | |
tree | 5624eebcb58630543918be58cdc87151e7046dc1 /camera | |
parent | b64280419ede9bdeb654a1c963f7a501fd234182 (diff) |
msm8996-common: QCamera2: Fix sensor to active array ROI conversion logic.
Change-Id: Ic9049f6d80c5bb134cf184fc009871956e924f91
Diffstat (limited to 'camera')
-rw-r--r-- | camera/QCamera2/HAL3/QCamera3CropRegionMapper.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/camera/QCamera2/HAL3/QCamera3CropRegionMapper.cpp b/camera/QCamera2/HAL3/QCamera3CropRegionMapper.cpp index 94a398b..4d6d8b2 100644 --- a/camera/QCamera2/HAL3/QCamera3CropRegionMapper.cpp +++ b/camera/QCamera2/HAL3/QCamera3CropRegionMapper.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. +/* Copyright (c) 2015-2016, 2020, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -34,6 +34,7 @@ // Camera dependencies #include "QCamera3CropRegionMapper.h" #include "QCamera3HWI.h" +#include "math.h" extern "C" { #include "mm_camera_dbg.h" @@ -159,16 +160,23 @@ void QCamera3CropRegionMapper::toActiveArray(int32_t& crop_left, int32_t& crop_t void QCamera3CropRegionMapper::toSensor(int32_t& crop_left, int32_t& crop_top, int32_t& crop_width, int32_t& crop_height) { + float tmpLeft, tmpTop, tmpWidth, tmpHeight; + if (mSensorW == 0 || mSensorH == 0 || mActiveArrayW == 0 || mActiveArrayH == 0) { LOGE("sensor/active array sizes are not initialized!"); return; } - crop_left = crop_left * mSensorW / mActiveArrayW; - crop_top = crop_top * mSensorH / mActiveArrayH; - crop_width = crop_width * mSensorW / mActiveArrayW; - crop_height = crop_height * mSensorH / mActiveArrayH; + tmpLeft = (float)crop_left * mSensorW / mActiveArrayW; + tmpTop = (float)crop_top * mSensorH / mActiveArrayH; + tmpWidth = (float)crop_width * mSensorW / mActiveArrayW; + tmpHeight = (float)crop_height * mSensorH / mActiveArrayH; + + crop_left = ceil(tmpLeft); + crop_top = ceil(tmpTop); + crop_width = ceil(tmpWidth); + crop_height = ceil(tmpHeight); LOGD("before bounding left %d, top %d, width %d, height %d", crop_left, crop_top, crop_width, crop_height); |