From patchwork Wed Oct 15 01:22:23 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: 24656 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 80303C3331 for ; Wed, 15 Oct 2025 01:23:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0F4986061D; Wed, 15 Oct 2025 03:23:16 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="AwPr4qEC"; dkim-atps=neutral Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1303060622 for ; Wed, 15 Oct 2025 03:23:06 +0200 (CEST) Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-b3f5e0e2bf7so1113267166b.3 for ; Tue, 14 Oct 2025 18:23:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1760491385; x=1761096185; 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=FfMDGj8P0x7z1LvkPhcFidNlN8u1agxdsMEloe1hujg=; b=AwPr4qECFBQ78mGqmarLNLW1X1gOPlbFEu4m/Y6T3yiui/pedZD5z7pynHeHpMpy4I 3drfhWwLOaPyrAd+PlaVlRVYZOrFZPRkNk6KAnjFpyIFcDcm1gTXmmiGGEV6et5mPLHN pXYT1VJEf8rXN/FWr8KmopHQ5Dj1XUKXiZabgaCy1YUAlnaDpxQA8pxgYqSzuDmSbhyv ckHQyvBUecC2V4Pcgjgq+mCF4LGecG6lcj23te++lwcAp9QpK9aLM8ru3672e3F5Crzp XVdOQjTvhliSslseidybo8MCNpaKqL0JYTZS95qGM28ix8qdAOPo8hhCz7DJhqsKNnOt ZjfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760491385; x=1761096185; 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=FfMDGj8P0x7z1LvkPhcFidNlN8u1agxdsMEloe1hujg=; b=UI6wNY6RZAHf30IEuAnffQX8h/ux3Sf0QEUNrVPesjxXSGwVx0Fi71KHxg17ICDC+x xcDbZHqjauAVcPnkSmM4IlxjIrmolgovvLbiDHVLlytk+HRMlU2fXz7legteW7vzV7sH hWBACOSQyBM579ORpcTXX8WDLsi9LdeaWQTdQ6aN/kMXgj6gJKgBItzd33q6lFSMVGZ4 txWAUa74jYET1GMIAAK/rv5BYIWMI3qy79Xo9VwB8zzAhYqd2maxTcuEX3GIXJhWyoVN GBgoLYILH7lGZIWEjJOVWjcaCz2n2Tb8nV5KeUsnwKvl338KQ2/bn7TdIpRAv8HEWRhd rrfw== X-Gm-Message-State: AOJu0YxCCk3+/kIymkDRrXrqzouAM1wcSByUB+zpH8ChNZprdE2swWtT ro62DlX+ZrlDnXv4mPXNkJqmOLTvNOUNFsXHuA7qvV2EHuqBU4WSeJVylv6z+5v6kiCWyMLXPG7 idLLr X-Gm-Gg: ASbGnctTTyn9JRRN3irE821Dvc30zpZlvVV5WOl0CJ4BHZ4XMGW5Em6FWDJaf1rBgE5 PIucEG3dF1QeaA/6Lxy/tLYEfUgHCI9dPHxym91ZqrUYU9D4RJ0Tt5aXD4ana2FxSLKOffwd9bL /Yi9lUtovhY7CZGbD4a7XXfiFJgd5YvRCQzBnhUq0zhsMagdETI4w1iAkZBkPOUfMeRwL81Jt6U x8bW6W2f1cWOJNTggzYzOmQsBe0zcuj6hq4PyROLslppbGSMZpOc6XjCu0i0vmeWiwfQPRUGQnj y6nxeD4RKM+hoh89gMh7I6N+b3co52LaKhDryPdkroJEB8w/M6X+FP5PWljM03kBWiDRng1vkEO +FgpZwaidCRx4k9sBq4LJLEG9K00tcAqSLG35dR5fckSpX9GfQDflMVdyKLCN6pCqmHekVWC5l8 eHp3w5Q3rPBUgY4Sa5ut9Bmt9B6nAiQh5r9VYpv0Hl X-Google-Smtp-Source: AGHT+IEdriDcKM4RN1llZOayHWGsZIX6OrNV5NzV2kfdl2PFxSWnluIcPy9vFpV2AwikpZThgJ+Vvw== X-Received: by 2002:a17:907:72d3:b0:b4f:4940:6a23 with SMTP id a640c23a62f3a-b50aa899e80mr2831672766b.24.1760491385306; Tue, 14 Oct 2025 18:23:05 -0700 (PDT) Received: from inspiron14p-linux.nxsw.local (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b5ccd7b202dsm98348466b.82.2025.10.14.18.23.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Oct 2025 18:23:04 -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 v3 11/39] libcamera: software_isp: Move param select code to Debayer base class Date: Wed, 15 Oct 2025 02:22:23 +0100 Message-ID: <20251015012251.17508-12-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251015012251.17508-1-bryan.odonoghue@linaro.org> References: <20251015012251.17508-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" Move the parameter selection code into the Debayer base class in-order to facilitate reuse of the lookup tables in the eGL shaders. Signed-off-by: Bryan O'Donoghue Reviewed-by: Kieran Bingham Reviewed-by: Milan Zamazal --- src/libcamera/software_isp/debayer.cpp | 27 ++++++++++++++++++++++ src/libcamera/software_isp/debayer.h | 3 +++ src/libcamera/software_isp/debayer_cpu.cpp | 19 +-------------- 3 files changed, 31 insertions(+), 18 deletions(-) diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp index 937d5e2e..cf74b92b 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -187,4 +187,31 @@ Debayer::~Debayer() * \brief Signals when the output buffer is ready */ +/** + * \fn void Debayer::setParams(DebayerParams ¶ms) + * \brief Select the bayer params to use for the next frame debayer + * \param[in] params The parameters to be used in debayering + */ +void Debayer::setParams(DebayerParams ¶ms) +{ + green_ = params.green; + greenCcm_ = params.greenCcm; + if (swapRedBlueGains_) { + red_ = params.blue; + blue_ = params.red; + redCcm_ = params.blueCcm; + blueCcm_ = params.redCcm; + for (unsigned int i = 0; i < 256; i++) { + std::swap(redCcm_[i].r, redCcm_[i].b); + std::swap(blueCcm_[i].r, blueCcm_[i].b); + } + } else { + red_ = params.red; + blue_ = params.blue; + redCcm_ = params.redCcm; + blueCcm_ = params.blueCcm; + } + gammaLut_ = params.gammaLut; +} + } /* namespace libcamera */ diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h index 2cbf0823..c04c289d 100644 --- a/src/libcamera/software_isp/debayer.h +++ b/src/libcamera/software_isp/debayer.h @@ -93,6 +93,9 @@ public: private: virtual Size patternSize(PixelFormat inputFormat) = 0; + +protected: + void setParams(DebayerParams ¶ms); }; } /* namespace libcamera */ diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp index 42a0f374..6be5cdbd 100644 --- a/src/libcamera/software_isp/debayer_cpu.cpp +++ b/src/libcamera/software_isp/debayer_cpu.cpp @@ -758,24 +758,7 @@ void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output for (const FrameBuffer::Plane &plane : output->planes()) dmaSyncers.emplace_back(plane.fd, DmaSyncer::SyncType::Write); - green_ = params.green; - greenCcm_ = params.greenCcm; - if (swapRedBlueGains_) { - red_ = params.blue; - blue_ = params.red; - redCcm_ = params.blueCcm; - blueCcm_ = params.redCcm; - for (unsigned int i = 0; i < 256; i++) { - std::swap(redCcm_[i].r, redCcm_[i].b); - std::swap(blueCcm_[i].r, blueCcm_[i].b); - } - } else { - red_ = params.red; - blue_ = params.blue; - redCcm_ = params.redCcm; - blueCcm_ = params.blueCcm; - } - gammaLut_ = params.gammaLut; + setParams(params); /* Copy metadata from the input buffer */ FrameMetadata &metadata = output->_d()->metadata();