From patchwork Wed Dec 10 00:31:31 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: 25410 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 311FBBD1F1 for ; Wed, 10 Dec 2025 00:32:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D7A3D61461; Wed, 10 Dec 2025 01:32:35 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="A1zVkhnm"; dkim-atps=neutral Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7597961450 for ; Wed, 10 Dec 2025 01:32:34 +0100 (CET) Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-34381ec9197so5394920a91.1 for ; Tue, 09 Dec 2025 16:32:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1765326753; x=1765931553; 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=PYxXfqRVTKkcbydoq54khVfP7mMuF5TcbppUiqX56+k=; b=A1zVkhnmQ2Gr4sOBJPvWyhwR+HwP48pCrocImppfIHqbKWwilXdbtW4cVc7mqOua8R cQw7toevKdyBQisZsrGX2zXevMZJQT9xdC+0Y/wxu3Eh5lYFm6yF4Z2UgyfdNiwhVXgT KEd+ZNQq3OcWdBEItqpY/HlYZzvVbEB+lZfx6hVaGuSVRwnEjVbKwcecZnNcvgKbxWEl NcN4M2wmZhiFVtSNOsBjoKAuKLAvq8PycLflrZF0keNvLXqZ1yPcoRG8JfZlJB02KuI5 WXiAL7RBQYZzaMbHIVhfPJK/9QB/kWhhmN10V0fNfStBS15omRUI4CDQNHKsGY6kIunI 1ozg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765326753; x=1765931553; 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=PYxXfqRVTKkcbydoq54khVfP7mMuF5TcbppUiqX56+k=; b=wRFNllz6Aue0uPcTTo69G57nS6SYDd4M5ayv6/6OfGEyylrIbEWJHEWkXSt/vOyYg+ lJHjzaocpTnuVQ+EUJdTKTB7303Nvw3l1VuF85HTClXPANvhsx3XTU2zBTQN0uYLwF6q 2Xt1tMAGzm30YEG2f4TOcS9Rc111IorVZ5MxnWXBK5rSQ5ZQxStxm65iK96aNX/Kv50U UPOeUzfhINsnudR9/MAcEEZFE6gUca0v1ufrhgOtJuu3vPPuZ6In8ZliAUirFONL/dQy LZCs+PYfTEFXsu+4ZMims5eWP0uFE7qQ9mVzmcJ5+ZFIZSk/B7ScNfab4FQsGzgxgsoq ichA== X-Gm-Message-State: AOJu0YxVPRfc44/aZB7Sh3wjE/drcP4kH2zK7Qr8frH3RaPrjMGAmlEN NaxGYqy8BXnejuuzpSNpoxMSW2Z1iZ7VOnGu45CdOtkKXk7zG/6LJ1ax4fiUam9ihAwf0GM3l7S +3bxP X-Gm-Gg: AY/fxX7W8PfdO8ZGZ8cVbePt/YvWxJfeVjXMrQh/F48lMuQazpxOINxB3j/zaS26v8m YerTXWWopj36gA/nBRZwyyPf3pK9OGeDzsMzAkkZORnl+Qze/QibAlxwTYIi/r34Avm4vIdjVMW wQIbrWZlhKR0vtS8hC7hB3mJy7h9n6kmMgAszlD91GHzujaIJOuF7yofEe7PNiFttJJpEpa6nXP tSIVFd+GWqMeWVFGSxiOCoUPbO6XX2zzAnGlJxWEPdGAfl2cbdg/FAfys0UyW/L/+i/J1DM3WBE 7VqeOMNbj79zqNzmHrMj7kgxACjsRKyFNqkouNL/lAVx9JTuhl+CPlG2+T7UaqeQZ9zZSsnYxVi z/bdPvpL5s9NrcoxfkOh4muluT0inaVdsC7uGuy0vL1dpz64WdNSdTLJW9n3YMvO92FufMYAIBT GdAiGzQw/mGXB2aVZr0PQHgIErIKuJ5Z5d0EvrrgC1+mI4tpbtq9T8NCJSmuhZh16NFh5PNCfZ8 2Q= X-Google-Smtp-Source: AGHT+IF1tFzK5Os+YFOI7Vcab+ZiSBCt58wtaoBjC9UBqh4MX63VyBGBudb9ZEOTtORZwRYELj2rjw== X-Received: by 2002:a17:90b:5823:b0:33f:ebc2:643 with SMTP id 98e67ed59e1d1-34a728a7f64mr514786a91.23.1765326752770; Tue, 09 Dec 2025 16:32:32 -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.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Dec 2025 16:32:32 -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 14/20] libcamera: software_isp: Move isStandardBayerOrder to base class Date: Wed, 10 Dec 2025 00:31:31 +0000 Message-ID: <20251210003139.43606-15-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" 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 158128f30..1d135b278 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -379,4 +379,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 d2893d81b..ff4a92c15 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" @@ -88,6 +89,7 @@ private: protected: void setParams(DebayerParams ¶ms); void dmaSyncBegin(std::vector &dmaSyncers, FrameBuffer *input, FrameBuffer *output); + static 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