Patch Detail
Show a patch.
GET /api/patches/18869/?format=api
{ "id": 18869, "url": "https://patchwork.libcamera.org/api/patches/18869/?format=api", "web_url": "https://patchwork.libcamera.org/patch/18869/", "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": "<20230724071101.5256-8-jacopo.mondi@ideasonboard.com>", "date": "2023-07-24T07:10:58", "name": "[libcamera-devel,v4,07/10] libcamera: transform: Add operations with Orientation", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "b48e062701793c893d2cf2330849c851e00d1353", "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/18869/mbox/", "series": [ { "id": 3981, "url": "https://patchwork.libcamera.org/api/series/3981/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3981", "date": "2023-07-24T07:10:51", "name": "libcamera: Replace CameraConfiguration::transform", "version": 4, "mbox": "https://patchwork.libcamera.org/series/3981/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/18869/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/18869/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 0F6A0C324E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 24 Jul 2023 07:11:32 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AD8E1628C0;\n\tMon, 24 Jul 2023 09:11:31 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 49AD0628C2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Jul 2023 09:11:26 +0200 (CEST)", "from uno.localdomain (mob-5-91-20-233.net.vodafone.it\n\t[5.91.20.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 17DE8735;\n\tMon, 24 Jul 2023 09:10:28 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1690182691;\n\tbh=ROI3Ux4EEZWj62eMqFJTgCtOWTqlIBEQRw94ikVQKDc=;\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=qKNKYNwYcouIW5btBYTi8K7Ui3GxlvgmvmrbmA2ao8B/7nDxv87cyJu9dT98p+sF+\n\t5yghrS81t3X/QMqh+hFXgFZDUXaEO79lE1LpJDleGmLUIyywFLZcIvd7s4PKYr9v91\n\trkHb3U+JjmusCCueTtXS4Qaar5VKevoy2ZsnQsW9hxwHBCio2iKSnibCeoTmCCZgrp\n\tR3aEpspwYon5RqEYwxlKSaMdR+7SOAFcom8VJqhL/xdjV+H61ZikEbaQsO1Q3F6hZm\n\tjwYaOrsWogn9YafeGBcY3fLioGfLZS1RszESkIbpNQJasaLT4V9tXm99ZyHBHCPrxn\n\tdwiGmnzCClBMg==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1690182629;\n\tbh=ROI3Ux4EEZWj62eMqFJTgCtOWTqlIBEQRw94ikVQKDc=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Bfbpb1/8GBtzgDu4qaGEXh2tty/tnNXTRRb+3rs3qVgx+LnbfenLqKuxwUUJWVGPt\n\tlHlraAYmEJsekAKfokABQbaWn143PrSNlg4JfcUND5XUFa03vNXLprdbKhLGCrLU4q\n\tAfQVUqjN1XX3cGvEs5qvS5sxCwlkhB5bg/NvnxSE=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Bfbpb1/8\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 24 Jul 2023 09:10:58 +0200", "Message-Id": "<20230724071101.5256-8-jacopo.mondi@ideasonboard.com>", "X-Mailer": "git-send-email 2.40.1", "In-Reply-To": "<20230724071101.5256-1-jacopo.mondi@ideasonboard.com>", "References": "<20230724071101.5256-1-jacopo.mondi@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v4 07/10] libcamera: transform: Add\n\toperations with 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 operations that allows to combine Transform with Orientation.\n\n- Transform operator/(Orientation1, Orientation2)\n allows to easily get back the Transform that needs to be applied to\n Orientation2 to get Orientation1\n\n- Orientation operator*(Orientation1, Transform)\n allows to apply a Transform to an Orientation and obtain the\n combination of the two\n\nThese two operations allow applications to use Transforms to\nmanipulate the Orientation inside the CameraConfiguration, if they\nwish.\n\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n---\n include/libcamera/transform.h | 3 +++\n src/libcamera/transform.cpp | 37 +++++++++++++++++++++++++++++++++++\n 2 files changed, 40 insertions(+)", "diff": "diff --git a/include/libcamera/transform.h b/include/libcamera/transform.h\nindex 14f1db0e8572..847a1f94713c 100644\n--- a/include/libcamera/transform.h\n+++ b/include/libcamera/transform.h\n@@ -74,6 +74,9 @@ Transform transformFromRotation(int angle, bool *success = nullptr);\n Transform transformFromOrientation(const Orientation &orientation);\n Orientation transformToOrientation(const Transform &transform);\n \n+Transform operator/(const Orientation &o1, const Orientation &o2);\n+Orientation operator*(const Orientation &o1, const Transform &t);\n+\n const char *transformToString(Transform t);\n \n } /* namespace libcamera */\ndiff --git a/src/libcamera/transform.cpp b/src/libcamera/transform.cpp\nindex d192d63d9290..80cd804ca530 100644\n--- a/src/libcamera/transform.cpp\n+++ b/src/libcamera/transform.cpp\n@@ -362,6 +362,43 @@ Orientation transformToOrientation(const Transform &transform)\n \treturn Orientation::rotate0;\n }\n \n+/**\n+ * \\brief Return the Transform that applied to \\a o2 gives \\a o1\n+ * \\param o1 The Orientation to obtain\n+ * \\param o2 The base Orientation\n+ *\n+ * This operation can be used to easily compute the Transform to apply to a\n+ * base orientation \\a o2 to get the desired orientation \\a o1.\n+ *\n+ * The CameraSensor class uses this function to compute what Transform to apply\n+ * to a camera with mounting rotation \\a o2 (the base) to obtain the user\n+ * requested orientation \\a o1.\n+ *\n+ * \\return A Transform that applied to \\a o2 gives \\a o1\n+ */\n+Transform operator/(const Orientation &o1, const Orientation &o2)\n+{\n+\tTransform t1 = transformFromOrientation(o1);\n+\tTransform t2 = transformFromOrientation(o2);\n+\n+\treturn -t2 * t1;\n+}\n+\n+/**\n+ * \\brief Apply the Transform \\a t on the base orientation \\a o\n+ * \\param o The base orientation\n+ * \\param t The transform to apply on \\a o\n+ * \\return The Orientation resulting from applying \\a t on \\a o\n+ */\n+Orientation operator*(const Orientation &o, const Transform &t)\n+{\n+\t/*\n+\t * Apply a Transform corresponding to the base orientation first and\n+\t * then apply \\a t to it.\n+\t */\n+\treturn transformToOrientation(transformFromOrientation(o) * t);\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", "v4", "07/10" ] }