[{"id":33498,"web_url":"https://patchwork.libcamera.org/comment/33498/","msgid":"<zgs5b6fuyzuihrvsgkm3xxrv4gr6g2umw6lvafqetzsnizmxc5@6jvux4xfnyep>","date":"2025-02-26T20:40:11","subject":"Re: [PATCH] media: rkisp1: Apply full quantization when color space\n\tJPEG is requested","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"content":"Hi all,\n\nunfortunately I was tricked by my own observations and this patch\ndoesn't actually fix the problem. So please ignore. I'll post a proper\nfix soon.\n\nSorry for the noise.\n\nBest regards,\nStefan\n\nOn Wed, Feb 26, 2025 at 08:23:53PM +0100, Stefan Klug wrote:\n> When color space V4L2_COLORSPACE_JPEG is requested the ISP incorrectly\n> sets the output quantization to V4L2_QUANTIZATION_LIM_RANGE. Fix that by\n> applying the default quantization for the requested color space.\n> \n> Fixes: c1ec5efba080 (\"media: rkisp1: Allow setting all color space fields on ISP source pad\")\n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> ---\n>  drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c | 5 +++--\n>  1 file changed, 3 insertions(+), 2 deletions(-)\n> \n> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c\n> index d94917211828..98635d875ac4 100644\n> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c\n> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c\n> @@ -646,7 +646,7 @@ static void rkisp1_isp_set_src_fmt(struct rkisp1_isp *isp,\n>  \n>  \t/*\n>  \t * Copy the color space for the sink pad. When converting from Bayer to\n> -\t * YUV, default to a limited quantization range.\n> +\t * YUV, default to the default quantization range of the color space.\n>  \t */\n>  \tsrc_fmt->colorspace = sink_fmt->colorspace;\n>  \tsrc_fmt->xfer_func = sink_fmt->xfer_func;\n> @@ -654,7 +654,8 @@ static void rkisp1_isp_set_src_fmt(struct rkisp1_isp *isp,\n>  \n>  \tif (sink_info->pixel_enc == V4L2_PIXEL_ENC_BAYER &&\n>  \t    src_info->pixel_enc == V4L2_PIXEL_ENC_YUV)\n> -\t\tsrc_fmt->quantization = V4L2_QUANTIZATION_LIM_RANGE;\n> +\t\tsrc_fmt->quantization = V4L2_MAP_QUANTIZATION_DEFAULT(\n> +\t\t\tfalse, sink_fmt->colorspace, sink_fmt->ycbcr_enc);\n>  \telse\n>  \t\tsrc_fmt->quantization = sink_fmt->quantization;\n>  \n> -- \n> 2.43.0\n> \n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 0072FBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 26 Feb 2025 20:40:16 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0FBCB6874E;\n\tWed, 26 Feb 2025 21:40:16 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 44BDE61853\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 26 Feb 2025 21:40:14 +0100 (CET)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:2b29:76dc:a5a9:647c])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C9C1949E;\n\tWed, 26 Feb 2025 21:38:45 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"uUJUF/yQ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1740602325;\n\tbh=TXJqXbK1vX8NmA7FEpqCUeP7RrAU0Ywxmcnb5iP26BM=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=uUJUF/yQUab2QYU+TOwjAEATLWKwxseYippfVXxx28KOGRWekBNjBD6MfnddV6k/Q\n\t4gVA6WRE24YhBqVeORCByYnjzVTex42lX0ZP7k+K1/hHsN4pS+c27Q3Xs0KL/K6EGR\n\tgZx/e9/4UfYTtyXwXjnFKsKeG8hj7yWf5VE0LxPo=","Date":"Wed, 26 Feb 2025 21:40:11 +0100","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org, \n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tMauro Carvalho Chehab <mchehab@kernel.org>, \n\tPaul Elder <paul.elder@ideasonboard.com>,\n\tDafna Hirschfeld <dafna@fastmail.com>, \n\tlinux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, \n\tlinux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org","Cc":"Heiko Stuebner <heiko@sntech.de>","Subject":"Re: [PATCH] media: rkisp1: Apply full quantization when color space\n\tJPEG is requested","Message-ID":"<zgs5b6fuyzuihrvsgkm3xxrv4gr6g2umw6lvafqetzsnizmxc5@6jvux4xfnyep>","References":"<20250226192413.2903243-1-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20250226192413.2903243-1-stefan.klug@ideasonboard.com>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]