[{"id":39224,"web_url":"https://patchwork.libcamera.org/comment/39224/","msgid":"<95262e15-0468-4bc9-9a6f-361eecedfde8@collabora.com>","date":"2026-06-22T09:13:56","subject":"Re: [PATCH 0/7] softisp: Fix Saturation and Black level handling","submitter":{"id":140,"url":"https://patchwork.libcamera.org/api/people/140/","name":"Robert Mader","email":"robert.mader@collabora.com"},"content":"Thanks a lot for the series! I just tested it on multiple devices, most \nimportantly on a FairPhone 5 with the following tuning file from \nKieran used for the imx858 as well as the s5kjn1:\n\n# SPDX-License-Identifier: CC0-1.0\n%YAML 1.1\n---\nversion: 1\nalgorithms:\n   - BlackLevel:\n       blackLevel: 4096\n   - Awb:\n   # Color correction matrices can be defined here. The CCM algorithm\n   # has a significant performance impact, and should only be enabled\n   # if tuned.\n   - Ccm:\n       ccms:\n         - ct: 2676\n           ccm: [ 2.02152, -0.41859, -0.60292,\n                 -0.59481,  2.21509, -0.62029,\n                 -0.44029, -1.16865,  2.60894 ]\n         - ct: 6890\n           ccm: [ 1.93867, -0.67486, -0.26381,\n                 -0.43049,  2.00702, -0.57652,\n                 -0.15696, -0.51345,  1.67041 ]\n   - Adjust:\n   - Agc:\n...\n\nand can confirm the previously observed saturation bugs are gone - \napplying the CCM now clearly improves the overall result and is IMO \nready for shipping in pmOS!\n\nNo other regressions spotted, thus the whole series is:\n\nTested-by: Robert Mader <robert.mader@collabora.com>\n\nOn 21.06.26 01:00, Kieran Bingham wrote:\n> These patches have floated around in various forms and versions, but\n> this series aims to collate the main parts of fixing black level and\n> saturation bugs in the SoftISP for both GPU ISP and CPU ISP.\n>\n> This is predominantly fixed by splitting the AWB gains out of the CCM\n> which has previously been 'combined'. Combining means we do not\n> correctly saturate at the sensor levels when applying gains. So now we\n> cna do that and clamp accordingly.\n>\n> To get there, I've added a new clamp operation to the Vector class (and\n> fixed up one usage of that in the rkisp1 ... yeah - I'm trying not to go\n> down rabbit holes, and focus on saturation but adding a clamp was a\n> previous review request ...)\n>\n> I've made use of Milan's existing Black Level Correction fixes, and\n> picked up and applied all previous review comments and refactoring to\n> get here.\n>\n> So far - this is tested on my x13s laptop (with an arbitrary tuning file\n> to make sure the CCM is tested) for both GPU and CPU ISP....\n>\n> Please test if you can and I'm really keen to merge these so that\n> both Jacopo's and Bryan's work can be rebased on top.\n>\n> Signed-off-by: Kieran Bingham<kieran.bingham@ideasonboard.com>\n> ---\n> Kieran Bingham (4):\n>        libcamera: vector: Add clamp operation\n>        ipa: rkisp1: awb: Utilise clamp function\n>        softisp: Split AWB from Combined Matrix\n>        shaders: bayer: Use native matrix multiplication\n>\n> Milan Zamazal (3):\n>        ipa: simple: Limit the black level value\n>        libcamera: software_isp: Fix black level application in GPU ISP\n>        libcamera: software_isp: Fix black level handling in CPU ISP\n>\n>   include/libcamera/internal/vector.h        |  8 ++++\n>   src/ipa/rkisp1/algorithms/awb.cpp          |  2 +-\n>   src/ipa/simple/algorithms/awb.cpp          | 16 ++------\n>   src/ipa/simple/algorithms/blc.cpp          |  7 ++--\n>   src/ipa/simple/ipa_context.h               |  5 +--\n>   src/libcamera/shaders/bayer_1x_packed.frag | 51 +++++-------------------\n>   src/libcamera/shaders/bayer_unpacked.frag  | 51 +++++-------------------\n>   src/libcamera/software_isp/debayer_cpu.cpp | 64 ++++++++++++++----------------\n>   src/libcamera/software_isp/debayer_egl.cpp | 18 +++------\n>   src/libcamera/software_isp/debayer_egl.h   |  3 ++\n>   src/libcamera/vector.cpp                   |  8 ++++\n>   test/vector.cpp                            |  1 +\n>   12 files changed, 83 insertions(+), 151 deletions(-)\n> ---\n> base-commit: 84e1336956a78f7b416f8bd2abf747d93ad64260\n> change-id: 20260620-kbingham-awb-saturation-39e26bd1b580\n>\n> Best regards,","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 358A4BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 22 Jun 2026 09:14:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 420306571C;\n\tMon, 22 Jun 2026 11:14:08 +0200 (CEST)","from sender4-op-o12.zoho.com (sender4-op-o12.zoho.com\n\t[136.143.188.12])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D47FD623CC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 22 Jun 2026 11:14:05 +0200 (CEST)","by mx.zohomail.com with SMTPS id 1782119640097151.8993820739471;\n\tMon, 22 Jun 2026 02:14:00 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=collabora.com\n\theader.i=robert.mader@collabora.com header.b=\"OWz/Z8p/\"; \n\tdkim-atps=neutral","ARC-Seal":"i=1; a=rsa-sha256; t=1782119641; cv=none; \n\td=zohomail.com; s=zohoarc; \n\tb=ZsrociRFtAiIvxUTxW3XrSheGBtoKyzwTCQtFsGITO2QLO9TNDah1WBYYUWmOjPUBPNjH07hl5crZTFWIGz4adDwNN2hxEsXyzqhA3OgFslOrATbJCAfPqcURY8gzQcso5+4U+qCd1xoqXt+DZtJQV3c3Atvds78pJ4i5eHZ8tE=","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; \n\ts=zohoarc; t=1782119641;\n\th=Content-Type:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To:Cc;\n\tbh=8T5zqT3yKBb+zicNFltwFZ4ZY7bDR0RNy9itJedTExs=; \n\tb=cp4maoxjgSAyBp1YsAU930GnN7mE5TpDpS5rJGzJrhWXKNaFkM3SVYWiGvN6RbtwebsXrrjS27Zx28/hQCe87jjpKF0lJkogx3bCvtDwQPzFJxjJvmBLH22nZw30agSZPOzpqzdIK/NGuE/hpZx30+/krQmx4IfWs+Q1vYbpZ5A=","ARC-Authentication-Results":"i=1; mx.zohomail.com;\n\tdkim=pass  header.i=collabora.com;\n\tspf=pass  smtp.mailfrom=robert.mader@collabora.com;\n\tdmarc=pass header.from=<robert.mader@collabora.com>","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1782119641;\n\ts=zohomail; d=collabora.com; i=robert.mader@collabora.com;\n\th=Content-Type:Message-ID:Date:Date:MIME-Version:Subject:Subject:To:To:References:From:From:In-Reply-To:Message-Id:Reply-To:Cc;\n\tbh=8T5zqT3yKBb+zicNFltwFZ4ZY7bDR0RNy9itJedTExs=;\n\tb=OWz/Z8p/lqW1Kp05nF6SCl42GXLGKCj3WCLgWSveQ9URdGDQSHCN1t+OPElCwU1/\n\tOGQsK7efaweET6g4ode1Zx38nwRH5755+Kj7C3Hzd+rCMYEilnKN4rt9aO2M/8Kn1Tu\n\tEcBhbN9iEEapY0BLCr81nj60UAuSLAQkNQnv9pH0=","Content-Type":"multipart/alternative;\n\tboundary=\"------------UxrsCTPBrn60tsVK09oy1DYC\"","Message-ID":"<95262e15-0468-4bc9-9a6f-361eecedfde8@collabora.com>","Date":"Mon, 22 Jun 2026 11:13:56 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH 0/7] softisp: Fix Saturation and Black level handling","To":"libcamera-devel@lists.libcamera.org","References":"<20260621-kbingham-awb-saturation-v1-0-b91ea59c6cfb@ideasonboard.com>","Content-Language":"en-US, de-DE","From":"Robert Mader <robert.mader@collabora.com>","In-Reply-To":"<20260621-kbingham-awb-saturation-v1-0-b91ea59c6cfb@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>"}}]