media: allegro: write correct colorspace into SPS
authorMichael Tretter <m.tretter@pengutronix.de>
Wed, 8 Sep 2021 13:03:53 +0000 (14:03 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Wed, 20 Oct 2021 15:00:28 +0000 (16:00 +0100)
commit0317c05fa15b64fe10b832eeab2354cf1b8ec831
treefdad269c9a97b0d0d13566f44baef079ab72b4c8
parente5c28f21916df73c5d794fa82d79ca3cce7ea1f3
media: allegro: write correct colorspace into SPS

Currently, the driver always writes PAL as video format into the SPS of
the encoded stream.

Set the video format to the default value 5 (unspecified) and use the
color description that is already configured on the channel as color
space. This fixes the color space definition in the coded data to
reflect the configured color space of the video data that is encoded.

Add lookup functions to convert the color primaries, transfer function
and matrix coefficients from the V4L2 control values to the values
specified in the h.264 standard.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/allegro-dvt/allegro-core.c
drivers/media/platform/allegro-dvt/nal-h264.h