summaryrefslogtreecommitdiff
path: root/src/ipa/raspberrypi/controller/rpi/contrast.cpp
diff options
context:
space:
mode:
authorDavid Plowman <david.plowman@raspberrypi.com>2021-01-25 18:48:57 +0000
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-01-26 10:46:10 +0200
commitd97b1bcd2a756dbbd12b14f462dcf7620adabe14 (patch)
tree120f8d64b3aec2e49045daf835fa351e980b818f /src/ipa/raspberrypi/controller/rpi/contrast.cpp
parenteb605eab5b3df765082549bda2dc45215cda16f9 (diff)
ipa: raspberrypi: Replace Raspberry Pi debug with libcamera debug
This commit deals with all the "small" algorithms (that is, not Agc/Awb/Alsc). A few unnecessary debug messages have also been removed. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/ipa/raspberrypi/controller/rpi/contrast.cpp')
-rw-r--r--src/ipa/raspberrypi/controller/rpi/contrast.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/ipa/raspberrypi/controller/rpi/contrast.cpp b/src/ipa/raspberrypi/controller/rpi/contrast.cpp
index 103153db..05ed139f 100644
--- a/src/ipa/raspberrypi/controller/rpi/contrast.cpp
+++ b/src/ipa/raspberrypi/controller/rpi/contrast.cpp
@@ -6,12 +6,17 @@
*/
#include <stdint.h>
+#include "libcamera/internal/log.h"
+
#include "../contrast_status.h"
#include "../histogram.hpp"
#include "contrast.hpp"
using namespace RPiController;
+using namespace libcamera;
+
+LOG_DEFINE_CATEGORY(RPiContrast)
// This is a very simple control algorithm which simply retrieves the results of
// AGC and AWB via their "status" metadata, and applies digital gain to the
@@ -97,11 +102,13 @@ Pwl compute_stretch_curve(Histogram const &histogram,
double hist_lo = histogram.Quantile(config.lo_histogram) *
(65536 / NUM_HISTOGRAM_BINS);
double level_lo = config.lo_level * 65536;
- RPI_LOG("Move histogram point " << hist_lo << " to " << level_lo);
+ LOG(RPiContrast, Debug)
+ << "Move histogram point " << hist_lo << " to " << level_lo;
hist_lo = std::max(
level_lo,
std::min(65535.0, std::min(hist_lo, level_lo + config.lo_max)));
- RPI_LOG("Final values " << hist_lo << " -> " << level_lo);
+ LOG(RPiContrast, Debug)
+ << "Final values " << hist_lo << " -> " << level_lo;
enhance.Append(hist_lo, level_lo);
// Keep the mid-point (median) in the same place, though, to limit the
// apparent amount of global brightness shift.
@@ -113,11 +120,13 @@ Pwl compute_stretch_curve(Histogram const &histogram,
double hist_hi = histogram.Quantile(config.hi_histogram) *
(65536 / NUM_HISTOGRAM_BINS);
double level_hi = config.hi_level * 65536;
- RPI_LOG("Move histogram point " << hist_hi << " to " << level_hi);
+ LOG(RPiContrast, Debug)
+ << "Move histogram point " << hist_hi << " to " << level_hi;
hist_hi = std::min(
level_hi,
std::max(0.0, std::max(hist_hi, level_hi - config.hi_max)));
- RPI_LOG("Final values " << hist_hi << " -> " << level_hi);
+ LOG(RPiContrast, Debug)
+ << "Final values " << hist_hi << " -> " << level_hi;
enhance.Append(hist_hi, level_hi);
enhance.Append(65535, 65535);
return enhance;
@@ -127,7 +136,8 @@ Pwl apply_manual_contrast(Pwl const &gamma_curve, double brightness,
double contrast)
{
Pwl new_gamma_curve;
- RPI_LOG("Manual brightness " << brightness << " contrast " << contrast);
+ LOG(RPiContrast, Debug)
+ << "Manual brightness " << brightness << " contrast " << contrast;
gamma_curve.Map([&](double x, double y) {
new_gamma_curve.Append(
x, std::max(0.0, std::min(65535.0,