{"id":9546,"url":"https://patchwork.libcamera.org/api/1.1/patches/9546/?format=json","web_url":"https://patchwork.libcamera.org/patch/9546/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20200909073833.16465-1-email@uajain.com>","date":"2020-09-09T07:38:33","name":"[libcamera-devel] android: camera_device: Fix value of orientation metadata","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"66d0ebcc588b7f80ad3a72d4ef451bb1bec9219f","submitter":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/people/1/?format=json","name":"Umang Jain","email":"email@uajain.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/9546/mbox/","series":[{"id":1276,"url":"https://patchwork.libcamera.org/api/1.1/series/1276/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1276","date":"2020-09-09T07:38:33","name":"[libcamera-devel] android: camera_device: Fix value of orientation metadata","version":1,"mbox":"https://patchwork.libcamera.org/series/1276/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/9546/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/9546/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 5BC1DBDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  9 Sep 2020 07:38:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DDD1C62C30;\n\tWed,  9 Sep 2020 09:38:48 +0200 (CEST)","from mail.uajain.com (static.126.159.217.95.clients.your-server.de\n\t[95.217.159.126])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B45B4603ED\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  9 Sep 2020 09:38:46 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=uajain.com header.i=@uajain.com\n\theader.b=\"EVk7ORoH\"; dkim-atps=neutral","From":"Umang Jain <email@uajain.com>","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=uajain.com; s=mail;\n\tt=1599637125; bh=miYIMDtRDfzDxoBql3h+SttZ8edwZs//iIdwrmg7Ruk=;\n\th=From:To:Cc:Subject;\n\tb=EVk7ORoHpty0VnmoxTqtYMMjh0BZaaErzRgjMMtkoa9PBF+y8JHEz6VDziJLklX6m\n\tE9johdsTQf1BCbSS0WcrFshhNqUuJLY6gIcqwfNQMH/MqJvR6pUNT1/dp/B64A3TLn\n\tACMmaglaf7aszpNTbPummre7u2/1xW8wRuuWnPog99uWzlgoVGG0K9Kku6gh268wkv\n\t02IcjPBX+Y64vUzNJzcx6jNyXHcPnsj4RyZ2fXVVhgeYVyOYYn6Aewe4/dW8pC1zbg\n\t4eKzScizBhxyS7xOadpwT+jAgNuz7GPvGkwVaSOWXaEi+Pc4LpuC09sE9PfgSjDzqy\n\t0aQVasqUNG5Dg==","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  9 Sep 2020 13:08:33 +0530","Message-Id":"<20200909073833.16465-1-email@uajain.com>","Mime-Version":"1.0","Subject":"[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>","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>"},"content":"Android's orientation metadata cannot have identical numerical\nvalue to libcamera's rotation property. This is due to the fact\nthat libcamera's rotation property specify the correction angle\nin anti-clockwise direction whereas Android's orientation metadata\nspecifies the value in clockwise direction. Fix that by computing\ncorresponding value for clockwise direction from libcamera's rotation\nproperty.\n\nSigned-off-by: Umang Jain <email@uajain.com>\n---\n src/android/camera_device.cpp | 15 ++++++++++-----\n 1 file changed, 10 insertions(+), 5 deletions(-)","diff":"diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 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+\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+\t\torientation_ = (360 - libcameraRotation) % 360;\n+\t}\n \n \tint ret = camera_->acquire();\n \tif (ret) {\n","prefixes":["libcamera-devel"]}