[{"id":14861,"web_url":"https://patchwork.libcamera.org/comment/14861/","msgid":"<YBSXYb8r1tKdRtCB@oden.dyn.berto.se>","date":"2021-01-29T23:16:49","subject":"Re: [libcamera-devel] [PATCH 3/3] android: camera_device: Use\n\treference to settings","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nThanks for your work.\n\nOn 2021-01-29 15:26:15 +0100, Jacopo Mondi wrote:\n> In preparation to use the keys part of a capture request to\n> fill in the result metadata, instantiate a reference to\n> descriptor_->settings_ and use it.\n\ns/instantiate/create/\ns/and use it//\n\n> \n> While at it, move the 'ret' variable declaration to the beginning of\n> the function and rename it in 'found', as it will be used in many\n> places and move the \\todo comment up as it applies to all metadata\n> whose value is copied from settings.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  src/android/camera_device.cpp | 16 +++++++++++-----\n>  1 file changed, 11 insertions(+), 5 deletions(-)\n> \n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index b66e7c71884a..0c424978838d 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -1936,7 +1936,9 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,\n>  \t\t\t\tint64_t timestamp)\n>  {\n>  \tconst ControlList &metadata = descriptor->request_->metadata();\n> +\tconst CameraMetadata &settings = descriptor->settings_;\n>  \tcamera_metadata_ro_entry_t entry;\n> +\tbool found;\n>  \n>  \t/*\n>  \t * \\todo Keep this in sync with the actual number of entries.\n> @@ -1961,6 +1963,12 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,\n>  \t\treturn nullptr;\n>  \t}\n>  \n> +\t/*\n> +\t * \\todo The value of the results metadata copied from the settings\n> +\t * will have to be passed to the libcamera::Camera and extracted\n> +\t * from libcamera::Request::metadata.\n> +\t */\n> +\n>  \tuint8_t value = ANDROID_CONTROL_AE_ANTIBANDING_MODE_OFF;\n>  \tresultMetadata->addEntry(ANDROID_CONTROL_AE_ANTIBANDING_MODE, &value, 1);\n>  \n> @@ -1975,10 +1983,9 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,\n>  \t\t\t\t aeFpsTarget.data(), aeFpsTarget.size());\n>  \n>  \tvalue = ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_IDLE;\n> -\t/* \\todo Handle IPA appropriately */\n> -\tbool ret = descriptor->settings_.getEntry(ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER, &entry);\n> +\tfound = settings.getEntry(ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER, &entry);\n>  \tresultMetadata->addEntry(ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER,\n> -\t\t\t\t ret ? entry.data.u8 : &value, 1);\n> +\t\t\t\t found ? entry.data.u8 : &value, 1);\n>  \n>  \tvalue = ANDROID_CONTROL_AE_STATE_CONVERGED;\n>  \tresultMetadata->addEntry(ANDROID_CONTROL_AE_STATE, &value, 1);\n> @@ -2022,8 +2029,7 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,\n>  \tvalue = ANDROID_FLASH_STATE_UNAVAILABLE;\n>  \tresultMetadata->addEntry(ANDROID_FLASH_STATE, &value, 1);\n>  \n> -\tret = descriptor->settings_.getEntry(ANDROID_LENS_APERTURE, &entry);\n> -\tif (ret)\n> +\tif (settings.getEntry(ANDROID_LENS_APERTURE, &entry))\n>  \t\tresultMetadata->addEntry(ANDROID_LENS_APERTURE, entry.data.f, 1);\n>  \n>  \tfloat focal_length = 1.0;\n> -- \n> 2.30.0\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","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 5F94ABD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 29 Jan 2021 23:16:53 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2FAFF683C0;\n\tSat, 30 Jan 2021 00:16:53 +0100 (CET)","from mail-lf1-x134.google.com (mail-lf1-x134.google.com\n\t[IPv6:2a00:1450:4864:20::134])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7D8696030A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 30 Jan 2021 00:16:51 +0100 (CET)","by mail-lf1-x134.google.com with SMTP id h7so14768964lfc.6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 29 Jan 2021 15:16:51 -0800 (PST)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\ta6sm102144lfk.104.2021.01.29.15.16.50\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 29 Jan 2021 15:16:50 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com\n\theader.b=\"HLa8U5Ew\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to;\n\tbh=dswjGUbzDlp7VbdReKRu467XKyAigl3PwNiWkpv2o5E=;\n\tb=HLa8U5Ewb0V3N/hSAf2B2Awvt9FOa2qDj2j4kq/cW2jYKOkHSQbymtQygchmsmYVlu\n\tu4v55ojUZu2PyuAItwwCaIrpUpDs84FFmLCiJRP4s8sumoCVdMVp+EvpuFm+OAjIkQfn\n\t1YyhLJ422+//pXPXipPOaZjzFF8mb/kgL887nj0CictE2+8CEcbkXFuD8m6h603KzxQQ\n\tj4YFkg+NDcovhZwftcYK/1fYZC9EGoLmnQ4ShSRrzEmWN0h2Yw2bRzySXHetw6LScU2P\n\tOELsUgVkq8SLB+NgJWMi8zttMmrydn4e88uWtIIfvFO0bUUcSFHMqRI4RY72ZqMY/4yO\n\t3BkQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to;\n\tbh=dswjGUbzDlp7VbdReKRu467XKyAigl3PwNiWkpv2o5E=;\n\tb=DhMUN15ErnEpl3oXy3ql6HG4w2XKlUE6t2+8EWxTLu1no/2TL78HAZ8O+HuoaxpH8P\n\tzLwcaS3nhA2UwXgRGS7r3V/HjY5nhh4WziJJEcJIaMxel9Z/9jvYM38HcTMfoYaHzGH9\n\t0Rg5Sy5WOEMTTxD/qr+PXDXmzaq2vel6OIsLqAhCgSwO1QM1i7XJoZfD2P3cj1Gqhco/\n\tP5BwS804+Ab++ghtmvseLrFj2lvlCQJ0YgAGTDqT/OcYpVBI2Rz7CtydA1PYwUfhDgJM\n\tDvlyrkXYavF/edqLVcIp5kQGQ3hq5C7oCmNUC9tSK2hs3wfoMBl31Ni5Y6fJM/YUMeem\n\txGpQ==","X-Gm-Message-State":"AOAM533HPq8hBXp16IJqcGiatXs4a0hlbq6bGoUxTHPRjudQIh9BlFYj\n\t7Tz3bwiKLdysyczSEgbkN0To+g==","X-Google-Smtp-Source":"ABdhPJz4n5mhNPgHBQkGp8acBpM7thyOAsCUYpL8wPYsFuh8VDR6nQoeaXZLk7KzlDbS/c7KIzBg8w==","X-Received":"by 2002:a19:600b:: with SMTP id\n\tu11mr3162981lfb.483.1611962210984; \n\tFri, 29 Jan 2021 15:16:50 -0800 (PST)","Date":"Sat, 30 Jan 2021 00:16:49 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YBSXYb8r1tKdRtCB@oden.dyn.berto.se>","References":"<20210129142615.669464-1-jacopo@jmondi.org>\n\t<20210129142615.669464-4-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210129142615.669464-4-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH 3/3] android: camera_device: Use\n\treference to settings","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=\"iso-8859-1\"","Content-Transfer-Encoding":"quoted-printable","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":14869,"web_url":"https://patchwork.libcamera.org/comment/14869/","msgid":"<20210201025224.GC3415@pyrite.rasen.tech>","date":"2021-02-01T02:52:24","subject":"Re: [libcamera-devel] [PATCH 3/3] android: camera_device: Use\n\treference to settings","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Hi Jacopo,\n\nOn Fri, Jan 29, 2021 at 03:26:15PM +0100, Jacopo Mondi wrote:\n> In preparation to use the keys part of a capture request to\n> fill in the result metadata, instantiate a reference to\n> descriptor_->settings_ and use it.\n> \n> While at it, move the 'ret' variable declaration to the beginning of\n> the function and rename it in 'found', as it will be used in many\n> places and move the \\todo comment up as it applies to all metadata\n> whose value is copied from settings.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  src/android/camera_device.cpp | 16 +++++++++++-----\n>  1 file changed, 11 insertions(+), 5 deletions(-)\n> \n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index b66e7c71884a..0c424978838d 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -1936,7 +1936,9 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,\n>  \t\t\t\tint64_t timestamp)\n>  {\n>  \tconst ControlList &metadata = descriptor->request_->metadata();\n> +\tconst CameraMetadata &settings = descriptor->settings_;\n>  \tcamera_metadata_ro_entry_t entry;\n> +\tbool found;\n>  \n>  \t/*\n>  \t * \\todo Keep this in sync with the actual number of entries.\n> @@ -1961,6 +1963,12 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,\n>  \t\treturn nullptr;\n>  \t}\n>  \n> +\t/*\n> +\t * \\todo The value of the results metadata copied from the settings\n> +\t * will have to be passed to the libcamera::Camera and extracted\n> +\t * from libcamera::Request::metadata.\n> +\t */\n> +\n>  \tuint8_t value = ANDROID_CONTROL_AE_ANTIBANDING_MODE_OFF;\n>  \tresultMetadata->addEntry(ANDROID_CONTROL_AE_ANTIBANDING_MODE, &value, 1);\n>  \n> @@ -1975,10 +1983,9 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,\n>  \t\t\t\t aeFpsTarget.data(), aeFpsTarget.size());\n>  \n>  \tvalue = ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_IDLE;\n> -\t/* \\todo Handle IPA appropriately */\n> -\tbool ret = descriptor->settings_.getEntry(ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER, &entry);\n> +\tfound = settings.getEntry(ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER, &entry);\n>  \tresultMetadata->addEntry(ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER,\n> -\t\t\t\t ret ? entry.data.u8 : &value, 1);\n> +\t\t\t\t found ? entry.data.u8 : &value, 1);\n>  \n>  \tvalue = ANDROID_CONTROL_AE_STATE_CONVERGED;\n>  \tresultMetadata->addEntry(ANDROID_CONTROL_AE_STATE, &value, 1);\n> @@ -2022,8 +2029,7 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,\n>  \tvalue = ANDROID_FLASH_STATE_UNAVAILABLE;\n>  \tresultMetadata->addEntry(ANDROID_FLASH_STATE, &value, 1);\n>  \n> -\tret = descriptor->settings_.getEntry(ANDROID_LENS_APERTURE, &entry);\n> -\tif (ret)\n> +\tif (settings.getEntry(ANDROID_LENS_APERTURE, &entry))\n>  \t\tresultMetadata->addEntry(ANDROID_LENS_APERTURE, entry.data.f, 1);\n>  \n>  \tfloat focal_length = 1.0;\n> -- \n> 2.30.0\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","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 DC6C9BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  1 Feb 2021 02:52:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6E9AD683E2;\n\tMon,  1 Feb 2021 03:52:35 +0100 (CET)","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 758B160107\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  1 Feb 2021 03:52:33 +0100 (CET)","from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A36598B5;\n\tMon,  1 Feb 2021 03:52:30 +0100 (CET)"],"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=\"p6iRF8iS\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1612147953;\n\tbh=AH1BPPe+hCOGwPHqp/dspGTvkwNq0JWazezhNhNCOlA=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=p6iRF8iSNcn5KArtCObIZ3dOlN+NZUY7EjOdEF4ljDyLJcwFllJmTYJOjGVkf4Kty\n\tQLJfEAfK/hSyUdZJAeVVf3MmBeXYy3DYBw+YLVWolgwG4SU/YSWLIVFnVoM4R0djCu\n\tNaiXu1/z8ZT8L942vX3+V98W/C24EFc1kdU27Fgo=","Date":"Mon, 1 Feb 2021 11:52:24 +0900","From":"paul.elder@ideasonboard.com","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<20210201025224.GC3415@pyrite.rasen.tech>","References":"<20210129142615.669464-1-jacopo@jmondi.org>\n\t<20210129142615.669464-4-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210129142615.669464-4-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH 3/3] android: camera_device: Use\n\treference to settings","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>"}}]