From patchwork Tue Apr 22 21:59:08 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: 23228 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 858E6C3320 for ; Tue, 22 Apr 2025 21:59:51 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 160B468B47; Tue, 22 Apr 2025 23:59:51 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="SCpNfJnB"; dkim-atps=neutral Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2C57768B33 for ; Tue, 22 Apr 2025 23:59:38 +0200 (CEST) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-43cfa7e7f54so2379195e9.1 for ; Tue, 22 Apr 2025 14:59:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1745359177; x=1745963977; 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=wtckwzkmaU4Et0QIN3FBwnzzUA21kmyVM0rQImxpaL0=; b=SCpNfJnBWtP2mU3tOWim/Vywqy/2lKCpw8M1qDaawLPg7lgxVNMtWL67xhSlG+LjEM LXSVo9mLfk6EnnSXvX0d+rPCI0PVllicwszBs8Bt1JgO4ZjUPA+A+H+7IEHtObJYDYEU PFF1spzlMZzi2g6Gyi7jOTVgOEsMoMflQnGBECrV84qem2geK4qnDpj4SqMdQFVXhtxq clrzTrP2j9lOolWva/WtUkG2QQ44jFMoIR/tzK62QTYQoPgt7Rf4LDJ2HbLweLycEUqq 8iljjNt6zqcuqOv3XfBo7VROPmU1vmJOD5dLuL3xTx+z/aT+868chq/oib36MJLdxLl9 Zg2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745359177; x=1745963977; 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=wtckwzkmaU4Et0QIN3FBwnzzUA21kmyVM0rQImxpaL0=; b=jVNIg66yXZ2c+z1D4Qh5kveVaUZApoIeJNNngC8D6G+9okxok3vwaDRZli49CM1mTS aG+d0WC3LgDVcfdLlpBNvOTVWqvlBZud5Lr1HmbBC8iJgzwsX9tIvxKAtOe2YidfrfXT uCy0+D6O6xnGjEkM9ItsHkRwRMcuGIRmG0GoIyadWzE8MbsqTPAOTrFHeQVEqcnKXuR1 QJbSE8EyvWobpwUopx7w8ieliFqOlYH61wTQU/P9vts7CY03crDALTct0Iicx0YeZtRs 8suaNxTgws1JS4bfgcLFQkE9Ci4UQlkp36O+8WPWMCdJpa4N87ZHdYgQyHb9ZxITqq0v 2+Gg== X-Gm-Message-State: AOJu0YwMyBG81DZDwOKhAmndYSGhogRtPiIJEQdjRLU298+WojrscrmZ WIwX+XXnELtMtyu5UCHhuFHQqMb5ov+s00jR3tKEnjFTsnflW7ZcJk1d5BRYzcEHpv4OpfLtsAv jo20= X-Gm-Gg: ASbGncvxCs3EixTlE2qz4aw7TWzAakeIMchOjqDfjsffkmr0uD3xwImLw+r6zxKxA4J 1rfcnqQu+mf3IVmN1XjYSwLm+cgzGv3UWXzT28MPJTI3I74KoclbA/Wdr83YnN+URoburW2Ifpc M+/ZJ1H+kSmW6KX1KoPhfFsEfc4huRnnGIvRMZipHLuDCUzPECXalVJvPkO33VPJBnS0uZ10Pve 4Ex7yOoqbC5fzA6U7aRE3vxk5WADE/6ZGwLm4E34nEruO7UkL/goMK1cZ6DEM9S/UKhqv1OPCQc 1cWIjDoeyE7a2196TWANgaJXC9/KPhnC5t5u/OWlgWDmhSntSWKqpZtZenGf7vD2iXiKQYHXw9M QZaJwzyaiod1rn82MxDay X-Google-Smtp-Source: AGHT+IHpQPHt75gmoBCGW5v77VPAJw6TAV63lAOiMPAA+55nk84XlkIFMr03XqR3C63vWF0NXBEXzg== X-Received: by 2002:a05:600c:5119:b0:43d:fa5f:7d30 with SMTP id 5b1f17b1804b1-44091fabcd8mr3249645e9.16.1745359177503; Tue, 22 Apr 2025 14:59:37 -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-44092d2eccesm2726615e9.20.2025.04.22.14.59.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Apr 2025 14:59:37 -0700 (PDT) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: hdegoede@redhat.com, mzamazal@redhat.com, bryan.odonoghue@linaro.org, bod.linux@nxsw.ie Subject: [PATCH 15/27] libcamera: software_isp: Move useful items from DebayerCpu to Debayer base class Date: Tue, 22 Apr 2025 22:59:08 +0100 Message-ID: <20250422215920.4297-16-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250422215920.4297-1-bryan.odonoghue@linaro.org> References: <20250422215920.4297-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 | 34 +++++++++++++++++++++++- src/libcamera/software_isp/debayer_cpu.h | 34 +----------------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h index ba033d44..dd26b9d8 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,10 +47,40 @@ 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 */