From patchwork Thu Nov 20 23:20:11 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: 25115 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 51F77C3333 for ; Thu, 20 Nov 2025 23:20:51 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id F23B960AB3; Fri, 21 Nov 2025 00:20:50 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="AZLIAG+4"; dkim-atps=neutral Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 37DCE60AAF for ; Fri, 21 Nov 2025 00:20:49 +0100 (CET) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-47796a837c7so9424795e9.0 for ; Thu, 20 Nov 2025 15:20:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763680848; x=1764285648; 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=P/vViwioaRQnkwkLzBBnhXzc9u7iK4MAB2njnFCGogQ=; b=AZLIAG+4PyTCzxwOVwgdjIfa9Dla0qseG1ea4nzxs80GNZq15XyngGdl2N8+BsRK42 MXyDfCCpJMwyLPYYx6xr0boQrmV1jlelJrF2yUwgMdt0LD0FxGbrxUgvqtsstHnFQ/Cc 4FH0xygU+CRvvylm2vJ5B93MMKnO7sn0mjMmc7jx4N/dYOlFAyfMLmZST+jPWBhjvvHU AVtUKpVaDIfBXlLbMAxC2ouDIrltzBrEo1uMj2ByaeSGL5p1CFezU6ixapMNR6pJ5buz b88nFsP4JZQvLQDHiAUKb7DifYSARdMYbf4u9WwrCNmWhf6bKmuG3olDa5yvDn3zdndN DXkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763680848; x=1764285648; 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=P/vViwioaRQnkwkLzBBnhXzc9u7iK4MAB2njnFCGogQ=; b=rH0sg21qHy4s396jPfhAL2qY+kmCzWL1/mya4IT2PuUff07DuA0swBaDWq+tACNT9G 4E5C96QyUsZWRvWNjbW93wSQbtuSFer+19IiXONUXHGx/koNfaachVU/iuHoAZrqkT2X n1Od61lSeDdeLdPANLweR+gM1wNK3U6YlIZZuaEEw5nerIrQH4dLOqm9JEodcn/7pozE sU6c7ovA1YWC2kR9VF1ENgyopGWKrMo+nNYVQHiLSAPIK4c6Q0Tsu6XY9OufeT5vvppQ dD0aR2ZUcMrh5Qoi65lvlS1XuFE7YhGwZUH8dSuMhRzMfoxlz/SR8U9MZZGl+70EE8Kb lisA== X-Gm-Message-State: AOJu0YxZTtTA7WPUCMthaYA86KER4Whfh4WOMSzB/fF5mEkzdi/Tj0mL Tk/VE9iSmK5tqucOOyVhWZYSetG5bMko2U1cTnDhDSrhfUXLv7Eju1NDA2TM/oPUHWQIFx2lT6D aWAPss+A= X-Gm-Gg: ASbGncukbDqAWDBG05ruXT+oGGLbRaT3tdzCFFk5j9WH4M2KrOGcvwu+U4tzmR6lhhb +ZvfxvcCZCdgECFZ3HFf8RyThedbaYO64ZHymeSFSZtiOvDv7csy2O46tMygYFsU6DBBVpzSLxc oJQl39T0kJnFbsLaXS+eDCScjOxwqAek21BDnuPQrtgSM03sVVojaiRHq0/KJOskpTylz5q38g2 TGP82/X49PJdPV0K3QnAQ7/z5vYDqPDHbWBIIJRFeqxpFkDECmEiFB0+y5M9hei7HNYVXqUudIW rn19hzxuHNbx990Txvs4h0HlA7B6QgmuPDhCGGywlxsnedUh0KIXWSWaYYfQ9j+HwOoeuVdXIS8 6vFadhx/C8eQmHB+faVymRQkTpojIdFX+DsfuVC4grLx8PZTyE3I34+sA7DjG0T5+FD280nR+zr bPSlVM6sKxOwC9JnYJl8oyoo2SQ5wP3CvlYQuSQoUBiDylTEtAQ6v5yfMG3CBfxPjofZE= X-Google-Smtp-Source: AGHT+IG/UQAVf29+IYijztD5D0i+UYGbaaJ9llpkWn1cv9fnT+huQY3NzXdRXGRBvutSr6hfehWW0A== X-Received: by 2002:a05:600c:468c:b0:477:79f8:daa8 with SMTP id 5b1f17b1804b1-477c01b219amr3584435e9.17.1763680848531; Thu, 20 Nov 2025 15:20:48 -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 5b1f17b1804b1-477bf3af0ecsm11618415e9.9.2025.11.20.15.20.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 15:20:47 -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 14/22] libcamera: software_isp: Move isStandardBayerOrder to base class Date: Thu, 20 Nov 2025 23:20:11 +0000 Message-ID: <20251120232019.3590-15-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251120232019.3590-1-bryan.odonoghue@linaro.org> References: <20251120232019.3590-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" isStandardBayerOrder is useful to both CPU and GPU debayer logic and reusable as-is for both. Move to shared location in base class. Reviewed-by: Kieran Bingham Reviewed-by: Milan Zamazal Signed-off-by: Bryan O'Donoghue --- src/libcamera/software_isp/debayer.cpp | 10 ++++++++++ src/libcamera/software_isp/debayer.h | 2 ++ src/libcamera/software_isp/debayer_cpu.cpp | 6 ------ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp index 8a53437e9..441e49522 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -236,4 +236,14 @@ void Debayer::dmaSyncBegin(std::vector &dmaSyncers, FrameBuffer *inpu } } +/** + * \fn void Debayer::isStandardBayerOrder(BayerFormat::Order order) + * \brief Common method to validate standard 2x2 Bayer pattern of 2 Green, 1 Blue, 1 Red pixels. + */ +bool Debayer::isStandardBayerOrder(BayerFormat::Order order) +{ + return order == BayerFormat::BGGR || order == BayerFormat::GBRG || + order == BayerFormat::GRBG || order == BayerFormat::RGGB; +} + } /* namespace libcamera */ diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h index 334211215..26787a985 100644 --- a/src/libcamera/software_isp/debayer.h +++ b/src/libcamera/software_isp/debayer.h @@ -20,6 +20,7 @@ #include #include +#include "libcamera/internal/bayer_format.h" #include "libcamera/internal/dma_buf_allocator.h" #include "libcamera/internal/global_configuration.h" #include "libcamera/internal/software_isp/benchmark.h" @@ -116,6 +117,7 @@ private: protected: void setParams(DebayerParams ¶ms); void dmaSyncBegin(std::vector &dmaSyncers, FrameBuffer *input, FrameBuffer *output); + bool isStandardBayerOrder(BayerFormat::Order order); }; } /* namespace libcamera */ diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp index 8f1b4e53d..00738c56b 100644 --- a/src/libcamera/software_isp/debayer_cpu.cpp +++ b/src/libcamera/software_isp/debayer_cpu.cpp @@ -288,12 +288,6 @@ void DebayerCpu::debayer10P_RGRG_BGR888(uint8_t *dst, const uint8_t *src[]) } } -static bool isStandardBayerOrder(BayerFormat::Order order) -{ - return order == BayerFormat::BGGR || order == BayerFormat::GBRG || - order == BayerFormat::GRBG || order == BayerFormat::RGGB; -} - /* * Setup the Debayer object according to the passed in parameters. * Return 0 on success, a negative errno value on failure