Patch Detail
Show a patch.
GET /api/1.1/patches/16671/?format=api
{ "id": 16671, "url": "https://patchwork.libcamera.org/api/1.1/patches/16671/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16671/", "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": "<20220718081602.32535-6-naush@raspberrypi.com>", "date": "2022-07-18T08:15:59", "name": "[libcamera-devel,v6,5/8] ipa: raspberrypi: Introduce version 2.0 format for the camera tuning file", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "768ce49815b5e9ebfbe1b958107a44b5dc031786", "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/16671/mbox/", "series": [ { "id": 3293, "url": "https://patchwork.libcamera.org/api/1.1/series/3293/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3293", "date": "2022-07-18T08:15:54", "name": "Replace boost JSON parser with libyaml in Raspberry Pi IPA", "version": 6, "mbox": "https://patchwork.libcamera.org/series/3293/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16671/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16671/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 1E9B7BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 18 Jul 2022 08:16:14 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C8EF863317;\n\tMon, 18 Jul 2022 10:16:13 +0200 (CEST)", "from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com\n\t[IPv6:2a00:1450:4864:20::32d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5866763313\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 Jul 2022 10:16:10 +0200 (CEST)", "by mail-wm1-x32d.google.com with SMTP id o8so6649436wms.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 Jul 2022 01:16:10 -0700 (PDT)", "from naush-laptop.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\ta15-20020adffb8f000000b0021dbac444a7sm10206795wrr.59.2022.07.18.01.16.09\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 18 Jul 2022 01:16:09 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658132173;\n\tbh=HLUs42uFbD7cMb9yZy5swV03CaFsS+iH1xxvF7Oa/lE=;\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=bA74/dVHCBT/iH7vmCjf/8I4nEBJTB/yst2zpFlAmYLLaAH38oo4MxtPTM1bdqRCs\n\tbNUGCR/DRxe5cDZCLXt1wawYFKoVLUC81de3J9WydaEmzw7SmiNOcMRCkNAGRwo5QZ\n\tOo8vhsfGDWemcNUwTgZGiHUGckWMwukspqbC5ZgPZrkYwdG2ltK9rkObWzThxjFr6U\n\tlP6Xe3n9fxWdsPSp9G8a6Y4SKZ9hjbghMZV8pK5zh8Dt3y8Wp9PaJMuH2m4PSw7eGc\n\tptBTKDa1y/OAXZTg39z7JFaGzmRFLY8OoIOr0QELxbg8efB+0+0BuCaSTxGNLRQ2My\n\tEzO1EX8mva8rg==", "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=XtlLy1tZ90SLNUA/xVA9z1V4OdXjkWqfFZp8JsW2GDU=;\n\tb=GogST6hM2jKmA8Pl7cUcTK/Ua5crd8paPh+Ptcwu+mq21aF5JUu8GJlISzTuH9zGe9\n\t0r/p3Hdmbf1YxI2io+bqjFrkqbsCNEvODQTo/9nQw7Rn/NRo0eZlKmqYJcYWfnUtmUwp\n\t0MKNLk4PDN15jFfaNCB4S/dmuKpm824uXPRLgXVxUhZ6v6NZhFKtlA28VcensiY4eFI4\n\tRlH+uKTCguKTcIE4TWjUHgNX3mT1BiuYRfIBp/RbgAzf3Kgvc31u6wY3NvFLSEoBWOVQ\n\tLnhKbcGkarZuMb79SBo5udTrs75DTCZ+0sbCai48qvbd0EqEJnuKM1Ip5W/re6ZzKvzp\n\t/0lg==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"GogST6hM\"; dkim-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=XtlLy1tZ90SLNUA/xVA9z1V4OdXjkWqfFZp8JsW2GDU=;\n\tb=CksL4URYJXr/Oo9M5XdFaQLy0eGz0wZ6LbKzHXUp3zgGlKmHYtMRP2xmZQUCyWJ2LU\n\tptM3cQmFsdibCOgi1Y5e1tRzpHsGj/ZOKJXP+Ze6+1XPFR+H8i/kFiQzAAFzhOeqthHc\n\tIEpD6ALPUwTdkvGrXdZLds5XYr6wyUSefl6nRwxtkI1gu3ELDGnlpp40R1B6g4eeEtL3\n\tHsDQwgkhROXijCULTfdU0CQzmPhHRlTOp0jsSkD0YYMxc8Jf1yBRyOywH2wEfSh8GtxA\n\tKDfuuEQamWCEgNxT+kDsjFi/d4C0Dwbs+qrOVJa9laAi1CmaKo56MRWl5/JGjG0pEusw\n\t9RUA==", "X-Gm-Message-State": "AJIora9ieVQbqhF9ati/5J1YN+NJvigS0Rb0CRo7uMNxO1Brz5UaVa9W\n\tcUzwIU898/G7BQka5XQoLBiGYAh1wddVwg==", "X-Google-Smtp-Source": "AGRyM1sjfNHVM2+UDg56jdYB5b5Qz67xu+9wisA1G74fM8DOIUEyPghI1rKst39j9oAZISmk0Ohhcw==", "X-Received": "by 2002:a05:600c:4e0d:b0:3a3:bc7:e9ec with SMTP id\n\tb13-20020a05600c4e0d00b003a30bc7e9ecmr14675124wmq.167.1658132169730; \n\tMon, 18 Jul 2022 01:16:09 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 18 Jul 2022 09:15:59 +0100", "Message-Id": "<20220718081602.32535-6-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20220718081602.32535-1-naush@raspberrypi.com>", "References": "<20220718081602.32535-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v6 5/8] ipa: raspberrypi: Introduce\n\tversion 2.0 format for the camera tuning file", "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": "The existing tuning file format (version 1.0) requires the controller algorithms\nto run in the same order as listed in the JSON structure. The JSON specification\ndoes not mandate any such ordering, but the Boost JSON parser would maintain\nthis order.\n\nIn order to remove this reliance on the parser to provide ordering, introduce a\nnew version 2.0 format for the camera tuning file. In this version, the\nalgorithms are specified in a top level list node (\"algorithms\"), which does\nrequire strict ordering of the elements.\n\nA \"version\" node is added to distinguish between the version 1.0 and 2.0\nformats. The absence of the \"version\" node implies version 1.0.\n\nA \"target\" node is also added to specify the target platform for this\nconfiguration.\n\nUpdate the controller to support either version of the tuning file by looking\nat the version node. CreateAlgorithm member function to now load and configure\neach algorithm. Additionally, make CreateAlgorithm a private member, it does not\nget called externally.\n\nIf a version 1.0 format tuning file is used, throw a warning message indicating\nit will be soon deprecated.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/ipa/raspberrypi/controller/controller.cpp | 43 +++++++++++++------\n src/ipa/raspberrypi/controller/controller.hpp | 4 +-\n 2 files changed, 34 insertions(+), 13 deletions(-)", "diff": "diff --git a/src/ipa/raspberrypi/controller/controller.cpp b/src/ipa/raspberrypi/controller/controller.cpp\nindex 67d650ef0c1b..b22a17f18f8e 100644\n--- a/src/ipa/raspberrypi/controller/controller.cpp\n+++ b/src/ipa/raspberrypi/controller/controller.cpp\n@@ -42,22 +42,41 @@ void Controller::Read(char const *filename)\n \t}\n \n \tstd::unique_ptr<YamlObject> root = YamlParser::parse(file);\n-\n-\tfor (auto const &[key, value] : root->asDict()) {\n-\t\tAlgorithm *algo = CreateAlgorithm(key.c_str());\n-\t\tif (algo) {\n-\t\t\talgo->Read(value);\n-\t\t\talgorithms_.push_back(AlgorithmPtr(algo));\n-\t\t} else\n-\t\t\tLOG(RPiController, Warning)\n-\t\t\t\t<< \"No algorithm found for \\\"\" << key << \"\\\"\";\n+\tdouble version = (*root)[\"version\"].get<double>(1.0);\n+\tif (version < 2.0) {\n+\t\tLOG(RPiController, Warning)\n+\t\t\t<< \"This format of the tuning file will be deprecated soon!\"\n+\t\t\t<< \" Please use the convert_tuning.py utility to update to version 2.0.\";\n+\t\tfor (auto const &[key, value] : root->asDict())\n+\t\t\tCreateAlgorithm(key, value);\n+\t} else if (version < 3.0) {\n+\t\tif (!root->contains(\"algorithms\")) {\n+\t\t\tLOG(RPiController, Fatal)\n+\t\t\t\t<< \"Tuning file \" << filename\n+\t\t\t\t<< \" does not have an \\\"algorithms\\\" list!\";\n+\t\t\treturn;\n+\t\t}\n+\t\tfor (auto const &rootAlgo : (*root)[\"algorithms\"].asList())\n+\t\t\tfor (auto const &[key, value] : rootAlgo.asDict())\n+\t\t\t\tCreateAlgorithm(key, value);\n+\t} else {\n+\t\tLOG(RPiController, Fatal)\n+\t\t\t<< \"Unrecognised version \" << version\n+\t\t\t<< \" for the tuning file \" << filename;\n \t}\n }\n \n-Algorithm *Controller::CreateAlgorithm(char const *name)\n+void Controller::CreateAlgorithm(const std::string &name, const YamlObject ¶ms)\n {\n-\tauto it = GetAlgorithms().find(std::string(name));\n-\treturn it != GetAlgorithms().end() ? (*it->second)(this) : nullptr;\n+\tauto it = GetAlgorithms().find(name);\n+\tif (it == GetAlgorithms().end()) {\n+\t\tLOG(RPiController, Warning)\n+\t\t\t<< \"No algorithm found for \\\"\" << name << \"\\\"\";\n+\t\treturn;\n+\t}\n+\tAlgorithm *algo = (*it->second)(this);\n+\talgo->Read(params);\n+\talgorithms_.push_back(AlgorithmPtr(algo));\n }\n \n void Controller::Initialise()\ndiff --git a/src/ipa/raspberrypi/controller/controller.hpp b/src/ipa/raspberrypi/controller/controller.hpp\nindex 3b50ae770d11..9091deac5feb 100644\n--- a/src/ipa/raspberrypi/controller/controller.hpp\n+++ b/src/ipa/raspberrypi/controller/controller.hpp\n@@ -15,6 +15,8 @@\n \n #include <linux/bcm2835-isp.h>\n \n+#include \"libcamera/internal/yaml_parser.h\"\n+\n #include \"camera_mode.h\"\n #include \"device_status.h\"\n #include \"metadata.hpp\"\n@@ -36,7 +38,6 @@ public:\n \tController();\n \tController(char const *json_filename);\n \t~Controller();\n-\tAlgorithm *CreateAlgorithm(char const *name);\n \tvoid Read(char const *filename);\n \tvoid Initialise();\n \tvoid SwitchMode(CameraMode const &camera_mode, Metadata *metadata);\n@@ -46,6 +47,7 @@ public:\n \tAlgorithm *GetAlgorithm(std::string const &name) const;\n \n protected:\n+\tvoid CreateAlgorithm(const std::string &name, const libcamera::YamlObject ¶ms);\n \tMetadata global_metadata_;\n \tstd::vector<AlgorithmPtr> algorithms_;\n \tbool switch_mode_called_;\n", "prefixes": [ "libcamera-devel", "v6", "5/8" ] }