Show a patch.

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

{
    "id": 19015,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/19015/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19015/",
    "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": "<20230915122954.5231-2-david.plowman@raspberrypi.com>",
    "date": "2023-09-15T12:29:50",
    "name": "[libcamera-devel,v4,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/19015/mbox/",
    "series": [
        {
            "id": 4024,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4024/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4024",
            "date": "2023-09-15T12:29:49",
            "name": "Multi-channel AGC",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/4024/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/19015/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19015/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 87DE2C3260\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 15 Sep 2023 12:30:21 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6179B62919;\n\tFri, 15 Sep 2023 14:30:20 +0200 (CEST)",
            "from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com\n\t[IPv6:2a00:1450:4864:20::42e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1BF92628EC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Sep 2023 14:30:19 +0200 (CEST)",
            "by mail-wr1-x42e.google.com with SMTP id\n\tffacd0b85a97d-31c4d5bd69cso1940619f8f.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Sep 2023 05:30:19 -0700 (PDT)",
            "from localhost.localdomain ([195.180.61.40])\n\tby smtp.gmail.com with ESMTPSA id\n\ty14-20020a7bcd8e000000b004030e8ff964sm7435009wmj.34.2023.09.15.05.30.17\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 15 Sep 2023 05:30:17 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1694781020;\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=VbOJBt9ZKGV0aDpSKMGXp5COOeoUZUNL8KD/pwfp9X8tUiTAkWkd6FOgQu1BG1y2g\n\t5WdKFzfqVsIAahWC4avGfYhR1Ih2ZeDPayxG1j/AlNlQkspjkYYdk5W00grxeDdRLd\n\t9KXGK0PjqdATwVTOX9/NnPK/lJcgTy5q4wZ9Lrrz0w8DJTbk26533zZh2TDWT3N5Jw\n\tytex3TKOTmuNszw66ryK0yuDkkmIZBM+/xWA51whJ9nHSGkMalROSTyBjb50W+Kt4J\n\tY7VQRb1VDMWQ6D6LEv72ububdTQJd1xT/vNe6Y/j1W2CLHY+y+h3EkV1at3+b8vVcs\n\tbF7ueqXKrtRaA==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1694781018; x=1695385818;\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=SvXU0nVsahcUHIGNQnH32gB5pjFlIApW17UnlcbVgFuNXR5r8u04ASE464VqO1EqCL\n\tNmqLJqlCeRLsDveEzA7zMfxs830ntkr2iPoB8ip0f3t1KVY5cgmXxkcp8AkZV0XjaJUE\n\tPxMYgFHIauSbA002GvzSej+VWKHLM0/GwRHxZXUG8GCLJ3+RfV1P+fGt2jpvzwgpjHUf\n\th5OfGY1cru36P/uKVw9Azx6Vw/tLiPcGoGgNruL2OIJ1XLS//HfLRlPZADPZYPRDWcqd\n\tM62CttBdY6a6KOxoT+ZBUiRST+BzinugHdQw1RH5oeZtRf9xtBR9xvKc9XrRZcIOh9mo\n\t7dzg=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"SvXU0nVs\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1694781018; x=1695385818;\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=D5KT6G8s56eoZErNNX2gL5QA+4i1UjfNp5+K/kFdedH7Qot8k1+VJFjausyfmed2zV\n\tyJqUaUsu8al5AdqGK8+T2p9XTfqP10YOFL3DmF7vzXrvmp3mEfPxsFnmiaH45jAM30xN\n\tFltLkF3W2mhKkGSHqIRDLw/w8R/V7U5SmOqifaM+5cnqMIYUkGV4pL3oKheD0OH8GgcG\n\tBE74iacytK5nahZ0uXDKGuQxII/RFzWbTrbJ6dqlFvm1sFrhxKBdRsvW3bWVvBpTe/Dz\n\tgQd0DHJnLnyEUWeN4AeLcm1EfArhR5+DfmTt2BE2hmU9nazjXYuTQOA2V+9D2/DwIAm6\n\tDeNA==",
        "X-Gm-Message-State": "AOJu0YwcCY3JawcPIRDbTzuGHlJxrrYEqb+I1xP52418wNphQ6nXCd0q\n\tJr+EDUgvIJu7XvC5463F0GwN3s08ghj3wOKlAn4=",
        "X-Google-Smtp-Source": "AGHT+IGWP0SCZsawPPRxtRFsagd+4oy9i6PbS60fJ4uAQClQ+CZUzzcxS80EEQ9/oROytyMGYvi2DQ==",
        "X-Received": "by 2002:a5d:6a4c:0:b0:317:3a18:df26 with SMTP id\n\tt12-20020a5d6a4c000000b003173a18df26mr1370899wrw.39.1694781018357; \n\tFri, 15 Sep 2023 05:30:18 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 15 Sep 2023 13:29:50 +0100",
        "Message-Id": "<20230915122954.5231-2-david.plowman@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.30.2",
        "In-Reply-To": "<20230915122954.5231-1-david.plowman@raspberrypi.com>",
        "References": "<20230915122954.5231-1-david.plowman@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v4 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",
        "v4",
        "1/5"
    ]
}