* [PATCH] media: amphion: remove redundant check of colorspace in venc_s_fmt
@ 2022-11-29 10:22 Ming Qian
2022-12-06 19:18 ` Nicolas Dufresne
0 siblings, 1 reply; 2+ messages in thread
From: Ming Qian @ 2022-11-29 10:22 UTC (permalink / raw)
To: mchehab, hverkuil-cisco
Cc: shawnguo, robh+dt, s.hauer, kernel, festevam, linux-imx,
xiahong.bao, ming.zhou, linux-media, linux-kernel,
linux-arm-kernel
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>
---
drivers/media/platform/amphion/venc.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/drivers/media/platform/amphion/venc.c b/drivers/media/platform/amphion/venc.c
index 3cbe8ce637e5..e6e8fe45fc7c 100644
--- a/drivers/media/platform/amphion/venc.c
+++ b/drivers/media/platform/amphion/venc.c
@@ -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));
--
2.38.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] media: amphion: remove redundant check of colorspace in venc_s_fmt
2022-11-29 10:22 [PATCH] media: amphion: remove redundant check of colorspace in venc_s_fmt Ming Qian
@ 2022-12-06 19:18 ` Nicolas Dufresne
0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Dufresne @ 2022-12-06 19:18 UTC (permalink / raw)
To: Ming Qian, mchehab, hverkuil-cisco
Cc: shawnguo, robh+dt, s.hauer, kernel, festevam, linux-imx,
xiahong.bao, ming.zhou, linux-media, linux-kernel,
linux-arm-kernel
Le mardi 29 novembre 2022 à 18:22 +0800, Ming Qian a écrit :
> 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>
This seems like the right approach to me. The only down side, is that userspace
will not be aware that the encoder could not store the colorimetry into the
bitstream. What I totally agree, is that this should not prevent encoding the
stream, but the stream should also not lie about it (which this change fixes).
Acked-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> ---
> drivers/media/platform/amphion/venc.c | 18 ++++--------------
> 1 file changed, 4 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/media/platform/amphion/venc.c b/drivers/media/platform/amphion/venc.c
> index 3cbe8ce637e5..e6e8fe45fc7c 100644
> --- a/drivers/media/platform/amphion/venc.c
> +++ b/drivers/media/platform/amphion/venc.c
> @@ -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));
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-12-06 19:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-29 10:22 [PATCH] media: amphion: remove redundant check of colorspace in venc_s_fmt Ming Qian
2022-12-06 19:18 ` Nicolas Dufresne
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®