summaryrefslogtreecommitdiffstats
path: root/libcamera
diff options
context:
space:
mode:
authorJeong-Seok Yang <jseok.yang@samsung.com>2010-10-20 00:46:09 +0900
committerSimon Wilson <simonwilson@google.com>2010-10-24 16:54:28 -0700
commitf2130bc090352d31627c6b141a574b303cfb02fe (patch)
treecabceb9b1cfcec798ee640e679e1e35efcb1197b /libcamera
parenta9cd521a0eff363c7f776392b885d252281d58f1 (diff)
downloaddevice_samsung_crespo-f2130bc090352d31627c6b141a574b303cfb02fe.zip
device_samsung_crespo-f2130bc090352d31627c6b141a574b303cfb02fe.tar.gz
device_samsung_crespo-f2130bc090352d31627c6b141a574b303cfb02fe.tar.bz2
libcamera: for setting quality of JPEG on front camera
Front camera sensor doesn't support jpeg quality by itself. Because It use H/W JPEG encoder for capturing picture. So, It should be control in HAL. Change-Id: I7f31fae9098b69c3b2ec20891f8b815931bee638 Signed-off-by: Jeong-Seok Yang <jseok.yang@samsung.com>
Diffstat (limited to 'libcamera')
-rw-r--r--libcamera/SecCamera.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/libcamera/SecCamera.cpp b/libcamera/SecCamera.cpp
index f3267b1..d235f06 100644
--- a/libcamera/SecCamera.cpp
+++ b/libcamera/SecCamera.cpp
@@ -1710,7 +1710,17 @@ int SecCamera::getSnapshotAndJpeg(unsigned char *yuv_buf, unsigned char *jpeg_bu
if (jpgEnc.setConfig(JPEG_SET_SAMPING_MODE, outFormat) != JPG_SUCCESS)
LOGE("[JPEG_SET_SAMPING_MODE] Error\n");
- if (jpgEnc.setConfig(JPEG_SET_ENCODE_QUALITY, JPG_QUALITY_LEVEL_2) != JPG_SUCCESS)
+ image_quality_type_t jpegQuality;
+ if (m_jpeg_quality >= 90)
+ jpegQuality = JPG_QUALITY_LEVEL_1;
+ else if (m_jpeg_quality >= 80)
+ jpegQuality = JPG_QUALITY_LEVEL_2;
+ else if (m_jpeg_quality >= 70)
+ jpegQuality = JPG_QUALITY_LEVEL_3;
+ else
+ jpegQuality = JPG_QUALITY_LEVEL_4;
+
+ if (jpgEnc.setConfig(JPEG_SET_ENCODE_QUALITY, jpegQuality) != JPG_SUCCESS)
LOGE("[JPEG_SET_ENCODE_QUALITY] Error\n");
if (jpgEnc.setConfig(JPEG_SET_ENCODE_WIDTH, m_snapshot_width) != JPG_SUCCESS)
LOGE("[JPEG_SET_ENCODE_WIDTH] Error\n");
@@ -2453,7 +2463,7 @@ int SecCamera::setJpegQuality(int jpeg_quality)
if (m_jpeg_quality != jpeg_quality) {
m_jpeg_quality = jpeg_quality;
- if (m_flag_camera_start) {
+ if (m_flag_camera_start && (m_camera_id == CAMERA_ID_BACK)) {
if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAM_JPEG_QUALITY, jpeg_quality) < 0) {
LOGE("ERR(%s):Fail on V4L2_CID_CAM_JPEG_QUALITY", __func__);
return -1;