Patch Detail
Show a patch.
GET /api/patches/22220/?format=api
{ "id": 22220, "url": "https://patchwork.libcamera.org/api/patches/22220/?format=api", "web_url": "https://patchwork.libcamera.org/patch/22220/", "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": "<20241206145242.827886-4-stefan.klug@ideasonboard.com>", "date": "2024-12-06T14:52:23", "name": "[v5,3/8] ipa: rkisp1: awb: Implement ColourTemperature control", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "6aa2d39763780ebb63a20219c38371ef1e46e001", "submitter": { "id": 184, "url": "https://patchwork.libcamera.org/api/people/184/?format=api", "name": "Stefan Klug", "email": "stefan.klug@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/22220/mbox/", "series": [ { "id": 4857, "url": "https://patchwork.libcamera.org/api/series/4857/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4857", "date": "2024-12-06T14:52:20", "name": "rkisp1: Add manual colour temperature control", "version": 5, "mbox": "https://patchwork.libcamera.org/series/4857/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/22220/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/22220/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 DD643BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 6 Dec 2024 14:52:58 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 972A96615F;\n\tFri, 6 Dec 2024 15:52:58 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 22ADA6615F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 6 Dec 2024 15:52:56 +0100 (CET)", "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:3543:aebe:e043:ef86])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4AFCB641;\n\tFri, 6 Dec 2024 15:52:26 +0100 (CET)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"NRMNoJlS\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1733496746;\n\tbh=2FLxC8TgZOLDJJOO/13xn0N0PRQZ0JY/NUSsuDaKXW0=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=NRMNoJlSEPtzVCDyl07d1hs2CTtIVuyUQypaReG3ja6yaTwBAhO/24xWNNsBLF/Rb\n\ta1U0PR7ViiGvL3sF4eFUyXvzarbxDnjkfZzcgJtWjKiNjQLsfK556GKXdSug1i75yY\n\t1e0nickqVFOaLISVJQ7SWJGosfsQHYMWof11mhIY=", "From": "Stefan Klug <stefan.klug@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>", "Subject": "[PATCH v5 3/8] ipa: rkisp1: awb: Implement ColourTemperature control", "Date": "Fri, 6 Dec 2024 15:52:23 +0100", "Message-ID": "<20241206145242.827886-4-stefan.klug@ideasonboard.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20241206145242.827886-1-stefan.klug@ideasonboard.com>", "References": "<20241206145242.827886-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": "There are many use-cases (tuning-validation, working in static\nenvironments) where a manual ColourTemperature control is helpful.\nImplement that by interpolating and applying the white balance gains\nfrom the tuning file according to the requested colour temperature. If\ncolour gains are provided on the same request, they take precedence. As\nthe colour temperature reported in the metadata is always based on the\nmeasurements, we don't have to touch that.\n\nNote that in the automatic case, the colour gains are still based on the\ngray world model and the ones from the tuning file get ignored.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n---\n src/ipa/rkisp1/algorithms/awb.cpp | 35 ++++++++++++++++++++++++-------\n 1 file changed, 28 insertions(+), 7 deletions(-)", "diff": "diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp\nindex 23a81e75d3d3..41f260e7089c 100644\n--- a/src/ipa/rkisp1/algorithms/awb.cpp\n+++ b/src/ipa/rkisp1/algorithms/awb.cpp\n@@ -33,6 +33,10 @@ namespace ipa::rkisp1::algorithms {\n \n LOG_DEFINE_CATEGORY(RkISP1Awb)\n \n+constexpr int32_t kMinColourTemperature = 2500;\n+constexpr int32_t kMaxColourTemperature = 10000;\n+constexpr int32_t kDefaultColourTemperature = 6500;\n+\n /* Minimum mean value below which AWB can't operate. */\n constexpr double kMeanMinThreshold = 2.0;\n \n@@ -44,8 +48,13 @@ Awb::Awb()\n /**\n * \\copydoc libcamera::ipa::Algorithm::init\n */\n-int Awb::init([[maybe_unused]] IPAContext &context, const YamlObject &tuningData)\n+int Awb::init(IPAContext &context, const YamlObject &tuningData)\n {\n+\tauto &cmap = context.ctrlMap;\n+\tcmap[&controls::ColourTemperature] = ControlInfo(kMinColourTemperature,\n+\t\t\t\t\t\t\t kMaxColourTemperature,\n+\t\t\t\t\t\t\t kDefaultColourTemperature);\n+\n \tInterpolator<Vector<double, 2>> gains;\n \tint ret = gains.readYaml(tuningData[\"gains\"], \"ct\", \"gains\");\n \tif (ret < 0)\n@@ -101,19 +110,31 @@ void Awb::queueRequest(IPAContext &context,\n \t\t\t<< (*awbEnable ? \"Enabling\" : \"Disabling\") << \" AWB\";\n \t}\n \n+\tframeContext.awb.autoEnabled = awb.autoEnabled;\n+\n \tconst auto &colourGains = controls.get(controls::ColourGains);\n-\tif (colourGains && !awb.autoEnabled) {\n+\tconst auto &colourTemperature = controls.get(controls::ColourTemperature);\n+\n+\tif (awb.autoEnabled)\n+\t\treturn;\n+\n+\tbool update = false;\n+\tif (colourGains) {\n \t\tawb.gains.manual.r() = (*colourGains)[0];\n \t\tawb.gains.manual.b() = (*colourGains)[1];\n+\t\tupdate = true;\n+\t} else if (colourTemperature && gains_) {\n+\t\tauto gains = gains_->getInterpolated(*colourTemperature);\n+\t\tawb.gains.manual.r() = gains[0];\n+\t\tawb.gains.manual.b() = gains[1];\n+\t\tupdate = true;\n+\t}\n \n+\tif (update)\n \t\tLOG(RkISP1Awb, Debug)\n \t\t\t<< \"Set colour gains to \" << awb.gains.manual;\n-\t}\n-\n-\tframeContext.awb.autoEnabled = awb.autoEnabled;\n \n-\tif (!awb.autoEnabled)\n-\t\tframeContext.awb.gains = awb.gains.manual;\n+\tframeContext.awb.gains = awb.gains.manual;\n }\n \n /**\n", "prefixes": [ "v5", "3/8" ] }