[{"id":28613,"web_url":"https://patchwork.libcamera.org/comment/28613/","msgid":"<20240123171709.GD14927@pendragon.ideasonboard.com>","date":"2024-01-23T17:17:09","subject":"Re: [libcamera-devel] [PATCH v2 09/18] libcamera: software_isp: Add\n\tDebayer base class","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Sat, Jan 13, 2024 at 03:22:09PM +0100, 📷-dev wrote:\n> Add a base class for debayer implementations. This is intended to be\n> suitable for both GPU (or otherwise) accelerated debayer implementations\n> as well as CPU based debayering.\n\nSame comment as for the stats, let's keep it simple, we have a single\nimplementation, we'll make code modular later when/if we can.\n\n> Doxygen documentation by Dennis Bonke.\n> \n> Co-authored-by: Dennis Bonke <admin@dennisbonke.com>\n> Signed-off-by: Dennis Bonke <admin@dennisbonke.com>\n> Co-authored-by: Andrey Konovalov <andrey.konovalov@linaro.org>\n> Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>\n> Signed-off-by: Hans de Goede <hdegoede@redhat.com>\n> Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> # sc8280xp Lenovo x13s\n> Tested-by: Pavel Machek <pavel@ucw.cz>\n> ---\n>  .../libcamera/internal/software_isp/debayer.h | 132 ++++++++++++++++++\n>  .../internal/software_isp/debayer_params.h    |  43 ++++++\n>  .../internal/software_isp/meson.build         |   2 +\n>  src/libcamera/software_isp/debayer.cpp        |  22 +++\n>  src/libcamera/software_isp/meson.build        |   1 +\n>  5 files changed, 200 insertions(+)\n>  create mode 100644 include/libcamera/internal/software_isp/debayer.h\n>  create mode 100644 include/libcamera/internal/software_isp/debayer_params.h\n>  create mode 100644 src/libcamera/software_isp/debayer.cpp\n> \n> diff --git a/include/libcamera/internal/software_isp/debayer.h b/include/libcamera/internal/software_isp/debayer.h\n> new file mode 100644\n> index 00000000..39e6f393\n> --- /dev/null\n> +++ b/include/libcamera/internal/software_isp/debayer.h\n> @@ -0,0 +1,132 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +/*\n> + * Copyright (C) 2023, Linaro Ltd\n> + * Copyright (C) 2023, Red Hat Inc.\n> + *\n> + * Authors:\n> + * Hans de Goede <hdegoede@redhat.com> \n> + *\n> + * debayer.h - debayering base class\n> + */\n> +\n> +#pragma once\n> +\n> +#include <stdint.h>\n> +\n> +#include <libcamera/base/log.h>\n> +#include <libcamera/base/signal.h>\n> +\n> +#include <libcamera/geometry.h>\n> +#include <libcamera/stream.h>\n> +\n> +#include \"libcamera/internal/software_isp/debayer_params.h\"\n> +\n> +namespace libcamera {\n> +\n> +class FrameBuffer;\n> +\n> +LOG_DECLARE_CATEGORY(Debayer)\n> +\n> +/**\n> + * \\class Debayer\n> + * \\brief Base debayering class\n> + *\n> + * Base class that provides functions for setting up the debayering process.\n> + */\n> +class Debayer\n> +{\n> +public:\n> +\tvirtual ~Debayer() = 0;\n> +\n> +\t/**\n> +\t * \\brief Configure the debayer object according to the passed in parameters.\n> +\t * \\param[in] inputCfg The input configuration.\n> +\t * \\param[in] outputCfgs The output configurations.\n> +\t *\n> +\t * \\return 0 on success, a negative errno on failure.\n> +\t */\n> +\tvirtual int configure(const StreamConfiguration &inputCfg,\n> +\t\t\t      const std::vector<std::reference_wrapper<StreamConfiguration>> &outputCfgs) = 0;\n> +\n> +\t/**\n> +\t * \\brief Get the width and height at which the bayer pattern repeats.\n> +\t * \\param[in] inputFormat The input format.\n> +\t *\n> +\t * \\return pattern size or an empty size for unsupported inputFormats.\n> +\t */\n> +\tvirtual Size patternSize(PixelFormat inputFormat) = 0;\n> +\n> +\t/**\n> +\t * \\brief Get the supported output formats.\n> +\t * \\param[in] inputFormat The input format.\n> +\t *\n> +\t * \\return all supported output formats or an empty vector if there are none.\n> +\t */\n> +\tvirtual std::vector<PixelFormat> formats(PixelFormat inputFormat) = 0;\n> +\n> +\t/**\n> +\t * \\brief Get the stride and the frame size.\n> +\t * \\param[in] outputFormat The output format.\n> +\t * \\param[in] size The output size.\n> +\t *\n> +\t * \\return a tuple of the stride and the frame size, or a tuple with 0,0 if there is no valid output config.\n> +\t */\n> +\tvirtual std::tuple<unsigned int, unsigned int>\n> +\t\tstrideAndFrameSize(const PixelFormat &outputFormat, const Size &size) = 0;\n> +\n> +\t/**\n> +\t * \\brief Process the bayer data into the requested format.\n> +\t * \\param[in] input The input buffer.\n> +\t * \\param[in] output The output buffer.\n> +\t * \\param[in] params The parameters to be used in debayering.\n> +\t *\n> +\t * \\note DebayerParams is passed by value deliberately so that a copy is passed\n> +\t * when this is run in another thread by invokeMethod().\n> +\t */\n> +\tvirtual void process(FrameBuffer *input, FrameBuffer *output, DebayerParams params) = 0;\n> +\n> +\t/**\n> +\t * \\brief Get the supported output sizes for the given input format and size.\n> +\t * \\param[in] inputFormat The input format.\n> +\t * \\param[in] inputSize The input size.\n> +\t *\n> +\t * \\return The valid size ranges or an empty range if there are none.\n> +\t */\n> +\tSizeRange sizes(PixelFormat inputFormat, const Size &inputSize)\n> +\t{\n> +\t\tSize pattern_size = patternSize(inputFormat);\n> +\n> +\t\tif (pattern_size.isNull())\n> +\t\t\treturn {};\n> +\n> +\t\t/*\n> +\t\t * For debayer interpolation a border of pattern-height x pattern-width\n> +\t\t * is kept around the entire image. Combined with a minimum-size of\n> +\t\t * pattern-height x pattern-width this means the input-size needs to be\n> +\t\t * at least (3 * pattern-height) x (3 * pattern-width).\n> +\t\t */\n> +\t\tif (inputSize.width < (3 * pattern_size.width) ||\n> +\t\t    inputSize.height < (3 * pattern_size.height)) {\n> +\t\t\tLOG(Debayer, Warning)\n> +\t\t\t\t<< \"Input format size too small: \" << inputSize.toString();\n> +\t\t\treturn {};\n> +\t\t}\n> +\n> +\t\treturn SizeRange(Size(pattern_size.width, pattern_size.height),\n> +\t\t\t\t Size((inputSize.width - 2 * pattern_size.width) & ~(pattern_size.width - 1),\n> +\t\t\t\t      (inputSize.height - 2 * pattern_size.height) & ~(pattern_size.height - 1)),\n> +\t\t\t\t pattern_size.width, pattern_size.height);\n> +\t}\n> +\n> +\t/**\n> +\t * \\brief Signals when the input buffer is ready.\n> +\t */\n> +\tSignal<FrameBuffer *> inputBufferReady;\n> +\n> +\t/**\n> +\t * \\brief Signals when the output buffer is ready.\n> +\t */\n> +\tSignal<FrameBuffer *> outputBufferReady;\n> +};\n> +\n> +} /* namespace libcamera */\n> diff --git a/include/libcamera/internal/software_isp/debayer_params.h b/include/libcamera/internal/software_isp/debayer_params.h\n> new file mode 100644\n> index 00000000..8f515304\n> --- /dev/null\n> +++ b/include/libcamera/internal/software_isp/debayer_params.h\n> @@ -0,0 +1,43 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +/*\n> + * Copyright (C) 2023, Red Hat Inc.\n> + *\n> + * Authors:\n> + * Hans de Goede <hdegoede@redhat.com> \n> + *\n> + * swstats.h - software statistics base class\n> + */\n> +\n> +#pragma once\n> +\n> +namespace libcamera {\n> +\n> +/**\n> + * \\brief Struct to hold the debayer parameters.\n> + */\n> +struct DebayerParams {\n> +\t/**\n> +\t * \\brief Red Gain.\n> +\t *\n> +\t * 128 = 0.5, 256 = 1.0, 512 = 2.0, etc.\n> +\t */\n> +\tunsigned int gainR;\n> +\t/**\n> +\t * \\brief Green Gain.\n> +\t *\n> +\t * 128 = 0.5, 256 = 1.0, 512 = 2.0, etc.\n> +\t */\n> +\tunsigned int gainG;\n> +\t/**\n> +\t * \\brief Blue Gain.\n> +\t *\n> +\t * 128 = 0.5, 256 = 1.0, 512 = 2.0, etc.\n> +\t */\n> +\tunsigned int gainB;\n> +\t/**\n> +\t * \\brief Gamma correction, 1.0 is no correction.\n> +\t */\n> +\tfloat gamma;\n> +};\n> +\n> +} /* namespace libcamera */\n> diff --git a/include/libcamera/internal/software_isp/meson.build b/include/libcamera/internal/software_isp/meson.build\n> index 1d9e4018..7e40925e 100644\n> --- a/include/libcamera/internal/software_isp/meson.build\n> +++ b/include/libcamera/internal/software_isp/meson.build\n> @@ -1,6 +1,8 @@\n>  # SPDX-License-Identifier: CC0-1.0\n>  \n>  libcamera_internal_headers += files([\n> +    'debayer.h',\n> +    'debayer_params.h',\n>      'swisp_stats.h',\n>      'swstats.h',\n>      'swstats_cpu.h',\n> diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp\n> new file mode 100644\n> index 00000000..442da1ac\n> --- /dev/null\n> +++ b/src/libcamera/software_isp/debayer.cpp\n> @@ -0,0 +1,22 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +/*\n> + * Copyright (C) 2023, Linaro Ltd\n> + * Copyright (C) 2023, Red Hat Inc.\n> + *\n> + * Authors:\n> + * Hans de Goede <hdegoede@redhat.com> \n> + *\n> + * debayer.cpp - debayer base class\n> + */\n> +\n> +#include \"libcamera/internal/software_isp/debayer.h\"\n> +\n> +namespace libcamera {\n> +\n> +LOG_DEFINE_CATEGORY(Debayer)\n> +\n> +Debayer::~Debayer()\n> +{\n> +}\n> +\n> +} /* namespace libcamera */\n> diff --git a/src/libcamera/software_isp/meson.build b/src/libcamera/software_isp/meson.build\n> index d31c6217..d4ae5ac7 100644\n> --- a/src/libcamera/software_isp/meson.build\n> +++ b/src/libcamera/software_isp/meson.build\n> @@ -1,6 +1,7 @@\n>  # SPDX-License-Identifier: CC0-1.0\n>  \n>  libcamera_sources += files([\n> +\t'debayer.cpp',\n>  \t'swstats.cpp',\n>  \t'swstats_cpu.cpp',\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 1FD77BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 23 Jan 2024 17:17:14 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C678E62944;\n\tTue, 23 Jan 2024 18:17:13 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3ACE0628E9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Jan 2024 18:17:12 +0100 (CET)","from pendragon.ideasonboard.com (89-27-53-110.bb.dnainternet.fi\n\t[89.27.53.110])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 68CC21B9A;\n\tTue, 23 Jan 2024 18:15:58 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"tEsj0/gF\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1706030158;\n\tbh=yBaz4ezKfbvhfgHQqdc2BC0ShHRDoWOFWdhZ5EOxuf0=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=tEsj0/gFbCnabjfWNg44uEsMrcpf2Eo4+/QLzGR/Nh4ogasUjL1UKV+ZH0B20nyUL\n\tJQRjYjA530PhpOPWn043wXp4UmMDnO5IjWJlxPNMcG6kLiV9HJwXufhZXpSZUkXW05\n\tF39F6+zqDUevwDNkVfL9RwxVzYeinhethbz4nWlI=","Date":"Tue, 23 Jan 2024 19:17:09 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Hans de Goede <hdegoede@redhat.com>","Subject":"Re: [libcamera-devel] [PATCH v2 09/18] libcamera: software_isp: Add\n\tDebayer base class","Message-ID":"<20240123171709.GD14927@pendragon.ideasonboard.com>","References":"<20240113142218.28063-1-hdegoede@redhat.com>\n\t<20240113142218.28063-10-hdegoede@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20240113142218.28063-10-hdegoede@redhat.com>","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>","Cc":"Maxime Ripard <mripard@redhat.com>, g.martti@gmail.com,\n\tt.langendam@gmail.com, libcamera-devel@lists.libcamera.org,\n\tsrinivas.kandagatla@linaro.org, Pavel Machek <pavel@ucw.cz>,\n\tBryan O'Donoghue <bryan.odonoghue@linaro.org>, admin@dennisbonke.com","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":28646,"web_url":"https://patchwork.libcamera.org/comment/28646/","msgid":"<e26000eb-3218-40ea-b8df-63d2ba3db575@redhat.com>","date":"2024-02-12T15:53:50","subject":"Re: [libcamera-devel] [PATCH v2 09/18] libcamera: software_isp: Add\n\tDebayer base class","submitter":{"id":102,"url":"https://patchwork.libcamera.org/api/people/102/","name":"Hans de Goede","email":"hdegoede@redhat.com"},"content":"Hi Laurent,\n\nOn 1/23/24 18:17, Laurent Pinchart wrote:\n> On Sat, Jan 13, 2024 at 03:22:09PM +0100, 📷-dev wrote:\n>> Add a base class for debayer implementations. This is intended to be\n>> suitable for both GPU (or otherwise) accelerated debayer implementations\n>> as well as CPU based debayering.\n> \n> Same comment as for the stats, let's keep it simple, we have a single\n> implementation, we'll make code modular later when/if we can.\n\nRight, so with the SwStats class I ended up actually dropping\nthe base class and doing everything in SwStatsCpu since that is\nfine for Bryan's GLES work.\n\nWhere as my remark made about the swstats base class dropping:\n\nI'm fine with dropping the base class. But Bryan mentioned that\nhe actually plans to move some more common code there for the GLES\nwork he is doing.\n\nSo for posting v3 of this upstream I'm going to keep the base-class\naround. We can always drop it later.\n\nActually does apply here, so I plan to keep the Debayer base-class\naround for now until we can evaluate how this all interacts\nwith Bryan's GLES work.\n\nRegards,\n\nHans\n\n\n\n> \n>> Doxygen documentation by Dennis Bonke.\n>>\n>> Co-authored-by: Dennis Bonke <admin@dennisbonke.com>\n>> Signed-off-by: Dennis Bonke <admin@dennisbonke.com>\n>> Co-authored-by: Andrey Konovalov <andrey.konovalov@linaro.org>\n>> Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>\n>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>\n>> Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> # sc8280xp Lenovo x13s\n>> Tested-by: Pavel Machek <pavel@ucw.cz>\n>> ---\n>>  .../libcamera/internal/software_isp/debayer.h | 132 ++++++++++++++++++\n>>  .../internal/software_isp/debayer_params.h    |  43 ++++++\n>>  .../internal/software_isp/meson.build         |   2 +\n>>  src/libcamera/software_isp/debayer.cpp        |  22 +++\n>>  src/libcamera/software_isp/meson.build        |   1 +\n>>  5 files changed, 200 insertions(+)\n>>  create mode 100644 include/libcamera/internal/software_isp/debayer.h\n>>  create mode 100644 include/libcamera/internal/software_isp/debayer_params.h\n>>  create mode 100644 src/libcamera/software_isp/debayer.cpp\n>>\n>> diff --git a/include/libcamera/internal/software_isp/debayer.h b/include/libcamera/internal/software_isp/debayer.h\n>> new file mode 100644\n>> index 00000000..39e6f393\n>> --- /dev/null\n>> +++ b/include/libcamera/internal/software_isp/debayer.h\n>> @@ -0,0 +1,132 @@\n>> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n>> +/*\n>> + * Copyright (C) 2023, Linaro Ltd\n>> + * Copyright (C) 2023, Red Hat Inc.\n>> + *\n>> + * Authors:\n>> + * Hans de Goede <hdegoede@redhat.com> \n>> + *\n>> + * debayer.h - debayering base class\n>> + */\n>> +\n>> +#pragma once\n>> +\n>> +#include <stdint.h>\n>> +\n>> +#include <libcamera/base/log.h>\n>> +#include <libcamera/base/signal.h>\n>> +\n>> +#include <libcamera/geometry.h>\n>> +#include <libcamera/stream.h>\n>> +\n>> +#include \"libcamera/internal/software_isp/debayer_params.h\"\n>> +\n>> +namespace libcamera {\n>> +\n>> +class FrameBuffer;\n>> +\n>> +LOG_DECLARE_CATEGORY(Debayer)\n>> +\n>> +/**\n>> + * \\class Debayer\n>> + * \\brief Base debayering class\n>> + *\n>> + * Base class that provides functions for setting up the debayering process.\n>> + */\n>> +class Debayer\n>> +{\n>> +public:\n>> +\tvirtual ~Debayer() = 0;\n>> +\n>> +\t/**\n>> +\t * \\brief Configure the debayer object according to the passed in parameters.\n>> +\t * \\param[in] inputCfg The input configuration.\n>> +\t * \\param[in] outputCfgs The output configurations.\n>> +\t *\n>> +\t * \\return 0 on success, a negative errno on failure.\n>> +\t */\n>> +\tvirtual int configure(const StreamConfiguration &inputCfg,\n>> +\t\t\t      const std::vector<std::reference_wrapper<StreamConfiguration>> &outputCfgs) = 0;\n>> +\n>> +\t/**\n>> +\t * \\brief Get the width and height at which the bayer pattern repeats.\n>> +\t * \\param[in] inputFormat The input format.\n>> +\t *\n>> +\t * \\return pattern size or an empty size for unsupported inputFormats.\n>> +\t */\n>> +\tvirtual Size patternSize(PixelFormat inputFormat) = 0;\n>> +\n>> +\t/**\n>> +\t * \\brief Get the supported output formats.\n>> +\t * \\param[in] inputFormat The input format.\n>> +\t *\n>> +\t * \\return all supported output formats or an empty vector if there are none.\n>> +\t */\n>> +\tvirtual std::vector<PixelFormat> formats(PixelFormat inputFormat) = 0;\n>> +\n>> +\t/**\n>> +\t * \\brief Get the stride and the frame size.\n>> +\t * \\param[in] outputFormat The output format.\n>> +\t * \\param[in] size The output size.\n>> +\t *\n>> +\t * \\return a tuple of the stride and the frame size, or a tuple with 0,0 if there is no valid output config.\n>> +\t */\n>> +\tvirtual std::tuple<unsigned int, unsigned int>\n>> +\t\tstrideAndFrameSize(const PixelFormat &outputFormat, const Size &size) = 0;\n>> +\n>> +\t/**\n>> +\t * \\brief Process the bayer data into the requested format.\n>> +\t * \\param[in] input The input buffer.\n>> +\t * \\param[in] output The output buffer.\n>> +\t * \\param[in] params The parameters to be used in debayering.\n>> +\t *\n>> +\t * \\note DebayerParams is passed by value deliberately so that a copy is passed\n>> +\t * when this is run in another thread by invokeMethod().\n>> +\t */\n>> +\tvirtual void process(FrameBuffer *input, FrameBuffer *output, DebayerParams params) = 0;\n>> +\n>> +\t/**\n>> +\t * \\brief Get the supported output sizes for the given input format and size.\n>> +\t * \\param[in] inputFormat The input format.\n>> +\t * \\param[in] inputSize The input size.\n>> +\t *\n>> +\t * \\return The valid size ranges or an empty range if there are none.\n>> +\t */\n>> +\tSizeRange sizes(PixelFormat inputFormat, const Size &inputSize)\n>> +\t{\n>> +\t\tSize pattern_size = patternSize(inputFormat);\n>> +\n>> +\t\tif (pattern_size.isNull())\n>> +\t\t\treturn {};\n>> +\n>> +\t\t/*\n>> +\t\t * For debayer interpolation a border of pattern-height x pattern-width\n>> +\t\t * is kept around the entire image. Combined with a minimum-size of\n>> +\t\t * pattern-height x pattern-width this means the input-size needs to be\n>> +\t\t * at least (3 * pattern-height) x (3 * pattern-width).\n>> +\t\t */\n>> +\t\tif (inputSize.width < (3 * pattern_size.width) ||\n>> +\t\t    inputSize.height < (3 * pattern_size.height)) {\n>> +\t\t\tLOG(Debayer, Warning)\n>> +\t\t\t\t<< \"Input format size too small: \" << inputSize.toString();\n>> +\t\t\treturn {};\n>> +\t\t}\n>> +\n>> +\t\treturn SizeRange(Size(pattern_size.width, pattern_size.height),\n>> +\t\t\t\t Size((inputSize.width - 2 * pattern_size.width) & ~(pattern_size.width - 1),\n>> +\t\t\t\t      (inputSize.height - 2 * pattern_size.height) & ~(pattern_size.height - 1)),\n>> +\t\t\t\t pattern_size.width, pattern_size.height);\n>> +\t}\n>> +\n>> +\t/**\n>> +\t * \\brief Signals when the input buffer is ready.\n>> +\t */\n>> +\tSignal<FrameBuffer *> inputBufferReady;\n>> +\n>> +\t/**\n>> +\t * \\brief Signals when the output buffer is ready.\n>> +\t */\n>> +\tSignal<FrameBuffer *> outputBufferReady;\n>> +};\n>> +\n>> +} /* namespace libcamera */\n>> diff --git a/include/libcamera/internal/software_isp/debayer_params.h b/include/libcamera/internal/software_isp/debayer_params.h\n>> new file mode 100644\n>> index 00000000..8f515304\n>> --- /dev/null\n>> +++ b/include/libcamera/internal/software_isp/debayer_params.h\n>> @@ -0,0 +1,43 @@\n>> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n>> +/*\n>> + * Copyright (C) 2023, Red Hat Inc.\n>> + *\n>> + * Authors:\n>> + * Hans de Goede <hdegoede@redhat.com> \n>> + *\n>> + * swstats.h - software statistics base class\n>> + */\n>> +\n>> +#pragma once\n>> +\n>> +namespace libcamera {\n>> +\n>> +/**\n>> + * \\brief Struct to hold the debayer parameters.\n>> + */\n>> +struct DebayerParams {\n>> +\t/**\n>> +\t * \\brief Red Gain.\n>> +\t *\n>> +\t * 128 = 0.5, 256 = 1.0, 512 = 2.0, etc.\n>> +\t */\n>> +\tunsigned int gainR;\n>> +\t/**\n>> +\t * \\brief Green Gain.\n>> +\t *\n>> +\t * 128 = 0.5, 256 = 1.0, 512 = 2.0, etc.\n>> +\t */\n>> +\tunsigned int gainG;\n>> +\t/**\n>> +\t * \\brief Blue Gain.\n>> +\t *\n>> +\t * 128 = 0.5, 256 = 1.0, 512 = 2.0, etc.\n>> +\t */\n>> +\tunsigned int gainB;\n>> +\t/**\n>> +\t * \\brief Gamma correction, 1.0 is no correction.\n>> +\t */\n>> +\tfloat gamma;\n>> +};\n>> +\n>> +} /* namespace libcamera */\n>> diff --git a/include/libcamera/internal/software_isp/meson.build b/include/libcamera/internal/software_isp/meson.build\n>> index 1d9e4018..7e40925e 100644\n>> --- a/include/libcamera/internal/software_isp/meson.build\n>> +++ b/include/libcamera/internal/software_isp/meson.build\n>> @@ -1,6 +1,8 @@\n>>  # SPDX-License-Identifier: CC0-1.0\n>>  \n>>  libcamera_internal_headers += files([\n>> +    'debayer.h',\n>> +    'debayer_params.h',\n>>      'swisp_stats.h',\n>>      'swstats.h',\n>>      'swstats_cpu.h',\n>> diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp\n>> new file mode 100644\n>> index 00000000..442da1ac\n>> --- /dev/null\n>> +++ b/src/libcamera/software_isp/debayer.cpp\n>> @@ -0,0 +1,22 @@\n>> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n>> +/*\n>> + * Copyright (C) 2023, Linaro Ltd\n>> + * Copyright (C) 2023, Red Hat Inc.\n>> + *\n>> + * Authors:\n>> + * Hans de Goede <hdegoede@redhat.com> \n>> + *\n>> + * debayer.cpp - debayer base class\n>> + */\n>> +\n>> +#include \"libcamera/internal/software_isp/debayer.h\"\n>> +\n>> +namespace libcamera {\n>> +\n>> +LOG_DEFINE_CATEGORY(Debayer)\n>> +\n>> +Debayer::~Debayer()\n>> +{\n>> +}\n>> +\n>> +} /* namespace libcamera */\n>> diff --git a/src/libcamera/software_isp/meson.build b/src/libcamera/software_isp/meson.build\n>> index d31c6217..d4ae5ac7 100644\n>> --- a/src/libcamera/software_isp/meson.build\n>> +++ b/src/libcamera/software_isp/meson.build\n>> @@ -1,6 +1,7 @@\n>>  # SPDX-License-Identifier: CC0-1.0\n>>  \n>>  libcamera_sources += files([\n>> +\t'debayer.cpp',\n>>  \t'swstats.cpp',\n>>  \t'swstats_cpu.cpp',\n>>  ])\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 076D0BDE17\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 12 Feb 2024 15:53:58 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 66EFE62808;\n\tMon, 12 Feb 2024 16:53:57 +0100 (CET)","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 48A1762803\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Feb 2024 16:53:56 +0100 (CET)","from mail-ej1-f70.google.com (mail-ej1-f70.google.com\n\t[209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-536-Uio_YqkMOPKN7bekZkYgzw-1; Mon, 12 Feb 2024 10:53:53 -0500","by mail-ej1-f70.google.com with SMTP id\n\ta640c23a62f3a-a2bc664528fso259621766b.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Feb 2024 07:53:53 -0800 (PST)","from [10.40.98.142] ([78.108.130.194])\n\tby smtp.gmail.com with ESMTPSA id\n\tlr22-20020a170906fb9600b00a3c5fa1052csm323145ejb.138.2024.02.12.07.53.51\n\t(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n\tMon, 12 Feb 2024 07:53:51 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"HqenNh+c\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1707753235;\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\tcontent-transfer-encoding:content-transfer-encoding:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=rtS9gpuA0WiZbAJyFv/i8g5lT0+xGifLETqc7CH1I3A=;\n\tb=HqenNh+coraX/onO3TAYT6tqL3V/Rbvh4NP1IX+tOPl71JLysKCnwl9M9B/wOA5isiVyal\n\tcY57S9sPjvngiIe744C4ao7nILfCVUYvmrKa6ygUIQywR2/rYW6PnAASmj1iq7ucKtpYop\n\tLcr8RyjHIVYWunfU73vAgKx3+mAkbRo=","X-MC-Unique":"Uio_YqkMOPKN7bekZkYgzw-1","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1707753232; x=1708358032;\n\th=content-transfer-encoding:in-reply-to:from:references:cc:to\n\t:content-language:subject:user-agent:mime-version:date:message-id\n\t:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;\n\tbh=rtS9gpuA0WiZbAJyFv/i8g5lT0+xGifLETqc7CH1I3A=;\n\tb=IxM7wlECKpA88uBw9lhpO12UoCLzjoKG3GDGSHNiCcjjJNdQtwr+N3CCycEJ9NW93E\n\tDvZtUkTYigOKLhAsoHEPt1x4k1BmAyAY4Iy836ur+JfwvNjpn/tRAiuF4i/hPGP6O4P5\n\tc422Ta6h7pUn7XoQGyZbuNSFgm5JeAYjqkU1RyW89jUL37pBKFTHaSXWBzdo6y7e8sGd\n\tMY+r4bw7eZlaliSPOeVl5SXq4iLb0YtWudsXmo4i/C0a3iiHoudBfWUr7XczQDs3yGIN\n\tXuBePrfEu2T4tMR+8sxGcTfUq4F0YcCkBRoukl4VQBBhMY5N3HPsmq3gCukRR3msGCYs\n\ts3eA==","X-Gm-Message-State":"AOJu0YwUSoXAu407IJRFlD72Mp04blBxe1Eg6C/pbtsf3GqY/LiTc9s6\n\t6gPfoXg+/DvO/fBARtM9zlk0Q4Q6K2eeWu4yIXjshmoQYn+hNzOsdKKj7xaMdKyLJd3wUoOgiFe\n\tpUtyS8glKabTH9S7wNJZ4jNVLkrIWFht4wxNTatsfdrxzKrBgQW+UIK5w5Z8lff6MZ2Dh190=","X-Received":["by 2002:a17:906:b74f:b0:a38:567a:6576 with SMTP id\n\tfx15-20020a170906b74f00b00a38567a6576mr5461636ejb.44.1707753232473; \n\tMon, 12 Feb 2024 07:53:52 -0800 (PST)","by 2002:a17:906:b74f:b0:a38:567a:6576 with SMTP id\n\tfx15-20020a170906b74f00b00a38567a6576mr5461610ejb.44.1707753232049; \n\tMon, 12 Feb 2024 07:53:52 -0800 (PST)"],"X-Google-Smtp-Source":"AGHT+IFEzLW+tnMCGAt0M9cQ0mjOzVGLQaTs74WOLl70BZ4/gli9yq9VddprbN/aZyw/xw88DvfIoQ==","X-Forwarded-Encrypted":"i=1;\n\tAJvYcCX3AEprQt5mUQOb2v2vuNHMG7A0BAzClWrc5WomVVZ0O+DMODRD64B29tTH0gyFiG52iOIjufdP8wzf1Yn/5dpw99X1ZuRMgBwtoR4gfRkzGMnMcNJg3gx8XD0CHMGPnVLCPM1CwSUBSH2dqM85FzC3MXWijOEfs0lemBbdx664xg8th+DistPwtykfWLfi+Mtet07yU2eUleG69TniMvsID4Kb5GTdL92ltiFtU0AdkfpSak6nPPRDUnXUn853RnDxFzQlFeFKSzG7KvRmjqZbKvnwZ/QRjB5NLyO6hgXbfvD/OVp8aIsTRkcQ3BMy","Message-ID":"<e26000eb-3218-40ea-b8df-63d2ba3db575@redhat.com>","Date":"Mon, 12 Feb 2024 16:53:50 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [libcamera-devel] [PATCH v2 09/18] libcamera: software_isp: Add\n\tDebayer base class","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","References":"<20240113142218.28063-1-hdegoede@redhat.com>\n\t<20240113142218.28063-10-hdegoede@redhat.com>\n\t<20240123171709.GD14927@pendragon.ideasonboard.com>","From":"Hans de Goede <hdegoede@redhat.com>","In-Reply-To":"<20240123171709.GD14927@pendragon.ideasonboard.com>","X-Mimecast-Spam-Score":"0","X-Mimecast-Originator":"redhat.com","Content-Language":"en-US","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","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>","Cc":"Maxime Ripard <mripard@redhat.com>, g.martti@gmail.com,\n\tt.langendam@gmail.com, libcamera-devel@lists.libcamera.org,\n\tsrinivas.kandagatla@linaro.org, Pavel Machek <pavel@ucw.cz>,\n\tBryan O'Donoghue <bryan.odonoghue@linaro.org>, admin@dennisbonke.com","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]