{"id":26110,"url":"https://patchwork.libcamera.org/api/patches/26110/?format=json","web_url":"https://patchwork.libcamera.org/patch/26110/","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":"<20260209112818.854064-1-stefan.klug@ideasonboard.com>","date":"2026-02-09T11:28:14","name":"libcamera: dw100_vertexmap: Fix dewarp parameter p2 handling","commit_ref":"1dcf9957a47fb54fce4fbae9daec0b587e52562e","pull_url":null,"state":"accepted","archived":false,"hash":"3d27db14e27488a8116fa0e677695d13cbbff07b","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/26110/mbox/","series":[{"id":5779,"url":"https://patchwork.libcamera.org/api/series/5779/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5779","date":"2026-02-09T11:28:14","name":"libcamera: dw100_vertexmap: Fix dewarp parameter p2 handling","version":1,"mbox":"https://patchwork.libcamera.org/series/5779/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/26110/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/26110/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 4FE4CBD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  9 Feb 2026 11:28:25 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6AE58620E7;\n\tMon,  9 Feb 2026 12:28:24 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8363A620CB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  9 Feb 2026 12:28:22 +0100 (CET)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:39aa:ef0c:a929:b3d8])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id A181A454;\n\tMon,  9 Feb 2026 12:27:36 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"lkRYcvBK\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1770636456;\n\tbh=rorbU4PqTNk3cf9t43h2kdF9CsM54yexUTijKvnpCyQ=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=lkRYcvBKcKl8XJKsuzuC/sSWgdJ5NS/GxD39DjiAtVAk8mHm4CI62PgjM7jjV9CvH\n\t3lJ7U2m6q0swINsNkqb6uA+mVVY6mqx6cSi7ImZ8aZ9kyXsFxdyEpfO2kdIBi7asBw\n\tzD6ijJgZX5blfDm1sfrQcVQJeahLRwY1N7rj1Bsg=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","Subject":"[PATCH] libcamera: dw100_vertexmap: Fix dewarp parameter p2 handling","Date":"Mon,  9 Feb 2026 12:28:14 +0100","Message-ID":"<20260209112818.854064-1-stefan.klug@ideasonboard.com>","X-Mailer":"git-send-email 2.51.0","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":"The lens dewarp implementation done in commit 1784e08be3a6 (\"libcamera:\ndw100_vertexmap: Implement parametric dewarping\") handles the dewarp\nparameter p2 incorrectly because it uses the already dewarped x value as\ninput for the calculation of the y value. Fix that by using separate\nvariables for the output value. Do so for x and y to keep the code\nsymmetric even if it is only strictly required for y.\n\nFixes: 1784e08be3a6 (\"libcamera: dw100_vertexmap: Implement parametric dewarping\")\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n src/libcamera/converter/converter_dw100_vertexmap.cpp | 9 +++++----\n 1 file changed, 5 insertions(+), 4 deletions(-)","diff":"diff --git a/src/libcamera/converter/converter_dw100_vertexmap.cpp b/src/libcamera/converter/converter_dw100_vertexmap.cpp\nindex 2cdfe9767a9f..6e238736c435 100644\n--- a/src/libcamera/converter/converter_dw100_vertexmap.cpp\n+++ b/src/libcamera/converter/converter_dw100_vertexmap.cpp\n@@ -628,6 +628,7 @@ int Dw100VertexMap::setDewarpParams(const Matrix<double, 3, 3> &cm,\n Vector2d Dw100VertexMap::dewarpPoint(const Vector2d &p)\n {\n \tdouble x, y;\n+\tdouble xout, yout;\n \tdouble k1 = dewarpCoeffs_[0];\n \tdouble k2 = dewarpCoeffs_[1];\n \tdouble p1 = dewarpCoeffs_[2];\n@@ -647,11 +648,11 @@ Vector2d Dw100VertexMap::dewarpPoint(const Vector2d &p)\n \tdouble r2 = x * x + y * y;\n \tdouble d = (1 + k1 * r2 + k2 * r2 * r2 + k3 * r2 * r2 * r2) /\n \t\t   (1 + k4 * r2 + k5 * r2 * r2 + k6 * r2 * r2 * r2);\n-\tx = x * d + 2 * p1 * x * y + p2 * (r2 + 2 * x * x) + s1 * r2 + s2 * r2 * r2;\n-\ty = y * d + 2 * p2 * x * y + p1 * (r2 + 2 * y * y) + s3 * r2 + s4 * r2 * r2;\n+\txout = x * d + 2 * p1 * x * y + p2 * (r2 + 2 * x * x) + s1 * r2 + s2 * r2 * r2;\n+\tyout = y * d + 2 * p2 * x * y + p1 * (r2 + 2 * y * y) + s3 * r2 + s4 * r2 * r2;\n \n-\treturn { { x * dewarpM_[0][0] + y * dewarpM_[0][1] + dewarpM_[0][2],\n-\t\t   y * dewarpM_[1][1] + dewarpM_[1][2] } };\n+\treturn { { xout * dewarpM_[0][0] + yout * dewarpM_[0][1] + dewarpM_[0][2],\n+\t\t   yout * dewarpM_[1][1] + dewarpM_[1][2] } };\n }\n \n } /* namespace libcamera */\n","prefixes":[]}