{"id":18968,"url":"https://patchwork.libcamera.org/api/1.1/patches/18968/?format=json","web_url":"https://patchwork.libcamera.org/patch/18968/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20230901150215.11585-6-jacopo.mondi@ideasonboard.com>","date":"2023-09-01T15:02:08","name":"[libcamera-devel,v5,05/12] libcamera: transform: Add functions to convert Orientation","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"a752519853b14428bb2ecba57306dab982163010","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/1.1/people/143/?format=json","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18968/mbox/","series":[{"id":4010,"url":"https://patchwork.libcamera.org/api/1.1/series/4010/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4010","date":"2023-09-01T15:02:03","name":"libcamera: Replace CameraConfiguration::transform","version":5,"mbox":"https://patchwork.libcamera.org/series/4010/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18968/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18968/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 706D2C32B1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  1 Sep 2023 15:02:53 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1C66B628EA;\n\tFri,  1 Sep 2023 17:02:53 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E717B628E8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  1 Sep 2023 17:02:50 +0200 (CEST)","from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 6F0EA15E9;\n\tFri,  1 Sep 2023 17:01:26 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1693580573;\n\tbh=C071+c9sKX4BUUndlfeOERBWDFRvAPyBmpu+wDpWu2E=;\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=pnUO5sCc0yVcdFK4NUYq9puRbahTfOOgtHNPcA0oG1exlmNMDsm9vBIE84Zd8f4WO\n\tXijgQH9gGGmhQX3qn14EWgpPF7YRamnCIDXgOxJRknlRTtKeTPyhu9NPZBkpC/VLD1\n\tPIUbgk+wAJpwTRlDHoUG3nEZpWsWhpxHKR67w4HsPt+VA2sBxwntZG8qPNM15Ojujx\n\t5NiEJQuzGgUvZO/n2MCxQmyfh5s4/+7LN7WvhYAeBJYymxqdsRd1LBwZnYxWx9Ht2j\n\t5h5j3Zzvx8FsRU0Fi/sQFJKr/ACCrwmr4YXupneNiLAXFlfJFR5emjD0nk1AdOyokW\n\tiM9CCvKqR+AZw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1693580487;\n\tbh=C071+c9sKX4BUUndlfeOERBWDFRvAPyBmpu+wDpWu2E=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=IKo2s78UuanEo5YDXv5GpRKhRj4nSxo5PNedQ+vaMS62uwapqk4je0otrfN/qTvIM\n\t3tbL6Sjj3/d6JkXuc9olY2x1yIBq3xlUTlj/zr/BUme8QIr6f5eb9LC7xIgXekdZKm\n\t62F94SVzVACwQwg5CWmf+Cl67k9WyRf+CVy7Wbno="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"IKo2s78U\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Fri,  1 Sep 2023 17:02:08 +0200","Message-Id":"<20230901150215.11585-6-jacopo.mondi@ideasonboard.com>","X-Mailer":"git-send-email 2.40.1","In-Reply-To":"<20230901150215.11585-1-jacopo.mondi@ideasonboard.com>","References":"<20230901150215.11585-1-jacopo.mondi@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v5 05/12] 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\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n---\n include/libcamera/transform.h |  4 +++\n src/libcamera/transform.cpp   | 60 +++++++++++++++++++++++++++++++++++\n 2 files changed, 64 insertions(+)","diff":"diff --git a/include/libcamera/transform.h b/include/libcamera/transform.h\nindex 2a6838c78369..14f1db0e8572 100644\n--- a/include/libcamera/transform.h\n+++ b/include/libcamera/transform.h\n@@ -11,6 +11,8 @@\n \n namespace libcamera {\n \n+enum class Orientation;\n+\n enum class Transform : int {\n \tIdentity = 0,\n \tRot0 = Identity,\n@@ -69,6 +71,8 @@ constexpr Transform operator~(Transform t)\n }\n \n Transform transformFromRotation(int angle, bool *success = nullptr);\n+Transform transformFromOrientation(const Orientation &orientation);\n+Orientation transformToOrientation(const Transform &transform);\n \n const char *transformToString(Transform t);\n \ndiff --git a/src/libcamera/transform.cpp b/src/libcamera/transform.cpp\nindex 4668303d0676..c70cac3f14ee 100644\n--- a/src/libcamera/transform.cpp\n+++ b/src/libcamera/transform.cpp\n@@ -7,6 +7,8 @@\n \n #include <libcamera/transform.h>\n \n+#include <libcamera/orientation.h>\n+\n /**\n  * \\file transform.h\n  * \\brief Enum to represent and manipulate 2D plane transforms\n@@ -299,6 +301,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 Orientation &orientation)\n+{\n+\tswitch (orientation) {\n+\tcase Orientation::rotate0:\n+\t\treturn Transform::Identity;\n+\tcase Orientation::rotate0Flip:\n+\t\treturn Transform::HFlip;\n+\tcase Orientation::rotate180:\n+\t\treturn Transform::Rot180;\n+\tcase Orientation::rotate180Flip:\n+\t\treturn Transform::VFlip;\n+\tcase Orientation::rotate90Flip:\n+\t\treturn Transform::Transpose;\n+\tcase Orientation::rotate90:\n+\t\treturn Transform::Rot90;\n+\tcase Orientation::rotate270Flip:\n+\t\treturn Transform::Rot180Transpose;\n+\tcase Orientation::rotate270:\n+\t\treturn Transform::Rot270;\n+\t}\n+\n+\treturn Transform::Identity;\n+}\n+\n+/**\n+ * \\brief Return the Orientation representing \\a transform\n+ * \\param[in] transform The transform to convert\n+ * \\return The Orientation corresponding to \\a transform\n+ */\n+Orientation transformToOrientation(const Transform &transform)\n+{\n+\tswitch (transform) {\n+\tcase Transform::Identity:\n+\t\treturn Orientation::rotate0;\n+\tcase Transform::HFlip:\n+\t\treturn Orientation::rotate0Flip;\n+\tcase Transform::VFlip:\n+\t\treturn Orientation::rotate180Flip;\n+\tcase Transform::Rot180:\n+\t\treturn Orientation::rotate180;\n+\tcase Transform::Transpose:\n+\t\treturn Orientation::rotate90Flip;\n+\tcase Transform::Rot270:\n+\t\treturn Orientation::rotate270;\n+\tcase Transform::Rot90:\n+\t\treturn Orientation::rotate90;\n+\tcase Transform::Rot180Transpose:\n+\t\treturn Orientation::rotate270Flip;\n+\t}\n+\n+\treturn Orientation::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","v5","05/12"]}