Patch Detail
Show a patch.
GET /api/patches/19322/?format=api
{ "id": 19322, "url": "https://patchwork.libcamera.org/api/patches/19322/?format=api", "web_url": "https://patchwork.libcamera.org/patch/19322/", "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": "<20231214121350.206015-6-hdegoede@redhat.com>", "date": "2023-12-14T12:13:43", "name": "[libcamera-devel,05/11] libcamera: software_isp: Add Debayer base class", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "f22037a4ad31b8993c78bba6bbbf494dd5973173", "submitter": { "id": 102, "url": "https://patchwork.libcamera.org/api/people/102/?format=api", "name": "Hans de Goede", "email": "hdegoede@redhat.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/19322/mbox/", "series": [ { "id": 4117, "url": "https://patchwork.libcamera.org/api/series/4117/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4117", "date": "2023-12-14T12:13:38", "name": "libcamera: introduce Software ISP and Software IPA", "version": 1, "mbox": "https://patchwork.libcamera.org/series/4117/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/19322/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/19322/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 1777ABD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 14 Dec 2023 12:14:11 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C59FB62B60;\n\tThu, 14 Dec 2023 13:14:10 +0100 (CET)", "from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9495862B5C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 14 Dec 2023 13:14:07 +0100 (CET)", "from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com\n\t[66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-625-TclWStvuNSSePfAJU6mq_g-1; Thu, 14 Dec 2023 07:14:00 -0500", "from smtp.corp.redhat.com\n\t(int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\tkey-exchange X25519 server-signature RSA-PSS (2048 bits)\n\tserver-digest SHA256) (No client certificate requested)\n\tby mimecast-mx02.redhat.com (Postfix) with ESMTPS id D530185A588;\n\tThu, 14 Dec 2023 12:13:59 +0000 (UTC)", "from shalem.redhat.com (unknown [10.39.194.72])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 8ED601121306;\n\tThu, 14 Dec 2023 12:13:58 +0000 (UTC)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1702556050;\n\tbh=LhipIp4GtupJ6IaZ4rU1hdfOM4k+B4tp1rNOs3vZZhM=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=X+PK7G6ejJzjWapZ9vXWaVYpXWCPpwdoIkkipHzSzcbBHyzBRzL6VStJYixi1g4Ra\n\tAtsYkSS/A+ZKxhCBlp3UNKIPxgbIJVXFy5BFfQsbElzVu8nC2KCmXYlmMTwuJGYtSc\n\taOVtShLA944qyHzSlTRJ6WgaMtpPw3wiQqq8BGS5XXikl8ep2ZAqsy2FNw+dQkL9go\n\tIo9gYhfUG1bsy/hwD0FMBLDHsM+Gxjx45hyrD6UH8bwZihCI8lQ0JmYFAVf3X2LH4M\n\tKM72jvlG+B6t7QVJlVWsT4vpjCwLhAr+/y2yp1/9iCJsrFJlVRyYmfHl/NNR5aWHa0\n\tKoJ8p2D3yixkQ==", "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1702556046;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tcontent-transfer-encoding:content-transfer-encoding:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=tdIzGLQxhxYICZ6OdjRLAGlPb0lmvJYHuBZDXsIFGfs=;\n\tb=MiqDOFlK8hYw42doQy/SeEYGJFTb8cytEFspUufA5en9Het49HNR5O6izPOJcPnzKVkHPe\n\tMm1DEpfAy/BrwweIeKCyNymzx5muhHGV9je6FZRaLBN0vAOQ3MshlU/Kn3PsPheUzKCYXh\n\tlE+dQSaRNRJcJ463Q3oS9UcNZPpyO4Q=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=redhat.com\n\theader.i=@redhat.com header.b=\"MiqDOFlK\"; \n\tdkim-atps=neutral", "X-MC-Unique": "TclWStvuNSSePfAJU6mq_g-1", "To": "libcamera-devel@lists.libcamera.org,\n\tAndrey Konovalov <andrey.konovalov@linaro.org>", "Date": "Thu, 14 Dec 2023 13:13:43 +0100", "Message-ID": "<20231214121350.206015-6-hdegoede@redhat.com>", "In-Reply-To": "<20231214121350.206015-1-hdegoede@redhat.com>", "References": "<20231214121350.206015-1-hdegoede@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 3.4.1 on 10.11.54.3", "X-Mimecast-Spam-Score": "0", "X-Mimecast-Originator": "redhat.com", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain; charset=\"US-ASCII\"; x-default=true", "Subject": "[libcamera-devel] [PATCH 05/11] libcamera: software_isp: Add\n\tDebayer base class", "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>", "From": "Hans de Goede via libcamera-devel <libcamera-devel@lists.libcamera.org>", "Reply-To": "Hans de Goede <hdegoede@redhat.com>", "Cc": "Maxime Ripard <mripard@redhat.com>, g.martti@gmail.com,\n\tt.langendam@gmail.com, srinivas.kandagatla@linaro.org,\n\tBryan O'Donoghue <bryan.odonoghue@linaro.org>, admin@dennisbonke.com", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Add a base class for debayer implementations. This is intended to be\nsuitable for both GPU (or otherwise) accelerated debayer implementations\nas well as CPU based debayering.\n\nCo-authored-by: Andrey Konovalov <andrey.konovalov@linaro.org>\nSigned-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>\nSigned-off-by: Hans de Goede <hdegoede@redhat.com>\n---\n .../libcamera/internal/software_isp/debayer.h | 90 +++++++++++++++++++\n .../internal/software_isp/debayer_params.h | 24 +++++\n .../internal/software_isp/meson.build | 2 +\n src/libcamera/software_isp/debayer.cpp | 22 +++++\n src/libcamera/software_isp/meson.build | 1 +\n 5 files changed, 139 insertions(+)\n create mode 100644 include/libcamera/internal/software_isp/debayer.h\n create mode 100644 include/libcamera/internal/software_isp/debayer_params.h\n create mode 100644 src/libcamera/software_isp/debayer.cpp", "diff": "diff --git a/include/libcamera/internal/software_isp/debayer.h b/include/libcamera/internal/software_isp/debayer.h\nnew file mode 100644\nindex 00000000..206bc2ac\n--- /dev/null\n+++ b/include/libcamera/internal/software_isp/debayer.h\n@@ -0,0 +1,90 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2023, Linaro Ltd\n+ * Copyright (C) 2023, Red Hat Inc.\n+ *\n+ * Authors:\n+ * Hans de Goede <hdegoede@redhat.com> \n+ *\n+ * debayer.h - debayering base class\n+ */\n+\n+#pragma once\n+\n+#include <stdint.h>\n+\n+#include <libcamera/base/log.h>\n+#include <libcamera/base/signal.h>\n+\n+#include <libcamera/geometry.h>\n+#include <libcamera/stream.h>\n+\n+#include \"libcamera/internal/software_isp/debayer_params.h\"\n+\n+namespace libcamera {\n+\n+class FrameBuffer;\n+\n+LOG_DECLARE_CATEGORY(Debayer)\n+\n+class Debayer\n+{\n+public:\n+\tvirtual ~Debayer() = 0;\n+\n+\t/*\n+\t * Setup the Debayer object according to the passed in parameters.\n+\t * Return 0 on success, a negative errno value on failure\n+\t * (unsupported parameters).\n+\t */\n+\tvirtual int configure(const StreamConfiguration &inputCfg,\n+\t\t\t const std::vector<std::reference_wrapper<StreamConfiguration>> &outputCfgs) = 0;\n+\n+\t/*\n+\t * Get width and height at which the bayer-pattern repeats.\n+\t * Return pattern-size or an empty Size for an unsupported inputFormat.\n+\t */\n+\tvirtual Size patternSize(PixelFormat inputFormat) = 0;\n+\n+\tvirtual std::vector<PixelFormat> formats(PixelFormat inputFormat) = 0;\n+\tvirtual std::tuple<unsigned int, unsigned int>\n+\t\tstrideAndFrameSize(const PixelFormat &outputFormat, const Size &size) = 0;\n+\n+\t/*\n+\t * Note DebayerParams is passed by value deliberately so that a copy is passed\n+\t * when this is run in another thread to invokeMethod.\n+\t */\n+\tvirtual void process(FrameBuffer *input, FrameBuffer *output, DebayerParams params) = 0;\n+\n+\t/* sizes() - Get supported output sizes for given input fmt + size */\n+\tSizeRange sizes(PixelFormat inputFormat, const Size &inputSize)\n+\t{\n+\t\tSize pattern_size = patternSize(inputFormat);\n+\n+\t\tif (pattern_size.isNull())\n+\t\t\treturn {};\n+\n+\t\t/*\n+\t\t * For debayer interpolation a border of pattern-height x pattern-width\n+\t\t * is kept around the entire image. Combined with a minimum-size of\n+\t\t * pattern-height x pattern-width this means the input-size needs to be\n+\t\t * at least (3 * pattern-height) x (3 * pattern-width).\n+\t\t */\n+\t\tif (inputSize.width < (3 * pattern_size.width) ||\n+\t\t inputSize.height < (3 * pattern_size.height)) {\n+\t\t\tLOG(Debayer, Warning)\n+\t\t\t\t<< \"Input format size too small: \" << inputSize.toString();\n+\t\t\treturn {};\n+\t\t}\n+\n+\t\treturn SizeRange(Size(pattern_size.width, pattern_size.height),\n+\t\t\t\t Size((inputSize.width - 2 * pattern_size.width) & ~(pattern_size.width - 1),\n+\t\t\t\t (inputSize.height - 2 * pattern_size.height) & ~(pattern_size.height - 1)),\n+\t\t\t\t pattern_size.width, pattern_size.height);\n+\t}\n+\n+\tSignal<FrameBuffer *> inputBufferReady;\n+\tSignal<FrameBuffer *> outputBufferReady;\n+};\n+\n+} /* namespace libcamera */\ndiff --git a/include/libcamera/internal/software_isp/debayer_params.h b/include/libcamera/internal/software_isp/debayer_params.h\nnew file mode 100644\nindex 00000000..885d3605\n--- /dev/null\n+++ b/include/libcamera/internal/software_isp/debayer_params.h\n@@ -0,0 +1,24 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2023, Red Hat Inc.\n+ *\n+ * Authors:\n+ * Hans de Goede <hdegoede@redhat.com> \n+ *\n+ * swstats.h - software statistics base class\n+ */\n+\n+#pragma once\n+\n+namespace libcamera {\n+\n+struct DebayerParams {\n+\t/* Red Gain, 128 = 0.5, 256 = 1.0, 512 = 2.0, etc. */\n+\tunsigned int gainR;\n+\t/* Blue Gain, same range as Red Gain. */\n+\tunsigned int gainB;\n+\t/* Gamma correction, 1.0 is no correction. */\n+\tfloat gamma;\n+};\n+\n+} /* namespace libcamera */\ndiff --git a/include/libcamera/internal/software_isp/meson.build b/include/libcamera/internal/software_isp/meson.build\nindex 1d9e4018..7e40925e 100644\n--- a/include/libcamera/internal/software_isp/meson.build\n+++ b/include/libcamera/internal/software_isp/meson.build\n@@ -1,6 +1,8 @@\n # SPDX-License-Identifier: CC0-1.0\n \n libcamera_internal_headers += files([\n+ 'debayer.h',\n+ 'debayer_params.h',\n 'swisp_stats.h',\n 'swstats.h',\n 'swstats_cpu.h',\ndiff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp\nnew file mode 100644\nindex 00000000..442da1ac\n--- /dev/null\n+++ b/src/libcamera/software_isp/debayer.cpp\n@@ -0,0 +1,22 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2023, Linaro Ltd\n+ * Copyright (C) 2023, Red Hat Inc.\n+ *\n+ * Authors:\n+ * Hans de Goede <hdegoede@redhat.com> \n+ *\n+ * debayer.cpp - debayer base class\n+ */\n+\n+#include \"libcamera/internal/software_isp/debayer.h\"\n+\n+namespace libcamera {\n+\n+LOG_DEFINE_CATEGORY(Debayer)\n+\n+Debayer::~Debayer()\n+{\n+}\n+\n+} /* namespace libcamera */\ndiff --git a/src/libcamera/software_isp/meson.build b/src/libcamera/software_isp/meson.build\nindex d31c6217..d4ae5ac7 100644\n--- a/src/libcamera/software_isp/meson.build\n+++ b/src/libcamera/software_isp/meson.build\n@@ -1,6 +1,7 @@\n # SPDX-License-Identifier: CC0-1.0\n \n libcamera_sources += files([\n+\t'debayer.cpp',\n \t'swstats.cpp',\n \t'swstats_cpu.cpp',\n ])\n", "prefixes": [ "libcamera-devel", "05/11" ] }