From patchwork Wed Jun 11 01:32:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 23514 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 21315C3326 for ; Wed, 11 Jun 2025 01:33:28 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8D56268DD2; Wed, 11 Jun 2025 03:33:27 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="iU/7qkHQ"; dkim-atps=neutral Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 81EA768DCA for ; Wed, 11 Jun 2025 03:33:25 +0200 (CEST) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-43edecbfb94so73699135e9.1 for ; Tue, 10 Jun 2025 18:33:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1749605604; x=1750210404; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1JOyJ0DIm6FCLhp4r1H55WC7og1e2fTC9EjR+qyZDhw=; b=iU/7qkHQYUG7PoqOeUpFFNm0Cb2eQRd6MP9x/Aj09t6oNsJqSkA3/Lniiq9IuhseA8 avM8MjbykgBfgubzy/tZW/vZQhPn4bJkV3gGbrmDdksPGPoQrlOopzTfQGrcYDTSq+Vg KhOnY09lQOAvYrhqbzS5h8dCwlwMDgbYFbVU6WEcWz7tHG4ff0OroPdlk9QkLB/Z2cTm 7tPpXkDVWz11CNjrYr7i5VUrkEhVqlO+NC7vKn8hHUhBpMUr7MyIfuixtNluzWuGR9Ao 9cBIv8o5GCfMrh7laUEHTzXHwGXAFbwwGMFHDaulrugdXILpuSWbmMrOc7YqTDQzLgWk kUpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749605604; x=1750210404; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1JOyJ0DIm6FCLhp4r1H55WC7og1e2fTC9EjR+qyZDhw=; b=WRI2EoI2wqhtQqEV5rhRxFBjfSmtmIe8vQxFuWl5iH2AHCFfTNVlUEg2RDo7nD5czL +6JTZKodWVOvqrDysg7bPwVaJMkUjeVeRcmaQAi9vaDUFHX4EGIzNuWH5uVg3BszYyc+ mnn2q0Z7JPlroN2FuHGI1aOPJXV6kfxc+QKj61wQAP1iZGGcfxUaUjLh8qz+AyT44b3t +dkWHEQm/IBgFgq86v5o4uTB+wTIpwZm5kS4j/HjO2C6++i9dcl5EOJUb1ugQ/sTlfn6 GppgGGb2FxzXfIM3bHlEjzcC6r/YH8Xj+4ImunmKiF644g/u1mdn9lrGsvAzKcuOFda5 DDlA== X-Gm-Message-State: AOJu0YywPM1cM7PF1EFKJJsyflwbbx7mQgk40WBHj8l3sXHYDA/CwtoG XyQkQyZN7CmowKj/TuDsNzDgrkvurlaL0+4nEy5R0L8u8TAHk1jdLz6OKhh7C7tIR6OP8SLYSmG Im+Tu/H4= X-Gm-Gg: ASbGncutoqrZsOkU/K3JttQeIZgtGS6bB93Aeu7d/xIUR5NH1mIHK1YK4UPCTjs+ZAZ ZFsqOFaF6B+mseM3iAoZP+Iei9bbbP09LgoJb1S0MjmvDv9wjbRwhDT9bEsRIatdykQtQtS/kWM m0zDtnW45Wy+M8koTEPsHE+qf6Iv4Q/dV//687utfZbsOnO+UZHE/jRjMxZ35E3hQxrBNGiPyy5 un9H0USbKeY1lPj2P2aVCFabfhrTY3pKJM/aXbqFy2c904Ext/JeFlKuSQaYhLIFGbq/mG8T14O 5fle6HtR59bkY3hbY77nqL+5Zcyw+gxCoyuTlvVrDrM5yOSVL6arxcI5MkJ6DCVgRMkIuvmnngd jmSk0uH2wQqYBdmDd5JiJi9rWDUX3xg8Ou58rJQt2Lw== X-Google-Smtp-Source: AGHT+IGym948NlpHWXWR8q20L4SDDBsI7bA0Pbfsm3lLFFNZnxE5m3nod3wJoQc0Oj6p8tOe2UI3Ig== X-Received: by 2002:a5d:584b:0:b0:3a5:3bdd:6cfe with SMTP id ffacd0b85a97d-3a5587fb627mr851880f8f.26.1749605604324; Tue, 10 Jun 2025 18:33:24 -0700 (PDT) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4532514138asm5680625e9.3.2025.06.10.18.33.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jun 2025 18:33:23 -0700 (PDT) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: Bryan O'Donoghue Subject: [PATCH 08/35] libcamera: software_isp: Move useful items from DebayerCpu 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 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The DebayerCpu class has a number of variables, embedded structures and methods which are useful to DebayerGpu implementation. Move relevant variables and methods to base class. Signed-off-by: Bryan O'Donoghue --- src/libcamera/software_isp/debayer.h | 33 ++++++++++++++++++++++- src/libcamera/software_isp/debayer_cpu.h | 34 +----------------------- 2 files changed, 33 insertions(+), 34 deletions(-) diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h index ba033d44..45da822a 100644 --- a/src/libcamera/software_isp/debayer.h +++ b/src/libcamera/software_isp/debayer.h @@ -14,11 +14,13 @@ #include #include +#include #include #include #include +#include "libcamera/internal/software_isp/benchmark.h" #include "libcamera/internal/software_isp/debayer_params.h" namespace libcamera { @@ -27,7 +29,7 @@ class FrameBuffer; LOG_DECLARE_CATEGORY(Debayer) -class Debayer +class Debayer : public Object { public: virtual ~Debayer() = 0; @@ -45,9 +47,38 @@ public: virtual SizeRange sizes(PixelFormat inputFormat, const Size &inputSize) = 0; + virtual const SharedFD &getStatsFD() = 0; + + unsigned int frameSize() { return outputConfig_.frameSize; } + Signal inputBufferReady; Signal outputBufferReady; + struct DebayerInputConfig { + Size patternSize; + unsigned int bpp; /* Memory used per pixel, not precision */ + unsigned int stride; + std::vector outputFormats; + }; + + struct DebayerOutputConfig { + unsigned int bpp; /* Memory used per pixel, not precision */ + unsigned int stride; + unsigned int frameSize; + }; + + DebayerInputConfig inputConfig_; + DebayerOutputConfig outputConfig_; + DebayerParams::LookupTable red_; + DebayerParams::LookupTable green_; + DebayerParams::LookupTable blue_; + DebayerParams::CcmLookupTable redCcm_; + DebayerParams::CcmLookupTable greenCcm_; + DebayerParams::CcmLookupTable blueCcm_; + DebayerParams::LookupTable gammaLut_; + bool swapRedBlueGains_; + Benchmark bench_; + private: virtual Size patternSize(PixelFormat inputFormat) = 0; }; diff --git a/src/libcamera/software_isp/debayer_cpu.h b/src/libcamera/software_isp/debayer_cpu.h index 182607cd..0b4b16e1 100644 --- a/src/libcamera/software_isp/debayer_cpu.h +++ b/src/libcamera/software_isp/debayer_cpu.h @@ -17,7 +17,6 @@ #include -#include "libcamera/internal/software_isp/benchmark.h" #include "libcamera/internal/bayer_format.h" #include "libcamera/internal/software_isp/swstats_cpu.h" @@ -25,7 +24,7 @@ namespace libcamera { -class DebayerCpu : public Debayer, public Object +class DebayerCpu : public Debayer { public: DebayerCpu(std::unique_ptr stats); @@ -48,13 +47,6 @@ public: */ const SharedFD &getStatsFD() { return stats_->getStatsFD(); } - /** - * \brief Get the output frame size - * - * \return The output frame size - */ - unsigned int frameSize() { return outputConfig_.frameSize; } - private: /** * \brief Called to debayer 1 line of Bayer input data to output format @@ -111,19 +103,6 @@ private: template void debayer10P_RGRG_BGR888(uint8_t *dst, const uint8_t *src[]); - struct DebayerInputConfig { - Size patternSize; - unsigned int bpp; /* Memory used per pixel, not precision */ - unsigned int stride; - std::vector outputFormats; - }; - - struct DebayerOutputConfig { - unsigned int bpp; /* Memory used per pixel, not precision */ - unsigned int stride; - unsigned int frameSize; - }; - int getInputConfig(PixelFormat inputFormat, DebayerInputConfig &config); int getOutputConfig(PixelFormat outputFormat, DebayerOutputConfig &config); int setupStandardBayerOrder(BayerFormat::Order order); @@ -139,20 +118,11 @@ private: /* Max. supported Bayer pattern height is 4, debayering this requires 5 lines */ static constexpr unsigned int kMaxLineBuffers = 5; - DebayerParams::LookupTable red_; - DebayerParams::LookupTable green_; - DebayerParams::LookupTable blue_; - DebayerParams::CcmLookupTable redCcm_; - DebayerParams::CcmLookupTable greenCcm_; - DebayerParams::CcmLookupTable blueCcm_; - DebayerParams::LookupTable gammaLut_; debayerFn debayer0_; debayerFn debayer1_; debayerFn debayer2_; debayerFn debayer3_; Rectangle window_; - DebayerInputConfig inputConfig_; - DebayerOutputConfig outputConfig_; std::unique_ptr stats_; std::vector lineBuffers_[kMaxLineBuffers]; unsigned int lineBufferLength_; @@ -160,8 +130,6 @@ private: unsigned int lineBufferIndex_; unsigned int xShift_; /* Offset of 0/1 applied to window_.x */ bool enableInputMemcpy_; - bool swapRedBlueGains_; - Benchmark bench_; }; } /* namespace libcamera */