{"id":22378,"url":"https://patchwork.libcamera.org/api/1.1/patches/22378/?format=json","web_url":"https://patchwork.libcamera.org/patch/22378/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20241217150007.376357-1-stefan.klug@ideasonboard.com>","date":"2024-12-17T14:59:35","name":"utils: tuning: libtuning: Fix tuning for non RGGB RAWs","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"2ef42c64b8078a34d02167b62d00965612a6ae24","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/1.1/people/184/?format=json","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/22378/mbox/","series":[{"id":4904,"url":"https://patchwork.libcamera.org/api/1.1/series/4904/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4904","date":"2024-12-17T14:59:35","name":"utils: tuning: libtuning: Fix tuning for non RGGB RAWs","version":1,"mbox":"https://patchwork.libcamera.org/series/4904/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/22378/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/22378/checks/","tags":{},"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 4F4D4BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 17 Dec 2024 15:00:15 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 558F267FD5;\n\tTue, 17 Dec 2024 16:00:14 +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 D77F267F0D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 Dec 2024 16:00:12 +0100 (CET)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:1451:ee40:8df6:656d])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 76D763E;\n\tTue, 17 Dec 2024 15:59:35 +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=\"leG01dPT\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1734447575;\n\tbh=g2aGI4gcNdTAnnVy5e3WxZJHshLnJ+V2K65qpbPiUSk=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=leG01dPTKTjB5zkZLWgyQd7VyF/7noWnjmcMDecddCwcRNISPdF/l0N3dcrJxO7zg\n\tw3luvQv+xsjXGbryJMladlmjbejn0Hx+kWI434MgNc7wr+DlOX5VCVhnnVWDYb4I+A\n\t6oYilAYAwZRPWhvF6uyCQY5JqHtfnnTmW/GBJ/24=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","Subject":"[PATCH] utils: tuning: libtuning: Fix tuning for non RGGB RAWs","Date":"Tue, 17 Dec 2024 15:59:35 +0100","Message-ID":"<20241217150007.376357-1-stefan.klug@ideasonboard.com>","X-Mailer":"git-send-email 2.43.0","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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>"},"content":"Tuning fails for raw images that don't have the channels ordered in\nRGGB.  In 19dc8c28f63c (\"utils: tuning: libtuning: Implement the core of\nlibtuning\") the channels of the image were reordered to RGGB\nunconditionally in _read_image_dng(). That change was not applied to the\nctt_awb code, so that the channels were reordered twice. Fix by removing\nthe double ordering.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n utils/tuning/libtuning/ctt_awb.py | 3 +--\n utils/tuning/libtuning/image.py   | 2 +-\n 2 files changed, 2 insertions(+), 3 deletions(-)","diff":"diff --git a/utils/tuning/libtuning/ctt_awb.py b/utils/tuning/libtuning/ctt_awb.py\nindex 117612f2582a..240f37e644bb 100644\n--- a/utils/tuning/libtuning/ctt_awb.py\n+++ b/utils/tuning/libtuning/ctt_awb.py\n@@ -302,10 +302,10 @@ def get_alsc_patches(Img, colour_cals, grey=True):\n     patches for each channel, remembering to subtract blacklevel\n     If grey then only greyscale patches considered\n     \"\"\"\n+    patches = Img.patches\n     if grey:\n         cen_coords = Img.cen_coords[3::4]\n         col = Img.color\n-        patches = [np.array(Img.patches[i]) for i in Img.order]\n         r_patchs = patches[0][3::4] - Img.blacklevel_16\n         b_patchs = patches[3][3::4] - Img.blacklevel_16\n         \"\"\"\n@@ -315,7 +315,6 @@ def get_alsc_patches(Img, colour_cals, grey=True):\n     else:\n         cen_coords = Img.cen_coords\n         col = Img.color\n-        patches = [np.array(Img.patches[i]) for i in Img.order]\n         r_patchs = patches[0] - Img.blacklevel_16\n         b_patchs = patches[3] - Img.blacklevel_16\n         g_patchs = (patches[1]+patches[2])/2 - Img.blacklevel_16\ndiff --git a/utils/tuning/libtuning/image.py b/utils/tuning/libtuning/image.py\nindex c8911a0ff125..ecd334bdc67f 100644\n--- a/utils/tuning/libtuning/image.py\n+++ b/utils/tuning/libtuning/image.py\n@@ -135,6 +135,6 @@ class Image:\n \n             all_patches.append(ch_patches)\n \n-        self.patches = all_patches\n+        self.patches = np.array(all_patches)\n \n         return not saturated\n","prefixes":[]}