{"id":16005,"url":"https://patchwork.libcamera.org/api/patches/16005/?format=json","web_url":"https://patchwork.libcamera.org/patch/16005/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220523092435.475510-6-fsylvestre@baylibre.com>","date":"2022-05-23T09:24:35","name":"[libcamera-devel,libcamera-devel,5/5] ipa: rkisp1: add support of Black Level Correction default values","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"7930d56e65c0860bb751ad16951d2168a6fa13fb","submitter":{"id":123,"url":"https://patchwork.libcamera.org/api/people/123/?format=json","name":"Florian Sylvestre","email":"fsylvestre@baylibre.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16005/mbox/","series":[{"id":3133,"url":"https://patchwork.libcamera.org/api/series/3133/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3133","date":"2022-05-23T09:24:30","name":"Add configuration file support for rkisp1 blc algo","version":1,"mbox":"https://patchwork.libcamera.org/series/3133/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16005/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16005/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 82463C326D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 23 May 2022 09:24:53 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0884765665;\n\tMon, 23 May 2022 11:24:53 +0200 (CEST)","from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com\n\t[IPv6:2a00:1450:4864:20::32e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6692F65664\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 May 2022 11:24:48 +0200 (CEST)","by mail-wm1-x32e.google.com with SMTP id\n\ti20-20020a05600c355400b0039456976dcaso7084265wmq.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 May 2022 02:24:48 -0700 (PDT)","from BL087.. ([2a01:e34:eea9:e630:1bc6:bcdb:60b7:f1d3])\n\tby smtp.gmail.com with ESMTPSA id\n\tw22-20020a1cf616000000b003942a244eebsm8034250wmc.48.2022.05.23.02.24.47\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 23 May 2022 02:24:47 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1653297893;\n\tbh=pF+0FartIekw3vlykOdO3tItB/+BHQEi9mxCGtiusy8=;\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=ltxhor3UlBLsKVP8NWLQyxggAK40VWzYoN4mxHkvhjGF3r0p++ukFtert3vBUpqeh\n\tWSLOGv6DNJitJWSe9YRFWpW1zyazbzBs5pncc18tWrAJhw/8TfmQgG3+ROSD4dEVlk\n\tn0i49k95jXrV9Mxeisu/Nsdj1fzbWKu25aMmdvDVWdgZ47TSbtmgoax3auCvsAAlU8\n\tIGX0bCykkKMfFdM+NZ7J/wrdAW7S2EX2M0H7hIq5qje1Hzkmo+NiZyqiejPdlKnZJM\n\tS0FNbV0oMYpQGNlFvG89+Zr9jVry20y9nvAvxBQ6V1+jTsosAkEEMFatKfGZvkmTnO\n\twh5H0+mkJHJeA==","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=BWYAGTM46cpY4F7Zs7rdKi3eRfvDuDKFa5PryrP+6TE=;\n\tb=hygYUBvW+GiKzi+sM+S2wJRed+uDyzag66XysxkuVjsNbyDJZRaIr3eFjZTMuG0z2U\n\tMsataPnh8aboWE+cp+fVid1h3iTsUOCFFkDTO1tpd7s3Wl1YTOJh+0HGXWKvJ1AC8haQ\n\tXE/he1BjiFeWExhDhd7cBkgZDrfJBi3twoFe39Nm822k5WNn+hIdHqZoOE/G0NTRwrdB\n\tEx2diQBhq7ExVwW+zm06da/+F27yTi91N10VJOdoGDZcuWlxM4KtuBVALJhxW6xKGKA0\n\t/fvQRTzzpQTpvvfu02S5/hvUhlOq3NO4QjbZ6Wab0iW94MVMtQMELn5ljL6oB6ioyJDs\n\tRWSA=="],"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=\"hygYUBvW\"; \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=BWYAGTM46cpY4F7Zs7rdKi3eRfvDuDKFa5PryrP+6TE=;\n\tb=KxJ+XCEgNbg0txso3V+tGyiL7neOceyj2axu5eiaiXrSBKJTLS0SxCzf5X2/00uoet\n\tmz2jkHnN5hiDKeirMAfO3wus7JKe1r7mT20Vo9RFJyeLeSfoahAPaY7J5DtREJpcze81\n\tELgwWJ4xhCs/zG0Mpy6Pc5zlwb54rua0y1yShBQsshRozrz57mL1EP6dRfrZyN5wUTfz\n\tlSdpgd+O9+43krn99t495TFCDbN8E40NhhVRCVc44XDQGxTTZEVgCAXEtbbm6MTtJb7j\n\tbDJ9AtB6MLyLOQyXL5S6Ed8ZpfwP6FENCOHennlfeVCicD3Y3JyiFym5ox2XuTqxRnaR\n\tAUZw==","X-Gm-Message-State":"AOAM532TwbeIbxiqHNP320ladZl7AIPOt4n1iR5cxqSD2jMRCwf/9lK2\n\tYXVhd5AnUTAAAlK1y7Eh9BOo1lIbfWBkUg==","X-Google-Smtp-Source":"ABdhPJxbIgq0PI1P4NMDNZ6WtwOxKXPtAj4SzqnlGdb8rAawGiwso3sN4jx5nw4MNF6V6z/++ZEZhw==","X-Received":"by 2002:a05:600c:1d9d:b0:397:3dc1:5249 with SMTP id\n\tp29-20020a05600c1d9d00b003973dc15249mr11531437wms.144.1653297887787; \n\tMon, 23 May 2022 02:24:47 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 23 May 2022 11:24:35 +0200","Message-Id":"<20220523092435.475510-6-fsylvestre@baylibre.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20220523092435.475510-1-fsylvestre@baylibre.com>","References":"<20220523092435.475510-1-fsylvestre@baylibre.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [libcamera-devel 5/5] ipa: rkisp1: add support of\n\tBlack Level 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\nconfiguration file.\n\nSigned-off-by: Florian Sylvestre <fsylvestre@baylibre.com>\n---\n src/ipa/rkisp1/algorithms/blc.cpp | 46 ++++++++++++++++++++++++++++---\n src/ipa/rkisp1/algorithms/blc.h   |  9 ++++++\n 2 files changed, 51 insertions(+), 4 deletions(-)","diff":"diff --git a/src/ipa/rkisp1/algorithms/blc.cpp b/src/ipa/rkisp1/algorithms/blc.cpp\nindex 0c5948ff..177bc22e 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,40 @@ namespace ipa::rkisp1::algorithms {\n  * isn't currently supported.\n  */\n \n+LOG_DEFINE_CATEGORY(RkISP1Blc)\n+\n+/**\n+ * \\copydoc libcamera::ipa::Algorithm::init\n+ */\n+int BlackLevelCorrection::init(IPAContext &context,\n+\t\t\t       const YamlObject *params)\n+{\n+\tif (context.frameContext.frameCount > 0)\n+\t\treturn -EBUSY;\n+\n+\t/* Parse property \"BlackLevelCorrection\" */\n+\tif (!params->contains(\"BlackLevelCorrection\"))\n+\t\treturn -EINVAL;\n+\n+\tconst YamlObject &blcObject = (*params)[\"BlackLevelCorrection\"];\n+\n+\tif (!blcObject.isDictionary())\n+\t\treturn -EINVAL;\n+\n+\tblackLevelRed_ = blcObject[\"R\"].get<int32_t>(256);\n+\tblackLevelGreenR_ = blcObject[\"Gr\"].get<int32_t>(256);\n+\tblackLevelGreenB_ = blcObject[\"Gb\"].get<int32_t>(256);\n+\tblackLevelBlue_ = blcObject[\"B\"].get<int32_t>(256);\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@@ -42,10 +80,10 @@ void BlackLevelCorrection::prepare(IPAContext &context,\n \t * \\todo Use a configuration file for it ?\n \t */\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..2f6e2d82 100644\n--- a/src/ipa/rkisp1/algorithms/blc.h\n+++ b/src/ipa/rkisp1/algorithms/blc.h\n@@ -13,6 +13,8 @@\n \n namespace libcamera {\n \n+class YamlObject;\n+\n struct IPACameraSensorInfo;\n \n namespace ipa::rkisp1::algorithms {\n@@ -23,7 +25,14 @@ public:\n \tBlackLevelCorrection() = default;\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+\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","libcamera-devel","5/5"]}