Show a patch.

GET /api/patches/18965/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 18965,
    "url": "https://patchwork.libcamera.org/api/patches/18965/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18965/",
    "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": "<20230901150215.11585-3-jacopo.mondi@ideasonboard.com>",
    "date": "2023-09-01T15:02:05",
    "name": "[libcamera-devel,v5,02/12] libcamera: camera: Introduce Orientation",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "bbca87bad1ca980ae4ef2a9bd28de802222756c0",
    "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/18965/mbox/",
    "series": [
        {
            "id": 4010,
            "url": "https://patchwork.libcamera.org/api/series/4010/?format=api",
            "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/18965/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18965/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 E1B03C3264\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  1 Sep 2023 15:02:42 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3E941628DF;\n\tFri,  1 Sep 2023 17:02:42 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D3AFD627DF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  1 Sep 2023 17:02:40 +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 7BC241288;\n\tFri,  1 Sep 2023 17:01:14 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1693580562;\n\tbh=yzZAi3e2eilrv1EvD0hf800qyt3WTFM+D5evp0TGr3o=;\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=1+1Z9XtS7E+/pND7PQvLhJrQyVkpKR3/ZqpRYCeBnv8qH+JmU3SIc3ter1WNqvMDN\n\t1ybUr5of+jPmZKTktnzXEUz+AxbuGNd4LhcqNOrzU3gtRKN7M5DstZOhueuAE4fwfJ\n\tgU5taNVGNOrr/Av4aU4H4ehrBQ49cjE8C+OUry8ebFbLBSR+5PbLg6jNBpGi/yKZPe\n\tEDF4pP4I3ifMmEjxTKd+LTVZ75dmPlOqd62rg6udeIwsyioNwT/3rR6rP+4udq+4gl\n\tORccEsDOh/Tl53NFfkWxjGPQyb/S6hCPOWTLNcZFpSumbi4X82t8Nx7jd7/t/32QVC\n\tdHATaSZLCPe7g==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1693580477;\n\tbh=yzZAi3e2eilrv1EvD0hf800qyt3WTFM+D5evp0TGr3o=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=nQiCKDMwISZ0hK/h2Zw9YRvmeE6t9YXRCUzcZa6RjJQkV2o7Uu4ZZUVL2w/cOXWNw\n\tMx9uMmk+kuWiyVOCU622uot2l6FS0zIu1ean3Hr6t5QueuNRhSxzhTocPhfZ2cRANj\n\tYcWNaW6eomgJ0jHLKOY44YkSece4XgEBVJkPt2Vc="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"nQiCKDMw\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri,  1 Sep 2023 17:02:05 +0200",
        "Message-Id": "<20230901150215.11585-3-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 02/12] libcamera: camera: Introduce\n\tOrientation",
        "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 the Orientation enumeration which describes the possible 2D\ntransformations that can be applied to an image using two basic plane\ntransformations.\n\nAdd to the CameraConfiguration class a new member 'orientation' which is\nused to specify the image orientation in the memory buffers delivered to\napplications.\n\nThe enumeration values follow the ones defined by the EXIF specification at\nrevision 2.32, Tag 274 'orientation'.\n\nThe newly introduced field 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>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n---\n include/libcamera/camera.h      |  2 +\n include/libcamera/meson.build   |  1 +\n include/libcamera/orientation.h | 28 ++++++++++++\n src/libcamera/camera.cpp        | 18 +++++++-\n src/libcamera/meson.build       |  1 +\n src/libcamera/orientation.cpp   | 78 +++++++++++++++++++++++++++++++++\n 6 files changed, 127 insertions(+), 1 deletion(-)\n create mode 100644 include/libcamera/orientation.h\n create mode 100644 src/libcamera/orientation.cpp",
    "diff": "diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h\nindex 004bc89455f5..6e9342773962 100644\n--- a/include/libcamera/camera.h\n+++ b/include/libcamera/camera.h\n@@ -19,6 +19,7 @@\n #include <libcamera/base/signal.h>\n \n #include <libcamera/controls.h>\n+#include <libcamera/orientation.h>\n #include <libcamera/request.h>\n #include <libcamera/stream.h>\n #include <libcamera/transform.h>\n@@ -67,6 +68,7 @@ public:\n \tstd::size_t size() const;\n \n \tTransform transform;\n+\tOrientation orientation;\n \n protected:\n \tCameraConfiguration();\ndiff --git a/include/libcamera/meson.build b/include/libcamera/meson.build\nindex 408b7acf152c..a24c50d66a82 100644\n--- a/include/libcamera/meson.build\n+++ b/include/libcamera/meson.build\n@@ -12,6 +12,7 @@ libcamera_public_headers = files([\n     'framebuffer_allocator.h',\n     'geometry.h',\n     'logging.h',\n+    'orientation.h',\n     'pixel_format.h',\n     'request.h',\n     'stream.h',\ndiff --git a/include/libcamera/orientation.h b/include/libcamera/orientation.h\nnew file mode 100644\nindex 000000000000..63ac4aba07ce\n--- /dev/null\n+++ b/include/libcamera/orientation.h\n@@ -0,0 +1,28 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2023, Ideas On Board Oy\n+ *\n+ * orientation.h - Image orientation\n+ */\n+\n+#pragma once\n+\n+#include <iostream>\n+\n+namespace libcamera {\n+\n+enum class Orientation {\n+\t/* EXIF tag 274 starts from '1' */\n+\trotate0 = 1,\n+\trotate0Flip,\n+\trotate180,\n+\trotate180Flip,\n+\trotate90Flip,\n+\trotate270,\n+\trotate270Flip,\n+\trotate90,\n+};\n+\n+std::ostream &operator<<(std::ostream &out, const Orientation &orientation);\n+\n+} /* namespace libcamera */\ndiff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex 0eecee766f00..d4ad4a553752 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -160,7 +160,8 @@ 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(Orientation::rotate0),\n+\t  config_({})\n {\n }\n \n@@ -404,6 +405,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 field is set to Orientation::rotate0.\n+ */\n+\n /**\n  * \\var CameraConfiguration::config_\n  * \\brief The vector of stream configurations\ndiff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\nindex b24f82965764..d0e26f6b4141 100644\n--- a/src/libcamera/meson.build\n+++ b/src/libcamera/meson.build\n@@ -34,6 +34,7 @@ libcamera_sources = files([\n     'mapped_framebuffer.cpp',\n     'media_device.cpp',\n     'media_object.cpp',\n+    'orientation.cpp',\n     'pipeline_handler.cpp',\n     'pixel_format.cpp',\n     'process.cpp',\ndiff --git a/src/libcamera/orientation.cpp b/src/libcamera/orientation.cpp\nnew file mode 100644\nindex 000000000000..f2ee14dd4182\n--- /dev/null\n+++ b/src/libcamera/orientation.cpp\n@@ -0,0 +1,78 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2023, Ideas On Board Oy\n+ *\n+ * orientation.cpp - Image orientation\n+ */\n+\n+#include <libcamera/orientation.h>\n+\n+#include <array>\n+#include <string>\n+\n+/**\n+ * \\file libcamera/orientation.h\n+ * \\brief Image orientation definition\n+ */\n+\n+namespace libcamera {\n+\n+/**\n+ * \\enum 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 plane transformations 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 then 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 then applying an\n+ * horizontal mirroring.\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, const 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[static_cast<unsigned int>(orientation)];\n+\treturn out;\n+}\n+\n+} /* namespace libcamera */\n",
    "prefixes": [
        "libcamera-devel",
        "v5",
        "02/12"
    ]
}