Patch Detail
Show a patch.
GET /api/patches/27386/?format=api
{ "id": 27386, "url": "https://patchwork.libcamera.org/api/patches/27386/?format=api", "web_url": "https://patchwork.libcamera.org/patch/27386/", "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": "<20260720113935.52936-1-robert.mader@collabora.com>", "date": "2026-07-20T11:39:35", "name": "[v2] libcamera: debayer: Use helpers for strides and frame sizes", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "d5f91e421fb0ce48af213da6f3b5d57892e9edbd", "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/27386/mbox/", "series": [ { "id": 6064, "url": "https://patchwork.libcamera.org/api/series/6064/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=6064", "date": "2026-07-20T11:39:35", "name": "[v2] libcamera: debayer: Use helpers for strides and frame sizes", "version": 2, "mbox": "https://patchwork.libcamera.org/series/6064/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/27386/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/27386/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 5A183C3264\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 20 Jul 2026 11:39:52 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9D30167E1F;\n\tMon, 20 Jul 2026 13:39:51 +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 CDA7466122\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 20 Jul 2026 13:39:49 +0200 (CEST)", "by mx.zohomail.com with SMTPS id 1784547584670848.5064648967673;\n\tMon, 20 Jul 2026 04:39:44 -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=\"P3ogPoTs\"; \n\tdkim-atps=neutral", "ARC-Seal": "i=1; a=rsa-sha256; t=1784547585; cv=none; \n\td=zohomail.com; s=zohoarc; \n\tb=PJKLiaUfdV5Ns2Qg5DpSHd4s1hlqouOC3BGa5TzKemPN8MbINhRRmZuJQNG97G1fMJU7rcHxvbfZYniQcuDUMQ35ckGmCMniuQkH+ZVz6CNJbC6dNAwI+KDi+UCc1VT4cpCr11DBlKIzJsi6yKNwzwCW4h79xxgsM7fWbcFzQO8=", "ARC-Message-Signature": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; \n\ts=zohoarc; t=1784547585;\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=BGc2KL47AMbUeUrphPA2fXB/5CWcv52E3dnfUCvcYbc=; \n\tb=kuVSPLLGAmW1lbQi1+kWoyHQ5qaRS4xeV2pxVobu5TslkwJKr6o1P1QnyZGogZ/1jubiBIiGsX1lPVXxuz0tHO6ZphwGZ+wS3v9wJ4/A24qc/X3tP/pfIVgNSR25yHHXNd36L28KQj3aO6R0XOs33p5CNbhpZs71przk2xb5hl4=", "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=1784547585;\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=BGc2KL47AMbUeUrphPA2fXB/5CWcv52E3dnfUCvcYbc=;\n\tb=P3ogPoTs0gUd9hyZ3x5xreQTT8Fr2TZDsNMocOTRJUinIbCjKvAiSYEN7lpVrsS0\n\tTFxcZ1nxSyOPOgoBXb3F3KtnBF+6fvsIkPVk+ZkkpZp5AGU7fFsVwNsfoOkDAlm/1Vi\n\t9ONcCJhb84t0ToiKMsYLVgjcb9QJ1/wWfbW1QZGs=", "From": "Robert Mader <robert.mader@collabora.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Robert Mader <robert.mader@collabora.com>", "Subject": "[PATCH v2] libcamera: debayer: Use helpers for strides and frame\n\tsizes", "Date": "Mon, 20 Jul 2026 13:39:35 +0200", "Message-ID": "<20260720113935.52936-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---\n\nChanges in v2:\n - remove bpp docs to fix CI\n---\n src/libcamera/software_isp/debayer.cpp | 3 ---\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 6 files changed, 5 insertions(+), 54 deletions(-)", "diff": "diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp\nindex 56446f55d..a4854e51b 100644\n--- a/src/libcamera/software_isp/debayer.cpp\n+++ b/src/libcamera/software_isp/debayer.cpp\n@@ -192,9 +192,6 @@ Debayer::~Debayer()\n * Defines how the output of the debayer process is laid out in memory.\n * It includes per-pixel size, stride, and total frame size.\n *\n- * \\var Debayer::DebayerOutputConfig::bpp\n- * Bytes used per pixel in the output format.\n- *\n * \\var Debayer::DebayerOutputConfig::stride\n * Line stride in bytes for the output frame.\n *\ndiff --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 ¶ms);\n", "prefixes": [ "v2" ] }