Patch Detail
Show a patch.
GET /api/1.1/patches/22365/?format=api
{ "id": 22365, "url": "https://patchwork.libcamera.org/api/1.1/patches/22365/?format=api", "web_url": "https://patchwork.libcamera.org/patch/22365/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20241216154124.203650-20-stefan.klug@ideasonboard.com>", "date": "2024-12-16T15:40:59", "name": "[v4,19/20] libcamera: camera_sensor: Add parameter to limit returned sensor size", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "8fb52286100ecf0c67a0ca06de62553327af7200", "submitter": { "id": 184, "url": "https://patchwork.libcamera.org/api/1.1/people/184/?format=api", "name": "Stefan Klug", "email": "stefan.klug@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/22365/mbox/", "series": [ { "id": 4896, "url": "https://patchwork.libcamera.org/api/1.1/series/4896/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4896", "date": "2024-12-16T15:40:40", "name": "rkisp1: Fix aspect ratio and ScalerCrop", "version": 4, "mbox": "https://patchwork.libcamera.org/series/4896/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/22365/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/22365/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 ED60CC32F6\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 16 Dec 2024 15:42:43 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 65ED267FA1;\n\tMon, 16 Dec 2024 16:42:43 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E9BA567F9A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Dec 2024 16:42:38 +0100 (CET)", "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:bfdf:3a3c:e45:66e3])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 33DF182A;\n\tMon, 16 Dec 2024 16:42:02 +0100 (CET)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"RVbnb6PC\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1734363722;\n\tbh=4D69et1CbHfB2HVgM+731TlbSbrVJ4XG7A6AK7c5V+4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=RVbnb6PCwj0Ne9zJCeOHFjkHFAvJTZ9KEhoAxir81MpMbKzEqmOKIJ7e+qcBwCZdj\n\tzfBns7VRaz0Ue8/Lb1hlLfgrJQifMj1L6eD7L/rbdMIaAS3IUzXDOhCeICOjMcMA9n\n\tal0PTfVil+xsGBTYKEeL86MnhhkP2qWuajY0Ba1E=", "From": "Stefan Klug <stefan.klug@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>,\n\tJacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>", "Subject": "[PATCH v4 19/20] libcamera: camera_sensor: Add parameter to limit\n\treturned sensor size", "Date": "Mon, 16 Dec 2024 16:40:59 +0100", "Message-ID": "<20241216154124.203650-20-stefan.klug@ideasonboard.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20241216154124.203650-1-stefan.klug@ideasonboard.com>", "References": "<20241216154124.203650-1-stefan.klug@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "The getFormat function takes the aspect ratio and the area of the\nrequested size into account when choosing the best sensor size. In case\nthe sensor is connected to an rkisp1 the maximum supported frame size of\nthe ISP is another constraining factor for the selection of the best\nformat. Add a maxSize parameter to support such a constraint.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\n\nChanges in v4:\n- Collected tags\n\nChanges in v3:\n- Added this patch\n---\n include/libcamera/internal/camera_sensor.h | 2 +-\n src/libcamera/sensor/camera_sensor.cpp | 3 +++\n src/libcamera/sensor/camera_sensor_legacy.cpp | 9 +++++++--\n 3 files changed, 11 insertions(+), 3 deletions(-)", "diff": "diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\nindex d030e254a552..605ea8136900 100644\n--- a/include/libcamera/internal/camera_sensor.h\n+++ b/include/libcamera/internal/camera_sensor.h\n@@ -53,7 +53,7 @@ public:\n \n \tvirtual V4L2SubdeviceFormat\n \tgetFormat(const std::vector<unsigned int> &mbusCodes,\n-\t\t const Size &size) const = 0;\n+\t\t const Size &size, const Size maxSize = Size()) const = 0;\n \tvirtual int setFormat(V4L2SubdeviceFormat *format,\n \t\t\t Transform transform = Transform::Identity) = 0;\n \tvirtual int tryFormat(V4L2SubdeviceFormat *format) const = 0;\ndiff --git a/src/libcamera/sensor/camera_sensor.cpp b/src/libcamera/sensor/camera_sensor.cpp\nindex 208a1603cb32..a131ac224ec0 100644\n--- a/src/libcamera/sensor/camera_sensor.cpp\n+++ b/src/libcamera/sensor/camera_sensor.cpp\n@@ -116,6 +116,7 @@ CameraSensor::~CameraSensor() = default;\n * \\brief Retrieve the best sensor format for a desired output\n * \\param[in] mbusCodes The list of acceptable media bus codes\n * \\param[in] size The desired size\n+ * \\param[in] maxSize The maximum size\n *\n * Media bus codes are selected from \\a mbusCodes, which lists all acceptable\n * codes in decreasing order of preference. Media bus codes supported by the\n@@ -134,6 +135,8 @@ CameraSensor::~CameraSensor() = default;\n * bandwidth.\n * - The desired \\a size shall be supported by one of the media bus code listed\n * in \\a mbusCodes.\n+ * - The desired \\a size shall fit into the maximum size \\a maxSize if it is not\n+ * null.\n *\n * When multiple media bus codes can produce the same size, the code at the\n * lowest position in \\a mbusCodes is selected.\ndiff --git a/src/libcamera/sensor/camera_sensor_legacy.cpp b/src/libcamera/sensor/camera_sensor_legacy.cpp\nindex 17d6fa680e39..32989c19c019 100644\n--- a/src/libcamera/sensor/camera_sensor_legacy.cpp\n+++ b/src/libcamera/sensor/camera_sensor_legacy.cpp\n@@ -74,7 +74,8 @@ public:\n \tSize resolution() const override;\n \n \tV4L2SubdeviceFormat getFormat(const std::vector<unsigned int> &mbusCodes,\n-\t\t\t\t const Size &size) const override;\n+\t\t\t\t const Size &size,\n+\t\t\t\t const Size maxSize) const override;\n \tint setFormat(V4L2SubdeviceFormat *format,\n \t\t Transform transform = Transform::Identity) override;\n \tint tryFormat(V4L2SubdeviceFormat *format) const override;\n@@ -699,7 +700,7 @@ Size CameraSensorLegacy::resolution() const\n \n V4L2SubdeviceFormat\n CameraSensorLegacy::getFormat(const std::vector<unsigned int> &mbusCodes,\n-\t\t\t const Size &size) const\n+\t\t\t const Size &size, Size maxSize) const\n {\n \tunsigned int desiredArea = size.width * size.height;\n \tunsigned int bestArea = UINT_MAX;\n@@ -716,6 +717,10 @@ CameraSensorLegacy::getFormat(const std::vector<unsigned int> &mbusCodes,\n \t\tfor (const SizeRange &range : formats->second) {\n \t\t\tconst Size &sz = range.max;\n \n+\t\t\tif (!maxSize.isNull() &&\n+\t\t\t (sz.width > maxSize.width || sz.height > maxSize.height))\n+\t\t\t\tcontinue;\n+\n \t\t\tif (sz.width < size.width || sz.height < size.height)\n \t\t\t\tcontinue;\n \n", "prefixes": [ "v4", "19/20" ] }