[media] m5mols: Add JPEG compression quality control
Add JPEG compression quality control for snapshot capture. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
50d3f93e39
commit
dd9c471dd3
|
@ -172,6 +172,7 @@ struct m5mols_version {
|
||||||
* @zoom: zoom control
|
* @zoom: zoom control
|
||||||
* @wdr: wide dynamic range control
|
* @wdr: wide dynamic range control
|
||||||
* @stabilization: image stabilization control
|
* @stabilization: image stabilization control
|
||||||
|
* @jpeg_quality: JPEG compression quality control
|
||||||
* @ver: information of the version
|
* @ver: information of the version
|
||||||
* @cap: the capture mode attributes
|
* @cap: the capture mode attributes
|
||||||
* @power: current sensor's power status
|
* @power: current sensor's power status
|
||||||
|
@ -213,6 +214,7 @@ struct m5mols_info {
|
||||||
struct v4l2_ctrl *zoom;
|
struct v4l2_ctrl *zoom;
|
||||||
struct v4l2_ctrl *wdr;
|
struct v4l2_ctrl *wdr;
|
||||||
struct v4l2_ctrl *stabilization;
|
struct v4l2_ctrl *stabilization;
|
||||||
|
struct v4l2_ctrl *jpeg_quality;
|
||||||
|
|
||||||
struct m5mols_version ver;
|
struct m5mols_version ver;
|
||||||
struct m5mols_capture cap;
|
struct m5mols_capture cap;
|
||||||
|
|
|
@ -492,6 +492,10 @@ static int m5mols_s_ctrl(struct v4l2_ctrl *ctrl)
|
||||||
case V4L2_CID_IMAGE_STABILIZATION:
|
case V4L2_CID_IMAGE_STABILIZATION:
|
||||||
ret = m5mols_set_stabilization(info, ctrl->val);
|
ret = m5mols_set_stabilization(info, ctrl->val);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case V4L2_CID_JPEG_COMPRESSION_QUALITY:
|
||||||
|
ret = m5mols_write(sd, CAPP_JPEG_RATIO, ctrl->val);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == 0 && info->mode != last_mode)
|
if (ret == 0 && info->mode != last_mode)
|
||||||
|
@ -530,8 +534,7 @@ int m5mols_init_controls(struct v4l2_subdev *sd)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
zoom_step = is_manufacturer(info, REG_SAMSUNG_OPTICS) ? 31 : 1;
|
zoom_step = is_manufacturer(info, REG_SAMSUNG_OPTICS) ? 31 : 1;
|
||||||
|
v4l2_ctrl_handler_init(&info->handle, 20);
|
||||||
v4l2_ctrl_handler_init(&info->handle, 6);
|
|
||||||
|
|
||||||
info->auto_wb = v4l2_ctrl_new_std_menu(&info->handle,
|
info->auto_wb = v4l2_ctrl_new_std_menu(&info->handle,
|
||||||
&m5mols_ctrl_ops, V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE,
|
&m5mols_ctrl_ops, V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE,
|
||||||
|
@ -579,6 +582,9 @@ int m5mols_init_controls(struct v4l2_subdev *sd)
|
||||||
info->stabilization = v4l2_ctrl_new_std(&info->handle, &m5mols_ctrl_ops,
|
info->stabilization = v4l2_ctrl_new_std(&info->handle, &m5mols_ctrl_ops,
|
||||||
V4L2_CID_IMAGE_STABILIZATION, 0, 1, 1, 0);
|
V4L2_CID_IMAGE_STABILIZATION, 0, 1, 1, 0);
|
||||||
|
|
||||||
|
info->jpeg_quality = v4l2_ctrl_new_std(&info->handle, &m5mols_ctrl_ops,
|
||||||
|
V4L2_CID_JPEG_COMPRESSION_QUALITY, 1, 100, 1, 80);
|
||||||
|
|
||||||
if (info->handle.error) {
|
if (info->handle.error) {
|
||||||
int ret = info->handle.error;
|
int ret = info->handle.error;
|
||||||
v4l2_err(sd, "Failed to initialize controls: %d\n", ret);
|
v4l2_err(sd, "Failed to initialize controls: %d\n", ret);
|
||||||
|
|
|
@ -310,6 +310,7 @@
|
||||||
#define REG_JPEG 0x10
|
#define REG_JPEG 0x10
|
||||||
|
|
||||||
#define CAPP_MAIN_IMAGE_SIZE I2C_REG(CAT_CAPT_PARM, 0x01, 1)
|
#define CAPP_MAIN_IMAGE_SIZE I2C_REG(CAT_CAPT_PARM, 0x01, 1)
|
||||||
|
#define CAPP_JPEG_RATIO I2C_REG(CAT_CAPT_PARM, 0x17, 1)
|
||||||
|
|
||||||
#define CAPP_MCC_MODE I2C_REG(CAT_CAPT_PARM, 0x1d, 1)
|
#define CAPP_MCC_MODE I2C_REG(CAT_CAPT_PARM, 0x1d, 1)
|
||||||
#define REG_MCC_OFF 0x00
|
#define REG_MCC_OFF 0x00
|
||||||
|
|
Loading…
Reference in New Issue