[PATCH v3 13/23] libcamera: software_isp: Create algorithms
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Tue Aug 13 00:45:33 CEST 2024
Hi Milan,
Thank you for the patch.
On Wed, Jul 17, 2024 at 10:54:34AM +0200, Milan Zamazal wrote:
> We are ready to introduce algorithms now. First, let's create
> algorithms. The algorithms are not called yet, calls to them will be
> added in followup patches.
>
> The maximum number of contexts is set to the same value as in hardware
> pipelines.
>
> Signed-off-by: Milan Zamazal <mzamazal at redhat.com>
> Reviewed-by: Umang Jain <umang.jain at ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> ---
> src/ipa/simple/algorithms/meson.build | 4 ++++
> src/ipa/simple/data/uncalibrated.yaml | 1 +
> src/ipa/simple/meson.build | 7 +++++--
> src/ipa/simple/soft_simple.cpp | 14 ++++++++++++++
> 4 files changed, 24 insertions(+), 2 deletions(-)
> create mode 100644 src/ipa/simple/algorithms/meson.build
>
> diff --git a/src/ipa/simple/algorithms/meson.build b/src/ipa/simple/algorithms/meson.build
> new file mode 100644
> index 00000000..31d26e43
> --- /dev/null
> +++ b/src/ipa/simple/algorithms/meson.build
> @@ -0,0 +1,4 @@
> +# SPDX-License-Identifier: CC0-1.0
> +
> +soft_simple_ipa_algorithms = files([
> +])
> diff --git a/src/ipa/simple/data/uncalibrated.yaml b/src/ipa/simple/data/uncalibrated.yaml
> index ff981a1a..2cdc39a8 100644
> --- a/src/ipa/simple/data/uncalibrated.yaml
> +++ b/src/ipa/simple/data/uncalibrated.yaml
> @@ -2,4 +2,5 @@
> %YAML 1.1
> ---
> version: 1
> +algorithms:
> ...
> diff --git a/src/ipa/simple/meson.build b/src/ipa/simple/meson.build
> index 363251fb..7515a8d8 100644
> --- a/src/ipa/simple/meson.build
> +++ b/src/ipa/simple/meson.build
> @@ -1,5 +1,8 @@
> # SPDX-License-Identifier: CC0-1.0
>
> +subdir('algorithms')
> +subdir('data')
> +
> ipa_name = 'ipa_soft_simple'
>
> soft_simple_sources = files([
> @@ -8,6 +11,8 @@ soft_simple_sources = files([
> 'black_level.cpp',
> ])
>
> +soft_simple_sources += soft_simple_ipa_algorithms
> +
> mod = shared_module(ipa_name,
> [soft_simple_sources, libcamera_generated_ipa_headers],
> name_prefix : '',
> @@ -25,6 +30,4 @@ if ipa_sign_module
> build_by_default : true)
> endif
>
> -subdir('data')
> -
> ipa_names += ipa_name
> diff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp
> index 09e3c8f6..dd300387 100644
> --- a/src/ipa/simple/soft_simple.cpp
> +++ b/src/ipa/simple/soft_simple.cpp
> @@ -53,12 +53,15 @@ static constexpr float kExposureOptimal = kExposureBinsCount / 2.0;
> * enough to prevent the exposure from wobbling around the optimal value.
> */
> static constexpr float kExposureSatisfactory = 0.2;
> +/* Maximum number of frame contexts to be held */
> +static constexpr uint32_t kMaxFrameContexts = 16;
>
> class IPASoftSimple : public ipa::soft::IPASoftInterface, public Module
> {
> public:
> IPASoftSimple()
> : params_(nullptr), stats_(nullptr), blackLevel_(BlackLevel()),
> + context_({ {}, {}, { kMaxFrameContexts } }),
> ignoreUpdates_(0)
> {
> }
> @@ -92,6 +95,8 @@ private:
> static constexpr unsigned int kGammaLookupSize = 1024;
> std::array<uint8_t, kGammaLookupSize> gammaTable_;
> int lastBlackLevel_ = -1;
> + /* Local parameter storage */
> + struct IPAContext context_;
>
> int32_t exposureMin_, exposureMax_;
> int32_t exposure_;
> @@ -138,6 +143,15 @@ int IPASoftSimple::init(const IPASettings &settings,
> unsigned int version = (*data)["version"].get<uint32_t>(0);
> LOG(IPASoft, Debug) << "Tuning file version " << version;
>
> + if (!data->contains("algorithms")) {
> + LOG(IPASoft, Error) << "Tuning file doesn't contain algorithms";
> + return -EINVAL;
> + }
> +
> + int ret = createAlgorithms(context_, (*data)["algorithms"]);
> + if (ret)
> + return ret;
> +
> params_ = nullptr;
> stats_ = nullptr;
>
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list