2014-07-08 14:30:52

by Andrey Utkin

[permalink] [raw]
Subject: [PATCH 1/2] solo6x10: expose encoder quantization setting as V4L2 control

solo6*10 boards have configurable quantization parameter which takes
values from 0 to 31, inclusively.

This change enables setting it with ioctl VIDIOC_S_CTRL with id
V4L2_CID_MPEG_VIDEO_H264_MIN_QP.
---
drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c
index b8ff113..bf6eb06 100644
--- a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c
+++ b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c
@@ -1111,6 +1111,9 @@ static int solo_s_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_CID_MPEG_VIDEO_GOP_SIZE:
solo_enc->gop = ctrl->val;
return 0;
+ case V4L2_CID_MPEG_VIDEO_H264_MIN_QP:
+ solo_enc->qp = ctrl->val;
+ return 0;
case V4L2_CID_MOTION_THRESHOLD:
solo_enc->motion_thresh = ctrl->val;
if (!solo_enc->motion_global || !solo_enc->motion_enabled)
@@ -1260,6 +1263,8 @@ static struct solo_enc_dev *solo_enc_alloc(struct solo_dev *solo_dev,
V4L2_CID_SHARPNESS, 0, 15, 1, 0);
v4l2_ctrl_new_std(hdl, &solo_ctrl_ops,
V4L2_CID_MPEG_VIDEO_GOP_SIZE, 1, 255, 1, solo_dev->fps);
+ v4l2_ctrl_new_std(hdl, &solo_ctrl_ops,
+ V4L2_CID_MPEG_VIDEO_H264_MIN_QP, 0, 31, 1, SOLO_DEFAULT_QP);
v4l2_ctrl_new_custom(hdl, &solo_motion_threshold_ctrl, NULL);
v4l2_ctrl_new_custom(hdl, &solo_motion_enable_ctrl, NULL);
v4l2_ctrl_new_custom(hdl, &solo_osd_text_ctrl, NULL);
--
1.8.3.2


2014-07-08 14:31:03

by Andrey Utkin

[permalink] [raw]
Subject: [PATCH 2/2] solo6x10: update GOP size, QP immediately

Previously, it was needed to reopen device to update GOP size and
quantization parameter. Now we update device registers with new values
immediately.
---
drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c
index bf6eb06..14f933f 100644
--- a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c
+++ b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c
@@ -1110,9 +1110,13 @@ static int solo_s_ctrl(struct v4l2_ctrl *ctrl)
ctrl->val);
case V4L2_CID_MPEG_VIDEO_GOP_SIZE:
solo_enc->gop = ctrl->val;
+ solo_reg_write(solo_dev, SOLO_VE_CH_GOP(solo_enc->ch), solo_enc->gop);
+ solo_reg_write(solo_dev, SOLO_VE_CH_GOP_E(solo_enc->ch), solo_enc->gop);
return 0;
case V4L2_CID_MPEG_VIDEO_H264_MIN_QP:
solo_enc->qp = ctrl->val;
+ solo_reg_write(solo_dev, SOLO_VE_CH_QP(solo_enc->ch), solo_enc->qp);
+ solo_reg_write(solo_dev, SOLO_VE_CH_QP_E(solo_enc->ch), solo_enc->qp);
return 0;
case V4L2_CID_MOTION_THRESHOLD:
solo_enc->motion_thresh = ctrl->val;
--
1.8.3.2

2014-07-08 15:20:25

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH 1/2] solo6x10: expose encoder quantization setting as V4L2 control

On Tue, Jul 08, 2014 at 05:30:33PM +0300, Andrey Utkin wrote:
> solo6*10 boards have configurable quantization parameter which takes
> values from 0 to 31, inclusively.
>
> This change enables setting it with ioctl VIDIOC_S_CTRL with id
> V4L2_CID_MPEG_VIDEO_H264_MIN_QP.

Both of these two need signed-off-by lines.

regards,
dan carpenter