[{"id":29889,"web_url":"https://patchwork.libcamera.org/comment/29889/","msgid":"<Zmql-9c3YEf5HkWQ@pyrite.rasen.tech>","date":"2024-06-13T07:55:39","subject":"Re: [PATCH 08/11] ipa: libipa: pwl: Add a constructor that moves a\n\tPoint vector","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"On Thu, Jun 13, 2024 at 04:39:41AM +0300, Laurent Pinchart wrote:\n> The Pwl::Pwl(const std::vector<Point> &) constructor is inefficient as\n> it makes a copy of the given points vector. Add a second constructor\n> that takes an rvalue reference to a points vector to provide move\n> semantics.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  src/ipa/libipa/pwl.cpp | 11 +++++++++++\n>  src/ipa/libipa/pwl.h   |  2 ++\n>  2 files changed, 13 insertions(+)\n> \n> diff --git a/src/ipa/libipa/pwl.cpp b/src/ipa/libipa/pwl.cpp\n> index 8b437dd1a650..cf864fbb3889 100644\n> --- a/src/ipa/libipa/pwl.cpp\n> +++ b/src/ipa/libipa/pwl.cpp\n> @@ -114,6 +114,17 @@ Pwl::Pwl(const std::vector<Point> &points)\n>  {\n>  }\n>  \n> +/**\n> + * \\copydoc Pwl::Pwl(const std::vector<Point> &points)\n> + *\n> + * The contents of the \\a points vector is moved to the newly constructed Pwl\n> + * instance.\n> + */\n> +Pwl::Pwl(std::vector<Point> &&points)\n> +\t: points_(std::move(points))\n> +{\n> +}\n> +\n>  /**\n>   * \\brief Populate the piecewise linear function from yaml data\n>   * \\param[in] params Yaml data to populate the piecewise linear function with\n> diff --git a/src/ipa/libipa/pwl.h b/src/ipa/libipa/pwl.h\n> index 028342314fca..8edb4d33dc71 100644\n> --- a/src/ipa/libipa/pwl.h\n> +++ b/src/ipa/libipa/pwl.h\n> @@ -47,6 +47,8 @@ public:\n>  \n>  \tPwl();\n>  \tPwl(const std::vector<Point> &points);\n> +\tPwl(std::vector<Point> &&points);\n> +\n>  \tint readYaml(const libcamera::YamlObject &params);\n>  \n>  \tvoid append(double x, double y, double eps = 1e-6);","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 D7452C3237\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 13 Jun 2024 07:55:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 102F86548B;\n\tThu, 13 Jun 2024 09:55:48 +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 1ED7A65458\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 13 Jun 2024 09:55:46 +0200 (CEST)","from pyrite.rasen.tech (h175-177-049-156.catv02.itscom.jp\n\t[175.177.49.156])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AA3C84CF;\n\tThu, 13 Jun 2024 09:55:30 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"nHnjO633\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1718265332;\n\tbh=bsUc49pZYVUin+qD/aBvoaHdAnk/Hdzq5wkPsuacg2w=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=nHnjO633+van4RxqDvWM9garVEExN223JN3FZwQ51rIWlTzjoO8xCWk8zQRP9uF+7\n\tsWwfbOBdy/V3j/ohD26CfmvmNQaYQtVwSxQk7Qm91MNjwDrocdEqRpeq09LUBbONHo\n\teFYQUG2G/zvw7Wx80rCFSQLEKY56TKm77Xej3z8k=","Date":"Thu, 13 Jun 2024 16:55:39 +0900","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tDavid Plowman <david.plowman@raspberrypi.com>,\n\tNaushir Patuck <naush@raspberrypi.com>","Subject":"Re: [PATCH 08/11] ipa: libipa: pwl: Add a constructor that moves a\n\tPoint vector","Message-ID":"<Zmql-9c3YEf5HkWQ@pyrite.rasen.tech>","References":"<20240613013944.23344-1-laurent.pinchart@ideasonboard.com>\n\t<20240613013944.23344-9-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20240613013944.23344-9-laurent.pinchart@ideasonboard.com>","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":29914,"web_url":"https://patchwork.libcamera.org/comment/29914/","msgid":"<171827744763.1550852.7909371160421336369@ping.linuxembedded.co.uk>","date":"2024-06-13T11:17:27","subject":"Re: [PATCH 08/11] ipa: libipa: pwl: Add a constructor that moves a\n\tPoint vector","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Laurent Pinchart (2024-06-13 02:39:41)\n> The Pwl::Pwl(const std::vector<Point> &) constructor is inefficient as\n> it makes a copy of the given points vector. Add a second constructor\n> that takes an rvalue reference to a points vector to provide move\n> semantics.\n> \n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  src/ipa/libipa/pwl.cpp | 11 +++++++++++\n>  src/ipa/libipa/pwl.h   |  2 ++\n>  2 files changed, 13 insertions(+)\n> \n> diff --git a/src/ipa/libipa/pwl.cpp b/src/ipa/libipa/pwl.cpp\n> index 8b437dd1a650..cf864fbb3889 100644\n> --- a/src/ipa/libipa/pwl.cpp\n> +++ b/src/ipa/libipa/pwl.cpp\n> @@ -114,6 +114,17 @@ Pwl::Pwl(const std::vector<Point> &points)\n>  {\n>  }\n>  \n> +/**\n> + * \\copydoc Pwl::Pwl(const std::vector<Point> &points)\n> + *\n> + * The contents of the \\a points vector is moved to the newly constructed Pwl\n> + * instance.\n> + */\n> +Pwl::Pwl(std::vector<Point> &&points)\n> +       : points_(std::move(points))\n> +{\n> +}\n> +\n>  /**\n>   * \\brief Populate the piecewise linear function from yaml data\n>   * \\param[in] params Yaml data to populate the piecewise linear function with\n> diff --git a/src/ipa/libipa/pwl.h b/src/ipa/libipa/pwl.h\n> index 028342314fca..8edb4d33dc71 100644\n> --- a/src/ipa/libipa/pwl.h\n> +++ b/src/ipa/libipa/pwl.h\n> @@ -47,6 +47,8 @@ public:\n>  \n>         Pwl();\n>         Pwl(const std::vector<Point> &points);\n> +       Pwl(std::vector<Point> &&points);\n> +\n>         int readYaml(const libcamera::YamlObject &params);\n>  \n>         void append(double x, double y, double eps = 1e-6);\n> -- \n> Regards,\n> \n> Laurent Pinchart\n>","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 94346C3237\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 13 Jun 2024 11:17:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 39B5F65496;\n\tThu, 13 Jun 2024 13:17:32 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C0B5165462\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 13 Jun 2024 13:17:30 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CC9F04AB;\n\tThu, 13 Jun 2024 13:17:16 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"LK7WXmhU\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1718277436;\n\tbh=rhtXvWe/9NJa8LpWxRZeIb+QHHN+lQZJyZO0eEKNIZo=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=LK7WXmhUiD0JqARHxU0pGeL94EGm48dSLj5pnPiyGs/nMkbRkx3d6ov3x+gI1t05K\n\tO7OoOM+qlApII5rBntVV5q399Xz77LDPd0JTQ3z46Sq/DOd5fbZ8DKSHYcEy9sZdh+\n\tUTb5wQ/obB/yYPFLbc5DYp/MSu7RmzIMKlbBWM4I=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20240613013944.23344-9-laurent.pinchart@ideasonboard.com>","References":"<20240613013944.23344-1-laurent.pinchart@ideasonboard.com>\n\t<20240613013944.23344-9-laurent.pinchart@ideasonboard.com>","Subject":"Re: [PATCH 08/11] ipa: libipa: pwl: Add a constructor that moves a\n\tPoint vector","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Paul Elder <paul.elder@ideasonboard.com>,\n\tDavid Plowman <david.plowman@raspberrypi.com>,\n\tNaushir Patuck <naush@raspberrypi.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Thu, 13 Jun 2024 12:17:27 +0100","Message-ID":"<171827744763.1550852.7909371160421336369@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]