From patchwork Thu Nov 27 02:22:46 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: 25228 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 7A20DC3260 for ; Thu, 27 Nov 2025 02:23:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1DA6D60AC8; Thu, 27 Nov 2025 03:23:38 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="gNYOAPIF"; dkim-atps=neutral Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 31F4D60AA2 for ; Thu, 27 Nov 2025 03:23:36 +0100 (CET) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-477b1cc8fb4so1602185e9.1 for ; Wed, 26 Nov 2025 18:23:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764210215; x=1764815015; 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=jCaLe3/UWqLlNrzkfiMHL8sWpJisLkNSLQveLCRiGQI=; b=gNYOAPIFIDOiBLVCX6VYAvl+4NU8sXP6sUxsb1oJxn0bhKEk94BcCqioNH4l0aNXYk k/IY0LdMj+L4lf1TqmH9IfHuf6g+Rapw3WTRVDbEzd4VqCDsGqlk7SlgCoWqyuv/Jknz 9bqFfpnPfePZHem89IXiKkXjLb69wzSQqUAdm1X/6+h3F3WpaSl4MicPgJ8rJGJFgcja A7nCwWdKjYZsmC3M1Ovp4kBEyl64F5g+AGaBCMizrDRR2OSjCd9dyRJk8bjRLaJUV/1T b+Sm/k2SvXpqrWfUCLmy5zbUsb7mfm8Ke+zityfZRqOPex54OKp467qhVr14EO/Gs9mf FKzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764210215; x=1764815015; 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=jCaLe3/UWqLlNrzkfiMHL8sWpJisLkNSLQveLCRiGQI=; b=tYgPthMaDcikk4UGICLbp/MR/3FDFfbC23EvZb31aF0dECJ3/amlQEYKPXiiSPZO4n Ype1qN/QfN0sFfov081YRMqjhXOzbH7qFJAfXVZoRjvb9+eUE8J1Yj5z/wTtNjlIWbyC xH7Daswmv1wNMJIaA8KiMvN7q7Dj2IUkR4JuT8gmgiNqp7n8iV9pBYRkEggl8gxReAoh LyHaGMqyGvIkH/rdvWkzrihXzFFzxoDEQnNF42qXL3FpcDFd4NNuiOYmPEmyp+KL3TaJ GfCbAltG4rd0OpdIgUBZaaxc77IqGIPN39dz2gTambz5OEFYXeF2nqCb/5isWYvCKKMS 1MjA== X-Gm-Message-State: AOJu0YywsXmJtr5F61lSHsdOHA8w6ZIOP3OiZF47cTVuyN3zxyjci8w0 TyvUYEASFWAVLbKErOZw9/GToASygNPeliAswiBCyByLyJXRitbQIlPrUtDnXov1/BD5zA/pxcQ vOALmnmM= X-Gm-Gg: ASbGnctYbV0lrjZt92O0+G2YjxOLMpV8/R07GZQiKRTH88lvLTthWnAWgxemjk/NmdR mZXeinJQXBuQ1U0lOIGgitHolvr/rAkzTBWqK7N2JmbKiC9Hjijs+C6/ez6ZvyxeM8h1777Indg nBLY0N42RZWK0P0059Wi91bLBPeFyrsHbopYjocAEz0GJmbohU4X/QjYeJTcYGYksPTDpyc0r/p stN7/LYkc3ZpLdnXz0sa//WM7qzsGK8v0isYn/SP29zp/ec8yYiuI0tvALqzlUNfJBz6wQlmbIR yeGMaeLS3ht9pYxxNkzPFUTvJE14KwNABZgkcrFpdf3qXdsNAk40Lgrh8h5KVUCq5CiJufBLrAu U6Dro4yjhqyPBKts9FQ7GsaAk/qN/41T8RpmmH6neOJOUOCO/zQjT+nukOqpVmMHfzOBCpvnhdv UKo59MV0n63r+pZL5YE5ZS6eGDrsY9XvzWfciz0S7ZsVfZKsPT1nNzU65e+6cV6TCIp4mSQ6yx/ mIT4w== X-Google-Smtp-Source: AGHT+IGY9uxppccb10Nkpqyh5YN5+IsTQsreC8A5gA9I6JHljIx5+3CPzOfT78PgPrpCfCkDW+Ke8g== X-Received: by 2002:a05:600c:4443:b0:46e:53cb:9e7f with SMTP id 5b1f17b1804b1-47904b103e2mr90365565e9.18.1764210215495; Wed, 26 Nov 2025 18:23:35 -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-4790b0e21e8sm71549495e9.15.2025.11.26.18.23.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Nov 2025 18:23:34 -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 v2 14/22] libcamera: software_isp: Move isStandardBayerOrder to base class Date: Thu, 27 Nov 2025 02:22:46 +0000 Message-ID: <20251127022256.178929-15-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251127022256.178929-1-bryan.odonoghue@linaro.org> References: <20251127022256.178929-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..451c1c9ac 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); + 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