{"id":16825,"url":"https://patchwork.libcamera.org/api/1.1/patches/16825/?format=json","web_url":"https://patchwork.libcamera.org/patch/16825/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","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-15-laurent.pinchart@ideasonboard.com>","date":"2022-07-27T02:38:16","name":"[libcamera-devel,v7,14/14] ipa: raspberrypi: agc: Use YamlObject::getList()","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"9317db80390f7be4ed1438841c732a1b8262d24e","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16825/mbox/","series":[{"id":3331,"url":"https://patchwork.libcamera.org/api/1.1/series/3331/?format=json","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/16825/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16825/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 17F70C3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 27 Jul 2022 02:38:39 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A30EB6333C;\n\tWed, 27 Jul 2022 04:38:38 +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 AF23163329\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Jul 2022 04:38:35 +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 47CAC56D;\n\tWed, 27 Jul 2022 04:38:35 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658889518;\n\tbh=l78zBW/LwB1XHylCSimYUBear1h4A4iOs0lqRZY8i80=;\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=Ydzxteb89tbxEPsII9IxztP6wU/aAlDkGxilzAHCat0I3+3fKY/qWaFO21ngNz/dt\n\tuV5qKDn23yeRTaD1cAlGrHDCz2m3fih6me8uZAs39grmpwwP1BdmTgt6Gs5NfjBSSp\n\tRUvt1qNVxXyMh7Msfnj2f8znq6ZHg+/QiNH4qc5SjCnjQFEfJRO5I2xB2Zp4QGGq/1\n\tfr5GPwu/2NB+xqnNrD9UFDoNEk2wTQ+VQ4DDr7BPwz5vc1KlmzhsozNioVAOY/iSJQ\n\t1jerXdUnvQ6y+qCzXjJW4a66QBNDZSW0ISMrYoYjnaF4HKtXL44FhFZnYc3yJ4tCMF\n\tzBBOu5q0hAb7w==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1658889515;\n\tbh=l78zBW/LwB1XHylCSimYUBear1h4A4iOs0lqRZY8i80=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=IN7T4mGDXst/UXBMCVeql5pJEQ4TskSP/W3OlM0qzegP3dMX+G5u2UcHeUv7Ycug9\n\tNryNrghEHnlcCh0ZIrg8SuhCe+06PphLiw6n1SmpbRV9mOyqQpeAJHY92hqXxh9Gdl\n\tjPmVzqCkLjl7T816j1ZSz3dbSKsoXMHTPyF+WXPI="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"IN7T4mGD\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 27 Jul 2022 05:38:16 +0300","Message-Id":"<20220727023816.30008-15-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 14/14] ipa: raspberrypi: agc: Use\n\tYamlObject::getList()","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":"Replace the manual implementation of the readList() functions with\nYamlObject::getList().\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/ipa/raspberrypi/controller/rpi/agc.cpp | 43 +++++++---------------\n 1 file changed, 13 insertions(+), 30 deletions(-)","diff":"diff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp b/src/ipa/raspberrypi/controller/rpi/agc.cpp\nindex 9fd339c6904e..b8eb5bc605a1 100644\n--- a/src/ipa/raspberrypi/controller/rpi/agc.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp\n@@ -5,6 +5,7 @@\n  * agc.cpp - AGC/AEC control algorithm\n  */\n \n+#include <algorithm>\n #include <map>\n #include <tuple>\n \n@@ -71,44 +72,26 @@ readMeteringModes(std::map<std::string, AgcMeteringMode> &metering_modes,\n \treturn { 0, first };\n }\n \n-static int readList(std::vector<double> &list,\n-\t\t    const libcamera::YamlObject &params)\n-{\n-\tfor (const auto &p : params.asList()) {\n-\t\tauto value = p.get<double>();\n-\t\tif (!value)\n-\t\t\treturn -EINVAL;\n-\t\tlist.push_back(*value);\n-\t}\n-\n-\treturn list.size();\n-}\n-\n-static int readList(std::vector<Duration> &list,\n-\t\t    const libcamera::YamlObject &params)\n-{\n-\tfor (const auto &p : params.asList()) {\n-\t\tauto value = p.get<double>();\n-\t\tif (!value)\n-\t\t\treturn -EINVAL;\n-\t\tlist.push_back(*value * 1us);\n-\t}\n-\n-\treturn list.size();\n-}\n-\n int AgcExposureMode::read(const libcamera::YamlObject &params)\n {\n-\tint numShutters = readList(shutter, params[\"shutter\"]);\n-\tint numAgs = readList(gain, params[\"gain\"]);\n+\tauto value = params[\"shutter\"].getList<double>();\n+\tif (!value)\n+\t\treturn -EINVAL;\n+\tstd::transform(value->begin(), value->end(), std::back_inserter(shutter),\n+\t\t       [](double v) { return v * 1us; });\n \n-\tif (numShutters < 2 || numAgs < 2) {\n+\tvalue = params[\"gain\"].getList<double>();\n+\tif (!value)\n+\t\treturn -EINVAL;\n+\tgain = std::move(*value);\n+\n+\tif (shutter.size() < 2 || gain.size() < 2) {\n \t\tLOG(RPiAgc, Error)\n \t\t\t<< \"AgcExposureMode: must have at least two entries in exposure profile\";\n \t\treturn -EINVAL;\n \t}\n \n-\tif (numShutters != numAgs) {\n+\tif (shutter.size() != gain.size()) {\n \t\tLOG(RPiAgc, Error)\n \t\t\t<< \"AgcExposureMode: expect same number of exposure and gain entries in exposure profile\";\n \t\treturn -EINVAL;\n","prefixes":["libcamera-devel","v7","14/14"]}