[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250227114558.3097101-2-stefan.klug@ideasonboard.com>
Date: Thu, 27 Feb 2025 12:44:59 +0100
From: Stefan Klug <stefan.klug@...asonboard.com>
To: linux-media@...r.kernel.org,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Dafna Hirschfeld <dafna@...tmail.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Heiko Stuebner <heiko@...ech.de>
Cc: Stefan Klug <stefan.klug@...asonboard.com>,
linux-rockchip@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 1/3] media: rkisp1: Set format defaults based on requested color space
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. Do this only in case we are converting
from RAW to YUV.
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,
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)
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);
}
if (format->quantization != V4L2_QUANTIZATION_DEFAULT)
--
2.43.0
Powered by blists - more mailing lists