Patch Detail
Show a patch.
GET /api/patches/18907/?format=api
{ "id": 18907, "url": "https://patchwork.libcamera.org/api/patches/18907/?format=api", "web_url": "https://patchwork.libcamera.org/patch/18907/", "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": "<20230731094641.73646-5-david.plowman@raspberrypi.com>", "date": "2023-07-31T09:46:40", "name": "[libcamera-devel,4/5] ipa: rpi: agc: Add AgcChannelConstraint class", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "64b54ea68cf87f0c096e429d108c451a982c21ec", "submitter": { "id": 42, "url": "https://patchwork.libcamera.org/api/people/42/?format=api", "name": "David Plowman", "email": "david.plowman@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/18907/mbox/", "series": [ { "id": 3996, "url": "https://patchwork.libcamera.org/api/series/3996/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3996", "date": "2023-07-31T09:46:36", "name": "Multi-channel AGC", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3996/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/18907/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/18907/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 80DABBDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 31 Jul 2023 09:46:52 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2F93E627EF;\n\tMon, 31 Jul 2023 11:46:52 +0200 (CEST)", "from mail-lj1-x233.google.com (mail-lj1-x233.google.com\n\t[IPv6:2a00:1450:4864:20::233])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 23FDC627ED\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 31 Jul 2023 11:46:48 +0200 (CEST)", "by mail-lj1-x233.google.com with SMTP id\n\t38308e7fff4ca-2b74fa5e7d7so62476651fa.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 31 Jul 2023 02:46:48 -0700 (PDT)", "from pi4-davidp.pitowers.org\n\t([2a00:1098:3142:14:2bce:64d6:1a5c:49a2])\n\tby smtp.gmail.com with ESMTPSA id\n\t9-20020a05600c240900b003fa98908014sm13612838wmp.8.2023.07.31.02.46.46\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 31 Jul 2023 02:46:46 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1690796812;\n\tbh=jGq5jBI3BqwxJE7FTkFcHo3Tzt/Lct4FiWi97U8t/Dw=;\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:\n\tFrom;\n\tb=cq6Q+hxRL2Bb2036cb2E6OUW2aNU0jGEUjMmkQ9ERNixklmOdJW3m3oHV/JcMPm+l\n\tT0VozjCettKXs1O75lp4bryXjKkkU21/1HE77gI0W5V2Ih3yxdEWjxKCJjRLlaUMIv\n\tjHJBWmYUqp8p/mYUL7U/kf02giYp8aVbKGqImaTyLJLmaKjGQJ05JVAbmPM7fsaaxO\n\tYo6bfhzIgoSJIhYn75Db8qE/vCQBlaYzTL1/Xdx8Mpwtd/pgXOeuGGBEB2W6qsWPgo\n\tkCeydiRSXJ/5CWONWy/em4w4r8UJY89MAx+ZBPr6ii1QaIS7MCHxVqN11Z90mFspKT\n\t1oqkNlhy5sIyg==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1690796807; x=1691401607;\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=9vptURN2phqMoGwpBtJfb059dhhw16s4PNq8MmQlO9c=;\n\tb=PcxU5ntk9nVmjQPGYiB98sQC4cjYPEuaxew9p/w7sCVNhp9lOi6f9lPjOIDhd8r/ZG\n\tRNxQ5FLtEkyUpuxlDO8AGnxanv7eEe1xX+i+mxpkwV8MDMfQaeFk3Q7NGbEowvK6IAxu\n\tOJdAFb7ccbXeiWQgyz/pYIF5kC6ES/nL4ceuZOBrKhhrvK+pL9jYWjgB8UCd+1QLEOrZ\n\tWU67DO+0TceNJyZRiLOKAX0fyQrSv/pwFEstejGedkftHVbodYZrQXQ+Q98sAG880HW3\n\tv78fnDEaIIihGfD8X0MqVy+5QdRJgmQaHrPOf9oPz/F7ZCTVgjvasTpk3X4Wym6jElwH\n\t2Dww==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"PcxU5ntk\"; dkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20221208; t=1690796807; x=1691401607;\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=9vptURN2phqMoGwpBtJfb059dhhw16s4PNq8MmQlO9c=;\n\tb=Sf2n8ByIQYTYYiPfXBfWR+GOORcnptQEw3ql8SjGMD9r7rzCNG7TCjLfZ1T911x5N3\n\t17gmDy7acnxiSBXVwMNaBlRQxS95GiHlokB2NXadqhzyMI2gCft0DYKiQvjkRtLvombx\n\tM/fUFQmt4S4gRWUsSgaQ9cOoYexPot6URVDOPDl8KI9f8iDh7k4NW7/rTo+/l6BAlxRk\n\tHlbu9NmLLCLuReAdVZqqCW/rTeakBXeckEM4UWNK5V3YqI38GM6c5WBmWsoLjz1wq5xb\n\tjDWyUweLGuhSEH+Ya9T+f2fJmhz2oUzDI7U1Pw1YNIAMtlXn2/fg1Xs6vI3C/DOXpr9b\n\tQYXg==", "X-Gm-Message-State": "ABy/qLbPgPS1sAR+G6E2SQUx02pWW+qAd2LSoQTFcAD7Tva+rDxiJNJP\n\t138zEPpvYuAQccsqw8pJHwUo/ZNlydQ1zB9RPiY=", "X-Google-Smtp-Source": "APBJJlGJe5DiqDhgfKL8QlafMloOwTkNiWXt91kNby/O38RTSvX3zLJGr3gUF0Fa9ejZR+QzKrBZqw==", "X-Received": "by 2002:a2e:93cd:0:b0:2b9:43a7:376e with SMTP id\n\tp13-20020a2e93cd000000b002b943a7376emr3881949ljh.29.1690796807039; \n\tMon, 31 Jul 2023 02:46:47 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 31 Jul 2023 10:46:40 +0100", "Message-Id": "<20230731094641.73646-5-david.plowman@raspberrypi.com>", "X-Mailer": "git-send-email 2.30.2", "In-Reply-To": "<20230731094641.73646-1-david.plowman@raspberrypi.com>", "References": "<20230731094641.73646-1-david.plowman@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 4/5] ipa: rpi: agc: Add\n\tAgcChannelConstraint class", "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": "David Plowman via libcamera-devel <libcamera-devel@lists.libcamera.org>", "Reply-To": "David Plowman <david.plowman@raspberrypi.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "A channel constraint is somewhat similar to the upper/lower bound\nconstraints that we use elsewhere, but these constraints apply between\nmultiple AGC channels. For example, it lets you say things like \"don't\nlet the channel 1 total exposure be more than 8x that of channel 0\",\nand so on. By using both an upper and lower bound constraint, you\ncould fix one AGC channel always to be a fixed ratio of another.\n\nAlso read a vector of them (if present) when loading the tuning file.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/ipa/rpi/controller/rpi/agc_channel.cpp | 42 ++++++++++++++++++++++\n src/ipa/rpi/controller/rpi/agc_channel.h | 10 ++++++\n 2 files changed, 52 insertions(+)", "diff": "diff --git a/src/ipa/rpi/controller/rpi/agc_channel.cpp b/src/ipa/rpi/controller/rpi/agc_channel.cpp\nindex ddec611f..ed8a3b30 100644\n--- a/src/ipa/rpi/controller/rpi/agc_channel.cpp\n+++ b/src/ipa/rpi/controller/rpi/agc_channel.cpp\n@@ -173,6 +173,42 @@ readConstraintModes(std::map<std::string, AgcConstraintMode> &constraintModes,\n \treturn { 0, first };\n }\n \n+int AgcChannelConstraint::read(const libcamera::YamlObject ¶ms)\n+{\n+\tstd::string boundString = params[\"bound\"].get<std::string>(\"\");\n+\ttransform(boundString.begin(), boundString.end(),\n+\t\t boundString.begin(), ::toupper);\n+\tif (boundString != \"UPPER\" && boundString != \"LOWER\") {\n+\t\tLOG(RPiAgc, Error) << \"AGC channelconstraint type should be UPPER or LOWER\";\n+\t\treturn -EINVAL;\n+\t}\n+\tbound = boundString == \"UPPER\" ? Bound::UPPER : Bound::LOWER;\n+\n+\tauto value = params[\"factor\"].get<double>();\n+\tif (!value)\n+\t\treturn -EINVAL;\n+\tfactor = *value;\n+\n+\treturn 0;\n+}\n+\n+int readChannelConstraints(std::vector<AgcChannelConstraint> channelConstraints,\n+\t\t\t const libcamera::YamlObject ¶ms)\n+{\n+\tint ret = 0;\n+\n+\tfor (const auto &p : params.asList()) {\n+\t\tAgcChannelConstraint constraint;\n+\t\tret = constraint.read(p);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\n+\t\tchannelConstraints.push_back(std::move(constraint));\n+\t}\n+\n+\treturn ret;\n+}\n+\n int AgcConfig::read(const libcamera::YamlObject ¶ms)\n {\n \tLOG(RPiAgc, Debug) << \"AgcConfig\";\n@@ -191,6 +227,12 @@ int AgcConfig::read(const libcamera::YamlObject ¶ms)\n \tif (ret)\n \t\treturn ret;\n \n+\tif (params.contains(\"channel_constraints\")) {\n+\t\tret = readChannelConstraints(channelConstraints, params[\"channel_constraints\"]);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t}\n+\n \tret = yTarget.read(params[\"y_target\"]);\n \tif (ret)\n \t\treturn ret;\ndiff --git a/src/ipa/rpi/controller/rpi/agc_channel.h b/src/ipa/rpi/controller/rpi/agc_channel.h\nindex 0e3d44b0..446125ef 100644\n--- a/src/ipa/rpi/controller/rpi/agc_channel.h\n+++ b/src/ipa/rpi/controller/rpi/agc_channel.h\n@@ -42,11 +42,21 @@ struct AgcConstraint {\n \n typedef std::vector<AgcConstraint> AgcConstraintMode;\n \n+struct AgcChannelConstraint {\n+\tenum class Bound { LOWER = 0,\n+\t\t\t UPPER = 1 };\n+\tBound bound;\n+\tunsigned int channel;\n+\tdouble factor;\n+\tint read(const libcamera::YamlObject ¶ms);\n+};\n+\n struct AgcConfig {\n \tint read(const libcamera::YamlObject ¶ms);\n \tstd::map<std::string, AgcMeteringMode> meteringModes;\n \tstd::map<std::string, AgcExposureMode> exposureModes;\n \tstd::map<std::string, AgcConstraintMode> constraintModes;\n+\tstd::vector<AgcChannelConstraint> channelConstraints;\n \tPwl yTarget;\n \tdouble speed;\n \tuint16_t startupFrames;\n", "prefixes": [ "libcamera-devel", "4/5" ] }