[{"id":15912,"web_url":"https://patchwork.libcamera.org/comment/15912/","msgid":"<YF0UHpzNB4/d4RQP@oden.dyn.berto.se>","date":"2021-03-25T22:52:14","subject":"Re: [libcamera-devel] [PATCH v3 3/3] android: camera_device: Report\n\tsensor physical size","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-03-25 14:51:16 +0100, 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> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/android/camera_device.cpp | 25 +++++++++++++------------\n>  1 file changed, 13 insertions(+), 12 deletions(-)\n> \n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index 5fbf6f82ee9a..1d94e3a0b6ab 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -931,15 +931,23 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n>  \tstaticMetadata_->addEntry(ANDROID_JPEG_MAX_SIZE, &maxJpegBufferSize_, 1);\n>  \n>  \t/* Sensor static metadata. */\n> +\tint32_t pixelArraySize[2];\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\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, 2);\n> +\t}\n> +\n> +\tif (properties.contains(properties::UnitCellSize)) {\n> +\t\tstd::vector<float> physicalSize(2);\n\nI'm not sure what is 'nicer' int32_t pixelArraySize[2] or \nstd::vector<float> physicalSize(2) (and the different addEntry() \nstyles), but I think you should pick on or the other.\n\nWhit this aligned,\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> +\t\tconst Size &size = properties.get<Size>(properties::UnitCellSize);\n> +\t\tphysicalSize[0] = size.width * pixelArraySize[0] / 1e6f;\n> +\t\tphysicalSize[1] = size.height * pixelArraySize[1] / 1e6f;\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> @@ -987,13 +995,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);\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 D9A89C32EA\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 25 Mar 2021 22:52:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 567416084F;\n\tThu, 25 Mar 2021 23:52:18 +0100 (CET)","from mail-lj1-x233.google.com (mail-lj1-x233.google.com\n\t[IPv6:2a00:1450:4864:20::233])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 50101603FF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 25 Mar 2021 23:52:16 +0100 (CET)","by mail-lj1-x233.google.com with SMTP id u20so5170120lja.13\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 25 Mar 2021 15:52:16 -0700 (PDT)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\tz64sm671454lfa.92.2021.03.25.15.52.15\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 25 Mar 2021 15:52:15 -0700 (PDT)"],"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=\"fjVYg8DG\"; 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=UvaJcZ0pWVo17Ces6ejn6+avdXKY0INZBhKnMcBiftM=;\n\tb=fjVYg8DGUth6D+thauXtMKvVt+EfUr7jzPzJchKihaTByWaGCGWGHsQlNX0S/VO6tM\n\t9TtzQLgbypTFKQRoTXm8+DggkE5g2I7+YhW/n6krSSYzpoM1y3ncoiYs9X4LgUgLNq4v\n\tDo/F9yI9uq3AUuOM5PWXrXpYw6WgFYyEXeL9spgy/10yNk06xPE6QaaYiS0tsCx56+Wa\n\tG22nmb7rjVYN49fX+UsH89BEapZU3R61dn7QBfdIaH8WQ7PvUlURz3rmXA3I2dHIt5Gt\n\tfK7Mkp/8E7ZR+l13/eFzg/lhhD3BE5/T1BKTAbcHVl7hg+b8PsNz2ZJU7wVC0D0Jyxk0\n\tfaCA==","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=UvaJcZ0pWVo17Ces6ejn6+avdXKY0INZBhKnMcBiftM=;\n\tb=YAIS0AQHgLM9/tu4QCqoUk1owxbttT+izLlu3iakf9jEPV6OYIxSBtv5YEjXDzfk4X\n\tfDiAjYR/jkfK+aiE/Co+goUbeG7sh3nkZAO7MbNyqoN55UjJfTRtHWX5i196TlG4q9DD\n\tPCbnvyAj6QpoV6euKJnN63HN39Ocvt0XKqADDeQBreYY91HsoxOszCXClPRuFwukdKoR\n\tgO5t9cBggGizsZaVETlhUlvHQnEneyhxIS0DGlFDheABPU4vfK+SMqOzRYfWXI1XsN26\n\tessC1t/XJnn+XER213Ixea0C7eM3l92JJ5W/Ag0DHklUSeP6bqsdW5db5ofPUlALpltY\n\tha5Q==","X-Gm-Message-State":"AOAM532IQb3Bb1zOUxz6scBXCUDMH2gej7gL1aXURILYGU2FDY6MvGGb\n\tif0EwXqMAvPMYzBZz5ZETuYOk/9E3MA3OA==","X-Google-Smtp-Source":"ABdhPJwYasZTSoPTvjLOZZSK3RYk6O4hLd90L6J33ZCp1BvN2C4TveHpq/iZ9VKUvyvDQcshglnE4A==","X-Received":"by 2002:a05:651c:3c1:: with SMTP id\n\tf1mr7207005ljp.507.1616712735726; \n\tThu, 25 Mar 2021 15:52:15 -0700 (PDT)","Date":"Thu, 25 Mar 2021 23:52:14 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YF0UHpzNB4/d4RQP@oden.dyn.berto.se>","References":"<20210325135116.21548-1-jacopo@jmondi.org>\n\t<20210325135116.21548-4-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210325135116.21548-4-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH v3 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=\"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>"}}]