{"id":19175,"url":"https://patchwork.libcamera.org/api/patches/19175/?format=json","web_url":"https://patchwork.libcamera.org/patch/19175/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20231022224159.30298-7-laurent.pinchart@ideasonboard.com>","date":"2023-10-22T22:41:57","name":"[libcamera-devel,v6,19/12] libcamera: camera_sensor: Cache mounting orientation instead of transform","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"c7f61ee77dd91fe44eda62f40ca3e08862981992","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/19175/mbox/","series":[{"id":4053,"url":"https://patchwork.libcamera.org/api/series/4053/?format=json","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/19175/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/19175/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 391F3C32B8\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 22 Oct 2023 22:42:06 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 664DA6298D;\n\tMon, 23 Oct 2023 00:42:03 +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 A29B26297F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Oct 2023 00:41:59 +0200 (CEST)","from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi\n\t[213.243.189.158])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4F242749;\n\tMon, 23 Oct 2023 00:41:49 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1698014523;\n\tbh=vTFhs4od3h0Y/PLNg5ahJow5rZArqfKXmk+S/CiZSmA=;\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=ucXVuL5z5xnuSQaDKhLBAl772odByM3+IczXG17HnBMSqfUlldokbgXsHqJKKYNYL\n\tY1UbAJelqc0So3TnyXZbOvfPLKmJxfgY3s75WKJxkT4HYzURLZj+gSI5aHxcXDiws0\n\tfnoeLaDxo4AkmhZKv95i6yYR7ZcMRmu8OvMw8+FZXVtVrMxDWVEfc27HnG7YmF8LAJ\n\tAohK1IbLf5KuRuPrq3Um6teiuDKhOUU+LXjbqHDbE5G49luQeEycqZIF9vuTWim5eu\n\tZIoQLo5JnMum/3mO8KvtvNmJJX9dBjdLVc/fi1uoYiOnuY4Beqz3lyD/etoYa33FP6\n\t/mjkA6nP/hLDA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1698014509;\n\tbh=vTFhs4od3h0Y/PLNg5ahJow5rZArqfKXmk+S/CiZSmA=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=bFBfwf6gOAorqXaLrechhyPKwKUck2nSEGp2biKvIULP2tABTrDlaLCNbf4ArvGOX\n\tOaZqQa94zVwzgFiqUiUGkLcqe4QQxJ+0msKcdalcidnW8UtJGmFpwPXP9OOjOxHc4L\n\tN2FudP2I5/w4KvgsFgxZHNFrUUdmqz4+s/eNn9sU="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"bFBfwf6g\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 23 Oct 2023 01:41:57 +0300","Message-ID":"<20231022224159.30298-7-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.41.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 19/12] libcamera: camera_sensor: Cache\n\tmounting orientation instead of transform","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":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@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":"The cached rotationTransform_ value is used in computeTransform() only,\nto compute the mounting orientation. Cache the mounting orientation\ninstead, removing the need for the intermediate conversion of the\nrotation to a transform.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/internal/camera_sensor.h |  3 ++-\n src/libcamera/camera_sensor.cpp            | 18 ++++++++----------\n 2 files changed, 10 insertions(+), 11 deletions(-)","diff":"diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\nindex bcdb2d834dc3..60a8b106d175 100644\n--- a/include/libcamera/internal/camera_sensor.h\n+++ b/include/libcamera/internal/camera_sensor.h\n@@ -17,6 +17,7 @@\n #include <libcamera/control_ids.h>\n #include <libcamera/controls.h>\n #include <libcamera/geometry.h>\n+#include <libcamera/orientation.h>\n #include <libcamera/transform.h>\n \n #include <libcamera/ipa/core_ipa_interface.h>\n@@ -114,7 +115,7 @@ private:\n \tRectangle activeArea_;\n \tconst BayerFormat *bayerFormat_;\n \tbool supportFlips_;\n-\tTransform rotationTransform_;\n+\tOrientation mountingOrientation_;\n \n \tControlList properties_;\n \ndiff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex f175f8b56077..d92616722bc3 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -470,12 +470,12 @@ int CameraSensor::initProperties()\n \t\t * rotation for later use in computeTransform().\n \t\t */\n \t\tbool success;\n-\t\trotationTransform_ = transformFromRotation(propertyValue, &success);\n+\t\tmountingOrientation_ = orientationFromRotation(propertyValue, &success);\n \t\tif (!success) {\n \t\t\tLOG(CameraSensor, Warning)\n \t\t\t\t<< \"Invalid rotation of \" << propertyValue\n \t\t\t\t<< \" degrees - ignoring\";\n-\t\t\trotationTransform_ = Transform::Identity;\n+\t\t\tmountingOrientation_ = Orientation::Rotate0;\n \t\t}\n \n \t\tproperties_.set(properties::Rotation, propertyValue);\n@@ -483,7 +483,7 @@ int CameraSensor::initProperties()\n \t\tLOG(CameraSensor, Warning)\n \t\t\t<< \"Rotation control not available, default to 0 degrees\";\n \t\tproperties_.set(properties::Rotation, 0);\n-\t\trotationTransform_ = Transform::Identity;\n+\t\tmountingOrientation_ = Orientation::Rotate0;\n \t}\n \n \tproperties_.set(properties::PixelArraySize, pixelArraySize_);\n@@ -1137,14 +1137,12 @@ void CameraSensor::updateControlInfo()\n  */\n Transform CameraSensor::computeTransform(Orientation *orientation) const\n {\n-\tOrientation mountingOrientation = transformToOrientation(rotationTransform_);\n-\n \t/*\n \t * If we cannot do any flips we cannot change the native camera mounting\n \t * orientation.\n \t */\n \tif (!supportFlips_) {\n-\t\t*orientation = mountingOrientation;\n+\t\t*orientation = mountingOrientation_;\n \t\treturn Transform::Identity;\n \t}\n \n@@ -1153,17 +1151,17 @@ Transform CameraSensor::computeTransform(Orientation *orientation) const\n \t * from the mounting rotation.\n \t *\n \t * As a note:\n-\t * \torientation / mountingOrientation = transform\n-\t * \tmountingOrientation * transform = orientation\n+\t * \torientation / mountingOrientation_ = transform\n+\t * \tmountingOrientation_ * transform = orientation\n \t */\n-\tTransform transform = *orientation / mountingOrientation;\n+\tTransform transform = *orientation / mountingOrientation_;\n \n \t/*\n \t * If transform contains any Transpose we cannot do it, so adjust\n \t * 'orientation' to report the image native orientation and return Identity.\n \t */\n \tif (!!(transform & Transform::Transpose)) {\n-\t\t*orientation = mountingOrientation;\n+\t\t*orientation = mountingOrientation_;\n \t\treturn Transform::Identity;\n \t}\n \n","prefixes":["libcamera-devel","v6","19/12"]}