From patchwork Tue Dec 2 13:31:42 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: 25297 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 46F76C3257 for ; Tue, 2 Dec 2025 13:32:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A86A560D0B; Tue, 2 Dec 2025 14:32:24 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="nUtHyror"; dkim-atps=neutral Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1D2DB60C8C for ; Tue, 2 Dec 2025 14:32:14 +0100 (CET) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-477bf34f5f5so36196365e9.0 for ; Tue, 02 Dec 2025 05:32:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764682333; x=1765287133; 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=eHob+j+mTcN+DmZI0Jjd1599ddaYfYHVsPKAaDomjAg=; b=nUtHyrorpmd84Q2szErt7OY320nqbZNiBtW/AZde0xsypcQqkraSt9DIlASqkbM/EE 4FqiC5gF834thZ3YzmOxshhDQTtW3v7DuVwwiyOmw/kY6u/dK6G+b7WadEdLjoDAHBjE yjqG+NyRG+BppVqFfmWrXU5Xp8pcBeH8RpEYOiFLmfGlZRKxEu8+iswoLov3+/6TIarJ xXOafuhcZ5jU+q3ol1MzhrIwEO97wIJyI4bJzWLeSmBNBiQq1ErDilX20oMhA9psNtRn KaYmMzd64C/0ytjfN7zOFGMP/RtvNDsn/P3JFTdEpb83QZpkccdHHmSlmlkBdB284sWS 2q9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764682333; x=1765287133; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=eHob+j+mTcN+DmZI0Jjd1599ddaYfYHVsPKAaDomjAg=; b=tRctv+yywdEbqohHFR+Jn2eSYZCwlLvuSqG4AQWMfSv3mJq/xet8UdO2m+iHDxMa3A 4NEv19A6wxSFLSg98sDtIV5QwCqO1Sv3Pc4KcaqNBVjrzpeCJGwvgUII/X4mKoH+7Mgh 7g8Ee25wihCq7jhOQK/nxb/lrCIBSRLl7S5Hw1MErN33AZ1fG8ksH1B3h92tz7JPkDyc qhi5fgMbrYy1f1fFpSnP4wQhP975n+tjhxaLieH8kDMpmnUEFULOIF5yIFtdzTOj5Lsb KfeCeeB4S4QzQl619w1wPg16Xkoa99yBkOxN3Pzwiw63rqukTZQQFDyfbVkLSSr0EjfQ UdAg== X-Gm-Message-State: AOJu0YwYh0toU6OKWMp9deW/Gy6tu8qeSi88O50uoOt8P9cQgxsHO7l3 WNtOAQqRoyqpDeomkv9Qax07y3zrx48faq2X5dlLBM9ZjNsRvUWbPR7NAn3/mtbZ5JyquUCDZMV v9T8l X-Gm-Gg: ASbGncsT93nSgbDtuzgnDWEln9cuKycCWe7etUt5b1Go/sUiKKtt0QWMCHQJxIJ5Xwh vpO8RZhIC9SKorHmrpFPfwd3WueEv3UnFrEyGtqeC5f/0aediCpydlCPbh42k5tmMARlbFlLIDW CRy0dhY+uLgzfaS1lW9b700Ag42jOoKUqDqhKuUnusbOcfuRQVrfmLiSFUy6XVpLZI0XrCNHizr T7q4A0C478IG1JgKMvgpVb/B4HVNQs9N1pnUlLDc8107jjC9+1hFibOPR4wsAGQl3yRz3fh1+Za D0E01zu88/+8EQyh5SvQVGZcCz5td/wRK56Qx2fuPLN145KOnldPnCSFYdyP9DP5zDmxEm3pODz BYoFr2+alt4HVHuD4KcenQLEkW61hpP8n055cK8INpqiyaQavBtpf806lFnx+K6iTuA9Rftb3ap 3PVK2lbaG0MKuegJTsE8lfzS/xhzmlUZ+U6zB2ggV+EIuaDH10baA11pLXBvWhggMcN54= X-Google-Smtp-Source: AGHT+IH45vLV5fKOXC82R9Mr/pZXwM9s5zTKvOwbbSliygXuCVFBXXrJ7ryiNLaUDevshfUuundZYA== X-Received: by 2002:a5d:5d85:0:b0:429:c851:69ab with SMTP id ffacd0b85a97d-42e0f35a730mr31038773f8f.55.1764682333407; Tue, 02 Dec 2025 05:32:13 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42e1c5c30c4sm33363322f8f.9.2025.12.02.05.32.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 05:32:13 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Kieran Bingham , Milan Zamazal Subject: [PATCH v3 11/22] libcamera: software_isp: Move param select code to Debayer base class Date: Tue, 2 Dec 2025 13:31:42 +0000 Message-ID: <20251202133157.661407-12-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251202133157.661407-1-bryan.odonoghue@linaro.org> References: <20251202133157.661407-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. Reviewed-by: Kieran Bingham Reviewed-by: Milan Zamazal Signed-off-by: Bryan O'Donoghue --- src/libcamera/software_isp/debayer.cpp | 28 ++++++++++++++++++++++ src/libcamera/software_isp/debayer.h | 3 +++ src/libcamera/software_isp/debayer_cpu.cpp | 20 +--------------- 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp index 8cadfaadc..cea30af67 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -336,4 +336,32 @@ Debayer::~Debayer() * debayer processing. */ +/** + * \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(greenCcm_[i].r, greenCcm_[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 f4373ddeb..6903caae8 100644 --- a/src/libcamera/software_isp/debayer.h +++ b/src/libcamera/software_isp/debayer.h @@ -83,6 +83,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 8f42d706b..6be5cdbd5 100644 --- a/src/libcamera/software_isp/debayer_cpu.cpp +++ b/src/libcamera/software_isp/debayer_cpu.cpp @@ -758,25 +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(greenCcm_[i].r, greenCcm_[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();