Show a patch.

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

{
    "id": 10463,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/10463/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/10463/",
    "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": "<20201123073804.3125-5-david.plowman@raspberrypi.com>",
    "date": "2020-11-23T07:37:58",
    "name": "[libcamera-devel,v2,04/10] libcamera: ipa: raspberrypi: agc: Improve centre-weighted luminance calucation",
    "commit_ref": "9db94a3635b8cc0963fdbc8e33c07890ce177359",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "27eee47def51ccd8e6048b799aa8d86b00597cb0",
    "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/10463/mbox/",
    "series": [
        {
            "id": 1475,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1475/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1475",
            "date": "2020-11-23T07:37:54",
            "name": "Raspberry Pi AGC",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/1475/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/10463/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/10463/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 48142BE08A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 23 Nov 2020 07:38:37 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1110263320;\n\tMon, 23 Nov 2020 08:38:37 +0100 (CET)",
            "from mail-wr1-x431.google.com (mail-wr1-x431.google.com\n\t[IPv6:2a00:1450:4864:20::431])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3A4A963327\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Nov 2020 08:38:34 +0100 (CET)",
            "by mail-wr1-x431.google.com with SMTP id r17so17621935wrw.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 22 Nov 2020 23:38:34 -0800 (PST)",
            "from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\th15sm17841822wrw.15.2020.11.22.23.38.32\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSun, 22 Nov 2020 23:38:33 -0800 (PST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"rxN2a/78\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=QATcowDQnYv31Wl12U+LjUBs2LFP1uTTOOAJsc0CaZk=;\n\tb=rxN2a/7885WjDU4E+/cuKRoaa3F0Hz4WJOZQ4mgH4y/cMTOrZys8po5EY5+XEANrPU\n\tmqmqZU+6m9xYan4rTRZZNsqduuQ47gzs3GFYH//s7kyBzczeZUedx5LTDWhhHCZvacDg\n\tpapNWPF6xJwKLcVwn85l4ixeFJQtmA5Dul1FCl0seRmEVIwcQ6Lq5Sz0wUrLqRlPeQ3M\n\t9Q1T30GvI7l2EiM1uV0lXdILa3gyNBkyfDg/xRVDVgsghmqWR+MYbXwK72wmHzwrHAW9\n\tKbt1zuvdRVir0UOeuECd/IZ/ykZssmJiRL1IGwox1YEIptJDwWFA7jYPub/q0CxTwcvm\n\tHHDQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=QATcowDQnYv31Wl12U+LjUBs2LFP1uTTOOAJsc0CaZk=;\n\tb=SYhIYnBQ2ZWYoOkn8zvo1AEJtuPOP+eeOEB+0r8/Ok2soRBHIj1Bg7+hVopwj6AkKJ\n\tP6szz/vuHiyFenw2ez+ELw+xqtloVqf8YV3s7iuHQsiB9j5611oJiztYcclI0pQ5ShE3\n\t77YbJ+HaJnT3KfZEFqyU0yaMuYXa5H6H+6R1ykXP0E8HMhqU7Fe6I1pGZpkSEdVlv2Ci\n\tmEgh1rq+2uX+xzBbYqZeYkCpaX82iIDIq1P6Ut5OboeiOSLZmmpDcOksclNa8qteOCfC\n\tfHq/RyGuoXN+hsEdR6eFk6rVokkUK9yWxHUUKBFLmuhB7whermXPeAczoDau7Q8Oe4U/\n\t4Fjg==",
        "X-Gm-Message-State": "AOAM530RLHstQq+O0F5tcIUCqcgGvB4WtCLijqyFriAqPagdFadKuc/m\n\tyByrJiVMfiNy0QXwvkj4Rz7Te6WAEh0SK2bA",
        "X-Google-Smtp-Source": "ABdhPJxtTz78BBXcL1pf6MAVI2HT0pWVTG8gxgVd3lQu/A9QMWdae96iurU91PdWmruCs7fyMDECEw==",
        "X-Received": "by 2002:adf:c452:: with SMTP id\n\ta18mr30006592wrg.189.1606117113639; \n\tSun, 22 Nov 2020 23:38:33 -0800 (PST)",
        "From": "David Plowman <david.plowman@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 23 Nov 2020 07:37:58 +0000",
        "Message-Id": "<20201123073804.3125-5-david.plowman@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20201123073804.3125-1-david.plowman@raspberrypi.com>",
        "References": "<20201123073804.3125-1-david.plowman@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v2 04/10] libcamera: ipa: raspberrypi:\n\tagc: Improve centre-weighted luminance calucation",
        "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>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Previously the calculation computed Y for each region before returning\nthe weighted average, which \"baked in\" the over-importance of small\nstatistics regions. The revised calculation will treat all pixels\nequally when the region weights are the same, making it easier to\nuse. With the previous scheme, proper \"average\" metering was difficult\nto implement.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/ipa/raspberrypi/controller/rpi/agc.cpp | 25 +++++++++++++---------\n 1 file changed, 15 insertions(+), 10 deletions(-)",
    "diff": "diff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp b/src/ipa/raspberrypi/controller/rpi/agc.cpp\nindex 9a5d84f7..f0c70a0a 100644\n--- a/src/ipa/raspberrypi/controller/rpi/agc.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp\n@@ -385,18 +385,23 @@ static double compute_initial_Y(bcm2835_isp_stats *stats, Metadata *image_metada\n \tawb.gain_r = awb.gain_g = awb.gain_b = 1.0; // in case no metadata\n \tif (image_metadata->Get(\"awb.status\", awb) != 0)\n \t\tLOG(RPiAgc, Warning) << \"Agc: no AWB status found\";\n-\tdouble Y_sum = 0, weight_sum = 0;\n+\t// Note how the calculation below means that equal weights give you\n+\t// \"average\" metering (i.e. all pixels equally important).\n+\tdouble R_sum = 0, G_sum = 0, B_sum = 0, pixel_sum = 0;\n \tfor (int i = 0; i < AGC_STATS_SIZE; i++) {\n-\t\tif (regions[i].counted == 0)\n-\t\t\tcontinue;\n-\t\tweight_sum += weights[i];\n-\t\tdouble Y = regions[i].r_sum * awb.gain_r * .299 +\n-\t\t\t   regions[i].g_sum * awb.gain_g * .587 +\n-\t\t\t   regions[i].b_sum * awb.gain_b * .114;\n-\t\tY /= regions[i].counted;\n-\t\tY_sum += Y * weights[i];\n+\t\tR_sum += regions[i].r_sum * weights[i];\n+\t\tG_sum += regions[i].g_sum * weights[i];\n+\t\tB_sum += regions[i].b_sum * weights[i];\n+\t\tpixel_sum += regions[i].counted * weights[i];\n \t}\n-\treturn Y_sum / weight_sum / (1 << PIPELINE_BITS);\n+\tif (pixel_sum == 0.0) {\n+\t\tLOG(RPiAgc, Warning) << \"compute_initial_Y: pixel_sum is zero\";\n+\t\treturn 0;\n+\t}\n+\tdouble Y_sum = R_sum * awb.gain_r * .299 +\n+\t\t       G_sum * awb.gain_g * .587 +\n+\t\t       B_sum * awb.gain_b * .114;\n+\treturn Y_sum / pixel_sum / (1 << PIPELINE_BITS);\n }\n \n // We handle extra gain through EV by adjusting our Y targets. However, you\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "04/10"
    ]
}