Patch Detail
Show a patch.
GET /api/1.1/patches/16534/?format=api
{ "id": 16534, "url": "https://patchwork.libcamera.org/api/1.1/patches/16534/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16534/", "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": "<20220704152318.221213-5-fsylvestre@baylibre.com>", "date": "2022-07-04T15:23:18", "name": "[libcamera-devel,4/4] ipa: rkisp1: Add support of ColorProcessing control", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "d427a45e6ea7f1cf26c72e30c377f64d0b681678", "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/16534/mbox/", "series": [ { "id": 3247, "url": "https://patchwork.libcamera.org/api/1.1/series/3247/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3247", "date": "2022-07-04T15:23:14", "name": "Add Demosaicing and Color Processing control for rkisp1", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3247/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16534/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16534/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 06A74BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 4 Jul 2022 15:23:30 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B06EA6565A;\n\tMon, 4 Jul 2022 17:23:29 +0200 (CEST)", "from mail-wm1-x331.google.com (mail-wm1-x331.google.com\n\t[IPv6:2a00:1450:4864:20::331])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 01D3565656\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 4 Jul 2022 17:23:28 +0200 (CEST)", "by mail-wm1-x331.google.com with SMTP id\n\to16-20020a05600c379000b003a02eaea815so6820096wmr.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 04 Jul 2022 08:23:27 -0700 (PDT)", "from BL087.. ([2a01:e34:eea9:e630:ca4a:68b5:560f:5682])\n\tby smtp.gmail.com with ESMTPSA id\n\tp15-20020a05600c204f00b0039c5cecf206sm19603199wmg.4.2022.07.04.08.23.25\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 04 Jul 2022 08:23:25 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1656948209;\n\tbh=QzRrqs99qNCE6wYpDgldZ1zuCI/Mo1WhxRQz6bRcTiA=;\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=MNHFgyL2YlCFTJe0jomBlpeEfh0q0K3komjirmUpMOKpLdHU8djvnjJlIpq1EeDXP\n\tA1RK93q0UBJtQhUjf6VRUWIzH3sFZkgaATuXGUR7dOxZFbVewUJmxBWSUzD8Th18Vz\n\th7UThoNjGiSg72kHQTUu2mTFpaUZ17x/+QvnDXA5l/76TEqGQgEmyYjT/zxvqXSsPm\n\t45HN/M+PoNE0a5oZJwXWCLFmAa5bJcuBDf+ViakPEDykXvxp7ih4rdGUMrHBXmV9Z+\n\ttoh/qTnX7BxdTq4qJsYZiciE1LdFhfZ9asmRnQ/UrveZ+lJnngyeEI7Od87q+Uo9KC\n\t9+C4DtivY3JWg==", "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=ZHdKIv5kQQXb0EA7dV48Tixdt7wNv4+1ifWMHIKgfa0=;\n\tb=A1Qpifi44YEIjFwXHnwyvnLLUbFVzcj3IrJiyLuLMjIFVQmHVayWp7P7n+gFFaIhMY\n\tLXYCH3iurgb3UUJLgnV/cCCartpCb8fXo//G2TjCJEOwh/lz1xqfIpTFT5afwevU3FLV\n\tjLH/OFxltoXPZqbM4//chDBkFTYFYyfATop7Zp7/2U3eM6/nq+7OGRoEWuAkL9KLI5n7\n\taQp9nbUjk01pSQYKg0Id1vMvYctlD6WrE6sj7Eiyrzj4cej0g/r3a9j7V3mvST4R6bt1\n\tOLe+9/sy9CILyeLTyDA/rcBZb+0Xv/ps5D4qV+lc/AhXGlKEh1sxgyeYDcekqrDCq7A8\n\tGkjw==" ], "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=\"A1Qpifi4\"; \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=ZHdKIv5kQQXb0EA7dV48Tixdt7wNv4+1ifWMHIKgfa0=;\n\tb=dMn5RtIXUQJF38WQyFSpcxPz5Np6OXKPqlnX0b0mysVLWpxxkYU5kW8050LoFEFikf\n\tDNC1da7SmJWpwVQb/7G4e65FURTrIiSW4tctakz/0FETO/mBoC8Jvvh4nwE2PbIZNEvG\n\tFlLQ0dFRHoLWHQcaKO9mAAveDVn0cUSXD5a6/L8MiP6C0WqZRNdeuXLF9qVdZceEPmYB\n\tm2oEUO+WAVBO/Fkxhri5zJlULnUYw/H7fcRouC4kBIGHJTUXXEiXFSCFQlX/YCMsr/RO\n\tEfAAFQtvnct3DTX8kL05d7arhI2O5MRSEzhDwEihxVu72Pdv7T1Kth8xFISBUv/NfHyE\n\tOQ6A==", "X-Gm-Message-State": "AJIora9DkrvEvaEEY1GnNVsbZpoQituf4FcnJ5l+gtvq5qQ5rkcjcQLm\n\t/ZTdw0XmgfQXelkF81/XlsteTrFuZfHXaA==", "X-Google-Smtp-Source": "AGRyM1uMa37m+ztKEEgliZQu/K0h0GVIAV+x6wtgHDijYuXkBaw4jSretUCN8+oHaBJidNW1RME1kg==", "X-Received": "by 2002:a7b:c381:0:b0:3a2:aef9:8df4 with SMTP id\n\ts1-20020a7bc381000000b003a2aef98df4mr4683209wmj.7.1656948207217; \n\tMon, 04 Jul 2022 08:23:27 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 4 Jul 2022 17:23:18 +0200", "Message-Id": "<20220704152318.221213-5-fsylvestre@baylibre.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20220704152318.221213-1-fsylvestre@baylibre.com>", "References": "<20220704152318.221213-1-fsylvestre@baylibre.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 4/4] ipa: rkisp1: Add support of\n\tColorProcessing control", "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": "Add ColorProcessing algorithm that is in charge to manage brightness, contrast\nand saturation controls.\nThese controls are currently based on user controls.\n\nSigned-off-by: Florian Sylvestre <fsylvestre@baylibre.com>\n---\n .../rkisp1/algorithms/color_processing.cpp | 101 ++++++++++++++++++\n src/ipa/rkisp1/algorithms/color_processing.h | 38 +++++++\n src/ipa/rkisp1/algorithms/meson.build | 1 +\n src/ipa/rkisp1/data/ov5640.yaml | 1 +\n src/ipa/rkisp1/rkisp1.cpp | 1 +\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 12 +++\n 6 files changed, 154 insertions(+)\n create mode 100644 src/ipa/rkisp1/algorithms/color_processing.cpp\n create mode 100644 src/ipa/rkisp1/algorithms/color_processing.h", "diff": "diff --git a/src/ipa/rkisp1/algorithms/color_processing.cpp b/src/ipa/rkisp1/algorithms/color_processing.cpp\nnew file mode 100644\nindex 00000000..a7f2a470\n--- /dev/null\n+++ b/src/ipa/rkisp1/algorithms/color_processing.cpp\n@@ -0,0 +1,101 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2021-2022, Ideas On Board\n+ *\n+ * lsc.cpp - RkISP1 Defect Pixel Cluster Correction control\n+ */\n+\n+#include \"color_processing.h\"\n+\n+#include <libcamera/base/log.h>\n+\n+#include <libcamera/control_ids.h>\n+\n+#include \"libcamera/internal/yaml_parser.h\"\n+#include \"linux/rkisp1-config.h\"\n+\n+/**\n+ * \\file color-processing.h\n+ */\n+\n+namespace libcamera {\n+\n+namespace ipa::rkisp1::algorithms {\n+\n+/**\n+ * \\class ColorProcessing\n+ * \\brief RkISP1 Color Processing control\n+ *\n+ * The ColorProcessing algorithm is responsible to apply brightness, contrast\n+ * and saturation corrections.\n+ * The coefficient applied for brightness, contrast and saturation are directly\n+ * provided by user controls.\n+ */\n+\n+LOG_DEFINE_CATEGORY(RkISP1ColorProcessing)\n+\n+ColorProcessing::ColorProcessing()\n+\t: userBrightness_(0), userContrast_(0),\n+\t userSaturation_(0), updateUserControls_(true)\n+{\n+}\n+\n+/**\n+ * \\copydoc libcamera::ipa::Algorithm::queueRequest\n+ */\n+void ColorProcessing::queueRequest([[maybe_unused]] IPAContext &context,\n+\t\t\t\t [[maybe_unused]] const uint32_t frame,\n+\t\t\t\t const ControlList &controls)\n+{\n+\tfor (auto const &ctrl : controls) {\n+\t\tif (ctrl.first == controls::BRIGHTNESS) {\n+\t\t\tuserBrightness_ = ctrl.second.get<float>();\n+\t\t\tupdateUserControls_ = true;\n+\n+\t\t\tLOG(RkISP1ColorProcessing, Debug)\n+\t\t\t\t<< \"Set brightness to: \"\n+\t\t\t\t<< int(userBrightness_);\n+\t\t} else if (ctrl.first == controls::CONTRAST) {\n+\t\t\tuserContrast_ = ctrl.second.get<float>();\n+\t\t\tupdateUserControls_ = true;\n+\n+\t\t\tLOG(RkISP1ColorProcessing, Debug)\n+\t\t\t\t<< \"Set contrast to: \"\n+\t\t\t\t<< int(userContrast_);\n+\t\t} else if (ctrl.first == controls::SATURATION) {\n+\t\t\tuserSaturation_ = ctrl.second.get<float>();\n+\t\t\tupdateUserControls_ = true;\n+\n+\t\t\tLOG(RkISP1ColorProcessing, Debug)\n+\t\t\t\t<< \"Set saturation to: \"\n+\t\t\t\t<< int(userSaturation_);\n+\t\t}\n+\t}\n+}\n+\n+/**\n+ * \\copydoc libcamera::ipa::Algorithm::prepare\n+ */\n+void ColorProcessing::prepare([[maybe_unused]] IPAContext &context,\n+\t\t\t rkisp1_params_cfg *params)\n+{\n+\t/* Check if the algorithm configuration has been updated. */\n+\tif (!updateUserControls_)\n+\t\treturn;\n+\n+\tupdateUserControls_ = false;\n+\n+\tparams->others.cproc_config.brightness = userBrightness_;\n+\tparams->others.cproc_config.contrast = userContrast_;\n+\tparams->others.cproc_config.sat = userSaturation_;\n+\n+\tparams->module_en_update |= RKISP1_CIF_ISP_MODULE_CPROC;\n+\tparams->module_ens |= RKISP1_CIF_ISP_MODULE_CPROC;\n+\tparams->module_cfg_update |= RKISP1_CIF_ISP_MODULE_CPROC;\n+}\n+\n+REGISTER_IPA_ALGORITHM(ColorProcessing, \"ColorProcessing\")\n+\n+} /* namespace ipa::rkisp1::algorithms */\n+\n+} /* namespace libcamera */\ndiff --git a/src/ipa/rkisp1/algorithms/color_processing.h b/src/ipa/rkisp1/algorithms/color_processing.h\nnew file mode 100644\nindex 00000000..bdb40bd1\n--- /dev/null\n+++ b/src/ipa/rkisp1/algorithms/color_processing.h\n@@ -0,0 +1,38 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2021-2022, Ideas On Board\n+ *\n+ * dpcc.h - RkISP1 Color Processing control\n+ */\n+\n+#pragma once\n+\n+#include <sys/types.h>\n+#include <linux/rkisp1-config.h>\n+\n+#include \"algorithm.h\"\n+\n+namespace libcamera {\n+\n+struct IPACameraSensorInfo;\n+\n+namespace ipa::rkisp1::algorithms {\n+\n+class ColorProcessing : public Algorithm\n+{\n+public:\n+\tColorProcessing();\n+\t~ColorProcessing() = default;\n+\n+\tvoid queueRequest(IPAContext &context, const uint32_t frame,\n+\t\t\t const ControlList &controls) override;\n+\tvoid prepare(IPAContext &context, rkisp1_params_cfg *params) override;\n+private:\n+\tuint32_t userBrightness_;\n+\tuint32_t userContrast_;\n+\tuint32_t userSaturation_;\n+\tbool updateUserControls_;\n+};\n+\n+} /* namespace ipa::rkisp1::algorithms */\n+} /* namespace libcamera */\ndiff --git a/src/ipa/rkisp1/algorithms/meson.build b/src/ipa/rkisp1/algorithms/meson.build\nindex 7e078b0d..7f9c3899 100644\n--- a/src/ipa/rkisp1/algorithms/meson.build\n+++ b/src/ipa/rkisp1/algorithms/meson.build\n@@ -4,6 +4,7 @@ rkisp1_ipa_algorithms = files([\n 'agc.cpp',\n 'awb.cpp',\n 'blc.cpp',\n+ 'color_processing.cpp',\n 'demosaicing.cpp',\n 'dpcc.cpp',\n 'gsl.cpp',\ndiff --git a/src/ipa/rkisp1/data/ov5640.yaml b/src/ipa/rkisp1/data/ov5640.yaml\nindex 4ae0ffc0..331f9d2d 100644\n--- a/src/ipa/rkisp1/data/ov5640.yaml\n+++ b/src/ipa/rkisp1/data/ov5640.yaml\n@@ -10,6 +10,7 @@ algorithms:\n Gr: 256\n Gb: 256\n B: 256\n+ - ColorProcessing:\n - GammaSensorLinearization:\n x-intervals: [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]\n y:\ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex 85a75070..d380c59b 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -31,6 +31,7 @@\n #include \"algorithms/algorithm.h\"\n #include \"algorithms/awb.h\"\n #include \"algorithms/blc.h\"\n+#include \"algorithms/color_processing.h\"\n #include \"algorithms/demosaicing.h\"\n #include \"algorithms/dpcc.h\"\n #include \"algorithms/gsl.h\"\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 3d0075ee..4e82ab39 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -957,6 +957,18 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)\n \t\t std::forward_as_tuple(&controls::Sharpness),\n \t\t std::forward_as_tuple(0.0f, 10.0f, 1.0f));\n \n+\tctrls.emplace(std::piecewise_construct,\n+\t\t std::forward_as_tuple(&controls::Brightness),\n+\t\t std::forward_as_tuple(-128.0f, 127.0f));\n+\n+\tctrls.emplace(std::piecewise_construct,\n+\t\t std::forward_as_tuple(&controls::Contrast),\n+\t\t std::forward_as_tuple(0.0f, 1.992f));\n+\n+\tctrls.emplace(std::piecewise_construct,\n+\t\t std::forward_as_tuple(&controls::Saturation),\n+\t\t std::forward_as_tuple(0.0f, 1.992f));\n+\n \tctrls.emplace(std::piecewise_construct,\n \t\t std::forward_as_tuple(&controls::draft::NoiseReductionMode),\n \t\t std::forward_as_tuple(controls::draft::NoiseReductionModeValues));\n", "prefixes": [ "libcamera-devel", "4/4" ] }