]> Gentwo Git Trees - linux/.git/commit
media: v4l2-ctrls: add full AV1 profile validation in validate_av1_sequence()
authorPavan Bobba <opensource206@gmail.com>
Sat, 13 Sep 2025 10:52:46 +0000 (16:22 +0530)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Mon, 20 Oct 2025 07:23:17 +0000 (09:23 +0200)
commit2ce45197befbdc60f72288346c67930db3a4489e
treeb4bf5613ada970060e2b50d8f6ff4eb3606b8da4
parentcdd0f118ef87db8a664fb5ea366fd1766d2df1cd
media: v4l2-ctrls: add full AV1 profile validation in validate_av1_sequence()

Complete the "TODO: PROFILES" by enforcing profile-specific and
monochrome constraints as defined by the AV1 specification
(Section 5.5.2, "Color config syntax").

The validator now checks:

 - Flags: reject any unknown bits set in sequence->flags
 - Profile range: only profiles 0..2 are valid
 - Profile 0: 8/10-bit only, subsampling must be 4:2:0 (sx=1, sy=1),
   monochrome allowed
 - Profile 1: 8/10-bit only, subsampling must be 4:4:4 (sx=0, sy=0),
   monochrome forbidden
 - Profile 2:
    * 8/10-bit: only 4:2:2 allowed (sx=1, sy=0)
    * 12-bit: 4:4:4 (sx=0, sy=0), 4:2:2 (sx=1, sy=0), or 4:2:0 (sx=1, sy=1)
      allowed
 - Monochrome path (all profiles except 1): forces subsampling_x=1,
   subsampling_y=1, separate_uv_delta_q=0

These checks prevent userspace from providing invalid AV1 sequence
headers that would otherwise be accepted, leading to undefined driver
or hardware behavior.

Signed-off-by: Pavan Bobba <opensource206@gmail.com>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/v4l2-core/v4l2-ctrls-core.c