Show a patch.

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

{
    "id": 16262,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/16262/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/16262/",
    "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": "<20220617092315.120781-6-fsylvestre@baylibre.com>",
    "date": "2022-06-17T09:23:15",
    "name": "[libcamera-devel,v3,5/5] ipa: rkisp1: add support of Black Level Correction default values",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "2a82372507c44da6f93fb5e419fa1de27e24b949",
    "submitter": {
        "id": 123,
        "url": "https://patchwork.libcamera.org/api/1.1/people/123/?format=api",
        "name": "Florian Sylvestre",
        "email": "fsylvestre@baylibre.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/16262/mbox/",
    "series": [
        {
            "id": 3186,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3186/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3186",
            "date": "2022-06-17T09:23:10",
            "name": "Add tuning file support for rkisp1 blc algo",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/3186/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/16262/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/16262/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 8423EC3277\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 17 Jun 2022 09:23:57 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7F50F65649;\n\tFri, 17 Jun 2022 11:23:56 +0200 (CEST)",
            "from mail-wm1-x330.google.com (mail-wm1-x330.google.com\n\t[IPv6:2a00:1450:4864:20::330])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D34756563F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 17 Jun 2022 11:23:52 +0200 (CEST)",
            "by mail-wm1-x330.google.com with SMTP id\n\tc130-20020a1c3588000000b0039c6fd897b4so4037923wma.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 17 Jun 2022 02:23:52 -0700 (PDT)",
            "from BL087.. ([2a01:e34:eea9:e630:4718:73b:d035:3786])\n\tby smtp.gmail.com with ESMTPSA id\n\th81-20020a1c2154000000b0039c41686421sm7962328wmh.17.2022.06.17.02.23.51\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 17 Jun 2022 02:23:51 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655457836;\n\tbh=TloXXzm5eo2KHa8EodsfPeU+QqYB63AheceWFReMO2g=;\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=nZlYXwR4tYFH8VcbB+cLcX/q2ITVuSE0yhsQzEJODCntCq5zWLQH0PIkvc23/ktek\n\tBGDejN/lo/ZFkl+MXiv91Q8qbooCVTeiP2ArjkbMKCNap/+hWVQNXNZ6f7yzmxYEq+\n\t2FdS8/e9YpKSD67pajxTqgDDftscvkIR10IGPJlVttz/uWL/yg0THKkLkVelcMLc9s\n\tkgg+A0WHKRJeDKx1x3yFgSWvnZGQSbjslQ6sDuFMfdKxXeDEK1qWBExz8BVew9hiVd\n\t5LhL2TQ7aMva+l5eCUn2qpMJQf/Ziu1f8j8kvNETJTuKNJD/r7Y16Ort8xcjacw1RQ\n\teEPJ8B8GNcomQ==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=baylibre-com.20210112.gappssmtp.com; s=20210112;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=XeKsV/YuY0fyhoiofGONCkdluUpahL9gkkVSrZ2xqrQ=;\n\tb=FchiH7XpKmvEux2rwv8t9105jqb4Yr2mUVclfaPl+wJM/pDA5+b+OKb7U73e23F0rN\n\tpXdQU4gt21KwSSXa5q1cn4OKBsodYAl03Zh2AMGW1Wwq07T4ETCVzxi12vjIt+XJGq4x\n\tOB0BI8OoCvDoHJ21DREEwetDlZngH+RqDet38NKaD3V0Ry01JbOofrQ+ZLABCUa9SyGH\n\tgu2jWW00jpGA+EoNWjWPPqEqeMtZ/t9S1I5yswU7DG6OLMpqJIv+akdU9ckR8IjvK+sF\n\twSQKbPVPmkMUsJldaNgONXQ38qnfH3fZgand0baxkdcDt0umdKVk/DeuNsqL/gHKBwbQ\n\txBmg=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=baylibre-com.20210112.gappssmtp.com\n\theader.i=@baylibre-com.20210112.gappssmtp.com header.b=\"FchiH7Xp\"; \n\tdkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=XeKsV/YuY0fyhoiofGONCkdluUpahL9gkkVSrZ2xqrQ=;\n\tb=s19HfovdpPjTQit97zO+gfyWW1QMlXVjJUj7grWIjzSfYE6S/J+nn7mSt8XssznzMV\n\thrT72Bvyfv+8cTTpdZLV2vLFFnEtlVLyrEwHqdSWT/UWvBaN5Eschl8qxahvN47eeJu/\n\toNZddVdDbTH4TCWE6mPjLQ7cgs3waQyO60RMI8WqH/uybHNNYij5a++fnO4QOgqbACJX\n\txM9bDLfoYihAX4Sia8S62cTJgVs4n+gL04t07I5LD/PJKTrv6YzCCZtZze+zyZNWg3hR\n\tF5kAzoScpfWUVxFFQyMc1a03d1fCDoVIaoKqpxX9RcQgSYJ0Jq4gcax6qW9Rg3QC+6DQ\n\tTnWQ==",
        "X-Gm-Message-State": "AOAM532mcHReFfL0xC8tiSAgvKblxDcQtixHQudGSPsaGFZBvgHKYImL\n\tG9noQ+8NhEjGvwVC96Q/vqNbGn5eTWN5AA==",
        "X-Google-Smtp-Source": "ABdhPJxb8NPFwY8qo61pAcoKUQMCJ5nfmxPR5SaAPP/olIa6/zOSyY8JiKqnn2VZFNx2ZlysOkJWww==",
        "X-Received": "by 2002:a1c:19c3:0:b0:39c:6479:3ca with SMTP id\n\t186-20020a1c19c3000000b0039c647903camr20090483wmz.27.1655457832100; \n\tFri, 17 Jun 2022 02:23:52 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 17 Jun 2022 11:23:15 +0200",
        "Message-Id": "<20220617092315.120781-6-fsylvestre@baylibre.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20220617092315.120781-1-fsylvestre@baylibre.com>",
        "References": "<20220617092315.120781-1-fsylvestre@baylibre.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3 5/5] ipa: rkisp1: add support of Black\n\tLevel Correction default values",
        "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": "Florian Sylvestre via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Florian Sylvestre <fsylvestre@baylibre.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Get default values for Black Level Correction algorithm form YAML\ntuning file.\n\nSigned-off-by: Florian Sylvestre <fsylvestre@baylibre.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n---\n src/ipa/rkisp1/algorithms/blc.cpp | 62 +++++++++++++++++++++++++++----\n src/ipa/rkisp1/algorithms/blc.h   | 10 ++++-\n 2 files changed, 63 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/src/ipa/rkisp1/algorithms/blc.cpp b/src/ipa/rkisp1/algorithms/blc.cpp\nindex 0c5948ff..aa4fe8c6 100644\n--- a/src/ipa/rkisp1/algorithms/blc.cpp\n+++ b/src/ipa/rkisp1/algorithms/blc.cpp\n@@ -7,6 +7,10 @@\n \n #include \"blc.h\"\n \n+#include <libcamera/base/log.h>\n+\n+#include \"libcamera/internal/yaml_parser.h\"\n+\n /**\n  * \\file blc.h\n  */\n@@ -29,6 +33,48 @@ namespace ipa::rkisp1::algorithms {\n  * isn't currently supported.\n  */\n \n+LOG_DEFINE_CATEGORY(RkISP1Blc)\n+\n+BlackLevelCorrection::BlackLevelCorrection()\n+\t: tuningParameters_(false)\n+{\n+}\n+\n+/**\n+ * \\copydoc libcamera::ipa::Algorithm::init\n+ */\n+int BlackLevelCorrection::init([[maybe_unused]] IPAContext &context,\n+\t\t\t       const YamlObject &params)\n+{\n+\t/* Parse property \"BlackLevelCorrection\". */\n+\tif (!params.contains(\"BlackLevelCorrection\")) {\n+\t\tLOG(RkISP1Blc, Debug) << \"No tuning parameters found for BlackLevelCorrection\";\n+\t\treturn 0;\n+\t}\n+\n+\tconst YamlObject &blcObject = params[\"BlackLevelCorrection\"];\n+\n+\tif (!blcObject.isDictionary()) {\n+\t\tLOG(RkISP1Blc, Error) << \"'BlackLevelCorrection' in tuning file is not a dictionnary\";\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tblackLevelRed_ = blcObject[\"R\"].get<int16_t>(256);\n+\tblackLevelGreenR_ = blcObject[\"Gr\"].get<int16_t>(256);\n+\tblackLevelGreenB_ = blcObject[\"Gb\"].get<int16_t>(256);\n+\tblackLevelBlue_ = blcObject[\"B\"].get<int16_t>(256);\n+\n+\ttuningParameters_ = true;\n+\n+\tLOG(RkISP1Blc, Debug)\n+\t\t<< \" Read black levels red \" << blackLevelRed_\n+\t\t<< \", green (red) \" << blackLevelGreenR_\n+\t\t<< \", green (blue) \" << blackLevelGreenB_\n+\t\t<< \", blue \" << blackLevelBlue_;\n+\n+\treturn 0;\n+}\n+\n /**\n  * \\copydoc libcamera::ipa::Algorithm::prepare\n  */\n@@ -37,15 +83,15 @@ void BlackLevelCorrection::prepare(IPAContext &context,\n {\n \tif (context.frameContext.frameCount > 0)\n \t\treturn;\n-\t/*\n-\t * Substract fixed values taken from imx219 tuning file.\n-\t * \\todo Use a configuration file for it ?\n-\t */\n+\n+\tif (!tuningParameters_)\n+\t\treturn;\n+\n \tparams->others.bls_config.enable_auto = 0;\n-\tparams->others.bls_config.fixed_val.r = 256;\n-\tparams->others.bls_config.fixed_val.gr = 256;\n-\tparams->others.bls_config.fixed_val.gb = 256;\n-\tparams->others.bls_config.fixed_val.b = 256;\n+\tparams->others.bls_config.fixed_val.r = blackLevelRed_;\n+\tparams->others.bls_config.fixed_val.gr = blackLevelGreenR_;\n+\tparams->others.bls_config.fixed_val.gb = blackLevelGreenB_;\n+\tparams->others.bls_config.fixed_val.b = blackLevelBlue_;\n \n \tparams->module_en_update |= RKISP1_CIF_ISP_MODULE_BLS;\n \tparams->module_ens |= RKISP1_CIF_ISP_MODULE_BLS;\ndiff --git a/src/ipa/rkisp1/algorithms/blc.h b/src/ipa/rkisp1/algorithms/blc.h\nindex 69874d8f..c979d327 100644\n--- a/src/ipa/rkisp1/algorithms/blc.h\n+++ b/src/ipa/rkisp1/algorithms/blc.h\n@@ -20,10 +20,18 @@ namespace ipa::rkisp1::algorithms {\n class BlackLevelCorrection : public Algorithm\n {\n public:\n-\tBlackLevelCorrection() = default;\n+\tBlackLevelCorrection();\n \t~BlackLevelCorrection() = default;\n \n+\tint init(IPAContext &context, const YamlObject &params) override;\n \tvoid prepare(IPAContext &context, rkisp1_params_cfg *params) override;\n+\n+private:\n+\tbool tuningParameters_;\n+\tint16_t blackLevelRed_;\n+\tint16_t blackLevelGreenR_;\n+\tint16_t blackLevelGreenB_;\n+\tint16_t blackLevelBlue_;\n };\n \n } /* namespace ipa::rkisp1::algorithms */\n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "5/5"
    ]
}