Patch Detail
Show a patch.
GET /api/patches/19034/?format=api
{ "id": 19034, "url": "https://patchwork.libcamera.org/api/patches/19034/?format=api", "web_url": "https://patchwork.libcamera.org/patch/19034/", "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": "<20230915155844.2388-2-david.plowman@raspberrypi.com>", "date": "2023-09-15T15:58:40", "name": "[libcamera-devel,v5,1/5] ipa: rpi: histogram: Add interBinMean()", "commit_ref": "cd940f7fd3a0636c79bfcb2ebb462e17f92cb987", "pull_url": null, "state": "accepted", "archived": false, "hash": "0fe24a22affc8b48f66507a8ae46f849a586d373", "submitter": { "id": 42, "url": "https://patchwork.libcamera.org/api/people/42/?format=api", "name": "David Plowman", "email": "david.plowman@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/19034/mbox/", "series": [ { "id": 4026, "url": "https://patchwork.libcamera.org/api/series/4026/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4026", "date": "2023-09-15T15:58:39", "name": "Multi-channel AGC", "version": 5, "mbox": "https://patchwork.libcamera.org/series/4026/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/19034/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/19034/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 929BBBD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 15 Sep 2023 15:58:52 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 49E7A6291D;\n\tFri, 15 Sep 2023 17:58:52 +0200 (CEST)", "from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com\n\t[IPv6:2a00:1450:4864:20::32b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 42DA9628EC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Sep 2023 17:58:51 +0200 (CEST)", "by mail-wm1-x32b.google.com with SMTP id\n\t5b1f17b1804b1-40434d284f7so22809895e9.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Sep 2023 08:58:51 -0700 (PDT)", "from localhost.localdomain ([195.180.61.40])\n\tby smtp.gmail.com with ESMTPSA id\n\tl13-20020a7bc44d000000b00401c595fcc7sm7810618wmi.11.2023.09.15.08.58.47\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 15 Sep 2023 08:58:47 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1694793532;\n\tbh=u61zsKeWhQAgxve5YcLlCpBT79AgLH4OcJpd3Ged9qE=;\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:Cc:\n\tFrom;\n\tb=RdQ3kdZm62NGOydpXRvlvgOKi0pZI2mlemQoTYksBWvjdfllz0+6NpxajqLOvVphh\n\trNt4KYAKz2BhUBYWx+kjScIrLOp5DQ7Z4AqQ3aPaxm9SiWTfpWIRc1ZKxYmAdPg+p4\n\t5NmYAIOuEltYKQFwhwFkxuRqdMC3x4rbtsM5AYGTeS+SwmlYefo+nR/wK9aA8JvlGu\n\tz3yR9U+7QpRtUwW3lptmeDISaRAI4oPDgXT1TyUr1tauwvZxvFilh9+epD+oDb+jEl\n\t/yp3tWrqW9fLxH81apQn6gOuHkOP+TQJNHgPxOLyHa/SKxp9zJsuev3FqaMwUEv08L\n\tnqPDzTprAIS5g==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1694793530; x=1695398330;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=PLzIHdZWYnWfcoP1tg/UVALNkMV3EEqa5nrqb1B3Op8=;\n\tb=kes1vK9Ui66o6hXXzrZOvNZ+lnEQS5P97c48etkxv8ush37OpspghZBFk8+o2cutk0\n\t8h/VHOcAnHIyUnDPyJahjmpHa+5CAiaQeQiaikDNJEq5e02H9q4of/hFxN35OfQm04am\n\t3pjCjvr6Mf4nOSvq6HSTZO8IpMWun3ikIfAlRUWoKXfgyOXlRgMwhkTwlT/wPrb5ETNc\n\teO3L8G2GP0jqKUfAc+X+GJzjKmarK+h7Q1e0rgGMF5A2s2VjLyyDUcNHEkRSSpgOE9CM\n\tfLqJHqFDDRuHytB238RTxX9AHlX7E6gH9g8QRh4p3BiPRt9UWGMZrnPysIPnwg7jJkjx\n\tysHw==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"kes1vK9U\"; dkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1694793530; x=1695398330;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=PLzIHdZWYnWfcoP1tg/UVALNkMV3EEqa5nrqb1B3Op8=;\n\tb=tOXgX9T2pm1Ww1iHbc4dF6iOj6243OfgKU0LRhunuDe0IymI0c3RAP6G0KM4gpqqIw\n\t5BAQag53qIgzp62LvmP1iqTwJBMTQdll2zLp8l8mfLxJUun739hyNVFMwN5zUIY+4j1R\n\ttH1kFEPYFhFWiKtYAst5ZOtWSdGOF1kGgGE2uiY+HKOqfz66ct8Zpf2eTL6iAevNeoCx\n\tIf6rLqNGMPHwmiqE5TU0d0fRNbztbHN3sB/Dy/WpaKtsXmaHfBZ7LMnzyxt8JojY1eo0\n\t5bFyO92HPuLRP0QRUpiqaRG8zLwTRFU/ixMGCoWkTVi1CaBhQRed/xaRpzCQ3GYJmnGt\n\thNfA==", "X-Gm-Message-State": "AOJu0Yx5bXY7eCQV8tIW1yITfcfyCJZnn46wemSl55tf1zqhNAYkAcjm\n\tVPSD29vVh36+GIoOh6N5q9GsiB1uwV5q9duHujU=", "X-Google-Smtp-Source": "AGHT+IHRy+DMKozH3lm8b1nPEFOfpKKlhWRzDIxxODNP1GLolMLUmIObx6lEr3FTWwlkJWBORlLaRw==", "X-Received": "by 2002:a7b:c4cb:0:b0:401:b53e:6c56 with SMTP id\n\tg11-20020a7bc4cb000000b00401b53e6c56mr2227815wmk.3.1694793530403; \n\tFri, 15 Sep 2023 08:58:50 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 15 Sep 2023 16:58:40 +0100", "Message-Id": "<20230915155844.2388-2-david.plowman@raspberrypi.com>", "X-Mailer": "git-send-email 2.30.2", "In-Reply-To": "<20230915155844.2388-1-david.plowman@raspberrypi.com>", "References": "<20230915155844.2388-1-david.plowman@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v5 1/5] ipa: rpi: histogram: Add\n\tinterBinMean()", "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": "David Plowman via libcamera-devel <libcamera-devel@lists.libcamera.org>", "Reply-To": "David Plowman <david.plowman@raspberrypi.com>", "Cc": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "From: Naushir Patuck <naush@raspberrypi.com>\n\nAdd a new helper function Histogram::interBinMean() that essentially\nreplaces the existing Histogram::interQuantileMean() logic but working on\nbins instead.\n\nRework the interQuantileMean() to call into interBinMean() with the\nappropriate convertion from quatiles to bins.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n src/ipa/rpi/controller/histogram.cpp | 22 ++++++++++++++--------\n src/ipa/rpi/controller/histogram.h | 2 ++\n 2 files changed, 16 insertions(+), 8 deletions(-)", "diff": "diff --git a/src/ipa/rpi/controller/histogram.cpp b/src/ipa/rpi/controller/histogram.cpp\nindex 16a9207f..0a27ba2c 100644\n--- a/src/ipa/rpi/controller/histogram.cpp\n+++ b/src/ipa/rpi/controller/histogram.cpp\n@@ -45,20 +45,26 @@ double Histogram::quantile(double q, int first, int last) const\n \treturn first + frac;\n }\n \n-double Histogram::interQuantileMean(double qLo, double qHi) const\n+double Histogram::interBinMean(double binLo, double binHi) const\n {\n-\tassert(qHi > qLo);\n-\tdouble pLo = quantile(qLo);\n-\tdouble pHi = quantile(qHi, (int)pLo);\n+\tassert(binHi > binLo);\n \tdouble sumBinFreq = 0, cumulFreq = 0;\n-\tfor (double pNext = floor(pLo) + 1.0; pNext <= ceil(pHi);\n-\t pLo = pNext, pNext += 1.0) {\n-\t\tint bin = floor(pLo);\n+\tfor (double binNext = floor(binLo) + 1.0; binNext <= ceil(binHi);\n+\t binLo = binNext, binNext += 1.0) {\n+\t\tint bin = floor(binLo);\n \t\tdouble freq = (cumulative_[bin + 1] - cumulative_[bin]) *\n-\t\t\t (std::min(pNext, pHi) - pLo);\n+\t\t\t (std::min(binNext, binHi) - binLo);\n \t\tsumBinFreq += bin * freq;\n \t\tcumulFreq += freq;\n \t}\n \t/* add 0.5 to give an average for bin mid-points */\n \treturn sumBinFreq / cumulFreq + 0.5;\n }\n+\n+double Histogram::interQuantileMean(double qLo, double qHi) const\n+{\n+\tassert(qHi > qLo);\n+\tdouble pLo = quantile(qLo);\n+\tdouble pHi = quantile(qHi, (int)pLo);\n+\treturn interBinMean(pLo, pHi);\n+}\ndiff --git a/src/ipa/rpi/controller/histogram.h b/src/ipa/rpi/controller/histogram.h\nindex 6b3e3a9e..e2c5509b 100644\n--- a/src/ipa/rpi/controller/histogram.h\n+++ b/src/ipa/rpi/controller/histogram.h\n@@ -38,6 +38,8 @@ public:\n \tuint64_t total() const { return cumulative_[cumulative_.size() - 1]; }\n \t/* Cumulative frequency up to a (fractional) point in a bin. */\n \tuint64_t cumulativeFreq(double bin) const;\n+\t/* Return the mean value between two (fractional) bins. */\n+\tdouble interBinMean(double binLo, double binHi) const;\n \t/*\n \t * Return the (fractional) bin of the point q (0 <= q <= 1) through the\n \t * histogram. Optionally provide limits to help.\n", "prefixes": [ "libcamera-devel", "v5", "1/5" ] }