{"id":19172,"url":"https://patchwork.libcamera.org/api/patches/19172/?format=json","web_url":"https://patchwork.libcamera.org/patch/19172/","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":"<20231022224159.30298-1-laurent.pinchart@ideasonboard.com>","date":"2023-10-22T22:41:51","name":"[libcamera-devel,v6,13/12] fixup! libcamera: camera: Introduce Orientation","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"82744257294334ce06b7f4c0e367211fcd4b833d","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/19172/mbox/","series":[{"id":4053,"url":"https://patchwork.libcamera.org/api/series/4053/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4053","date":"2023-10-19T14:01:21","name":"libcamera: Replace CameraConfiguration::transform","version":6,"mbox":"https://patchwork.libcamera.org/series/4053/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/19172/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/19172/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 87E32BDCBD\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 22 Oct 2023 22:42:04 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 68B2062988;\n\tMon, 23 Oct 2023 00:42:01 +0200 (CEST)","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 4795961DD0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Oct 2023 00:41:52 +0200 (CEST)","from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi\n\t[213.243.189.158])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 98337749;\n\tMon, 23 Oct 2023 00:41:41 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1698014521;\n\tbh=jsX2FEZlWfOPS/fLsvnAPP8EC7SPNUJ6IrVArWH9Si8=;\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=tPa1WZP/54VWTFrQIEi2KSifewZ3RMYww+h54v7vFk5Lmztq69IgRSuyFvoJoke+N\n\tpqt8pHuo00q72T0+igYJ2HDOnj+QhQFEaRhkZY15rvWAshfk5P7LsejKYOyOux+RWg\n\tgo9tzDVRdDauVWP21lWGTtEnMe2fFgFH+FukvX3QWiEGmqCkxForjrAdnemiu6qbgv\n\tlhIPmlCl1Nxou+pL/KnGpvwWrnMRKBb45ge7fzXOsJuo/umSMEOF8/LwjTXpGJEi92\n\t3tO43F7pinLZ44GJt/s1pkEO+m4M9DL0jt6s55DKskqo/DYN1nfj5NNroOW2EZTcPe\n\tJtMLfo9ymVvDw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1698014501;\n\tbh=jsX2FEZlWfOPS/fLsvnAPP8EC7SPNUJ6IrVArWH9Si8=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=B4dKCUsXd98pe8bKXHGIUvaNNGvaqH/mw1nV5s6ZUcm1XPUMw2XVJk3MUe30DQYFz\n\txtmkcg2QLj/fU1rEJg/xyCHpLIRKhqUjD/yPNam4aF5aXLPazQUtrGLNxPEGUCULiw\n\tCWMVrgkFjPmdvvQxbT7V+oXSvNZVvqwqUwenhTfk="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"B4dKCUsX\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 23 Oct 2023 01:41:51 +0300","Message-ID":"<20231022224159.30298-1-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.41.0","In-Reply-To":"<20231019140133.32090-1-jacopo.mondi@ideasonboard.com>","References":"<20231019140133.32090-1-jacopo.mondi@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v6 13/12] fixup! libcamera: camera:\n\tIntroduce 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":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@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 an orientationFromRotation() function\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/orientation.h |  2 ++\n src/libcamera/orientation.cpp   | 36 +++++++++++++++++++++++++++++++++\n 2 files changed, 38 insertions(+)","diff":"diff --git a/include/libcamera/orientation.h b/include/libcamera/orientation.h\nindex ae19d4c44a55..9a2c2fb2fbb1 100644\n--- a/include/libcamera/orientation.h\n+++ b/include/libcamera/orientation.h\n@@ -23,6 +23,8 @@ enum class Orientation {\n \tRotate90,\n };\n \n+Orientation orientationFromRotation(int angle, bool *success = nullptr);\n+\n std::ostream &operator<<(std::ostream &out, const Orientation &orientation);\n \n } /* namespace libcamera */\ndiff --git a/src/libcamera/orientation.cpp b/src/libcamera/orientation.cpp\nindex 5caf76f73865..a6363df30861 100644\n--- a/src/libcamera/orientation.cpp\n+++ b/src/libcamera/orientation.cpp\n@@ -56,6 +56,42 @@ namespace libcamera {\n  * \\image html rotation/rotate90.svg\n  */\n \n+/**\n+ * \\brief Return the orientation representing a rotation of the given angle\n+ * clockwise\n+ * \\param[in] angle The angle of rotation in a clockwise sense. Negative values\n+ * can be used to represent anticlockwise rotations\n+ * \\param[out] success Set to `true` if the angle is a multiple of 90 degrees,\n+ * otherwise `false`\n+ * \\return The orientation corresponding to the rotation if \\a success was set\n+ * to `true`, otherwise the `Rotate0` orientation\n+ */\n+Orientation orientationFromRotation(int angle, bool *success)\n+{\n+\tangle = angle % 360;\n+\tif (angle < 0)\n+\t\tangle += 360;\n+\n+\tif (success != nullptr)\n+\t\t*success = true;\n+\n+\tswitch (angle) {\n+\tcase 0:\n+\t\treturn Orientation::Rotate0;\n+\tcase 90:\n+\t\treturn Orientation::Rotate90;\n+\tcase 180:\n+\t\treturn Orientation::Rotate180;\n+\tcase 270:\n+\t\treturn Orientation::Rotate270;\n+\t}\n+\n+\tif (success != nullptr)\n+\t\t*success = false;\n+\n+\treturn Orientation::Rotate0;\n+}\n+\n /**\n  * \\brief Prints human-friendly names for Orientation items\n  * \\param[in] out The output stream\n","prefixes":["libcamera-devel","v6","13/12"]}