[{"id":12389,"web_url":"https://patchwork.libcamera.org/comment/12389/","msgid":"<20200909074252.GA3931@pendragon.ideasonboard.com>","date":"2020-09-09T07:42:52","subject":"Re: [libcamera-devel] [PATCH] android: camera_device: Fix value of\n\torientation metadata","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Umang,\n\nThank you for the patch.\n\nOn Wed, Sep 09, 2020 at 01:08:33PM +0530, Umang Jain wrote:\n> Android's orientation metadata cannot have identical numerical\n> value to libcamera's rotation property. This is due to the fact\n> that libcamera's rotation property specify the correction angle\n> in anti-clockwise direction whereas Android's orientation metadata\n\ns/anti-clockwise/anticlockwise/\n\n> specifies the value in clockwise direction. Fix that by computing\n> corresponding value for clockwise direction from libcamera's rotation\n> property.\n> \n> Signed-off-by: Umang Jain <email@uajain.com>\n> ---\n>  src/android/camera_device.cpp | 15 ++++++++++-----\n>  1 file changed, 10 insertions(+), 5 deletions(-)\n> \n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index 2582991..35aa6c4 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -265,12 +265,17 @@ int CameraDevice::initialize()\n>  \t}\n>  \n>  \t/*\n> -\t * The Android orientation metadata and libcamera rotation property are\n> -\t * defined differently but have identical numerical values for Android\n> -\t * devices such as phones and tablets.\n> +\t * The Android orientation metadata specifies its rotation correction\n> +\t * value in clockwise direction whereas libcamera specifies the\n> +\t * rotation property in anti-clockwise direction. Read the libcamera's\n> +\t * rotation property(anti-clockwise) and compute the corresponding\n\ns/property/property /\n\n> +\t * value for clockwise direction as required by the Android orientation\n> +\t * metadata.\n>  \t */\n> -\tif (properties.contains(properties::Rotation))\n> -\t\torientation_ = properties.get(properties::Rotation);\n> +\tif (properties.contains(properties::Rotation)) {\n> +\t\tint libcameraRotation = properties.get(properties::Rotation);\n\nThe variable could just be named rotation.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\t\torientation_ = (360 - libcameraRotation) % 360;\n> +\t}\n>  \n>  \tint ret = camera_->acquire();\n>  \tif (ret) {","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 01ACDBDB1D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  9 Sep 2020 07:43:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8D40862C30;\n\tWed,  9 Sep 2020 09:43:20 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 22F4B603ED\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  9 Sep 2020 09:43:19 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0C4809DF;\n\tWed,  9 Sep 2020 09:43:17 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"ajpU6Ut8\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1599637398;\n\tbh=sGy278f1uOAtxsEKvUfhbpiJ3RIDEkqv3gpLiFkK/Ug=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=ajpU6Ut897nhhFqUC0MUtAmtfUSkD7u8Kl+b4mWJ0H4Y0AF+uoUTx1kIG2M31PFBB\n\tcffKVysG9cjI4ibqHB0hw20x5REghb6U63sTL1GUJC1gXIN8pl51XEPkNDaOGQHYBr\n\tCNgyn6KbEskFjv/bnvKjBCGWRICNqSqwYfu9gwAE=","Date":"Wed, 9 Sep 2020 10:42:52 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Umang Jain <email@uajain.com>","Message-ID":"<20200909074252.GA3931@pendragon.ideasonboard.com>","References":"<20200909073833.16465-1-email@uajain.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200909073833.16465-1-email@uajain.com>","Subject":"Re: [libcamera-devel] [PATCH] android: camera_device: Fix value of\n\torientation metadata","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]