Skip to content

Commit

Permalink
media: verisilicon: Check AV1 bitstreams bit depth
Browse files Browse the repository at this point in the history
The driver supports 8 and 10 bits bitstreams, make sure to discard
other cases.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
  • Loading branch information
Benjamin Gaignard authored and intel-lab-lkp committed Jan 3, 2023
1 parent fc65607 commit e7673f1
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion drivers/media/platform/verisilicon/hantro_drv.c
Expand Up @@ -282,7 +282,13 @@ static int hantro_try_ctrl(struct v4l2_ctrl *ctrl)
/* We only support profile 0 */
if (dec_params->profile != 0)
return -EINVAL;
} else if (ctrl->id == V4L2_CID_STATELESS_AV1_SEQUENCE) {
const struct v4l2_ctrl_av1_sequence *sequence = ctrl->p_new.p_av1_sequence;

if (sequence->bit_depth != 8 && sequence->bit_depth != 10)
return -EINVAL;
}

return 0;
}

Expand Down Expand Up @@ -333,7 +339,13 @@ static int hantro_av1_s_ctrl(struct v4l2_ctrl *ctrl)

switch (ctrl->id) {
case V4L2_CID_STATELESS_AV1_SEQUENCE:
ctx->bit_depth = ctrl->p_new.p_av1_sequence->bit_depth;
int bit_depth = ctrl->p_new.p_av1_sequence->bit_depth;

if (vb2_is_streaming(v4l2_m2m_get_src_vq(ctx->fh.m2m_ctx)))
if (ctx->bit_depth != bit_depth)
return -EINVAL;

ctx->bit_depth = bit_depth;
break;
default:
return -EINVAL;
Expand Down

0 comments on commit e7673f1

Please sign in to comment.