[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250301010252.GI7342@pendragon.ideasonboard.com>
Date: Sat, 1 Mar 2025 03:02:52 +0200
From: Laurent Pinchart <laurent.pinchart@...asonboard.com>
To: Stefan Klug <stefan.klug@...asonboard.com>
Cc: linux-media@...r.kernel.org, Dafna Hirschfeld <dafna@...tmail.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Heiko Stuebner <heiko@...ech.de>,
linux-rockchip@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] media: rkisp1: Set format defaults based on
requested color space
Hi Stefan,
Thank you for the patch.
On Thu, Feb 27, 2025 at 12:44:59PM +0100, Stefan Klug wrote:
> When color space JPEG is requested, the ISP sets the quantization
> incorrectly to limited range. To fix that, set the xfer_func, ycbcr_enc
> and quantization to the defaults for the requested color space if they
> are not specified explicitly.
The commit message fails to explain why you're addressing xfer_func and
ycbcr_enc to fix the quantization issue.
> Do this only in case we are converting
> from RAW to YUV.
And this should explain why.
> Signed-off-by: Stefan Klug <stefan.klug@...asonboard.com>
> ---
> .../media/platform/rockchip/rkisp1/rkisp1-isp.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
> index d94917211828..468f5a7d03c7 100644
> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
> @@ -680,10 +680,23 @@ static void rkisp1_isp_set_src_fmt(struct rkisp1_isp *isp,
Adding a bit more context:
set_csc = format->flags & V4L2_MBUS_FRAMEFMT_SET_CSC;
if (set_csc && src_info->pixel_enc == V4L2_PIXEL_ENC_YUV) {
If V4L2_MBUS_FRAMEFMT_SET_CSC isn't set, the colorspace fields on the
source pad will be copied from the sink pad, which doesn't seem right.
It's a separate issue, but fixing both together may lead to better code.
> if (sink_info->pixel_enc == V4L2_PIXEL_ENC_BAYER) {
> if (format->colorspace != V4L2_COLORSPACE_DEFAULT)
> src_fmt->colorspace = format->colorspace;
> - if (format->xfer_func != V4L2_XFER_FUNC_DEFAULT)
> +
> + if (format->xfer_func == V4L2_XFER_FUNC_DEFAULT)
Are you sure the condition should be inverted ?
> src_fmt->xfer_func = format->xfer_func;
> + else
> + src_fmt->xfer_func =
> + V4L2_MAP_XFER_FUNC_DEFAULT(format->colorspace);
> +
> if (format->ycbcr_enc != V4L2_YCBCR_ENC_DEFAULT)
> src_fmt->ycbcr_enc = format->ycbcr_enc;
> + else
> + src_fmt->ycbcr_enc =
> + V4L2_MAP_YCBCR_ENC_DEFAULT(format->colorspace);
> +
> + if (format->quantization == V4L2_QUANTIZATION_DEFAULT)
> + src_fmt->quantization =
> + V4L2_MAP_QUANTIZATION_DEFAULT(false,
> + format->colorspace, format->ycbcr_enc);
Shouldn't this use src_fmt instead of format ?
I think quantization handling could be moved below.
> }
>
> if (format->quantization != V4L2_QUANTIZATION_DEFAULT)
--
Regards,
Laurent Pinchart
Powered by blists - more mailing lists