{"id":17437,"url":"https://patchwork.libcamera.org/api/patches/17437/?format=json","web_url":"https://patchwork.libcamera.org/patch/17437/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20220927023642.12341-27-laurent.pinchart@ideasonboard.com>","date":"2022-09-27T02:36:35","name":"[libcamera-devel,v5,26/33] ipa: rkisp1: awb: Use frame context to fix gains calculations","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"07faccda8b81ed7e9649b32cd6e985048d388475","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/17437/mbox/","series":[{"id":3506,"url":"https://patchwork.libcamera.org/api/series/3506/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3506","date":"2022-09-27T02:36:09","name":"ipa: Frame context queue, IPU3 & RkISP consolidation, and RkISP1 improvements","version":5,"mbox":"https://patchwork.libcamera.org/series/3506/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/17437/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/17437/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 BEA69C0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 27 Sep 2022 02:37:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8074B622E7;\n\tTue, 27 Sep 2022 04:37:42 +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 B50F76227A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 27 Sep 2022 04:37:40 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 38607E5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 27 Sep 2022 04:37:40 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1664246262;\n\tbh=GcSa94Jrazj/EAi+vuDxoDwbhhojdBEJ8UWXSrd03HA=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=cUq8F6Tq3TcsRZPgQWaNDyli6X9ok/TgbqLksOSlEGtHI08cq/SVRBVKufvGqs+vj\n\tgPa0q9ILTM/1xPLQbTPur0sTthNGPl6PlVd80stRBykzU8p/s+UvKZXm1gBkeMZDrW\n\tTVGhxTNnLYw88KB3dwltToLiBpiXDeKn06NlSjDLiUGRMhburWz1tr0J9H90a3Dpfb\n\t4Wxd127SIYh+5k4u5PG+4TdK6Lpb/ggBmG7lSQL8Ypy3JsyiG+pnlFt4CP3YHKiTfA\n\tZzYSXcfQ4gYhK3BeHoJC1PIql1rZl/XNg51dknZKP4NmabkEDynKSfM/qi1onAEVYO\n\t7Oaq8EnlqDP7Q==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1664246260;\n\tbh=GcSa94Jrazj/EAi+vuDxoDwbhhojdBEJ8UWXSrd03HA=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=aYn8SXblmJUy7BsusBKQqnnzfVFnMEbVOPeLCfKNYS/RU17yV2hZTnLLqXXBWOs/D\n\tNmL44y9qydpsvRy04P4uyyUOcnYdpfo8G9eq8eq4SJ2qz7KL7xcnXGKynTxIvKlOFL\n\tTFAOFlHZoQ+2mDbTM1EVlEWYby7QjgQFIH9X4ILU="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"aYn8SXbl\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 27 Sep 2022 05:36:35 +0300","Message-Id":"<20220927023642.12341-27-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.35.1","In-Reply-To":"<20220927023642.12341-1-laurent.pinchart@ideasonboard.com>","References":"<20220927023642.12341-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v5 26/33] ipa: rkisp1: awb: Use frame\n\tcontext to fix gains calculations","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>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The AWB statistics are computed after the ISP applies the colour gains.\nThis means that the red, green and blue means do not match the data\ncoming directly from the sensor, but are multiplied by the colour gains\nthat were used for the frame on which the statistics have been computed.\nThe AWB algorithm needs to take this into account when calculating the\ncolour gains for the next frame. Do so by dividing the means by the\ngains that were applied to the frame, retrieved from the frame context.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/ipa/rkisp1/algorithms/awb.cpp | 9 +++++++++\n 1 file changed, 9 insertions(+)","diff":"diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp\nindex e491cf7507e0..694d97cccc07 100644\n--- a/src/ipa/rkisp1/algorithms/awb.cpp\n+++ b/src/ipa/rkisp1/algorithms/awb.cpp\n@@ -207,6 +207,15 @@ void Awb::process(IPAContext &context,\n \tdouble greenMean = 1.1636 * yMean - 0.4045 * cbMean - 0.7949 * crMean;\n \tdouble blueMean = 1.1636 * yMean + 1.9912 * cbMean - 0.0250 * crMean;\n \n+\t/*\n+\t * The ISP computes the AWB means after applying the colour gains,\n+\t * divide by the gains that were used to get the raw means from the\n+\t * sensor.\n+\t */\n+\tredMean /= frameContext.awb.gains.red;\n+\tgreenMean /= frameContext.awb.gains.green;\n+\tblueMean /= frameContext.awb.gains.blue;\n+\n \tframeContext.awb.temperatureK = estimateCCT(redMean, greenMean, blueMean);\n \n \t/* Estimate the red and blue gains to apply in a grey world. */\n","prefixes":["libcamera-devel","v5","26/33"]}