From patchwork Sun Aug 24 00:48:19 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: 24190 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 EB3FEC32BB for ; Sun, 24 Aug 2025 00:48:54 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C379B6930C; Sun, 24 Aug 2025 02:48:53 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="q0xPzHu8"; dkim-atps=neutral Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id F165D692EE for ; Sun, 24 Aug 2025 02:48:42 +0200 (CEST) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-45b4d8921f2so22219825e9.2 for ; Sat, 23 Aug 2025 17:48:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1755996522; x=1756601322; darn=lists.libcamera.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=AhO5jbmqIErrZjhRQ9bdap2VGhNmIAawszqjnj5G6G0=; b=q0xPzHu8324Ga3Xjz4WC9U9LcjbqookTlHsaVE7bdXa7uHSKfhj7BfbRno4l3qymPd n4+EEDTAQxnHMvBTAepEEZshZBPE7tWcFaKJxUdx2V/jlXLrtCliFI5nEtSBPuNJG96N L6Qk0qtB8LcMfs3+S027beD7GejXRNogexSb+Vc2k3Rv/5LHwakItHypa2UMbSCSKpD/ q3eqF9Y3OD3S7vZTuuluXNvynG1EgFKpPI7TCPcW/xaI1aqvGVsEb4yF37bB6ggRYn8h N8gteaEzup584JIk+OYJZLMn3wYw+24+L2nFbWw6JSdkyLdruax6B/QgmXhrZQw0eUXt BVVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755996522; x=1756601322; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AhO5jbmqIErrZjhRQ9bdap2VGhNmIAawszqjnj5G6G0=; b=IUHl7b/drcW7tLD+7OTR8clPA+9zpeZwFYKCupjTUm51usV/DAe/86Lxd7BjuLCyW9 z5TIzd9ddJrD7ZiCuMWPL8ZV3zveVtqqE/5uyt8fClGp9ouo8Lce5uY5puQ6F4w9+rzv 2I4F9AK/j6k5A5zDQzMScCXEEncqFrCEzIWXOwfgp/8I7xjxUO4VVB7GCVPJjGhGZ+9P /E30ss6gWqSYw0AnicgW1cV28PPBtqCo1i6ID8SZgQjLCI7LlOqMS3ENEhuSRRa4mQws JwjyNCn+8nh9Ql5IB9ENwLRnP7rN13qH93VzssfPKVWwW2/yGuKFGtuKmPuk7ZrUvw1B U3ZA== X-Gm-Message-State: AOJu0YzwJLh3BeUXZOY6Drts11Ag3t9VX0QnIU5Y45o8oKjr1O09wRIf 73dRlOtESclgk78rv1WzvHNUxuGcl1mIsnfGs/ztOeidtgJA9DRTZjKLF0UsqNGR3cHy94KOAWx vm/DtglI= X-Gm-Gg: ASbGncuE5qoY01fzKQTByXEITSQ7RliG0F9x8CTWI3NSOKkLmrY3KSremd0I0j0rPew /OEhvySgP9A3T1wNmmQrDYTnJHlMPukzP64bc4/fWdyCKKfcPQjG5U7XD3UUJgHwhezhkdjupXX +NVpUhBJbvFLg+aq0fNBry08FECDtt3LCEj5fRKthQAnElLGGoeRmD0LyTmsTWSTcQh/qpb2vBU AZJvktDakLqE7R8UrGRM75re5RFQKI01qFzXNjh/seXg60aTkWoZq7DAcejGmXhQM6Ol1PDvoN9 L3DjlpekDqZZ4L/H+ySFKRt2IslNBW2++Xq/yoGa9FFmKzkJqTXfhhTDOuge07lpSQ5yZ94aMH6 VnlSpRY7EV8Lp666BCmTS4Vz9Ue0EDbtEqzIWX3r8y83D0HjnYlQf3dDAmEojkWEcZdxy+pGTAD CSvDkH2+XxW/OqW6MLHDGW X-Google-Smtp-Source: AGHT+IHd1ioe6SThEkVwGuh7YZPOZvaCjp43PneYdSgjb3eJynAhUL3q0tYjtwsvSkFm4gfcB0vJXg== X-Received: by 2002:a05:600c:c87:b0:456:f1e:205c with SMTP id 5b1f17b1804b1-45b5179f338mr61693245e9.4.1755996522472; Sat, 23 Aug 2025 17:48:42 -0700 (PDT) Received: from [192.168.0.13] (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45b4e1d530esm69347225e9.0.2025.08.23.17.48.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Aug 2025 17:48:42 -0700 (PDT) From: Bryan O'Donoghue Date: Sun, 24 Aug 2025 01:48:19 +0100 Subject: [PATCH v2 07/37] libcamera: software_isp: Move useful items from DebayerCpu to Debayer base class MIME-Version: 1.0 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 X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=5591; i=bryan.odonoghue@linaro.org; h=from:subject:message-id; bh=LwIhgiDDDDu/lPFoHfcp8xRUGk7VZNzUmlvPynHsyck=; b=owEBbQKS/ZANAwAKASJxO7Ohjcg6AcsmYgBoqmFdPeLlik6pgWEGFBQ48HIivehWpPvY1zqVZ go82bhgqSeJAjMEAAEKAB0WIQTmk/sqq6Nt4Rerb7QicTuzoY3IOgUCaKphXQAKCRAicTuzoY3I OnWsD/9UyZ5TN2WYmPvpw0lXfAr8edt72+LPDaRiUY7UoIDv9zV+g1NahNwmjrnBxy5zQ6UI65n cOouR0bWLw6+rZ/R8rc4n+ciAq75Jt4MpK3OWASLr6IMxEhZUL57tiYvOzapfAWVPZieP7yufwx rnY+DsUMfvuVf1UzblRiVo6W5i5U0PkWBAXbCs5IRs8fTu2W8kCmHsGY2JVJNe8hrNz/mS9X+5F vnLLxOwdQdqJJQU7x7/OIkJzUM9K54vstAwJDEt9jvfneJQSOolqaxqTl8U1z3r+jkZvPQsRztG 8OLplSKYZtMhrbmBykRf91vLZQ9lZaIBa4wSih8KTKVirGFrwWZqKdT3qs65gd3ixzNiGb+qWaS V+CjAdvQVmMB/uPjnVcY7c9UIW/32/BZV4k010Trr4wYswltlbIjtAIoump/Ckm3p5O6EwekELh fdRuBBhFN+o6HDCkeZvKxt6w1W4c//pMG3J3CfQgg5IRoEuENueSjjXTlS99Xm4T5vNOLaHO4NG NHIXU0BKTgn2YXRdVcHO9kfrc7ZD2PaDNHz3cqTcSWRZMMISjp2hPAXZ619F3M9i4aBVLAhC4HH D2yT1+iXlKSwmFsfz0B9OXePQu7qDr5/XY/ions+eNuUSilvuc4hp3aAY/N5gH/zPtqIpkCuU2j hHCgRho/q4MO2RQ== X-Developer-Key: i=bryan.odonoghue@linaro.org; a=openpgp; fpr=E693FB2AABA36DE117AB6FB422713BB3A18DC83A 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. Since we want to call setParams() from the GPUISP and reuse the code in the existing CPUISP as a first step, we need to move all of the dependent variables in DebayerCPU to the Debayer base class including LookupTable and redCcm_. The DebayerEGL class will ultimately be able to consume both the CCM and non-CCM data. 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 ba033d440901230875a6aba5d37027130791b87e..45da822a2173070fd1b99bbfed4c0fdeaa1a88c6 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 182607cda870be6f650368479b30865c7457880e..0b4b16e1a3b64f8eed25b6017274b21c9a89a1ee 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 */