From patchwork Tue Apr 22 21:59:09 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: 23229 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 87DCBC32A2 for ; Tue, 22 Apr 2025 21:59:53 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2F04968B48; Tue, 22 Apr 2025 23:59:53 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="XmfD5RAS"; dkim-atps=neutral Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0EBFE68B28 for ; Tue, 22 Apr 2025 23:59:39 +0200 (CEST) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-43cfba466b2so57634725e9.3 for ; Tue, 22 Apr 2025 14:59:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1745359178; x=1745963978; 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=Id0ekAEOjr9NRA9szz5nSdTr2ruvPZ3UziB6jBOQNuM=; b=XmfD5RAStjG7G89N5LxFlH1nymWi4ulVkAK6q0YAcDDDjrCqQkSOOJ/jeCvBleekPI dc/8zVSHpyKBCKgUANsz0qEWO/cgZZNohMCgbW3mCGG41DoBZf9VSIjDraln01kpuNDq ByVm3fERmz8Z71NUhEgvvviOWCB6DiIIA/Bw5V/Uv6qGC0xrvczRYRkKtebxciTe6gFx KPDdJ2ngVi8LN6KGNpAYGKpV2GNA4zGGDwmE6e5sduyjdDbS7fH4CbewHOZBwWS4pJ7o rfiuu3aCYzIbSS3Me16BfEyDJ3lv4PoV2EWkNmhpDMa2JSs2FHnTvShJ0uDEP4TBBVa9 lHeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745359178; x=1745963978; 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=Id0ekAEOjr9NRA9szz5nSdTr2ruvPZ3UziB6jBOQNuM=; b=qMLCTcy3YNG6YK+Yw3f+NyXUyknI2FxuFIdOZ5WvOG+gL4bDxTNR8E4k0dFpB4lw3I 0I6WQc5kvI+tbgypAYQpMKC4wp1Jz8O3nEdyLhfFeZCdrqVvD320CRUJoUdkmyM+7Hqw BlxWQaDS3Pgzp67ndTjjh+dnerY7M8sz4TZlMgDXGshqV1HFVF8SwsTU/5ZYO+XGrPA5 YK/Jga0p/7hOLWhlaEV7U8zG5aESx3z9rS9aRx1lpzmIiweseUidvTeDgETuniZbDPN8 QLocnSnlBrJy5/6RMU5USYC+1wsGzaeb66gTA+Enl0Y/NGIJbF1HQ++YhbwbXs6FNd4K cavw== X-Gm-Message-State: AOJu0YzUetdXYwoAFxmCiM2d3fs6L9WecX168Gpq8SX6rUCrF980WWhu sxDZSY1b2bqQ9N5yiTy7G5t2/c/rdQnhXNPb+P3hgLRk13kuLL+0c0cgsPX0USLuMrP6h0KMr+B b0gg= X-Gm-Gg: ASbGncsdCSEmC23qPNeIJAOi9NySLXc5suipEPKYuCMtTWqZ6ao75U1wyO8IsxcWW1I dUyTnQtaIBVCCfrxWc1UD/+TUSBs/UYW0Fl1h2/6/oNPg0/NAWdnuqttEyOIC19YG5T91wv5/40 Rl5F7kunJ9IDC9DahaelaTJHlheRcpbXmMTurcsDKunC7MhElQNJ7VxLjAEm0hncCGrL7eherWw niIFoxIkDJmREzGLJZZfqkj0JOF69udqVRUHFbCKbqGJhYe354lNoBvGH0UWIUvK6asDc4SiJeA 8dVNzv9az8MgM6n5+IWZ8D3EPqoRlO/AdBBipb4funyjcXfexN5jpv/1ok1TEWLumUX2kpH0WGB PHg/tW7ExuhYhGVtWL91P X-Google-Smtp-Source: AGHT+IFo70Eh9anSE9Q+86f3h02J5TIcuxAlK2QmEg5VsBRlKoxqrmnY5sB+lQeCOdOuHvz6b0qQdw== X-Received: by 2002:a05:600c:358b:b0:439:9424:1b70 with SMTP id 5b1f17b1804b1-4406ac17329mr168864905e9.30.1745359178430; Tue, 22 Apr 2025 14:59:38 -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.37 (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 16/27] libcamera: software_isp: Move param select code to Debayer base class Date: Tue, 22 Apr 2025 22:59:09 +0100 Message-ID: <20250422215920.4297-17-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" 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 --- src/libcamera/software_isp/debayer.cpp | 27 ++++++++++++++++++++++ src/libcamera/software_isp/debayer.h | 5 ++++ src/libcamera/software_isp/debayer_cpu.cpp | 19 +-------------- 3 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp index e9e18c48..3d883b28 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -176,4 +176,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 dd26b9d8..9cebcbe8 100644 --- a/src/libcamera/software_isp/debayer.h +++ b/src/libcamera/software_isp/debayer.h @@ -82,6 +82,11 @@ 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 8d30bf4a..baec4799 100644 --- a/src/libcamera/software_isp/debayer_cpu.cpp +++ b/src/libcamera/software_isp/debayer_cpu.cpp @@ -754,24 +754,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();