Patch Detail
Show a patch.
GET /api/patches/18827/?format=api
{ "id": 18827, "url": "https://patchwork.libcamera.org/api/patches/18827/?format=api", "web_url": "https://patchwork.libcamera.org/patch/18827/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20230714141549.11085-6-jacopo.mondi@ideasonboard.com>", "date": "2023-07-14T14:15:45", "name": "[libcamera-devel,v2,5/9] libcamera: transform: Add functions to convert Orientation", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "29b58b8fc6a152e31a9c1b04dfee21f7c8fbb447", "submitter": { "id": 143, "url": "https://patchwork.libcamera.org/api/people/143/?format=api", "name": "Jacopo Mondi", "email": "jacopo.mondi@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/18827/mbox/", "series": [ { "id": 3971, "url": "https://patchwork.libcamera.org/api/series/3971/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3971", "date": "2023-07-14T14:15:40", "name": "libcamera: Replace CameraConfiguration::transform", "version": 2, "mbox": "https://patchwork.libcamera.org/series/3971/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/18827/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/18827/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 934AFC32AA\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 14 Jul 2023 14:16:14 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3E9B7628D2;\n\tFri, 14 Jul 2023 16:16:14 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D0063628CB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 14 Jul 2023 16:16:11 +0200 (CEST)", "from uno.localdomain (mob-5-90-9-92.net.vodafone.it [5.90.9.92])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 68F6257E;\n\tFri, 14 Jul 2023 16:15:20 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1689344174;\n\tbh=J/w04h4LDd4HFy1aAx56ROTbTphrUdqJB5fqO1IyhZU=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=Y9KKVbhCkPSo7oCds3PmBZq6Bh90Hek44gikK1Tsr/5CAXhlyh0R/1W03aUOMZjTk\n\tkOFqTbpwboFssLAT33S2LYVd+7dqimRGXrLWueFJtk7kmf/w9rADwWj8bRH3Yfl5dI\n\tokixHME0+OWwJPJPNmdkcuxpI0VsJ3LihVNHVVL5NykykCsk9BnSYPT56+20/4qSHe\n\t3Le8wnHzKgtLFqzP0aCTAlNlgTMg0Rq+fA9kUjc/HanELnjJAqZ2jA8qHXRb5+0edm\n\ttdVdUGCOXcFapQQEW2XWKBYqfTNoGNxQ/eSnrhxMMIjrNdK3ABD2UFFULpFhllX9mJ\n\t+o9szbE5SUKpA==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1689344121;\n\tbh=J/w04h4LDd4HFy1aAx56ROTbTphrUdqJB5fqO1IyhZU=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=OtmqRZhNumqImemGJ03HKIfeHWx6mzL5XSwMat5jlK/t/SZTbeoCrOYEjhUJykpZB\n\tyVY4PVdsPp+NuA9PMNv3cDxkcnYAO6bUe13/zHqlev1aEjzFJ64/FnAMRDCpkpVr9l\n\tbGX/ZRnPghZzPErdc0YLyl0rtH7Tkwp/wsYhEROE=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"OtmqRZhN\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 14 Jul 2023 16:15:45 +0200", "Message-Id": "<20230714141549.11085-6-jacopo.mondi@ideasonboard.com>", "X-Mailer": "git-send-email 2.40.1", "In-Reply-To": "<20230714141549.11085-1-jacopo.mondi@ideasonboard.com>", "References": "<20230714141549.11085-1-jacopo.mondi@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 5/9] libcamera: transform: Add\n\tfunctions to convert Orientation", "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>", "From": "Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>", "Reply-To": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>", "Cc": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Add two helper functions to the transform.cpp file that allows to\nconvert to and from an Orientation.\n\nAs transform.h now needs to include camera.h remove \"#include\n<transform.h>\" from camera.h to avoid a cyclic inclusion loop.\n\nAdjust all files that need to include transform.h directly and didn't do\nso because it was implicitly included by camera.h.\n\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n include/libcamera/camera.h | 3 +-\n include/libcamera/transform.h | 4 ++\n src/libcamera/camera.cpp | 1 +\n src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 1 +\n src/libcamera/transform.cpp | 58 ++++++++++++++++++++\n 5 files changed, 66 insertions(+), 1 deletion(-)\n\n--\n2.40.1", "diff": "diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h\nindex 8132ef2506a4..55359d53f2ab 100644\n--- a/include/libcamera/camera.h\n+++ b/include/libcamera/camera.h\n@@ -22,7 +22,6 @@\n #include <libcamera/controls.h>\n #include <libcamera/request.h>\n #include <libcamera/stream.h>\n-#include <libcamera/transform.h>\n\n namespace libcamera {\n\n@@ -31,6 +30,8 @@ class FrameBufferAllocator;\n class PipelineHandler;\n class Request;\n\n+enum class Transform;\n+\n class CameraConfiguration\n {\n public:\ndiff --git a/include/libcamera/transform.h b/include/libcamera/transform.h\nindex 2a6838c78369..573adf18715d 100644\n--- a/include/libcamera/transform.h\n+++ b/include/libcamera/transform.h\n@@ -9,6 +9,8 @@\n\n #include <string>\n\n+#include <libcamera/camera.h>\n+\n namespace libcamera {\n\n enum class Transform : int {\n@@ -69,6 +71,8 @@ constexpr Transform operator~(Transform t)\n }\n\n Transform transformFromRotation(int angle, bool *success = nullptr);\n+Transform transformFromOrientation(const CameraConfiguration::Orientation &orientation);\n+CameraConfiguration::Orientation transformToOrientation(const Transform &transform);\n\n const char *transformToString(Transform t);\n\ndiff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex c8bb56d4af7f..af842e70dcb0 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -18,6 +18,7 @@\n #include <libcamera/framebuffer_allocator.h>\n #include <libcamera/request.h>\n #include <libcamera/stream.h>\n+#include <libcamera/transform.h>\n\n #include \"libcamera/internal/camera.h\"\n #include \"libcamera/internal/camera_controls.h\"\ndiff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\nindex 38f48a5d9269..02a6117c7955 100644\n--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n@@ -21,6 +21,7 @@\n #include <libcamera/property_ids.h>\n #include <libcamera/request.h>\n #include <libcamera/stream.h>\n+#include <libcamera/transform.h>\n\n #include \"libcamera/internal/camera.h\"\n #include \"libcamera/internal/device_enumerator.h\"\ndiff --git a/src/libcamera/transform.cpp b/src/libcamera/transform.cpp\nindex 4668303d0676..03d2b52e7f38 100644\n--- a/src/libcamera/transform.cpp\n+++ b/src/libcamera/transform.cpp\n@@ -299,6 +299,64 @@ Transform transformFromRotation(int angle, bool *success)\n \treturn Transform::Identity;\n }\n\n+/**\n+ * \\brief Return the transform representing \\a orientation\n+ * \\param[in] orientation The orientation to convert\n+ * \\return The transform corresponding to \\a orientation\n+ */\n+Transform transformFromOrientation(const CameraConfiguration::Orientation &orientation)\n+{\n+\tswitch (orientation) {\n+\tcase CameraConfiguration::rotate0:\n+\t\treturn Transform::Identity;\n+\tcase CameraConfiguration::rotate0Flip:\n+\t\treturn Transform::HFlip;\n+\tcase CameraConfiguration::rotate180:\n+\t\treturn Transform::Rot180;\n+\tcase CameraConfiguration::rotate180Flip:\n+\t\treturn Transform::VFlip;\n+\tcase CameraConfiguration::rotate90Flip:\n+\t\treturn Transform::Transpose;\n+\tcase CameraConfiguration::rotate90:\n+\t\treturn Transform::Rot90;\n+\tcase CameraConfiguration::rotate270Flip:\n+\t\treturn Transform::Rot180Transpose;\n+\tcase CameraConfiguration::rotate270:\n+\t\treturn Transform::Rot270;\n+\t}\n+\n+\treturn Transform::Identity;\n+}\n+\n+/**\n+ * \\brief Return the CameraConfiguration::Orientation representing \\a transform\n+ * \\param[in] transform The transform to convert\n+ * \\return The Orientation corresponding to \\a transform\n+ */\n+CameraConfiguration::Orientation transformToOrientation(const Transform &transform)\n+{\n+\tswitch (transform) {\n+\tcase Transform::Identity:\n+\t\treturn CameraConfiguration::rotate0;\n+\tcase Transform::HFlip:\n+\t\treturn CameraConfiguration::rotate0Flip;\n+\tcase Transform::VFlip:\n+\t\treturn CameraConfiguration::rotate180Flip;\n+\tcase Transform::Rot180:\n+\t\treturn CameraConfiguration::rotate180;\n+\tcase Transform::Transpose:\n+\t\treturn CameraConfiguration::rotate90Flip;\n+\tcase Transform::Rot270:\n+\t\treturn CameraConfiguration::rotate270;\n+\tcase Transform::Rot90:\n+\t\treturn CameraConfiguration::rotate90;\n+\tcase Transform::Rot180Transpose:\n+\t\treturn CameraConfiguration::rotate270Flip;\n+\t}\n+\n+\treturn CameraConfiguration::rotate0;\n+}\n+\n /**\n * \\brief Return a character string describing the transform\n * \\param[in] t The transform to be described.\n", "prefixes": [ "libcamera-devel", "v2", "5/9" ] }