Show a patch.

GET /api/patches/19018/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 19018,
    "url": "https://patchwork.libcamera.org/api/patches/19018/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19018/",
    "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": "<20230915122954.5231-5-david.plowman@raspberrypi.com>",
    "date": "2023-09-15T12:29:53",
    "name": "[libcamera-devel,v4,4/5] ipa: rpi: agc: Add AgcChannelConstraint class",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "e2ff1544b98cf0431a1c8b8000e8d00e3ea5debd",
    "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/19018/mbox/",
    "series": [
        {
            "id": 4024,
            "url": "https://patchwork.libcamera.org/api/series/4024/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4024",
            "date": "2023-09-15T12:29:49",
            "name": "Multi-channel AGC",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/4024/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/19018/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19018/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 0132BC3260\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 15 Sep 2023 12:30:26 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 85E6C6291F;\n\tFri, 15 Sep 2023 14:30:26 +0200 (CEST)",
            "from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com\n\t[IPv6:2a00:1450:4864:20::32f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 167FF62920\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Sep 2023 14:30:23 +0200 (CEST)",
            "by mail-wm1-x32f.google.com with SMTP id\n\t5b1f17b1804b1-402d0eda361so23086335e9.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Sep 2023 05:30:23 -0700 (PDT)",
            "from localhost.localdomain ([195.180.61.40])\n\tby smtp.gmail.com with ESMTPSA id\n\ty14-20020a7bcd8e000000b004030e8ff964sm7435009wmj.34.2023.09.15.05.30.21\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 15 Sep 2023 05:30:21 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1694781026;\n\tbh=1Xr4pR8DrROQ0Dcl/6NOOQtbpvCaJFLJFQ45yEclGpo=;\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=V9XocSmdjfk9rAsKG6R7G3tA2RXi1cXQBxQoQwKdl3R0Py98YlFMKZ9QBhDf1aITe\n\tn3xJDgRp6uMCY33KtK5hPzBjd6pgMyBT7wWC2pFRDTbwtGdTf2T5p3m7zDCVxp7ozs\n\tkzqcw7U2b+afVfYR3Wo3GFR7upsBKPRr/9ahQK/BW8XLtwUZIEd/dfS06Kneav2csQ\n\t4wT2zS2VJhcncvmQ6FjkQVjMAZszJEV+iaa+Jnor34csbYFBeraWei59eOdT4sford\n\tf60eiBJgzFjmU/omdIr+iQ4WOg6VTMF5fU3+3UHxPVaA5cFMFde+Ck7zAbnZ+ppDdA\n\txhD/nYmcQKcMw==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1694781022; x=1695385822;\n\tdarn=lists.libcamera.org; \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=CP7uUqAsGX+5ivupZb0spXi2UflxOvBFjljPrq0s5Zs=;\n\tb=o0i1uiZHYjbvinnG7m+XIn9ciFL3icsJBkPW7bs75jpXLCpPLJHHNawLOqOyzhsBCQ\n\tnYqK4bM+kdbiKbAde83b7LY9GU10UoTaIeFBT38Q4fhWBStdx1Lv8kDRBfTfP47r7Hcx\n\tnHV5Syvx6zTJpIzjXyjJI+4l522aAZymnxFB9HvDqVpVzIjQP3rU6Asxa9+CgJKLfKt/\n\tgrVpLefP+F43aMCnn0PJW4KMJP2scEuZ7o1GTpTYLMQ36zvZs0293AelyABy/LTmIgmH\n\t1dLO5nx2QJCdydpcJUPKetBKMR4B1Fzfy4b125Nxu5hWHUTauKqkSDY1DANQMRdmLC4G\n\t/kyw=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"o0i1uiZH\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1694781022; x=1695385822;\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=CP7uUqAsGX+5ivupZb0spXi2UflxOvBFjljPrq0s5Zs=;\n\tb=U8pERHJtA/IO0lnbbpzLAc00fGjoVJXT0QmSq/WGKHQnNYRYjRzPvjhwGcRB775YKT\n\tpKGhulMZxSF8Q2wzv8yMoxnLiOMHw3TWq8Tj4j/zZvsCpcr1Jr/TFNnc+ruWqA/G4mrd\n\t2TLHyi1yS0URZ8Gvvd+GZf+0psL6mY7VcEknw1YYZdSt5doepyf316Cy9tmUexZJYOnU\n\todX4Nu3+cjIzdJk5z7VVcmEyQdfsTqkDgKGIJp7Qb/Qeycqtny/SmZjJH7GvjbuwDxCD\n\t7Qe2vU+l9mggPswDdwaec6s59Frk+Evl01UxG9PgNRBQO2Bcb7YPZsFbVRMlYphoiG5C\n\tn2Jg==",
        "X-Gm-Message-State": "AOJu0YzaG8ghUlhNARE1QycgrnJ7k4UZj/LRkhvaGAmf9Z84WFVpt8Lr\n\t+1BuJk2Zg5soAoJj3BaYjgEtIWJ/nKtvPMhmdqE=",
        "X-Google-Smtp-Source": "AGHT+IFO9ChwqJVjsIxhXffh830LwsTS5gK1fadzZUGLJrDGkufQGtZyS5y2yBouD/L8DF1KtI1QTA==",
        "X-Received": "by 2002:a05:600c:21da:b0:3fe:2b8c:9f0b with SMTP id\n\tx26-20020a05600c21da00b003fe2b8c9f0bmr1318415wmj.23.1694781022274; \n\tFri, 15 Sep 2023 05:30:22 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 15 Sep 2023 13:29:53 +0100",
        "Message-Id": "<20230915122954.5231-5-david.plowman@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.30.2",
        "In-Reply-To": "<20230915122954.5231-1-david.plowman@raspberrypi.com>",
        "References": "<20230915122954.5231-1-david.plowman@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v4 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>",
        "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": "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>\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n src/ipa/rpi/controller/rpi/agc_channel.cpp | 49 ++++++++++++++++++++++\n src/ipa/rpi/controller/rpi/agc_channel.h   | 10 +++++\n 2 files changed, 59 insertions(+)",
    "diff": "diff --git a/src/ipa/rpi/controller/rpi/agc_channel.cpp b/src/ipa/rpi/controller/rpi/agc_channel.cpp\nindex 9c8d1a6f..afa06686 100644\n--- a/src/ipa/rpi/controller/rpi/agc_channel.cpp\n+++ b/src/ipa/rpi/controller/rpi/agc_channel.cpp\n@@ -170,6 +170,49 @@ readConstraintModes(std::map<std::string, AgcConstraintMode> &constraintModes,\n \treturn { 0, first };\n }\n \n+int AgcChannelConstraint::read(const libcamera::YamlObject &params)\n+{\n+\tauto channelValue = params[\"channel\"].get<unsigned int>();\n+\tif (!channelValue) {\n+\t\tLOG(RPiAgc, Error) << \"AGC channel constraint must have a channel\";\n+\t\treturn -EINVAL;\n+\t}\n+\tchannel = *channelValue;\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 channel constraint type should be UPPER or LOWER\";\n+\t\treturn -EINVAL;\n+\t}\n+\tbound = boundString == \"UPPER\" ? Bound::UPPER : Bound::LOWER;\n+\n+\tauto factorValue = params[\"factor\"].get<double>();\n+\tif (!factorValue) {\n+\t\tLOG(RPiAgc, Error) << \"AGC channel constraint must have a factor\";\n+\t\treturn -EINVAL;\n+\t}\n+\tfactor = *factorValue;\n+\n+\treturn 0;\n+}\n+\n+static int readChannelConstraints(std::vector<AgcChannelConstraint> &channelConstraints,\n+\t\t\t\t  const libcamera::YamlObject &params)\n+{\n+\tfor (const auto &p : params.asList()) {\n+\t\tAgcChannelConstraint constraint;\n+\t\tint ret = constraint.read(p);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\n+\t\tchannelConstraints.push_back(constraint);\n+\t}\n+\n+\treturn 0;\n+}\n+\n int AgcConfig::read(const libcamera::YamlObject &params)\n {\n \tLOG(RPiAgc, Debug) << \"AgcConfig\";\n@@ -188,6 +231,12 @@ int AgcConfig::read(const libcamera::YamlObject &params)\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 b2f554db..ceaab12f 100644\n--- a/src/ipa/rpi/controller/rpi/agc_channel.h\n+++ b/src/ipa/rpi/controller/rpi/agc_channel.h\n@@ -44,11 +44,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 &params);\n+};\n+\n struct AgcConfig {\n \tint read(const libcamera::YamlObject &params);\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",
        "v4",
        "4/5"
    ]
}