{"id":24190,"url":"https://patchwork.libcamera.org/api/patches/24190/?format=json","web_url":"https://patchwork.libcamera.org/patch/24190/","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":"<20250824-b4-v0-5-2-gpuisp-v2-a-v2-7-96f4576c814e@linaro.org>","date":"2025-08-24T00:48:19","name":"[v2,07/37] libcamera: software_isp: Move useful items from DebayerCpu to Debayer base class","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"bd3a43f08422c5aaaa33f8708bd01f9d0f28b4b0","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/24190/mbox/","series":[{"id":5400,"url":"https://patchwork.libcamera.org/api/series/5400/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5400","date":"2025-08-24T00:48:12","name":"Add GLES 2.0 GPUISP to libcamera","version":2,"mbox":"https://patchwork.libcamera.org/series/5400/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/24190/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/24190/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 EB3FEC32BB\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 24 Aug 2025 00:48:54 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C379B6930C;\n\tSun, 24 Aug 2025 02:48:53 +0200 (CEST)","from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com\n\t[IPv6:2a00:1450:4864:20::32f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F165D692EE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 24 Aug 2025 02:48:42 +0200 (CEST)","by mail-wm1-x32f.google.com with SMTP id\n\t5b1f17b1804b1-45b4d8921f2so22219825e9.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 23 Aug 2025 17:48:42 -0700 (PDT)","from [192.168.0.13] (188-141-3-146.dynamic.upc.ie. [188.141.3.146])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-45b4e1d530esm69347225e9.0.2025.08.23.17.48.41\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSat, 23 Aug 2025 17:48:42 -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=\"q0xPzHu8\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1755996522; x=1756601322;\n\tdarn=lists.libcamera.org; \n\th=cc:to:in-reply-to:references:message-id:content-transfer-encoding\n\t:mime-version:subject:date:from:from:to:cc:subject:date:message-id\n\t:reply-to; bh=AhO5jbmqIErrZjhRQ9bdap2VGhNmIAawszqjnj5G6G0=;\n\tb=q0xPzHu8324Ga3Xjz4WC9U9LcjbqookTlHsaVE7bdXa7uHSKfhj7BfbRno4l3qymPd\n\tn4+EEDTAQxnHMvBTAepEEZshZBPE7tWcFaKJxUdx2V/jlXLrtCliFI5nEtSBPuNJG96N\n\tL6Qk0qtB8LcMfs3+S027beD7GejXRNogexSb+Vc2k3Rv/5LHwakItHypa2UMbSCSKpD/\n\tq3eqF9Y3OD3S7vZTuuluXNvynG1EgFKpPI7TCPcW/xaI1aqvGVsEb4yF37bB6ggRYn8h\n\tN8gteaEzup584JIk+OYJZLMn3wYw+24+L2nFbWw6JSdkyLdruax6B/QgmXhrZQw0eUXt\n\tBVVA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1755996522; x=1756601322;\n\th=cc:to:in-reply-to:references:message-id:content-transfer-encoding\n\t:mime-version:subject:date:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=AhO5jbmqIErrZjhRQ9bdap2VGhNmIAawszqjnj5G6G0=;\n\tb=IUHl7b/drcW7tLD+7OTR8clPA+9zpeZwFYKCupjTUm51usV/DAe/86Lxd7BjuLCyW9\n\tz5TIzd9ddJrD7ZiCuMWPL8ZV3zveVtqqE/5uyt8fClGp9ouo8Lce5uY5puQ6F4w9+rzv\n\t2I4F9AK/j6k5A5zDQzMScCXEEncqFrCEzIWXOwfgp/8I7xjxUO4VVB7GCVPJjGhGZ+9P\n\t/E30ss6gWqSYw0AnicgW1cV28PPBtqCo1i6ID8SZgQjLCI7LlOqMS3ENEhuSRRa4mQws\n\tJwjyNCn+8nh9Ql5IB9ENwLRnP7rN13qH93VzssfPKVWwW2/yGuKFGtuKmPuk7ZrUvw1B\n\tU3ZA==","X-Gm-Message-State":"AOJu0YzwJLh3BeUXZOY6Drts11Ag3t9VX0QnIU5Y45o8oKjr1O09wRIf\n\t73dRlOtESclgk78rv1WzvHNUxuGcl1mIsnfGs/ztOeidtgJA9DRTZjKLF0UsqNGR3cHy94KOAWx\n\tvm/DtglI=","X-Gm-Gg":"ASbGncuE5qoY01fzKQTByXEITSQ7RliG0F9x8CTWI3NSOKkLmrY3KSremd0I0j0rPew\n\t/OEhvySgP9A3T1wNmmQrDYTnJHlMPukzP64bc4/fWdyCKKfcPQjG5U7XD3UUJgHwhezhkdjupXX\n\t+NVpUhBJbvFLg+aq0fNBry08FECDtt3LCEj5fRKthQAnElLGGoeRmD0LyTmsTWSTcQh/qpb2vBU\n\tAZJvktDakLqE7R8UrGRM75re5RFQKI01qFzXNjh/seXg60aTkWoZq7DAcejGmXhQM6Ol1PDvoN9\n\tL3DjlpekDqZZ4L/H+ySFKRt2IslNBW2++Xq/yoGa9FFmKzkJqTXfhhTDOuge07lpSQ5yZ94aMH6\n\tVnlSpRY7EV8Lp666BCmTS4Vz9Ue0EDbtEqzIWX3r8y83D0HjnYlQf3dDAmEojkWEcZdxy+pGTAD\n\tCSvDkH2+XxW/OqW6MLHDGW","X-Google-Smtp-Source":"AGHT+IHd1ioe6SThEkVwGuh7YZPOZvaCjp43PneYdSgjb3eJynAhUL3q0tYjtwsvSkFm4gfcB0vJXg==","X-Received":"by 2002:a05:600c:c87:b0:456:f1e:205c with SMTP id\n\t5b1f17b1804b1-45b5179f338mr61693245e9.4.1755996522472; \n\tSat, 23 Aug 2025 17:48:42 -0700 (PDT)","From":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>","Date":"Sun, 24 Aug 2025 01:48:19 +0100","Subject":"[PATCH v2 07/37] libcamera: software_isp: Move useful items from\n\tDebayerCpu to Debayer base class","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"7bit","Message-Id":"<20250824-b4-v0-5-2-gpuisp-v2-a-v2-7-96f4576c814e@linaro.org>","References":"<20250824-b4-v0-5-2-gpuisp-v2-a-v2-0-96f4576c814e@linaro.org>","In-Reply-To":"<20250824-b4-v0-5-2-gpuisp-v2-a-v2-0-96f4576c814e@linaro.org>","To":"libcamera-devel@lists.libcamera.org","Cc":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>","X-Mailer":"b4 0.14.2","X-Developer-Signature":"v=1; a=openpgp-sha256; l=5591;\n\ti=bryan.odonoghue@linaro.org; h=from:subject:message-id;\n\tbh=LwIhgiDDDDu/lPFoHfcp8xRUGk7VZNzUmlvPynHsyck=;\n\tb=owEBbQKS/ZANAwAKASJxO7Ohjcg6AcsmYgBoqmFdPeLlik6pgWEGFBQ48HIivehWpPvY1zqVZ\n\tgo82bhgqSeJAjMEAAEKAB0WIQTmk/sqq6Nt4Rerb7QicTuzoY3IOgUCaKphXQAKCRAicTuzoY3I\n\tOnWsD/9UyZ5TN2WYmPvpw0lXfAr8edt72+LPDaRiUY7UoIDv9zV+g1NahNwmjrnBxy5zQ6UI65n\n\tcOouR0bWLw6+rZ/R8rc4n+ciAq75Jt4MpK3OWASLr6IMxEhZUL57tiYvOzapfAWVPZieP7yufwx\n\trnY+DsUMfvuVf1UzblRiVo6W5i5U0PkWBAXbCs5IRs8fTu2W8kCmHsGY2JVJNe8hrNz/mS9X+5F\n\tvnLLxOwdQdqJJQU7x7/OIkJzUM9K54vstAwJDEt9jvfneJQSOolqaxqTl8U1z3r+jkZvPQsRztG\n\t8OLplSKYZtMhrbmBykRf91vLZQ9lZaIBa4wSih8KTKVirGFrwWZqKdT3qs65gd3ixzNiGb+qWaS\n\tV+CjAdvQVmMB/uPjnVcY7c9UIW/32/BZV4k010Trr4wYswltlbIjtAIoump/Ckm3p5O6EwekELh\n\tfdRuBBhFN+o6HDCkeZvKxt6w1W4c//pMG3J3CfQgg5IRoEuENueSjjXTlS99Xm4T5vNOLaHO4NG\n\tNHIXU0BKTgn2YXRdVcHO9kfrc7ZD2PaDNHz3cqTcSWRZMMISjp2hPAXZ619F3M9i4aBVLAhC4HH\n\tD2yT1+iXlKSwmFsfz0B9OXePQu7qDr5/XY/ions+eNuUSilvuc4hp3aAY/N5gH/zPtqIpkCuU2j\n\thHCgRho/q4MO2RQ==","X-Developer-Key":"i=bryan.odonoghue@linaro.org; a=openpgp;\n\tfpr=E693FB2AABA36DE117AB6FB422713BB3A18DC83A","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     | 33 ++++++++++++++++++++++++++++++-\n src/libcamera/software_isp/debayer_cpu.h | 34 +-------------------------------\n 2 files changed, 33 insertions(+), 34 deletions(-)","diff":"diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h\nindex ba033d440901230875a6aba5d37027130791b87e..45da822a2173070fd1b99bbfed4c0fdeaa1a88c6 100644\n--- a/src/libcamera/software_isp/debayer.h\n+++ b/src/libcamera/software_isp/debayer.h\n@@ -14,11 +14,13 @@\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/software_isp/benchmark.h\"\n #include \"libcamera/internal/software_isp/debayer_params.h\"\n \n namespace libcamera {\n@@ -27,7 +29,7 @@ class FrameBuffer;\n \n LOG_DECLARE_CATEGORY(Debayer)\n \n-class Debayer\n+class Debayer : public Object\n {\n public:\n \tvirtual ~Debayer() = 0;\n@@ -45,9 +47,38 @@ 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 \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+\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;\n };\ndiff --git a/src/libcamera/software_isp/debayer_cpu.h b/src/libcamera/software_isp/debayer_cpu.h\nindex 182607cda870be6f650368479b30865c7457880e..0b4b16e1a3b64f8eed25b6017274b21c9a89a1ee 100644\n--- a/src/libcamera/software_isp/debayer_cpu.h\n+++ b/src/libcamera/software_isp/debayer_cpu.h\n@@ -17,7 +17,6 @@\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/software_isp/swstats_cpu.h\"\n \n@@ -25,7 +24,7 @@\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);\n@@ -48,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@@ -111,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@@ -139,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@@ -160,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":["v2","07/37"]}