summaryrefslogtreecommitdiff
path: root/src/ipa/rpi/controller/rpi/contrast.cpp
diff options
context:
space:
mode:
authorDavid Plowman <david.plowman@raspberrypi.com>2023-10-13 08:48:38 +0100
committerKieran Bingham <kieran.bingham@ideasonboard.com>2023-10-18 11:01:23 +0100
commit0ff20bf8c1d21ffbb3694b67756abc59151132cf (patch)
tree8654dd1b72fcec8654ac605352297221311a41a6 /src/ipa/rpi/controller/rpi/contrast.cpp
parent9c90e56733311a1cdabf2554e3b82f7e177e735d (diff)
ipa: rpi: contrast: Allow adaptive contrast enhancement to be disabled
The enableCe() function enables or disables adaptive contrast enhancement and the restoreCe() function sets it back to its normal state (which is what was read from the tuning file). In future, algorithms like HDR might want to take over tonemapping functions, so any dynamic behaviour here would upset them. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/ipa/rpi/controller/rpi/contrast.cpp')
-rw-r--r--src/ipa/rpi/controller/rpi/contrast.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/ipa/rpi/controller/rpi/contrast.cpp b/src/ipa/rpi/controller/rpi/contrast.cpp
index bee1eadd..4e038a02 100644
--- a/src/ipa/rpi/controller/rpi/contrast.cpp
+++ b/src/ipa/rpi/controller/rpi/contrast.cpp
@@ -42,6 +42,7 @@ int Contrast::read(const libcamera::YamlObject &params)
{
// enable adaptive enhancement by default
config_.ceEnable = params["ce_enable"].get<int>(1);
+ ceEnable_ = config_.ceEnable;
// the point near the bottom of the histogram to move
config_.loHistogram = params["lo_histogram"].get<double>(0.01);
// where in the range to try and move it to
@@ -65,6 +66,16 @@ void Contrast::setContrast(double contrast)
contrast_ = contrast;
}
+void Contrast::enableCe(bool enable)
+{
+ ceEnable_ = enable;
+}
+
+void Contrast::restoreCe()
+{
+ ceEnable_ = config_.ceEnable;
+}
+
void Contrast::initialise()
{
/*
@@ -150,7 +161,7 @@ void Contrast::process(StatisticsPtr &stats,
* histogram down, and possibly push the end up.
*/
Pwl gammaCurve = config_.gammaCurve;
- if (config_.ceEnable) {
+ if (ceEnable_) {
if (config_.loMax != 0 || config_.hiMax != 0)
gammaCurve = computeStretchCurve(histogram, config_).compose(gammaCurve);
/*