Patch Detail
Show a patch.
GET /api/1.1/patches/13855/?format=api
{ "id": 13855, "url": "https://patchwork.libcamera.org/api/1.1/patches/13855/?format=api", "web_url": "https://patchwork.libcamera.org/patch/13855/", "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": "<20210915023043.7703-1-laurent.pinchart@ideasonboard.com>", "date": "2021-09-15T02:30:43", "name": "[libcamera-devel] ipa: ipu3: Split width and height loops in calculateBdsGrid()", "commit_ref": null, "pull_url": null, "state": "rejected", "archived": false, "hash": "5cd8ff20ac957e1a7f4ddb4ac664aa1342f9e192", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/13855/mbox/", "series": [ { "id": 2532, "url": "https://patchwork.libcamera.org/api/1.1/series/2532/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2532", "date": "2021-09-15T02:30:43", "name": "[libcamera-devel] ipa: ipu3: Split width and height loops in calculateBdsGrid()", "version": 1, "mbox": "https://patchwork.libcamera.org/series/2532/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/13855/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/13855/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 2542EBDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 15 Sep 2021 02:31:18 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7857469189;\n\tWed, 15 Sep 2021 04:31:17 +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 ED23260247\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 15 Sep 2021 04:31:15 +0200 (CEST)", "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 52C5424F;\n\tWed, 15 Sep 2021 04:31:15 +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=\"fYldfD8U\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1631673075;\n\tbh=v64vdeejrNdyrZAr2XUS3eWjUhvRQpYUznSbVC9xldA=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=fYldfD8U68HpFQAO/ltdJY9ym3LVPVo1MhgDwtntQS4kIKqiH+521yq3X5LVMYQOz\n\tQEkWVXqbSMK3uL59ZD9ZakwUjJYl5m1D5XCFkyt11WM91xnZKUOh4otJ6im27k/nqy\n\tPgAYUQ6rIcJcgZTknFEl/LFdvexuB8mNQ30EZqY0=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 15 Sep 2021 05:30:43 +0300", "Message-Id": "<20210915023043.7703-1-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.32.0", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH] ipa: ipu3: Split width and height loops\n\tin calculateBdsGrid()", "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 loops over the width and height of the image when calculating the\nBDS grid parameters are imbricated, but they're actually independent.\nSplit them to reduce the complexity.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/ipa/ipu3/ipu3.cpp | 45 ++++++++++++++++++++++++++-----------------\n 1 file changed, 27 insertions(+), 18 deletions(-)", "diff": "diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\nindex 30d2a53903ec..36fe4a6c9154 100644\n--- a/src/ipa/ipu3/ipu3.cpp\n+++ b/src/ipa/ipu3/ipu3.cpp\n@@ -293,33 +293,42 @@ int IPAIPU3::start()\n */\n void IPAIPU3::calculateBdsGrid(const Size &bdsOutputSize)\n {\n-\tuint32_t minError = std::numeric_limits<uint32_t>::max();\n \tSize best;\n \tSize bestLog2;\n \n \t/* Set the BDS output size in the IPAConfiguration structure */\n \tcontext_.configuration.grid.bdsOutputSize = bdsOutputSize;\n \n-\tfor (uint32_t widthShift = 3; widthShift <= 7; ++widthShift) {\n+\tuint32_t minError = std::numeric_limits<uint32_t>::max();\n+\n+\tfor (uint32_t shift = 3; shift <= 7; ++shift) {\n \t\tuint32_t width = std::min(kMaxCellWidthPerSet,\n-\t\t\t\t\t bdsOutputSize.width >> widthShift);\n-\t\twidth = width << widthShift;\n-\t\tfor (uint32_t heightShift = 3; heightShift <= 7; ++heightShift) {\n-\t\t\tint32_t height = std::min(kMaxCellHeightPerSet,\n-\t\t\t\t\t\t bdsOutputSize.height >> heightShift);\n-\t\t\theight = height << heightShift;\n-\t\t\tuint32_t error = std::abs(static_cast<int>(width - bdsOutputSize.width))\n-\t\t\t\t\t\t\t+ std::abs(static_cast<int>(height - bdsOutputSize.height));\n+\t\t\t\t\t bdsOutputSize.width >> shift);\n+\t\twidth = width << shift;\n+\t\tuint32_t error = std::abs(static_cast<int>(width - bdsOutputSize.width));\n \n-\t\t\tif (error > minError)\n-\t\t\t\tcontinue;\n+\t\tif (error > minError)\n+\t\t\tcontinue;\n \n-\t\t\tminError = error;\n-\t\t\tbest.width = width;\n-\t\t\tbest.height = height;\n-\t\t\tbestLog2.width = widthShift;\n-\t\t\tbestLog2.height = heightShift;\n-\t\t}\n+\t\tminError = error;\n+\t\tbest.width = width;\n+\t\tbestLog2.width = shift;\n+\t}\n+\n+\tminError = std::numeric_limits<uint32_t>::max();\n+\n+\tfor (uint32_t shift = 3; shift <= 7; ++shift) {\n+\t\tuint32_t height = std::min(kMaxCellHeightPerSet,\n+\t\t\t\t\t bdsOutputSize.height >> shift);\n+\t\theight = height << shift;\n+\t\tuint32_t error = std::abs(static_cast<int>(height - bdsOutputSize.height));\n+\n+\t\tif (error > minError)\n+\t\t\tcontinue;\n+\n+\t\tminError = error;\n+\t\tbest.height = height;\n+\t\tbestLog2.height = shift;\n \t}\n \n \tstruct ipu3_uapi_grid_config &bdsGrid = context_.configuration.grid.bdsGrid;\n", "prefixes": [ "libcamera-devel" ] }