Show a patch.

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

{
    "id": 18753,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/18753/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18753/",
    "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": "<20230620142904.72600-4-jacopo.mondi@ideasonboard.com>",
    "date": "2023-06-20T14:29:03",
    "name": "[libcamera-devel,RFC,3/4] libcamera: Move to use CameraConfiguration::orientation",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "ac6169d32216abe9d53f5ab0b551f4e3d163cd7d",
    "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/18753/mbox/",
    "series": [
        {
            "id": 3932,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3932/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3932",
            "date": "2023-06-20T14:29:00",
            "name": "libcamera: Replace CameraConfiguration::transform",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3932/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18753/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18753/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 A592ABD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 20 Jun 2023 14:29:23 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4C065628CC;\n\tTue, 20 Jun 2023 16:29:22 +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 7495B628BF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 20 Jun 2023 16:29:19 +0200 (CEST)",
            "from uno.lan (unknown [IPv6:2001:b07:5d2e:52c9:72c3:346:a663:c82d])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 6FE0D2B3;\n\tTue, 20 Jun 2023 16:28:44 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1687271362;\n\tbh=ybjACyq3vQ4lsNMBp29sW93fC5ZrCQ/CfKJ76mC74aE=;\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=fsfXkODHQL1du4hm8tvSp8watsRseTchckpiwy8GxPFCnsngLuKq4haIqYM68XaVj\n\twfFmfwsZ66Jta+4iancIGEUlyGA8OUUg7QVVP2kaITyvyCGyLc2dyz7FHde1jXfT1S\n\t9A2IHmCbCMEzN9RKyCwjbWydU3ejiSo1HUvEufapetYJH2zWA0HcHVjnrKZVJ30ZyU\n\t6KQFq9wzsMf/iklrR8ZPIE8T0CxEvTq0D9kR9GuVxhZJHtBhjVYUOWFLZUkgelOs7+\n\t7X7aoqgkFtgYdEmPtbP0DoVVlHLCzHcWchPAg9wn+jJIsIa50B+9ofC7yq7GCxW+Z5\n\tl85HVsTpWjRSw==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1687271324;\n\tbh=ybjACyq3vQ4lsNMBp29sW93fC5ZrCQ/CfKJ76mC74aE=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=klnvIo2rTOdzjmDs+tfHUj+hkXdx64iGoNoXANoCUy3jr82tooGWY68gQVEcWYRMu\n\tJd77C36aUGZrzYWZwa8cVdc9/3p79/YzyQYgNPkLVZ7n9YaLdZJTVC57aUcc1oYPwG\n\tExlvauFPIoI1dYrYwjSajYhE3DZGhlSfYY/2tUUA="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"klnvIo2r\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 20 Jun 2023 16:29:03 +0200",
        "Message-Id": "<20230620142904.72600-4-jacopo.mondi@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.40.1",
        "In-Reply-To": "<20230620142904.72600-1-jacopo.mondi@ideasonboard.com>",
        "References": "<20230620142904.72600-1-jacopo.mondi@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [RFC 3/4] libcamera: Move to use\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": "Replace the usage of CameraConfiguration::transform with the newly\nintroduced CameraConfiguration::orientation.\n\nRework the CameraSensor::validateTransform(transform) to\nCameraSensor::computeTransform(orientation), that given the desired\nimage orientation computes the Transform that pipeline handlers should\napply to the sensor to obtain it.\n\nIntroduce in transform.cpp two functions to convert from Transform to\nOrientation and vice-versa.\n\nPort all pipeline handlers to use the newly introduced function.\n\nThis commit breaks existing applications as it removes the public\nCameraConfiguration::transform in faviour of\nCameraConfiguration::orientation.\n\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n include/libcamera/camera.h                    |  2 -\n include/libcamera/internal/camera_sensor.h    |  3 +-\n include/libcamera/transform.h                 |  4 +\n src/libcamera/camera.cpp                      | 15 +--\n src/libcamera/camera_sensor.cpp               | 95 +++++++++----------\n src/libcamera/pipeline/ipu3/ipu3.cpp          |  6 +-\n src/libcamera/pipeline/rkisp1/rkisp1.cpp      |  8 +-\n .../pipeline/rpi/common/pipeline_base.cpp     |  9 +-\n src/libcamera/pipeline/simple/simple.cpp      |  6 +-\n src/libcamera/pipeline/uvcvideo/uvcvideo.cpp  |  4 +-\n src/libcamera/pipeline/vimc/vimc.cpp          |  4 +-\n src/libcamera/transform.cpp                   | 58 +++++++++++\n 12 files changed, 129 insertions(+), 85 deletions(-)",
    "diff": "diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h\nindex 608774ce7768..bffac6bc8922 100644\n--- a/include/libcamera/camera.h\n+++ b/include/libcamera/camera.h\n@@ -20,7 +20,6 @@\n #include <libcamera/controls.h>\n #include <libcamera/request.h>\n #include <libcamera/stream.h>\n-#include <libcamera/transform.h>\n \n namespace libcamera {\n \n@@ -76,7 +75,6 @@ public:\n \tbool empty() const;\n \tstd::size_t size() const;\n \n-\tTransform transform;\n \tOrientation orientation;\n \n protected:\ndiff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\nindex 02b4b4d25e6d..1d47a2b1a500 100644\n--- a/include/libcamera/internal/camera_sensor.h\n+++ b/include/libcamera/internal/camera_sensor.h\n@@ -14,6 +14,7 @@\n #include <libcamera/base/class.h>\n #include <libcamera/base/log.h>\n \n+#include <libcamera/camera.h>\n #include <libcamera/control_ids.h>\n #include <libcamera/controls.h>\n #include <libcamera/geometry.h>\n@@ -71,7 +72,7 @@ public:\n \n \tCameraLens *focusLens() { return focusLens_.get(); }\n \n-\tTransform validateTransform(Transform *transform) const;\n+\tTransform computeTransform(CameraConfiguration::Orientation *orientation) const;\n \n protected:\n \tstd::string logPrefix() const override;\ndiff --git a/include/libcamera/transform.h b/include/libcamera/transform.h\nindex 2a6838c78369..573adf18715d 100644\n--- a/include/libcamera/transform.h\n+++ b/include/libcamera/transform.h\n@@ -9,6 +9,8 @@\n \n #include <string>\n \n+#include <libcamera/camera.h>\n+\n namespace libcamera {\n \n enum class Transform : int {\n@@ -69,6 +71,8 @@ constexpr Transform operator~(Transform t)\n }\n \n Transform transformFromRotation(int angle, bool *success = nullptr);\n+Transform transformFromOrientation(const CameraConfiguration::Orientation &orientation);\n+CameraConfiguration::Orientation transformToOrientation(const Transform &transform);\n \n const char *transformToString(Transform t);\n \ndiff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex 5ca05719ebfc..bc1409b5c960 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -197,7 +197,7 @@ LOG_DECLARE_CATEGORY(Camera)\n  * \\brief Create an empty camera configuration\n  */\n CameraConfiguration::CameraConfiguration()\n-\t: transform(Transform::Identity), orientation(rotate0), config_({})\n+\t: orientation(rotate0), config_({})\n {\n }\n \n@@ -428,19 +428,6 @@ CameraConfiguration::Status CameraConfiguration::validateColorSpaces(ColorSpaceF\n \treturn status;\n }\n \n-/**\n- * \\var CameraConfiguration::transform\n- * \\brief User-specified transform to be applied to the image\n- *\n- * The transform is a user-specified 2D plane transform that will be applied\n- * to the camera images by the processing pipeline before being handed to\n- * the application.\n- *\n- * The usual 2D plane transforms are allowed here (horizontal/vertical\n- * flips, multiple of 90-degree rotations etc.), but the validate() function\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 video streams produced by the camera\ndiff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex a15a6c89c5c8..5c9f30a62527 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -465,7 +465,7 @@ int CameraSensor::initProperties()\n \n \t\t/*\n \t\t * Cache the Transform associated with the camera mounting\n-\t\t * rotation for later use in validateTransform().\n+\t\t * rotation for later use in computeTransform().\n \t\t */\n \t\tbool success;\n \t\trotationTransform_ = transformFromRotation(propertyValue, &success);\n@@ -477,7 +477,7 @@ int CameraSensor::initProperties()\n \t\t}\n \n \t\t/*\n-\t\t * Adjust property::Rotation as validateTransform() compensates\n+\t\t * Adjust property::Rotation as computeTransform() compensates\n \t\t * for the mounting rotation. However, as a camera sensor can\n \t\t * only compensate rotations by applying H/VFlips, only rotation\n \t\t * of 180 degrees are automatically compensated. The other valid\n@@ -1033,69 +1033,66 @@ void CameraSensor::updateControlInfo()\n  */\n \n /**\n- * \\brief Validate a transform request against the sensor capabilities\n- * \\param[inout] transform The requested transformation, updated to match\n- * the sensor capabilities\n+ * \\brief Compute the Transform that gives the requested \\a orientation\n+ * \\param[inout] orientation The desired image orientation\n  *\n- * The input \\a transform is the transform that the caller wants, and it is\n- * adjusted according to the capabilities of the sensor to represent the\n- * \"nearest\" transform that can actually be delivered.\n+ * This function computes the Transform that the pipeline handler should apply\n+ * to the CameraSensor to obtain the requested \\a orientation.\n  *\n- * The returned Transform is the transform applied to the sensor in order to\n- * produce the input \\a transform, It is also validated against the sensor's\n- * ability to perform horizontal and vertical flips.\n+ * The intended caller of this function is the validate() implementation of\n+ * pipeline handlers, that pass in the application requested\n+ * CameraConfiguration::orientation and obtain a Transform to apply to the\n+ * camera sensor, likely at configure() time.\n  *\n- * For example, if the requested \\a transform is Transform::Identity and the\n- * sensor rotation is 180 degrees, the output transform will be\n- * Transform::Rot180 to correct the images so that they appear to have\n- * Transform::Identity, but only if the sensor can apply horizontal and vertical\n- * flips.\n+ * If the requested \\a orientation cannot be obtained, the \\a orientation\n+ * parameter is adjusted to report what the current image orientation is and\n+ * Transform::Identity is returned.\n  *\n- * \\return A Transform instance that represents which transformation has been\n- * applied to the camera sensor\n+ * If the requested \\a orientation can be obtained, the function computes a\n+ * Transform and does not adjust \\a orientation.\n+ *\n+ * Pipeline handlers are expected to verify if \\a orientation has been\n+ * adjusted by this function and set the CameraConfiguration::status to\n+ * Adjusted accordingly.\n+ *\n+ * \\return A Transform instance that applied to the CameraSensor produces images\n+ * with \\a orientation\n  */\n-Transform CameraSensor::validateTransform(Transform *transform) const\n+Transform CameraSensor::computeTransform(CameraConfiguration::Orientation *orientation) const\n {\n \t/*\n-\t * Combine the requested transform to compensate the sensor mounting\n-\t * rotation.\n+\t * We cannot do any flips, we cannot change the native camera mounting\n+\t * orientation.\n \t */\n-\tTransform combined = *transform * rotationTransform_;\n+\tif (!supportFlips_) {\n+\t\t*orientation = transformToOrientation(rotationTransform_);\n+\t\treturn Transform::Identity;\n+\t}\n \n \t/*\n-\t * We combine the platform and user transform, but must \"adjust away\"\n-\t * any combined result that includes a transposition, as we can't do\n-\t * those. In this case, flipping only the transpose bit is helpful to\n-\t * applications - they either get the transform they requested, or have\n-\t * to do a simple transpose themselves (they don't have to worry about\n-\t * the other possible cases).\n+\t * If the camera is mounted 90 or 270 degrees rotated, there is no\n+\t * way we can correct it and there's no point in continuing as the\n+\t * user request cannot be satisfied in full.\n \t */\n-\tif (!!(combined & Transform::Transpose)) {\n-\t\t/*\n-\t\t * Flipping the transpose bit in \"transform\" flips it in the\n-\t\t * combined result too (as it's the last thing that happens),\n-\t\t * which is of course clearing it.\n-\t\t */\n-\t\t*transform ^= Transform::Transpose;\n-\t\tcombined &= ~Transform::Transpose;\n+\tif (!!(rotationTransform_ & Transform::Transpose)) {\n+\t\t*orientation = transformToOrientation(rotationTransform_);\n+\t\treturn Transform::Identity;\n \t}\n \n \t/*\n-\t * We also check if the sensor doesn't do h/vflips at all, in which\n-\t * case we clear them, and the application will have to do everything.\n+\t * If the user request contains a transform there's no way we can\n+\t * satisfy it, default it to Identity. We cannot return early as the\n+\t * camera mounting rotation has to be corrected, and if we get here we\n+\t * know we can do that (we adjusted property::Rotation already because\n+\t * of this).\n \t */\n-\tif (!supportFlips_ && !!combined) {\n-\t\t/*\n-\t\t * If the sensor can do no transforms, then combined must be\n-\t\t * changed to the identity. The only user transform that gives\n-\t\t * rise to this is the inverse of the rotation. (Recall that\n-\t\t * combined = transform * rotationTransform.)\n-\t\t */\n-\t\t*transform = -rotationTransform_;\n-\t\tcombined = Transform::Identity;\n-\t}\n+\tTransform request = transformFromOrientation(*orientation);\n+\tif (!!(request & Transform::Transpose))\n+\t\trequest = Transform::Identity;\n+\n+\t*orientation = transformToOrientation(request);\n \n-\treturn combined;\n+\treturn request * rotationTransform_;\n }\n \n std::string CameraSensor::logPrefix() const\ndiff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 355cb0cb76b8..ded41e011be2 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -187,9 +187,9 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()\n \t * rotation and store the final combined transform that configure() will\n \t * need to apply to the sensor to save us working it out again.\n \t */\n-\tTransform requestedTransform = transform;\n-\tcombinedTransform_ = data_->cio2_.sensor()->validateTransform(&transform);\n-\tif (transform != requestedTransform)\n+\tOrientation requestedOrientation = orientation;\n+\tcombinedTransform_ = data_->cio2_.sensor()->computeTransform(&orientation);\n+\tif (orientation != requestedOrientation)\n \t\tstatus = Adjusted;\n \n \t/* Cap the number of entries to the available streams. */\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 91a3c60757e1..81ae84b13a62 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -481,9 +481,9 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate()\n \t\tstatus = Adjusted;\n \t}\n \n-\tTransform requestedTransform = transform;\n-\tTransform combined = sensor->validateTransform(&transform);\n-\tif (transform != requestedTransform)\n+\tOrientation requestedOrientation = orientation;\n+\tcombinedTransform_ = data_->sensor_->computeTransform(&orientation);\n+\tif (orientation != requestedOrientation)\n \t\tstatus = Adjusted;\n \n \t/*\n@@ -595,8 +595,6 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate()\n \tif (sensorFormat_.size.isNull())\n \t\tsensorFormat_.size = sensor->resolution();\n \n-\tcombinedTransform_ = combined;\n-\n \treturn status;\n }\n \ndiff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\nindex df7482920e75..9d6d816f637a 100644\n--- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n@@ -254,9 +254,9 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()\n \t * rotation and store the final combined transform that configure() will\n \t * need to apply to the sensor to save us working it out again.\n \t */\n-\tTransform requestedTransform = transform;\n-\tcombinedTransform_ = data_->sensor_->validateTransform(&transform);\n-\tif (transform != requestedTransform)\n+\tOrientation requestedOrientation = orientation;\n+\tcombinedTransform_ = data_->sensor_->computeTransform(&orientation);\n+\tif (orientation != requestedOrientation)\n \t\tstatus = Adjusted;\n \n \tstd::vector<CameraData::StreamParams> rawStreams, outStreams;\n@@ -1193,7 +1193,8 @@ int CameraData::configureIPA(const CameraConfiguration *config, ipa::RPi::Config\n \t}\n \n \t/* Always send the user transform to the IPA. */\n-\tparams.transform = static_cast<unsigned int>(config->transform);\n+\tparams.transform =\n+\t\tstatic_cast<unsigned int>(transformFromOrientation(config->orientation));\n \n \t/* Ready the IPA - it must know about the sensor resolution. */\n \tret = ipa_->configure(sensorInfo_, params, result);\ndiff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex 050285fd389e..cae67c90bd20 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -888,9 +888,9 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate()\n \tif (config_.empty())\n \t\treturn Invalid;\n \n-\tTransform requestedTransform = transform;\n-\tcombinedTransform_ = sensor->validateTransform(&transform);\n-\tif (transform != requestedTransform)\n+\tOrientation requestedOrientation = orientation;\n+\tcombinedTransform_ = sensor->computeTransform(&orientation);\n+\tif (orientation != requestedOrientation)\n \t\tstatus = Adjusted;\n \n \t/* Cap the number of entries to the available streams. */\ndiff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\nindex 277465b72164..e1f215f06db2 100644\n--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n@@ -111,8 +111,8 @@ CameraConfiguration::Status UVCCameraConfiguration::validate()\n \tif (config_.empty())\n \t\treturn Invalid;\n \n-\tif (transform != Transform::Identity) {\n-\t\ttransform = Transform::Identity;\n+\tif (orientation != CameraConfiguration::rotate0) {\n+\t\torientation = CameraConfiguration::rotate0;\n \t\tstatus = Adjusted;\n \t}\n \ndiff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp\nindex 204f5ad73f6d..33c165d0cee2 100644\n--- a/src/libcamera/pipeline/vimc/vimc.cpp\n+++ b/src/libcamera/pipeline/vimc/vimc.cpp\n@@ -128,8 +128,8 @@ CameraConfiguration::Status VimcCameraConfiguration::validate()\n \tif (config_.empty())\n \t\treturn Invalid;\n \n-\tif (transform != Transform::Identity) {\n-\t\ttransform = Transform::Identity;\n+\tif (orientation != CameraConfiguration::rotate0) {\n+\t\torientation = CameraConfiguration::rotate0;\n \t\tstatus = Adjusted;\n \t}\n \ndiff --git a/src/libcamera/transform.cpp b/src/libcamera/transform.cpp\nindex 4668303d0676..930155b60ff4 100644\n--- a/src/libcamera/transform.cpp\n+++ b/src/libcamera/transform.cpp\n@@ -299,6 +299,64 @@ Transform transformFromRotation(int angle, bool *success)\n \treturn Transform::Identity;\n }\n \n+/**\n+ * \\brief Return the transform representing \\a orientation\n+ * \\param[in] orientation The orientation to convert\n+ * \\return The transform corresponding to \\a orientation\n+ */\n+Transform transformFromOrientation(const CameraConfiguration::Orientation &orientation)\n+{\n+\tswitch (orientation) {\n+\tcase CameraConfiguration::rotate0:\n+\t\treturn Transform::Identity;\n+\tcase CameraConfiguration::flipRotate0:\n+\t\treturn Transform::HFlip;\n+\tcase CameraConfiguration::rotate180:\n+\t\treturn Transform::Rot180;\n+\tcase CameraConfiguration::flipRotate180:\n+\t\treturn Transform::VFlip;\n+\tcase CameraConfiguration::flipRotate270:\n+\t\treturn Transform::Transpose;\n+\tcase CameraConfiguration::rotate90:\n+\t\treturn Transform::Rot90;\n+\tcase CameraConfiguration::flipRotate90:\n+\t\treturn Transform::Rot180Transpose;\n+\tcase CameraConfiguration::rotate270:\n+\t\treturn Transform::Rot270;\n+\t}\n+\n+\treturn Transform::Identity;\n+}\n+\n+/**\n+ * \\brief Return the CameraConfiguration::Orientation representing \\a transform\n+ * \\param[in] transform The transform to convert\n+ * \\return The Orientation corresponding to \\a transform\n+ */\n+CameraConfiguration::Orientation transformToOrientation(const Transform &transform)\n+{\n+\tswitch (transform) {\n+\tcase Transform::Identity:\n+\t\treturn CameraConfiguration::rotate0;\n+\tcase Transform::HFlip:\n+\t\treturn CameraConfiguration::flipRotate0;\n+\tcase Transform::VFlip:\n+\t\treturn CameraConfiguration::flipRotate180;\n+\tcase Transform::Rot180:\n+\t\treturn CameraConfiguration::rotate180;\n+\tcase Transform::Transpose:\n+\t\treturn CameraConfiguration::flipRotate270;\n+\tcase Transform::Rot270:\n+\t\treturn CameraConfiguration::rotate270;\n+\tcase Transform::Rot90:\n+\t\treturn CameraConfiguration::rotate90;\n+\tcase Transform::Rot180Transpose:\n+\t\treturn CameraConfiguration::flipRotate90;\n+\t}\n+\n+\treturn CameraConfiguration::rotate0;\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",
        "RFC",
        "3/4"
    ]
}