]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
media: v4l2-core: Initialize h264 scaling matrix
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Fri, 18 Feb 2022 18:42:07 +0000 (13:42 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 12:05:51 +0000 (14:05 +0200)
commitf6ce8604b7f61740ea1d8e64e3560073a68406ed
treeb1702f7a70d18a993f3dcdae9d20f97af8f4c102
parent80ba0bc740d7a63ca2e1184eed90fbb4e9c2622f
media: v4l2-core: Initialize h264 scaling matrix

[ Upstream commit 0f6146d476fc99862899e70f2554ee77b444b7b9 ]

In the final H264 API, it is not required to set scaling matrix if
they are not present in the bitstream. A flag was added in order to let
the driver know. The downside is that it leaves the default control
value to 0, which isn't valid. As per the spec (see formulas 7-8/7-9),
when the scaling matrix are absent from the bitstream, flat values
of 16 should be used. This improves this control semantic in a way
that the control value are always valid. Drivers can then use
the scaling_matrix control values without having to check its presence.
Same method was employed for MPEG2_QUANTISATION.

This fixes issues with MTK VCODEC H264 decoder when using GStreamer.
GStreamer does not set this control if its not present in the bitstream.
As MTK VDCODEC was using the initialized to 0 values, the frames ended
up completely gray.

Fixes: 54889c51b833d236 ("media: uapi: h264: Rename and clarify PPS_FLAG_SCALING_MATRIX_PRESENT")
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/v4l2-core/v4l2-ctrls-core.c