Show a patch.

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

{
    "id": 18477,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/18477/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18477/",
    "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": "<20230327122030.11756-9-naush@raspberrypi.com>",
    "date": "2023-03-27T12:20:28",
    "name": "[libcamera-devel,v2,08/10] ipa: raspberrypi: Generalise the agc algorithm",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "f936aef4b7099bcbcdffb48cbbcc0236d35ba0ef",
    "submitter": {
        "id": 34,
        "url": "https://patchwork.libcamera.org/api/1.1/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/18477/mbox/",
    "series": [
        {
            "id": 3819,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3819/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3819",
            "date": "2023-03-27T12:20:20",
            "name": "Raspberry Pi: Generalised algorithms",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/3819/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18477/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18477/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 3028AC329C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 27 Mar 2023 12:20:54 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D67F66276E;\n\tMon, 27 Mar 2023 14:20:53 +0200 (CEST)",
            "from mail-il1-x12a.google.com (mail-il1-x12a.google.com\n\t[IPv6:2607:f8b0:4864:20::12a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F2B9A62758\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Mar 2023 14:20:49 +0200 (CEST)",
            "by mail-il1-x12a.google.com with SMTP id h11so4512798ild.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Mar 2023 05:20:49 -0700 (PDT)",
            "from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tr7-20020a5edb47000000b00758ff97aaedsm3239026iop.16.2023.03.27.05.20.48\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 27 Mar 2023 05:20:49 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1679919653;\n\tbh=ikDcOL4X/wpeiEwyev6qGchPa+D+ecIaiLLxK93NTDI=;\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=sGTK48dfDLaLXEEjQglwNhSo+ivZ63VIVhFSZ5t2Sh/zV3ZEwYq18ZMXgKZ41DJ0+\n\tetDPZhylMiV17O5jf0f/wS8uJxLAz5Zpo4jPn1gwVTnzRwoN/+rIZb2JRnmYFdrGQA\n\tZqd8sTSyCOH9V0oR9DjVsv6+LdBYNEvoQJ4cJQkGt49/xFux9ZcTW/iVoJnRn70UI1\n\t9itESjgjR2Wiw8Ai05ZEi9nHgdaRm4UthvtqJVjfMb0aD5dlCXR4wdvuiXoIBXldcg\n\tmB/ir6wK3+v0IjZ2HVXVeiSj/b9YlKhkSoTQS7ub5DV1sYFdAXzDfcx/lfynD2wZD7\n\tkBiQ1kB4A0Rlg==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1679919649;\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=jFO9Xj1fKv8w1hxje+taVYe/vtFu0agkjxfPZsxmJQQ=;\n\tb=ZS6sZh7Trtz78CXj32JqqZy1CHyYojL6fNy1IoyWNykhnKjtx4RGYxebk+uTqF/5s0\n\tAZO4C1C1RNNRcuxqwUf1nezN24gX16Nx5SSAzx/cQKiz1v12/Gz5V2ZafRgbM9/AKZRy\n\tSEiSpvGy8Eh/f55/No0JKJeNxepoOV9+3hxMgsB9SxT06K1fRtvQ74k/Jy73ml+uWgJ8\n\txmLOaVTF74yrTcb6pnyi36+/XKD3cC8B/jMOjEcHLQoihhsEaqxE2XeqSZQmn+3HOEcc\n\tPUsTfVdodESPKu7plLFio7PEy6QLS+7zv+q1xnSa3zVOLPOF/mvnOylF9UZ3foA/d5FQ\n\t6l0Q=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"ZS6sZh7T\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112; t=1679919649;\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=jFO9Xj1fKv8w1hxje+taVYe/vtFu0agkjxfPZsxmJQQ=;\n\tb=UWBaj9bOF0Dtv/G2nu5YSjBOpK6iCnSohNEHZXzhN3bcEcq/sDKROxkxtiWpx3eSKb\n\tJxENYWnfTj6cJAWqFJfWLzly3GLBWO5FRgY0EIMaqWoFEFJgn5KLWimS61Cks/x+znDn\n\twLLFR2fDHv8DDqvEMuQmy69REA4RdpdDwaqxUrpYqtMSY5VnmbkJueII6dO+pUVe+gXv\n\ttmvN4oXdX3CnlUNktJmi0GVP5QVt3cohHBCaSYj/d8CaWr3C+y7Yn/6B1cpb3BVxaeBw\n\tLaViJHZgXCbbaCeYJgJOyccezoiPDLpNleqSxDK8AcqccRa4f6laiR72qSu1yZoPUJD8\n\tuJVw==",
        "X-Gm-Message-State": "AAQBX9cpNqnei3Gti8qtX18UPs9e55MTbKMbwSq9wVH6NY4L7Kp5VMyK\n\tZvGM5cj2V0lBQ7aJXx0F6PZ2uTTTXXDOvFflx8SaCQ==",
        "X-Google-Smtp-Source": "AKy350bpm90pMeoJsaLV9ynHorlNTwk7/PJxoajuKhuWZksJf7Mu9O7ve/wSByUCm3LuQs22NYfvvw==",
        "X-Received": "by 2002:a05:6e02:811:b0:315:365d:5358 with SMTP id\n\tu17-20020a056e02081100b00315365d5358mr9665395ilm.10.1679919649425; \n\tMon, 27 Mar 2023 05:20:49 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 27 Mar 2023 13:20:28 +0100",
        "Message-Id": "<20230327122030.11756-9-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20230327122030.11756-1-naush@raspberrypi.com>",
        "References": "<20230327122030.11756-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 08/10] ipa: raspberrypi: Generalise the\n\tagc algorithm",
        "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": "Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Naushir Patuck <naush@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": "Remove any hard-coded assumptions about the target hardware platform\nfrom the AGC algorithm. Instead, use the \"target\" string provided by\nthe camera tuning config and generalised statistics structures to\ndeterming parameters such as grid and region sizes.\n\nThis change replaces all hard-coded arrays with equivalent std::vector\ntypes.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n src/ipa/raspberrypi/controller/rpi/agc.cpp | 20 +++++++++++++-------\n src/ipa/raspberrypi/controller/rpi/agc.h   |  9 +--------\n 2 files changed, 14 insertions(+), 15 deletions(-)",
    "diff": "diff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp b/src/ipa/raspberrypi/controller/rpi/agc.cpp\nindex 4ea0dd41e66c..fb96bb556e84 100644\n--- a/src/ipa/raspberrypi/controller/rpi/agc.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp\n@@ -31,17 +31,12 @@ LOG_DEFINE_CATEGORY(RPiAgc)\n int AgcMeteringMode::read(const libcamera::YamlObject &params)\n {\n \tconst YamlObject &yamlWeights = params[\"weights\"];\n-\tif (yamlWeights.size() != AgcStatsSize) {\n-\t\tLOG(RPiAgc, Error) << \"AgcMeteringMode: Incorrect number of weights\";\n-\t\treturn -EINVAL;\n-\t}\n \n-\tunsigned int num = 0;\n \tfor (const auto &p : yamlWeights.asList()) {\n \t\tauto value = p.get<double>();\n \t\tif (!value)\n \t\t\treturn -EINVAL;\n-\t\tweights[num++] = *value;\n+\t\tweights.push_back(*value);\n \t}\n \n \treturn 0;\n@@ -249,6 +244,14 @@ int Agc::read(const libcamera::YamlObject &params)\n \tif (ret)\n \t\treturn ret;\n \n+\tconst Size &size = getHardwareConfig().agcZoneWeights;\n+\tfor (auto const &modes : config_.meteringModes) {\n+\t\tif (modes.second.weights.size() != size.width * size.height) {\n+\t\t\tLOG(RPiAgc, Error) << \"AgcMeteringMode: Incorrect number of weights\";\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t}\n+\n \t/*\n \t * Set the config's defaults (which are the first ones it read) as our\n \t * current modes, until someone changes them.  (they're all known to\n@@ -582,9 +585,12 @@ void Agc::fetchAwbStatus(Metadata *imageMetadata)\n }\n \n static double computeInitialY(StatisticsPtr &stats, AwbStatus const &awb,\n-\t\t\t      double weights[], double gain)\n+\t\t\t      std::vector<double> &weights, double gain)\n {\n \tconstexpr uint64_t maxVal = 1 << Statistics::NormalisationFactorPow2;\n+\n+\tASSERT(weights.size() == stats->agcRegions.numRegions());\n+\n \t/*\n \t * Note how the calculation below means that equal weights give you\n \t * \"average\" metering (i.e. all pixels equally important).\ndiff --git a/src/ipa/raspberrypi/controller/rpi/agc.h b/src/ipa/raspberrypi/controller/rpi/agc.h\nindex f04896ca25ad..d11a49c9cd85 100644\n--- a/src/ipa/raspberrypi/controller/rpi/agc.h\n+++ b/src/ipa/raspberrypi/controller/rpi/agc.h\n@@ -17,17 +17,10 @@\n \n /* This is our implementation of AGC. */\n \n-/*\n- * This is the number actually set up by the firmware, not the maximum possible\n- * number (which is 16).\n- */\n-\n-constexpr unsigned int AgcStatsSize = 15;\n-\n namespace RPiController {\n \n struct AgcMeteringMode {\n-\tdouble weights[AgcStatsSize];\n+\tstd::vector<double> weights;\n \tint read(const libcamera::YamlObject &params);\n };\n \n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "08/10"
    ]
}