From patchwork Wed Dec 10 00:31:28 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: 25407 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 180ECBD1F1 for ; Wed, 10 Dec 2025 00:32:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CE70461450; Wed, 10 Dec 2025 01:32:28 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="OtZ7+GoK"; dkim-atps=neutral Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id F0D5F61450 for ; Wed, 10 Dec 2025 01:32:26 +0100 (CET) Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-340ba29d518so4100522a91.3 for ; Tue, 09 Dec 2025 16:32:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1765326745; x=1765931545; 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=OtZ7+GoKJJTucO12XIPWPjnOhnwfac8xglOW9lsY7ebj49RvV82+0fLXgDp86R24kx yQKR3r+7pmSNZv9oAuAAFb4s0Ek0kCKIloSV7G63gWME4txgR6Nq5PeiU191yCT4lpsL 9KR2rGjGyqpz9cfdS8xOG4uSDQvkhH1iFMGwYvIKPQY7WQcjtgM91kFZuLAoH9MX1Wdj 2F6konzv1Us80bhIp3pruhUSb5Ai0akWFqaJDXwqqE1yHgyErhwOsV5xVn6G4/FdL5+a NI3B0tgpWqlwYzupNuf4jzMomQXxtPexXIYrTMVjRVQ0mJquIi/OD1J2CD8J3SUJOjU+ aPLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765326745; x=1765931545; 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=pTNozqNvZ5brEbhHg6Ztzwb7Qwi2ulHJtagt6+3OxafYAth03Z+duQT4+sCT7xKb/U 6DIffqsk/vctrWNKcDqMGnZxnC3NTM1p8AsNNBLa5LdS+F537XXLkfm91fTCzK/PZjv6 9bGdt7UXwUeTTrSOG6EYGCgkiMbtavwJpjpuGba8wesHwY4WoFxSId6LQvcJS2cqPWR+ I8+xu0+3re4ILpmwuxObgL+Rc0EMjOIlaDKvGAlxUA7Uuk1YEPYP8LcVGNfHPlEr0n6z RAnIwh0w6GKCHjdIWHBib44bzyr062kjOXLnirKclkMIjrnkmYVvt+/OIFJz33eOvDKN 3zYA== X-Gm-Message-State: AOJu0YyYTsEUHsZI4SQoo1GorJn0vpJVGQA1r/9l91ssPd8FOvTihM1Q D92fpJrVvLLiLHCqzclKypRp9iJQfSJibA4u0nkzoXrxdmg3i5RN1RcPJhi3yEwgWDv9prQw60s wjcPF X-Gm-Gg: AY/fxX7WxELnKLvsyzf/HdaaxkWRMGgjMFSM1/wgZ4RazdXdyPBCurB1ezGpJ/ZPOsN Hhd6boV3SBycQ/2iSI3BpoYOUXS5DPsUnqq/ikhUvXGdvhA+CLxXENE07HwMtIefREEzefdWkmU kgBD/thSkdFqEFxu+ueWRz9oLsQOl+0ETYuAhuTdrT/CWeIkxQ1otnuSx2tbJCi6MtJNOh4S8PP gNA8gGYjVgLQDLCWxNOIq7Ja4uASruj0xl2bZS8GWnkPb7s2DdgzWCuwK9to6eFH1A7vmGsKHky sr0ef4Xf3aVTMj6QUWyt7FocFApocdhE2E0sMbAcje0PrvURvl0ZytsAUuJ+SaLo2yXZDltHFDc RvfO8Tsbrl6mTt5ZaF8MhdFyjEumuKDAFP2bSFVDj9mVcrLzdUUNkKqQ4F1BnVgMw31G7fwdwjx PEuQOeizAPwAJiyJufwMzs5IUfpDtdqsMfx4Q0ii+AeBUt2U9PZJxclztZkYfJ/5vPbVk0MjplE qg= X-Google-Smtp-Source: AGHT+IEcbSoPTewzFYSYS2yxh+MQ7so0+W1Mg/l1AndVOaKsI4MoMrOEIneRPupbHpQ/yd6rub6oxg== X-Received: by 2002:a17:90b:2d4d:b0:349:3fe6:ab8b with SMTP id 98e67ed59e1d1-34a7289e99amr440696a91.36.1765326745140; Tue, 09 Dec 2025 16:32:25 -0800 (PST) Received: from inspiron14p-linux (p96936b06.osaknt01.ap.so-net.ne.jp. [150.147.107.6]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-34a70427ea6sm566580a91.3.2025.12.09.16.32.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Dec 2025 16:32:24 -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 v4 11/20] libcamera: software_isp: Move param select code to Debayer base class Date: Wed, 10 Dec 2025 00:31:28 +0000 Message-ID: <20251210003139.43606-12-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251210003139.43606-1-bryan.odonoghue@linaro.org> References: <20251210003139.43606-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();