From patchwork Mon Jul 24 07:10:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 18866 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 331CCC32AA for ; Mon, 24 Jul 2023 07:11:27 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DA61E628D4; Mon, 24 Jul 2023 09:11:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1690182686; bh=xDK91yoWnPn+8AhlpzdW8lSc0qCCbfllNaIxij+HUQg=; 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=17mpc9u3OTXDX61fc4Ixw3V9/elpfc9+ae8zQ27On5HeUKCofpv6lRHcfWBaltxey EzUjs4cersxS2TqSd0NJWuEWNUuXID+w73zG1HqXnPQaNOUdJrAMOO1n+QI3gxv4Yz Chtm8xwc/+JqEPISFWJo+gSgFm+C2cf/K+tgGnW3hiR/EYrFpw0zkoztN8FnppZrmK 5MK+RhrsBF/UpheVAsi4dHqP9+0fuCYocyULITiOBMi8sTrgSw/JzP4Rp7tfFcAJGx rJMBH/5uRH1pkJlxHGFkJ/ofVEUAAqvo3lJ/gotxkmnPoKZERz6xz5N0tASZB6aLmS OfTGS5qUiCndQ== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5CB5A628CB for ; Mon, 24 Jul 2023 09:11:23 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Cov2X0JP"; dkim-atps=neutral Received: from uno.localdomain (mob-5-91-20-233.net.vodafone.it [5.91.20.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 97BB84AD; Mon, 24 Jul 2023 09:10:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1690182626; bh=xDK91yoWnPn+8AhlpzdW8lSc0qCCbfllNaIxij+HUQg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cov2X0JP7XP/wHSucBCibrOUlUrCJj5WRey1Yo3HIffbJoTyF1s9Azy6ezHyf6GNb c4d8WwkOI2eKfJVH1Rv2rcvQ3eiZp96R2IqA4VbDXNgfIYVsHuJF68zJHYrqcJDd0n HCc8az/3KO3iuHE5lMZqsmXJcCN7A4So63kmHGgA= To: libcamera-devel@lists.libcamera.org Date: Mon, 24 Jul 2023 09:10:55 +0200 Message-Id: <20230724071101.5256-5-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 Subject: [libcamera-devel] [PATCH v4 04/10] 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 --- src/libcamera/camera_sensor.cpp | 11 +---------- src/libcamera/property_ids.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 9a033459742f..3ba364c44a40 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -476,20 +476,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, propertyValue); rotationTransform_ = Transform::Identity; } diff --git a/src/libcamera/property_ids.yaml b/src/libcamera/property_ids.yaml index 5bddafc29364..fb53081c1bd2 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, 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