Patch Detail
Show a patch.
GET /api/1.1/patches/16615/?format=api
{ "id": 16615, "url": "https://patchwork.libcamera.org/api/1.1/patches/16615/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16615/", "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": "<20220713092159.9014-6-naush@raspberrypi.com>", "date": "2022-07-13T09:21:56", "name": "[libcamera-devel,v4,5/8] ipa: raspberrypi: Introduce version 2.0 format for the camera tuning file", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "a1f532edd2b0caa5a9b5b723f831e2b67fd21fec", "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/16615/mbox/", "series": [ { "id": 3277, "url": "https://patchwork.libcamera.org/api/1.1/series/3277/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3277", "date": "2022-07-13T09:21:51", "name": "Replace boost JSON parser with libyaml in Raspberry Pi IPA", "version": 4, "mbox": "https://patchwork.libcamera.org/series/3277/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16615/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16615/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 73EF9BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 13 Jul 2022 09:22:25 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1265163319;\n\tWed, 13 Jul 2022 11:22:25 +0200 (CEST)", "from mail-wr1-x432.google.com (mail-wr1-x432.google.com\n\t[IPv6:2a00:1450:4864:20::432])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D81C763311\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Jul 2022 11:22:18 +0200 (CEST)", "by mail-wr1-x432.google.com with SMTP id q9so14612937wrd.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Jul 2022 02:22:18 -0700 (PDT)", "from naush-laptop.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tbd20-20020a05600c1f1400b0039747cf8354sm1514778wmb.39.2022.07.13.02.22.17\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 13 Jul 2022 02:22:17 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1657704145;\n\tbh=YI7BM4sT/ZSFYVkbfWj4074LOQTRgQCuu4wZilU/Vws=;\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=2oazOmlKhjTmIzgvjGnG/4Mz4TZjjIj+V0qToneuiysrxBBsiLV3i1cpGESh15tpP\n\t0Z4RzhuFSyB92op+tGDz7Zudimi0UcpbUG3Kf+cvQEkLnzNC5zSI4PD3PrQ2lP52Ys\n\tqdTiN3KaH9FF8qzBazcIscsR/ZcOsc+Xrhwkj6BAfQ3VQ2AU2CGuMkByXd6Rf9XALT\n\tnec29gqPlUAbgLYnyIVhI+ajyZIJsmEs5Wa2/1KTMPsyIN3Z/cV/Ird70KuiD+A39r\n\tdex+temIqFlLBatL5doPLp5Rk8KqO+F5HCQVDJlNfPSlsT9ZTgy5HJD68bo2GnyanU\n\tGp6C8rK8CgL2A==", "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=zF0UqHd97naQVI/PN/cm7tNAF00UwIi5w7xlYtIKTk8=;\n\tb=BBtNQfRPXOcjBdS82psMt3g0mHQL8HXRYx0Q73Xuqk0P0oOkRAiAUErBCXXk5j7+P8\n\tTPDCRb6o1fxnOG9gyyUcNQ/0zvXeAPfObtr36FD3x0K2w4uHolIO5nIClEEbPBQJoydF\n\t2SD1CmovstXCU91VT3rXVFdqKimsgHreMqiPX3FNASkZ6jBVAF/w/WB510ctZ23seNRK\n\tXDTUSAB5WgeWvMmduSy0vwVcvYnjEYKqay+ScGX0mqxUOLlOv6X6j5KKZEqECwnKu+pb\n\tTZ/44LVLQzucY7Qpasikgrgn3sLzXmPGJJVxpBceOK2BvcZb6abBguP8jedAdcwIWjHF\n\tMgLg==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"BBtNQfRP\"; 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=zF0UqHd97naQVI/PN/cm7tNAF00UwIi5w7xlYtIKTk8=;\n\tb=y/PEsfeDiUOg7J1J5nz6TZmEAPX26Ar2O439BZILHMiE6xj0OSjSGJP6sqIF0VN8HR\n\tBcpJRO/4GcNuCxdjzs01J8FtrPBHbYZMQ5HBPu+n+O7GsbepaBuNkZ+WfTwxmu0Mt8/F\n\tTZJe9ts89AQMtOhroCEGtOP1plBJDmKWYf5jYDPov+Sj1kHHlObqBLoh9XOYaVM/395E\n\tt1l7PqXs5xcK0jMrNJS94PQ/DmhbtdhU4X2EDolfNwp0L2enDmJ/sbCuzj75UN+/QHrN\n\tlkzru345E4Uh04W1GOksdWkeAlxG2vcGTU2tekVse8mDLTj2roJoS8mD8NMAN1KofmX2\n\tdg9A==", "X-Gm-Message-State": "AJIora8SGD7n6GjN4q6J5lCUqualVf3GBUqMjEu+UIegNfh7kURRyg9n\n\tEqCsadjBmw26FpRZuRYBzuG6rlDflznzSQ==", "X-Google-Smtp-Source": "AGRyM1v00rdmB1R4U9gNjwKETxhK6KYveZDwmYawigIaM890g5CTyfPn7kmmICuLfBSC0qhBN21W6g==", "X-Received": "by 2002:a5d:6b4b:0:b0:21d:7854:7755 with SMTP id\n\tx11-20020a5d6b4b000000b0021d78547755mr2251873wrw.437.1657704138303; \n\tWed, 13 Jul 2022 02:22:18 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 13 Jul 2022 10:21:56 +0100", "Message-Id": "<20220713092159.9014-6-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20220713092159.9014-1-naush@raspberrypi.com>", "References": "<20220713092159.9014-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v4 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 listied in the JSON structure. The JSON\nspecification does not mandate any such ordering, but the Boost JSON parser\nwould maintain this 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. Additionally, a \"version\" node is added\nto distinguish between the version 1.0 and 2.0 formats. The absence of the\n\"version\" node implies version 1.0.\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 | 42 +++++++++++++------\n src/ipa/raspberrypi/controller/controller.hpp | 4 +-\n 2 files changed, 33 insertions(+), 13 deletions(-)", "diff": "diff --git a/src/ipa/raspberrypi/controller/controller.cpp b/src/ipa/raspberrypi/controller/controller.cpp\nindex 67d650ef0c1b..9a2a3fb01793 100644\n--- a/src/ipa/raspberrypi/controller/controller.cpp\n+++ b/src/ipa/raspberrypi/controller/controller.cpp\n@@ -42,22 +42,40 @@ 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\tif (!key.compare(\"version\"))\n+\t\t\t\tcontinue;\n+\t\t\tCreateAlgorithm(key, value);\n+\t\t}\n+\t} else {\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}\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", "v4", "5/8" ] }