From patchwork Thu Jun 13 01:39:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 20278 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 6B677C3293 for ; Thu, 13 Jun 2024 01:40:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7FBC7654A5; Thu, 13 Jun 2024 03:40:18 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="OSzwPOD+"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id F115665497 for ; Thu, 13 Jun 2024 03:40:12 +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 24E03D77; Thu, 13 Jun 2024 03:39:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1718242799; bh=QfP+IXVNd5SDkUNs2zUuuWEjVVHYBLjTTkKgFe1q5Ug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OSzwPOD+M2boEMMlzGeHXoogFJmvF1igeacimHjve1cqZ83m+121LSlEqFzb9I67Q M8U6dXH+R7CDUnW5ywuPC5uXpstQ5hsxHN+hn/4NIMOn2rUcTMRcB6cCRe91Yvdlf0 dXxAn4/rZ5IkQ/wDgaKjXZOk8uMcIwUbKTUC+998= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Cc: Paul Elder , David Plowman , Naushir Patuck Subject: [PATCH 06/11] ipa: libipa: pwl: Make the empty() function inline Date: Thu, 13 Jun 2024 04:39:39 +0300 Message-ID: <20240613013944.23344-7-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::empty() function is a one-liner that can be easily optimized by the compiler given the chance. Make it inline. While at it, move the function documentation block to match the class declaration order. Signed-off-by: Laurent Pinchart Reviewed-by: Paul Elder Reviewed-by: Kieran Bingham --- src/ipa/libipa/pwl.cpp | 15 ++++++--------- src/ipa/libipa/pwl.h | 2 +- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/ipa/libipa/pwl.cpp b/src/ipa/libipa/pwl.cpp index 1ba0108515a1..d8ea92be0a86 100644 --- a/src/ipa/libipa/pwl.cpp +++ b/src/ipa/libipa/pwl.cpp @@ -182,6 +182,12 @@ void Pwl::prepend(double x, double y, const double eps) points_.insert(points_.begin(), Point({ x, y })); } +/** + * \fn Pwl::empty() const + * \brief Check if the piecewise linear function is empty + * \return True if there are no points in the function, false otherwise + */ + /** * \brief Get the domain of the piecewise linear function * \return An interval representing the domain @@ -203,15 +209,6 @@ Pwl::Interval Pwl::range() const return Interval(lo, hi); } -/** - * \brief Check if the piecewise linear function is empty - * \return True if there are no points in the function, false otherwise - */ -bool Pwl::empty() const -{ - return points_.empty(); -} - /** * \brief Evaluate the piecewise linear function * \param[in] x The x value to input into the function diff --git a/src/ipa/libipa/pwl.h b/src/ipa/libipa/pwl.h index 4cc257f97b19..b4de00cf88f0 100644 --- a/src/ipa/libipa/pwl.h +++ b/src/ipa/libipa/pwl.h @@ -51,7 +51,7 @@ public: void append(double x, double y, double eps = 1e-6); - bool empty() const; + bool empty() const { return points_.empty(); } Interval domain() const; Interval range() const;