Patch Detail
Show a patch.
GET /api/patches/11149/?format=api
{ "id": 11149, "url": "https://patchwork.libcamera.org/api/patches/11149/?format=api", "web_url": "https://patchwork.libcamera.org/patch/11149/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20210204162244.53630-2-jacopo@jmondi.org>", "date": "2021-02-04T16:22:44", "name": "[libcamera-devel,v3,2/2] android: camera_device: Generate JPEG thumbnail sizes", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "5f4af79b2869ffb0234b6495697b7c1223eb9d49", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/11149/mbox/", "series": [ { "id": 1654, "url": "https://patchwork.libcamera.org/api/series/1654/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1654", "date": "2021-02-04T16:22:43", "name": "[libcamera-devel,v3,1/2] android: camera_device: Fix wrong comment", "version": 3, "mbox": "https://patchwork.libcamera.org/series/1654/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/11149/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/11149/checks/", "tags": {}, "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 DB5FDBD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 4 Feb 2021 16:22:29 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1D7376142F;\n\tThu, 4 Feb 2021 17:22:29 +0100 (CET)", "from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net\n\t[217.70.183.196])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 629F060305\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 4 Feb 2021 17:22:27 +0100 (CET)", "from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 2AA78E000B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 4 Feb 2021 16:22:26 +0000 (UTC)" ], "X-Originating-IP": "93.61.96.190", "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 4 Feb 2021 17:22:44 +0100", "Message-Id": "<20210204162244.53630-2-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.30.0", "In-Reply-To": "<20210204162244.53630-1-jacopo@jmondi.org>", "References": "<20210204162244.53630-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v3 2/2] android: camera_device: Generate\n\tJPEG thumbnail sizes", "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>", "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>" }, "content": "The list of the available thumbnail sizes is generated from the\nlist of available JPEG resolution, one for each aspect ratio.\n\nThis change fixes the CTS test\nandroid.hardware.cts.CameraTest#testJpegThumbnailSize\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/android/camera_device.cpp | 55 ++++++++++++++++++++++++++++++-----\n 1 file changed, 48 insertions(+), 7 deletions(-)", "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 70170e243d06..65d37860cf95 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -705,10 +705,10 @@ std::tuple<uint32_t, uint32_t> CameraDevice::calculateStaticMetadataSize()\n {\n \t/*\n \t * \\todo Keep this in sync with the actual number of entries.\n-\t * Currently: 53 entries, 846 bytes of static metadata\n+\t * Currently: 53 entries, 838 bytes of static metadata\n \t */\n \tuint32_t numEntries = 53;\n-\tuint32_t byteSize = 846;\n+\tuint32_t byteSize = 838;\n \n \t/*\n \t * Calculate space occupation in bytes for dynamically built metadata\n@@ -720,6 +720,18 @@ std::tuple<uint32_t, uint32_t> CameraDevice::calculateStaticMetadataSize()\n \t */\n \tbyteSize += streamConfigurations_.size() * 48;\n \n+\t/*\n+\t * 2 32bits integers for each HAL_PIXEL_FORMAT_BLOB for thumbnail sizes\n+\t * 2 32bits integers for the (0, 0) thumbnail size\n+\t */\n+\tfor (const auto &entry : streamConfigurations_) {\n+\t\tif (entry.androidFormat != HAL_PIXEL_FORMAT_BLOB)\n+\t\t\tcontinue;\n+\n+\t\tbyteSize += 8;\n+\t}\n+\tbyteSize += 8;\n+\n \treturn std::make_tuple(numEntries, byteSize);\n }\n \n@@ -871,12 +883,41 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n \t\t\t\t &availableControlModes, 1);\n \n \t/* JPEG static metadata. */\n-\tstd::vector<int32_t> availableThumbnailSizes = {\n-\t\t0, 0,\n-\t};\n+\n+\t/*\n+\t * Create the list of supported thumbnail sizes by inspecting the\n+\t * available JPEG resolutions collected in streamConfigurations_ and\n+\t * generate one entry for each aspect ratio.\n+\t *\n+\t * The JPEG thumbnailer can freely scale, so pick an arbitrary\n+\t * (160, 160) size as designated thumbnail size.\n+\t */\n+\tconstexpr Size maxJpegThumbnail(160, 160);\n+\tstd::vector<Size> thumbnailSizes;\n+\tthumbnailSizes.push_back({ 0, 0 });\n+\tfor (const auto &entry : streamConfigurations_) {\n+\t\tif (entry.androidFormat != HAL_PIXEL_FORMAT_BLOB)\n+\t\t\tcontinue;\n+\n+\t\tSize thumbnailSize = maxJpegThumbnail\n+\t\t\t\t .boundedToAspectRatio({ entry.resolution.width,\n+\t\t\t\t\t\t\t entry.resolution.height });\n+\t\tthumbnailSizes.push_back(thumbnailSize);\n+\t}\n+\n+\tstd::sort(thumbnailSizes.begin(), thumbnailSizes.end());\n+\tauto last = std::unique(thumbnailSizes.begin(), thumbnailSizes.end());\n+\tthumbnailSizes.erase(last, thumbnailSizes.end());\n+\n+\t/* Transform sizes in to a list of integers that can be consumed. */\n+\tstd::vector<int32_t> thumbnailEntries;\n+\tthumbnailEntries.reserve(thumbnailSizes.size() * 2);\n+\tfor (const auto &size : thumbnailSizes) {\n+\t\tthumbnailEntries.push_back(size.width);\n+\t\tthumbnailEntries.push_back(size.height);\n+\t}\n \tstaticMetadata_->addEntry(ANDROID_JPEG_AVAILABLE_THUMBNAIL_SIZES,\n-\t\t\t\t availableThumbnailSizes.data(),\n-\t\t\t\t availableThumbnailSizes.size());\n+\t\t\t\t thumbnailEntries.data(), thumbnailEntries.size());\n \n \t/*\n \t * \\todo Calculate the maximum JPEG buffer size by asking the encoder\n", "prefixes": [ "libcamera-devel", "v3", "2/2" ] }