From patchwork Thu Jun 13 01:39:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 20280 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 80D02C3293 for ; Thu, 13 Jun 2024 01:40:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0305F6549D; Thu, 13 Jun 2024 03:40:30 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="quBFpeAC"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9110A6549D for ; Thu, 13 Jun 2024 03:40:15 +0200 (CEST) Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C4726D77; Thu, 13 Jun 2024 03:40:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1718242802; bh=sB1nvilvtB2BVEco4UCdHl1jKNcmGdGTbSSCICTpOwg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=quBFpeACenKSRA3Mi5VD9sfj3TKprIO6dAj8EP4RT741gBYE8AjehtkTGExFFCj8O DA/R84lPLiOh10nSrp454OqE2p8bkaTnY6tJ18wLTQHjEEudQjlD+OJh8XZK+8awSI tcfv3smnMmqAMhDsDZr2ihi6kJ6LRO8mD+j+PpHk= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Cc: Paul Elder , David Plowman , Naushir Patuck Subject: [PATCH 08/11] ipa: libipa: pwl: Add a constructor that moves a Point vector Date: Thu, 13 Jun 2024 04:39:41 +0300 Message-ID: <20240613013944.23344-9-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20240613013944.23344-1-laurent.pinchart@ideasonboard.com> References: <20240613013944.23344-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The Pwl::Pwl(const std::vector &) constructor is inefficient as it makes a copy of the given points vector. Add a second constructor that takes an rvalue reference to a points vector to provide move semantics. Signed-off-by: Laurent Pinchart Reviewed-by: Paul Elder Reviewed-by: Kieran Bingham --- src/ipa/libipa/pwl.cpp | 11 +++++++++++ src/ipa/libipa/pwl.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/src/ipa/libipa/pwl.cpp b/src/ipa/libipa/pwl.cpp index 8b437dd1a650..cf864fbb3889 100644 --- a/src/ipa/libipa/pwl.cpp +++ b/src/ipa/libipa/pwl.cpp @@ -114,6 +114,17 @@ Pwl::Pwl(const std::vector &points) { } +/** + * \copydoc Pwl::Pwl(const std::vector &points) + * + * The contents of the \a points vector is moved to the newly constructed Pwl + * instance. + */ +Pwl::Pwl(std::vector &&points) + : points_(std::move(points)) +{ +} + /** * \brief Populate the piecewise linear function from yaml data * \param[in] params Yaml data to populate the piecewise linear function with diff --git a/src/ipa/libipa/pwl.h b/src/ipa/libipa/pwl.h index 028342314fca..8edb4d33dc71 100644 --- a/src/ipa/libipa/pwl.h +++ b/src/ipa/libipa/pwl.h @@ -47,6 +47,8 @@ public: Pwl(); Pwl(const std::vector &points); + Pwl(std::vector &&points); + int readYaml(const libcamera::YamlObject ¶ms); void append(double x, double y, double eps = 1e-6);