Show a patch.

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

{
    "id": 27385,
    "url": "https://patchwork.libcamera.org/api/patches/27385/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/27385/",
    "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": "<20260720112719.16849-1-robert.mader@collabora.com>",
    "date": "2026-07-20T11:27:19",
    "name": "[v1] libcamera: debayer: Use helpers for strides and frame sizes",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "26b1754e5b8737fceeb578beed6bc2dfd3d52d15",
    "submitter": {
        "id": 140,
        "url": "https://patchwork.libcamera.org/api/people/140/?format=api",
        "name": "Robert Mader",
        "email": "robert.mader@collabora.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/27385/mbox/",
    "series": [
        {
            "id": 6063,
            "url": "https://patchwork.libcamera.org/api/series/6063/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=6063",
            "date": "2026-07-20T11:27:19",
            "name": "[v1] libcamera: debayer: Use helpers for strides and frame sizes",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/6063/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/27385/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/27385/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 E846CBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 20 Jul 2026 11:27:46 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 40A4666122;\n\tMon, 20 Jul 2026 13:27:46 +0200 (CEST)",
            "from sender4-op-o11.zoho.com (sender4-op-o11.zoho.com\n\t[136.143.188.11])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DECBD66122\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 20 Jul 2026 13:27:43 +0200 (CEST)",
            "by mx.zohomail.com with SMTPS id 178454685877748.65233887130182;\n\tMon, 20 Jul 2026 04:27:38 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=collabora.com\n\theader.i=robert.mader@collabora.com header.b=\"BVwcD7zN\"; \n\tdkim-atps=neutral",
        "ARC-Seal": "i=1; a=rsa-sha256; t=1784546860; cv=none; \n\td=zohomail.com; s=zohoarc; \n\tb=RIR5AabI2k11LxxMv5KIpdoXskCrL24XwJVJbL3xeASgPgTHbnkyPZmc+Z5D0BBIAVa58ysv5vwgkw56WZm3oV1X05r0rV5pqhbs9EDUrTdnomgGmDeAbj2Z1zGejxaDp80ynkSYPXJDnANm7HcqMnZPwdDgmgbsX/ihossj3XQ=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; \n\ts=zohoarc; t=1784546860;\n\th=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To;\n\tbh=iccqgmDyNjx2FIXQWxIKhQ+nizMb4bzWUGUnKlMjqcw=; \n\tb=XgBuz21fNOnzp7l6XOhHe6Y/Gh3P3X39eg0t9ub/H6ZX0CnuiTds615ASwD7zdmSo5Cr1hJclbYlaFV9xsTqJDvonww2u37Wrl+/IxGjUcaeagCAqLFEtU3dBwyvs/OL5tslLahmsNnFxQ9TckdRJ7j1V2kD8TR13rd01ZQHHI8=",
        "ARC-Authentication-Results": "i=1; mx.zohomail.com;\n\tdkim=pass  header.i=collabora.com;\n\tspf=pass  smtp.mailfrom=robert.mader@collabora.com;\n\tdmarc=pass header.from=<robert.mader@collabora.com>",
        "DKIM-Signature": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1784546860;\n\ts=zohomail; d=collabora.com; i=robert.mader@collabora.com;\n\th=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To;\n\tbh=iccqgmDyNjx2FIXQWxIKhQ+nizMb4bzWUGUnKlMjqcw=;\n\tb=BVwcD7zNdXW9DUXJGdk2szvii2eE4vAPHNXNV8Mg+kt3SDNM9ipIL4+kSTtY0yZV\n\tqlzoFuQwvwjrH/7i5TpShrnGfLJAU3UG6tbVssFu49s6MJLVhsW2Sl5GYYdQVQQ970H\n\t+yx7fVHBxstiEcVX5qP1tITr7ZEzduaiRvmQwUjM=",
        "From": "Robert Mader <robert.mader@collabora.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Robert Mader <robert.mader@collabora.com>",
        "Subject": "[PATCH v1] libcamera: debayer: Use helpers for strides and frame\n\tsizes",
        "Date": "Mon, 20 Jul 2026 13:27:19 +0200",
        "Message-ID": "<20260720112719.16849-1-robert.mader@collabora.com>",
        "X-Mailer": "git-send-email 2.55.0",
        "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": "Clean up some open-coded logic, making the code shorter, more generic\nand easier to follow.\n\nSigned-off-by: Robert Mader <robert.mader@collabora.com>\n---\n src/libcamera/software_isp/debayer.h       |  1 -\n src/libcamera/software_isp/debayer_cpu.cpp | 29 +++-------------------\n src/libcamera/software_isp/debayer_cpu.h   |  1 -\n src/libcamera/software_isp/debayer_egl.cpp | 24 ++----------------\n src/libcamera/software_isp/debayer_egl.h   |  1 -\n 5 files changed, 5 insertions(+), 51 deletions(-)",
    "diff": "diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h\nindex 28f1b857b..556852260 100644\n--- a/src/libcamera/software_isp/debayer.h\n+++ b/src/libcamera/software_isp/debayer.h\n@@ -69,7 +69,6 @@ public:\n \t};\n \n \tstruct DebayerOutputConfig {\n-\t\tunsigned int bpp;\n \t\tunsigned int stride;\n \t\tunsigned int frameSize;\n \t};\ndiff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp\nindex 49382b4c2..25e9830c8 100644\n--- a/src/libcamera/software_isp/debayer_cpu.cpp\n+++ b/src/libcamera/software_isp/debayer_cpu.cpp\n@@ -24,6 +24,7 @@\n \n #include \"libcamera/internal/bayer_format.h\"\n #include \"libcamera/internal/camera_manager.h\"\n+#include \"libcamera/internal/formats.h\"\n #include \"libcamera/internal/framebuffer.h\"\n #include \"libcamera/internal/global_configuration.h\"\n #include \"libcamera/internal/mapped_framebuffer.h\"\n@@ -474,24 +475,6 @@ int DebayerCpu::getInputConfig(PixelFormat inputFormat, DebayerInputConfig &conf\n \treturn -EINVAL;\n }\n \n-int DebayerCpu::getOutputConfig(PixelFormat outputFormat, DebayerOutputConfig &config)\n-{\n-\tif (outputFormat == formats::RGB888 || outputFormat == formats::BGR888) {\n-\t\tconfig.bpp = 24;\n-\t\treturn 0;\n-\t}\n-\n-\tif (outputFormat == formats::XRGB8888 || outputFormat == formats::ARGB8888 ||\n-\t    outputFormat == formats::XBGR8888 || outputFormat == formats::ABGR8888) {\n-\t\tconfig.bpp = 32;\n-\t\treturn 0;\n-\t}\n-\n-\tLOG(Debayer, Info)\n-\t\t<< \"Unsupported output format \" << outputFormat.toString();\n-\treturn -EINVAL;\n-}\n-\n /*\n  * Check for standard Bayer orders and set xShift_ and swap debayer0/1, so that\n  * a single pair of BGGR debayer functions can be used for all 4 standard orders.\n@@ -776,15 +759,9 @@ std::vector<PixelFormat> DebayerCpu::formats(PixelFormat inputFormat)\n std::tuple<unsigned int, unsigned int>\n DebayerCpu::strideAndFrameSize(const PixelFormat &outputFormat, const Size &size)\n {\n-\tDebayerCpu::DebayerOutputConfig config;\n-\n-\tif (getOutputConfig(outputFormat, config) != 0)\n-\t\treturn std::make_tuple(0, 0);\n-\n \t/* round up to multiple of 8 for 64 bits alignment */\n-\tunsigned int stride = (size.width * config.bpp / 8 + 7) & ~7;\n-\n-\treturn std::make_tuple(stride, stride * size.height);\n+\tconst PixelFormatInfo &info = PixelFormatInfo::info(outputFormat);\n+\treturn std::make_tuple(info.stride(size.width, 0, 8), info.frameSize(size, 8));\n }\n \n void DebayerCpuThread::setupInputMemcpy(const uint8_t *linePointers[])\ndiff --git a/src/libcamera/software_isp/debayer_cpu.h b/src/libcamera/software_isp/debayer_cpu.h\nindex 5281c65cb..2c88c9e1a 100644\n--- a/src/libcamera/software_isp/debayer_cpu.h\n+++ b/src/libcamera/software_isp/debayer_cpu.h\n@@ -121,7 +121,6 @@ private:\n \tvoid debayer12P_RGRG_BGR888(uint8_t *dst, const uint8_t *src[]);\n \n \tstatic int getInputConfig(PixelFormat inputFormat, DebayerInputConfig &config);\n-\tstatic int getOutputConfig(PixelFormat outputFormat, DebayerOutputConfig &config);\n \tint setupStandardBayerOrder(BayerFormat::Order order);\n \tint setDebayerFunctions(PixelFormat inputFormat,\n \t\t\t\tPixelFormat outputFormat,\ndiff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp\nindex 02651fe87..24faf480d 100644\n--- a/src/libcamera/software_isp/debayer_egl.cpp\n+++ b/src/libcamera/software_isp/debayer_egl.cpp\n@@ -96,20 +96,6 @@ int DebayerEGL::getInputConfig(PixelFormat inputFormat, DebayerInputConfig &conf\n \treturn -EINVAL;\n }\n \n-int DebayerEGL::getOutputConfig(PixelFormat outputFormat, DebayerOutputConfig &config)\n-{\n-\tif (outputFormat == formats::XRGB8888 || outputFormat == formats::ARGB8888 ||\n-\t    outputFormat == formats::XBGR8888 || outputFormat == formats::ABGR8888) {\n-\t\tconfig.bpp = 32;\n-\t\treturn 0;\n-\t}\n-\n-\tLOG(Debayer, Info)\n-\t\t<< \"Unsupported output format \" << outputFormat;\n-\n-\treturn -EINVAL;\n-}\n-\n int DebayerEGL::getShaderVariableLocations(void)\n {\n \tattributeVertex_ = glGetAttribLocation(programId_, \"vertexIn\");\n@@ -374,15 +360,9 @@ std::vector<PixelFormat> DebayerEGL::formats(PixelFormat inputFormat)\n std::tuple<unsigned int, unsigned int>\n DebayerEGL::strideAndFrameSize(const PixelFormat &outputFormat, const Size &size)\n {\n-\tDebayerEGL::DebayerOutputConfig config;\n-\n-\tif (getOutputConfig(outputFormat, config) != 0)\n-\t\treturn std::make_tuple(0, 0);\n-\n \t/* Align stride to 256 bytes as a generic GPU memory access alignment */\n-\tunsigned int stride = libcamera::utils::alignUp(size.width * config.bpp / 8, 256);\n-\n-\treturn std::make_tuple(stride, stride * size.height);\n+\tconst PixelFormatInfo &info = PixelFormatInfo::info(outputFormat);\n+\treturn std::make_tuple(info.stride(size.width, 0, 256), info.frameSize(size, 256));\n }\n \n uint32_t DebayerEGL::preferredInputStride(const PixelFormat &inputFormat, const Size &size)\ndiff --git a/src/libcamera/software_isp/debayer_egl.h b/src/libcamera/software_isp/debayer_egl.h\nindex d6223f3a9..e613639f5 100644\n--- a/src/libcamera/software_isp/debayer_egl.h\n+++ b/src/libcamera/software_isp/debayer_egl.h\n@@ -63,7 +63,6 @@ public:\n \n private:\n \tstatic int getInputConfig(PixelFormat inputFormat, DebayerInputConfig &config);\n-\tstatic int getOutputConfig(PixelFormat outputFormat, DebayerOutputConfig &config);\n \tint initBayerShaders(PixelFormat inputFormat, PixelFormat outputFormat);\n \tint getShaderVariableLocations();\n \tvoid setShaderVariableValues(eGLImage &eGLImageIn, const DebayerParams &params);\n",
    "prefixes": [
        "v1"
    ]
}