Patch Detail
Show a patch.
GET /api/1.1/patches/16821/?format=api
{ "id": 16821, "url": "https://patchwork.libcamera.org/api/1.1/patches/16821/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16821/", "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": "<20220727023816.30008-10-laurent.pinchart@ideasonboard.com>", "date": "2022-07-27T02:38:11", "name": "[libcamera-devel,v7,09/14] ipa: raspberrypi: Introduce version 2.0 format for the camera tuning file", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "c3a4d262b9ac30bde7acb6d2a14dc93cf3121074", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/16821/mbox/", "series": [ { "id": 3331, "url": "https://patchwork.libcamera.org/api/1.1/series/3331/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3331", "date": "2022-07-27T02:38:02", "name": "Replace boost JSON parser with libyaml in Raspberry Pi IPA", "version": 7, "mbox": "https://patchwork.libcamera.org/series/3331/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16821/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16821/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 A1740BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 27 Jul 2022 02:38:33 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4679863332;\n\tWed, 27 Jul 2022 04:38:33 +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 AD7DE6332A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Jul 2022 04:38:28 +0200 (CEST)", "from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4906556D;\n\tWed, 27 Jul 2022 04:38:28 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658889513;\n\tbh=exBJxnmOkPEWyGAfhnAEwP7yPxQEFUXRoFHvScU0fVU=;\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=3hiY3+nEhKH7xUPxHuC10cXShcolw3NHRXD9TOjqiBUGiqdu/gpbEDDY/lucw55B8\n\tC6iHBsCpTH7zNyD0W1ky3MoEJ92ecUfsUj6/LfXPklTeal1zjLxT3TP9Dr3188wcID\n\tE52uYiP5lWLFrnv8njd63bVLnI14cCVDelwakAONWRiV4IUm8bYQJLZb9YtM4YXSPK\n\tM9Uo7DVO3p8uj0XtUO7JrFmYbnVxT+AmvOZJyTeKjfz6W6/Ju9L8P68w/nJfpyCgEv\n\t2b9NVIxtAuPLCXEDyPqNN79eU+kskCfCFYIA55jfSdniK5jV5U2KqChDdFWgcjyCfr\n\tuOs3duNzpIs6w==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1658889508;\n\tbh=exBJxnmOkPEWyGAfhnAEwP7yPxQEFUXRoFHvScU0fVU=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=oCX05xwgIs/cRkF0bs5eng9i6ZuLbV3PxMv2V92TwJunI5huWYODY6Q8wb9hqOcWw\n\tzebzfEEUUs1WjkUzR2BYnRAWjUucIF/6A3htv/8DhyFQfn067xVYAPWeXNTUntg/dp\n\t09MH/+JJK7bER4ZAUpgCRLxHf9LJGrg66UHYudW4=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"oCX05xwg\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 27 Jul 2022 05:38:11 +0300", "Message-Id": "<20220727023816.30008-10-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.35.1", "In-Reply-To": "<20220727023816.30008-1-laurent.pinchart@ideasonboard.com>", "References": "<20220727023816.30008-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v7 09/14] 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": "Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "From: Naushir Patuck <naush@raspberrypi.com>\n\nThe 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>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/ipa/raspberrypi/controller/controller.cpp | 54 +++++++++++++++----\n src/ipa/raspberrypi/controller/controller.h | 5 +-\n 2 files changed, 47 insertions(+), 12 deletions(-)", "diff": "diff --git a/src/ipa/raspberrypi/controller/controller.cpp b/src/ipa/raspberrypi/controller/controller.cpp\nindex bceb62540dbd..bbd382bce3ab 100644\n--- a/src/ipa/raspberrypi/controller/controller.cpp\n+++ b/src/ipa/raspberrypi/controller/controller.cpp\n@@ -44,26 +44,58 @@ int Controller::read(char const *filename)\n \t}\n \n \tstd::unique_ptr<YamlObject> root = YamlParser::parse(file);\n+\tdouble version = (*root)[\"version\"].get<double>(1.0);\n \n-\tfor (auto const &[key, value] : root->asDict()) {\n-\t\tAlgorithm *algo = createAlgorithm(key.c_str());\n-\t\tif (algo) {\n-\t\t\tint ret = algo->read(value);\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+\n+\t\tfor (auto const &[key, value] : root->asDict()) {\n+\t\t\tint ret = createAlgorithm(key, value);\n \t\t\tif (ret)\n \t\t\t\treturn ret;\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+\t\t}\n+\t} else if (version < 3.0) {\n+\t\tif (!root->contains(\"algorithms\")) {\n+\t\t\tLOG(RPiController, Error)\n+\t\t\t\t<< \"Tuning file \" << filename\n+\t\t\t\t<< \" does not have an \\\"algorithms\\\" list!\";\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tfor (auto const &rootAlgo : (*root)[\"algorithms\"].asList())\n+\t\t\tfor (auto const &[key, value] : rootAlgo.asDict()) {\n+\t\t\t\tint ret = createAlgorithm(key, value);\n+\t\t\t\tif (ret)\n+\t\t\t\t\treturn ret;\n+\t\t\t}\n+\t} else {\n+\t\tLOG(RPiController, Error)\n+\t\t\t<< \"Unrecognised version \" << version\n+\t\t\t<< \" for the tuning file \" << filename;\n+\t\treturn -EINVAL;\n \t}\n \n \treturn 0;\n }\n \n-Algorithm *Controller::createAlgorithm(char const *name)\n+int 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 0;\n+\t}\n+\n+\tAlgorithm *algo = (*it->second)(this);\n+\tint ret = algo->read(params);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\talgorithms_.push_back(AlgorithmPtr(algo));\n+\treturn 0;\n }\n \n void Controller::initialise()\ndiff --git a/src/ipa/raspberrypi/controller/controller.h b/src/ipa/raspberrypi/controller/controller.h\nindex 841783bb7a5c..6be1e3cfa156 100644\n--- a/src/ipa/raspberrypi/controller/controller.h\n+++ b/src/ipa/raspberrypi/controller/controller.h\n@@ -17,6 +17,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.h\"\n@@ -40,7 +42,6 @@ public:\n \tController();\n \tController(char const *jsonFilename);\n \t~Controller();\n-\tAlgorithm *createAlgorithm(char const *name);\n \tint read(char const *filename);\n \tvoid initialise();\n \tvoid switchMode(CameraMode const &cameraMode, Metadata *metadata);\n@@ -50,6 +51,8 @@ public:\n \tAlgorithm *getAlgorithm(std::string const &name) const;\n \n protected:\n+\tint createAlgorithm(const std::string &name, const libcamera::YamlObject ¶ms);\n+\n \tMetadata globalMetadata_;\n \tstd::vector<AlgorithmPtr> algorithms_;\n \tbool switchModeCalled_;\n", "prefixes": [ "libcamera-devel", "v7", "09/14" ] }