Patch Detail
Show a patch.
GET /api/patches/11496/?format=api
{ "id": 11496, "url": "https://patchwork.libcamera.org/api/patches/11496/?format=api", "web_url": "https://patchwork.libcamera.org/patch/11496/", "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": "<20210304131709.981268-1-jacopo@jmondi.org>", "date": "2021-03-04T13:17:09", "name": "[libcamera-devel] libcamera: camera_sensor: Cap resolution to max frame size", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "08c0156279a4f6f1ecb05a894be8c9fa6ec0614c", "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/11496/mbox/", "series": [ { "id": 1760, "url": "https://patchwork.libcamera.org/api/series/1760/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1760", "date": "2021-03-04T13:17:09", "name": "[libcamera-devel] libcamera: camera_sensor: Cap resolution to max frame size", "version": 1, "mbox": "https://patchwork.libcamera.org/series/1760/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/11496/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/11496/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 2A426BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 4 Mar 2021 13:16:46 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8F05568A91;\n\tThu, 4 Mar 2021 14:16:45 +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 DD30D602ED\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 4 Mar 2021 14:16:43 +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 5EF7EE000D;\n\tThu, 4 Mar 2021 13:16:43 +0000 (UTC)" ], "X-Originating-IP": "93.61.96.190", "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 4 Mar 2021 14:17:09 +0100", "Message-Id": "<20210304131709.981268-1-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.30.0", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH] libcamera: camera_sensor: Cap resolution\n\tto max frame 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>", "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": "Since commit 96aecfe36508 (\"libcamera: camera_sensor: Use active area\nsize as resolution\") the CameraSensor::resolution() method returned the\nsensor's active pixel area size.\n\nAs the CameraSensor::resolution() method is widely used in the library\ncode base to retrieve the maximum frame size the sensor can produce,\nin case it is smaller than the pixel area size the returned size cannot\nbe used to configure the sensor correctly.\n\nFix this by returning the maximum frame resolution the sensor can\nproduce, or the pixel area size in case the sensor embeds and ISP that\ncan upscale and the supported maximum frame size is thus larger that\nthe pixel array size.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n include/libcamera/internal/camera_sensor.h | 2 +-\n src/libcamera/camera_sensor.cpp | 14 +++++++++++++-\n 2 files changed, 14 insertions(+), 2 deletions(-)\n\n--\n2.30.0", "diff": "diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\nindex 71d012f795fe..3e98f71b5e7f 100644\n--- a/include/libcamera/internal/camera_sensor.h\n+++ b/include/libcamera/internal/camera_sensor.h\n@@ -53,7 +53,7 @@ public:\n \tconst MediaEntity *entity() const { return entity_; }\n \tconst std::vector<unsigned int> &mbusCodes() const { return mbusCodes_; }\n \tconst std::vector<Size> &sizes() const { return sizes_; }\n-\tSize resolution() const { return activeArea_.size(); }\n+\tSize resolution() const;\n\n \tV4L2SubdeviceFormat getFormat(const std::vector<unsigned int> &mbusCodes,\n \t\t\t\t const Size &size) const;\ndiff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex a04982971616..edc2c27084ed 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -551,10 +551,22 @@ int CameraSensor::initProperties()\n */\n\n /**\n- * \\fn CameraSensor::resolution()\n * \\brief Retrieve the camera sensor resolution\n+ *\n+ * The camera sensor resolution is the largest frame size the sensor can produce\n+ * or, if the camera sensor embeds and ISP that can up-scale, the pixel area\n+ * size.\n+ *\n+ * \\todo Consider if it desirable to distinguish between the maximum resolution\n+ * the sensor can produce (also including upscaled ones) and the actual pixel\n+ * array size by splitting this method in two.\n+ *\n * \\return The camera sensor resolution in pixels\n */\n+Size CameraSensor::resolution() const\n+{\n+\treturn std::min(sizes_.back(), activeArea_.size());\n+}\n\n /**\n * \\brief Retrieve the best sensor format for a desired output\n", "prefixes": [ "libcamera-devel" ] }