diff options
author | Naushir Patuck <naush@raspberrypi.com> | 2023-10-13 08:48:32 +0100 |
---|---|---|
committer | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2023-10-18 11:01:22 +0100 |
commit | ded9004e91dd2487f3ec1827eaab8c80b0e02e68 (patch) | |
tree | f508bb314903a3f99063f3b0f92720f4db231618 /src/ipa/rpi/controller/rpi/tonemap.cpp | |
parent | c9fb1d44d850904a95d73e8773548485de1de081 (diff) |
ipa: rpi: Add new algorithms for PiSP
Add new CAC, HDR, Saturation and Tonemapping algorithms.
Add a new Denoise algorithm that handles spatial/temporal/colour denoise
through one interface. With this change, the old SDN algorithm is now
considered deprecated and a warning message will be displayed if it is
enabled.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/ipa/rpi/controller/rpi/tonemap.cpp')
-rw-r--r-- | src/ipa/rpi/controller/rpi/tonemap.cpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/ipa/rpi/controller/rpi/tonemap.cpp b/src/ipa/rpi/controller/rpi/tonemap.cpp new file mode 100644 index 00000000..5f8b2bf2 --- /dev/null +++ b/src/ipa/rpi/controller/rpi/tonemap.cpp @@ -0,0 +1,61 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ +/* + * Copyright (C) 2022 Raspberry Pi Ltd + * + * tonemap.cpp - Tonemap control algorithm + */ +#include "tonemap.h" + +#include <libcamera/base/log.h> + +#include "tonemap_status.h" + +using namespace RPiController; +using namespace libcamera; + +LOG_DEFINE_CATEGORY(RPiTonemap) + +#define NAME "rpi.tonemap" + +Tonemap::Tonemap(Controller *controller) + : Algorithm(controller) +{ +} + +char const *Tonemap::name() const +{ + return NAME; +} + +int Tonemap::read(const libcamera::YamlObject ¶ms) +{ + config_.detailConstant = params["detail_constant"].get<uint16_t>(0); + config_.detailSlope = params["detail_slope"].get<double>(0.1); + config_.iirStrength = params["iir_strength"].get<double>(1.0); + config_.strength = params["strength"].get<double>(1.0); + config_.tonemap.read(params["tone_curve"]); + return 0; +} + +void Tonemap::initialise() +{ +} + +void Tonemap::prepare(Metadata *imageMetadata) +{ + TonemapStatus tonemapStatus; + + tonemapStatus.detailConstant = config_.detailConstant; + tonemapStatus.detailSlope = config_.detailSlope; + tonemapStatus.iirStrength = config_.iirStrength; + tonemapStatus.strength = config_.strength; + tonemapStatus.tonemap = config_.tonemap; + imageMetadata->set("tonemap.status", tonemapStatus); +} + +// Register algorithm with the system. +static Algorithm *Create(Controller *controller) +{ + return (Algorithm *)new Tonemap(controller); +} +static RegisterAlgorithm reg(NAME, &Create); |