Patch Detail
Show a patch.
GET /api/patches/20773/?format=api
{ "id": 20773, "url": "https://patchwork.libcamera.org/api/patches/20773/?format=api", "web_url": "https://patchwork.libcamera.org/patch/20773/", "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": "<20240805120522.1613342-4-stefan.klug@ideasonboard.com>", "date": "2024-08-05T12:05:04", "name": "[v1,3/6] ipa: rkisp1: awb: Implement ColourTemperature control", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "e239183c552017dc45e425acc0d4de4aaaefb8c5", "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/20773/mbox/", "series": [ { "id": 4486, "url": "https://patchwork.libcamera.org/api/series/4486/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4486", "date": "2024-08-05T12:05:01", "name": "rkisp1: Add manual colour temperature control", "version": 1, "mbox": "https://patchwork.libcamera.org/series/4486/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/20773/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/20773/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 5B7AAC323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 5 Aug 2024 12:06:03 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EB36F6338D;\n\tMon, 5 Aug 2024 14:06:02 +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 02F0E63385\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 5 Aug 2024 14:05:58 +0200 (CEST)", "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:30ff:e7b4:349c:44ce])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 64BDAA06;\n\tMon, 5 Aug 2024 14:05:06 +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=\"MqhwLb+h\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1722859506;\n\tbh=V3A4n7vjPjDVEBZ5c5kzhoo4IFWKvuJR1cka4FNwiuE=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=MqhwLb+hIgV6IjGGw7JPFe8M2w7NJbMGmNVwSpZoYSum9Y6IpUQAFLcggsbGH3/PW\n\tLwdezwJ2VAGqli17u67uLZN9W2KFr1015M9CfT5VnojKf314Afa684tzc87mpkPHaq\n\t8/r6+HzmucPWYDnDrb1Z1CSnp9O88W8LYGYKtijo=", "From": "Stefan Klug <stefan.klug@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "David Plowman <david.plowman@raspberrypi.com>,\n\tStefan Klug <stefan.klug@ideasonboard.com>", "Subject": "[PATCH v1 3/6] ipa: rkisp1: awb: Implement ColourTemperature control", "Date": "Mon, 5 Aug 2024 14:05:04 +0200", "Message-ID": "<20240805120522.1613342-4-stefan.klug@ideasonboard.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20240805120522.1613342-1-stefan.klug@ideasonboard.com>", "References": "<20240805120522.1613342-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>\n---\n src/ipa/rkisp1/algorithms/awb.cpp | 20 ++++++++++++++++++++\n 1 file changed, 20 insertions(+)", "diff": "diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp\nindex 957d24fe3425..d482eda5b541 100644\n--- a/src/ipa/rkisp1/algorithms/awb.cpp\n+++ b/src/ipa/rkisp1/algorithms/awb.cpp\n@@ -31,6 +31,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,6 +48,11 @@ Awb::Awb()\n */\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 \tMatrixInterpolator<double, 2, 1> gains;\n \tint ret = gains.readYaml(tuningData[\"gains\"], \"ct\", \"gains\");\n \tif (ret < 0)\n@@ -113,6 +122,17 @@ void Awb::queueRequest(IPAContext &context,\n \t\t\t<< \", blue: \" << awb.gains.manual.blue;\n \t}\n \n+\tconst auto &colourTemperature = controls.get(controls::ColourTemperature);\n+\tif (colourTemperature && !awb.autoEnabled && gains_ && !colourGains) {\n+\t\tMatrix<double, 2, 1> gains = gains_->get(*colourTemperature);\n+\t\tawb.gains.manual.red = gains[0][0];\n+\t\tawb.gains.manual.blue = gains[1][0];\n+\n+\t\tLOG(RkISP1Awb, Debug)\n+\t\t\t<< \"Set colour gains to red: \" << awb.gains.manual.red\n+\t\t\t<< \", blue: \" << awb.gains.manual.blue;\n+\t}\n+\n \tframeContext.awb.autoEnabled = awb.autoEnabled;\n \n \tif (!awb.autoEnabled) {\n", "prefixes": [ "v1", "3/6" ] }