media: rkvdec: h264: Validate and use pic width and height in mbs
authorJonas Karlman <jonas@kwiboo.se>
Fri, 13 May 2022 20:29:14 +0000 (22:29 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Tue, 17 May 2022 08:06:31 +0000 (10:06 +0200)
commit77e74be83083194f949f4979a35dec9012348d3b
treeb8c156c53dee7d7e8c9dd64ae849de3b5ab64c5b
parentcf76bb4d5e74ac4211f1fa47052b30fa7dd6443f
media: rkvdec: h264: Validate and use pic width and height in mbs

The width and height in macroblocks is currently configured based on OUTPUT
buffer resolution, this works for frame pictures but can cause issues for
field pictures.

When frame_mbs_only_flag is 0 the height in mbs should be height of
the field instead of height of frame.

Validate pic_width_in_mbs_minus1 and pic_height_in_map_units_minus1
against OUTPUT buffer resolution and use these values to configure HW.
The validation is happening in both try_ctrt() and start() since it is
otherwise possible to trick the driver during initialization by changing
the OUTPUT format after having set a valid control.

[hverkuil: when -> When (first word in a comment block)]

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/staging/media/rkvdec/rkvdec-h264.c