Patch Detail
Show a patch.
GET /api/patches/23647/?format=api
{ "id": 23647, "url": "https://patchwork.libcamera.org/api/patches/23647/?format=api", "web_url": "https://patchwork.libcamera.org/patch/23647/", "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": "<20250624171223.2181226-4-kieran.bingham@ideasonboard.com>", "date": "2025-06-24T17:12:23", "name": "[3/3] ipa: rkisp1: cproc: Provide a Hue control", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "f24c2001f96d5a541e2386784cdccc5d966b396a", "submitter": { "id": 4, "url": "https://patchwork.libcamera.org/api/people/4/?format=api", "name": "Kieran Bingham", "email": "kieran.bingham@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/23647/mbox/", "series": [ { "id": 5245, "url": "https://patchwork.libcamera.org/api/series/5245/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5245", "date": "2025-06-24T17:12:20", "name": "rkisp1: cproc - Metadata and Hue developments", "version": 1, "mbox": "https://patchwork.libcamera.org/series/5245/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/23647/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/23647/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 E8CE8C3237\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 24 Jun 2025 17:12:36 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5DC2B68DEC;\n\tTue, 24 Jun 2025 19:12:33 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B6E8768DE6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 24 Jun 2025 19:12:27 +0200 (CEST)", "from Monstersaurus.hippo-penny.ts.net\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 347D9134A;\n\tTue, 24 Jun 2025 19:12:10 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"keClc7JD\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1750785130;\n\tbh=6g3S9fjkjcq7fIKKMWKaZbPmvsHirjBCKluUsFM+Abw=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=keClc7JDLIowTwqzCbvkCVEiG5Geo0zNRBdU/KJasWztWKE2hj9CtwRPKZjqlvWzk\n\tBP+1J1CPL7cTLCvc5R9KbNw1GW3lkd61lCf+Cm9OQgg5ZSZ/vGdbrDF6rsujytUaXC\n\tPnR1qmUILzdtN3kRkIImzZBBOJC88BId8sr4TiGY=", "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>", "To": "libcamera devel <libcamera-devel@lists.libcamera.org>", "Cc": "\"van Veen, Stephan\" <stephan.vanveen@karlstorz.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>", "Subject": "[PATCH 3/3] ipa: rkisp1: cproc: Provide a Hue control", "Date": "Tue, 24 Jun 2025 18:12:23 +0100", "Message-ID": "<20250624171223.2181226-4-kieran.bingham@ideasonboard.com>", "X-Mailer": "git-send-email 2.49.0", "In-Reply-To": "<20250624171223.2181226-1-kieran.bingham@ideasonboard.com>", "References": "<20250624171223.2181226-1-kieran.bingham@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "From: \"van Veen, Stephan\" <stephan.vanveen@karlstorz.com>\n\nThe RKISP1 supports a configurable Hue as part of the colour processing\nunit (cproc).\n\nThis is implemented as a phase shift of the chrominance values between\n-90 and +87.188 degrees.\n\nImplement the new control converting to the hardware scale accordingly\nand report the applied control in the completed request metadata.\n\nSigned-off-by: van Veen, Stephan <stephan.vanveen@karlstorz.com>\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/ipa/rkisp1/algorithms/cproc.cpp | 31 ++++++++++++++++++++++-------\n src/ipa/rkisp1/ipa_context.h | 2 ++\n 2 files changed, 26 insertions(+), 7 deletions(-)", "diff": "diff --git a/src/ipa/rkisp1/algorithms/cproc.cpp b/src/ipa/rkisp1/algorithms/cproc.cpp\nindex 9213ee49b374..217c1ee2b039 100644\n--- a/src/ipa/rkisp1/algorithms/cproc.cpp\n+++ b/src/ipa/rkisp1/algorithms/cproc.cpp\n@@ -27,8 +27,8 @@ namespace ipa::rkisp1::algorithms {\n * \\brief RkISP1 Color Processing control\n *\n * The ColorProcessing algorithm is responsible for applying brightness,\n- * contrast and saturation corrections. The values are directly provided\n- * through requests by the corresponding controls.\n+ * contrast, hue and saturation corrections. The values are directly\n+ * provided through requests by the corresponding controls.\n */\n \n LOG_DEFINE_CATEGORY(RkISP1CProc)\n@@ -37,14 +37,15 @@ namespace {\n \n constexpr float kDefaultBrightness = 0.0f;\n constexpr float kDefaultContrast = 1.0f;\n+constexpr float kDefaultHue = 0.0f;\n constexpr float kDefaultSaturation = 1.0f;\n \n-int convertBrightness(const float v)\n+int convertBrightnessOrHue(const float v)\n {\n \treturn std::clamp<int>(std::lround(v * 128), -128, 127);\n }\n \n-float convertBrightness(const int v)\n+float convertBrightnessOrHue(const int v)\n {\n \treturn static_cast<float>(v) / 128.0f;\n }\n@@ -71,6 +72,7 @@ int ColorProcessing::init(IPAContext &context,\n \n \tcmap[&controls::Brightness] = ControlInfo(-1.0f, 0.993f, kDefaultBrightness);\n \tcmap[&controls::Contrast] = ControlInfo(0.0f, 1.993f, kDefaultContrast);\n+\tcmap[&controls::Hue] = ControlInfo(-1.0f, 0.993f, kDefaultHue);\n \tcmap[&controls::Saturation] = ControlInfo(0.0f, 1.993f, kDefaultSaturation);\n \n \treturn 0;\n@@ -84,8 +86,9 @@ int ColorProcessing::configure(IPAContext &context,\n {\n \tauto &cproc = context.activeState.cproc;\n \n-\tcproc.brightness = convertBrightness(kDefaultBrightness);\n+\tcproc.brightness = convertBrightnessOrHue(kDefaultBrightness);\n \tcproc.contrast = convertContrastOrSaturation(kDefaultContrast);\n+\tcproc.hue = convertBrightnessOrHue(kDefaultHue);\n \tcproc.saturation = convertContrastOrSaturation(kDefaultSaturation);\n \n \treturn 0;\n@@ -107,7 +110,7 @@ void ColorProcessing::queueRequest(IPAContext &context,\n \n \tconst auto &brightness = controls.get(controls::Brightness);\n \tif (brightness) {\n-\t\tint value = convertBrightness(*brightness);\n+\t\tint value = convertBrightnessOrHue(*brightness);\n \t\tif (cproc.brightness != value) {\n \t\t\tcproc.brightness = value;\n \t\t\tupdate = true;\n@@ -127,6 +130,17 @@ void ColorProcessing::queueRequest(IPAContext &context,\n \t\tLOG(RkISP1CProc, Debug) << \"Set contrast to \" << value;\n \t}\n \n+\tconst auto &hue = controls.get(controls::Hue);\n+\tif (hue) {\n+\t\tint value = convertBrightnessOrHue(*hue);\n+\t\tif (cproc.hue != value) {\n+\t\t\tcproc.hue = value;\n+\t\t\tupdate = true;\n+\t\t}\n+\n+\t\tLOG(RkISP1CProc, Debug) << \"Set hue to \" << value;\n+\t}\n+\n \tconst auto saturation = controls.get(controls::Saturation);\n \tif (saturation) {\n \t\tint value = convertContrastOrSaturation(*saturation);\n@@ -140,6 +154,7 @@ void ColorProcessing::queueRequest(IPAContext &context,\n \n \tframeContext.cproc.brightness = cproc.brightness;\n \tframeContext.cproc.contrast = cproc.contrast;\n+\tframeContext.cproc.hue = cproc.hue;\n \tframeContext.cproc.saturation = cproc.saturation;\n \tframeContext.cproc.update = update;\n }\n@@ -160,6 +175,7 @@ void ColorProcessing::prepare([[maybe_unused]] IPAContext &context,\n \tconfig.setEnabled(true);\n \tconfig->brightness = frameContext.cproc.brightness;\n \tconfig->contrast = frameContext.cproc.contrast;\n+\tconfig->hue = frameContext.cproc.hue;\n \tconfig->sat = frameContext.cproc.saturation;\n }\n \n@@ -170,8 +186,9 @@ void ColorProcessing::process([[maybe_unused]] IPAContext &context, [[maybe_unus\n \t\t\t IPAFrameContext &frameContext, [[maybe_unused]] const rkisp1_stat_buffer *stats,\n \t\t\t ControlList &metadata)\n {\n-\tmetadata.set(controls::Brightness, convertBrightness(frameContext.cproc.brightness));\n+\tmetadata.set(controls::Brightness, convertBrightnessOrHue(frameContext.cproc.brightness));\n \tmetadata.set(controls::Contrast, convertContrastOrSaturation(frameContext.cproc.contrast));\n+\tmetadata.set(controls::Hue, convertBrightnessOrHue(frameContext.cproc.hue));\n \tmetadata.set(controls::Saturation, convertContrastOrSaturation(frameContext.cproc.saturation));\n }\n \ndiff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\nindex f0d504215d34..54234ea3acc4 100644\n--- a/src/ipa/rkisp1/ipa_context.h\n+++ b/src/ipa/rkisp1/ipa_context.h\n@@ -108,6 +108,7 @@ struct IPAActiveState {\n \tstruct {\n \t\tint8_t brightness;\n \t\tuint8_t contrast;\n+\t\tint8_t hue;\n \t\tuint8_t saturation;\n \t} cproc;\n \n@@ -152,6 +153,7 @@ struct IPAFrameContext : public FrameContext {\n \tstruct {\n \t\tint8_t brightness;\n \t\tuint8_t contrast;\n+\t\tint8_t hue;\n \t\tuint8_t saturation;\n \t\tbool update;\n \t} cproc;\n", "prefixes": [ "3/3" ] }