* [PATCH] media: v4l2-ctrls: Fix H264 SEPARATE_COLOUR_PLANE check
@ 2025-06-04 14:38 James Cowgill
2025-06-04 15:35 ` Nicolas Dufresne
0 siblings, 1 reply; 3+ messages in thread
From: James Cowgill @ 2025-06-04 14:38 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Hans Verkuil, Ezequiel Garcia
Cc: James Cowgill, linux-media@vger.kernel.org,
linux-kernel@vger.kernel.org
The `separate_colour_plane_flag` element is only present in the SPS if
`chroma_format_idc == 3`, so the corresponding flag should be disabled
whenever that is not the case and not just on profiles where
`chroma_format_idc` is not present.
Fixes: b32e48503df0 ("media: controls: Validate H264 stateless controls")
Signed-off-by: James Cowgill <james.cowgill@blaize.com>
---
drivers/media/v4l2-core/v4l2-ctrls-core.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/media/v4l2-core/v4l2-ctrls-core.c b/drivers/media/v4l2-core/v4l2-ctrls-core.c
index 90d25329661e..b45809a82f9a 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls-core.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls-core.c
@@ -968,12 +968,12 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,
p_h264_sps->flags &=
~V4L2_H264_SPS_FLAG_QPPRIME_Y_ZERO_TRANSFORM_BYPASS;
-
- if (p_h264_sps->chroma_format_idc < 3)
- p_h264_sps->flags &=
- ~V4L2_H264_SPS_FLAG_SEPARATE_COLOUR_PLANE;
}
+ if (p_h264_sps->chroma_format_idc < 3)
+ p_h264_sps->flags &=
+ ~V4L2_H264_SPS_FLAG_SEPARATE_COLOUR_PLANE;
+
if (p_h264_sps->flags & V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY)
p_h264_sps->flags &=
~V4L2_H264_SPS_FLAG_MB_ADAPTIVE_FRAME_FIELD;
--
2.49.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] media: v4l2-ctrls: Fix H264 SEPARATE_COLOUR_PLANE check
2025-06-04 14:38 [PATCH] media: v4l2-ctrls: Fix H264 SEPARATE_COLOUR_PLANE check James Cowgill
@ 2025-06-04 15:35 ` Nicolas Dufresne
2025-06-04 23:14 ` James Cowgill
0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Dufresne @ 2025-06-04 15:35 UTC (permalink / raw)
To: James Cowgill, Mauro Carvalho Chehab, Hans Verkuil,
Ezequiel Garcia
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Hi James,
Le mercredi 04 juin 2025 à 14:38 +0000, James Cowgill a écrit :
> The `separate_colour_plane_flag` element is only present in the SPS if
> `chroma_format_idc == 3`, so the corresponding flag should be disabled
> whenever that is not the case and not just on profiles where
> `chroma_format_idc` is not present.
The fix seems correct indeed. This has no incidence on any current driver, since
there is nothing upstream that supports decoding 4:4:4. Would you mind if we
extend the commit with something such as:
This prevents invalid flags being passed, though no upstream drivers
currently supports YCbCr 4:4:4 decoding.
Feel free to to suggest a better edit. It will make stable people (and bot) aware
of the patch priority. I can make the edit while applying.
regards,
Nicolas
>
> Fixes: b32e48503df0 ("media: controls: Validate H264 stateless controls")
> Signed-off-by: James Cowgill <james.cowgill@blaize.com>
> ---
> drivers/media/v4l2-core/v4l2-ctrls-core.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-core.c b/drivers/media/v4l2-core/v4l2-ctrls-core.c
> index 90d25329661e..b45809a82f9a 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls-core.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls-core.c
> @@ -968,12 +968,12 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,
>
> p_h264_sps->flags &=
> ~V4L2_H264_SPS_FLAG_QPPRIME_Y_ZERO_TRANSFORM_BYPASS;
> -
> - if (p_h264_sps->chroma_format_idc < 3)
> - p_h264_sps->flags &=
> - ~V4L2_H264_SPS_FLAG_SEPARATE_COLOUR_PLANE;
> }
>
> + if (p_h264_sps->chroma_format_idc < 3)
> + p_h264_sps->flags &=
> + ~V4L2_H264_SPS_FLAG_SEPARATE_COLOUR_PLANE;
> +
> if (p_h264_sps->flags & V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY)
> p_h264_sps->flags &=
> ~V4L2_H264_SPS_FLAG_MB_ADAPTIVE_FRAME_FIELD;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] media: v4l2-ctrls: Fix H264 SEPARATE_COLOUR_PLANE check
2025-06-04 15:35 ` Nicolas Dufresne
@ 2025-06-04 23:14 ` James Cowgill
0 siblings, 0 replies; 3+ messages in thread
From: James Cowgill @ 2025-06-04 23:14 UTC (permalink / raw)
To: Nicolas Dufresne, Mauro Carvalho Chehab, Hans Verkuil,
Ezequiel Garcia
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Hi Nicolas,
On 04/06/2025 16:35, Nicolas Dufresne wrote:
> Le mercredi 04 juin 2025 à 14:38 +0000, James Cowgill a écrit :
>> The `separate_colour_plane_flag` element is only present in the SPS if
>> `chroma_format_idc == 3`, so the corresponding flag should be disabled
>> whenever that is not the case and not just on profiles where
>> `chroma_format_idc` is not present.
>
>
> The fix seems correct indeed. This has no incidence on any current driver, since
> there is nothing upstream that supports decoding 4:4:4. Would you mind if we
> extend the commit with something such as:
>
> This prevents invalid flags being passed, though no upstream drivers
> currently supports YCbCr 4:4:4 decoding.
>
> Feel free to to suggest a better edit. It will make stable people (and bot) aware
> of the patch priority. I can make the edit while applying.
That wording seems fine to me.
And yes this patch was just based on me reading the code - it doesn't
fix any actual breakage (at least for now).
Thanks,
James
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-06-04 23:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-04 14:38 [PATCH] media: v4l2-ctrls: Fix H264 SEPARATE_COLOUR_PLANE check James Cowgill
2025-06-04 15:35 ` Nicolas Dufresne
2025-06-04 23:14 ` James Cowgill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).