[{"id":36268,"web_url":"https://patchwork.libcamera.org/comment/36268/","msgid":"<176056663528.162040.12299939865950890786@ping.linuxembedded.co.uk>","date":"2025-10-15T22:17:15","subject":"Re: [PATCH v3 14/39] libcamera: software_isp: Move\n\tisStandardBayerOrder to base class","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Bryan O'Donoghue (2025-10-15 02:22:26)\n> isStandardBayerOrder is useful to both CPU and GPU debayer logic and\n> reusable as-is for both.\n> \n> Move to shared location in base class.\n> \n> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n> ---\n>  src/libcamera/software_isp/debayer.cpp     | 10 ++++++++++\n>  src/libcamera/software_isp/debayer.h       |  2 ++\n>  src/libcamera/software_isp/debayer_cpu.cpp |  6 ------\n>  3 files changed, 12 insertions(+), 6 deletions(-)\n> \n> diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp\n> index 96737c45..db225ed6 100644\n> --- a/src/libcamera/software_isp/debayer.cpp\n> +++ b/src/libcamera/software_isp/debayer.cpp\n> @@ -229,4 +229,14 @@ void Debayer::dmaSyncBegin(std::vector<DmaSyncer> &dmaSyncers, FrameBuffer *inpu\n>         }\n>  }\n>  \n> +/**\n> + * \\fn void Debayer::isStandardBayerOrder(BayerFormat::Order order)\n\nNo need to specify this if it's a /** right before the function as far\nas I recall. Just something that could bitrot otherwise.\n\n> + * \\brief Common method to validate standard 2x2 Bayer pattern of 2 Green, 1 Blue, 1 Red pixels.\n\n * \\param[in] order The BayerFormat to check\n * \\return True if the BayerFormat is standard\n\nTedious - but I think usually required to satiate doxygen.\n\nWith that:\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> + */\n> +bool Debayer::isStandardBayerOrder(BayerFormat::Order order)\n> +{\n> +       return order == BayerFormat::BGGR || order == BayerFormat::GBRG ||\n> +              order == BayerFormat::GRBG || order == BayerFormat::RGGB;\n> +}\n> +\n>  } /* namespace libcamera */\n> diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h\n> index 98d88fb3..c5eb0d38 100644\n> --- a/src/libcamera/software_isp/debayer.h\n> +++ b/src/libcamera/software_isp/debayer.h\n> @@ -20,6 +20,7 @@\n>  #include <libcamera/geometry.h>\n>  #include <libcamera/stream.h>\n>  \n> +#include \"libcamera/internal/bayer_format.h\"\n>  #include \"libcamera/internal/dma_buf_allocator.h\"\n>  #include \"libcamera/internal/global_configuration.h\"\n>  #include \"libcamera/internal/software_isp/benchmark.h\"\n> @@ -98,6 +99,7 @@ private:\n>  protected:\n>         void setParams(DebayerParams &params);\n>         void dmaSyncBegin(std::vector<DmaSyncer> &dmaSyncers, FrameBuffer *input, FrameBuffer *output);\n> +       bool isStandardBayerOrder(BayerFormat::Order order);\n>  };\n>  \n>  } /* namespace libcamera */\n> diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp\n> index 8f1b4e53..00738c56 100644\n> --- a/src/libcamera/software_isp/debayer_cpu.cpp\n> +++ b/src/libcamera/software_isp/debayer_cpu.cpp\n> @@ -288,12 +288,6 @@ void DebayerCpu::debayer10P_RGRG_BGR888(uint8_t *dst, const uint8_t *src[])\n>         }\n>  }\n>  \n> -static bool isStandardBayerOrder(BayerFormat::Order order)\n> -{\n> -       return order == BayerFormat::BGGR || order == BayerFormat::GBRG ||\n> -              order == BayerFormat::GRBG || order == BayerFormat::RGGB;\n> -}\n> -\n>  /*\n>   * Setup the Debayer object according to the passed in parameters.\n>   * Return 0 on success, a negative errno value on failure\n> -- \n> 2.51.0\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 8B24BC3259\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 15 Oct 2025 22:17:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AF5AB60635;\n\tThu, 16 Oct 2025 00:17:19 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BC158605F3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 16 Oct 2025 00:17:17 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 51623558;\n\tThu, 16 Oct 2025 00:15:38 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"C8qDqva8\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1760566538;\n\tbh=le2IIijwlJRAfObx/LCsiWhd8MginQrRL+bFF0jhOyg=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=C8qDqva8Z/U0WAEngHulOeDm7sNWEp84I+YkHtaEk9E/XfuYq4o5cbZELsBIS04Of\n\tBW2FH1SkBTaRTiSQAbBeNgG7evRRwBwvWjaro4AX8PJ30oka4QqlKtJ0Hy/bqJC858\n\tQn897pZ1yucIzQ2n6LCfVIG6C4ktgOffooAoNLQw=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20251015012251.17508-15-bryan.odonoghue@linaro.org>","References":"<20251015012251.17508-1-bryan.odonoghue@linaro.org>\n\t<20251015012251.17508-15-bryan.odonoghue@linaro.org>","Subject":"Re: [PATCH v3 14/39] libcamera: software_isp: Move\n\tisStandardBayerOrder to base class","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"hdegoede@redhat.com, mzamazal@redhat.com, bryan.odonoghue@linaro.org,\n\tbod.linux@nxsw.ie","To":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Wed, 15 Oct 2025 23:17:15 +0100","Message-ID":"<176056663528.162040.12299939865950890786@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":36300,"web_url":"https://patchwork.libcamera.org/comment/36300/","msgid":"<85y0pbfcti.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","date":"2025-10-16T08:52:41","subject":"Re: [PATCH v3 14/39] libcamera: software_isp: Move\n\tisStandardBayerOrder to base class","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes:\n\n> isStandardBayerOrder is useful to both CPU and GPU debayer logic and\n> reusable as-is for both.\n>\n> Move to shared location in base class.\n>\n> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\n\n> ---\n>  src/libcamera/software_isp/debayer.cpp     | 10 ++++++++++\n>  src/libcamera/software_isp/debayer.h       |  2 ++\n>  src/libcamera/software_isp/debayer_cpu.cpp |  6 ------\n>  3 files changed, 12 insertions(+), 6 deletions(-)\n>\n> diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp\n> index 96737c45..db225ed6 100644\n> --- a/src/libcamera/software_isp/debayer.cpp\n> +++ b/src/libcamera/software_isp/debayer.cpp\n> @@ -229,4 +229,14 @@ void Debayer::dmaSyncBegin(std::vector<DmaSyncer> &dmaSyncers, FrameBuffer *inpu\n>  \t}\n>  }\n>  \n> +/**\n> + * \\fn void Debayer::isStandardBayerOrder(BayerFormat::Order order)\n> + * \\brief Common method to validate standard 2x2 Bayer pattern of 2 Green, 1 Blue, 1 Red pixels.\n> + */\n> +bool Debayer::isStandardBayerOrder(BayerFormat::Order order)\n> +{\n> +\treturn order == BayerFormat::BGGR || order == BayerFormat::GBRG ||\n> +\t       order == BayerFormat::GRBG || order == BayerFormat::RGGB;\n> +}\n> +\n>  } /* namespace libcamera */\n> diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h\n> index 98d88fb3..c5eb0d38 100644\n> --- a/src/libcamera/software_isp/debayer.h\n> +++ b/src/libcamera/software_isp/debayer.h\n> @@ -20,6 +20,7 @@\n>  #include <libcamera/geometry.h>\n>  #include <libcamera/stream.h>\n>  \n> +#include \"libcamera/internal/bayer_format.h\"\n>  #include \"libcamera/internal/dma_buf_allocator.h\"\n>  #include \"libcamera/internal/global_configuration.h\"\n>  #include \"libcamera/internal/software_isp/benchmark.h\"\n> @@ -98,6 +99,7 @@ private:\n>  protected:\n>  \tvoid setParams(DebayerParams &params);\n>  \tvoid dmaSyncBegin(std::vector<DmaSyncer> &dmaSyncers, FrameBuffer *input, FrameBuffer *output);\n> +\tbool isStandardBayerOrder(BayerFormat::Order order);\n>  };\n>  \n>  } /* namespace libcamera */\n> diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp\n> index 8f1b4e53..00738c56 100644\n> --- a/src/libcamera/software_isp/debayer_cpu.cpp\n> +++ b/src/libcamera/software_isp/debayer_cpu.cpp\n> @@ -288,12 +288,6 @@ void DebayerCpu::debayer10P_RGRG_BGR888(uint8_t *dst, const uint8_t *src[])\n>  \t}\n>  }\n>  \n> -static bool isStandardBayerOrder(BayerFormat::Order order)\n> -{\n> -\treturn order == BayerFormat::BGGR || order == BayerFormat::GBRG ||\n> -\t       order == BayerFormat::GRBG || order == BayerFormat::RGGB;\n> -}\n> -\n>  /*\n>   * Setup the Debayer object according to the passed in parameters.\n>   * Return 0 on success, a negative errno value on failure","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 8BE89BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 16 Oct 2025 08:52:50 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B294E60664;\n\tThu, 16 Oct 2025 10:52:49 +0200 (CEST)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E9E92600CC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 16 Oct 2025 10:52:47 +0200 (CEST)","from mail-wr1-f71.google.com (mail-wr1-f71.google.com\n\t[209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-596-rJUBll5yM4-cuwXBsQ5MIg-1; Thu, 16 Oct 2025 04:52:44 -0400","by mail-wr1-f71.google.com with SMTP id\n\tffacd0b85a97d-3ef9218daf5so1193976f8f.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 16 Oct 2025 01:52:44 -0700 (PDT)","from mzamazal-thinkpadp1gen7.tpbc.csb\n\t(ip-77-48-47-2.net.vodafone.cz. [77.48.47.2])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-426fb279857sm4605432f8f.20.2025.10.16.01.52.41\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 16 Oct 2025 01:52:42 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"DFsH+upq\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1760604766;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=5/0VXsY+jEfT1CTl9GflbVac6m3nRO5tZDSHrB4IgBM=;\n\tb=DFsH+upqKcBL/bNVX6snB1x01UX5nqn43pplZCjSTTmAluYmIU7vilJOGE0dshRUQl5pUk\n\tJancghuzRgIqvS8DC+yidJC3dGigNOF79LdZBOIkHKa9PBGAT0CLl+BPucDGUa+ZZCghK6\n\tFzlWpr043mV51szpw0jKPSXE+HiW9Uk=","X-MC-Unique":"rJUBll5yM4-cuwXBsQ5MIg-1","X-Mimecast-MFC-AGG-ID":"rJUBll5yM4-cuwXBsQ5MIg_1760604763","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1760604763; x=1761209563;\n\th=mime-version:user-agent:message-id:date:references:in-reply-to\n\t:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date\n\t:message-id:reply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aK+skDMSg/A9qBXz17w1RSO8R1GDy1aTI+tjwifUvcrSKHGpIib","X-Received":["by 2002:a05:600c:1c23:b0:46e:32a5:bd8d with SMTP id\n\t5b1f17b1804b1-46fa9a892d7mr228985495e9.3.1760604763174; \n\tThu, 16 Oct 2025 01:52:43 -0700 (PDT)","by 2002:a05:600c:1c23:b0:46e:32a5:bd8d with SMTP id\n\t5b1f17b1804b1-46fa9a892d7mr228985355e9.3.1760604762786; \n\tThu, 16 Oct 2025 01:52:42 -0700 (PDT)"],"X-Google-Smtp-Source":"AGHT+IHTsANxMGdTY0nN/4Wx+b3mOOuvlQOKawxksd8OKDniby1oUqtQRWouajLC1sxQBu/wG9GzVw==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>","Cc":"libcamera-devel@lists.libcamera.org,  hdegoede@redhat.com,\n\tbod.linux@nxsw.ie","Subject":"Re: [PATCH v3 14/39] libcamera: software_isp: Move\n\tisStandardBayerOrder to base class","In-Reply-To":"<20251015012251.17508-15-bryan.odonoghue@linaro.org> (Bryan\n\tO'Donoghue's message of \"Wed, 15 Oct 2025 02:22:26 +0100\")","References":"<20251015012251.17508-1-bryan.odonoghue@linaro.org>\n\t<20251015012251.17508-15-bryan.odonoghue@linaro.org>","Date":"Thu, 16 Oct 2025 10:52:41 +0200","Message-ID":"<85y0pbfcti.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"1RYUdRGA1CHnlwNtd-UXkHGdBbl6ElTELHL6JPLwt_o_1760604763","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]