Show a patch.

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

{
    "id": 19293,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/19293/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19293/",
    "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": "<20231206172743.13355-2-nick.hollinghurst@raspberrypi.com>",
    "date": "2023-12-06T17:27:43",
    "name": "[libcamera-devel] ipa: rpi: Allow the mean of an empty histogram interval",
    "commit_ref": "e71d63ce1bfa9784e18852fec264357bda5e3671",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "26f6b5cc3dbaeba79c5d55e2b08198bd439b5dd9",
    "submitter": {
        "id": 130,
        "url": "https://patchwork.libcamera.org/api/1.1/people/130/?format=api",
        "name": "Nick Hollinghurst",
        "email": "nick.hollinghurst@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/19293/mbox/",
    "series": [
        {
            "id": 4108,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4108/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4108",
            "date": "2023-12-06T17:27:43",
            "name": "[libcamera-devel] ipa: rpi: Allow the mean of an empty histogram interval",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4108/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/19293/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19293/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 5CD3BC32BC\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  6 Dec 2023 17:27:51 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BE33B62B31;\n\tWed,  6 Dec 2023 18:27:50 +0100 (CET)",
            "from mail-wr1-x429.google.com (mail-wr1-x429.google.com\n\t[IPv6:2a00:1450:4864:20::429])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 863BC61D9E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  6 Dec 2023 18:27:48 +0100 (CET)",
            "by mail-wr1-x429.google.com with SMTP id\n\tffacd0b85a97d-3332f1512e8so25262f8f.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 06 Dec 2023 09:27:48 -0800 (PST)",
            "from raspberrypi.pitowers.org\n\t([2001:4d4e:300:1f:e6dd:75ca:a054:1499])\n\tby smtp.gmail.com with ESMTPSA id\n\ts9-20020a5d4ec9000000b003334898aafasm190515wrv.11.2023.12.06.09.27.47\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 06 Dec 2023 09:27:47 -0800 (PST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1701883670;\n\tbh=1RB6+g4qfDW8rnb7Ja0vIUciQE5tC+vClsItg7uobb8=;\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=1nm4refd+TMAheu3h/dY/dodptkr1yfgvfI5/FNPLbZXzJ1EtbVr7wgQDkRYjMuLF\n\tr8+YTEF9SWym8YWMybSzqDoLcFYAKdO7mwX193fjv/fKEsFaMdvsU4sIdS5cwWO3dY\n\tHFkPA1iOXdYUMVA6gOQBmyWfFG+HD0piNtM4Io6Ta6N7kMpPSGn/WpHNhrPlWO0E7+\n\tTv8vms3FmIVCdAoCM8BEKtAv7RTptjEFXxy9wZsXkvaX4U+hwtH3O1ko8tOg9uVTxP\n\t5sf5bysQeueYEnoRqJLJ9kJe54P5H/gX03l1mCa/qDA4aQ3VIBRMiEc2xDKwZwxyuI\n\tWXgD1v1UcOzfg==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1701883668; x=1702488468;\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=aZhuqx7wWBWMSOCJUTftNWGOyTmgbVHIYfBu+U4mHcA=;\n\tb=T3wPslu+Q7BxuLwmm46wl5LDgW6S2IlVUBC4iljt4DlX0xAoNfdLQBWjUYE0wXK7q8\n\tF8zGRaHHJ/rzbTpbNUcACkarc+FaKTRjEnN6mKxWISCTZ7p9tN8jAn/DgxIHknMwZyrm\n\tKFvp7x+ZYbJn6FRveuFr1mitiTRH2vpIDvekmYiK7oQ5v3Y2i24fHUV+dJe3XQ8aWtFH\n\to7eX2AjB9Qs4A18vuQvW89woA/i8tTlc3ZZ1LlO5hV+fDCPFjyT9uUV1h4sRTPoKALJA\n\tpB2fNbsKEryzKVfkrgOZ8heoFAPsZ5YhY9vFMeJQKkLGwC/b4qCm9/maXA+f1pl7g0E1\n\t9PRQ=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"T3wPslu+\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1701883668; x=1702488468;\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=aZhuqx7wWBWMSOCJUTftNWGOyTmgbVHIYfBu+U4mHcA=;\n\tb=upbUxT8IbAx8CDp6rZsWp/saJNmuToTvFUaEy8zPUIP6WY2T4wY7kNH1sUm0TnJ9py\n\tWdK5FqwtyHhC5vqmzZ0VYx+EKozPebZb1XkmaSLDZLY6hbaQicnZYHeHAGqk9D/A4Djz\n\tBz6kYEhsWFdUrPogaHC+CZ60G3lsnxBLgx9cIfGpNRJ5cNlbh3iSK/S9J/XyuKO4GL8q\n\tEo94T9P+DU+cfXNwWSPY8TNh5IjDIcxaERsp0E+oFj6puoSqIECGFbehiNo+udmb0MxU\n\tuw3zzAkgihK4fKIsd6QhnpsTX7zQ55qWKoDChbvSEODaSkRhQNiitu0K1m1Y2m4okRnd\n\tFFFg==",
        "X-Gm-Message-State": "AOJu0YwDDzJD3kIy246RgTd1GuedTVhC7ku3tk/s6bbpHk3f1kS2qkQ7\n\tDu+mCqDwB2IKMl0J6fUyTRL1j14T5B2Sr5NqjncvLQ==",
        "X-Google-Smtp-Source": "AGHT+IG1zTIqX0B5UCHoC3kJaRNUoUJGyGkWkMXY+2MAqoJFIHaeUGTMyFSdCFmUa/gIZIoOrfJRdQ==",
        "X-Received": "by 2002:a5d:4fc5:0:b0:333:3fc7:f2bf with SMTP id\n\th5-20020a5d4fc5000000b003333fc7f2bfmr728856wrw.134.1701883667965; \n\tWed, 06 Dec 2023 09:27:47 -0800 (PST)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed,  6 Dec 2023 17:27:43 +0000",
        "Message-Id": "<20231206172743.13355-2-nick.hollinghurst@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.39.2",
        "In-Reply-To": "<20231206172743.13355-1-nick.hollinghurst@raspberrypi.com>",
        "References": "<20231206172743.13355-1-nick.hollinghurst@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH] ipa: rpi: Allow the mean of an empty\n\thistogram interval",
        "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": "Nick Hollinghurst via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>",
        "Cc": "Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Don't assert when taking the weighted mean of a zero-width or\nzero-weight interval; return its upper bound. That is certainly\ncorrect in the zero-width case, and plausible otherwise.\n\nSigned-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>\n---\n src/ipa/rpi/controller/histogram.cpp | 10 ++++++++--\n 1 file changed, 8 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/src/ipa/rpi/controller/histogram.cpp b/src/ipa/rpi/controller/histogram.cpp\nindex 0a27ba2c..78116141 100644\n--- a/src/ipa/rpi/controller/histogram.cpp\n+++ b/src/ipa/rpi/controller/histogram.cpp\n@@ -47,7 +47,7 @@ double Histogram::quantile(double q, int first, int last) const\n \n double Histogram::interBinMean(double binLo, double binHi) const\n {\n-\tassert(binHi > binLo);\n+\tassert(binHi >= binLo);\n \tdouble sumBinFreq = 0, cumulFreq = 0;\n \tfor (double binNext = floor(binLo) + 1.0; binNext <= ceil(binHi);\n \t     binLo = binNext, binNext += 1.0) {\n@@ -57,13 +57,19 @@ double Histogram::interBinMean(double binLo, double binHi) const\n \t\tsumBinFreq += bin * freq;\n \t\tcumulFreq += freq;\n \t}\n+\n+\tif (cumulFreq == 0) {\n+\t\t/* interval had zero width or contained no weight? */\n+\t\treturn binHi;\n+\t}\n+\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+\tassert(qHi >= qLo);\n \tdouble pLo = quantile(qLo);\n \tdouble pHi = quantile(qHi, (int)pLo);\n \treturn interBinMean(pLo, pHi);\n",
    "prefixes": [
        "libcamera-devel"
    ]
}