From patchwork Thu Dec 11 23:22:39 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: 25508 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 EF009C3257 for ; Thu, 11 Dec 2025 23:24:01 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A641661657; Fri, 12 Dec 2025 00:24:01 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="jlNbcsFC"; dkim-atps=neutral Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E31BE61657 for ; Fri, 12 Dec 2025 00:23:59 +0100 (CET) Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-7bc248dc16aso566414b3a.0 for ; Thu, 11 Dec 2025 15:23:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1765495438; x=1766100238; 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=jlNbcsFCDaUxN3a/LhFrFPrbVCE3hRmDXeORWhSNBX4oUOUL27Xp+cHcnRBZ28nMN/ c61pTBLNJxY+EpjyLLVWQ4ZdA+jH9JBMfDJ8BfkgCT04zfEcqCt5JtkPm5dK2UPUrFof uYWyy7dZP4dZZKdtg2G8UcXFnLrbexh/Pg3zGv/CxU07NcTLNfChdqnLmipX9359vrAQ 1yi8NeBO09GXVSspaWl/DR+coiHIfA9nPQnujeo0RdFKqmWRFiHh2pBmUtEU9lgatB5r HnglrIAlKcuF456A2szpWKHhx4008s05mFZfX2vQNt4vaa/i5nlgqwqINOX59AkPBx/U /RVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765495438; x=1766100238; 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=NiVOflKxS6L2qlUWle0yQoaODfemQ4jNXmQgRHiU6IYnw6Fa1glzOEAYf9zZL4gcke kWFyddKvFPpjSbDXpTtEuuMYxD/XsVd3RoF6y2M+UNfs3eKtai1rsyY+InNYkNSJG+Ue TEMRh3rbYDAc7uxmlmvlUb/q675026vMfqOW6Bca8+grX1vDKCYmQwF+m8u5zOpZx0/D 5oF6jy2kFzxcOhSlKEj7xBoMenaKyH3sFjXR9Qk02rie3eJnxACakO2kshX7TLly7rvM aOSXkwNgp3z1Qt5/IZlunwgXhb0MBRlO5UgNzgeUNqYr5ZKIUCHC9OpYBUbxgSNk7Tat 7fJw== X-Gm-Message-State: AOJu0Yy5VRHFXkiwwdL2Z/fkjtcr6CCVVmFSvveaeFN/KxCgkdsGVI35 pWIQUtR+I6YoHiPa461aJDj8zA7preNDfBOMyb4xAaV9aHSDCxO5ZOtar8g/za7CX8bUIlwJ9tv 0WaNd X-Gm-Gg: AY/fxX6kvHjvIocnfpJg2Mm8KtmtRVVTDxBlTu9cN9Zi2w+DXyBp3ba7jJ5sbQDaNa+ aqGZMNxbVYLeTQHWmCi9EAXy7m+05/E6FEMYsGh/52OuYpOp2RiFjAenXbxrxsaeJGk9wc817vi OL8z0YZ659+VREhdEAPCAhCa7tI8DOKXWi8bzk6EUXdwkXaWBPrEfCX2Zqf8UJRxkoHI0RCcSLZ DRBic3vbbNKAth1UCnImPJd2WbKn1Ly0Z4JC9MxaUToOp5u7H+Qm8bnG7PvpOqE4Fawl6xfRYTk wI6kLLzl6zg3rW/vH62gvoN8HHLkWe3LAGJJBk3XCCc/O5UbF6lSqjfP9qlaCJHq/fhy2AyHq52 LZhNWj+sWLLdYbNGeL9ZHDp0ylOZ944+GdBzLOaLtmxZ2qkdgyJJ9cM6nxHl9YxjbtLvsKkphbd ONEhSiLJfwbxE/MfAylGNPK4DI6wxsLLZX8YY779rDy2ig+R5oZofK3Cu7Tb8eyg== X-Google-Smtp-Source: AGHT+IHHsg32XA/0J0TloJh3W9EZdtYKmawcrzFppeNyaiJ+XomULhKAyAecM5PHRPsiwBgR5uhwsA== X-Received: by 2002:a05:6a00:1d9e:b0:7ba:153f:5a40 with SMTP id d2e1a72fcca58-7f667546c25mr174953b3a.9.1765495438287; Thu, 11 Dec 2025 15:23:58 -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.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Dec 2025 15:23:57 -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 14/20] libcamera: software_isp: Move isStandardBayerOrder to base class Date: Thu, 11 Dec 2025 23:22:39 +0000 Message-ID: <20251211232246.31330-15-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" 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