{"id":14065,"url":"https://patchwork.libcamera.org/api/1.1/patches/14065/?format=json","web_url":"https://patchwork.libcamera.org/patch/14065/","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":"<20211006140041.964542-9-jeanmichel.hautbois@ideasonboard.com>","date":"2021-10-06T14:00:38","name":"[libcamera-devel,v3,08/12] ipa: ipu3: awb: Correct the gain multipliers","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"91f4180dcf544ae0bcb1d8e39cb70d3882f5753c","submitter":{"id":75,"url":"https://patchwork.libcamera.org/api/1.1/people/75/?format=json","name":"Jean-Michel Hautbois","email":"jeanmichel.hautbois@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/14065/mbox/","series":[{"id":2605,"url":"https://patchwork.libcamera.org/api/1.1/series/2605/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2605","date":"2021-10-06T14:00:30","name":"Improve ImgU statistics usage","version":3,"mbox":"https://patchwork.libcamera.org/series/2605/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/14065/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/14065/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 83BABC323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  6 Oct 2021 14:01:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 39D08691C9;\n\tWed,  6 Oct 2021 16:01:13 +0200 (CEST)","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 D435E691C5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  6 Oct 2021 16:01:02 +0200 (CEST)","from tatooine.ideasonboard.com (unknown\n\t[IPv6:2a01:e0a:169:7140:843b:c831:54de:6e8c])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 46F25FFD;\n\tWed,  6 Oct 2021 16:01:02 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"OG1X8AWO\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1633528862;\n\tbh=3jseKx07R09HLzRif7yei3tfCVJt/so1W8hVpvcQ2Sw=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=OG1X8AWOqc3ZDywxVwd5bQ3Q3tfuS/rLYoyBx1cy79deySJUgVsnFNWWxc64z3ABJ\n\tIExyHGdgBqVM2zoo0ckoPUcWKEKSP0wYpsOZ5dtWYkWOc952WryqMyzslYL9fePR5C\n\ty6g5JYwNm5kdQkgWq38Ywz56a4pHCwthnJtnVOKU=","From":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  6 Oct 2021 16:00:38 +0200","Message-Id":"<20211006140041.964542-9-jeanmichel.hautbois@ideasonboard.com>","X-Mailer":"git-send-email 2.30.2","In-Reply-To":"<20211006140041.964542-1-jeanmichel.hautbois@ideasonboard.com>","References":"<20211006140041.964542-1-jeanmichel.hautbois@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 08/12] ipa: ipu3: awb: Correct the gain\n\tmultipliers","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":"The gains have a precision u3.13, range [0, 8[ which means that a gain\nmultiplier value of 1.0 is represented as a multiplication by 8192 in\nthe ImgU. Correct the gains as this was misunderstood in the first\nplace.\n\nSigned-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/ipa/ipu3/algorithms/awb.cpp | 15 ++++++---------\n 1 file changed, 6 insertions(+), 9 deletions(-)","diff":"diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp\nindex 1c294f31..2d875d0b 100644\n--- a/src/ipa/ipu3/algorithms/awb.cpp\n+++ b/src/ipa/ipu3/algorithms/awb.cpp\n@@ -317,6 +317,7 @@ void Awb::awbGreyWorld()\n \t/* Color temperature is not relevant in Grey world but still useful to estimate it :-) */\n \tasyncResults_.temperatureK = estimateCCT(sumRed.R, sumRed.G, sumBlue.B);\n \tasyncResults_.redGain = redGain;\n+\t/* Hardcode the green gain to 1.0. */\n \tasyncResults_.greenGain = 1.0;\n \tasyncResults_.blueGain = blueGain;\n }\n@@ -380,15 +381,11 @@ void Awb::prepare(IPAContext &context, ipu3_uapi_params *params)\n \t\t\t\t\t\t\t* params->acc_param.bnr.opt_center.x_reset;\n \tparams->acc_param.bnr.opt_center_sqr.y_sqr_reset = params->acc_param.bnr.opt_center.y_reset\n \t\t\t\t\t\t\t* params->acc_param.bnr.opt_center.y_reset;\n-\t/*\n-\t * Green gains should not be touched and considered 1.\n-\t * Default is 16, so do not change it at all.\n-\t * 4096 is the value for a gain of 1.0\n-\t */\n-\tparams->acc_param.bnr.wb_gains.gr = 16 * context.frameContext.awb.gains.green;\n-\tparams->acc_param.bnr.wb_gains.r = 4096 * context.frameContext.awb.gains.red;\n-\tparams->acc_param.bnr.wb_gains.b = 4096 * context.frameContext.awb.gains.blue;\n-\tparams->acc_param.bnr.wb_gains.gb = 16 * context.frameContext.awb.gains.green;\n+\t/* Convert to u3.13 fixed point values */\n+\tparams->acc_param.bnr.wb_gains.gr = 8192 * context.frameContext.awb.gains.green;\n+\tparams->acc_param.bnr.wb_gains.r  = 8192 * context.frameContext.awb.gains.red;\n+\tparams->acc_param.bnr.wb_gains.b  = 8192 * context.frameContext.awb.gains.blue;\n+\tparams->acc_param.bnr.wb_gains.gb = 8192 * context.frameContext.awb.gains.green;\n \n \tLOG(IPU3Awb, Debug) << \"Color temperature estimated: \" << asyncResults_.temperatureK;\n \n","prefixes":["libcamera-devel","v3","08/12"]}