{"id":23560,"url":"https://patchwork.libcamera.org/api/patches/23560/?format=json","web_url":"https://patchwork.libcamera.org/patch/23560/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20250613100947.589875-5-stefan.klug@ideasonboard.com>","date":"2025-06-13T10:09:39","name":"[v2,4/4] libipa: pwl: Fix single point Pwl","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"c8ef71cba309e3692ea7bca811dc7bca992c56e6","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/?format=json","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/23560/mbox/","series":[{"id":5217,"url":"https://patchwork.libcamera.org/api/series/5217/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5217","date":"2025-06-13T10:09:35","name":"ipa: pwl: Fixes for single point PWLs","version":2,"mbox":"https://patchwork.libcamera.org/series/5217/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/23560/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/23560/checks/","tags":{},"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 5B980BDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 13 Jun 2025 10:10:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 16BB968DC3;\n\tFri, 13 Jun 2025 12:10:19 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E081968DBD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 13 Jun 2025 12:10:15 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:37bc:6352:9b26:2f94])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 8C40416C5; \n\tFri, 13 Jun 2025 12:10:06 +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=\"BchVZ5Ls\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1749809406;\n\tbh=I2A0lR6CeaffCi2hrOyhn/4aS2n5HD5H4EIKhhY3lEU=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=BchVZ5LsF+4+pNTtRQRLFQoBvx3jH+7i8LvYQKm+NqzxHA3U/UAyVJm2hq1v0dvHg\n\tDkFQLLG5Izxtz6wSyRn8HzFWfgqw3LdoycZw4Q/+YjtermYiAHdtbSoDyv9QTw1okN\n\tccZAUHmj/xzng3NFBN8ZhTQliVuZ6EWVRt8Ort8U=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","Subject":"[PATCH v2 4/4] libipa: pwl: Fix single point Pwl","Date":"Fri, 13 Jun 2025 12:09:39 +0200","Message-ID":"<20250613100947.589875-5-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","Content-Transfer-Encoding":"8bit","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>"},"content":"Fix the eval() function for Pwls that contain only a single point.\nRemove the shouldi_fail from the corresponding test case.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n src/ipa/libipa/pwl.cpp      | 4 ++++\n test/ipa/libipa/meson.build | 2 +-\n 2 files changed, 5 insertions(+), 1 deletion(-)","diff":"diff --git a/src/ipa/libipa/pwl.cpp b/src/ipa/libipa/pwl.cpp\nindex 3d2188170d83..69a9334112e8 100644\n--- a/src/ipa/libipa/pwl.cpp\n+++ b/src/ipa/libipa/pwl.cpp\n@@ -210,6 +210,10 @@ double Pwl::eval(double x, int *span, bool updateSpan) const\n \t\t\t\t\t: points_.size() / 2 - 1);\n \tif (span && updateSpan)\n \t\t*span = index;\n+\n+\tif (points_.size() == 1)\n+\t\treturn points_[0].y();\n+\n \treturn points_[index].y() +\n \t       (x - points_[index].x()) * (points_[index + 1].y() - points_[index].y()) /\n \t\t       (points_[index + 1].x() - points_[index].x());\ndiff --git a/test/ipa/libipa/meson.build b/test/ipa/libipa/meson.build\nindex c553366a7934..2070bed70222 100644\n--- a/test/ipa/libipa/meson.build\n+++ b/test/ipa/libipa/meson.build\n@@ -4,7 +4,7 @@ libipa_test = [\n     {'name': 'fixedpoint', 'sources': ['fixedpoint.cpp']},\n     {'name': 'histogram', 'sources': ['histogram.cpp']},\n     {'name': 'interpolator', 'sources': ['interpolator.cpp']},\n-    {'name': 'pwl', 'sources': ['pwl.cpp'], 'should_fail': true },\n+    {'name': 'pwl', 'sources': ['pwl.cpp'] },\n ]\n \n foreach test : libipa_test\n","prefixes":["v2","4/4"]}