[{"id":11676,"web_url":"https://patchwork.libcamera.org/comment/11676/","msgid":"<20200728170022.u4djnajik7nzk6qs@uno.localdomain>","date":"2020-07-28T17:00:22","subject":"Re: [libcamera-devel] [RFC PATCH 5/6] [HACK]: android:\n\tcamera_device: Define JPEG size and quality","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"On Tue, Jul 21, 2020 at 11:01:25PM +0100, Kieran Bingham wrote:\n> Providing these two keys allows the camera application to capture\n> without crashing. It does not /succeed/ but it doesn't crash.\n>\n> The camera application and cros-camera-test still need exif information\n> to be able to successfully capture or pass the tests.\n>\n> These metadata values are hardcoded, as there is not yet an easy way to\n> add dynamic data to the request metadata.\n>\n> I would like to see all of the infrastructure around adding request\n> metadata support a more dynamic means of addition, which blocks easily\n> adding and updating key value pairs otherwise.\n>\n> But as all of that is a lot of work, here's a hack-ity work around for\n> the time being. Otherwise no form of the JPEG series will ever be\n> posted.\n>\n> Please don't review this. ;-)\n\nas you wish :)\n\n>\n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n>  src/android/camera_device.cpp | 14 ++++++++++++--\n>  1 file changed, 12 insertions(+), 2 deletions(-)\n>\n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index 7323d4e58f68..23dde1cfaf98 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -846,6 +846,8 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n>  \t\tANDROID_SENSOR_EXPOSURE_TIME,\n>  \t\tANDROID_STATISTICS_LENS_SHADING_MAP_MODE,\n>  \t\tANDROID_STATISTICS_SCENE_FLICKER,\n> +\t\tANDROID_JPEG_SIZE,\n> +\t\tANDROID_JPEG_QUALITY,\n>  \t};\n>  \tstaticMetadata_->addEntry(ANDROID_REQUEST_AVAILABLE_RESULT_KEYS,\n>  \t\t\t\t  availableResultKeys.data(),\n> @@ -1444,10 +1446,10 @@ std::unique_ptr<CameraMetadata> CameraDevice::getResultMetadata(int frame_number\n>  {\n>  \t/*\n>  \t * \\todo Keep this in sync with the actual number of entries.\n> -\t * Currently: 12 entries, 36 bytes\n\nThat's the second time I encounter a comment we failed to keep in sync\nfor metadata.\n\n> +\t * Currently: 17 entries, 58 bytes\n>  \t */\n>  \tstd::unique_ptr<CameraMetadata> resultMetadata =\n> -\t\tstd::make_unique<CameraMetadata>(15, 50);\n> +\t\tstd::make_unique<CameraMetadata>(17, 58);\n\n>  \tif (!resultMetadata->isValid()) {\n>  \t\tLOG(HAL, Error) << \"Failed to allocate static metadata\";\n>  \t\treturn nullptr;\n> @@ -1497,6 +1499,14 @@ std::unique_ptr<CameraMetadata> CameraDevice::getResultMetadata(int frame_number\n>  \tresultMetadata->addEntry(ANDROID_STATISTICS_SCENE_FLICKER,\n>  \t\t\t\t &scene_flicker, 1);\n>\n> +\tconst uint32_t jpeg_size = 1 << 13;\n> +\tresultMetadata->addEntry(ANDROID_JPEG_SIZE,\n> +\t\t\t\t &jpeg_size, 1);\n> +\n> +\tconst uint32_t jpeg_quality = 95;\n> +\tresultMetadata->addEntry(ANDROID_JPEG_QUALITY,\n> +\t\t\t\t &jpeg_quality, 1);\n> +\n>  \t/*\n>  \t * Return the result metadata pack even is not valid: get() will return\n>  \t * nullptr.\n> --\n> 2.25.1\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 3ADEABD86F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 28 Jul 2020 16:56:45 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BACA4613C6;\n\tTue, 28 Jul 2020 18:56:44 +0200 (CEST)","from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net\n\t[217.70.183.197])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5832160923\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Jul 2020 18:56:43 +0200 (CEST)","from uno.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay5-d.mail.gandi.net (Postfix) with ESMTPSA id C3F6F1C000E;\n\tTue, 28 Jul 2020 16:56:42 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","Date":"Tue, 28 Jul 2020 19:00:22 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<20200728170022.u4djnajik7nzk6qs@uno.localdomain>","References":"<20200721220126.202065-1-kieran.bingham@ideasonboard.com>\n\t<20200721220126.202065-6-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200721220126.202065-6-kieran.bingham@ideasonboard.com>","Subject":"Re: [libcamera-devel] [RFC PATCH 5/6] [HACK]: android:\n\tcamera_device: Define JPEG size and quality","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=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]