Patch Detail
Show a patch.
GET /api/1.1/patches/18824/?format=api
{ "id": 18824, "url": "https://patchwork.libcamera.org/api/1.1/patches/18824/?format=api", "web_url": "https://patchwork.libcamera.org/patch/18824/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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-3-jacopo.mondi@ideasonboard.com>", "date": "2023-07-14T14:15:42", "name": "[libcamera-devel,v2,2/9] libcamera: camera: Introduce CameraConfiguration::orientation", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "b52a864eade569f70f5d30ee38ffc3421c847804", "submitter": { "id": 143, "url": "https://patchwork.libcamera.org/api/1.1/people/143/?format=api", "name": "Jacopo Mondi", "email": "jacopo.mondi@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/18824/mbox/", "series": [ { "id": 3971, "url": "https://patchwork.libcamera.org/api/1.1/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/18824/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/18824/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 1F57EBDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 14 Jul 2023 14:16:09 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 09D66628C4;\n\tFri, 14 Jul 2023 16:16:08 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 84319628C0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 14 Jul 2023 16:16:06 +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 1D72657E;\n\tFri, 14 Jul 2023 16:15:15 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1689344168;\n\tbh=Q9IWFqB6mXxY5M7epcsmJeDXvpQKthD6mOLYgResINc=;\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=pP+pI85Q5wyW6WXz0oU9kDJPTwiHJo4wU1aZgV+74++O5GGodOc9U4zfVMUV13VYL\n\twCKg39YDeNEDCmZYRAe86ThdwFZtgxvz3wFl//8A6A2NgpBv4BSsp5zO4DqJxXPoGS\n\tmbPhnA5/QhG4Dn1+e7GPYVZHnZfSyJfXMowT/TqTUUTmZUQnGnKsSJr+/BynUxJiFT\n\tqEL6q/olMPpHq1IhbvvqLUo3+xy+FdImz1Lr3ax7/eASlMy6+0bBdPCsb7Jx1/M/wN\n\tc8Dcq1SvNNzpbn8ZWN4jO+8afZNKj2+TeUtJILRu+OKDNMg0Y4bAXqGmWCXYveAjnG\n\tS3TF4yt2MZQhw==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1689344115;\n\tbh=Q9IWFqB6mXxY5M7epcsmJeDXvpQKthD6mOLYgResINc=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=s1Kc/QDh1TPOfoglBigLyQ2rReV8AxbcCEWmGbj79LM6Nfkts8t/zW2kYuBPrHaQ8\n\tWXtIoqTzhOwef4+9WiSlqyZRiOba0ugwVmqfTFLpxlFAYKoag8A+YY7FdfJF0GMsDy\n\t2QI+CjEyoHKoTS2jngJwK0W+3yRu/DnPtUXv+7ko=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"s1Kc/QDh\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 14 Jul 2023 16:15:42 +0200", "Message-Id": "<20230714141549.11085-3-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 2/9] libcamera: camera: Introduce\n\tCameraConfiguration::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": "Introduce CameraConfiguration::Orientation in the CameraConfiguration\nclass.\n\nThe Orienation enumeration describes the possible 2D transformations\nthat can be applied to an image using two basic plane transformations.\n\nThe enumeration values follow the ones defined by the EXIF specification at\nrevision 2.32, Tag 274 'orientation'.\n\nThe newly introduced filed is meant to replace\nCameraConfiguration::transform which is not removed yet not to break\ncompilation.\n\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n include/libcamera/camera.h | 17 +++++++++\n src/libcamera/camera.cpp | 76 +++++++++++++++++++++++++++++++++++++-\n 2 files changed, 92 insertions(+), 1 deletion(-)", "diff": "diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h\nindex 004bc89455f5..8132ef2506a4 100644\n--- a/include/libcamera/camera.h\n+++ b/include/libcamera/camera.h\n@@ -8,6 +8,7 @@\n #pragma once\n \n #include <initializer_list>\n+#include <iostream>\n #include <memory>\n #include <set>\n #include <stdint.h>\n@@ -39,6 +40,18 @@ public:\n \t\tInvalid,\n \t};\n \n+\tenum Orientation {\n+\t\t/* EXIF tag 274 starts from '1' */\n+\t\trotate0 = 1,\n+\t\trotate0Flip,\n+\t\trotate180,\n+\t\trotate180Flip,\n+\t\trotate90Flip,\n+\t\trotate270,\n+\t\trotate270Flip,\n+\t\trotate90,\n+\t};\n+\n \tusing iterator = std::vector<StreamConfiguration>::iterator;\n \tusing const_iterator = std::vector<StreamConfiguration>::const_iterator;\n \n@@ -67,6 +80,7 @@ public:\n \tstd::size_t size() const;\n \n \tTransform transform;\n+\tOrientation orientation;\n \n protected:\n \tCameraConfiguration();\n@@ -83,6 +97,9 @@ protected:\n \tstd::vector<StreamConfiguration> config_;\n };\n \n+std::ostream &operator<<(std::ostream &out,\n+\t\t\t const CameraConfiguration::Orientation &orientation);\n+\n class Camera final : public Object, public std::enable_shared_from_this<Camera>,\n \t\t public Extensible\n {\ndiff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex 0eecee766f00..78aa11e72dd4 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -145,6 +145,44 @@ LOG_DECLARE_CATEGORY(Camera)\n * The configuration is invalid and can't be adjusted automatically\n */\n \n+/**\n+ * \\enum CameraConfiguration::Orientation\n+ * \\brief The image orientation in a memory buffer\n+ *\n+ * The Orientation enumeration describes the orientation of the images\n+ * produced by the camera pipeline as they get received by the application\n+ * inside memory buffers.\n+ *\n+ * All the possible 2D planes transformation of an image are expressed as the\n+ * combination of two basic operations:\n+ *\n+ * 'a': rotate the image 90 degrees clockwise\n+ * 'b': flip the image horizontally (mirroring)\n+ *\n+ * plus an identity operator 'e'.\n+ *\n+ * The composition of operations 'a' and 'b' according to the canonical function\n+ * composition notion 'b * a' (where 'a' is applied first, then 'b' is applied\n+ * next) gives origin to a symmetric group of order 8, or dihedral group.\n+ *\n+ * See https://en.wikipedia.org/wiki/Dihedral_group#/media/File:Dih4_cycle_graph.svg\n+ * as an example of the 2D plane transformation and how they originate from\n+ * the composition of the 'a' and 'b' operations.\n+ *\n+ * The image orientation expressed using the Orientation enumeration can be\n+ * then inferred by applying a multiple of a 90 degrees rotation from the origin\n+ * and the applying any horizontal mirroring to a base image assume to be\n+ * naturally oriented (no rotation and no mirroring applied).\n+ *\n+ * The enumeration numerical values follow the ones defined by the EXIF\n+ * Specification version 2.32, Tag 274 \"Orientation\", while the names of the\n+ * enumerated values report the rotation and mirroring operations performed.\n+ *\n+ * In example Orientation::rotate90Flip describes the image transformation\n+ * obtained by rotating 90 degrees clockwise first and the applying an\n+ * horizontal mirroring.\n+ */\n+\n /**\n * \\typedef CameraConfiguration::iterator\n * \\brief Iterator for the stream configurations in the camera configuration\n@@ -160,7 +198,7 @@ LOG_DECLARE_CATEGORY(Camera)\n * \\brief Create an empty camera configuration\n */\n CameraConfiguration::CameraConfiguration()\n-\t: transform(Transform::Identity), config_({})\n+\t: transform(Transform::Identity), orientation(rotate0), config_({})\n {\n }\n \n@@ -317,6 +355,27 @@ std::size_t CameraConfiguration::size() const\n \treturn config_.size();\n }\n \n+/**\n+ * \\brief Prints human-friendly names for Orientation items\n+ * \\param[in] out The output stream\n+ * \\param[in] orientation The Orientation item\n+ * \\return The output stream \\a out\n+ */\n+std::ostream &operator<<(std::ostream &out,\n+\t\t\t const CameraConfiguration::Orientation &orientation)\n+{\n+\tconstexpr std::array<const char *, 9> orientationNames = {\n+\t\t\"\", /* Orientation starts counting from 1. */\n+\t\t\"rotate0\", \"rotate0Flip\",\n+\t\t\"rotate180\", \"rotate180Flip\",\n+\t\t\"rotate90Flip\", \"rotate270\",\n+\t\t\"rotate270Flip\", \"rotate90\",\n+\t};\n+\n+\tout << orientationNames[orientation];\n+\treturn out;\n+}\n+\n /**\n * \\enum CameraConfiguration::ColorSpaceFlag\n * \\brief Specify the behaviour of validateColorSpaces\n@@ -404,6 +463,21 @@ CameraConfiguration::Status CameraConfiguration::validateColorSpaces(ColorSpaceF\n * may adjust this field at its discretion if the selection is not supported.\n */\n \n+/**\n+ * \\var CameraConfiguration::orientation\n+ * \\brief The desired orientation of the images produced by the camera\n+ *\n+ * The orientation field is a user-specified 2D plane transformation that\n+ * specifies how the application wants the camera images to be rotated in\n+ * the memory buffers.\n+ *\n+ * If the application requested orientation cannot be obtained the validate()\n+ * function will Adjust this field to the actual orientation of the images\n+ * as produced by the camera pipeline.\n+ *\n+ * By default the orientation filed is set to Orientation::rotate0.\n+ */\n+\n /**\n * \\var CameraConfiguration::config_\n * \\brief The vector of stream configurations\n", "prefixes": [ "libcamera-devel", "v2", "2/9" ] }