Show a patch.

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

{
    "id": 21015,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/21015/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/21015/",
    "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": "<20240826152224.362773-6-stefan.klug@ideasonboard.com>",
    "date": "2024-08-26T15:22:03",
    "name": "[v1,5/8] ipa: rkisp1: Move loader functions into helper class",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "2c6bf1f8182e834153dcd0f32d64a3f1a5673544",
    "submitter": {
        "id": 184,
        "url": "https://patchwork.libcamera.org/api/1.1/people/184/?format=api",
        "name": "Stefan Klug",
        "email": "stefan.klug@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/21015/mbox/",
    "series": [
        {
            "id": 4540,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4540/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4540",
            "date": "2024-08-26T15:21:58",
            "name": "Implement polynomial lsc loader",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4540/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/21015/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/21015/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 3099DC323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 26 Aug 2024 15:22:47 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AEBBF63417;\n\tMon, 26 Aug 2024 17:22:46 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E6AF96341B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 26 Aug 2024 17:22:42 +0200 (CEST)",
            "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:58b7:f3d:c9d4:defa])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A93C2741;\n\tMon, 26 Aug 2024 17:21:36 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"tezfjt7I\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1724685696;\n\tbh=Sol+mcMBqj5cbBi+786nlOn9rj/Dv6QBpGCj8gp5HEM=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=tezfjt7I288Ni0Izke4FslbZcF5EntZHch71UICOS0XTyxwK5v5TioSk+JGhkRH9b\n\t97sm+Z7YPjSCaYbUFUf+Iljt1z0ZXFHSwmSmf4kTS910OFWi7Py9tbFgwlmsVSJ+tE\n\tuo2WWJHZ7L6HRPHE3sRG8a8I/6XaSbtlEV/YNIUI=",
        "From": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "Subject": "[PATCH v1 5/8] ipa: rkisp1: Move loader functions into helper class",
        "Date": "Mon, 26 Aug 2024 17:22:03 +0200",
        "Message-ID": "<20240826152224.362773-6-stefan.klug@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20240826152224.362773-1-stefan.klug@ideasonboard.com>",
        "References": "<20240826152224.362773-1-stefan.klug@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "In preparation to the polynomial LSC data, move the current loader into it's\nown helper class.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n src/ipa/rkisp1/algorithms/lsc.cpp | 124 ++++++++++++++++++------------\n 1 file changed, 75 insertions(+), 49 deletions(-)",
    "diff": "diff --git a/src/ipa/rkisp1/algorithms/lsc.cpp b/src/ipa/rkisp1/algorithms/lsc.cpp\nindex 7e0e65b22185..930c188f49e7 100644\n--- a/src/ipa/rkisp1/algorithms/lsc.cpp\n+++ b/src/ipa/rkisp1/algorithms/lsc.cpp\n@@ -68,6 +68,69 @@ namespace ipa::rkisp1::algorithms {\n \n LOG_DEFINE_CATEGORY(RkISP1Lsc)\n \n+class LscClassicLoader\n+{\n+public:\n+\tint parseLscData(const YamlObject &yamlSets,\n+\t\t\t std::map<unsigned int, LensShadingCorrection::Components> &lscData)\n+\t{\n+\t\tconst auto &sets = yamlSets.asList();\n+\t\tfor (const auto &yamlSet : sets) {\n+\t\t\tuint32_t ct = yamlSet[\"ct\"].get<uint32_t>(0);\n+\n+\t\t\tif (lscData.count(ct)) {\n+\t\t\t\tLOG(RkISP1Lsc, Error)\n+\t\t\t\t\t<< \"Multiple sets found for color temperature \"\n+\t\t\t\t\t<< ct;\n+\t\t\t\treturn -EINVAL;\n+\t\t\t}\n+\n+\t\t\tLensShadingCorrection::Components &set = lscData[ct];\n+\n+\t\t\tset.ct = ct;\n+\t\t\tset.r = parseTable(yamlSet, \"r\");\n+\t\t\tset.gr = parseTable(yamlSet, \"gr\");\n+\t\t\tset.gb = parseTable(yamlSet, \"gb\");\n+\t\t\tset.b = parseTable(yamlSet, \"b\");\n+\n+\t\t\tif (set.r.empty() || set.gr.empty() ||\n+\t\t\t    set.gb.empty() || set.b.empty()) {\n+\t\t\t\tLOG(RkISP1Lsc, Error)\n+\t\t\t\t\t<< \"Set for color temperature \" << ct\n+\t\t\t\t\t<< \" is missing tables\";\n+\t\t\t\treturn -EINVAL;\n+\t\t\t}\n+\t\t}\n+\n+\t\tif (lscData.empty()) {\n+\t\t\tLOG(RkISP1Lsc, Error) << \"Failed to load any sets\";\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\treturn 0;\n+\t}\n+\n+private:\n+\tstd::vector<uint16_t> parseTable(const YamlObject &tuningData,\n+\t\t\t\t\t const char *prop)\n+\t{\n+\t\tstatic constexpr unsigned int kLscNumSamples =\n+\t\t\tRKISP1_CIF_ISP_LSC_SAMPLES_MAX * RKISP1_CIF_ISP_LSC_SAMPLES_MAX;\n+\n+\t\tstd::vector<uint16_t> table =\n+\t\t\ttuningData[prop].getList<uint16_t>().value_or(std::vector<uint16_t>{});\n+\t\tif (table.size() != kLscNumSamples) {\n+\t\t\tLOG(RkISP1Lsc, Error)\n+\t\t\t\t<< \"Invalid '\" << prop << \"' values: expected \"\n+\t\t\t\t<< kLscNumSamples\n+\t\t\t\t<< \" elements, got \" << table.size();\n+\t\t\treturn {};\n+\t\t}\n+\n+\t\treturn table;\n+\t}\n+};\n+\n constexpr int kColourTemperatureChangeThreshhold = 10;\n \n static std::vector<double> parseSizes(const YamlObject &tuningData,\n@@ -100,25 +163,6 @@ static std::vector<double> parseSizes(const YamlObject &tuningData,\n \treturn sizes;\n }\n \n-static std::vector<uint16_t> parseTable(const YamlObject &tuningData,\n-\t\t\t\t\tconst char *prop)\n-{\n-\tstatic constexpr unsigned int kLscNumSamples =\n-\t\tRKISP1_CIF_ISP_LSC_SAMPLES_MAX * RKISP1_CIF_ISP_LSC_SAMPLES_MAX;\n-\n-\tstd::vector<uint16_t> table =\n-\t\ttuningData[prop].getList<uint16_t>().value_or(std::vector<uint16_t>{});\n-\tif (table.size() != kLscNumSamples) {\n-\t\tLOG(RkISP1Lsc, Error)\n-\t\t\t<< \"Invalid '\" << prop << \"' values: expected \"\n-\t\t\t<< kLscNumSamples\n-\t\t\t<< \" elements, got \" << table.size();\n-\t\treturn {};\n-\t}\n-\n-\treturn table;\n-}\n-\n LensShadingCorrection::LensShadingCorrection()\n \t: lastAppliedCt_(0), lastAppliedQuantizedCt_(0)\n {\n@@ -145,39 +189,21 @@ int LensShadingCorrection::init([[maybe_unused]] IPAContext &context,\n \t\treturn -EINVAL;\n \t}\n \n-\tconst auto &sets = yamlSets.asList();\n \tstd::map<unsigned int, Components> lscData;\n-\tfor (const auto &yamlSet : sets) {\n-\t\tuint32_t ct = yamlSet[\"ct\"].get<uint32_t>(0);\n-\n-\t\tif (lscData.count(ct)) {\n-\t\t\tLOG(RkISP1Lsc, Error)\n-\t\t\t\t<< \"Multiple sets found for color temperature \"\n-\t\t\t\t<< ct;\n-\t\t\treturn -EINVAL;\n-\t\t}\n-\n-\t\tComponents &set = lscData[ct];\n-\n-\t\tset.ct = ct;\n-\t\tset.r = parseTable(yamlSet, \"r\");\n-\t\tset.gr = parseTable(yamlSet, \"gr\");\n-\t\tset.gb = parseTable(yamlSet, \"gb\");\n-\t\tset.b = parseTable(yamlSet, \"b\");\n-\n-\t\tif (set.r.empty() || set.gr.empty() ||\n-\t\t    set.gb.empty() || set.b.empty()) {\n-\t\t\tLOG(RkISP1Lsc, Error)\n-\t\t\t\t<< \"Set for color temperature \" << ct\n-\t\t\t\t<< \" is missing tables\";\n-\t\t\treturn -EINVAL;\n-\t\t}\n+\tint res = 0;\n+\tstd::optional<std::string> type = tuningData[\"type\"].get<std::string>();\n+\tif (!type.has_value()) {\n+\t\tLOG(RkISP1Lsc, Warning) << \"LSC data is in classic format. \"\n+\t\t\t\t\t<< \"This will be deprecated soon.\";\n+\t\tauto loader = LscClassicLoader();\n+\t\tres = loader.parseLscData(yamlSets, lscData);\n+\t} else {\n+\t\tLOG(RkISP1Lsc, Error) << \"Unsupported LSC type '\" << *type << \"'\";\n+\t\tres = -EINVAL;\n \t}\n \n-\tif (lscData.empty()) {\n-\t\tLOG(RkISP1Lsc, Error) << \"Failed to load any sets\";\n-\t\treturn -EINVAL;\n-\t}\n+\tif (res)\n+\t\treturn res;\n \n \tsets_.setData(std::move(lscData));\n \n",
    "prefixes": [
        "v1",
        "5/8"
    ]
}