Patch Detail
Show a patch.
GET /api/patches/9241/?format=api
{ "id": 9241, "url": "https://patchwork.libcamera.org/api/patches/9241/?format=api", "web_url": "https://patchwork.libcamera.org/patch/9241/", "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": "<20200805153745.30378-1-jacopo@jmondi.org>", "date": "2020-08-05T15:37:45", "name": "[libcamera-devel] android: camera_device: Report supported JPEG sizes", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "c91cab91aa6d5f9d7e722793d6bfa25fbd8f9e8f", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": { "id": 15, "url": "https://patchwork.libcamera.org/api/users/15/?format=api", "username": "jmondi", "first_name": "Jacopo", "last_name": "Mondi", "email": "jacopo@jmondi.org" }, "mbox": "https://patchwork.libcamera.org/patch/9241/mbox/", "series": [ { "id": 1199, "url": "https://patchwork.libcamera.org/api/series/1199/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1199", "date": "2020-08-05T15:37:45", "name": "[libcamera-devel] android: camera_device: Report supported JPEG sizes", "version": 1, "mbox": "https://patchwork.libcamera.org/series/1199/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/9241/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/9241/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 8408FBD86F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 5 Aug 2020 15:34:12 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 19DF56071B;\n\tWed, 5 Aug 2020 17:34:12 +0200 (CEST)", "from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net\n\t[217.70.183.194])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D59EB60599\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 5 Aug 2020 17:34:10 +0200 (CEST)", "from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 4073740007;\n\tWed, 5 Aug 2020 15:34:09 +0000 (UTC)" ], "X-Originating-IP": "2.224.242.101", "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 5 Aug 2020 17:37:45 +0200", "Message-Id": "<20200805153745.30378-1-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.27.0", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH] android: camera_device: Report supported\n\tJPEG 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": "When producing the list of image resolution to claim as supported by the\ncamera HAL, the JPEG stream was assumed to be 'always valid' as, at the\ntime, there was no JPEG support in place at all.\n\nWith the introduction of support for JPEG compression, reporting\nnon-valid sizes as supported obviously causes troubles.\n\nIn order to avoid reporting non-supported resolutions as supported,\nproduce the list of available JPEG sizes by using the ones supported\nby the YCbCr_420_888 format, from which the JPEG stream is encoded.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n\nPatch to be applied on top of Kieran's JPEG work.\n---\n src/android/camera_device.cpp | 38 +++++++++++++++++++++++++----------\n 1 file changed, 27 insertions(+), 11 deletions(-)\n\n--\n2.27.0", "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex ec8ca934842a..6a9a038a2b53 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -398,27 +398,43 @@ int CameraDevice::initializeStreamConfigurations()\n \t\t */\n \t\tformatsMap_[androidFormat] = mappedFormat;\n\n+\t\t/*\n+\t\t * Stop here for JPEG streams: the JPEG supported sizes will\n+\t\t * be tested later using the here recorded non-blob stream sizes.\n+\t\t */\n+\t\tif (androidFormat == HAL_PIXEL_FORMAT_BLOB)\n+\t\t\tcontinue;\n+\n \t\tfor (const Size &res : cameraResolutions) {\n \t\t\tcfg.pixelFormat = mappedFormat;\n \t\t\tcfg.size = res;\n\n-\t\t\tCameraConfiguration::Status status = cameraConfig->validate();\n-\t\t\t/*\n-\t\t\t * Unconditionally report we can produce JPEG.\n-\t\t\t *\n-\t\t\t * \\todo The JPEG stream will be implemented as an\n-\t\t\t * HAL-only stream, but some cameras can produce it\n-\t\t\t * directly. As of now, claim support for JPEG without\n-\t\t\t * inspecting where the JPEG stream is produced.\n-\t\t\t */\n-\t\t\tif (androidFormat != HAL_PIXEL_FORMAT_BLOB &&\n-\t\t\t status != CameraConfiguration::Valid)\n+\t\t\tif (cameraConfig->validate() != CameraConfiguration::Valid)\n \t\t\t\tcontinue;\n\n \t\t\tstreamConfigurations_.push_back({ res, androidFormat });\n \t\t}\n \t}\n\n+\t/*\n+\t * Insert the JPEG sizes by using the ones recorded for YUV streams\n+\t * from which JPEG is produced.\n+\t */\n+\tstd::vector<Camera3StreamConfiguration> jpegConfigurations;\n+\tjpegConfigurations.reserve(cameraResolutions.size());\n+\n+\tfor (const auto &config : streamConfigurations_) {\n+\t\t/* \\todo JPEG can be produced from other formats too! */\n+\t\tif (config.androidFormat != HAL_PIXEL_FORMAT_YCbCr_420_888)\n+\t\t\tcontinue;\n+\n+\t\tjpegConfigurations.push_back({ config.resolution,\n+\t\t\t\t\t HAL_PIXEL_FORMAT_BLOB });\n+\t}\n+\n+\tfor (auto const jpegConfig : jpegConfigurations)\n+\t\tstreamConfigurations_.push_back(jpegConfig);\n+\n \tLOG(HAL, Debug) << \"Collected stream configuration map: \";\n \tfor (const auto &entry : streamConfigurations_)\n \t\tLOG(HAL, Debug) << \"{ \" << entry.resolution.toString() << \" - \"\n", "prefixes": [ "libcamera-devel" ] }