From patchwork Wed Feb 26 19:23:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 22882 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 6C88BC324C for ; Wed, 26 Feb 2025 19:27:40 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 630CA6874C; Wed, 26 Feb 2025 20:27:39 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="NW8lxxvD"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4A7FF61853 for ; Wed, 26 Feb 2025 20:27:37 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:2b29:76dc:a5a9:647c]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 92A9C49E; Wed, 26 Feb 2025 20:26:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1740597968; bh=TR7F1RtqVngJgjrbPnHgmwGaX8T2VMKYSMSpMKAAPlE=; h=From:To:Cc:Subject:Date:From; b=NW8lxxvDmzfPYMXpgDSCd6IHHfUuXIIuesoKkEjM/CbPFSewuNBLXD2Ac6G4j/+ew Hg/pFr74tx67Rjt5r7WVNu3NLh/jjThLjdQ/lqtCRYThnm5hfSExf/UFMyKHXBAHNY RlF/Q/CmwML/jQGYJLlZPFuU7l/PlcwhAfIYdI9Q= From: Stefan Klug To: libcamera-devel@lists.libcamera.org, Laurent Pinchart , Mauro Carvalho Chehab , Paul Elder , Dafna Hirschfeld , linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Stefan Klug , Heiko Stuebner Subject: [PATCH] media: rkisp1: Apply full quantization when color space JPEG is requested Date: Wed, 26 Feb 2025 20:23:53 +0100 Message-ID: <20250226192413.2903243-1-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" When color space V4L2_COLORSPACE_JPEG is requested the ISP incorrectly sets the output quantization to V4L2_QUANTIZATION_LIM_RANGE. Fix that by applying the default quantization for the requested color space. Fixes: c1ec5efba080 ("media: rkisp1: Allow setting all color space fields on ISP source pad") Signed-off-by: Stefan Klug --- drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c index d94917211828..98635d875ac4 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c @@ -646,7 +646,7 @@ static void rkisp1_isp_set_src_fmt(struct rkisp1_isp *isp, /* * Copy the color space for the sink pad. When converting from Bayer to - * YUV, default to a limited quantization range. + * YUV, default to the default quantization range of the color space. */ src_fmt->colorspace = sink_fmt->colorspace; src_fmt->xfer_func = sink_fmt->xfer_func; @@ -654,7 +654,8 @@ static void rkisp1_isp_set_src_fmt(struct rkisp1_isp *isp, if (sink_info->pixel_enc == V4L2_PIXEL_ENC_BAYER && src_info->pixel_enc == V4L2_PIXEL_ENC_YUV) - src_fmt->quantization = V4L2_QUANTIZATION_LIM_RANGE; + src_fmt->quantization = V4L2_MAP_QUANTIZATION_DEFAULT( + false, sink_fmt->colorspace, sink_fmt->ycbcr_enc); else src_fmt->quantization = sink_fmt->quantization;