* [PATCH v8 0/3] media: rkvdec: Add H.264 High 10 and 4:2:2 profile support
@ 2025-04-17 17:14 Nicolas Dufresne
2025-04-17 17:14 ` [PATCH v8 1/3] media: rkvdec: h264: Limit minimum profile to constrained baseline Nicolas Dufresne
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Nicolas Dufresne @ 2025-04-17 17:14 UTC (permalink / raw)
To: Ezequiel Garcia, Mauro Carvalho Chehab, Greg Kroah-Hartman
Cc: linux-media, linux-rockchip, linux-staging, linux-kernel,
Nicolas Dufresne, kernel, Sebastian Fricke, Jonas Karlman,
Christopher Obbard
This series add H.264 High 10 and 4:2:2 profile support to the Rockchip
Video Decoder driver.
Patch 1 limits the minimum profile to constrained baseline due to
unsupported features in the full baseline profile.
Patch 2 refactors code to support filtering of CAPTURE formats based
on the image format returned from a new get_image_fmt() ops.
Patch 3 adds final bits to support H.264 High 10 and 4:2:2 profiles.
Tested with Fluster on a Libre Computer Renegade Elite (RK3399).
Decoder: GStreamer
Commit: 8c7ad20e4e82296ed9916f53c201e110c629f0f5
JVT-AVC_V1: 129/135
JVT-FR-EXT: 65/69
JVT-Professional_profiles: 12/38
JVT-MVC: 0/20 (not supported)
JVT-SCV: 38/185 (temporal only)
In summary, all tests that are 4:2:2 sub-sampled are now passing with
the exception of the following that display some unexplained artifacts.
- Hi422FREXT17_SONY_A
- Hi422FREXT19_SONY_A
This score also includes 4:2:0 10bit tests, that may have been reported
as failing due to lack of userspace support for NV15 format. It also
includes results from test suite that did not exists before (Pro, MVC
and SVC).
Changes in v8:
- Removed patches that got applied from v7
- Move the constrained-baseline fix first
- Move the format checks into s_ctrl only
- Simplify the checks
- Retest against a newer GStreamer version with NV16 and NV20 support.
- Test against the new fluster suite Professions, SVC and MVC.
Link to v7: https://lore.kernel.org/linux-media/20250225-rkvdec_h264_high10_and_422_support-v7-0-7992a68a4910@collabora.com/
Changes in v7:
- Split out the change with the minimum profile
- s/v4l2_format_plane_width/v4l2_format_plane_stride/
- Move V4L2_PIX_FMT_NV15/V4L2_PIX_FMT_NV20 documentation as suggested
- Change return value from int to bool on rkvdec_image_fmt_match
- Add reviewed-by tags
Link to v6: https://lore.kernel.org/linux-media/20240909192522.1076704-1-jonas@kwiboo.se/
Changes in v6:
- Change to use fmt_idx instead of j++ tucked inside a condition (Dan)
- Add patch to fix enumerated frame sizes returned to userspace (Alex)
- Fluster test score is same as v4 and v5, see [4] and [5]
Link to v5: https://lore.kernel.org/linux-media/20240618194647.742037-1-jonas@kwiboo.se/
Changes in v5:
- Drop Remove SPS validation at streaming start patch
- Move buffer align from rkvdec_fill_decoded_pixfmt to min/step_width
- Use correct profiles for V4L2_CID_MPEG_VIDEO_H264_PROFILE
- Collect r-b and t-b tags
- Fluster test score is same as v4, see [4] and [5]
Link to v4: https://lore.kernel.org/linux-media/20231105165521.3592037-1-jonas@kwiboo.se/
Changes in v4:
- Fix failed v4l2-compliance tests related to CAPTURE queue
- Rework CAPTURE format filter anv validate to use an image format
- Run fluster test suite JVT-FR-EXT [4] and JVT-AVC_V1 [5]
Link to v3: https://lore.kernel.org/linux-media/20231029183427.1781554-1-jonas@kwiboo.se/
Changes in v3:
- Drop merged patches
- Use bpp and bpp_div instead of prior misuse of block_w/block_h
- New patch to use values from SPS/PPS control to configure the HW
- New patch to remove an unnecessary call to validate sps at streaming start
- Reworked pixel format validation
Link to v2: https://lore.kernel.org/linux-media/20200706215430.22859-1-jonas@kwiboo.se/
Changes in v2:
- Collect r-b tags
- SPS pic width and height in mbs validation moved to rkvdec_try_ctrl
- New patch to not override output buffer sizeimage
- Reworked pixel format validation
- Only align decoded buffer instead of changing frmsize step_width
Link to v1: https://lore.kernel.org/linux-media/20200701215616.30874-1-jonas@kwiboo.se/
To fully runtime test this series you may need FFmpeg patches from [1]
and fluster patches from [2], this series is also available at [3].
[1] https://github.com/Kwiboo/FFmpeg/commits/v4l2request-2024-v2-rkvdec/
[2] https://github.com/Kwiboo/fluster/commits/ffmpeg-v4l2request-rkvdec/
[3] https://github.com/Kwiboo/linux-rockchip/commits/linuxtv-rkvdec-high-10-v6/
[4] https://gist.github.com/Kwiboo/f4ac15576b2c72887ae2bc5d58b5c865
[5] https://gist.github.com/Kwiboo/459a1c8f1dcb56e45dc7a7a29cc28adf
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
---
Jonas Karlman (2):
media: rkvdec: Add get_image_fmt ops
media: rkvdec: h264: Support High 10 and 4:2:2 profiles
Sebastian Fricke (1):
media: rkvdec: h264: Limit minimum profile to constrained baseline
drivers/staging/media/rkvdec/rkvdec-h264.c | 37 +++++++++----
drivers/staging/media/rkvdec/rkvdec.c | 84 +++++++++++++++++++++++++-----
drivers/staging/media/rkvdec/rkvdec.h | 5 ++
3 files changed, 105 insertions(+), 21 deletions(-)
---
base-commit: 14423fc3a4a21fb436dda85450339ec2bf191b36
change-id: 20250416-b4-rkvdec_h264_high10_and_422_support-381a74151162
Best regards,
--
Nicolas Dufresne <nicolas.dufresne@collabora.com>
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH v8 1/3] media: rkvdec: h264: Limit minimum profile to constrained baseline 2025-04-17 17:14 [PATCH v8 0/3] media: rkvdec: Add H.264 High 10 and 4:2:2 profile support Nicolas Dufresne @ 2025-04-17 17:14 ` Nicolas Dufresne 2025-04-17 17:14 ` [PATCH v8 2/3] media: rkvdec: Add get_image_fmt ops Nicolas Dufresne 2025-04-17 17:14 ` [PATCH v8 3/3] media: rkvdec: h264: Support High 10 and 4:2:2 profiles Nicolas Dufresne 2 siblings, 0 replies; 5+ messages in thread From: Nicolas Dufresne @ 2025-04-17 17:14 UTC (permalink / raw) To: Ezequiel Garcia, Mauro Carvalho Chehab, Greg Kroah-Hartman Cc: linux-media, linux-rockchip, linux-staging, linux-kernel, Nicolas Dufresne, kernel, Sebastian Fricke From: Sebastian Fricke <sebastian.fricke@collabora.com> Neither the hardware nor the kernel API support FMO/ASO features required by the full baseline profile. Therefore limit the minimum profile to the constrained baseline profile explicitly. Suggested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> --- drivers/staging/media/rkvdec/rkvdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c index dd7e57a902640d363d26be887cb535c2668d5b15..65c6f1d07a493e017ae941780b823d41314a49b8 100644 --- a/drivers/staging/media/rkvdec/rkvdec.c +++ b/drivers/staging/media/rkvdec/rkvdec.c @@ -150,7 +150,7 @@ static const struct rkvdec_ctrl_desc rkvdec_h264_ctrl_descs[] = { }, { .cfg.id = V4L2_CID_MPEG_VIDEO_H264_PROFILE, - .cfg.min = V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE, + .cfg.min = V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE, .cfg.max = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH, .cfg.menu_skip_mask = BIT(V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED), -- 2.49.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v8 2/3] media: rkvdec: Add get_image_fmt ops 2025-04-17 17:14 [PATCH v8 0/3] media: rkvdec: Add H.264 High 10 and 4:2:2 profile support Nicolas Dufresne 2025-04-17 17:14 ` [PATCH v8 1/3] media: rkvdec: h264: Limit minimum profile to constrained baseline Nicolas Dufresne @ 2025-04-17 17:14 ` Nicolas Dufresne 2025-04-17 20:03 ` Nicolas Dufresne 2025-04-17 17:14 ` [PATCH v8 3/3] media: rkvdec: h264: Support High 10 and 4:2:2 profiles Nicolas Dufresne 2 siblings, 1 reply; 5+ messages in thread From: Nicolas Dufresne @ 2025-04-17 17:14 UTC (permalink / raw) To: Ezequiel Garcia, Mauro Carvalho Chehab, Greg Kroah-Hartman Cc: linux-media, linux-rockchip, linux-staging, linux-kernel, Nicolas Dufresne, kernel, Jonas Karlman, Christopher Obbard From: Jonas Karlman <jonas@kwiboo.se> Add support for a get_image_fmt() ops that returns the required image format. The CAPTURE format is reset when the required image format changes and the buffer queue is not busy. Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Tested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Tested-by: Christopher Obbard <chris.obbard@collabora.com> Co-developed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> --- drivers/staging/media/rkvdec/rkvdec.c | 44 +++++++++++++++++++++++++++++++++-- drivers/staging/media/rkvdec/rkvdec.h | 2 ++ 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c index 65c6f1d07a493e017ae941780b823d41314a49b8..db01cc64f1ba2dcd5914537db41e2f51f454b186 100644 --- a/drivers/staging/media/rkvdec/rkvdec.c +++ b/drivers/staging/media/rkvdec/rkvdec.c @@ -72,6 +72,15 @@ static bool rkvdec_is_valid_fmt(struct rkvdec_ctx *ctx, u32 fourcc, return false; } +static bool rkvdec_fmt_changed(struct rkvdec_ctx *ctx, + enum rkvdec_image_fmt image_fmt) +{ + if (image_fmt == RKVDEC_IMG_FMT_ANY) + return false; + + return ctx->image_fmt != image_fmt; +} + static void rkvdec_fill_decoded_pixfmt(struct rkvdec_ctx *ctx, struct v4l2_pix_format_mplane *pix_mp) { @@ -111,15 +120,46 @@ static int rkvdec_try_ctrl(struct v4l2_ctrl *ctrl) { struct rkvdec_ctx *ctx = container_of(ctrl->handler, struct rkvdec_ctx, ctrl_hdl); const struct rkvdec_coded_fmt_desc *desc = ctx->coded_fmt_desc; + int ret; + + if (desc->ops->try_ctrl) { + ret = desc->ops->try_ctrl(ctx, ctrl); + if (ret) + return ret; + } + + return 0; +} + +static int rkvdec_s_ctrl(struct v4l2_ctrl *ctrl) +{ + struct rkvdec_ctx *ctx = container_of(ctrl->handler, struct rkvdec_ctx, ctrl_hdl); + const struct rkvdec_coded_fmt_desc *desc = ctx->coded_fmt_desc; + enum rkvdec_image_fmt image_fmt; + struct vb2_queue *vq; - if (desc->ops->try_ctrl) - return desc->ops->try_ctrl(ctx, ctrl); + /* Check if this change requires a capture format reset */ + if (!desc->ops->get_image_fmt) + return 0; + + image_fmt = desc->ops->get_image_fmt(ctx, ctrl); + if (rkvdec_fmt_changed(ctx, image_fmt)) { + /* Format changes are not allowed when capture queue is busy */ + vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, + V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); + if (vb2_is_busy(vq)) + return -EINVAL; + + ctx->image_fmt = image_fmt; + rkvdec_reset_decoded_fmt(ctx); + } return 0; } static const struct v4l2_ctrl_ops rkvdec_ctrl_ops = { .try_ctrl = rkvdec_try_ctrl, + .s_ctrl = rkvdec_s_ctrl, }; static const struct rkvdec_ctrl_desc rkvdec_h264_ctrl_descs[] = { diff --git a/drivers/staging/media/rkvdec/rkvdec.h b/drivers/staging/media/rkvdec/rkvdec.h index 6f8cf50c5d99aad2f52e321f54f3ca17166ddf98..e466a2753ccfc13738e0a672bc578e521af2c3f2 100644 --- a/drivers/staging/media/rkvdec/rkvdec.h +++ b/drivers/staging/media/rkvdec/rkvdec.h @@ -73,6 +73,8 @@ struct rkvdec_coded_fmt_ops { struct vb2_v4l2_buffer *dst_buf, enum vb2_buffer_state result); int (*try_ctrl)(struct rkvdec_ctx *ctx, struct v4l2_ctrl *ctrl); + enum rkvdec_image_fmt (*get_image_fmt)(struct rkvdec_ctx *ctx, + struct v4l2_ctrl *ctrl); }; enum rkvdec_image_fmt { -- 2.49.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v8 2/3] media: rkvdec: Add get_image_fmt ops 2025-04-17 17:14 ` [PATCH v8 2/3] media: rkvdec: Add get_image_fmt ops Nicolas Dufresne @ 2025-04-17 20:03 ` Nicolas Dufresne 0 siblings, 0 replies; 5+ messages in thread From: Nicolas Dufresne @ 2025-04-17 20:03 UTC (permalink / raw) To: Ezequiel Garcia, Mauro Carvalho Chehab, Greg Kroah-Hartman Cc: linux-media, linux-rockchip, linux-staging, linux-kernel, kernel, Jonas Karlman, Christopher Obbard Hi, Le jeudi 17 avril 2025 à 13:14 -0400, Nicolas Dufresne a écrit : > From: Jonas Karlman <jonas@kwiboo.se> > > Add support for a get_image_fmt() ops that returns the required image > format. > > The CAPTURE format is reset when the required image format changes and > the buffer queue is not busy. > > Signed-off-by: Jonas Karlman <jonas@kwiboo.se> > Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> > Tested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> > Tested-by: Christopher Obbard <chris.obbard@collabora.com> > Co-developed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> > Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> > --- > drivers/staging/media/rkvdec/rkvdec.c | 44 +++++++++++++++++++++++++++++++++-- > drivers/staging/media/rkvdec/rkvdec.h | 2 ++ > 2 files changed, 44 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c > index 65c6f1d07a493e017ae941780b823d41314a49b8..db01cc64f1ba2dcd5914537db41e2f51f454b186 100644 > --- a/drivers/staging/media/rkvdec/rkvdec.c > +++ b/drivers/staging/media/rkvdec/rkvdec.c > @@ -72,6 +72,15 @@ static bool rkvdec_is_valid_fmt(struct rkvdec_ctx *ctx, u32 fourcc, > return false; > } > > +static bool rkvdec_fmt_changed(struct rkvdec_ctx *ctx, > + enum rkvdec_image_fmt image_fmt) > +{ > + if (image_fmt == RKVDEC_IMG_FMT_ANY) > + return false; > + > + return ctx->image_fmt != image_fmt; > +} > + > static void rkvdec_fill_decoded_pixfmt(struct rkvdec_ctx *ctx, > struct v4l2_pix_format_mplane *pix_mp) > { > @@ -111,15 +120,46 @@ static int rkvdec_try_ctrl(struct v4l2_ctrl *ctrl) > { > struct rkvdec_ctx *ctx = container_of(ctrl->handler, struct rkvdec_ctx, ctrl_hdl); > const struct rkvdec_coded_fmt_desc *desc = ctx->coded_fmt_desc; > + int ret; > + > + if (desc->ops->try_ctrl) { > + ret = desc->ops->try_ctrl(ctx, ctrl); > + if (ret) > + return ret; > + } > + > + return 0; > +} > + > +static int rkvdec_s_ctrl(struct v4l2_ctrl *ctrl) > +{ > + struct rkvdec_ctx *ctx = container_of(ctrl->handler, struct rkvdec_ctx, ctrl_hdl); > + const struct rkvdec_coded_fmt_desc *desc = ctx->coded_fmt_desc; > + enum rkvdec_image_fmt image_fmt; > + struct vb2_queue *vq; > > - if (desc->ops->try_ctrl) > - return desc->ops->try_ctrl(ctx, ctrl); > + /* Check if this change requires a capture format reset */ > + if (!desc->ops->get_image_fmt) > + return 0; > + > + image_fmt = desc->ops->get_image_fmt(ctx, ctrl); > + if (rkvdec_fmt_changed(ctx, image_fmt)) { > + /* Format changes are not allowed when capture queue is busy */ > + vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, > + V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); > + if (vb2_is_busy(vq)) > + return -EINVAL; Sad to say, but this patch is bad, I've been testing the wrong kernel all along. This condition is reached before the queue is set (while the default control value is set). At the point, vq is null. I also came to realize the rkvdec_fmt_changed() is quite similar to the format match. I also assumed that if ctx->image_fmt is ANY, we should always reset, that's why the old code didn't not stumble on this issue. Please disregard this series, I'll make a v9. Nicolas > + > + ctx->image_fmt = image_fmt; > + rkvdec_reset_decoded_fmt(ctx); > + } > > return 0; > } > > static const struct v4l2_ctrl_ops rkvdec_ctrl_ops = { > .try_ctrl = rkvdec_try_ctrl, > + .s_ctrl = rkvdec_s_ctrl, > }; > > static const struct rkvdec_ctrl_desc rkvdec_h264_ctrl_descs[] = { > diff --git a/drivers/staging/media/rkvdec/rkvdec.h b/drivers/staging/media/rkvdec/rkvdec.h > index 6f8cf50c5d99aad2f52e321f54f3ca17166ddf98..e466a2753ccfc13738e0a672bc578e521af2c3f2 100644 > --- a/drivers/staging/media/rkvdec/rkvdec.h > +++ b/drivers/staging/media/rkvdec/rkvdec.h > @@ -73,6 +73,8 @@ struct rkvdec_coded_fmt_ops { > struct vb2_v4l2_buffer *dst_buf, > enum vb2_buffer_state result); > int (*try_ctrl)(struct rkvdec_ctx *ctx, struct v4l2_ctrl *ctrl); > + enum rkvdec_image_fmt (*get_image_fmt)(struct rkvdec_ctx *ctx, > + struct v4l2_ctrl *ctrl); > }; > > enum rkvdec_image_fmt { -- Nicolas Dufresne Principal Engineer at Collabora ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v8 3/3] media: rkvdec: h264: Support High 10 and 4:2:2 profiles 2025-04-17 17:14 [PATCH v8 0/3] media: rkvdec: Add H.264 High 10 and 4:2:2 profile support Nicolas Dufresne 2025-04-17 17:14 ` [PATCH v8 1/3] media: rkvdec: h264: Limit minimum profile to constrained baseline Nicolas Dufresne 2025-04-17 17:14 ` [PATCH v8 2/3] media: rkvdec: Add get_image_fmt ops Nicolas Dufresne @ 2025-04-17 17:14 ` Nicolas Dufresne 2 siblings, 0 replies; 5+ messages in thread From: Nicolas Dufresne @ 2025-04-17 17:14 UTC (permalink / raw) To: Ezequiel Garcia, Mauro Carvalho Chehab, Greg Kroah-Hartman Cc: linux-media, linux-rockchip, linux-staging, linux-kernel, Nicolas Dufresne, kernel, Jonas Karlman, Christopher Obbard From: Jonas Karlman <jonas@kwiboo.se> Add support and enable decoding of H264 High 10 and 4:2:2 profiles. Decoded CAPTURE buffer width is aligned to 64 pixels to accommodate HW requirement of 10-bit format buffers, fixes decoding of all the 4:2:2 and 10bit 4:2:2 flusters tests except two stream that present some visual artifacts. - Hi422FREXT17_SONY_A - Hi422FREXT19_SONY_A The get_image_fmt() ops is implemented to select an image format required for the provided SPS control, and returns RKVDEC_IMG_FMT_ANY for other controls. Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Tested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Tested-by: Christopher Obbard <chris.obbard@collabora.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> --- drivers/staging/media/rkvdec/rkvdec-h264.c | 37 ++++++++++++++++++++++------- drivers/staging/media/rkvdec/rkvdec.c | 38 +++++++++++++++++++++++------- drivers/staging/media/rkvdec/rkvdec.h | 3 +++ 3 files changed, 60 insertions(+), 18 deletions(-) diff --git a/drivers/staging/media/rkvdec/rkvdec-h264.c b/drivers/staging/media/rkvdec/rkvdec-h264.c index 8bce8902b8dda39bb2058c8504bd52ccae6b4204..d14b4d173448dbcce4ab978a83806064b100ca24 100644 --- a/drivers/staging/media/rkvdec/rkvdec-h264.c +++ b/drivers/staging/media/rkvdec/rkvdec-h264.c @@ -1027,24 +1027,42 @@ static int rkvdec_h264_adjust_fmt(struct rkvdec_ctx *ctx, return 0; } +static enum rkvdec_image_fmt rkvdec_h264_get_image_fmt(struct rkvdec_ctx *ctx, + struct v4l2_ctrl *ctrl) +{ + const struct v4l2_ctrl_h264_sps *sps = ctrl->p_new.p_h264_sps; + + if (ctrl->id != V4L2_CID_STATELESS_H264_SPS) + return RKVDEC_IMG_FMT_ANY; + + if (sps->bit_depth_luma_minus8 == 0) { + if (sps->chroma_format_idc == 2) + return RKVDEC_IMG_FMT_422_8BIT; + else + return RKVDEC_IMG_FMT_420_8BIT; + } else if (sps->bit_depth_luma_minus8 == 2) { + if (sps->chroma_format_idc == 2) + return RKVDEC_IMG_FMT_422_10BIT; + else + return RKVDEC_IMG_FMT_420_10BIT; + } + + return RKVDEC_IMG_FMT_ANY; +} + static int rkvdec_h264_validate_sps(struct rkvdec_ctx *ctx, const struct v4l2_ctrl_h264_sps *sps) { unsigned int width, height; - /* - * 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 */ + if (sps->chroma_format_idc > 2) + /* Only 4:0:0, 4:2:0 and 4:2:2 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 */ + if (sps->bit_depth_luma_minus8 != 0 && sps->bit_depth_luma_minus8 != 2) + /* Only 8-bit and 10-bit is supported */ return -EINVAL; width = (sps->pic_width_in_mbs_minus1 + 1) * 16; @@ -1190,4 +1208,5 @@ const struct rkvdec_coded_fmt_ops rkvdec_h264_fmt_ops = { .stop = rkvdec_h264_stop, .run = rkvdec_h264_run, .try_ctrl = rkvdec_h264_try_ctrl, + .get_image_fmt = rkvdec_h264_get_image_fmt, }; diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c index db01cc64f1ba2dcd5914537db41e2f51f454b186..d3485a591fc84c6aa506fc0371677f537fe20267 100644 --- a/drivers/staging/media/rkvdec/rkvdec.c +++ b/drivers/staging/media/rkvdec/rkvdec.c @@ -191,9 +191,10 @@ static const struct rkvdec_ctrl_desc rkvdec_h264_ctrl_descs[] = { { .cfg.id = V4L2_CID_MPEG_VIDEO_H264_PROFILE, .cfg.min = V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE, - .cfg.max = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH, + .cfg.max = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422_INTRA, .cfg.menu_skip_mask = - BIT(V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED), + BIT(V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED) | + BIT(V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_PREDICTIVE), .cfg.def = V4L2_MPEG_VIDEO_H264_PROFILE_MAIN, }, { @@ -208,11 +209,23 @@ static const struct rkvdec_ctrls rkvdec_h264_ctrls = { .num_ctrls = ARRAY_SIZE(rkvdec_h264_ctrl_descs), }; -static const struct rkvdec_decoded_fmt_desc rkvdec_h264_vp9_decoded_fmts[] = { +static const struct rkvdec_decoded_fmt_desc rkvdec_h264_decoded_fmts[] = { { .fourcc = V4L2_PIX_FMT_NV12, .image_fmt = RKVDEC_IMG_FMT_420_8BIT, }, + { + .fourcc = V4L2_PIX_FMT_NV15, + .image_fmt = RKVDEC_IMG_FMT_420_10BIT, + }, + { + .fourcc = V4L2_PIX_FMT_NV16, + .image_fmt = RKVDEC_IMG_FMT_422_8BIT, + }, + { + .fourcc = V4L2_PIX_FMT_NV20, + .image_fmt = RKVDEC_IMG_FMT_422_10BIT, + }, }; static const struct rkvdec_ctrl_desc rkvdec_vp9_ctrl_descs[] = { @@ -235,21 +248,28 @@ static const struct rkvdec_ctrls rkvdec_vp9_ctrls = { .num_ctrls = ARRAY_SIZE(rkvdec_vp9_ctrl_descs), }; +static const struct rkvdec_decoded_fmt_desc rkvdec_vp9_decoded_fmts[] = { + { + .fourcc = V4L2_PIX_FMT_NV12, + .image_fmt = RKVDEC_IMG_FMT_420_8BIT, + }, +}; + static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = { { .fourcc = V4L2_PIX_FMT_H264_SLICE, .frmsize = { - .min_width = 48, + .min_width = 64, .max_width = 4096, - .step_width = 16, + .step_width = 64, .min_height = 48, .max_height = 2560, .step_height = 16, }, .ctrls = &rkvdec_h264_ctrls, .ops = &rkvdec_h264_fmt_ops, - .num_decoded_fmts = ARRAY_SIZE(rkvdec_h264_vp9_decoded_fmts), - .decoded_fmts = rkvdec_h264_vp9_decoded_fmts, + .num_decoded_fmts = ARRAY_SIZE(rkvdec_h264_decoded_fmts), + .decoded_fmts = rkvdec_h264_decoded_fmts, .subsystem_flags = VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF, }, { @@ -264,8 +284,8 @@ static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = { }, .ctrls = &rkvdec_vp9_ctrls, .ops = &rkvdec_vp9_fmt_ops, - .num_decoded_fmts = ARRAY_SIZE(rkvdec_h264_vp9_decoded_fmts), - .decoded_fmts = rkvdec_h264_vp9_decoded_fmts, + .num_decoded_fmts = ARRAY_SIZE(rkvdec_vp9_decoded_fmts), + .decoded_fmts = rkvdec_vp9_decoded_fmts, } }; diff --git a/drivers/staging/media/rkvdec/rkvdec.h b/drivers/staging/media/rkvdec/rkvdec.h index e466a2753ccfc13738e0a672bc578e521af2c3f2..9a9f4fced7a184b952d341d75c7faedaa75163d6 100644 --- a/drivers/staging/media/rkvdec/rkvdec.h +++ b/drivers/staging/media/rkvdec/rkvdec.h @@ -80,6 +80,9 @@ struct rkvdec_coded_fmt_ops { enum rkvdec_image_fmt { RKVDEC_IMG_FMT_ANY = 0, RKVDEC_IMG_FMT_420_8BIT, + RKVDEC_IMG_FMT_420_10BIT, + RKVDEC_IMG_FMT_422_8BIT, + RKVDEC_IMG_FMT_422_10BIT, }; struct rkvdec_decoded_fmt_desc { -- 2.49.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-04-17 20:03 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-04-17 17:14 [PATCH v8 0/3] media: rkvdec: Add H.264 High 10 and 4:2:2 profile support Nicolas Dufresne 2025-04-17 17:14 ` [PATCH v8 1/3] media: rkvdec: h264: Limit minimum profile to constrained baseline Nicolas Dufresne 2025-04-17 17:14 ` [PATCH v8 2/3] media: rkvdec: Add get_image_fmt ops Nicolas Dufresne 2025-04-17 20:03 ` Nicolas Dufresne 2025-04-17 17:14 ` [PATCH v8 3/3] media: rkvdec: h264: Support High 10 and 4:2:2 profiles Nicolas Dufresne
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox