Patch Detail
Show a patch.
GET /api/1.1/patches/18501/?format=api
{ "id": 18501, "url": "https://patchwork.libcamera.org/api/1.1/patches/18501/?format=api", "web_url": "https://patchwork.libcamera.org/patch/18501/", "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": "<20230331072341.24851-6-naush@raspberrypi.com>", "date": "2023-03-31T07:23:36", "name": "[libcamera-devel,v3,05/10] ipa: raspberrypi: alsc: Use a better type name for sparse arrays", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "c0eddf9838a1b38bca38c4fdf6282a7f8f921581", "submitter": { "id": 34, "url": "https://patchwork.libcamera.org/api/1.1/people/34/?format=api", "name": "Naushir Patuck", "email": "naush@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/18501/mbox/", "series": [ { "id": 3830, "url": "https://patchwork.libcamera.org/api/1.1/series/3830/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3830", "date": "2023-03-31T07:23:31", "name": "Raspberry Pi: Generalised algorithms", "version": 3, "mbox": "https://patchwork.libcamera.org/series/3830/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/18501/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/18501/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 A5256C329E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 31 Mar 2023 07:40:55 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 57ACC6278A;\n\tFri, 31 Mar 2023 09:40:55 +0200 (CEST)", "from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com\n\t[IPv6:2607:f8b0:4864:20::d2c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 109C762754\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 31 Mar 2023 09:40:53 +0200 (CEST)", "by mail-io1-xd2c.google.com with SMTP id h187so7668305iof.7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 31 Mar 2023 00:40:53 -0700 (PDT)", "from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\ti17-20020a6bf411000000b0074555814e73sm421943iog.32.2023.03.31.00.40.51\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 31 Mar 2023 00:40:52 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1680248455;\n\tbh=klPCji71t9ff50/NTw25Wr7qoGXqjM2oZwi1ptHCVKI=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=TK3iyqJnQ6e9qTJDUAnf1KQSJEU7mN2uiLVayevDURw/SbBZzqTpO+6CLF4QX8lwx\n\t9awhTfkUXcuTAsKT5sANK7JEpENtzIYNbwGCDy/0OFUgNrd7SLIGx+Zq2MRIGf2xR6\n\tzpm8G605Uieyi9IArpsuZ5fbkhTF6YN8+4Eq5cVxwlf1dPReigdrMtOPzKB2tbvGap\n\t6vdkOSj8pjc8YBRERexF/LxvcGOaVvLjmZvIAAWI8IMdI227qVf2okc2c/TcI0pKUt\n\t76eYfCz18glD9y60/0EKseYa5jWjxtVgdWS6K2Sddt+nW780iEPQN0r6qcEp3/1Cqx\n\tqGdSjq5NEzIhg==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1680248452;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=548zcSLJYSR6puTSQTcbbtm0W6Y5GofHbCgq+Ac6wj0=;\n\tb=M7OOqDGKYqMQFtZEiafYztQE9d0F+GX8c3YlHV4+G3ApUf3uFJHx42DXE/+ze2LgcK\n\tXqngZ/rjWu3QypjMP3CuE38pvY3rOA4nkT2c1ENvKospTcMSFeMtEfbB444gILoZLt9I\n\t3lQITFKmb7exElJYXIqFIos5oosds75gX86r5nLSSp1rB1hJqalzPuk82Djf5FGqJQrY\n\t6B6USeBGMPmqn2Qdp4ENzJwDRdtyd4VGvpayuVyj0zTZ7jyQxQhCOnTIQg7hEBxqha9z\n\tci6vJbnmwaj6FjNlfCQYKOcHhxBz4EeCuermjPuz4qUUzWKUTmfMU85jQtexN/aw2woK\n\t5BIw==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"M7OOqDGK\"; dkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112; t=1680248452;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=548zcSLJYSR6puTSQTcbbtm0W6Y5GofHbCgq+Ac6wj0=;\n\tb=EZpPu5gfc9IafHo/t/F+9OlJGxNsxLqIeM4Il1IdiY4uhH8tu4Etkr5hr0XdjOmXMv\n\t27nLNWjupRhWWZT69275SsDQy4wz59ep4FfaZ1YZVnpX++WaZ3FityKkrU2oqRm46sZI\n\txzmCxNBIApAwJc/J2KEfGvp5Ax5Jy1tuikGKXnE2oN3fwGSftXNK61H6VAGrTuP9jOZc\n\tyvuq4BeOYMNnf7g7N/HSIZXFpFU7G/d0ymeXViPCnN4Azf/T1Y61jV7o8aw3S0hSQpxM\n\tmQaHuOjfg9cuM7pYgs0wqPFLwylm4Ydg8xSEr4lJl1M3Wh/0f5wqgN6ZXIaGvbWVzQFC\n\tGBgw==", "X-Gm-Message-State": "AO0yUKX+0sBQDH/XzupXfemhEzWCHaJMlfMgRwzbC924EV9GU+R0SlYm\n\tJH+It5Nd3H8z+ncLF9QkoVAb6bHqRgABQ0+7kLDg8Q==", "X-Google-Smtp-Source": "AK7set+r1qYivsl9wCo7KlfMqxO+4NEO/Egi3ao/192LhMH3d2DUZNo5aSneg9N6bpAb2AufIzhffw==", "X-Received": "by 2002:a5e:c001:0:b0:752:8aee:6d91 with SMTP id\n\tu1-20020a5ec001000000b007528aee6d91mr18664332iol.12.1680248452407; \n\tFri, 31 Mar 2023 00:40:52 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 31 Mar 2023 08:23:36 +0100", "Message-Id": "<20230331072341.24851-6-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20230331072341.24851-1-naush@raspberrypi.com>", "References": "<20230331072341.24851-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 05/10] ipa: raspberrypi: alsc: Use a\n\tbetter type name for sparse arrays", "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>", "From": "Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Naushir Patuck <naush@raspberrypi.com>", "Cc": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "From: David Plowman <david.plowman@raspberrypi.com>\n\nThe algorithm uses the data type std::vector<std::array<double, 4>> to\nrepresent the large sparse matrices that are XY (X, Y being the ALSC\ngrid size) high but with only 4 non-zero elements on each row.\n\nReplace this slightly long type name by SparseArray<double>.\n\nNo functional changes.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n src/ipa/raspberrypi/controller/rpi/alsc.cpp | 24 ++++++++++-----------\n src/ipa/raspberrypi/controller/rpi/alsc.h | 10 ++++++++-\n 2 files changed, 21 insertions(+), 13 deletions(-)", "diff": "diff --git a/src/ipa/raspberrypi/controller/rpi/alsc.cpp b/src/ipa/raspberrypi/controller/rpi/alsc.cpp\nindex 524c48093590..3a2e8fe00ca6 100644\n--- a/src/ipa/raspberrypi/controller/rpi/alsc.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/alsc.cpp\n@@ -607,7 +607,7 @@ static double computeWeight(double Ci, double Cj, double sigma)\n \n /* Compute all weights. */\n static void computeW(const Array2D<double> &C, double sigma,\n-\t\t std::vector<std::array<double, 4>> &W)\n+\t\t SparseArray<double> &W)\n {\n \tsize_t XY = C.size();\n \tsize_t X = C.dimensions().width;\n@@ -623,8 +623,8 @@ static void computeW(const Array2D<double> &C, double sigma,\n \n /* Compute M, the large but sparse matrix such that M * lambdas = 0. */\n static void constructM(const Array2D<double> &C,\n-\t\t const std::vector<std::array<double, 4>> &W,\n-\t\t std::vector<std::array<double, 4>> &M)\n+\t\t const SparseArray<double> &W,\n+\t\t SparseArray<double> &M)\n {\n \tsize_t XY = C.size();\n \tsize_t X = C.dimensions().width;\n@@ -651,37 +651,37 @@ static void constructM(const Array2D<double> &C,\n * left/right neighbours are zero down the left/right edges, so we don't need\n * need to test the i value to exclude them.\n */\n-static double computeLambdaBottom(int i, const std::vector<std::array<double, 4>> &M,\n+static double computeLambdaBottom(int i, const SparseArray<double> &M,\n \t\t\t\t Array2D<double> &lambda)\n {\n \treturn M[i][1] * lambda[i + 1] + M[i][2] * lambda[i + lambda.dimensions().width] +\n \t M[i][3] * lambda[i - 1];\n }\n-static double computeLambdaBottomStart(int i, const std::vector<std::array<double, 4>> &M,\n+static double computeLambdaBottomStart(int i, const SparseArray<double> &M,\n \t\t\t\t Array2D<double> &lambda)\n {\n \treturn M[i][1] * lambda[i + 1] + M[i][2] * lambda[i + lambda.dimensions().width];\n }\n-static double computeLambdaInterior(int i, const std::vector<std::array<double, 4>> &M,\n+static double computeLambdaInterior(int i, const SparseArray<double> &M,\n \t\t\t\t Array2D<double> &lambda)\n {\n \treturn M[i][0] * lambda[i - lambda.dimensions().width] + M[i][1] * lambda[i + 1] +\n \t M[i][2] * lambda[i + lambda.dimensions().width] + M[i][3] * lambda[i - 1];\n }\n-static double computeLambdaTop(int i, const std::vector<std::array<double, 4>> &M,\n+static double computeLambdaTop(int i, const SparseArray<double> &M,\n \t\t\t Array2D<double> &lambda)\n {\n \treturn M[i][0] * lambda[i - lambda.dimensions().width] + M[i][1] * lambda[i + 1] +\n \t M[i][3] * lambda[i - 1];\n }\n-static double computeLambdaTopEnd(int i, const std::vector<std::array<double, 4>> &M,\n+static double computeLambdaTopEnd(int i, const SparseArray<double> &M,\n \t\t\t\t Array2D<double> &lambda)\n {\n \treturn M[i][0] * lambda[i - lambda.dimensions().width] + M[i][3] * lambda[i - 1];\n }\n \n /* Gauss-Seidel iteration with over-relaxation. */\n-static double gaussSeidel2Sor(const std::vector<std::array<double, 4>> &M, double omega,\n+static double gaussSeidel2Sor(const SparseArray<double> &M, double omega,\n \t\t\t Array2D<double> &lambda, double lambdaBound)\n {\n \tint XY = lambda.size();\n@@ -753,8 +753,8 @@ static void reaverage(Array2D<double> &data)\n \n static void runMatrixIterations(const Array2D<double> &C,\n \t\t\t\tArray2D<double> &lambda,\n-\t\t\t\tconst std::vector<std::array<double, 4>> &W,\n-\t\t\t\tstd::vector<std::array<double, 4>> &M, double omega,\n+\t\t\t\tconst SparseArray<double> &W,\n+\t\t\t\tSparseArray<double> &M, double omega,\n \t\t\t\tunsigned int nIter, double threshold, double lambdaBound)\n {\n \tconstructM(C, W, M);\n@@ -813,7 +813,7 @@ void Alsc::doAlsc()\n {\n \tArray2D<double> &cr = tmpC_[0], &cb = tmpC_[1], &calTableR = tmpC_[2],\n \t\t\t&calTableB = tmpC_[3], &calTableTmp = tmpC_[4];\n-\tstd::vector<std::array<double, 4>> &wr = tmpM_[0], &wb = tmpM_[1], &M = tmpM_[2];\n+\tSparseArray<double> &wr = tmpM_[0], &wb = tmpM_[1], &M = tmpM_[2];\n \n \t/*\n \t * Calculate our R/B (\"Cr\"/\"Cb\") colour statistics, and assess which are\ndiff --git a/src/ipa/raspberrypi/controller/rpi/alsc.h b/src/ipa/raspberrypi/controller/rpi/alsc.h\nindex 1ab61299c4cd..0b6d9478073c 100644\n--- a/src/ipa/raspberrypi/controller/rpi/alsc.h\n+++ b/src/ipa/raspberrypi/controller/rpi/alsc.h\n@@ -68,6 +68,14 @@ private:\n \tstd::vector<T> data_;\n };\n \n+/*\n+ * We'll use the term SparseArray for the large sparse matrices that are\n+ * XY tall but have only 4 non-zero elements on each row.\n+ */\n+\n+template<typename T>\n+using SparseArray = std::vector<std::array<T, 4>>;\n+\n struct AlscCalibration {\n \tdouble ct;\n \tArray2D<double> table;\n@@ -160,7 +168,7 @@ private:\n \n \t/* Temporaries for the computations */\n \tstd::array<Array2D<double>, 5> tmpC_;\n-\tstd::array<std::vector<std::array<double, 4>>, 3> tmpM_;\n+\tstd::array<SparseArray<double>, 3> tmpM_;\n };\n \n } /* namespace RPiController */\n", "prefixes": [ "libcamera-devel", "v3", "05/10" ] }