diff options
author | Pawit Pornkitprasan <p.pawit@gmail.com> | 2012-05-04 21:36:06 +0700 |
---|---|---|
committer | Pawit Pornkitprasan <p.pawit@gmail.com> | 2012-05-04 21:36:06 +0700 |
commit | 0f2b64054472f9c11750bcf03d7f8f5952824a51 (patch) | |
tree | edb6f7c0c79bf459698a0e523489972249d60d65 /libcamera | |
parent | 80b2d4119caba8f7178df86fb4374efa4cf0750e (diff) | |
download | device_samsung_aries-common-0f2b64054472f9c11750bcf03d7f8f5952824a51.zip device_samsung_aries-common-0f2b64054472f9c11750bcf03d7f8f5952824a51.tar.gz device_samsung_aries-common-0f2b64054472f9c11750bcf03d7f8f5952824a51.tar.bz2 |
aries-common: libcamera: Add support for face-detection
This is done through Samsung-specific "facedetect" focus-mode
Change-Id: I6b1119539dff5a1a64ce5d440f57650543fa52db
Diffstat (limited to 'libcamera')
-rwxr-xr-x | libcamera/SecCamera.cpp | 2 | ||||
-rwxr-xr-x | libcamera/SecCameraHWInterface.cpp | 21 |
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; |