Show a patch.

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

{
    "id": 18436,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/18436/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18436/",
    "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": "<20230322130612.5208-10-naush@raspberrypi.com>",
    "date": "2023-03-22T13:06:11",
    "name": "[libcamera-devel,v1,09/10] ipa: raspberrypi: Generalise the agc algorithm",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "7bf4d0c45fc8a2efd42d9a30903a89cc54919a7c",
    "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/18436/mbox/",
    "series": [
        {
            "id": 3810,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3810/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3810",
            "date": "2023-03-22T13:06:02",
            "name": "Raspberry Pi: Generalised algorithms",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3810/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18436/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18436/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 3D9C1C32A2\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 22 Mar 2023 13:06:34 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9BCA56270D;\n\tWed, 22 Mar 2023 14:06:33 +0100 (CET)",
            "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 B28A762742\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Mar 2023 14:06:28 +0100 (CET)",
            "by mail-il1-x12a.google.com with SMTP id s1so3865698ild.6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Mar 2023 06:06:28 -0700 (PDT)",
            "from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tl6-20020a026646000000b003c488204c6fsm4927960jaf.76.2023.03.22.06.06.26\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 22 Mar 2023 06:06:26 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1679490393;\n\tbh=icouwjstIJlplcREzPnVduaDDhW/ubniFTTqrI/y6FU=;\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=xLV22dgMXQNFzxvoSsch1uRDjhg4Sg5YfCATW3JIi4S9UqlsXFfKz5x4LbvCGfPnh\n\tg3tGQygmnD8lWlb/JPBi5I7Vuo7Wq9ZqHxRNJtnQwqAIlP4lSDnfLnB0edWBcQmQDL\n\tOcfpUTr1RrEHe21Vn+kp+8l8H7MLJM0g8Ws3Jr0dvJVExjlNPTzjgeNj2pBMh/c874\n\tFqLcwMT2X1Q7fu6VoA98c2CG5Q3jGeKP2/Z8XQG7sCpxlPOFrNQR/TXj8fP3oV8PlD\n\tGTSIK4BlcQBajK3uJoLvOIXD1+5ozDeNEnTrzxcwySXlLy/9YK5UAMFEvh77nh9C1e\n\tbj9J91VgeS2Xw==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1679490387;\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=GM7wpbXpS06YcWhjewbppISe52faOHMFSk9/O0DNzEQ=;\n\tb=LRRacJ87oZGnJkjkesd+Ht/3B3SNA27IZgTMEbB+of/ASQoNt7YOki2JRslxNrDSyT\n\tLD6cYpqXp0dvz1wVptEJboQQc3NBT7OApqCel4OUivYZ5c4R9ACwJ0Va4i89ww2/q4cG\n\tnx0C9j2+F/dnRLL9JmqrVDea23p+J7RNCgFdN6yKYfUj3CAjLLIv4KNdlHwv5pTQP56K\n\t4fE2cN8O3nokyTFfCOjpxUHC3MqPZzPQLOTo3ZDfUy4yQxSSS8btl1ZV/W4kFt70x1w0\n\tBpuknBzR9geu6ExjhQFf4Z8o8sW3+Rskm00NKs+valOHMEbq/SPaPh7mZgcnKWV2mlR7\n\tVL/g=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"LRRacJ87\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112; t=1679490387;\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=GM7wpbXpS06YcWhjewbppISe52faOHMFSk9/O0DNzEQ=;\n\tb=b3+KLZUnw+cunhU7obXWL/Swmjxbk+yM5Fprnf6J4/5SPGq0B9UUc+pJWgY3RubceC\n\tCnVPNoLyyH5aUZ8uDIq/8KJIw7EE236sqYIvH52SVTk3L9E+pATz5oH8YnaJxNtIbdOx\n\tvMAPnPBrYv0zoXVApUXf6R4PDkrxZYyvfrl/DfsqdIlN7xc2IXZ+uAOlq8U+GCL/KASa\n\tTyaQD0iKPrLsn3HY63RQ2RvpVHbx9W9tI9I3FLkHHYzoavlsciAqGMWT99P+nhRPSWlf\n\tcGLEMj5q+237hh9YCpLFr+cNotSTk168PCZsxM5Jkqxc9rY0J3YGDgAHhToLJoo/8hTR\n\tK6tw==",
        "X-Gm-Message-State": "AO0yUKVvMELPjiO0OZtwV/OYXaP7Qw8KrpVLMu03YPURSQ0ak2wP31xA\n\tyV2KyssA+tf8kWvrD3ssk4U9QhlVzp5vKAlp9q9fwg==",
        "X-Google-Smtp-Source": "AK7set8PLqXmH0UGWOwh5b25oKKhBUnJz48E4VC3aauokboJ7eB6nS2E70NvbIckivVwVoDCTVt6Dw==",
        "X-Received": "by 2002:a92:c80c:0:b0:313:fea2:be5c with SMTP id\n\tv12-20020a92c80c000000b00313fea2be5cmr4201055iln.11.1679490387186; \n\tWed, 22 Mar 2023 06:06:27 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 22 Mar 2023 13:06:11 +0000",
        "Message-Id": "<20230322130612.5208-10-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20230322130612.5208-1-naush@raspberrypi.com>",
        "References": "<20230322130612.5208-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v1 09/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>",
        "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>\n---\n src/ipa/raspberrypi/controller/rpi/agc.cpp | 19 ++++++++++++-------\n src/ipa/raspberrypi/controller/rpi/agc.h   |  9 +--------\n 2 files changed, 13 insertions(+), 15 deletions(-)",
    "diff": "diff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp b/src/ipa/raspberrypi/controller/rpi/agc.cpp\nindex 4ea0dd41e66c..3e4a8149b9ae 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,11 @@ 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 \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",
        "v1",
        "09/10"
    ]
}