diff options
author | Florian Klink <flokli@flokli.de> | 2024-03-17T14·11+0200 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2024-03-19T06·59+0000 |
commit | 9948eb64d1d0a96c175114cfb2069cd301df740d (patch) | |
tree | 565a6ef12826eaeb0725c113a0442d4793a59129 /users/flokli/ipu6-softisp/libcamera/0009-libcamera-software_isp-Add-Debayer-base-class.patch | |
parent | 622efa86fa28f6357f65fc8e37efb8120734af39 (diff) |
chore(users/flokli/ipu6-softisp): refresh libcamera patches r/7738
Refresh them with the patches from https://patchwork.libcamera.org/cover/19663/. This is still based off v0.2.0. Change-Id: I875fd64e3bb71a95c92af1108a23d27c0f3494e0 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11179 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de> Autosubmit: flokli <flokli@flokli.de>
Diffstat (limited to 'users/flokli/ipu6-softisp/libcamera/0009-libcamera-software_isp-Add-Debayer-base-class.patch')
-rw-r--r-- | users/flokli/ipu6-softisp/libcamera/0009-libcamera-software_isp-Add-Debayer-base-class.patch | 272 |
1 files changed, 0 insertions, 272 deletions
diff --git a/users/flokli/ipu6-softisp/libcamera/0009-libcamera-software_isp-Add-Debayer-base-class.patch b/users/flokli/ipu6-softisp/libcamera/0009-libcamera-software_isp-Add-Debayer-base-class.patch deleted file mode 100644 index f43b3368e616..000000000000 --- a/users/flokli/ipu6-softisp/libcamera/0009-libcamera-software_isp-Add-Debayer-base-class.patch +++ /dev/null @@ -1,272 +0,0 @@ -From 8fc77447c0d76b0b52b19d23674049181c6cf8d2 Mon Sep 17 00:00:00 2001 -From: Hans de Goede <hdegoede@redhat.com> -Date: Mon, 11 Dec 2023 14:46:53 +0100 -Subject: [PATCH 09/25] libcamera: software_isp: Add Debayer base class - -Add a base class for debayer implementations. This is intended to be -suitable for both GPU (or otherwise) accelerated debayer implementations -as well as CPU based debayering. - -Doxygen documentation by Dennis Bonke. - -Co-authored-by: Dennis Bonke <admin@dennisbonke.com> -Signed-off-by: Dennis Bonke <admin@dennisbonke.com> -Co-authored-by: Andrey Konovalov <andrey.konovalov@linaro.org> -Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org> -Signed-off-by: Hans de Goede <hdegoede@redhat.com> -Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> # sc8280xp Lenovo x13s -Tested-by: Pavel Machek <pavel@ucw.cz> ---- - .../libcamera/internal/software_isp/debayer.h | 132 ++++++++++++++++++ - .../internal/software_isp/debayer_params.h | 43 ++++++ - .../internal/software_isp/meson.build | 2 + - src/libcamera/software_isp/debayer.cpp | 22 +++ - src/libcamera/software_isp/meson.build | 1 + - 5 files changed, 200 insertions(+) - create mode 100644 include/libcamera/internal/software_isp/debayer.h - create mode 100644 include/libcamera/internal/software_isp/debayer_params.h - create mode 100644 src/libcamera/software_isp/debayer.cpp - -diff --git a/include/libcamera/internal/software_isp/debayer.h b/include/libcamera/internal/software_isp/debayer.h -new file mode 100644 -index 00000000..39e6f393 ---- /dev/null -+++ b/include/libcamera/internal/software_isp/debayer.h -@@ -0,0 +1,132 @@ -+/* SPDX-License-Identifier: LGPL-2.1-or-later */ -+/* -+ * Copyright (C) 2023, Linaro Ltd -+ * Copyright (C) 2023, Red Hat Inc. -+ * -+ * Authors: -+ * Hans de Goede <hdegoede@redhat.com> -+ * -+ * debayer.h - debayering base class -+ */ -+ -+#pragma once -+ -+#include <stdint.h> -+ -+#include <libcamera/base/log.h> -+#include <libcamera/base/signal.h> -+ -+#include <libcamera/geometry.h> -+#include <libcamera/stream.h> -+ -+#include "libcamera/internal/software_isp/debayer_params.h" -+ -+namespace libcamera { -+ -+class FrameBuffer; -+ -+LOG_DECLARE_CATEGORY(Debayer) -+ -+/** -+ * \class Debayer -+ * \brief Base debayering class -+ * -+ * Base class that provides functions for setting up the debayering process. -+ */ -+class Debayer -+{ -+public: -+ virtual ~Debayer() = 0; -+ -+ /** -+ * \brief Configure the debayer object according to the passed in parameters. -+ * \param[in] inputCfg The input configuration. -+ * \param[in] outputCfgs The output configurations. -+ * -+ * \return 0 on success, a negative errno on failure. -+ */ -+ virtual int configure(const StreamConfiguration &inputCfg, -+ const std::vector<std::reference_wrapper<StreamConfiguration>> &outputCfgs) = 0; -+ -+ /** -+ * \brief Get the width and height at which the bayer pattern repeats. -+ * \param[in] inputFormat The input format. -+ * -+ * \return pattern size or an empty size for unsupported inputFormats. -+ */ -+ virtual Size patternSize(PixelFormat inputFormat) = 0; -+ -+ /** -+ * \brief Get the supported output formats. -+ * \param[in] inputFormat The input format. -+ * -+ * \return all supported output formats or an empty vector if there are none. -+ */ -+ virtual std::vector<PixelFormat> formats(PixelFormat inputFormat) = 0; -+ -+ /** -+ * \brief Get the stride and the frame size. -+ * \param[in] outputFormat The output format. -+ * \param[in] size The output size. -+ * -+ * \return a tuple of the stride and the frame size, or a tuple with 0,0 if there is no valid output config. -+ */ -+ virtual std::tuple<unsigned int, unsigned int> -+ strideAndFrameSize(const PixelFormat &outputFormat, const Size &size) = 0; -+ -+ /** -+ * \brief Process the bayer data into the requested format. -+ * \param[in] input The input buffer. -+ * \param[in] output The output buffer. -+ * \param[in] params The parameters to be used in debayering. -+ * -+ * \note DebayerParams is passed by value deliberately so that a copy is passed -+ * when this is run in another thread by invokeMethod(). -+ */ -+ virtual void process(FrameBuffer *input, FrameBuffer *output, DebayerParams params) = 0; -+ -+ /** -+ * \brief Get the supported output sizes for the given input format and size. -+ * \param[in] inputFormat The input format. -+ * \param[in] inputSize The input size. -+ * -+ * \return The valid size ranges or an empty range if there are none. -+ */ -+ SizeRange sizes(PixelFormat inputFormat, const Size &inputSize) -+ { -+ Size pattern_size = patternSize(inputFormat); -+ -+ if (pattern_size.isNull()) -+ return {}; -+ -+ /* -+ * For debayer interpolation a border of pattern-height x pattern-width -+ * is kept around the entire image. Combined with a minimum-size of -+ * pattern-height x pattern-width this means the input-size needs to be -+ * at least (3 * pattern-height) x (3 * pattern-width). -+ */ -+ if (inputSize.width < (3 * pattern_size.width) || -+ inputSize.height < (3 * pattern_size.height)) { -+ LOG(Debayer, Warning) -+ << "Input format size too small: " << inputSize.toString(); -+ return {}; -+ } -+ -+ return SizeRange(Size(pattern_size.width, pattern_size.height), -+ Size((inputSize.width - 2 * pattern_size.width) & ~(pattern_size.width - 1), -+ (inputSize.height - 2 * pattern_size.height) & ~(pattern_size.height - 1)), -+ pattern_size.width, pattern_size.height); -+ } -+ -+ /** -+ * \brief Signals when the input buffer is ready. -+ */ -+ Signal<FrameBuffer *> inputBufferReady; -+ -+ /** -+ * \brief Signals when the output buffer is ready. -+ */ -+ Signal<FrameBuffer *> outputBufferReady; -+}; -+ -+} /* namespace libcamera */ -diff --git a/include/libcamera/internal/software_isp/debayer_params.h b/include/libcamera/internal/software_isp/debayer_params.h -new file mode 100644 -index 00000000..8f515304 ---- /dev/null -+++ b/include/libcamera/internal/software_isp/debayer_params.h -@@ -0,0 +1,43 @@ -+/* SPDX-License-Identifier: LGPL-2.1-or-later */ -+/* -+ * Copyright (C) 2023, Red Hat Inc. -+ * -+ * Authors: -+ * Hans de Goede <hdegoede@redhat.com> -+ * -+ * swstats.h - software statistics base class -+ */ -+ -+#pragma once -+ -+namespace libcamera { -+ -+/** -+ * \brief Struct to hold the debayer parameters. -+ */ -+struct DebayerParams { -+ /** -+ * \brief Red Gain. -+ * -+ * 128 = 0.5, 256 = 1.0, 512 = 2.0, etc. -+ */ -+ unsigned int gainR; -+ /** -+ * \brief Green Gain. -+ * -+ * 128 = 0.5, 256 = 1.0, 512 = 2.0, etc. -+ */ -+ unsigned int gainG; -+ /** -+ * \brief Blue Gain. -+ * -+ * 128 = 0.5, 256 = 1.0, 512 = 2.0, etc. -+ */ -+ unsigned int gainB; -+ /** -+ * \brief Gamma correction, 1.0 is no correction. -+ */ -+ float gamma; -+}; -+ -+} /* namespace libcamera */ -diff --git a/include/libcamera/internal/software_isp/meson.build b/include/libcamera/internal/software_isp/meson.build -index 1d9e4018..7e40925e 100644 ---- a/include/libcamera/internal/software_isp/meson.build -+++ b/include/libcamera/internal/software_isp/meson.build -@@ -1,6 +1,8 @@ - # SPDX-License-Identifier: CC0-1.0 - - libcamera_internal_headers += files([ -+ 'debayer.h', -+ 'debayer_params.h', - 'swisp_stats.h', - 'swstats.h', - 'swstats_cpu.h', -diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp -new file mode 100644 -index 00000000..442da1ac ---- /dev/null -+++ b/src/libcamera/software_isp/debayer.cpp -@@ -0,0 +1,22 @@ -+/* SPDX-License-Identifier: LGPL-2.1-or-later */ -+/* -+ * Copyright (C) 2023, Linaro Ltd -+ * Copyright (C) 2023, Red Hat Inc. -+ * -+ * Authors: -+ * Hans de Goede <hdegoede@redhat.com> -+ * -+ * debayer.cpp - debayer base class -+ */ -+ -+#include "libcamera/internal/software_isp/debayer.h" -+ -+namespace libcamera { -+ -+LOG_DEFINE_CATEGORY(Debayer) -+ -+Debayer::~Debayer() -+{ -+} -+ -+} /* namespace libcamera */ -diff --git a/src/libcamera/software_isp/meson.build b/src/libcamera/software_isp/meson.build -index d31c6217..d4ae5ac7 100644 ---- a/src/libcamera/software_isp/meson.build -+++ b/src/libcamera/software_isp/meson.build -@@ -1,6 +1,7 @@ - # SPDX-License-Identifier: CC0-1.0 - - libcamera_sources += files([ -+ 'debayer.cpp', - 'swstats.cpp', - 'swstats_cpu.cpp', - ]) --- -2.43.0 - |