Show a patch.

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

{
    "id": 16003,
    "url": "https://patchwork.libcamera.org/api/patches/16003/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/16003/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/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": "<20220523092435.475510-4-fsylvestre@baylibre.com>",
    "date": "2022-05-23T09:24:33",
    "name": "[libcamera-devel,libcamera-devel,3/5] ipa: rkisp1: Add Yaml configuration file support",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "4ed3c248836b737e1c5c72bb4b172cf67110842f",
    "submitter": {
        "id": 123,
        "url": "https://patchwork.libcamera.org/api/people/123/?format=api",
        "name": "Florian Sylvestre",
        "email": "fsylvestre@baylibre.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/16003/mbox/",
    "series": [
        {
            "id": 3133,
            "url": "https://patchwork.libcamera.org/api/series/3133/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3133",
            "date": "2022-05-23T09:24:30",
            "name": "Add configuration file support for rkisp1 blc algo",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3133/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/16003/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/16003/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 0F673C3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 23 May 2022 09:24:52 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A8BBA65666;\n\tMon, 23 May 2022 11:24:51 +0200 (CEST)",
            "from mail-wm1-x336.google.com (mail-wm1-x336.google.com\n\t[IPv6:2a00:1450:4864:20::336])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E5E0465669\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 May 2022 11:24:46 +0200 (CEST)",
            "by mail-wm1-x336.google.com with SMTP id\n\t184-20020a1c02c1000000b003974edd7c56so1860wmc.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 May 2022 02:24:46 -0700 (PDT)",
            "from BL087.. ([2a01:e34:eea9:e630:1bc6:bcdb:60b7:f1d3])\n\tby smtp.gmail.com with ESMTPSA id\n\tw22-20020a1cf616000000b003942a244eebsm8034250wmc.48.2022.05.23.02.24.45\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 23 May 2022 02:24:45 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1653297891;\n\tbh=kZxk0NVbb8Hm0WltkUCI26czoTpAsmKnSvlffhi7O/Q=;\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=TNnZxyGfpGPKp1gG5jcT8Rp58K66U/TXMLn1KvSJBKh9FZZU7Is5pwM0o6EgXl9Vg\n\tF+OcuwwwR2gqAnWafVABtcaa844Pn6368a7bUcIqxkMvi9EM8cO390vSHMC3NHkQgB\n\tKR9HpQtcJHI3+LAqfy+E1PAHKvoxd9PHjBIkJ4ni20UpjnFyAYq0JHxAgdNpcE6za+\n\tV3AJtZBucUVkYjZB4Dzsn+goBZZOD4vJXT+SFDFMwZ1lRcbj3dIWWtDaIjPcrldLP2\n\twvIoWb74tTHnKWK4nEnMxP2PjD4fpWDtFpgKn3wzxz2ePjnB8zW7sRZ/ia2NOCr9Qr\n\tHNzDH8CEUHkCw==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=baylibre-com.20210112.gappssmtp.com; s=20210112;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=Q8q1+OAMp24LB9fLgpAqDcjnJp128nBRCd8CXPkDeQY=;\n\tb=WI3WSQfSyy/LPlpVejZ/ucoYvulAcUbIr6Ui4Lw0YNfPLYi4MWXAt1ZU7Pk/16PAQe\n\tzPOow1DZO2+Q5DkRRCuEEhx1kzsmqD/YV+7mvSgQIBW1K9hO0JGGqHLgKBLS9IdkGE2k\n\tb0bmRETBQzk1+6OgmiKgoGRCVLqSTo+N+EonxwQtowoQjmTmaHuQYrRof4BZGAIYF263\n\tVrFTgrbc6pF5FwNEOJWTWB1gONjYMH0oVH7Qog4wTOQBi/a91JcDTLY0PPgkNy+/gANy\n\tYVWfKEt6kNFdjfFqjHsWs3x+2nodMO+TsWDpM+lgNJvD1ezG0rhP7zZkXjSwD7rQZOZu\n\taS+w=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=baylibre-com.20210112.gappssmtp.com\n\theader.i=@baylibre-com.20210112.gappssmtp.com header.b=\"WI3WSQfS\"; \n\tdkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\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=Q8q1+OAMp24LB9fLgpAqDcjnJp128nBRCd8CXPkDeQY=;\n\tb=caibQbfzqeMyiMNMNw4+vk9qAwKo/StadyYLYJ8OvUNbiUw+O9kDSC3p++fgH2gOax\n\tgmvw7praOQmDW/0youQ0vraJ9Dv82rbvFR1CUe241Xj2SvPRr+07ppXSVoh64EzWMKFq\n\tBazJPjp6pRCJwNkwobGDfifWJwqShJD19H0hKNl1bnnK7i9JNxn57fpdLh0jQ1pdyuYc\n\tIDsvGexy2BmQWkxc5xNHIg0xR7WKwPHARyCtjV+HL+7ioP84+8POp2qIOSNi5IM87RC9\n\tEX7yKs+vIoRLo3cPh5mS/beSNtLMc9inU8mLSQeX6GGkniQ0vuQTd9zYg0uoznX6a2pq\n\tDagw==",
        "X-Gm-Message-State": "AOAM531aMEHaONGHqfaJQoJhA/r/oEQZBkMiu39j4E0IQH7DB6vqW1TZ\n\tAneGV3xYnIvrM4BOEgSVqAkkHe515KQ7Qw==",
        "X-Google-Smtp-Source": "ABdhPJwuA2lzpok6fo92bnZ1O0OavHAYw2cai5+1orD5bVVhGia53CaqUGwaDd/+yoif+cQQhj/YPg==",
        "X-Received": "by 2002:a05:600c:3d19:b0:396:f904:753e with SMTP id\n\tbh25-20020a05600c3d1900b00396f904753emr18723499wmb.178.1653297886198; \n\tMon, 23 May 2022 02:24:46 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 23 May 2022 11:24:33 +0200",
        "Message-Id": "<20220523092435.475510-4-fsylvestre@baylibre.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20220523092435.475510-1-fsylvestre@baylibre.com>",
        "References": "<20220523092435.475510-1-fsylvestre@baylibre.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [libcamera-devel 3/5] ipa: rkisp1: Add Yaml\n\tconfiguration file support",
        "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": "Florian Sylvestre via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Florian Sylvestre <fsylvestre@baylibre.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Retrieve root node in Yaml configuration file and provide to\neach algorithm this YamlObject to allow them to grab their default\nparameters by calling init() function.\n\nSigned-off-by: Florian Sylvestre <fsylvestre@baylibre.com>\n---\n src/ipa/rkisp1/algorithms/algorithm.h |  4 ++-\n src/ipa/rkisp1/rkisp1.cpp             | 36 +++++++++++++++++++++++++++\n 2 files changed, 39 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/ipa/rkisp1/algorithms/algorithm.h b/src/ipa/rkisp1/algorithms/algorithm.h\nindex d46c3188..5b95fd30 100644\n--- a/src/ipa/rkisp1/algorithms/algorithm.h\n+++ b/src/ipa/rkisp1/algorithms/algorithm.h\n@@ -17,9 +17,11 @@\n \n namespace libcamera {\n \n+class YamlObject;\n+\n namespace ipa::rkisp1 {\n \n-using Algorithm = libcamera::ipa::Algorithm<IPAContext, IPACameraSensorInfo, rkisp1_params_cfg, rkisp1_stat_buffer>;\n+using Algorithm = libcamera::ipa::Algorithm<IPAContext, YamlObject, IPACameraSensorInfo, rkisp1_params_cfg, rkisp1_stat_buffer>;\n \n } /* namespace ipa::rkisp1 */\n \ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex 23cb95b5..c44514c2 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -24,6 +24,7 @@\n #include <libcamera/request.h>\n \n #include <libcamera/internal/mapped_framebuffer.h>\n+#include <libcamera/internal/yaml_parser.h>\n \n #include \"algorithms/agc.h\"\n #include \"algorithms/algorithm.h\"\n@@ -61,6 +62,7 @@ public:\n private:\n \tvoid setControls(unsigned int frame);\n \tvoid prepareMetadata(unsigned int frame, unsigned int aeState);\n+\tint parseConfigurationFile(FILE *fh);\n \n \tstd::map<unsigned int, FrameBuffer> buffers_;\n \tstd::map<unsigned int, MappedFrameBuffer> mappedBuffers_;\n@@ -126,6 +128,40 @@ int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision)\n \talgorithms_.push_back(std::make_unique<algorithms::Awb>());\n \talgorithms_.push_back(std::make_unique<algorithms::BlackLevelCorrection>());\n \n+\t/* Load the tuning file for this sensor. */\n+\tFILE *fh = fopen(settings.configurationFile.c_str(), \"r\");\n+\tif (!fh) {\n+\t\tint ret = -errno;\n+\t\tLOG(IPARkISP1, Error) << \"Failed to open configuration file \"\n+\t\t\t\t      << settings.configurationFile << \": \" << strerror(-ret);\n+\t\treturn ret;\n+\t}\n+\n+\tint ret = parseConfigurationFile(fh);\n+\n+\tfclose(fh);\n+\tif (ret)\n+\t\treturn -EINVAL;\n+\n+\treturn 0;\n+}\n+\n+int IPARkISP1::parseConfigurationFile(FILE *fh)\n+{\n+\tstd::unique_ptr<libcamera::YamlObject> root = YamlParser::parse(fh);\n+\tif (!root)\n+\t\treturn -EINVAL;\n+\n+\tif (!root->isDictionary())\n+\t\treturn -EINVAL;\n+\n+\t/* Allow each algo to get parameters from configuration file. */\n+\tfor (auto const &algo : algorithms_) {\n+\t\tint ret = algo->init(context_, root.get());\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t}\n+\n \treturn 0;\n }\n \n",
    "prefixes": [
        "libcamera-devel",
        "libcamera-devel",
        "3/5"
    ]
}