media: vicodec: Introducing stateless fwht defs and structs

Add structs and definitions needed to implement stateless
decoder for fwht and add I/P-frames QP controls to the
public api.

Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
Dafna Hirschfeld
2019-03-06 16:13:40 -05:00
committed by Mauro Carvalho Chehab
parent ee3963c492
commit 2495f39ce1
6 changed files with 65 additions and 29 deletions

View File

@@ -64,6 +64,10 @@ static const struct v4l2_fwht_pixfmt_info pixfmt_fwht = {
V4L2_PIX_FMT_FWHT, 0, 3, 1, 1, 1, 1, 1, 0, 1
};
static const struct v4l2_fwht_pixfmt_info pixfmt_stateless_fwht = {
V4L2_PIX_FMT_FWHT_STATELESS, 0, 3, 1, 1, 1, 1, 1, 0, 1
};
static void vicodec_dev_release(struct device *dev)
{
}
@@ -1524,10 +1528,6 @@ static int queue_init(void *priv, struct vb2_queue *src_vq,
return vb2_queue_init(dst_vq);
}
#define VICODEC_CID_CUSTOM_BASE (V4L2_CID_MPEG_BASE | 0xf000)
#define VICODEC_CID_I_FRAME_QP (VICODEC_CID_CUSTOM_BASE + 0)
#define VICODEC_CID_P_FRAME_QP (VICODEC_CID_CUSTOM_BASE + 1)
static int vicodec_s_ctrl(struct v4l2_ctrl *ctrl)
{
struct vicodec_ctx *ctx = container_of(ctrl->handler,
@@ -1537,10 +1537,10 @@ static int vicodec_s_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_CID_MPEG_VIDEO_GOP_SIZE:
ctx->state.gop_size = ctrl->val;
return 0;
case VICODEC_CID_I_FRAME_QP:
case V4L2_CID_FWHT_I_FRAME_QP:
ctx->state.i_frame_qp = ctrl->val;
return 0;
case VICODEC_CID_P_FRAME_QP:
case V4L2_CID_FWHT_P_FRAME_QP:
ctx->state.p_frame_qp = ctrl->val;
return 0;
}
@@ -1551,26 +1551,9 @@ static const struct v4l2_ctrl_ops vicodec_ctrl_ops = {
.s_ctrl = vicodec_s_ctrl,
};
static const struct v4l2_ctrl_config vicodec_ctrl_i_frame = {
.ops = &vicodec_ctrl_ops,
.id = VICODEC_CID_I_FRAME_QP,
.name = "FWHT I-Frame QP Value",
.type = V4L2_CTRL_TYPE_INTEGER,
.min = 1,
.max = 31,
.def = 20,
.step = 1,
};
static const struct v4l2_ctrl_config vicodec_ctrl_p_frame = {
.ops = &vicodec_ctrl_ops,
.id = VICODEC_CID_P_FRAME_QP,
.name = "FWHT P-Frame QP Value",
.type = V4L2_CTRL_TYPE_INTEGER,
.min = 1,
.max = 31,
.def = 20,
.step = 1,
static const struct v4l2_ctrl_config vicodec_ctrl_stateless_state = {
.id = V4L2_CID_MPEG_VIDEO_FWHT_PARAMS,
.elem_size = sizeof(struct v4l2_ctrl_fwht_params),
};
/*
@@ -1603,8 +1586,10 @@ static int vicodec_open(struct file *file)
v4l2_ctrl_handler_init(hdl, 4);
v4l2_ctrl_new_std(hdl, &vicodec_ctrl_ops, V4L2_CID_MPEG_VIDEO_GOP_SIZE,
1, 16, 1, 10);
v4l2_ctrl_new_custom(hdl, &vicodec_ctrl_i_frame, NULL);
v4l2_ctrl_new_custom(hdl, &vicodec_ctrl_p_frame, NULL);
v4l2_ctrl_new_std(hdl, &vicodec_ctrl_ops, V4L2_CID_FWHT_I_FRAME_QP,
1, 31, 1, 20);
v4l2_ctrl_new_std(hdl, &vicodec_ctrl_ops, V4L2_CID_FWHT_P_FRAME_QP,
1, 31, 1, 20);
if (hdl->error) {
rc = hdl->error;
v4l2_ctrl_handler_free(hdl);