From patchwork Thu Dec 11 23:22:36 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: 25505 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 27765C3257 for ; Thu, 11 Dec 2025 23:23:53 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E01C561657; Fri, 12 Dec 2025 00:23:52 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="WzpWbXaL"; dkim-atps=neutral Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C0A3961643 for ; Fri, 12 Dec 2025 00:23:51 +0100 (CET) Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-7e1651ae0d5so553664b3a.1 for ; Thu, 11 Dec 2025 15:23:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1765495430; x=1766100230; 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=WzpWbXaLQf1wF6iqvUsNWjw+mul9uKuVWPg0+7wpQXIHhLMjjZQxMnBrMoYqKeXOSN JHffpFV9t3LQ5olHzV1A2/hkTSdW/fPCpJ5iAC09HDHJdKGtFqIVxKs2SbG04d8/DjrD ZbFIITGe4vegsl+AkHjTQb2jANLY3JpLlyVAll/zbpheqLDP9mknFncZaBDQ85gAuvYH pUC2vkhvpWPU4/TWOoeDPjmE/vUbRlNRHSzH/rM9crzu7L6Gnb7XGBv51AG8a4znraou Qibixn8ULdxuyEGjqzPksNCF61dL2ZUxmLdo2/91zNgQwRgo6wxwmL8s9TEuz5yLveFK sj+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765495430; x=1766100230; 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=nb+6usxl+/+reAyOMSS5MYMUvTMbHRgJVmbxbExunInd58IbUdKi9813cXq95giiQx tjy78lzWMx0TeWRA9Om+xy5oG4HG3BydnEYD4fpLQoKtI4NFZ7vVAe8MI7KnAzugv3M+ wL+tOZiajMWPdvlUSAXpVETQGZPfFdMAsZ1b0wt6vcUDI1Kivre40z5maGR+f+qDyah6 A8Nde8QZgni8dDdO1FBjuS2btLXZh/Q4jrLIHRfvEd8Wm3c8oO8niyiBj5+51IHj9Jza +NC7V0fzdsFQBKvlbdtam/eOU9/oW7VW6kEfF8272kk1t26TYkcmZ61NO1pINIHb6Yyi v01w== X-Gm-Message-State: AOJu0YxJcPAWooZSb3nMyOwGzBn57iVhpWtApn+ft1Hwj6ui2HOCrioV qI27lpSRNLXbgljw7B2a/rhhyRHcKPYS/MUeECsWemXtn2ixFE3SqC72uUbsmZXabAStiw14prw PKFKm X-Gm-Gg: AY/fxX4iWdwryprNpj/hoOglAJ3zxziueAdYc216JDf69mcXNZHBIIe+C1yRK7Xig7Z XDGpMBp/qfXARD5qLJ/txZEgY/BeUL8h1+/Nspsfva68Dq4K+9rbYELKHB64i1gDLYTCTnSuAAQ S5pwtWEVh47em10O4oDAgHYz/mADrjKSZPPkJfkpj+45kAd3TUD3DWGZ2FP/ZE+Kx6wEOl91QNZ XIT6QgQLqi28QJ63HeBgT295s2c0VfXUNSy2SOaBk+AzXbNPma9pHqKYxpORDryF/LKVTCk7AN6 7JgCSD/uB2KiGAyo/m8VRB/s405sHErUPTxJAuEkY8FPI8a4yo3nXvrfEjFw65ktFM+bvsitPtP aYVHGnJjhX8W1AXaunPgB8HcW7cfM8C6/ZT2hVnUBNCyfKPeG4Tyr9Uj/myDNTj/XMjrr4FopBs h1Kd1NHkAqtnrks/Isp3e2kUGxOvQHtpJYLLUFFW2YuQfpU9O+1arf/1V+cIitsA== X-Google-Smtp-Source: AGHT+IGs4w9m1qhROws1gi5EVLMT+1KVu4HMMa7RPzVhS7CDdJS/owF5sdiwfcR8BZEwbB+W3j5wAg== X-Received: by 2002:a05:6a00:f04:b0:7e8:4587:e8b2 with SMTP id d2e1a72fcca58-7f6693a692emr146536b3a.37.1765495430072; Thu, 11 Dec 2025 15:23:50 -0800 (PST) Received: from inspiron14p-linux (M106185144161.v4.enabler.ne.jp. [106.185.144.161]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7f4c4ab52aasm3399933b3a.38.2025.12.11.15.23.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Dec 2025 15:23:49 -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 v5 11/20] libcamera: software_isp: Move param select code to Debayer base class Date: Thu, 11 Dec 2025 23:22:36 +0000 Message-ID: <20251211232246.31330-12-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251211232246.31330-1-bryan.odonoghue@linaro.org> References: <20251211232246.31330-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();