{"id":20658,"url":"https://patchwork.libcamera.org/api/patches/20658/?format=json","web_url":"https://patchwork.libcamera.org/patch/20658/","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":"<20240712143227.3036702-4-stefan.klug@ideasonboard.com>","date":"2024-07-12T14:32:04","name":"[v1,3/5] ipa: rkisp1: awb: Unconditionally fill metadata","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"acd9a1f24dd99d83515b8a0b6f31646a1441faa5","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/?format=json","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/20658/mbox/","series":[{"id":4452,"url":"https://patchwork.libcamera.org/api/series/4452/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4452","date":"2024-07-12T14:32:01","name":"A few fixes for the rkisp1 ipa","version":1,"mbox":"https://patchwork.libcamera.org/series/4452/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/20658/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/20658/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 260ECBD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 12 Jul 2024 14:32:53 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AB01B6336F;\n\tFri, 12 Jul 2024 16:32:52 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6E3F56336D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 12 Jul 2024 16:32:47 +0200 (CEST)","from ideasonboard.com (unknown [94.31.101.36])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E9EBC7E3;\n\tFri, 12 Jul 2024 16:32:12 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"tcnzMPx6\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1720794733;\n\tbh=m9noFd5imylmPZI1gUS+wu1vDgxSb8W5byBqHMSuASc=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=tcnzMPx6mW6BAzOb6/rIFVqbiKTY9/HCOx/+4fuxepRPjlHeL4FdO1CFVOR5D+JEc\n\t8Yei2HcYGaIdJEK7nfSmSDVdNnsDs/kvdv+MLzXQTuZNWmooo+2+QellajUNikRP/R\n\tZ25vHhXyn/Tw5IbDfVHK7cSj5g334IcaL/TvWbO0=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","Subject":"[PATCH v1 3/5] ipa: rkisp1: awb: Unconditionally fill metadata","Date":"Fri, 12 Jul 2024 16:32:04 +0200","Message-ID":"<20240712143227.3036702-4-stefan.klug@ideasonboard.com>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20240712143227.3036702-1-stefan.klug@ideasonboard.com>","References":"<20240712143227.3036702-1-stefan.klug@ideasonboard.com>","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":"When the colour temperature estimation gets skipped, the metadata isn't\npopulated. Fix that by filling the metadata early in the function.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n src/ipa/rkisp1/algorithms/awb.cpp | 17 ++++++++++-------\n 1 file changed, 10 insertions(+), 7 deletions(-)","diff":"diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp\nindex 18f750207793..4ccafd48dedd 100644\n--- a/src/ipa/rkisp1/algorithms/awb.cpp\n+++ b/src/ipa/rkisp1/algorithms/awb.cpp\n@@ -222,6 +222,12 @@ void Awb::process(IPAContext &context,\n \tdouble redMean;\n \tdouble blueMean;\n \n+\tmetadata.set(controls::AwbEnable, frameContext.awb.autoEnabled);\n+\tmetadata.set(controls::ColourGains, {\n+\t\t\tstatic_cast<float>(frameContext.awb.gains.red),\n+\t\t\tstatic_cast<float>(frameContext.awb.gains.blue)\n+\t\t});\n+\n \tif (rgbMode_) {\n \t\tgreenMean = awb->awb_mean[0].mean_y_or_g;\n \t\tredMean = awb->awb_mean[0].mean_cr_or_r;\n@@ -277,11 +283,15 @@ void Awb::process(IPAContext &context,\n \t */\n \tif (redMean < kMeanMinThreshold && greenMean < kMeanMinThreshold &&\n \t    blueMean < kMeanMinThreshold) {\n+\t\tmetadata.set(controls::ColourTemperature, activeState.awb.temperatureK);\n \t\treturn;\n \t}\n \n \tactiveState.awb.temperatureK = estimateCCT(redMean, greenMean, blueMean);\n \n+\t/* Metadata shall contain the up to date measurement */\n+\tmetadata.set(controls::ColourTemperature, activeState.awb.temperatureK);\n+\n \t/*\n \t * Estimate the red and blue gains to apply in a grey world. The green\n \t * gain is hardcoded to 1.0. Avoid divisions by zero by clamping the\n@@ -308,13 +318,6 @@ void Awb::process(IPAContext &context,\n \tactiveState.awb.gains.automatic.blue = blueGain;\n \tactiveState.awb.gains.automatic.green = 1.0;\n \n-\tmetadata.set(controls::AwbEnable, frameContext.awb.autoEnabled);\n-\tmetadata.set(controls::ColourGains, {\n-\t\t\tstatic_cast<float>(frameContext.awb.gains.red),\n-\t\t\tstatic_cast<float>(frameContext.awb.gains.blue)\n-\t\t});\n-\tmetadata.set(controls::ColourTemperature, activeState.awb.temperatureK);\n-\n \tLOG(RkISP1Awb, Debug) << std::showpoint\n \t\t<< \"Means [\" << redMean << \", \" << greenMean << \", \" << blueMean\n \t\t<< \"], gains [\" << activeState.awb.gains.automatic.red << \", \"\n","prefixes":["v1","3/5"]}