Show a patch.

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

{
    "id": 24829,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/24829/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/24829/",
    "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": "<20251026233048.175689-7-kieran.bingham@ideasonboard.com>",
    "date": "2025-10-26T23:30:43",
    "name": "[6/6] ipa: rkisp1: cproc: Provide a Hue control",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "6a1fd86a16b8ae4cf628b01c778fbfb7515c7c4b",
    "submitter": {
        "id": 4,
        "url": "https://patchwork.libcamera.org/api/1.1/people/4/?format=api",
        "name": "Kieran Bingham",
        "email": "kieran.bingham@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/24829/mbox/",
    "series": [
        {
            "id": 5532,
            "url": "https://patchwork.libcamera.org/api/1.1/series/5532/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5532",
            "date": "2025-10-26T23:30:37",
            "name": "libipa: Introduce a Quantized type",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/5532/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/24829/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/24829/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 720A2BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 26 Oct 2025 23:31:06 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CD9C160751;\n\tMon, 27 Oct 2025 00:31:03 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2BCE1606F8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Oct 2025 00:30:55 +0100 (CET)",
            "from charm.hippo-penny.ts.net (unknown [209.38.108.23])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B8A69177B;\n\tMon, 27 Oct 2025 00:29:07 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"HbQxr1i3\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1761521347;\n\tbh=KP+YWnztm0c8cLSMzDHVFJJYgv58QJA33dIgfbcoYJI=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=HbQxr1i34M5giUy2XfueB8dZJvHQHpkeoHEwLQyH0Z222fUKQGxrS5pKSgoTOG1YV\n\t7h+QPWLWUbVXJNvj3uc81F/3XOO3UU6RXnqnOTSOeyNokU53zceJzMmzDKATwct1qD\n\tVpSYiFnqVI6KQCxsvJH4436i2ISAKO1atdKQBuMw=",
        "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "To": "libcamera devel <libcamera-devel@lists.libcamera.org>",
        "Cc": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "Subject": "[PATCH 6/6] ipa: rkisp1: cproc: Provide a Hue control",
        "Date": "Sun, 26 Oct 2025 23:30:43 +0000",
        "Message-ID": "<20251026233048.175689-7-kieran.bingham@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.51.0",
        "In-Reply-To": "<20251026233048.175689-1-kieran.bingham@ideasonboard.com>",
        "References": "<20251026233048.175689-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": "The 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: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/ipa/rkisp1/algorithms/cproc.cpp | 38 +++++++++++++++++++++++++++++\n src/ipa/rkisp1/ipa_context.h        |  2 ++\n 2 files changed, 40 insertions(+)",
    "diff": "diff --git a/src/ipa/rkisp1/algorithms/cproc.cpp b/src/ipa/rkisp1/algorithms/cproc.cpp\nindex d19d808cce4d..a92bf05131ba 100644\n--- a/src/ipa/rkisp1/algorithms/cproc.cpp\n+++ b/src/ipa/rkisp1/algorithms/cproc.cpp\n@@ -39,6 +39,7 @@ 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 class BrightnessQ : public Quantizer<int8_t>\n@@ -59,6 +60,27 @@ public:\n \t}\n };\n \n+class HueQ : public Quantizer<int8_t>\n+{\n+public:\n+\tHueQ(float val) { set(val); }\n+\tHueQ(int8_t val) { set(val); }\n+\n+\tstatic constexpr float MaxDegrees = 90;\n+\tstatic constexpr float q = 128.0f / MaxDegrees;\n+\n+\tint8_t fromFloat(float v) const override\n+\t{\n+\t\tint quantized = std::lround(v * q);\n+\t\treturn static_cast<int8_t>(std::clamp<int>(quantized, -128, 127));\n+\t}\n+\n+\tfloat toFloat(int8_t v) const override\n+\t{\n+\t\treturn static_cast<float>(v) / q;\n+\t}\n+};\n+\n class ContrastSaturationQuantizer : public Quantizer<uint8_t>\n {\n public:\n@@ -92,6 +114,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(-90.0f, 90.0f, kDefaultHue);\n \tcmap[&controls::Saturation] = ControlInfo(0.0f, 1.993f, kDefaultSaturation);\n \n \treturn 0;\n@@ -107,6 +130,7 @@ int ColorProcessing::configure(IPAContext &context,\n \n \tcproc.brightness = BrightnessQ(kDefaultBrightness);\n \tcproc.contrast = ContrastQ(kDefaultContrast);\n+\tcproc.hue = HueQ(kDefaultHue);\n \tcproc.saturation = SaturationQ(kDefaultSaturation);\n \n \treturn 0;\n@@ -148,6 +172,17 @@ void ColorProcessing::queueRequest(IPAContext &context,\n \t\tLOG(RkISP1CProc, Debug) << \"Set contrast to \" << value.value();\n \t}\n \n+\tconst auto &hue = controls.get(controls::Hue);\n+\tif (hue) {\n+\t\tHueQ value = *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.value();\n+\t}\n+\n \tconst auto saturation = controls.get(controls::Saturation);\n \tif (saturation) {\n \t\tSaturationQ value = *saturation;\n@@ -161,6 +196,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@@ -181,6 +217,7 @@ void ColorProcessing::prepare([[maybe_unused]] IPAContext &context,\n \tconfig.setEnabled(true);\n \tconfig->brightness = frameContext.cproc.brightness.quantized();\n \tconfig->contrast = frameContext.cproc.contrast.quantized();\n+\tconfig->hue = frameContext.cproc.hue.quantized();\n \tconfig->sat = frameContext.cproc.saturation.quantized();\n }\n \n@@ -193,6 +230,7 @@ void ColorProcessing::process([[maybe_unused]] IPAContext &context, [[maybe_unus\n {\n \tmetadata.set(controls::Brightness, frameContext.cproc.brightness.value());\n \tmetadata.set(controls::Contrast, frameContext.cproc.contrast.value());\n+\tmetadata.set(controls::Hue, frameContext.cproc.hue.value());\n \tmetadata.set(controls::Saturation, frameContext.cproc.saturation.value());\n }\n \ndiff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\nindex b7cdfc36b275..51281e7f7b82 100644\n--- a/src/ipa/rkisp1/ipa_context.h\n+++ b/src/ipa/rkisp1/ipa_context.h\n@@ -118,6 +118,7 @@ struct IPAActiveState {\n \tstruct {\n \t\tQuantized<int8_t> brightness;\n \t\tQuantized<uint8_t> contrast;\n+\t\tQuantized<int8_t> hue;\n \t\tQuantized<uint8_t> saturation;\n \t} cproc;\n \n@@ -172,6 +173,7 @@ struct IPAFrameContext : public FrameContext {\n \tstruct {\n \t\tQuantized<int8_t> brightness;\n \t\tQuantized<uint8_t> contrast;\n+\t\tQuantized<int8_t> hue;\n \t\tQuantized<uint8_t> saturation;\n \t\tbool update;\n \t} cproc;\n",
    "prefixes": [
        "6/6"
    ]
}