From: Detlev Casanova <detlev.casanova@collabora.com>
To: linux-kernel@vger.kernel.org
Cc: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Heiko Stuebner <heiko@sntech.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Hans Verkuil <hverkuil@xs4all.nl>,
Nicolas Dufresne <nicolas.dufresne@collabora.com>,
Andrzej Pietrasiewicz <andrzej.p@collabora.com>,
Jonas Karlman <jonas@kwiboo.se>,
Sebastian Reichel <sebastian.reichel@collabora.com>,
Niklas Cassel <cassel@kernel.org>,
Alexey Charkov <alchark@gmail.com>,
Dragan Simic <dsimic@manjaro.org>,
Jianfeng Liu <liujianfeng1994@gmail.com>,
Detlev Casanova <detlev.casanova@collabora.com>,
Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Kieran Bingham <kieran.bingham@ideasonboard.com>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Umang Jain <umang.jain@ideasonboard.com>,
Naushir Patuck <naush@raspberrypi.com>,
Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>,
Dmitry Perchanov <dmitry.perchanov@intel.com>,
Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-staging@lists.linux.dev, kernel@collabora.com
Subject: [PATCH v4 2/6] media: v4l2-ctrls-core: Set frame_mbs_only_flag by default in h264 SPS
Date: Tue, 25 Mar 2025 17:22:18 -0400 [thread overview]
Message-ID: <20250325213303.826925-3-detlev.casanova@collabora.com> (raw)
In-Reply-To: <20250325213303.826925-1-detlev.casanova@collabora.com>
This flag is needed for drivers that have a minimum height lower
than 32 pixels.
This is because when the flag is not set, the height is halved, which
would make it lower than 16 pixels if min height is 16.
Setting this flag will keep the height at its value and have a valid
SPS.
Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
---
drivers/media/v4l2-core/v4l2-ctrls-core.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/media/v4l2-core/v4l2-ctrls-core.c b/drivers/media/v4l2-core/v4l2-ctrls-core.c
index eeab6a5eb7bac..b2343f051e5b9 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls-core.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls-core.c
@@ -111,6 +111,7 @@ static void std_init_compound(const struct v4l2_ctrl *ctrl, u32 idx,
struct v4l2_ctrl_vp9_frame *p_vp9_frame;
struct v4l2_ctrl_fwht_params *p_fwht_params;
struct v4l2_ctrl_h264_scaling_matrix *p_h264_scaling_matrix;
+ struct v4l2_ctrl_h264_sps *p_h264_sps;
struct v4l2_ctrl_av1_sequence *p_av1_sequence;
void *p = ptr.p + idx * ctrl->elem_size;
@@ -179,6 +180,18 @@ static void std_init_compound(const struct v4l2_ctrl *ctrl, u32 idx,
*/
memset(p_h264_scaling_matrix, 16, sizeof(*p_h264_scaling_matrix));
break;
+ case V4L2_CTRL_TYPE_H264_SPS:
+ p_h264_sps = p;
+ /*
+ * Without V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY,
+ * frame_mbs_only_flag set to 0 will translate to a minimum
+ * height of 32 (see H.264 specification 7-8). Some driver may
+ * have a minimum size lower than 32, which would fail
+ * validation with the SPS value. Set this flag, so that there
+ * is now doubling in the height, allowing a valid default.
+ */
+ p_h264_sps->flags = V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY;
+ break;
}
}
--
2.49.0
next prev parent reply other threads:[~2025-03-25 21:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-25 21:22 [PATCH v4 0/6] media: rockchip: Add rkvdec2 driver Detlev Casanova
2025-03-25 21:22 ` [PATCH v4 1/6] media: v4l2: Add NV15 and NV20 pixel formats Detlev Casanova
2025-03-28 23:09 ` Diederik de Haas
2025-04-08 21:08 ` Nicolas Dufresne
2025-03-25 21:22 ` Detlev Casanova [this message]
2025-03-25 21:22 ` [PATCH v4 3/6] media: rockchip: Move H264 CABAC table to header file Detlev Casanova
2025-03-25 21:22 ` [PATCH v4 4/6] media: rockchip: Introduce the rkvdec2 driver Detlev Casanova
2025-03-25 21:22 ` [PATCH v4 5/6] media: dt-bindings: rockchip: Document RK3588 Video Decoder bindings Detlev Casanova
2025-03-27 8:04 ` Krzysztof Kozlowski
2025-03-25 21:22 ` [PATCH v4 6/6] arm64: dts: rockchip: Add rkvdec2 Video Decoder on rk3588(s) Detlev Casanova
2025-04-08 13:16 ` Heiko Stübner
2025-04-08 18:34 ` Jonas Karlman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250325213303.826925-3-detlev.casanova@collabora.com \
--to=detlev.casanova@collabora.com \
--cc=alchark@gmail.com \
--cc=andrzej.p@collabora.com \
--cc=cassel@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.perchanov@intel.com \
--cc=dsimic@manjaro.org \
--cc=ezequiel@vanguardiasur.com.ar \
--cc=gregkh@linuxfoundation.org \
--cc=heiko@sntech.de \
--cc=hverkuil@xs4all.nl \
--cc=jacopo.mondi@ideasonboard.com \
--cc=jeanmichel.hautbois@ideasonboard.com \
--cc=jonas@kwiboo.se \
--cc=kernel@collabora.com \
--cc=kieran.bingham@ideasonboard.com \
--cc=krzk+dt@kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-staging@lists.linux.dev \
--cc=liujianfeng1994@gmail.com \
--cc=mchehab@kernel.org \
--cc=naush@raspberrypi.com \
--cc=nicolas.dufresne@collabora.com \
--cc=robh@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=sebastian.reichel@collabora.com \
--cc=tomi.valkeinen@ideasonboard.com \
--cc=umang.jain@ideasonboard.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox