summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZiyan <jaraidaniel@gmail.com>2016-02-06 14:10:14 +0100
committerZiyan <jaraidaniel@gmail.com>2016-02-10 20:12:45 +0100
commit522c9cceeb130974a0621e7c5ce794ff046b5412 (patch)
tree156cd277249d0f668b6b4001e3b255c59637a21c
parenta3e97a7d54e4e13ab4a2c547a05eb03c2e3d7559 (diff)
downloaddevice_samsung_tuna-522c9cceeb130974a0621e7c5ce794ff046b5412.zip
device_samsung_tuna-522c9cceeb130974a0621e7c5ce794ff046b5412.tar.gz
device_samsung_tuna-522c9cceeb130974a0621e7c5ce794ff046b5412.tar.bz2
camera: update default zoom in video mode to workaround pink lines
Change-Id: Ie1001438fb90b8f6a3991a14e0f11968eb2d1ac9
-rw-r--r--camera/OMXCameraAdapter/OMXCameraAdapter.cpp2
-rw-r--r--camera/OMXCameraAdapter/OMXZoom.cpp39
-rw-r--r--camera/inc/OMXCameraAdapter/OMXCameraAdapter.h7
3 files changed, 43 insertions, 5 deletions
diff --git a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp
index 9b8064b..00d57a2 100644
--- a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp
+++ b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp
@@ -247,6 +247,7 @@ status_t OMXCameraAdapter::initialize(CameraProperties::Properties* caps)
mCapabilities = caps;
mZoomUpdating = false;
mZoomUpdate = false;
+ mPrevZoomModeIsVideo = false;
mGBCE = BRIGHTNESS_OFF;
mGLBCE = BRIGHTNESS_OFF;
mParameters3A.ExposureLock = OMX_FALSE;
@@ -4149,6 +4150,7 @@ OMXCameraAdapter::OMXCameraAdapter(size_t sensor_index)
mOmxInitialized = false;
mComponentState = OMX_StateInvalid;
mSensorIndex = sensor_index;
+ mPrevZoomSensorIndex = sensor_index;
mPictureRotation = 0;
// Initial values
mTimeSourceDelta = 0;
diff --git a/camera/OMXCameraAdapter/OMXZoom.cpp b/camera/OMXCameraAdapter/OMXZoom.cpp
index e39a3b0..af5c5db 100644
--- a/camera/OMXCameraAdapter/OMXZoom.cpp
+++ b/camera/OMXCameraAdapter/OMXZoom.cpp
@@ -24,6 +24,15 @@
#include "CameraHal.h"
#include "OMXCameraAdapter.h"
+#ifdef CAMERAHAL_TUNA
+namespace {
+ // Experimentally determined values that make
+ // overlapping bands go away in video mode.
+ const int32_t FrontSensorVideoMinZoom = 66816; // 65536 + 1280
+ const int32_t BackSensorVideoMinZoom = 66304; // 65536 + 768
+}
+#endif
+
namespace Ti {
namespace Camera {
@@ -45,6 +54,18 @@ const int32_t OMXCameraAdapter::ZOOM_STEPS [ZOOM_STAGES] = {
456131, 472515, 488899, 506593,
524288 };
+#ifdef CAMERAHAL_TUNA
+int32_t OMXCameraAdapter::getZoomStep(int index)
+{
+ if (index != 0 || !mPrevZoomModeIsVideo) {
+ return OMXCameraAdapter::ZOOM_STEPS[index];
+ } else if (mSensorIndex == 1) {
+ return FrontSensorVideoMinZoom;
+ } else {
+ return BackSensorVideoMinZoom;
+ }
+}
+#endif
status_t OMXCameraAdapter::setParametersZoom(const android::CameraParameters &params,
BaseCameraAdapter::AdapterState state)
@@ -98,17 +119,29 @@ status_t OMXCameraAdapter::doZoom(int index)
ret = -EINVAL;
}
- if (mPreviousZoomIndx == index )
+ bool curZoomModeIsVideo = (mCapMode == OMXCameraAdapter::VIDEO_MODE ||
+ mCapMode == OMXCameraAdapter::VIDEO_MODE_HQ);
+
+ // When index == 0 and there was a switch between video and non-video mode or between sensors,
+ // we do need to perform the zoom, as 0th index is different between video and non-video modes
+ // and between different sensors.
+ if (mPreviousZoomIndx == index && (index != 0 || (curZoomModeIsVideo == mPrevZoomModeIsVideo &&
+ mSensorIndex == mPrevZoomSensorIndex)))
{
return NO_ERROR;
}
+ mPrevZoomModeIsVideo = curZoomModeIsVideo;
+ mPrevZoomSensorIndex = mSensorIndex;
+
if ( NO_ERROR == ret )
{
OMX_INIT_STRUCT_PTR (&zoomControl, OMX_CONFIG_SCALEFACTORTYPE);
zoomControl.nPortIndex = OMX_ALL;
- zoomControl.xHeight = ZOOM_STEPS[index];
- zoomControl.xWidth = ZOOM_STEPS[index];
+#ifdef CAMERAHAL_TUNA
+ zoomControl.xHeight = getZoomStep(index);
+ zoomControl.xWidth = zoomControl.xHeight;
+#endif
eError = OMX_SetConfig(mCameraAdapterParameters.mHandleComp,
OMX_IndexConfigCommonDigitalZoom,
diff --git a/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h b/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h
index 10590df..5f0433c 100644
--- a/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h
+++ b/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h
@@ -536,6 +536,9 @@ private:
//Digital zoom
status_t setParametersZoom(const android::CameraParameters &params,
BaseCameraAdapter::AdapterState state);
+#ifdef CAMERAHAL_TUNA
+ int32_t getZoomStep(int index);
+#endif
status_t doZoom(int index);
status_t advanceZoom();
@@ -1093,7 +1096,7 @@ private:
//current zoom
android::Mutex mZoomLock;
unsigned int mCurrentZoomIdx, mTargetZoomIdx, mPreviousZoomIndx;
- bool mZoomUpdating, mZoomUpdate;
+ bool mZoomUpdating, mZoomUpdate, mPrevZoomModeIsVideo;
int mZoomInc;
bool mReturnZoomStatus;
static const int32_t ZOOM_STEPS [];
@@ -1196,7 +1199,7 @@ private:
android::Mutex mDoAFMutex;
android::Condition mDoAFCond;
- size_t mSensorIndex;
+ size_t mSensorIndex, mPrevZoomSensorIndex;
CodingMode mCodingMode;
// Time source delta of ducati & system time