From patchwork Thu Jun 13 01:39:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 20279 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 A2DDAC3237 for ; Thu, 13 Jun 2024 01:40:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5841865493; Thu, 13 Jun 2024 03:40:29 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="QyALSLOf"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 385D36548E for ; Thu, 13 Jun 2024 03:40:14 +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 7242914F6; Thu, 13 Jun 2024 03:40:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1718242800; bh=+2Ie6SuSVmwT98UJPkmaaxNiaK0n36IBUW/S7guOaR0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QyALSLOff8/dTxBUJNkSSFz2nHNH6/kxH5cJtgjzoQWIZdfGk9W9n1ijGXnQku0V4 nxjWJg7dqifnAshxfJ00MQ1kdLWs5YPYJ3e0UKmSzCfaeMTpwgs3J+GCUMKmAF8oK7 7M6+RtNVWTKtta9+yju4BK+59oYyXAvQC48bShMs= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Cc: Paul Elder , David Plowman , Naushir Patuck Subject: [PATCH 07/11] ipa: libipa: pwl: Add a size() function Date: Thu, 13 Jun 2024 04:39:40 +0300 Message-ID: <20240613013944.23344-8-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" Add a size() function to the Pwl class to return the number of points in the piecewise linear function. This is useful, for instance, to validate that all points added with append() or prepend() have been taken into account. Signed-off-by: Laurent Pinchart Reviewed-by: Paul Elder Reviewed-by: Kieran Bingham --- src/ipa/libipa/pwl.cpp | 6 ++++++ src/ipa/libipa/pwl.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/ipa/libipa/pwl.cpp b/src/ipa/libipa/pwl.cpp index d8ea92be0a86..8b437dd1a650 100644 --- a/src/ipa/libipa/pwl.cpp +++ b/src/ipa/libipa/pwl.cpp @@ -188,6 +188,12 @@ void Pwl::prepend(double x, double y, const double eps) * \return True if there are no points in the function, false otherwise */ +/** + * \fn Pwl::size() const + * \brief Retrieve the number of points in the piecewise linear function + * \return The number of points in the piecewise linear function + */ + /** * \brief Get the domain of the piecewise linear function * \return An interval representing the domain diff --git a/src/ipa/libipa/pwl.h b/src/ipa/libipa/pwl.h index b4de00cf88f0..028342314fca 100644 --- a/src/ipa/libipa/pwl.h +++ b/src/ipa/libipa/pwl.h @@ -52,6 +52,8 @@ public: void append(double x, double y, double eps = 1e-6); bool empty() const { return points_.empty(); } + size_t size() const { return points_.size(); } + Interval domain() const; Interval range() const;