[{"id":19873,"web_url":"https://patchwork.libcamera.org/comment/19873/","msgid":"<CAO5uPHMzmgK_-+ER-UQy7j-HQA-SzJ39Mg1Coo=f87Akp_g7-A@mail.gmail.com>","date":"2021-09-27T11:10:44","subject":"Re: [libcamera-devel] [PATCH v4 1/2] android: camera_capabilities:\n\tClarify CameraMetadata allocation","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"content":"Hi Umang, thank you for the patch.\n\nOn Thu, Sep 23, 2021 at 5:38 PM Umang Jain <umang.jain@ideasonboard.com> wrote:\n>\n> CameraMetadata's constructor take in number of entries and number of\n> bytes to be allocated for those entries. However, CameraMetadata is\n> already capable of resizing its container on the fly, in case more\n> entries are added to it. Hence, the numbers passed in during the\n> construction acts as hint values for initialization.\n>\n> Clarify this in CameraCapabilities::requestTemplatePreview() and\n> remove the \\todo, as the arguments and the \\todo gives the perspective\n> that we need to be quite accurate with the numbers of entries / bytes,\n> which is not the case.\n>\n> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>\n> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\nReviewed-by: Hirokazu Honda <hiroh@chromium.org>\n\n> ---\n>  src/android/camera_capabilities.cpp | 8 ++++++--\n>  1 file changed, 6 insertions(+), 2 deletions(-)\n>\n> diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp\n> index e92bca42..edeb6943 100644\n> --- a/src/android/camera_capabilities.cpp\n> +++ b/src/android/camera_capabilities.cpp\n> @@ -1340,8 +1340,12 @@ std::unique_ptr<CameraMetadata> CameraCapabilities::requestTemplateManual() cons\n>  std::unique_ptr<CameraMetadata> CameraCapabilities::requestTemplatePreview() const\n>  {\n>         /*\n> -        * \\todo Keep this in sync with the actual number of entries.\n> -        * Currently: 20 entries, 35 bytes\n> +        * Give initial hint of entries and number of bytes to be allocated.\n> +        * It is deliberate that the hint is slightly larger than required, to\n> +        * avoid resizing the container.\n> +        *\n> +        * CameraMetadata is capable of resizing the container on the fly, if\n> +        * adding a new entry will exceed its capacity.\n>          */\n>         auto requestTemplate = std::make_unique<CameraMetadata>(21, 36);\n>         if (!requestTemplate->isValid()) {\n> --\n> 2.31.1\n>","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 DABFBBDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 27 Sep 2021 11:10:56 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9D31E6918D;\n\tMon, 27 Sep 2021 13:10:56 +0200 (CEST)","from mail-ed1-x536.google.com (mail-ed1-x536.google.com\n\t[IPv6:2a00:1450:4864:20::536])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E38FB69189\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Sep 2021 13:10:54 +0200 (CEST)","by mail-ed1-x536.google.com with SMTP id b26so19304895edt.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Sep 2021 04:10:54 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"jFuEEbYB\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=g7jgyLTPskTFR1V4gprLW04PWCXboru6t0gAZS8fj4o=;\n\tb=jFuEEbYBwsJKDZam1sSNYCtUeBpK0vbzRdM4REdVWctd6wTbRxP7WUltpWhPEqMcRj\n\tcKX4xfMGmzSth+qU6HBJEnIwK5YPrdy6BFrfIVaOd+U3JsmOSR1r6gdi+gf7fIaAaWXz\n\tuTyiIy1WOta5SJTbPWunpz4DaZsPY00R9nCBM=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=g7jgyLTPskTFR1V4gprLW04PWCXboru6t0gAZS8fj4o=;\n\tb=tS8QiCnpCq4gKnYHhWph6gUsIUka6f4Ahq5GmfGS/NBTbFzfg+le1PmJTFhVBSYt9m\n\tQi38lIpM2CkHdIeZU/X44XyUmeUbXFdxusOwJf8/G6TgO7SvUm1vX82ZDnfpVD+/bgKp\n\tNwPemaqvqMp68xsc2o/mSFb25d912Kh48fo6DgeUrNdtnf/2LCBCdg8xNq5rQ0UmLnNK\n\tW1VAwxvMfkD4SsWMLw9SU+VPdxmEbcZKOeblRhvb+r8dkVmNmNSgN3XyrNLtHRtN7Ewg\n\tzwwW6vvCu3FFvcu8IYcj5cfprDPnkM1BdqO/vYQnzUX9GGhbIOQqIQpibxOnFkz1joON\n\tuxTg==","X-Gm-Message-State":"AOAM531CdGcTqynvFzn8trk+K4XWygg3iH6EmHHcdzNbjLE8JdUSNngo\n\t3fni2+khGFguk/FISKm9mYDNZpmMpLu5wRdYVf9/YrNtOeY=","X-Google-Smtp-Source":"ABdhPJwPfDuJZhaE52UsjD8uVwQYq9F1w6o19InN04MkA+mVooI+lH5eLyIKjkBlG1i04SMEehXAus+lYAqSYsUPGDk=","X-Received":"by 2002:a17:906:1f49:: with SMTP id\n\td9mr27253702ejk.150.1632741054641; \n\tMon, 27 Sep 2021 04:10:54 -0700 (PDT)","MIME-Version":"1.0","References":"<20210923083748.146265-1-umang.jain@ideasonboard.com>\n\t<20210923083748.146265-2-umang.jain@ideasonboard.com>","In-Reply-To":"<20210923083748.146265-2-umang.jain@ideasonboard.com>","From":"Hirokazu Honda <hiroh@chromium.org>","Date":"Mon, 27 Sep 2021 20:10:44 +0900","Message-ID":"<CAO5uPHMzmgK_-+ER-UQy7j-HQA-SzJ39Mg1Coo=f87Akp_g7-A@mail.gmail.com>","To":"Umang Jain <umang.jain@ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH v4 1/2] android: camera_capabilities:\n\tClarify CameraMetadata allocation","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 <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":19894,"web_url":"https://patchwork.libcamera.org/comment/19894/","msgid":"<20210927194018.coryhswpnktvdwm7@uno.localdomain>","date":"2021-09-27T19:40:18","subject":"Re: [libcamera-devel] [PATCH v4 1/2] android: camera_capabilities:\n\tClarify CameraMetadata allocation","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Umang,\n\nOn Thu, Sep 23, 2021 at 02:07:47PM +0530, Umang Jain wrote:\n> CameraMetadata's constructor take in number of entries and number of\n> bytes to be allocated for those entries. However, CameraMetadata is\n> already capable of resizing its container on the fly, in case more\n> entries are added to it. Hence, the numbers passed in during the\n> construction acts as hint values for initialization.\n>\n> Clarify this in CameraCapabilities::requestTemplatePreview() and\n> remove the \\todo, as the arguments and the \\todo gives the perspective\n> that we need to be quite accurate with the numbers of entries / bytes,\n> which is not the case.\n>\n> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>\n> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\nIndeed, I got you to worry about a non-issue here, sorry about that\n\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/android/camera_capabilities.cpp | 8 ++++++--\n>  1 file changed, 6 insertions(+), 2 deletions(-)\n>\n> diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp\n> index e92bca42..edeb6943 100644\n> --- a/src/android/camera_capabilities.cpp\n> +++ b/src/android/camera_capabilities.cpp\n> @@ -1340,8 +1340,12 @@ std::unique_ptr<CameraMetadata> CameraCapabilities::requestTemplateManual() cons\n>  std::unique_ptr<CameraMetadata> CameraCapabilities::requestTemplatePreview() const\n>  {\n>  \t/*\n> -\t * \\todo Keep this in sync with the actual number of entries.\n> -\t * Currently: 20 entries, 35 bytes\n> +\t * Give initial hint of entries and number of bytes to be allocated.\n> +\t * It is deliberate that the hint is slightly larger than required, to\n> +\t * avoid resizing the container.\n> +\t *\n> +\t * CameraMetadata is capable of resizing the container on the fly, if\n> +\t * adding a new entry will exceed its capacity.\n>  \t */\n>  \tauto requestTemplate = std::make_unique<CameraMetadata>(21, 36);\n>  \tif (!requestTemplate->isValid()) {\n> --\n> 2.31.1\n>","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 5081CC3243\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 27 Sep 2021 19:39:33 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BB4DC6918B;\n\tMon, 27 Sep 2021 21:39:32 +0200 (CEST)","from relay11.mail.gandi.net (relay11.mail.gandi.net\n\t[217.70.178.231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A27BA6012C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Sep 2021 21:39:31 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby relay11.mail.gandi.net (Postfix) with ESMTPSA id 1720B100004;\n\tMon, 27 Sep 2021 19:39:30 +0000 (UTC)"],"Date":"Mon, 27 Sep 2021 21:40:18 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Umang Jain <umang.jain@ideasonboard.com>","Message-ID":"<20210927194018.coryhswpnktvdwm7@uno.localdomain>","References":"<20210923083748.146265-1-umang.jain@ideasonboard.com>\n\t<20210923083748.146265-2-umang.jain@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20210923083748.146265-2-umang.jain@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v4 1/2] android: camera_capabilities:\n\tClarify CameraMetadata allocation","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>"}}]