From patchwork Thu Oct 19 14:01:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 19152 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 69959C32B6 for ; Thu, 19 Oct 2023 14:01:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0B4DD62988; Thu, 19 Oct 2023 16:01:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1697724115; bh=ez09PkZ4hoqGcybyDh8tQLfj8on8zVKYntI7Pbhg7iU=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=hmh1E0IyH29VoqYDUUgjxLDWiJtjhAgYpeN23sJ2qDESavs3purnXW2JIpNCebA27 gcuFzoAXGx2oeqlZk8UmzGnG0++JNiJQ3Gw9pFyToJy4zuOBKKNrNnjNvlMxi/AYGV oMryTikx1Uk7HJPCtlYf8j9nbVQ4cAecLYerBuimx3bqwg9GCYvsoL9GfkhEnp564j QT30BA328g5WDzh56Ac89Oj8aDuIu5QXOBBqGzT6hC0TnCTIadhXJI1xhaDgC+Vc3d cm08Ml9R11ctcBVLs2oM6WPR7RLcuMPehZtOMamiBNyQL9GoiKUQyjKQ7gsvpSg9k2 Jmmeylv6O1inQ== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6281961DD2 for ; Thu, 19 Oct 2023 16:01:51 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="fl+XKNeG"; dkim-atps=neutral Received: from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 490A7735; Thu, 19 Oct 2023 16:01:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1697724103; bh=ez09PkZ4hoqGcybyDh8tQLfj8on8zVKYntI7Pbhg7iU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fl+XKNeGydxpskHCF1D4xdyMq6xly0K1PMzcyu8kX2BZ/pdV0PXTkLevTknFOJIEZ s3RB9PFMkNlR43Z84sKkWJFSCdsdJzvtNCnzotua1AzebnQCxj5NDHvTqzLDf3Xlv+ oUsHYY6fjOl2hrS2zNouj/K4CU9bhcg6CU9eqHFU= To: libcamera-devel@lists.libcamera.org Date: Thu, 19 Oct 2023 16:01:25 +0200 Message-ID: <20231019140133.32090-5-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 Subject: [libcamera-devel] [PATCH v6 04/12] libcamera: properties: Make 'Rotation' the mounting rotation X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jacopo Mondi via libcamera-devel From: Jacopo Mondi Reply-To: Jacopo Mondi Cc: Jacopo Mondi Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Specify in the documentation that properties::Rotation specifies the mounting rotation of the camera module. This avoids confusion with the image orientation which is instead expressed by CameraConfiguration::orientation. For this reason, do not compensate the Rotation property when initializing the CameraSensor class but report the value of V4L2_CID_CAMERA_SENSOR_ROTATION or 0 if the control is not available. Signed-off-by: Jacopo Mondi Reviewed-by: David Plowman Reviewed-by: Laurent Pinchart --- src/libcamera/camera_sensor.cpp | 15 +++------------ src/libcamera/property_ids.yaml | 8 ++++---- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index e3826cebeeff..8ff72b424560 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -433,11 +433,11 @@ int CameraSensor::initProperties() /* Retrieve and register properties from the kernel interface. */ const ControlInfoMap &controls = subdev_->controls(); - int32_t propertyValue; const auto &orientation = controls.find(V4L2_CID_CAMERA_ORIENTATION); if (orientation != controls.end()) { int32_t v4l2Orientation = orientation->second.def().get(); + int32_t propertyValue; switch (v4l2Orientation) { default: @@ -462,7 +462,7 @@ int CameraSensor::initProperties() const auto &rotationControl = controls.find(V4L2_CID_CAMERA_SENSOR_ROTATION); if (rotationControl != controls.end()) { - propertyValue = rotationControl->second.def().get(); + int32_t propertyValue = rotationControl->second.def().get(); /* * Cache the Transform associated with the camera mounting @@ -477,20 +477,11 @@ int CameraSensor::initProperties() rotationTransform_ = Transform::Identity; } - /* - * Adjust property::Rotation as validateTransform() compensates - * for the mounting rotation. However, as a camera sensor can - * only compensate rotations by applying H/VFlips, only rotation - * of 180 degrees are automatically compensated. The other valid - * rotations (Rot90 and Rot270) require transposition, which the - * camera sensor cannot perform, so leave them untouched. - */ - if (propertyValue == 180 && supportFlips_) - propertyValue = 0; properties_.set(properties::Rotation, propertyValue); } else { LOG(CameraSensor, Warning) << "Rotation control not available, default to 0 degrees"; + properties_.set(properties::Rotation, 0); rotationTransform_ = Transform::Identity; } diff --git a/src/libcamera/property_ids.yaml b/src/libcamera/property_ids.yaml index 5bddafc29364..f35563842a5a 100644 --- a/src/libcamera/property_ids.yaml +++ b/src/libcamera/property_ids.yaml @@ -29,10 +29,10 @@ controls: - Rotation: type: int32_t description: | - The camera rotation is expressed as the angular difference in degrees - between two reference systems, one relative to the camera module, and - one defined on the external world scene to be captured when projected - on the image sensor pixel array. + The camera physical mounting rotation. It is expressed as the angular + difference in degrees between two reference systems, one relative to the + camera module, and one defined on the external world scene to be + captured when projected on the image sensor pixel array. A camera sensor has a 2-dimensional reference system 'Rc' defined by its pixel array read-out order. The origin is set to the first pixel