{"id":24654,"url":"https://patchwork.libcamera.org/api/patches/24654/?format=json","web_url":"https://patchwork.libcamera.org/patch/24654/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20251015012251.17508-10-bryan.odonoghue@linaro.org>","date":"2025-10-15T01:22:21","name":"[v3,09/39] libcamera: software_isp: Move useful items from DebayerCpu to Debayer base class","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"5e7ed7bf8c386b6c32c57f700af20f9b3917764e","submitter":{"id":175,"url":"https://patchwork.libcamera.org/api/people/175/?format=json","name":"Bryan O'Donoghue","email":"bryan.odonoghue@linaro.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/24654/mbox/","series":[{"id":5503,"url":"https://patchwork.libcamera.org/api/series/5503/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5503","date":"2025-10-15T01:22:12","name":"Add GLES 2.0 GPUISP to libcamera","version":3,"mbox":"https://patchwork.libcamera.org/series/5503/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/24654/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/24654/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 DED39BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 15 Oct 2025 01:23:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 480CB60622;\n\tWed, 15 Oct 2025 03:23:13 +0200 (CEST)","from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com\n\t[IPv6:2a00:1450:4864:20::62f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4D71D60618\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 15 Oct 2025 03:23:04 +0200 (CEST)","by mail-ej1-x62f.google.com with SMTP id\n\ta640c23a62f3a-b40f11a1027so1073899066b.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Oct 2025 18:23:04 -0700 (PDT)","from inspiron14p-linux.nxsw.local (188-141-3-146.dynamic.upc.ie.\n\t[188.141.3.146]) by smtp.gmail.com with ESMTPSA id\n\ta640c23a62f3a-b5ccd7b202dsm98348466b.82.2025.10.14.18.23.02\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 14 Oct 2025 18:23:03 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"Lm7RcUaU\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1760491383; x=1761096183;\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=3ome6wJLZjqhmaYsCAuXqPUDJjo8qNs2C5lFy+zKkTE=;\n\tb=Lm7RcUaUwvpmuNB+o7/ZuQiNuiiXUzftaQ4LIDuXjdvh5z6o488Yai98btBfEDYU2L\n\tEdDEiSwitUWuVYYscBArXRAKB1Mp7jyZ7Uwl7fZDB9GwI7sNCu4LDVV6cXgHldrb1sad\n\tih5uuzigH9ntvdrKW5PMaltZ4X7NQPU/+MXGLunibAvAmxMifRaJt64+Ah3XDJ1rgGw1\n\tqdJdVmVVB9u4NtDaqQNktKvZ6COnM4Ys1uanRcn32dUWXhsy8/oiGHxaBvMU7bjpgJdT\n\tDPQh+1Z4aLR++r7h4Z8GpeEkGuw59GpsQQi9ykFTfsN5gV/xLe2MWZP8zFAsZwhkNBJ6\n\tVV1g==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1760491383; x=1761096183;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=3ome6wJLZjqhmaYsCAuXqPUDJjo8qNs2C5lFy+zKkTE=;\n\tb=xSuFSdSSDG4ex3I/XiXEryBD3MNMx9TapmfyNHzYv4pA1rfGvNIKMSMZEPbns59IAd\n\trLHxiMSqS1TOXQDcazeBeqqGjaRAsvcCdwgn76Di59TMcoco2PwW2nO5bE+zBCYUcdXX\n\t0hxerUJQi/kkv3lS4CC1rEkgtBgE9w3yQdGVDI4d9uD8gaeNlXfX1kApv2dpl1KQSRJ3\n\t9NDBE8Ovexi7PwTWhj8QtSR2/p6zlE5nhbP/Gga2Bsd8R06sXxQf7zzixptsnfJ9fC7j\n\tu1P7qh93IZRAE3aCDmbv2uYHXmzf5VRL+tTB60qjpin5a4fyjk7nrXrv/uJFe9sjfjiq\n\tFdpw==","X-Gm-Message-State":"AOJu0YytI/uZHKDzXSj/CsgC5NlmZ6HdLQgL+FsrA7r6Ds4i4SANpLN5\n\tUP+x31iBhiPFOwmJ+TP09LG8aBVQf3Wb4FBEjiIm2wRJtIcs8tCZK7RdX1yNIEZtyqvh9kx9IMa\n\tScuPD","X-Gm-Gg":"ASbGncsYYMeoGzbmtV5MGBApauDR3dtOFKXu/PmtruaTlIIlERmnn+cZTnWrUz+3zcA\n\tpt0/lg4mXxr+QMKTfT1fFfv0WvWdv5sh0zog5FzzX6YJw6wLXqIU4Qxp2dB1TFGZmrhSYILIFjX\n\tjRIdkzWrTbT6yDg/TDVCnRZYKi9NQMpy2jsIMxV2S9w+WjwvB+Fd7So3JqTd8wxkF25k3HGjVtf\n\tnzaFkkKic+Lh0Ol8YXYbrE/Vbb9/4NnVPLT21SlQgJr2AwxnYcxYWaekV4/j94Gs2zRWmCXPlNp\n\tGYxoWO8rYwJ0+h9l/srLQRIykB5rh4nt8jIiu6xDcbsLS65kAL88yeib4Bq7JsCZ6nBB5qtfyuj\n\tXXlipQXjJJ7KL8k7wK/0qEIl/NpsrM26egiN7ka59/yyWXdraD+SqZxRA/id3PhOFhg9JiFeaFq\n\t0eGTXXsGGg3Jy2bhVJszEmD3aOR/QAfe6d80KthSlj","X-Google-Smtp-Source":"AGHT+IFmbV75YWgYP1Snbyr6pOFAXRm/0v9qTOz/dXXNUUtfTCfRYD9tOCS1lhudIxriMMetwv88Bw==","X-Received":"by 2002:a17:907:7292:b0:b50:891f:66b3 with SMTP id\n\ta640c23a62f3a-b50aca0b669mr2544259966b.64.1760491383451; \n\tTue, 14 Oct 2025 18:23:03 -0700 (PDT)","From":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>","To":"libcamera-devel@lists.libcamera.org","Cc":"hdegoede@redhat.com, mzamazal@redhat.com, bryan.odonoghue@linaro.org,\n\tbod.linux@nxsw.ie","Subject":"[PATCH v3 09/39] libcamera: software_isp: Move useful items from\n\tDebayerCpu to Debayer base class","Date":"Wed, 15 Oct 2025 02:22:21 +0100","Message-ID":"<20251015012251.17508-10-bryan.odonoghue@linaro.org>","X-Mailer":"git-send-email 2.51.0","In-Reply-To":"<20251015012251.17508-1-bryan.odonoghue@linaro.org>","References":"<20251015012251.17508-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":"The DebayerCpu class has a number of variables, embedded structures and\nmethods which are useful to DebayerGpu implementation.\n\nMove relevant variables and methods to base class.\n\nSince we want to call setParams() from the GPUISP and reuse the code in\nthe existing CPUISP as a first step, we need to move all of the\ndependent variables in DebayerCPU to the Debayer base class including\nLookupTable and redCcm_.\n\nThe DebayerEGL class will ultimately be able to consume both the CCM and\nnon-CCM data.\n\nSigned-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n---\n src/libcamera/software_isp/debayer.h       | 45 +++++++++++++++++++++-\n src/libcamera/software_isp/debayer_cpu.cpp |  2 +-\n src/libcamera/software_isp/debayer_cpu.h   | 35 +----------------\n 3 files changed, 46 insertions(+), 36 deletions(-)","diff":"diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h\nindex ba033d44..1b195d29 100644\n--- a/src/libcamera/software_isp/debayer.h\n+++ b/src/libcamera/software_isp/debayer.h\n@@ -14,11 +14,14 @@\n #include <stdint.h>\n \n #include <libcamera/base/log.h>\n+#include <libcamera/base/object.h>\n #include <libcamera/base/signal.h>\n \n #include <libcamera/geometry.h>\n #include <libcamera/stream.h>\n \n+#include \"libcamera/internal/global_configuration.h\"\n+#include \"libcamera/internal/software_isp/benchmark.h\"\n #include \"libcamera/internal/software_isp/debayer_params.h\"\n \n namespace libcamera {\n@@ -27,9 +30,10 @@ class FrameBuffer;\n \n LOG_DECLARE_CATEGORY(Debayer)\n \n-class Debayer\n+class Debayer : public Object\n {\n public:\n+\tDebayer (const GlobalConfiguration &configuration) : bench_(configuration) {};\n \tvirtual ~Debayer() = 0;\n \n \tvirtual int configure(const StreamConfiguration &inputCfg,\n@@ -45,8 +49,47 @@ public:\n \n \tvirtual SizeRange sizes(PixelFormat inputFormat, const Size &inputSize) = 0;\n \n+\tvirtual const SharedFD &getStatsFD() = 0;\n+\n+\tunsigned int frameSize() { return outputConfig_.frameSize; }\n+\n \tSignal<FrameBuffer *> inputBufferReady;\n \tSignal<FrameBuffer *> outputBufferReady;\n+\t\n+\t/**\n+\t * struct DebayerInputConfig \n+\t *\n+\t * Structure to describe the incoming Bayer parameters.\n+\t */\n+\tstruct DebayerInputConfig {\n+\t\tSize patternSize;\n+\t\tunsigned int bpp; /* Memory used per pixel, not precision */\n+\t\tunsigned int stride;\n+\t\tstd::vector<PixelFormat> outputFormats;\n+\t};\n+\n+\t/**\n+\t * struct DebayerOutputConfig \n+\t *\n+\t * Structure to describe the output pattern requested to the Debayer logic.\n+\t */\n+\tstruct DebayerOutputConfig {\n+\t\tunsigned int bpp; /* Memory used per pixel, not precision */\n+\t\tunsigned int stride;\n+\t\tunsigned int frameSize;\n+\t};\n+\n+\tDebayerInputConfig inputConfig_;\n+\tDebayerOutputConfig outputConfig_;\n+\tDebayerParams::LookupTable red_;\n+\tDebayerParams::LookupTable green_;\n+\tDebayerParams::LookupTable blue_;\n+\tDebayerParams::CcmLookupTable redCcm_;\n+\tDebayerParams::CcmLookupTable greenCcm_;\n+\tDebayerParams::CcmLookupTable blueCcm_;\n+\tDebayerParams::LookupTable gammaLut_;\n+\tbool swapRedBlueGains_;\n+\tBenchmark bench_;\n \n private:\n \tvirtual Size patternSize(PixelFormat inputFormat) = 0;\ndiff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp\nindex df77deb6..612f01a6 100644\n--- a/src/libcamera/software_isp/debayer_cpu.cpp\n+++ b/src/libcamera/software_isp/debayer_cpu.cpp\n@@ -42,7 +42,7 @@ namespace libcamera {\n  * \\param[in] configuration The global configuration\n  */\n DebayerCpu::DebayerCpu(std::unique_ptr<SwStatsCpu> stats, const GlobalConfiguration &configuration)\n-\t: stats_(std::move(stats)), bench_(configuration)\n+\t: Debayer(configuration), stats_(std::move(stats))\n {\n \t/*\n \t * Reading from uncached buffers may be very slow.\ndiff --git a/src/libcamera/software_isp/debayer_cpu.h b/src/libcamera/software_isp/debayer_cpu.h\nindex aff32491..ff72eaba 100644\n--- a/src/libcamera/software_isp/debayer_cpu.h\n+++ b/src/libcamera/software_isp/debayer_cpu.h\n@@ -17,16 +17,14 @@\n \n #include <libcamera/base/object.h>\n \n-#include \"libcamera/internal/software_isp/benchmark.h\"\n #include \"libcamera/internal/bayer_format.h\"\n-#include \"libcamera/internal/global_configuration.h\"\n #include \"libcamera/internal/software_isp/swstats_cpu.h\"\n \n #include \"debayer.h\"\n \n namespace libcamera {\n \n-class DebayerCpu : public Debayer, public Object\n+class DebayerCpu : public Debayer\n {\n public:\n \tDebayerCpu(std::unique_ptr<SwStatsCpu> stats, const GlobalConfiguration &configuration);\n@@ -49,13 +47,6 @@ public:\n \t */\n \tconst SharedFD &getStatsFD() { return stats_->getStatsFD(); }\n \n-\t/**\n-\t * \\brief Get the output frame size\n-\t *\n-\t * \\return The output frame size\n-\t */\n-\tunsigned int frameSize() { return outputConfig_.frameSize; }\n-\n private:\n \t/**\n \t * \\brief Called to debayer 1 line of Bayer input data to output format\n@@ -112,19 +103,6 @@ private:\n \ttemplate<bool addAlphaByte, bool ccmEnabled>\n \tvoid debayer10P_RGRG_BGR888(uint8_t *dst, const uint8_t *src[]);\n \n-\tstruct DebayerInputConfig {\n-\t\tSize patternSize;\n-\t\tunsigned int bpp; /* Memory used per pixel, not precision */\n-\t\tunsigned int stride;\n-\t\tstd::vector<PixelFormat> outputFormats;\n-\t};\n-\n-\tstruct DebayerOutputConfig {\n-\t\tunsigned int bpp; /* Memory used per pixel, not precision */\n-\t\tunsigned int stride;\n-\t\tunsigned int frameSize;\n-\t};\n-\n \tint getInputConfig(PixelFormat inputFormat, DebayerInputConfig &config);\n \tint getOutputConfig(PixelFormat outputFormat, DebayerOutputConfig &config);\n \tint setupStandardBayerOrder(BayerFormat::Order order);\n@@ -140,20 +118,11 @@ private:\n \t/* Max. supported Bayer pattern height is 4, debayering this requires 5 lines */\n \tstatic constexpr unsigned int kMaxLineBuffers = 5;\n \n-\tDebayerParams::LookupTable red_;\n-\tDebayerParams::LookupTable green_;\n-\tDebayerParams::LookupTable blue_;\n-\tDebayerParams::CcmLookupTable redCcm_;\n-\tDebayerParams::CcmLookupTable greenCcm_;\n-\tDebayerParams::CcmLookupTable blueCcm_;\n-\tDebayerParams::LookupTable gammaLut_;\n \tdebayerFn debayer0_;\n \tdebayerFn debayer1_;\n \tdebayerFn debayer2_;\n \tdebayerFn debayer3_;\n \tRectangle window_;\n-\tDebayerInputConfig inputConfig_;\n-\tDebayerOutputConfig outputConfig_;\n \tstd::unique_ptr<SwStatsCpu> stats_;\n \tstd::vector<uint8_t> lineBuffers_[kMaxLineBuffers];\n \tunsigned int lineBufferLength_;\n@@ -161,8 +130,6 @@ private:\n \tunsigned int lineBufferIndex_;\n \tunsigned int xShift_; /* Offset of 0/1 applied to window_.x */\n \tbool enableInputMemcpy_;\n-\tbool swapRedBlueGains_;\n-\tBenchmark bench_;\n };\n \n } /* namespace libcamera */\n","prefixes":["v3","09/39"]}