summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawit Pornkitprasan <p.pawit@gmail.com>2012-05-04 18:37:26 +0400
committerGerrit Code Review <gerrit@review.cyanogenmod.com>2012-05-04 18:37:26 +0400
commitf01eff4a27b14c13616444aa9c81772202393843 (patch)
treebcf39972a2c5bc5c8418caf857c6eeb5c8b483d8
parent5105dffc495ae04cc4c0263c73e228cc2eed6b32 (diff)
parent0f2b64054472f9c11750bcf03d7f8f5952824a51 (diff)
downloaddevice_samsung_aries-common-f01eff4a27b14c13616444aa9c81772202393843.zip
device_samsung_aries-common-f01eff4a27b14c13616444aa9c81772202393843.tar.gz
device_samsung_aries-common-f01eff4a27b14c13616444aa9c81772202393843.tar.bz2
Merge "aries-common: libcamera: Add support for face-detection" into ics
-rwxr-xr-xlibcamera/SecCamera.cpp2
-rwxr-xr-xlibcamera/SecCameraHWInterface.cpp21
2 files changed, 21 insertions, 2 deletions
diff --git a/libcamera/SecCamera.cpp b/libcamera/SecCamera.cpp
index dabe878..3150b15 100755
--- a/libcamera/SecCamera.cpp
+++ b/libcamera/SecCamera.cpp
@@ -807,7 +807,6 @@ int SecCamera::startPreview(void)
// More parameters for CE147
ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_FOCUS_MODE, m_params->focus_mode);
CHECK(ret);
- // TODO
m_face_detect = 0;
ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_FACE_DETECTION, m_face_detect);
CHECK(ret);
@@ -821,7 +820,6 @@ int SecCamera::startPreview(void)
m_beauty_shot = 0;
ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_BEAUTY_SHOT, m_beauty_shot);
CHECK(ret);
- // TODO
m_zoom_level = 0;
ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_ZOOM, m_zoom_level);
CHECK(ret);
diff --git a/libcamera/SecCameraHWInterface.cpp b/libcamera/SecCameraHWInterface.cpp
index 8b873c2..bbc5b64 100755
--- a/libcamera/SecCameraHWInterface.cpp
+++ b/libcamera/SecCameraHWInterface.cpp
@@ -76,6 +76,9 @@ static const int EFFECT_SKIP_FRAME = 1;
gralloc_module_t const* CameraHardwareSec::mGrallocHal;
+// Samsung-specific focus mode
+const char FOCUS_MODE_FACEDETECT[] = "facedetect";
+
CameraHardwareSec::CameraHardwareSec(int cameraId, camera_device_t *dev)
:
mCaptureInProgress(false),
@@ -202,6 +205,8 @@ void CameraHardwareSec::initDefaultParameters(int cameraId)
parameterString.append(CameraParameters::FOCUS_MODE_INFINITY);
parameterString.append(",");
parameterString.append(CameraParameters::FOCUS_MODE_MACRO);
+ parameterString.append(",");
+ parameterString.append(FOCUS_MODE_FACEDETECT);
p.set(CameraParameters::KEY_SUPPORTED_FOCUS_MODES,
parameterString.string());
p.set(CameraParameters::KEY_FOCUS_MODE,
@@ -1748,12 +1753,28 @@ status_t CameraHardwareSec::setParameters(const CameraParameters& params)
mParameters.set(CameraParameters::KEY_FOCUS_DISTANCES,
BACK_CAMERA_INFINITY_FOCUS_DISTANCES_STR);
}
+ else if (!strcmp(new_focus_mode_str, FOCUS_MODE_FACEDETECT)) {
+ // Enable face detect here, SecCamera will take care of the rest
+ if (mSecCamera->setFaceDetect(FACE_DETECTION_ON) < 0) {
+ LOGE("%s::mSecCamera->setFaceDetect(%d) fail", __func__, FACE_DETECTION_ON);
+ ret = UNKNOWN_ERROR;
+ }
+ mParameters.set(CameraParameters::KEY_FOCUS_MODE, new_focus_mode_str);
+ mParameters.set(CameraParameters::KEY_FOCUS_DISTANCES,
+ BACK_CAMERA_AUTO_FOCUS_DISTANCES_STR);
+ }
else {
LOGE("%s::unmatched focus_mode(%s)", __func__, new_focus_mode_str);
ret = UNKNOWN_ERROR;
}
if (0 <= new_focus_mode) {
+ // Disable face-detect
+ if (mSecCamera->setFaceDetect(FACE_DETECTION_OFF) < 0) {
+ LOGE("%s::mSecCamera->setFaceDetect(%d) fail", __func__, FACE_DETECTION_OFF);
+ ret = UNKNOWN_ERROR;
+ }
+
if (mSecCamera->setFocusMode(new_focus_mode) < 0) {
LOGE("%s::mSecCamera->setFocusMode(%d) fail", __func__, new_focus_mode);
ret = UNKNOWN_ERROR;