[{"id":17831,"web_url":"https://patchwork.libcamera.org/comment/17831/","msgid":"<YNkk536FyLffXAkB@pendragon.ideasonboard.com>","date":"2021-06-28T01:24:55","subject":"Re: [libcamera-devel] [RFC PATCH 06/14] android: Plumb AeEnable\n\tcontrol","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Paul,\n\nThank you for the patch.\n\nOn Fri, Jun 18, 2021 at 07:33:43PM +0900, Paul Elder wrote:\n> Plumb the AeEnable control into the HAL for CONTROL_AE_AVAILABLE_MODES\n> for static metadata, and CONTROL_AE_MODE for result metadata.\n> \n> Bug: https://bugs.libcamera.org/show_bug.cgi?id=42\n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> ---\n>  src/android/camera_device.cpp | 28 +++++++++++++++++++++++-----\n>  1 file changed, 23 insertions(+), 5 deletions(-)\n> \n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index 86f47e00..3446cdb6 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -10,6 +10,7 @@\n>  #include \"camera_ops.h\"\n>  #include \"post_processor.h\"\n>  \n> +#include <algorithm>\n>  #include <array>\n>  #include <cmath>\n>  #include <fstream>\n> @@ -877,9 +878,24 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n>  \tstaticMetadata_->addEntry(ANDROID_CONTROL_AE_AVAILABLE_ANTIBANDING_MODES,\n>  \t\t\t\t  aeAvailableAntiBandingModes);\n>  \n> -\tstd::vector<uint8_t> aeAvailableModes = {\n> -\t\tANDROID_CONTROL_AE_MODE_ON,\n> -\t};\n> +\tstd::vector<uint8_t> aeAvailableModes;\n> +\taeAvailableModes.reserve(2);\n> +\tconst auto &aeModesInfo = controlsInfo.find(&controls::AeEnable);\n> +\tif (aeModesInfo != controlsInfo.end()) {\n> +\t\taeAvailableModes.push_back(aeModesInfo->second.min().get<bool>());\n> +\t\tif (aeModesInfo->second.min() != aeModesInfo->second.max())\n> +\t\t\taeAvailableModes.push_back(aeModesInfo->second.max().get<bool>());\n> +\t} else {\n> +\t\taeAvailableModes.push_back(ANDROID_CONTROL_AE_MODE_ON);\n> +\t}\n> +\n> +\tif (std::find(aeAvailableModes.begin(),\n> +\t\t      aeAvailableModes.end(),\n> +\t\t      ANDROID_CONTROL_AE_MODE_OFF) == aeAvailableModes.end()) {\n> +\t\tfullSupport = false;\n> +\t\t/* \\todo Double check if this is the correct capability */\n\nSeems fine to me.\n\n> +\t\tcapabilities[ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR] = false;\n> +\t}\n>  \tstaticMetadata_->addEntry(ANDROID_CONTROL_AE_AVAILABLE_MODES,\n>  \t\t\t\t  aeAvailableModes);\n>  \n> @@ -2333,8 +2349,10 @@ CameraDevice::getResultMetadata(const Camera3RequestDescriptor &descriptor) cons\n>  \tvalue = ANDROID_CONTROL_AE_LOCK_OFF;\n>  \tresultMetadata->addEntry(ANDROID_CONTROL_AE_LOCK, value);\n>  \n> -\tvalue = ANDROID_CONTROL_AE_MODE_ON;\n> -\tresultMetadata->addEntry(ANDROID_CONTROL_AE_MODE, value);\n> +\tif (metadata.contains(controls::AeEnable)) {\n> +\t\tuint8_t aeMode = metadata.get<bool>(controls::AeEnable);\n\nI'd make this more explicit, with\n\n\t\tuint8_t aeMode = metadata.get<bool>(controls::AeEnable)\n\t\t\t       ? ANDROID_CONTROL_AE_MODE_ON\n\t\t\t       : ANDROID_CONTROL_AE_MODE_OFF;\n\nIt would also be nice for the code above to do something similar.\n\n> +\t\tresultMetadata->addEntry(ANDROID_CONTROL_AE_MODE, aeMode);\n> +\t}\n>  \n>  \tif (settings.getEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE, &entry))\n>  \t\t/*","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 12E10C321A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 28 Jun 2021 01:25:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 611E8684D5;\n\tMon, 28 Jun 2021 03:24:59 +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 2A46B6028C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 28 Jun 2021 03:24:57 +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 8C3E757E;\n\tMon, 28 Jun 2021 03:24:56 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"N6oObq9e\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1624843496;\n\tbh=bAIQED2egGG3pRRECBHwtST9qH0xdxa37Vwb2l0VAJ0=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=N6oObq9e6duOXMvwTt0ze2Xy+rzr1wwkcy71SRQ94kVRmvofHvkcbzYrVaxWzp1+z\n\tQoFp3JTHZMVduEj++JXaNyb0rcAMkpmlc123e4+7X4XKfms40xbOBGe4zUlONk2MY0\n\tZhX0bhMvVs904D9oTCbJ5Le70XWsNm1oUQgc4hOE=","Date":"Mon, 28 Jun 2021 04:24:55 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Paul Elder <paul.elder@ideasonboard.com>","Message-ID":"<YNkk536FyLffXAkB@pendragon.ideasonboard.com>","References":"<20210618103351.1642060-1-paul.elder@ideasonboard.com>\n\t<20210618103351.1642060-7-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20210618103351.1642060-7-paul.elder@ideasonboard.com>","Subject":"Re: [libcamera-devel] [RFC PATCH 06/14] android: Plumb AeEnable\n\tcontrol","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","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]