From patchwork Wed Oct 15 01:22:26 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: 24659 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 8BBD9C3264 for ; Wed, 15 Oct 2025 01:23:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 348D56063A; Wed, 15 Oct 2025 03:23:19 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="t6g+Z1Mw"; dkim-atps=neutral Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 25422605FF for ; Wed, 15 Oct 2025 03:23:10 +0200 (CEST) Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-b3d5088259eso883467566b.1 for ; Tue, 14 Oct 2025 18:23:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1760491389; x=1761096189; 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=v0b7JxJB6O3gPrxcbAeOh02oDu6uU929TeOiKkmwuWo=; b=t6g+Z1MwISnFX/SwiWOghL2LkVpu7B5WHwQoF63rzRngSOT88fgZazSwMexoX8Xe6s l/dMFy8nRCAubSl5i3nGpycVgPi/T+Mn89ZQZ6Y1ePYr7XRQE2Ltr+Gz+xqoLyI5uq3K NcYOxIEJfZKd+yPxNay7r4T0HkEFy1sTe/Y4+ocvFKPvMi91M1JQbKD4s5ibsEgD8b7/ Fe6/MM/TdqJUFFe172bM2LsTmXcXNYIeLfj8x9obNv1SGX6wwz77VkwzkKK2Yzm1a/an hYhGh/RrfI8QBFS2CrGeWqiFRW5fZN1xyLiWD5mkIlz4QnC+aBbVmIbgzjXwFMTMu3bP YPig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760491389; x=1761096189; 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=v0b7JxJB6O3gPrxcbAeOh02oDu6uU929TeOiKkmwuWo=; b=C6H72zwultTv0Hazps6OwOBcrdwmEjRUfU4k0GAx/p5kr/IkHJFPiEnEKGNAa3+YxR I4uwQ743ZQ5xMaRRzAdNs6dstKwNTIfxzXwCpN+cosMh5Xyo+UAOQHTl46txtHC4ttm1 uuV7VRaQ6y/ns4EecBFHOV4rXCSGtldMJreMEoLj5Jrzuq3kfoh3I3V3FSLBYRkBteZT 7Dke2E0mV7J0buYOFznAfDLNOYj9u84FFUov+BRWjxmy0RfJUqmgXMyGrGRLD6Xlh2uR 1aON8Mql0VTv0QfyCQWF9vk+Kn8jsOZoiB+zSjfxzloAYJKByKpO7SpHWHrmwDZoQBDc 7mjA== X-Gm-Message-State: AOJu0YwksJn7NC7Fh0Py6ikN9xWtmyWZdL5wX0JfSKADzlwQh94Q3ZIq AcRsC92xh8p/JUUAAIiqIMMdyyWAKlqfj/IQgU1m0YivGHdj+qir6L0b2zZ9vgEfj5PKyO1bs4w 1/YI5 X-Gm-Gg: ASbGncuf2i/8jQAgrMTBFZHzs8SwsBrS8vg8L+PPfTZPcr+nsAiFvOfztowpn7+UhqJ Gz+Jy7qtyI1NI0UUKE7NQ2TDFSW0Zq9wgGRKeFCf8qNG1JvO7KWENMHY3ROZ7mbWcJPFZL1OiPv 2Iele5f18lCHL6FLg5tXabyd9YDktEjMpQwZcR+BgfHTt68JKAhXvbiFwiC6YkqsL+1sStwDjFd Y5WA4jrPKIWt259VEWOKsPznZtgQHAO8kOrhkprPcsgabdqEb/7CZ5O5muoZu3/1kSmQtAKh6fP 808B3pcxICrb4Tg/FhZJYcmHk8MpDyr8Uxk+k5vsiyH4qGzGQJ6YwozrjQ2K6k2OUjg9yIh23zi JbuO+6dDCxScABK3GI0HbA2aqVWluLcxCeOnLiJ+5fuSlZ4JIVkZO7MXOenyFMSDCG9APkPsVXD LCsfqg9j38tdxLsc5ve/BHwxwgbkp8FOV/iq302/yK X-Google-Smtp-Source: AGHT+IEtRU/iWYLtTdyCFbjTNZ0VDQupR+yAGpOi3k5WUtUlqiabZz6RBSIXnJ5KZdMnPFRLT1bf3w== X-Received: by 2002:a17:907:3d89:b0:b3e:f89e:9840 with SMTP id a640c23a62f3a-b50aa9a1e57mr2836400366b.20.1760491388895; Tue, 14 Oct 2025 18:23:08 -0700 (PDT) Received: from inspiron14p-linux.nxsw.local (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b5ccd7b202dsm98348466b.82.2025.10.14.18.23.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Oct 2025 18:23:08 -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 v3 14/39] libcamera: software_isp: Move isStandardBayerOrder to base class Date: Wed, 15 Oct 2025 02:22:26 +0100 Message-ID: <20251015012251.17508-15-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251015012251.17508-1-bryan.odonoghue@linaro.org> References: <20251015012251.17508-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. Signed-off-by: Bryan O'Donoghue Reviewed-by: Kieran Bingham Reviewed-by: Milan Zamazal --- 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 96737c45..db225ed6 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -229,4 +229,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 98d88fb3..c5eb0d38 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" @@ -98,6 +99,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 8f1b4e53..00738c56 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