media: rkvdec: Move H264 SPS validation in rkvdec-h264
No functional change, this moves H264 specific validation into the H264 specific code. This is in preparation of improving this validation and reusing it when VIDIOC_STREAMON is called. Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
parent
a074aa4760
commit
cf76bb4d5e
@ -1137,9 +1137,32 @@ static int rkvdec_h264_run(struct rkvdec_ctx *ctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rkvdec_h264_try_ctrl(struct rkvdec_ctx *ctx, struct v4l2_ctrl *ctrl)
|
||||
{
|
||||
if (ctrl->id == V4L2_CID_STATELESS_H264_SPS) {
|
||||
const struct v4l2_ctrl_h264_sps *sps = ctrl->p_new.p_h264_sps;
|
||||
/*
|
||||
* TODO: The hardware supports 10-bit and 4:2:2 profiles,
|
||||
* but it's currently broken in the driver.
|
||||
* Reject them for now, until it's fixed.
|
||||
*/
|
||||
if (sps->chroma_format_idc > 1)
|
||||
/* Only 4:0:0 and 4:2:0 are supported */
|
||||
return -EINVAL;
|
||||
if (sps->bit_depth_luma_minus8 != sps->bit_depth_chroma_minus8)
|
||||
/* Luma and chroma bit depth mismatch */
|
||||
return -EINVAL;
|
||||
if (sps->bit_depth_luma_minus8 != 0)
|
||||
/* Only 8-bit is supported */
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const struct rkvdec_coded_fmt_ops rkvdec_h264_fmt_ops = {
|
||||
.adjust_fmt = rkvdec_h264_adjust_fmt,
|
||||
.start = rkvdec_h264_start,
|
||||
.stop = rkvdec_h264_stop,
|
||||
.run = rkvdec_h264_run,
|
||||
.try_ctrl = rkvdec_h264_try_ctrl,
|
||||
};
|
||||
|
@ -29,23 +29,12 @@
|
||||
|
||||
static int rkvdec_try_ctrl(struct v4l2_ctrl *ctrl)
|
||||
{
|
||||
if (ctrl->id == V4L2_CID_STATELESS_H264_SPS) {
|
||||
const struct v4l2_ctrl_h264_sps *sps = ctrl->p_new.p_h264_sps;
|
||||
/*
|
||||
* TODO: The hardware supports 10-bit and 4:2:2 profiles,
|
||||
* but it's currently broken in the driver.
|
||||
* Reject them for now, until it's fixed.
|
||||
*/
|
||||
if (sps->chroma_format_idc > 1)
|
||||
/* Only 4:0:0 and 4:2:0 are supported */
|
||||
return -EINVAL;
|
||||
if (sps->bit_depth_luma_minus8 != sps->bit_depth_chroma_minus8)
|
||||
/* Luma and chroma bit depth mismatch */
|
||||
return -EINVAL;
|
||||
if (sps->bit_depth_luma_minus8 != 0)
|
||||
/* Only 8-bit is supported */
|
||||
return -EINVAL;
|
||||
}
|
||||
struct rkvdec_ctx *ctx = container_of(ctrl->handler, struct rkvdec_ctx, ctrl_hdl);
|
||||
const struct rkvdec_coded_fmt_desc *desc = ctx->coded_fmt_desc;
|
||||
|
||||
if (desc->ops->try_ctrl)
|
||||
return desc->ops->try_ctrl(ctx, ctrl);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -72,6 +72,7 @@ struct rkvdec_coded_fmt_ops {
|
||||
void (*done)(struct rkvdec_ctx *ctx, struct vb2_v4l2_buffer *src_buf,
|
||||
struct vb2_v4l2_buffer *dst_buf,
|
||||
enum vb2_buffer_state result);
|
||||
int (*try_ctrl)(struct rkvdec_ctx *ctx, struct v4l2_ctrl *ctrl);
|
||||
};
|
||||
|
||||
struct rkvdec_coded_fmt_desc {
|
||||
|
Loading…
Reference in New Issue
Block a user