Patch Detail
Show a patch.
GET /api/patches/17443/?format=api
{ "id": 17443, "url": "https://patchwork.libcamera.org/api/patches/17443/?format=api", "web_url": "https://patchwork.libcamera.org/patch/17443/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "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-33-laurent.pinchart@ideasonboard.com>", "date": "2022-09-27T02:36:41", "name": "[libcamera-devel,v5,32/33] ipa: rkisp1: awb: Freeze AWB when means are too small", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "b7112db064dc1058970c55a5a04f8a678787e579", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/17443/mbox/", "series": [ { "id": 3506, "url": "https://patchwork.libcamera.org/api/series/3506/?format=api", "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/17443/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/17443/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 D572CC0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 27 Sep 2022 02:37:51 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9AD0E62369;\n\tTue, 27 Sep 2022 04:37:51 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 92760622EE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 27 Sep 2022 04:37:49 +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 097D0E5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 27 Sep 2022 04:37:48 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1664246271;\n\tbh=3B+zhvvDYOWFaJ5PLdGBMmgUzAOCaswyHUmOwZPzXX0=;\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=U4ySHf8TKPiZxVPaXY3Bwj5hdFBv3VW+owgCgcQl7EpPPYXtg9bzn2GooOo9WH2uV\n\tgncH4MnYFwaX/bA0EhVkII+4RPjZ6xIH8RWbC867ABQhfLwFhCQsbOrTqm3FETSKs9\n\tmoxElfxYHcX9LSchhU8M5UQtduNiPUv2ZdnCY5XFf+SQTYfu7HwOrt/m1erxudBGKw\n\tIL0dZkj4XSmbsX8OfGAr0C15x8+PckQuGMtBuC+WhUhSUwtRF6AXNSJsXtg9ob5k4m\n\tlhLC0wmnVbvTlLDEdOswfaBPQLxIUDW2/5fUFPkd/p5oQ2JinEWUtY5VMnRMDTq/AJ\n\tMyz2R6kTMD2gw==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1664246269;\n\tbh=3B+zhvvDYOWFaJ5PLdGBMmgUzAOCaswyHUmOwZPzXX0=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=M1hqnLsEWlJFl06t8xOi1rQciiQ3UMZGsDQiDvGGvwDMfN1wcHfi7YrhPiQ9SB2oe\n\tDawgadp4nwJr0mZtU0subUkpfHZnkTv61orfRtgGZF9CgRQlZxt3T7KbsCXx92ejdM\n\tnNmAdmoGXYmuvcQmCNCShCw/deWFdf0eArwJeyIY=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"M1hqnLsE\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 27 Sep 2022 05:36:41 +0300", "Message-Id": "<20220927023642.12341-33-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 32/33] ipa: rkisp1: awb: Freeze AWB\n\twhen means are too small", "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": "When the RGB means are too small, gains and color temperature can't be\nmeaningfully calculated. Freeze the AWB in that case, using the\npreviously calculated values.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/ipa/rkisp1/algorithms/awb.cpp | 17 ++++++++++++++++-\n src/ipa/rkisp1/ipa_context.cpp | 3 +++\n src/ipa/rkisp1/ipa_context.h | 1 +\n 3 files changed, 20 insertions(+), 1 deletion(-)", "diff": "diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp\nindex a3066fbb1994..eb32cd722071 100644\n--- a/src/ipa/rkisp1/algorithms/awb.cpp\n+++ b/src/ipa/rkisp1/algorithms/awb.cpp\n@@ -31,6 +31,9 @@ namespace ipa::rkisp1::algorithms {\n \n LOG_DEFINE_CATEGORY(RkISP1Awb)\n \n+/* Minimum mean value below which AWB can't operate. */\n+constexpr double kMeanMinThreshold = 2.0;\n+\n Awb::Awb()\n \t: rgbMode_(false)\n {\n@@ -263,7 +266,17 @@ void Awb::process(IPAContext &context,\n \tgreenMean /= frameContext.awb.gains.green;\n \tblueMean /= frameContext.awb.gains.blue;\n \n-\tframeContext.awb.temperatureK = estimateCCT(redMean, greenMean, blueMean);\n+\t/*\n+\t * If the means are too small we don't have enough information to\n+\t * meaningfully calculate gains. Freeze the algorithm in that case.\n+\t */\n+\tif (redMean < kMeanMinThreshold && greenMean < kMeanMinThreshold &&\n+\t blueMean < kMeanMinThreshold) {\n+\t\tframeContext.awb.temperatureK = activeState.awb.temperatureK;\n+\t\treturn;\n+\t}\n+\n+\tactiveState.awb.temperatureK = estimateCCT(redMean, greenMean, blueMean);\n \n \t/*\n \t * Estimate the red and blue gains to apply in a grey world. The green\n@@ -290,6 +303,8 @@ void Awb::process(IPAContext &context,\n \tactiveState.awb.gains.automatic.blue = blueGain;\n \tactiveState.awb.gains.automatic.green = 1.0;\n \n+\tframeContext.awb.temperatureK = 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 << \", \"\ndiff --git a/src/ipa/rkisp1/ipa_context.cpp b/src/ipa/rkisp1/ipa_context.cpp\nindex 2126ed1d0acb..b00dc29c1713 100644\n--- a/src/ipa/rkisp1/ipa_context.cpp\n+++ b/src/ipa/rkisp1/ipa_context.cpp\n@@ -156,6 +156,9 @@ namespace libcamera::ipa::rkisp1 {\n * \\var IPAActiveState::awb.gains.automatic.blue\n * \\brief Automatic white balance gain for B channel\n *\n+ * \\var IPAActiveState::awb.temperatureK\n+ * \\brief Estimated color temperature\n+ *\n * \\var IPAActiveState::awb.autoEnabled\n * \\brief Whether the Auto White Balance algorithm is enabled\n */\ndiff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\nindex d0692f872960..0677c8c35d73 100644\n--- a/src/ipa/rkisp1/ipa_context.h\n+++ b/src/ipa/rkisp1/ipa_context.h\n@@ -69,6 +69,7 @@ struct IPAActiveState {\n \t\t\t} automatic;\n \t\t} gains;\n \n+\t\tunsigned int temperatureK;\n \t\tbool autoEnabled;\n \t} awb;\n \n", "prefixes": [ "libcamera-devel", "v5", "32/33" ] }