From patchwork Fri Jun 13 10:09:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 23558 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 83C4BBDE6B for ; Fri, 13 Jun 2025 10:10:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C5E0468DC4; Fri, 13 Jun 2025 12:10:11 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="SY58bHMD"; 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 CC3FE68DBD for ; Fri, 13 Jun 2025 12:10:08 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:37bc:6352:9b26:2f94]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 741DC56D; Fri, 13 Jun 2025 12:09:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1749809399; bh=5DiqzN8HEsFS9cHqGWYTO0rnQSzdPwpkQLvhfXtqJog=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SY58bHMDsMPV5tyQIMUJ9BA4H2XfWmtVzX03NuiBpL1411kNjTH41XzDBgjRDvH0e LrNV2QTCgE/v+zLJp8/vQ/YEYlBiqCkfE6r3IUKaAojtKWY/vMOcaL5SyCpJIot+JE 0h2p5PmRSd2g9ijwGdnSlIe7SMrwWxQbsGIk5czY= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v2 2/4] libipa: pwl: Improve documentation Date: Fri, 13 Jun 2025 12:09:37 +0200 Message-ID: <20250613100947.589875-3-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250613100947.589875-1-stefan.klug@ideasonboard.com> References: <20250613100947.589875-1-stefan.klug@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" If a Pwl is evaluated outside of the domain, it gets extrapolated linearly. Fix the documentation as it states otherwise. Signed-off-by: Stefan Klug --- src/ipa/libipa/pwl.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/ipa/libipa/pwl.cpp b/src/ipa/libipa/pwl.cpp index 3fa005ba92df..3d2188170d83 100644 --- a/src/ipa/libipa/pwl.cpp +++ b/src/ipa/libipa/pwl.cpp @@ -35,14 +35,13 @@ namespace ipa { * * https://en.wikipedia.org/wiki/Piecewise_linear_function * - * A consequence of the Pwl class being defined by knots instead of linear - * functions is that the values of the piecewise linear function past the ends - * of the function are constants as opposed to linear functions. In a - * mathematical piecewise linear function that is defined by multiple linear - * functions, the ends of the function are also linear functions and hence grow - * to infinity (or negative infinity). However, since this Pwl class is defined - * by knots, the y-value of the leftmost and rightmost knots will hold for all - * x values to negative infinity and positive infinity, respectively. + * Outside the domain of the piecewise linear function the closest segment is + * extrapolated linearly. If one wants to ensure that the returned values stay + * within the range of the pwl, the input can be clamped: + * + * \code{.cpp} + * pwl.eval(pwl.domain().clip(x)) + * \endcode */ /**