Patch Detail
Show a patch.
GET /api/patches/13181/?format=api
{ "id": 13181, "url": "https://patchwork.libcamera.org/api/patches/13181/?format=api", "web_url": "https://patchwork.libcamera.org/patch/13181/", "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": "<20210803133205.6599-5-umang.jain@ideasonboard.com>", "date": "2021-08-03T13:32:05", "name": "[libcamera-devel,4/4] ipu3: cio2: Tweak sensor size selection policy", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "207be6785acf4db490c51e3a1108de9388e9a178", "submitter": { "id": 86, "url": "https://patchwork.libcamera.org/api/people/86/?format=api", "name": "Umang Jain", "email": "umang.jain@ideasonboard.com" }, "delegate": { "id": 12, "url": "https://patchwork.libcamera.org/api/users/12/?format=api", "username": "uajain", "first_name": "Umang", "last_name": "Jain", "email": "umang.jain@ideasonboard.com" }, "mbox": "https://patchwork.libcamera.org/patch/13181/mbox/", "series": [ { "id": 2296, "url": "https://patchwork.libcamera.org/api/series/2296/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2296", "date": "2021-08-03T13:32:01", "name": "ipu3: Change sensor size selection policy", "version": 1, "mbox": "https://patchwork.libcamera.org/series/2296/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/13181/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/13181/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 38AEBC3235\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 3 Aug 2021 13:32:36 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C9BBF687DE;\n\tTue, 3 Aug 2021 15:32:34 +0200 (CEST)", "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 BB5E2687CE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 3 Aug 2021 15:32:33 +0200 (CEST)", "from perceval.ideasonboard.com (unknown [103.238.109.12])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B492D3F0;\n\tTue, 3 Aug 2021 15:32:32 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Qk62e1az\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1627997553;\n\tbh=8RpSljUB7bb7AR22UrEoMo0xiz6QWPZswzKxRCnSPjg=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Qk62e1azlA70n32aO4ElGiTo/dyaH1eQLArMK1fRR90SC/s8Ylb2y5vqA9jD0+900\n\tSlgAXmx0PrDTyJWlNqgXyN4RvvTk/F2FgmwvChgEhd4atFyluC+BL9BQKfQf+o0w/P\n\tTmg7wyM7/JhzikV+0U0+jZEMSTa4dAOCPy27AJHs=", "From": "Umang Jain <umang.jain@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 3 Aug 2021 19:02:05 +0530", "Message-Id": "<20210803133205.6599-5-umang.jain@ideasonboard.com>", "X-Mailer": "git-send-email 2.31.1", "In-Reply-To": "<20210803133205.6599-1-umang.jain@ideasonboard.com>", "References": "<20210803133205.6599-1-umang.jain@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 4/4] ipu3: cio2: Tweak sensor size\n\tselection policy", "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": "Do not compare higher precision of the ratios, as it might lead to\nabsurd selection of sensor size for a relatively low requested\nresolution size.\n\nFor example:\nThe imx258 driver supports the following sensor resolutions:\n\n - 4208x3118 = 1.349583066\n - 2104x1560 = 1.348717949\n - 1048x780 = 1.343589744\n\nIt can be inferred that, that the aspect ratio only differs by a small\nfactor with each other. It does not makes sense to select a 4208x3118\nfor a requested size of say 640x480 or 1280x720, which is what is\nhappening currently.\n($) cam -c1 -swidth=640,height=480,role=raw\n - CIO2 configuration: 4208x3118-SGRBG10_IPU3\n\nIn order to address this constraint, only compare the ratio with single\nprecision to make a better decision on the sensor resolution policy\nselection.\n\n($) cam -c1 -srole=raw,width=640,height=480\n - CIO2 configuration: 1048x780-SGRBG10_IPU3\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n src/libcamera/pipeline/ipu3/cio2.cpp | 7 +++++++\n 1 file changed, 7 insertions(+)", "diff": "diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp\nindex 9980b8bd..887b850d 100644\n--- a/src/libcamera/pipeline/ipu3/cio2.cpp\n+++ b/src/libcamera/pipeline/ipu3/cio2.cpp\n@@ -281,6 +281,13 @@ V4L2SubdeviceFormat CIO2Device::getSensorFormat(const std::vector<unsigned int>\n \t\t\t\tcontinue;\n \n \t\t\tfloat ratio = static_cast<float>(sz.width) / sz.height;\n+\t\t\t/*\n+\t\t\t * Comparing ratios with a single precision is enough.\n+\t\t\t * This avoids the selection of a frame size which is\n+\t\t\t * 2x or 3x than the requested size, having a slightly\n+\t\t\t * better ratio w.r.t native resolution ratio.\n+\t\t\t */\n+\t\t\tratio = static_cast<unsigned int>(ratio * 10) / 10.0;\n \t\t\tfloat ratioDiff = fabsf(ratio - desiredRatio);\n \t\t\tunsigned int area = sz.width * sz.height;\n \t\t\tunsigned int areaDiff = area - desiredArea;\n", "prefixes": [ "libcamera-devel", "4/4" ] }