Patch Detail
Show a patch.
GET /api/patches/23175/?format=api
{ "id": 23175, "url": "https://patchwork.libcamera.org/api/patches/23175/?format=api", "web_url": "https://patchwork.libcamera.org/patch/23175/", "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": "<20250411130423.2164577-9-stefan.klug@ideasonboard.com>", "date": "2025-04-11T13:04:15", "name": "[8/8] ipa: rkisp1: agc: Add debug controls for statistic values", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "5425f257c50f7ce962be3f728cca3257dfd3f999", "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/23175/mbox/", "series": [ { "id": 5122, "url": "https://patchwork.libcamera.org/api/series/5122/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5122", "date": "2025-04-11T13:04:07", "name": "Implement WDR algorithm", "version": 1, "mbox": "https://patchwork.libcamera.org/series/5122/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/23175/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/23175/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 72C6BC3213\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 11 Apr 2025 13:04:51 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2AADC68AB4;\n\tFri, 11 Apr 2025 15:04:51 +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 A9BFA68AB4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 11 Apr 2025 15:04:49 +0200 (CEST)", "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:5b21:2ad5:1023:7179])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5E01E735;\n\tFri, 11 Apr 2025 15:02:50 +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=\"Rfz8rFf/\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1744376570;\n\tbh=a4GTBrVlT555xzFzrZUEcNd7nTZIbDjvjOE1SuHrkiw=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Rfz8rFf/ZHpVpZfVL4B5H8zIL5SCEVixRKD0xbRPt64yeBde6lPmpjNFuyj+okAhX\n\tiaBRWxdysODrLNU0IRDCPav5oje5Om0yrMuIO9il8fxLY47MVPzmzP9aE/qmrebvSV\n\to5LsOVzvIOEJq4RVhDpSbQGCDvhOD73eIxcZTNlg=", "From": "Stefan Klug <stefan.klug@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>", "Subject": "[PATCH 8/8] ipa: rkisp1: agc: Add debug controls for statistic\n\tvalues", "Date": "Fri, 11 Apr 2025 15:04:15 +0200", "Message-ID": "<20250411130423.2164577-9-stefan.klug@ideasonboard.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20250411130423.2164577-1-stefan.klug@ideasonboard.com>", "References": "<20250411130423.2164577-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": "Add debug controls for AWB stats and exposure means.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n src/ipa/rkisp1/algorithms/agc.cpp | 16 +++++++++++++++\n src/ipa/rkisp1/algorithms/awb.cpp | 3 +++\n src/libcamera/control_ids_debug.yaml | 29 ++++++++++++++++++++++++++++\n 3 files changed, 48 insertions(+)", "diff": "diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\nindex a2c8d5403ba2..6dc8b9fc0a31 100644\n--- a/src/ipa/rkisp1/algorithms/agc.cpp\n+++ b/src/ipa/rkisp1/algorithms/agc.cpp\n@@ -400,8 +400,10 @@ void Agc::fillMetadata(IPAContext &context, IPAFrameContext &frameContext,\n {\n \tutils::Duration exposureTime = context.configuration.sensor.lineDuration\n \t\t\t\t * frameContext.sensor.exposure;\n+\tutils::Duration exposureTimeCorrected = exposureTime * frameContext.awb.additionalGain;\n \tmetadata.set(controls::AnalogueGain, frameContext.sensor.gain);\n \tmetadata.set(controls::ExposureTime, exposureTime.get<std::micro>());\n+\tmetadata.set<float>(controls::debug::ExposureTimeCorrected, exposureTimeCorrected.get<std::micro>());\n \tmetadata.set(controls::FrameDuration, frameContext.agc.frameDuration.get<std::micro>());\n \tmetadata.set(controls::ExposureTimeMode,\n \t\t frameContext.agc.autoExposureEnabled\n@@ -574,6 +576,20 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n \t\t\t frameContext.agc.exposureMode,\n \t\t\t hist, effectiveExposureValue);\n \n+\tauto &debugMeta = context.debugMetadata;\n+\tstd::vector<int32_t> histMeta;\n+\tfor (unsigned i = 0; i < context.hw->numHistogramBins; i++)\n+\t\thistMeta.push_back(params->hist.hist_bins[i] >> 4);\n+\tdebugMeta.set<Span<const int32_t>>(controls::debug::StatsHistogram, histMeta);\n+\n+\tdouble meanExposure = 0;\n+\tfor (uint8_t expMean : expMeans_)\n+\t\tmeanExposure += expMean;\n+\tmeanExposure = meanExposure / expMeans_.size() / 255.0;\n+\tdebugMeta.set<const float>(controls::debug::StatsExpMean, meanExposure);\n+\n+\tdebugMeta.set<Span<const uint8_t>>(controls::debug::StatsExpMeans, expMeans_);\n+\n \tLOG(RkISP1Agc, Debug)\n \t\t<< \"Divided up exposure time, analogue gain and digital gain are \"\n \t\t<< newExposureTime << \", \" << aGain << \" and \" << dGain;\ndiff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp\nindex cc78136a22c8..be08458e45e3 100644\n--- a/src/ipa/rkisp1/algorithms/awb.cpp\n+++ b/src/ipa/rkisp1/algorithms/awb.cpp\n@@ -310,6 +310,9 @@ void Awb::process(IPAContext &context,\n \n \tRGB<double> rgbMeans = calculateRgbMeans(frameContext, awb);\n \n+\tcontext.debugMetadata.set<Span<const float>>(controls::debug::RgbMeans, Vector<float, 3>(rgbMeans).data());\n+\tcontext.debugMetadata.set<int>(controls::debug::AwbCount, awb->awb_mean[0].cnt);\n+\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.\ndiff --git a/src/libcamera/control_ids_debug.yaml b/src/libcamera/control_ids_debug.yaml\nindex 9489e677402e..d0f9329187f7 100644\n--- a/src/libcamera/control_ids_debug.yaml\n+++ b/src/libcamera/control_ids_debug.yaml\n@@ -1,9 +1,38 @@\n # SPDX-License-Identifier: LGPL-2.1-or-later\n #\n+# This file was generated by utils/gen-debug-controls.py\n+#\n %YAML 1.1\n ---\n vendor: debug\n controls:\n+- AwbCount:\n+ type: int\n+ direction: out\n+ description: Debug control AwbCount found in src/ipa/rkisp1/algorithms/awb.cpp\n+- ExposureTimeCorrected:\n+ type: float\n+ direction: out\n+ description: Debug control ExposureTimeCorrected found in src/ipa/rkisp1/algorithms/agc.cpp\n+- RgbMeans:\n+ type: float\n+ direction: out\n+ description: Debug control RgbMeans found in src/ipa/rkisp1/algorithms/awb.cpp\n+ size: '[n]'\n+- StatsExpMean:\n+ type: const float\n+ direction: out\n+ description: Debug control StatsExpMean found in src/ipa/rkisp1/algorithms/agc.cpp\n+- StatsExpMeans:\n+ type: uint8_t\n+ direction: out\n+ description: Debug control StatsExpMeans found in src/ipa/rkisp1/algorithms/agc.cpp\n+ size: '[n]'\n+- StatsHistogram:\n+ type: int32_t\n+ direction: out\n+ description: Debug control StatsHistogram found in src/ipa/rkisp1/algorithms/agc.cpp\n+ size: '[n]'\n - WdrCurve:\n type: Point\n direction: out\n", "prefixes": [ "8/8" ] }