From patchwork Wed Jul 3 14:17:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 20535 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 B68DFBEFBE for ; Wed, 3 Jul 2024 14:18:37 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7495B6336F; Wed, 3 Jul 2024 16:18:37 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ki3bNeyy"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1D88B63370 for ; Wed, 3 Jul 2024 16:18:35 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:9263:c199:9587:576]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id F39C64CA; Wed, 3 Jul 2024 16:18:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1720016287; bh=/gVqIs0u6onaUPch87D8xNTLx3TCQPtgdC96/KTuCqc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ki3bNeyyh+1/KKbFnbYQry2+7puEHlYdj6bIhU3mvcLlIsvIFbVeA+0Iz62h5ISMI ssk7Cgyj9UZiJdiZ7eRcxeZrKveDjY5xe9p3+7mxV5gz5fiUOBcZ/NkhNjIzYiQUKV a3cr6XWcLw2NiWkjHtXKoDXTZ6d0pF81poAunR+I= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v3 21/23] libtuning: lsc: rkisp1: Do not calculate ratios to green Date: Wed, 3 Jul 2024 16:17:10 +0200 Message-ID: <20240703141726.252368-22-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240703141726.252368-1-stefan.klug@ideasonboard.com> References: <20240703141726.252368-1-stefan.klug@ideasonboard.com> 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" The current LSC algorithm for the rkisp1 just forwards the LSC tables to the hardware, so absolute factors are needed and not ratios compared to green. Therefore every channel needs to be calculated independently. Signed-off-by: Stefan Klug Reviewed-by: Laurent Pinchart Reviewed-by: Paul Elder --- utils/tuning/libtuning/modules/lsc/rkisp1.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/utils/tuning/libtuning/modules/lsc/rkisp1.py b/utils/tuning/libtuning/modules/lsc/rkisp1.py index 512233aeae9d..56df23ec7b42 100644 --- a/utils/tuning/libtuning/modules/lsc/rkisp1.py +++ b/utils/tuning/libtuning/modules/lsc/rkisp1.py @@ -38,8 +38,12 @@ class LSCRkISP1(LSC): # \todo Should these ratio against the average of both greens or just # each green like we've done here? - cr, _ = self._lsc_single_channel(image.channels[lt.Color.R], image, gr) - cb, _ = self._lsc_single_channel(image.channels[lt.Color.B], image, gb) + + # The LSC tables in the our rkisp1 algorithm represent gains on the + # corresponding channel, not ratios with respect to green, so calculate + # them independently + cr, _ = self._lsc_single_channel(image.channels[lt.Color.R], image, None) + cb, _ = self._lsc_single_channel(image.channels[lt.Color.B], image, None) return image.color, cr.flatten(), cb.flatten(), cgr.flatten(), cgb.flatten()