[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20221109182309.2475221-4-jernej.skrabec@gmail.com>
Date: Wed, 9 Nov 2022 19:23:09 +0100
From: Jernej Skrabec <jernej.skrabec@...il.com>
To: mripard@...nel.org, paul.kocialkowski@...tlin.com
Cc: mchehab@...nel.org, gregkh@...uxfoundation.org, wens@...e.org,
samuel@...lland.org, hverkuil-cisco@...all.nl,
linux-media@...r.kernel.org, linux-staging@...ts.linux.dev,
linux-arm-kernel@...ts.infradead.org, linux-sunxi@...ts.linux.dev,
linux-kernel@...r.kernel.org,
Jernej Skrabec <jernej.skrabec@...il.com>
Subject: [PATCH v3 3/3] media: cedrus: Relax HEVC SPS restrictions
Testing reference video TSUNEQBD_A_MAIN10_Technicolor_2 has show that
Cedrus is capable of decoding frames with different chroma and luma bit
depths.
Relax restrictions so only highest depth is checked.
Signed-off-by: Jernej Skrabec <jernej.skrabec@...il.com>
---
drivers/staging/media/sunxi/cedrus/cedrus.c | 24 ++++++++-------------
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c b/drivers/staging/media/sunxi/cedrus/cedrus.c
index 2e860cf60136..a43d5ff66716 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus.c
@@ -45,30 +45,24 @@ static int cedrus_try_ctrl(struct v4l2_ctrl *ctrl)
} else if (ctrl->id == V4L2_CID_STATELESS_HEVC_SPS) {
const struct v4l2_ctrl_hevc_sps *sps = ctrl->p_new.p_hevc_sps;
struct cedrus_ctx *ctx = container_of(ctrl->handler, struct cedrus_ctx, hdl);
- unsigned int bit_depth;
+ unsigned int bit_depth, max_depth;
struct vb2_queue *vq;
if (sps->chroma_format_idc != 1)
/* Only 4:2:0 is supported */
return -EINVAL;
- if (sps->bit_depth_luma_minus8 != sps->bit_depth_chroma_minus8)
- /* Luma and chroma bit depth mismatch */
- return -EINVAL;
-
- if (ctx->dev->capabilities & CEDRUS_CAPABILITY_H265_10_DEC) {
- if (sps->bit_depth_luma_minus8 != 0 && sps->bit_depth_luma_minus8 != 2)
- /* Only 8-bit and 10-bit are supported */
- return -EINVAL;
- } else {
- if (sps->bit_depth_luma_minus8 != 0)
- /* Only 8-bit is supported */
- return -EINVAL;
- }
-
bit_depth = max(sps->bit_depth_luma_minus8,
sps->bit_depth_chroma_minus8) + 8;
+ if (cedrus_is_capable(ctx, CEDRUS_CAPABILITY_H265_10_DEC))
+ max_depth = 10;
+ else
+ max_depth = 8;
+
+ if (bit_depth > max_depth)
+ return -EINVAL;
+
vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx,
V4L2_BUF_TYPE_VIDEO_CAPTURE);
--
2.38.1
Powered by blists - more mailing lists