Show a patch.

GET /api/1.1/patches/18951/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 18951,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/18951/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18951/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20230823120915.18621-2-david.plowman@raspberrypi.com>",
    "date": "2023-08-23T12:09:11",
    "name": "[libcamera-devel,v2,1/5] ipa: rpi: histogram: Add interBinMean()",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "0fe24a22affc8b48f66507a8ae46f849a586d373",
    "submitter": {
        "id": 42,
        "url": "https://patchwork.libcamera.org/api/1.1/people/42/?format=api",
        "name": "David Plowman",
        "email": "david.plowman@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/18951/mbox/",
    "series": [
        {
            "id": 4006,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4006/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4006",
            "date": "2023-08-23T12:09:10",
            "name": "Multi-channel AGC",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/4006/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18951/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18951/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 ABBA7C3262\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 23 Aug 2023 12:09:23 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 09076627DF;\n\tWed, 23 Aug 2023 14:09:22 +0200 (CEST)",
            "from mail-wm1-x333.google.com (mail-wm1-x333.google.com\n\t[IPv6:2a00:1450:4864:20::333])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 020A560379\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Aug 2023 14:09:20 +0200 (CEST)",
            "by mail-wm1-x333.google.com with SMTP id\n\t5b1f17b1804b1-400a087b0bfso1483915e9.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Aug 2023 05:09:20 -0700 (PDT)",
            "from pi4-davidp.pitowers.org\n\t([2a00:1098:3142:14:2bce:64d6:1a5c:49a2])\n\tby smtp.gmail.com with ESMTPSA id\n\tu1-20020a7bcb01000000b003fefcbe7fa8sm3800589wmj.28.2023.08.23.05.09.18\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 23 Aug 2023 05:09:18 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1692792562;\n\tbh=VC872qSQmTIHBHsNVEBK4zhptjsHyXIelDczVsln2+4=;\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=y9BjaHAzkEGnQsHXniBovUFjUDub1/p++Rt3uDM31Q2WnK+kyrqeioHZamUu+v/C9\n\tQqVBQ8vXD7NagDihsG7kCaJHDo33ksGwSiG5YD8vX4ceZRpr+33vkKHuMlLVPIq2PQ\n\tJCulKsgxnsnVURKEobiSyPYYUWYs+n6nLtxrK50XJCL/5iEUJBWZ3k9y6g338FYTS6\n\tqUhSfQzO4dGRuUcizpbjnFFyBil5zkrDHyt8+dO1gmKyx0bXF+cPoDqcEkqB/dbckg\n\tWsly8w70Q84+oBt+sY2gxx2wZmn5B8zewKQzcuddJJLt/KO8xz5TAhMgwBl35148/R\n\tDxZoArizYO1kg==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1692792559; x=1693397359;\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=u7iKFr8D3j7b58GG5UKdV0vUoX70DBmLHHZQRY3Vb7Y=;\n\tb=s3UX7Q5uiuMaKza7evIjOaBBuBvaikpVGMwm719bP52Z7iw+oesfFYWMwl9J7vA39S\n\tpH5gcQY1ukuXFRlwDct4ndKvQMPvTGF3JZ+6nERpN1bpK7ADKewgDVs2hU81rqty3RYh\n\t7T0rTL1IgLSp5oZUdoGg7IQc9tTGbhbqhsUqlSi0P+pxHSKgqsdVpppSfZdqw/L8YDnt\n\tjsph99RBHZAm33IOa5mpF3OocD4Bu50HY1e+e/QCfTyvwk/Q8NzBv3UnkCEtt+6lXhfB\n\tmTr+DFcQbW/kP8nOhWk8RsVqpY8Ngtb+XrA9NdT0C8YBgavBKuPWx0DccJTph+dwCJov\n\tXEoA=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"s3UX7Q5u\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20221208; t=1692792559; x=1693397359;\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=u7iKFr8D3j7b58GG5UKdV0vUoX70DBmLHHZQRY3Vb7Y=;\n\tb=NgX+hJMrLm4jMEVmfjU3WUuzS5W1H/HfKBGz/u9rVOLAurIVFsFQKcTnrOOOLsXetk\n\tA6rOXgwD0ZsjdXA1862L/RLgXTk05QIcR+CP9wrdrhvZiRYhxmvPMa4AZzkuVK/9RAuz\n\tsMUepzmMl3qieyrFTA0ik3OE94C+B4aFquT5oRLvOeuDTbaOeM3cTI2DCFwp/I9UowPO\n\t1i7Hkx+Elb8gyHDUC4sX1KjMwO1cs3stpCKrcy9h9DsZ0wUpRM3lW76ByAKsTgyiXyXC\n\tM1oP8NIB8FxNOlPrTggR8datcJ2ieBKmSb+Jumq2ngdR1CKq2BE7JncDxmuMuLpKZLHp\n\tTCRg==",
        "X-Gm-Message-State": "AOJu0YwWGL9kkUHF0RgTU98DRfjorlMhDRCIWRpQFwBO5ksG2OxZPzg6\n\tX4HGZUbqLURcu7jRggvlm3CoeM4LhlkfHt0Y+UI=",
        "X-Google-Smtp-Source": "AGHT+IHK+5iGBnSJUn36Yv2dlGlKUTsseI0Hur4wG0Z76cgmyh4Y1hb9Ec6r7ti9Q8qkr+HAbEFF1g==",
        "X-Received": "by 2002:a05:600c:2307:b0:3fe:1cac:37d5 with SMTP id\n\t7-20020a05600c230700b003fe1cac37d5mr9871084wmo.4.1692792559221; \n\tWed, 23 Aug 2023 05:09:19 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 23 Aug 2023 13:09:11 +0100",
        "Message-Id": "<20230823120915.18621-2-david.plowman@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.30.2",
        "In-Reply-To": "<20230823120915.18621-1-david.plowman@raspberrypi.com>",
        "References": "<20230823120915.18621-1-david.plowman@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 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>",
        "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>\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",
        "v2",
        "1/5"
    ]
}