Patch Detail
Show a patch.
GET /api/1.1/patches/19150/?format=api
{ "id": 19150, "url": "https://patchwork.libcamera.org/api/1.1/patches/19150/?format=api", "web_url": "https://patchwork.libcamera.org/patch/19150/", "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": "<20231019140133.32090-3-jacopo.mondi@ideasonboard.com>", "date": "2023-10-19T14:01:23", "name": "[libcamera-devel,v6,02/12] libcamera: camera: Introduce Orientation", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "e6460c641228a032a59ed7a79235170a3110998b", "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/19150/mbox/", "series": [ { "id": 4053, "url": "https://patchwork.libcamera.org/api/1.1/series/4053/?format=api", "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/19150/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/19150/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 0C73AC3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 19 Oct 2023 14:01:54 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2CBE662986;\n\tThu, 19 Oct 2023 16:01:53 +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 923BF6297F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 19 Oct 2023 16:01: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 7D341276;\n\tThu, 19 Oct 2023 16:01:42 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1697724113;\n\tbh=hEUiGA6p2uTq7SwijDhe6oOdyARlL3Y27YjKeEsINPI=;\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=tI5sqJAHf2OfjhIFQiThJ+ofP1azcP1Q9TVip9qu03iZzfCJqQycBFHxZYdPTtNYd\n\t0ptrno3EzPDioarKSaVvRiGZFRk8q705fmODzGtv3BEisJJrErdKP0Wqm45Y/KWNff\n\tF1wLE51zfkcXRJpVPPunuUOJxCr/6/iwq7TM3EZziNisV++sy5L4RoVji+DW5menEI\n\tU0yvWaKHeHpFwMNVJbJM0NCxkmH/m87Ze7wAnUKrDmOIXRWYBAxN0XZb9LOr8q/TRJ\n\tToGHKYkgIoOs7tDamROkaZowFWR59D1m4sVIHzve7Sm0SKPR4EycbjbEfAhKv1Kg0N\n\ttPqtErWROTa+g==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1697724102;\n\tbh=hEUiGA6p2uTq7SwijDhe6oOdyARlL3Y27YjKeEsINPI=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=oxmSxRnVzhOYlxMX+tsOlIjS/f+tHsyWhPgFctVfH4iE9Da6W/y+j86wxVNgCDi7z\n\tDdjTqZzcMFEVBfZE/ANeiETlWqMRoUG7pbk0R9mKFfd0jBNSN9drU64iln5HzN4Um7\n\t32vIvVnnt03vrfqN6xeKtbX6UD+PDaWuR/ah7ckw=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"oxmSxRnV\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 19 Oct 2023 16:01:23 +0200", "Message-ID": "<20231019140133.32090-3-jacopo.mondi@ideasonboard.com>", "X-Mailer": "git-send-email 2.42.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 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 | 62 +++++++++++++++++++++++++++++++++\n 6 files changed, 111 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 decf4ec0d4db..a4536c72a17e 100644\n--- a/include/libcamera/camera.h\n+++ b/include/libcamera/camera.h\n@@ -21,6 +21,7 @@\n \n #include <libcamera/controls.h>\n #include <libcamera/geometry.h>\n+#include <libcamera/orientation.h>\n #include <libcamera/request.h>\n #include <libcamera/stream.h>\n #include <libcamera/transform.h>\n@@ -94,6 +95,7 @@ public:\n \n \tstd::optional<SensorConfiguration> sensorConfig;\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..ae19d4c44a55\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+\tRotate0Mirror,\n+\tRotate180,\n+\tRotate180Mirror,\n+\tRotate90Mirror,\n+\tRotate270,\n+\tRotate270Mirror,\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 b940647d8d09..59ee3c40dc8e 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -291,7 +291,8 @@ bool SensorConfiguration::isValid() const\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@@ -552,6 +553,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 orientation requested by the application cannot be obtained, the\n+ * camera will not rotate or flip the images, and the validate() function will\n+ * Adjust this value to the native image orientation produced by the camera.\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..61f26cfda31b\n--- /dev/null\n+++ b/src/libcamera/orientation.cpp\n@@ -0,0 +1,62 @@\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+ * The image orientation expressed using the Orientation enumeration can be then\n+ * inferred by applying to a naturally oriented image a multiple of a 90 degrees\n+ * rotation in the clockwise direction from the origin and then by applying an\n+ * optional horizontal mirroring.\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::Rotate90Mirror 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\"Rotate90Mirror\", \"Rotate270\",\n+\t\t\"Rotate270Mirror\", \"Rotate90\",\n+\t};\n+\n+\tout << orientationNames[static_cast<unsigned int>(orientation)];\n+\treturn out;\n+}\n+\n+} /* namespace libcamera */\n", "prefixes": [ "libcamera-devel", "v6", "02/12" ] }