{"id":23514,"url":"https://patchwork.libcamera.org/api/patches/23514/?format=json","web_url":"https://patchwork.libcamera.org/patch/23514/","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":"<20250611013245.133785-9-bryan.odonoghue@linaro.org>","date":"2025-06-11T01:32:18","name":"[08/35] 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/23514/mbox/","series":[{"id":5212,"url":"https://patchwork.libcamera.org/api/series/5212/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5212","date":"2025-06-11T01:32:10","name":"Add GLES 2.0 GPUISP to libcamera","version":1,"mbox":"https://patchwork.libcamera.org/series/5212/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/23514/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/23514/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 21315C3326\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 11 Jun 2025 01:33:28 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8D56268DD2;\n\tWed, 11 Jun 2025 03:33:27 +0200 (CEST)","from mail-wm1-x332.google.com (mail-wm1-x332.google.com\n\t[IPv6:2a00:1450:4864:20::332])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 81EA768DCA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 11 Jun 2025 03:33:25 +0200 (CEST)","by mail-wm1-x332.google.com with SMTP id\n\t5b1f17b1804b1-43edecbfb94so73699135e9.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 10 Jun 2025 18:33:25 -0700 (PDT)","from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie.\n\t[188.141.3.146]) by smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-4532514138asm5680625e9.3.2025.06.10.18.33.22\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 10 Jun 2025 18:33:23 -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=\"iU/7qkHQ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1749605604; x=1750210404;\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=1JOyJ0DIm6FCLhp4r1H55WC7og1e2fTC9EjR+qyZDhw=;\n\tb=iU/7qkHQYUG7PoqOeUpFFNm0Cb2eQRd6MP9x/Aj09t6oNsJqSkA3/Lniiq9IuhseA8\n\tavM8MjbykgBfgubzy/tZW/vZQhPn4bJkV3gGbrmDdksPGPoQrlOopzTfQGrcYDTSq+Vg\n\tKhOnY09lQOAvYrhqbzS5h8dCwlwMDgbYFbVU6WEcWz7tHG4ff0OroPdlk9QkLB/Z2cTm\n\t7tPpXkDVWz11CNjrYr7i5VUrkEhVqlO+NC7vKn8hHUhBpMUr7MyIfuixtNluzWuGR9Ao\n\t9cBIv8o5GCfMrh7laUEHTzXHwGXAFbwwGMFHDaulrugdXILpuSWbmMrOc7YqTDQzLgWk\n\tkUpg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1749605604; x=1750210404;\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=1JOyJ0DIm6FCLhp4r1H55WC7og1e2fTC9EjR+qyZDhw=;\n\tb=WRI2EoI2wqhtQqEV5rhRxFBjfSmtmIe8vQxFuWl5iH2AHCFfTNVlUEg2RDo7nD5czL\n\t+6JTZKodWVOvqrDysg7bPwVaJMkUjeVeRcmaQAi9vaDUFHX4EGIzNuWH5uVg3BszYyc+\n\tmnn2q0Z7JPlroN2FuHGI1aOPJXV6kfxc+QKj61wQAP1iZGGcfxUaUjLh8qz+AyT44b3t\n\t+dkWHEQm/IBgFgq86v5o4uTB+wTIpwZm5kS4j/HjO2C6++i9dcl5EOJUb1ugQ/sTlfn6\n\tGppgGGb2FxzXfIM3bHlEjzcC6r/YH8Xj+4ImunmKiF644g/u1mdn9lrGsvAzKcuOFda5\n\tDDlA==","X-Gm-Message-State":"AOJu0YywPM1cM7PF1EFKJJsyflwbbx7mQgk40WBHj8l3sXHYDA/CwtoG\n\tXyQkQyZN7CmowKj/TuDsNzDgrkvurlaL0+4nEy5R0L8u8TAHk1jdLz6OKhh7C7tIR6OP8SLYSmG\n\tIm+Tu/H4=","X-Gm-Gg":"ASbGncutoqrZsOkU/K3JttQeIZgtGS6bB93Aeu7d/xIUR5NH1mIHK1YK4UPCTjs+ZAZ\n\tZFsqOFaF6B+mseM3iAoZP+Iei9bbbP09LgoJb1S0MjmvDv9wjbRwhDT9bEsRIatdykQtQtS/kWM\n\tm0zDtnW45Wy+M8koTEPsHE+qf6Iv4Q/dV//687utfZbsOnO+UZHE/jRjMxZ35E3hQxrBNGiPyy5\n\tun9H0USbKeY1lPj2P2aVCFabfhrTY3pKJM/aXbqFy2c904Ext/JeFlKuSQaYhLIFGbq/mG8T14O\n\t5fle6HtR59bkY3hbY77nqL+5Zcyw+gxCoyuTlvVrDrM5yOSVL6arxcI5MkJ6DCVgRMkIuvmnngd\n\tjmSk0uH2wQqYBdmDd5JiJi9rWDUX3xg8Ou58rJQt2Lw==","X-Google-Smtp-Source":"AGHT+IGym948NlpHWXWR8q20L4SDDBsI7bA0Pbfsm3lLFFNZnxE5m3nod3wJoQc0Oj6p8tOe2UI3Ig==","X-Received":"by 2002:a5d:584b:0:b0:3a5:3bdd:6cfe with SMTP id\n\tffacd0b85a97d-3a5587fb627mr851880f8f.26.1749605604324; \n\tTue, 10 Jun 2025 18:33:24 -0700 (PDT)","From":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>","To":"libcamera-devel@lists.libcamera.org","Cc":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>","Subject":"[PATCH 08/35] libcamera: software_isp: Move useful items from\n\tDebayerCpu to Debayer base class","Date":"Wed, 11 Jun 2025 02:32:18 +0100","Message-ID":"<20250611013245.133785-9-bryan.odonoghue@linaro.org>","X-Mailer":"git-send-email 2.49.0","In-Reply-To":"<20250611013245.133785-1-bryan.odonoghue@linaro.org>","References":"<20250611013245.133785-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\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 ba033d44..45da822a 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 182607cd..0b4b16e1 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":["08/35"]}