[{"id":16178,"web_url":"https://patchwork.libcamera.org/comment/16178/","msgid":"<CAO5uPHNppU4UCoVZec=U1A-TMVvd90kubyp+-0jQiCMKeXX3Qw@mail.gmail.com>","date":"2021-04-12T13:08:29","subject":"Re: [libcamera-devel] [PATCH v4 3/3] android: camera_device: Report\n\tsensor physical size","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"content":"Hi Jacopo, thanks for the patch.\n\nOn Mon, Apr 12, 2021 at 4:56 PM Jacopo Mondi <jacopo@jmondi.org> wrote:\n>\n> Calculate the value of the ANDROID_SENSOR_INFO_PHYSICAL_SIZE property\n> multiplying the number of sensor's readable pixels with the pixel unit\n> cell size if provided by the Camera.\n>\n> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/android/camera_device.cpp | 30 ++++++++++++++++--------------\n>  1 file changed, 16 insertions(+), 14 deletions(-)\n>\n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index 89044efa7ebe..754ee00af472 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -9,6 +9,7 @@\n>  #include \"camera_ops.h\"\n>  #include \"post_processor.h\"\n>\n> +#include <array>\n>  #include <cmath>\n>  #include <fstream>\n>  #include <sys/mman.h>\n> @@ -1026,15 +1027,23 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n>         staticMetadata_->addEntry(ANDROID_JPEG_MAX_SIZE, &maxJpegBufferSize_, 1);\n>\n>         /* Sensor static metadata. */\n> +       std::array<int32_t, 2> pixelArraySize;\n>         {\n> -               const Size &size =\n> -                       properties.get(properties::PixelArraySize);\n> -               std::vector<int32_t> data{\n> -                       static_cast<int32_t>(size.width),\n> -                       static_cast<int32_t>(size.height),\n> -               };\n> +               const Size &size = properties.get(properties::PixelArraySize);\n> +               pixelArraySize[0] = size.width;\n> +               pixelArraySize[1] = size.height;\n>                 staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE,\n> -                                         data.data(), data.size());\n> +                                         pixelArraySize.data(), pixelArraySize.size());\n> +       }\n> +\n> +       if (properties.contains(properties::UnitCellSize)) {\n> +               const Size &cellSize = properties.get<Size>(properties::UnitCellSize);\n> +               std::array<float, 2> physicalSize{\n> +                       cellSize.width * pixelArraySize[0] / 1e6f,\n> +                       cellSize.height * pixelArraySize[1] / 1e6f\n> +               };\n> +               staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PHYSICAL_SIZE,\n> +                                         physicalSize.data(), physicalSize.size());\n>         }\n>\n>         {\n> @@ -1082,13 +1091,6 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n>                                   testPatterModes.data(),\n>                                   testPatterModes.size());\n>\n> -       std::vector<float> physicalSize = {\n> -               2592, 1944,\n> -       };\n> -       staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PHYSICAL_SIZE,\n> -                                 physicalSize.data(),\n> -                                 physicalSize.size());\n> -\n>         uint8_t timestampSource = ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN;\n>         staticMetadata_->addEntry(ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE,\n>                                   &timestampSource, 1);\n> --\n> 2.31.1\n>\n\nReviewed-by: Hirokazu Honda <hiroh@chromium.org>\n\n-Hiro\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 AE153BD224\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 12 Apr 2021 13:08:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6DB59687F3;\n\tMon, 12 Apr 2021 15:08:43 +0200 (CEST)","from mail-ej1-x633.google.com (mail-ej1-x633.google.com\n\t[IPv6:2a00:1450:4864:20::633])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 61DDD602C8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Apr 2021 15:08:42 +0200 (CEST)","by mail-ej1-x633.google.com with SMTP id n2so20133322ejy.7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Apr 2021 06:08:42 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"mg83IHVs\"; 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:content-transfer-encoding;\n\tbh=LdgHzoUh99fQncj11lVCDVqPP7Oe5bJa98CM6xnua8Y=;\n\tb=mg83IHVseO37bs0L76Nr2gK7ljK1MdDvc157TQPHABqyyfBxrVilQcnrPHw3FJ+Kur\n\tWYOfG00RneWXVFmuWcr1RPfPrNkZBqjyAG/gm91SDBtQQe9OKtKvGzSUZwARdR4ZZQKX\n\t4VeAMhPsLrepDTeJiwxRHX6JXTXAiE4aqM5AA=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc:content-transfer-encoding;\n\tbh=LdgHzoUh99fQncj11lVCDVqPP7Oe5bJa98CM6xnua8Y=;\n\tb=ckYuCcyWqepQHTh/MjGDH64mi70QW0Ex+820BDWrd9rjBVNgc5oqgcBxjZh2zzCwN/\n\tN2ERJjNCa+vC4fHzpgNxRkRwbqKtH7Rv1ttaSTWfIERm4da0YKrPENApt5d7Fw0H8pAS\n\tFcnDyRi275fZDdcfaevyeIhy706rjZYmIQCjzKfUDRidzquiZrVHg8KK4bJ2rnMVSWo1\n\tM9uDP8q9nt7zx4IkJ6A1JTE4KDZchg2dI+TgzGYoMV/jNqWCTDmpCB1OvcX35W9ZYLWQ\n\thSsMxYi3cGoRjxWfb89sIxuwSAK8VMDeHfuvWnNV3qOJf4iGknCW1RQT1Wn7bK4h9zGD\n\tcUGQ==","X-Gm-Message-State":"AOAM531YpcDfp7RVkAp7IoU57p/SOGTaTtn8wyWmHLUNDNrew/1VXG+d\n\t1vU/8bYgjGySXlgkj5qW6r6tcKpvkCvw1FlwqF+0g8PaNzB7bg==","X-Google-Smtp-Source":"ABdhPJzXMeJtTueX+/fCHpaZpIIp+ijYPDydsfaKzcHf76MbYZxPwLrfC24bHezNldd9XYacHe6IAEcWLNfe+bkN9x8=","X-Received":"by 2002:a17:906:b890:: with SMTP id\n\thb16mr4655975ejb.221.1618232922098; \n\tMon, 12 Apr 2021 06:08:42 -0700 (PDT)","MIME-Version":"1.0","References":"<20210412075702.9955-1-jacopo@jmondi.org>\n\t<20210412075702.9955-4-jacopo@jmondi.org>","In-Reply-To":"<20210412075702.9955-4-jacopo@jmondi.org>","From":"Hirokazu Honda <hiroh@chromium.org>","Date":"Mon, 12 Apr 2021 22:08:29 +0900","Message-ID":"<CAO5uPHNppU4UCoVZec=U1A-TMVvd90kubyp+-0jQiCMKeXX3Qw@mail.gmail.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH v4 3/3] android: camera_device: Report\n\tsensor physical size","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>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":16201,"web_url":"https://patchwork.libcamera.org/comment/16201/","msgid":"<YHT4nlrAsyJ7QtJz@pendragon.ideasonboard.com>","date":"2021-04-13T01:49:18","subject":"Re: [libcamera-devel] [PATCH v4 3/3] android: camera_device: Report\n\tsensor physical size","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Mon, Apr 12, 2021 at 09:57:02AM +0200, Jacopo Mondi wrote:\n> Calculate the value of the ANDROID_SENSOR_INFO_PHYSICAL_SIZE property\n> multiplying the number of sensor's readable pixels with the pixel unit\n> cell size if provided by the Camera.\n> \n> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  src/android/camera_device.cpp | 30 ++++++++++++++++--------------\n>  1 file changed, 16 insertions(+), 14 deletions(-)\n> \n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index 89044efa7ebe..754ee00af472 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -9,6 +9,7 @@\n>  #include \"camera_ops.h\"\n>  #include \"post_processor.h\"\n>  \n> +#include <array>\n>  #include <cmath>\n>  #include <fstream>\n>  #include <sys/mman.h>\n> @@ -1026,15 +1027,23 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n>  \tstaticMetadata_->addEntry(ANDROID_JPEG_MAX_SIZE, &maxJpegBufferSize_, 1);\n>  \n>  \t/* Sensor static metadata. */\n> +\tstd::array<int32_t, 2> pixelArraySize;\n>  \t{\n> -\t\tconst Size &size =\n> -\t\t\tproperties.get(properties::PixelArraySize);\n> -\t\tstd::vector<int32_t> data{\n> -\t\t\tstatic_cast<int32_t>(size.width),\n> -\t\t\tstatic_cast<int32_t>(size.height),\n> -\t\t};\n> +\t\tconst Size &size = properties.get(properties::PixelArraySize);\n> +\t\tpixelArraySize[0] = size.width;\n> +\t\tpixelArraySize[1] = size.height;\n>  \t\tstaticMetadata_->addEntry(ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE,\n> -\t\t\t\t\t  data.data(), data.size());\n> +\t\t\t\t\t  pixelArraySize.data(), pixelArraySize.size());\n> +\t}\n> +\n> +\tif (properties.contains(properties::UnitCellSize)) {\n> +\t\tconst Size &cellSize = properties.get<Size>(properties::UnitCellSize);\n> +\t\tstd::array<float, 2> physicalSize{\n> +\t\t\tcellSize.width * pixelArraySize[0] / 1e6f,\n> +\t\t\tcellSize.height * pixelArraySize[1] / 1e6f\n> +\t\t};\n> +\t\tstaticMetadata_->addEntry(ANDROID_SENSOR_INFO_PHYSICAL_SIZE,\n> +\t\t\t\t\t  physicalSize.data(), physicalSize.size());\n>  \t}\n>  \n>  \t{\n> @@ -1082,13 +1091,6 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n>  \t\t\t\t  testPatterModes.data(),\n>  \t\t\t\t  testPatterModes.size());\n>  \n> -\tstd::vector<float> physicalSize = {\n> -\t\t2592, 1944,\n> -\t};\n> -\tstaticMetadata_->addEntry(ANDROID_SENSOR_INFO_PHYSICAL_SIZE,\n> -\t\t\t\t  physicalSize.data(),\n> -\t\t\t\t  physicalSize.size());\n> -\n>  \tuint8_t timestampSource = ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN;\n>  \tstaticMetadata_->addEntry(ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE,\n>  \t\t\t\t  &timestampSource, 1);","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 7127CBD1F6\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 13 Apr 2021 01:50:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ECD3E687EC;\n\tTue, 13 Apr 2021 03:50:10 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D64C8605AE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Apr 2021 03:50:08 +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 4E5286F2;\n\tTue, 13 Apr 2021 03:50:08 +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=\"RVF78Iht\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1618278608;\n\tbh=KJuXhYLnTpbQ8VmFhcRwi3/lGOrO4/sz/PJppQdW6DA=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=RVF78IhtI5zm+q1fl+q0XaVndzL0g+dQAiz0dyrO5gB7lXQGB8W1F60i6yTO21Gi+\n\tf2tpnE2vpmMwWLsHqrPtaloZLIct57n/BD+nSxLQu/l3rSjOricpm1bQpIV6W55QGq\n\tkX3f9C4Ks2LKyGj5qlSL6d4ZdWbEnES8SizbTDWM=","Date":"Tue, 13 Apr 2021 04:49:18 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YHT4nlrAsyJ7QtJz@pendragon.ideasonboard.com>","References":"<20210412075702.9955-1-jacopo@jmondi.org>\n\t<20210412075702.9955-4-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210412075702.9955-4-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH v4 3/3] android: camera_device: Report\n\tsensor physical size","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=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]