{"id":25207,"url":"https://patchwork.libcamera.org/api/patches/25207/?format=json","web_url":"https://patchwork.libcamera.org/patch/25207/","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":"<20251125162851.2301793-29-stefan.klug@ideasonboard.com>","date":"2025-11-25T16:28:40","name":"[v3,28/29] DNI libcamera: rkisp1: Implement dw100 specific features","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"5a130587d55f5e8e4a49b3e97fee270c984c907c","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/25207/mbox/","series":[{"id":5613,"url":"https://patchwork.libcamera.org/api/series/5613/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5613","date":"2025-11-25T16:28:12","name":"Full dewarper support on imx8mp","version":3,"mbox":"https://patchwork.libcamera.org/series/5613/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/25207/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/25207/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 CD921C3338\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 25 Nov 2025 16:30:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 797B760C6B;\n\tTue, 25 Nov 2025 17:30:19 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3958A60A9E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 25 Nov 2025 17:30:18 +0100 (CET)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:bae1:340c:573c:570b])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 4C0DC20E6; \n\tTue, 25 Nov 2025 17:28:09 +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=\"a3onN/CS\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1764088089;\n\tbh=KaJ8SJFcJP01NIS+AmLdW5zLqpm8qBdeOgGbRh+56xY=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=a3onN/CSK42MgwlrPuxrC4Gjo2V81Gs1J3zrUmcP8jHxBX1A9ALsvAmhrRT+JemRy\n\tHqeHcIGSAbVgSLeK3r15ATa8xVC9RmFUDyi2W5HUM+t4EaW268IGZexR+Vv5KWADLK\n\teEzX2ENnkrVlPGrcBEua2tP3u/ONAuVxJYE672Kc=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","Subject":"[PATCH v3 28/29] DNI libcamera: rkisp1: Implement dw100 specific\n\tfeatures","Date":"Tue, 25 Nov 2025 17:28:40 +0100","Message-ID":"<20251125162851.2301793-29-stefan.klug@ideasonboard.com>","X-Mailer":"git-send-email 2.51.0","In-Reply-To":"<20251125162851.2301793-1-stefan.klug@ideasonboard.com>","References":"<20251125162851.2301793-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":"The dw100 allows more features implemented in the dw100 vertex map.\nImplement these features for the rkisp1 pipeline.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n\n---\n\nChanges in v3:\n- Move control handling from pipeline handler to the converter\n  class\n- Moved controls into core namespace\n\nChanges in v2:\n- Marked as DoNotIntegrate because the puplic interface needs further\n  discussions\n- Added Dw100EffectiveScale metadata\n---\n .../converter/converter_dw100_vertexmap.h     |  2 +-\n src/libcamera/control_ids_core.yaml           | 50 +++++++++++++++++++\n src/libcamera/converter/converter_dw100.cpp   | 36 +++++++++++++\n 3 files changed, 87 insertions(+), 1 deletion(-)","diff":"diff --git a/include/libcamera/internal/converter/converter_dw100_vertexmap.h b/include/libcamera/internal/converter/converter_dw100_vertexmap.h\nindex 49ecc81678a0..f79274a6098a 100644\n--- a/include/libcamera/internal/converter/converter_dw100_vertexmap.h\n+++ b/include/libcamera/internal/converter/converter_dw100_vertexmap.h\n@@ -42,7 +42,7 @@ public:\n \tconst Transform &transform() const { return transform_; }\n \n \tvoid setScale(const float scale) { scale_ = scale; }\n-\tfloat effectiveScale() const { return (effectiveScaleX_ + effectiveScaleY_) * 0.5; }\n+\tstd::array<float, 2> effectiveScale() const { return { static_cast<float>(effectiveScaleX_), static_cast<float>(effectiveScaleY_) }; }\n \n \tvoid setRotation(const float rotation) { rotation_ = rotation; }\n \tfloat rotation() const { return rotation_; }\ndiff --git a/src/libcamera/control_ids_core.yaml b/src/libcamera/control_ids_core.yaml\nindex 3bcb475fd102..e03b570282ba 100644\n--- a/src/libcamera/control_ids_core.yaml\n+++ b/src/libcamera/control_ids_core.yaml\n@@ -1353,4 +1353,54 @@ controls:\n         Enable or disable lens dewarping. This control is only available if lens\n         dewarp parameters are configured in the tuning file.\n \n+  - Dw100ScaleMode:\n+      type: int32_t\n+      direction: inout\n+      description: |\n+        Scale mode of the dewarper.\n+      enum:\n+        - name: Dw100ScaleModeFill\n+          value: 0\n+          description: |\n+            Fills the given output size with the largest rectangle possible.\n+            Aspect ratio is not preserved. Dw100Scale is ignored.\n+        - name: Dw100ScaleModeCrop\n+          value: 1\n+          description: |\n+            Crops to the given output size. The scale factor can be specified\n+            using Dw100Scale. Aspect ratio is preserved.\n+\n+  - Dw100Scale:\n+      type: float\n+      direction: inout\n+      description: |\n+        Scale factor applied to the image when Dw100ScaleMode is set to Crop.\n+        This value is clamped, so that all pixels have valid input data.\n+        Therefore a value of 0 always provides the largest possible field of\n+        view. Scaling happens centered around the center of the ScalerCrop +\n+        Dw10Offset.\n+\n+  - Dw100Rotation:\n+      type: float\n+      direction: inout\n+      description: |\n+        Rotates the image by the given angle in degrees in clockwise direction\n+        around the center of ScalerCrop + Dw100Offset\n+\n+  - Dw100Offset:\n+      type: Point\n+      direction: inout\n+      description: |\n+        Moves the image by the given values in x and y direction in sensor\n+        coordinate space. This is clamped, so that all output pixels contain\n+        valid data. The offset is therefore ignored when the Dw100Scale value is\n+        too small.\n+\n+  - Dw100EffectiveScale:\n+      type: float\n+      direction: out\n+      description: |\n+        Effective scale\n+      size: [2]\n+\n ...\ndiff --git a/src/libcamera/converter/converter_dw100.cpp b/src/libcamera/converter/converter_dw100.cpp\nindex 7adad1b502f0..b39e4ab23cd6 100644\n--- a/src/libcamera/converter/converter_dw100.cpp\n+++ b/src/libcamera/converter/converter_dw100.cpp\n@@ -346,6 +346,13 @@ void ConverterDW100Module::updateControlInfos(const Stream *stream, ControlInfoM\n \tif (dewarpParams_.has_value())\n \t\tcontrols[&controls::LensDewarpEnable] = ControlInfo(false, true, true);\n \n+\tcontrols[&controls::Dw100Scale] = ControlInfo(0.2f, 8.0f, 1.0f);\n+\tcontrols[&controls::Dw100Rotation] = ControlInfo(-180.0f, 180.0f, 0.0f);\n+\tcontrols[&controls::Dw100Offset] =\n+\t\tControlInfo(Point(-10000, -10000), Point(10000, 10000), Point(0, 0));\n+\tcontrols[&controls::Dw100ScaleMode] =\n+\t\tControlInfo(controls::Dw100ScaleModeValues, controls::Dw100ScaleModeFill);\n+\n \tif (!converter_.supportsRequests())\n \t\tLOG(Converter, Warning)\n \t\t\t<< \"dw100 kernel driver has no requests support.\"\n@@ -369,6 +376,30 @@ void ConverterDW100Module::setControls(const Stream *stream, const ControlList &\n \tauto &info = vertexMaps_[stream];\n \tauto &vertexMap = info.map;\n \n+\tconst auto &scale = controls.get(controls::Dw100Scale);\n+\tif (scale) {\n+\t\tvertexMap.setScale(*scale);\n+\t\tinfo.update = true;\n+\t}\n+\n+\tconst auto &rotation = controls.get(controls::Dw100Rotation);\n+\tif (rotation) {\n+\t\tvertexMap.setRotation(*rotation);\n+\t\tinfo.update = true;\n+\t}\n+\n+\tconst auto &offset = controls.get(controls::Dw100Offset);\n+\tif (offset) {\n+\t\tvertexMap.setOffset(*offset);\n+\t\tinfo.update = true;\n+\t}\n+\n+\tconst auto &scaleMode = controls.get(controls::Dw100ScaleMode);\n+\tif (scaleMode) {\n+\t\tvertexMap.setMode(static_cast<Dw100VertexMap::ScaleMode>(*scaleMode));\n+\t\tinfo.update = true;\n+\t}\n+\n \tconst auto &lensDewarpEnable = controls.get(controls::LensDewarpEnable);\n \tif (lensDewarpEnable) {\n \t\tvertexMap.setLensDewarpEnable(*lensDewarpEnable);\n@@ -402,6 +433,11 @@ void ConverterDW100Module::populateMetadata(const Stream *stream, ControlList &m\n \n \tauto &vertexMap = vertexMaps_[stream].map;\n \n+\tstd::array<float, 2> effectiveScale = vertexMap.effectiveScale();\n+\tmeta.set(controls::Dw100EffectiveScale, effectiveScale);\n+\tmeta.set(controls::Dw100Scale, (effectiveScale[0] + effectiveScale[1]) / 2.0);\n+\tmeta.set(controls::Dw100Rotation, vertexMap.rotation());\n+\tmeta.set(controls::Dw100Offset, vertexMap.effectiveOffset());\n \tmeta.set(controls::ScalerCrop, vertexMap.effectiveScalerCrop());\n \n \tif (dewarpParams_.has_value())\n","prefixes":["v3","28/29"]}