media: amphion: remove redundant check of colorspace in venc_s_fmt
authorMing Qian <ming.qian@nxp.com>
Tue, 29 Nov 2022 10:22:17 +0000 (11:22 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Mon, 6 Feb 2023 07:57:57 +0000 (08:57 +0100)
record the colorspace set by user.
if it's not supported by h264 vui, then zero will be written to vui,
but don't modify the user setting.

Fixes: 0401e659c1f9 ("media: amphion: add v4l2 m2m vpu encoder stateful driver")
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Acked-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/platform/amphion/venc.c

index 3cbe8ce637e544e60309c7cc2db09caff8d47aaf..e6e8fe45fc7c3e2b7cb5fdaf4f22bd67ef98a0c7 100644 (file)
@@ -250,19 +250,10 @@ static int venc_s_fmt(struct file *file, void *fh, struct v4l2_format *f)
        }
 
        if (V4L2_TYPE_IS_OUTPUT(f->type)) {
-               if (!vpu_color_check_primaries(pix_mp->colorspace)) {
-                       venc->params.color.primaries = pix_mp->colorspace;
-                       vpu_color_get_default(venc->params.color.primaries,
-                                             &venc->params.color.transfer,
-                                             &venc->params.color.matrix,
-                                             &venc->params.color.full_range);
-               }
-               if (!vpu_color_check_transfers(pix_mp->xfer_func))
-                       venc->params.color.transfer = pix_mp->xfer_func;
-               if (!vpu_color_check_matrix(pix_mp->ycbcr_enc))
-                       venc->params.color.matrix = pix_mp->ycbcr_enc;
-               if (!vpu_color_check_full_range(pix_mp->quantization))
-                       venc->params.color.full_range = pix_mp->quantization;
+               venc->params.color.primaries = pix_mp->colorspace;
+               venc->params.color.transfer = pix_mp->xfer_func;
+               venc->params.color.matrix = pix_mp->ycbcr_enc;
+               venc->params.color.full_range = pix_mp->quantization;
        }
 
        pix_mp->colorspace = venc->params.color.primaries;
@@ -1281,7 +1272,6 @@ static void venc_init(struct file *file)
        f.fmt.pix_mp.width = 1280;
        f.fmt.pix_mp.height = 720;
        f.fmt.pix_mp.field = V4L2_FIELD_NONE;
-       f.fmt.pix_mp.colorspace = V4L2_COLORSPACE_REC709;
        venc_s_fmt(file, &inst->fh, &f);
 
        memset(&f, 0, sizeof(f));