Show a patch.

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

{
    "id": 25654,
    "url": "https://patchwork.libcamera.org/api/patches/25654/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/25654/",
    "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": "<20260106170059.56193-2-bryan.odonoghue@linaro.org>",
    "date": "2026-01-06T17:00:36",
    "name": "[v11,01/24] libcamera: software_isp: debayer: Latch contrastExp not contrast to debayer parameters",
    "commit_ref": "a1a6253ff93ebff81984e2eac778bad32f8c88c3",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "4fa5d7e67226e6615efad7b0faa62fa3212d1792",
    "submitter": {
        "id": 175,
        "url": "https://patchwork.libcamera.org/api/people/175/?format=api",
        "name": "Bryan O'Donoghue",
        "email": "bryan.odonoghue@linaro.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/25654/mbox/",
    "series": [
        {
            "id": 5689,
            "url": "https://patchwork.libcamera.org/api/series/5689/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5689",
            "date": "2026-01-06T17:00:35",
            "name": "Add GLES 2.0 GPUISP to libcamera",
            "version": 10,
            "mbox": "https://patchwork.libcamera.org/series/5689/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/25654/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/25654/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 980EFBDCC0\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  6 Jan 2026 17:01:06 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4014461FD2;\n\tTue,  6 Jan 2026 18:01:06 +0100 (CET)",
            "from mail-wr1-x433.google.com (mail-wr1-x433.google.com\n\t[IPv6:2a00:1450:4864:20::433])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6E74461FD3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  6 Jan 2026 18:01:04 +0100 (CET)",
            "by mail-wr1-x433.google.com with SMTP id\n\tffacd0b85a97d-42e2ba54a6fso452598f8f.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 06 Jan 2026 09:01:04 -0800 (PST)",
            "from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie.\n\t[188.141.3.146]) by smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-432bd0dadcfsm5515322f8f.3.2026.01.06.09.01.02\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 06 Jan 2026 09:01:03 -0800 (PST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"vLUBsVcU\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1767718864; x=1768323664;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=e2IR4ED7mZBKvzF2+iSu2ko6YvEmnv4sI3xsTCm2tIc=;\n\tb=vLUBsVcUHBTD0Beet/DLK4iXvhjniL6I2Pv2LokpIlXHcPb0WALOQWkK+CR6wj8iZe\n\tkD9BWdoyaHmCRD2HLNXHgpvW8J2tGfIR/Hgu9TnPsUHq0nNiARUxOuJ6MgdfIcgSN5pc\n\tle/ma5ha0tyJOxzTSTcKcourgdrvbvLi326Zd5C1B6g/uLDgiJeuGZZmrUs2vSR8WPq3\n\tv7Sy0UJkxPMyQ70pKdgD8uwKQ7qCvNaRSoQrokei9XlpCRk/RRjOy+8LwWTUp4Zlj/JL\n\t7n3iVWbs+6eYTJZnahSPlLDPhmyBcteAqEX6ftNhExUES7Wo+dG9JHrVnRBw7Nx1FABv\n\tPE/A==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1767718864; x=1768323664;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n\t:to:cc:subject:date:message-id:reply-to;\n\tbh=e2IR4ED7mZBKvzF2+iSu2ko6YvEmnv4sI3xsTCm2tIc=;\n\tb=IxKbXiDylvpIYkUItSQcWHZ+EwaMR3N4SS8N4unEtSKwtZ32TFcO/3ivAwpNHy9hdW\n\tqJBTpjWwnuCljp3msfccksxQrXtL0DBcEEBv6XOt2jMbieP9c7mxdp+6zhh2/RxP95vD\n\tWIAtlRcpt1ddiwOPdJQ4AvTtNArk459oM6vO4Vs75vpff9k2e63L0mkbKqd2s0bUL0Bq\n\tbpUWQ9uP67vKPtARrebSi5T6gbCq55HRvnd3Umm7Kwxj/7ja2qcDovUhwXH7/LFzWzod\n\tLUGgpP90bSUYuDzR5GyqpLoO1wwibrXoLqy8eqMIrM52tZ6m9ZP6zqfoTEqGP08Kbp8A\n\tco9Q==",
        "X-Gm-Message-State": "AOJu0YwvKjjylOWIIWP/MXagXOHe9IR3Vy2hojJVpDENVYrByHxTg+9Y\n\ttm/gpeeaJCA72u8BhAxm7gYiUGaAJFDX9CS5UYLfdN/60G2tRze+8/zGCEjo/gbRAy2PUfobsTI\n\tpMLIQubU=",
        "X-Gm-Gg": "AY/fxX6bQortH9sQSl05kqba3YGpfqLa/vdjqsiWm+RnzyflH1MrHAVlUUh64ElJSXQ\n\tauwVm6XxMsQk00LeM5+j21PRxROg2ML/fbYHGVdnZC8ViwbPI0Tl8cYn3SAIMhSHx8cxxjObJjs\n\t7UN6pjScyG8txQfiqS5/5gKu80fthufn3y1vuyRn+1MVAf+nwxQJEOpCPaFVsFL4MO3oiEdH8V2\n\tIw5S9ffQtxk/QWugMpLizQwHEjn8M88QZKnqsR6zPhM3EGvdDCJVuCKE1mKo3oMXaxZEIfVxuZK\n\tXM+bWdgKzIN+thHYQ7cr3YYXfiA5CCipA83qlWpa9IpAee+p0s5d9TE2Y+HTbFkgNMeZ1JlRJGJ\n\tQ1QJriwHpl2LxJl3hUrpBUgkYf5XJg1bluq3xkGjvs9zDGb+t40TDgIwwhbQSQphZ68dFK6Yp5E\n\tOZxWxbRcdGybKE6WhpwpHl5m6KE0ssY98E7smD2FtgbaatLAjvZWtLBwHLR8+RuoDIqZGKPQHvY\n\tMOOlA==",
        "X-Google-Smtp-Source": "AGHT+IGsKCOZevJxuVFhiZ4nEsUD4nZvvJFjoLkfdNsFDgiKFBw0XcyaA8paUH3t4s4eTkU1FF6weA==",
        "X-Received": "by 2002:a05:6000:2305:b0:431:c60:c5ed with SMTP id\n\tffacd0b85a97d-432bca19d80mr4913791f8f.13.1767718863521; \n\tTue, 06 Jan 2026 09:01:03 -0800 (PST)",
        "From": "Bryan O'Donoghue <bryan.odonoghue@linaro.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "pavel@ucw.cz,\n\tBryan O'Donoghue <bryan.odonoghue@linaro.org>",
        "Subject": "[PATCH v11 01/24] libcamera: software_isp: debayer: Latch\n\tcontrastExp not contrast to debayer parameters",
        "Date": "Tue,  6 Jan 2026 17:00:36 +0000",
        "Message-ID": "<20260106170059.56193-2-bryan.odonoghue@linaro.org>",
        "X-Mailer": "git-send-email 2.52.0",
        "In-Reply-To": "<20260106170059.56193-1-bryan.odonoghue@linaro.org>",
        "References": "<20260106170059.56193-1-bryan.odonoghue@linaro.org>",
        "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": "Pass contrastExp as calculated in lut to debayer params not the raw\ncontrast. This way we calculate contrastExp once per frame in lut and pass\nthe calculated value into the shaders, instead of passing contrast and\ncalculating contrastExp once per pixel in the shaders.\n\nSigned-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n---\n include/libcamera/internal/software_isp/debayer_params.h | 2 +-\n src/ipa/simple/algorithms/lut.cpp                        | 7 ++++---\n src/ipa/simple/ipa_context.h                             | 1 +\n src/libcamera/software_isp/debayer.cpp                   | 2 +-\n 4 files changed, 7 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/include/libcamera/internal/software_isp/debayer_params.h b/include/libcamera/internal/software_isp/debayer_params.h\nindex 8033f7d5b..256c7d43d 100644\n--- a/include/libcamera/internal/software_isp/debayer_params.h\n+++ b/include/libcamera/internal/software_isp/debayer_params.h\n@@ -59,7 +59,7 @@ struct DebayerParams {\n \tMatrix<float, 3, 3> ccm;\n \tRGB<float> blackLevel;\n \tfloat gamma;\n-\tfloat contrast;\n+\tdouble contrastExp;\n };\n \n } /* namespace libcamera */\ndiff --git a/src/ipa/simple/algorithms/lut.cpp b/src/ipa/simple/algorithms/lut.cpp\nindex 9aaab54f1..7d015ac89 100644\n--- a/src/ipa/simple/algorithms/lut.cpp\n+++ b/src/ipa/simple/algorithms/lut.cpp\n@@ -60,12 +60,13 @@ void Lut::updateGammaTable(IPAContext &context)\n \tconst auto blackLevel = context.activeState.blc.level;\n \tconst unsigned int blackIndex = blackLevel * gammaTable.size() / 256;\n \tconst auto contrast = context.activeState.knobs.contrast.value_or(1.0);\n+\t/* Convert 0..2 to 0..infinity; avoid actual inifinity at tan(pi/2) */\n+\tdouble contrastExp = tan(std::clamp(contrast * M_PI_4, 0.0, M_PI_2 - 0.00001));\n \n \tconst float divisor = gammaTable.size() - blackIndex - 1.0;\n \tfor (unsigned int i = blackIndex; i < gammaTable.size(); i++) {\n \t\tdouble normalized = (i - blackIndex) / divisor;\n \t\t/* Convert 0..2 to 0..infinity; avoid actual inifinity at tan(pi/2) */\n-\t\tdouble contrastExp = tan(std::clamp(contrast * M_PI_4, 0.0, M_PI_2 - 0.00001));\n \t\t/* Apply simple S-curve */\n \t\tif (normalized < 0.5)\n \t\t\tnormalized = 0.5 * std::pow(normalized / 0.5, contrastExp);\n@@ -84,7 +85,7 @@ void Lut::updateGammaTable(IPAContext &context)\n \t\t  gammaTable[blackIndex]);\n \n \tcontext.activeState.gamma.blackLevel = blackLevel;\n-\tcontext.activeState.gamma.contrast = contrast;\n+\tcontext.activeState.gamma.contrastExp = contrastExp;\n }\n \n int16_t Lut::ccmValue(unsigned int i, float ccm) const\n@@ -149,7 +150,7 @@ void Lut::prepare(IPAContext &context,\n \t}\n \n \tparams->gamma = context.configuration.gamma;\n-\tparams->contrast = context.activeState.gamma.contrast;\n+\tparams->contrastExp = context.activeState.gamma.contrastExp;\n }\n \n void Lut::process([[maybe_unused]] IPAContext &context,\ndiff --git a/src/ipa/simple/ipa_context.h b/src/ipa/simple/ipa_context.h\nindex 26b60fb68..7837bb4dd 100644\n--- a/src/ipa/simple/ipa_context.h\n+++ b/src/ipa/simple/ipa_context.h\n@@ -59,6 +59,7 @@ struct IPAActiveState {\n \t\tstd::array<double, kGammaLookupSize> gammaTable;\n \t\tuint8_t blackLevel;\n \t\tdouble contrast;\n+\t\tdouble contrastExp;\n \t} gamma;\n \n \tstruct {\ndiff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp\nindex b33f818a7..4cb5b4da4 100644\n--- a/src/libcamera/software_isp/debayer.cpp\n+++ b/src/libcamera/software_isp/debayer.cpp\n@@ -116,7 +116,7 @@ namespace libcamera {\n  */\n \n /**\n- * \\var DebayerParams::contrast\n+ * \\var DebayerParams::contrastExp\n  * \\brief Contrast value for GPUISP\n  */\n \n",
    "prefixes": [
        "v11",
        "01/24"
    ]
}