media: v4l2-common: add pixel encoding support
authorBenoit Parrot <bparrot@ti.com>
Mon, 7 Oct 2019 15:10:07 +0000 (12:10 -0300)
committerpopcornmix <popcornmix@gmail.com>
Wed, 1 Jul 2020 15:33:30 +0000 (16:33 +0100)
commit9ccbe7d6fc9aeb4ec37596a5eca8a1c96210667f
tree91e606fff9024806396bac14ad4e1812d46bf79c
parentc31a2a5cc871900b29f88eb4f84a680275b7c529
media: v4l2-common: add pixel encoding support

Commit d5a897c8428b38053df4b427a4277b1a0722bfa0 upstream.

It is often useful to figure out if a pixel_format is either YUV or RGB
especially for driver who can perform the pixel encoding conversion.

Instead of having each driver implement its own "is_this_yuv/rgb"
function based on a restricted set of pixel value, it is better to do
this in centralized manner.

We therefore add a pixel_enc member to the v4l2_format_info structure to
quickly identify the related pixel encoding.
And add helper functions to check pixel encoding.

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/v4l2-core/v4l2-common.c
include/media/v4l2-common.h