[libcamera-devel] [PATCH 08/17] DNI: ipa: raspberrypi: Code refactoring to match style guidelines
Naushir Patuck
naush at raspberrypi.com
Tue Jul 26 14:45:40 CEST 2022
Refactor the source files src/ipa/raspberrypi/controller/rps/[b|c|d]* to match the
recommended formatting guidelines for the libcamera project. The vast majority
of changes in this commit comprise of switching from snake_case to CamelCase,
and starting class member functions with a lower case character.
Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
.../controller/black_level_status.h | 6 +-
src/ipa/raspberrypi/controller/rpi/agc.cpp | 2 +-
.../controller/rpi/black_level.cpp | 34 ++---
.../controller/rpi/black_level.hpp | 12 +-
src/ipa/raspberrypi/controller/rpi/ccm.cpp | 84 +++++++------
src/ipa/raspberrypi/controller/rpi/ccm.hpp | 12 +-
.../raspberrypi/controller/rpi/contrast.cpp | 118 +++++++++---------
.../raspberrypi/controller/rpi/contrast.hpp | 30 ++---
src/ipa/raspberrypi/controller/rpi/dpc.cpp | 18 +--
src/ipa/raspberrypi/controller/rpi/dpc.hpp | 6 +-
10 files changed, 160 insertions(+), 162 deletions(-)
diff --git a/src/ipa/raspberrypi/controller/black_level_status.h b/src/ipa/raspberrypi/controller/black_level_status.h
index d085f64b27fe..df3661401d99 100644
--- a/src/ipa/raspberrypi/controller/black_level_status.h
+++ b/src/ipa/raspberrypi/controller/black_level_status.h
@@ -13,9 +13,9 @@ extern "C" {
#endif
struct BlackLevelStatus {
- uint16_t black_level_r; // out of 16 bits
- uint16_t black_level_g;
- uint16_t black_level_b;
+ uint16_t blackLevelR; // out of 16 bits
+ uint16_t blackLevelG;
+ uint16_t blackLevelB;
};
#ifdef __cplusplus
diff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp b/src/ipa/raspberrypi/controller/rpi/agc.cpp
index c19769f4e27b..408ff9cf296d 100644
--- a/src/ipa/raspberrypi/controller/rpi/agc.cpp
+++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp
@@ -250,7 +250,7 @@ void Agc::setFixedShutter(Duration fixedShutter)
void Agc::setFixedAnalogueGain(double fixedAnalogueGain)
{
- fixedAnalogueGain_ = fixedAnalogueGain_;
+ fixedAnalogueGain_ = fixedAnalogueGain;
// Set this in case someone calls Pause() straight after.
status_.analogueGain = fixedAnalogueGain;
}
diff --git a/src/ipa/raspberrypi/controller/rpi/black_level.cpp b/src/ipa/raspberrypi/controller/rpi/black_level.cpp
index 6b3497f13c19..101b5ea92cf5 100644
--- a/src/ipa/raspberrypi/controller/rpi/black_level.cpp
+++ b/src/ipa/raspberrypi/controller/rpi/black_level.cpp
@@ -26,38 +26,38 @@ BlackLevel::BlackLevel(Controller *controller)
{
}
-char const *BlackLevel::Name() const
+char const *BlackLevel::name() const
{
return NAME;
}
-void BlackLevel::Read(boost::property_tree::ptree const ¶ms)
+void BlackLevel::read(boost::property_tree::ptree const ¶ms)
{
- uint16_t black_level = params.get<uint16_t>(
+ uint16_t blackLevel = params.get<uint16_t>(
"black_level", 4096); // 64 in 10 bits scaled to 16 bits
- black_level_r_ = params.get<uint16_t>("black_level_r", black_level);
- black_level_g_ = params.get<uint16_t>("black_level_g", black_level);
- black_level_b_ = params.get<uint16_t>("black_level_b", black_level);
+ blackLevelR_ = params.get<uint16_t>("blackLevelR", blackLevel);
+ blackLevelG_ = params.get<uint16_t>("blackLevelG", blackLevel);
+ blackLevelB_ = params.get<uint16_t>("blackLevelB", blackLevel);
LOG(RPiBlackLevel, Debug)
- << " Read black levels red " << black_level_r_
- << " green " << black_level_g_
- << " blue " << black_level_b_;
+ << " Read black levels red " << blackLevelR_
+ << " green " << blackLevelG_
+ << " blue " << blackLevelB_;
}
-void BlackLevel::Prepare(Metadata *image_metadata)
+void BlackLevel::prepare(Metadata *imageMetadata)
{
- // Possibly we should think about doing this in a switch_mode or
+ // Possibly we should think about doing this in a switchMode or
// something?
struct BlackLevelStatus status;
- status.black_level_r = black_level_r_;
- status.black_level_g = black_level_g_;
- status.black_level_b = black_level_b_;
- image_metadata->Set("black_level.status", status);
+ status.blackLevelR = blackLevelR_;
+ status.blackLevelG = blackLevelG_;
+ status.blackLevelB = blackLevelB_;
+ imageMetadata->set("black_level.status", status);
}
// Register algorithm with the system.
-static Algorithm *Create(Controller *controller)
+static Algorithm *create(Controller *controller)
{
return new BlackLevel(controller);
}
-static RegisterAlgorithm reg(NAME, &Create);
+static RegisterAlgorithm reg(NAME, &create);
diff --git a/src/ipa/raspberrypi/controller/rpi/black_level.hpp b/src/ipa/raspberrypi/controller/rpi/black_level.hpp
index 65ec4d0ed26c..0d74f6a4c49b 100644
--- a/src/ipa/raspberrypi/controller/rpi/black_level.hpp
+++ b/src/ipa/raspberrypi/controller/rpi/black_level.hpp
@@ -17,14 +17,14 @@ class BlackLevel : public Algorithm
{
public:
BlackLevel(Controller *controller);
- char const *Name() const override;
- void Read(boost::property_tree::ptree const ¶ms) override;
- void Prepare(Metadata *image_metadata) override;
+ char const *name() const override;
+ void read(boost::property_tree::ptree const ¶ms) override;
+ void prepare(Metadata *imageMetadata) override;
private:
- double black_level_r_;
- double black_level_g_;
- double black_level_b_;
+ double blackLevelR_;
+ double blackLevelG_;
+ double blackLevelB_;
};
} // namespace RPiController
diff --git a/src/ipa/raspberrypi/controller/rpi/ccm.cpp b/src/ipa/raspberrypi/controller/rpi/ccm.cpp
index 821a4c7c98c5..24d8e5bd1fd8 100644
--- a/src/ipa/raspberrypi/controller/rpi/ccm.cpp
+++ b/src/ipa/raspberrypi/controller/rpi/ccm.cpp
@@ -37,7 +37,7 @@ Matrix::Matrix(double m0, double m1, double m2, double m3, double m4, double m5,
m[0][0] = m0, m[0][1] = m1, m[0][2] = m2, m[1][0] = m3, m[1][1] = m4,
m[1][2] = m5, m[2][0] = m6, m[2][1] = m7, m[2][2] = m8;
}
-void Matrix::Read(boost::property_tree::ptree const ¶ms)
+void Matrix::read(boost::property_tree::ptree const ¶ms)
{
double *ptr = (double *)m;
int n = 0;
@@ -53,47 +53,49 @@ void Matrix::Read(boost::property_tree::ptree const ¶ms)
Ccm::Ccm(Controller *controller)
: CcmAlgorithm(controller), saturation_(1.0) {}
-char const *Ccm::Name() const
+char const *Ccm::name() const
{
return NAME;
}
-void Ccm::Read(boost::property_tree::ptree const ¶ms)
+void Ccm::read(boost::property_tree::ptree const ¶ms)
{
if (params.get_child_optional("saturation"))
- config_.saturation.Read(params.get_child("saturation"));
+ config_.saturation.read(params.get_child("saturation"));
for (auto &p : params.get_child("ccms")) {
- CtCcm ct_ccm;
- ct_ccm.ct = p.second.get<double>("ct");
- ct_ccm.ccm.Read(p.second.get_child("ccm"));
+ CtCcm ctCcm;
+ ctCcm.ct = p.second.get<double>("ct");
+ ctCcm.ccm.read(p.second.get_child("ccm"));
if (!config_.ccms.empty() &&
- ct_ccm.ct <= config_.ccms.back().ct)
+ ctCcm.ct <= config_.ccms.back().ct)
throw std::runtime_error(
"Ccm: CCM not in increasing colour temperature order");
- config_.ccms.push_back(std::move(ct_ccm));
+ config_.ccms.push_back(std::move(ctCcm));
}
if (config_.ccms.empty())
throw std::runtime_error("Ccm: no CCMs specified");
}
-void Ccm::SetSaturation(double saturation)
+void Ccm::setSaturation(double saturation)
{
saturation_ = saturation;
}
-void Ccm::Initialise() {}
+void Ccm::initialise()
+{
+}
template<typename T>
-static bool get_locked(Metadata *metadata, std::string const &tag, T &value)
+static bool getLocked(Metadata *metadata, std::string const &tag, T &value)
{
- T *ptr = metadata->GetLocked<T>(tag);
+ T *ptr = metadata->getLocked<T>(tag);
if (ptr == nullptr)
return false;
value = *ptr;
return true;
}
-Matrix calculate_ccm(std::vector<CtCcm> const &ccms, double ct)
+Matrix calculateCcm(std::vector<CtCcm> const &ccms, double ct)
{
if (ct <= ccms.front().ct)
return ccms.front().ccm;
@@ -109,7 +111,7 @@ Matrix calculate_ccm(std::vector<CtCcm> const &ccms, double ct)
}
}
-Matrix apply_saturation(Matrix const &ccm, double saturation)
+Matrix applySaturation(Matrix const &ccm, double saturation)
{
Matrix RGB2Y(0.299, 0.587, 0.114, -0.169, -0.331, 0.500, 0.500, -0.419,
-0.081);
@@ -119,51 +121,51 @@ Matrix apply_saturation(Matrix const &ccm, double saturation)
return Y2RGB * S * RGB2Y * ccm;
}
-void Ccm::Prepare(Metadata *image_metadata)
+void Ccm::prepare(Metadata *imageMetadata)
{
- bool awb_ok = false, lux_ok = false;
+ bool awbOk = false, luxOk = false;
struct AwbStatus awb = {};
- awb.temperature_K = 4000; // in case no metadata
+ awb.temperatureK = 4000; // in case no metadata
struct LuxStatus lux = {};
lux.lux = 400; // in case no metadata
{
// grab mutex just once to get everything
- std::lock_guard<Metadata> lock(*image_metadata);
- awb_ok = get_locked(image_metadata, "awb.status", awb);
- lux_ok = get_locked(image_metadata, "lux.status", lux);
+ std::lock_guard<Metadata> lock(*imageMetadata);
+ awbOk = getLocked(imageMetadata, "awb.status", awb);
+ luxOk = getLocked(imageMetadata, "lux.status", lux);
}
- if (!awb_ok)
+ if (!awbOk)
LOG(RPiCcm, Warning) << "no colour temperature found";
- if (!lux_ok)
+ if (!luxOk)
LOG(RPiCcm, Warning) << "no lux value found";
- Matrix ccm = calculate_ccm(config_.ccms, awb.temperature_K);
+ Matrix ccm = calculateCcm(config_.ccms, awb.temperatureK);
double saturation = saturation_;
- struct CcmStatus ccm_status;
- ccm_status.saturation = saturation;
- if (!config_.saturation.Empty())
- saturation *= config_.saturation.Eval(
- config_.saturation.Domain().Clip(lux.lux));
- ccm = apply_saturation(ccm, saturation);
+ struct CcmStatus ccmStatus;
+ ccmStatus.saturation = saturation;
+ if (!config_.saturation.empty())
+ saturation *= config_.saturation.eval(
+ config_.saturation.domain().clip(lux.lux));
+ ccm = applySaturation(ccm, saturation);
for (int j = 0; j < 3; j++)
for (int i = 0; i < 3; i++)
- ccm_status.matrix[j * 3 + i] =
+ ccmStatus.matrix[j * 3 + i] =
std::max(-8.0, std::min(7.9999, ccm.m[j][i]));
LOG(RPiCcm, Debug)
- << "colour temperature " << awb.temperature_K << "K";
+ << "colour temperature " << awb.temperatureK << "K";
LOG(RPiCcm, Debug)
- << "CCM: " << ccm_status.matrix[0] << " " << ccm_status.matrix[1]
- << " " << ccm_status.matrix[2] << " "
- << ccm_status.matrix[3] << " " << ccm_status.matrix[4]
- << " " << ccm_status.matrix[5] << " "
- << ccm_status.matrix[6] << " " << ccm_status.matrix[7]
- << " " << ccm_status.matrix[8];
- image_metadata->Set("ccm.status", ccm_status);
+ << "CCM: " << ccmStatus.matrix[0] << " " << ccmStatus.matrix[1]
+ << " " << ccmStatus.matrix[2] << " "
+ << ccmStatus.matrix[3] << " " << ccmStatus.matrix[4]
+ << " " << ccmStatus.matrix[5] << " "
+ << ccmStatus.matrix[6] << " " << ccmStatus.matrix[7]
+ << " " << ccmStatus.matrix[8];
+ imageMetadata->set("ccm.status", ccmStatus);
}
// Register algorithm with the system.
-static Algorithm *Create(Controller *controller)
+static Algorithm *create(Controller *controller)
{
return (Algorithm *)new Ccm(controller);
;
}
-static RegisterAlgorithm reg(NAME, &Create);
+static RegisterAlgorithm reg(NAME, &create);
diff --git a/src/ipa/raspberrypi/controller/rpi/ccm.hpp b/src/ipa/raspberrypi/controller/rpi/ccm.hpp
index 330ed51fe398..4c4807b8a942 100644
--- a/src/ipa/raspberrypi/controller/rpi/ccm.hpp
+++ b/src/ipa/raspberrypi/controller/rpi/ccm.hpp
@@ -20,7 +20,7 @@ struct Matrix {
double m6, double m7, double m8);
Matrix();
double m[3][3];
- void Read(boost::property_tree::ptree const ¶ms);
+ void read(boost::property_tree::ptree const ¶ms);
};
static inline Matrix operator*(double d, Matrix const &m)
{
@@ -61,11 +61,11 @@ class Ccm : public CcmAlgorithm
{
public:
Ccm(Controller *controller = NULL);
- char const *Name() const override;
- void Read(boost::property_tree::ptree const ¶ms) override;
- void SetSaturation(double saturation) override;
- void Initialise() override;
- void Prepare(Metadata *image_metadata) override;
+ char const *name() const override;
+ void read(boost::property_tree::ptree const ¶ms) override;
+ void setSaturation(double saturation) override;
+ void initialise() override;
+ void prepare(Metadata *imageMetadata) override;
private:
CcmConfig config_;
diff --git a/src/ipa/raspberrypi/controller/rpi/contrast.cpp b/src/ipa/raspberrypi/controller/rpi/contrast.cpp
index ae55aad56739..169837576678 100644
--- a/src/ipa/raspberrypi/controller/rpi/contrast.cpp
+++ b/src/ipa/raspberrypi/controller/rpi/contrast.cpp
@@ -31,40 +31,40 @@ Contrast::Contrast(Controller *controller)
{
}
-char const *Contrast::Name() const
+char const *Contrast::name() const
{
return NAME;
}
-void Contrast::Read(boost::property_tree::ptree const ¶ms)
+void Contrast::read(boost::property_tree::ptree const ¶ms)
{
// enable adaptive enhancement by default
- config_.ce_enable = params.get<int>("ce_enable", 1);
+ config_.ceEnable = params.get<int>("ce_enable", 1);
// the point near the bottom of the histogram to move
- config_.lo_histogram = params.get<double>("lo_histogram", 0.01);
+ config_.loHistogram = params.get<double>("lo_histogram", 0.01);
// where in the range to try and move it to
- config_.lo_level = params.get<double>("lo_level", 0.015);
+ config_.loLevel = params.get<double>("lo_level", 0.015);
// but don't move by more than this
- config_.lo_max = params.get<double>("lo_max", 500);
+ config_.loMax = params.get<double>("lo_max", 500);
// equivalent values for the top of the histogram...
- config_.hi_histogram = params.get<double>("hi_histogram", 0.95);
- config_.hi_level = params.get<double>("hi_level", 0.95);
- config_.hi_max = params.get<double>("hi_max", 2000);
- config_.gamma_curve.Read(params.get_child("gamma_curve"));
+ config_.hiHistogram = params.get<double>("hi_histogram", 0.95);
+ config_.hiLevel = params.get<double>("hi_level", 0.95);
+ config_.hiMax = params.get<double>("hi_max", 2000);
+ config_.gammaCurve.read(params.get_child("gamma_curve"));
}
-void Contrast::SetBrightness(double brightness)
+void Contrast::setBrightness(double brightness)
{
brightness_ = brightness;
}
-void Contrast::SetContrast(double contrast)
+void Contrast::setContrast(double contrast)
{
contrast_ = contrast;
}
-static void fill_in_status(ContrastStatus &status, double brightness,
- double contrast, Pwl &gamma_curve)
+static void fillInStatus(ContrastStatus &status, double brightness,
+ double contrast, Pwl &gammaCurve)
{
status.brightness = brightness;
status.contrast = contrast;
@@ -73,104 +73,100 @@ static void fill_in_status(ContrastStatus &status, double brightness,
: (i < 24 ? (i - 16) * 2048 + 16384
: (i - 24) * 4096 + 32768);
status.points[i].x = x;
- status.points[i].y = std::min(65535.0, gamma_curve.Eval(x));
+ status.points[i].y = std::min(65535.0, gammaCurve.eval(x));
}
status.points[CONTRAST_NUM_POINTS - 1].x = 65535;
status.points[CONTRAST_NUM_POINTS - 1].y = 65535;
}
-void Contrast::Initialise()
+void Contrast::initialise()
{
// Fill in some default values as Prepare will run before Process gets
// called.
- fill_in_status(status_, brightness_, contrast_, config_.gamma_curve);
+ fillInStatus(status_, brightness_, contrast_, config_.gammaCurve);
}
-void Contrast::Prepare(Metadata *image_metadata)
+void Contrast::prepare(Metadata *imageMetadata)
{
std::unique_lock<std::mutex> lock(mutex_);
- image_metadata->Set("contrast.status", status_);
+ imageMetadata->set("contrast.status", status_);
}
-Pwl compute_stretch_curve(Histogram const &histogram,
- ContrastConfig const &config)
+Pwl computeStretchCurve(Histogram const &histogram,
+ ContrastConfig const &config)
{
Pwl enhance;
- enhance.Append(0, 0);
+ enhance.append(0, 0);
// If the start of the histogram is rather empty, try to pull it down a
// bit.
- double hist_lo = histogram.Quantile(config.lo_histogram) *
- (65536 / NUM_HISTOGRAM_BINS);
- double level_lo = config.lo_level * 65536;
+ double histLo = histogram.quantile(config.loHistogram) *
+ (65536 / NUM_HISTOGRAM_BINS);
+ double levelLo = config.loLevel * 65536;
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)));
+ << "Move histogram point " << histLo << " to " << levelLo;
+ histLo = std::max(levelLo,
+ std::min(65535.0, std::min(histLo, levelLo + config.loMax)));
LOG(RPiContrast, Debug)
- << "Final values " << hist_lo << " -> " << level_lo;
- enhance.Append(hist_lo, level_lo);
+ << "Final values " << histLo << " -> " << levelLo;
+ enhance.append(histLo, levelLo);
// Keep the mid-point (median) in the same place, though, to limit the
// apparent amount of global brightness shift.
- double mid = histogram.Quantile(0.5) * (65536 / NUM_HISTOGRAM_BINS);
- enhance.Append(mid, mid);
+ double mid = histogram.quantile(0.5) * (65536 / NUM_HISTOGRAM_BINS);
+ enhance.append(mid, mid);
// If the top to the histogram is empty, try to pull the pixel values
// there up.
- double hist_hi = histogram.Quantile(config.hi_histogram) *
- (65536 / NUM_HISTOGRAM_BINS);
- double level_hi = config.hi_level * 65536;
+ double histHi = histogram.quantile(config.hiHistogram) *
+ (65536 / NUM_HISTOGRAM_BINS);
+ double levelHi = config.hiLevel * 65536;
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)));
+ << "Move histogram point " << histHi << " to " << levelHi;
+ histHi = std::min(levelHi,
+ std::max(0.0, std::max(histHi, levelHi - config.hiMax)));
LOG(RPiContrast, Debug)
- << "Final values " << hist_hi << " -> " << level_hi;
- enhance.Append(hist_hi, level_hi);
- enhance.Append(65535, 65535);
+ << "Final values " << histHi << " -> " << levelHi;
+ enhance.append(histHi, levelHi);
+ enhance.append(65535, 65535);
return enhance;
}
-Pwl apply_manual_contrast(Pwl const &gamma_curve, double brightness,
- double contrast)
+Pwl applyManualContrast(Pwl const &gammaCurve, double brightness,
+ double contrast)
{
- Pwl new_gamma_curve;
+ Pwl newGammaCurve;
LOG(RPiContrast, Debug)
<< "Manual brightness " << brightness << " contrast " << contrast;
- gamma_curve.Map([&](double x, double y) {
- new_gamma_curve.Append(
+ gammaCurve.map([&](double x, double y) {
+ newGammaCurve.append(
x, std::max(0.0, std::min(65535.0,
(y - 32768) * contrast +
32768 + brightness)));
});
- return new_gamma_curve;
+ return newGammaCurve;
}
-void Contrast::Process(StatisticsPtr &stats,
- [[maybe_unused]] Metadata *image_metadata)
+void Contrast::process(StatisticsPtr &stats,
+ [[maybe_unused]] Metadata *imageMetadata)
{
Histogram histogram(stats->hist[0].g_hist, NUM_HISTOGRAM_BINS);
// We look at the histogram and adjust the gamma curve in the following
// ways: 1. Adjust the gamma curve so as to pull the start of the
// histogram down, and possibly push the end up.
- Pwl gamma_curve = config_.gamma_curve;
- if (config_.ce_enable) {
- if (config_.lo_max != 0 || config_.hi_max != 0)
- gamma_curve = compute_stretch_curve(histogram, config_)
- .Compose(gamma_curve);
+ Pwl gammaCurve = config_.gammaCurve;
+ if (config_.ceEnable) {
+ if (config_.loMax != 0 || config_.hiMax != 0)
+ gammaCurve = computeStretchCurve(histogram, config_).compose(gammaCurve);
// We could apply other adjustments (e.g. partial equalisation)
// based on the histogram...?
}
// 2. Finally apply any manually selected brightness/contrast
// adjustment.
if (brightness_ != 0 || contrast_ != 1.0)
- gamma_curve = apply_manual_contrast(gamma_curve, brightness_,
- contrast_);
+ gammaCurve = applyManualContrast(gammaCurve, brightness_, contrast_);
// And fill in the status for output. Use more points towards the bottom
// of the curve.
ContrastStatus status;
- fill_in_status(status, brightness_, contrast_, gamma_curve);
+ fillInStatus(status, brightness_, contrast_, gammaCurve);
{
std::unique_lock<std::mutex> lock(mutex_);
status_ = status;
@@ -178,8 +174,8 @@ void Contrast::Process(StatisticsPtr &stats,
}
// Register algorithm with the system.
-static Algorithm *Create(Controller *controller)
+static Algorithm *create(Controller *controller)
{
return (Algorithm *)new Contrast(controller);
}
-static RegisterAlgorithm reg(NAME, &Create);
+static RegisterAlgorithm reg(NAME, &create);
diff --git a/src/ipa/raspberrypi/controller/rpi/contrast.hpp b/src/ipa/raspberrypi/controller/rpi/contrast.hpp
index 85624539a1da..5a6d530f63fd 100644
--- a/src/ipa/raspberrypi/controller/rpi/contrast.hpp
+++ b/src/ipa/raspberrypi/controller/rpi/contrast.hpp
@@ -17,27 +17,27 @@ namespace RPiController {
// Back End AWB.
struct ContrastConfig {
- bool ce_enable;
- double lo_histogram;
- double lo_level;
- double lo_max;
- double hi_histogram;
- double hi_level;
- double hi_max;
- Pwl gamma_curve;
+ bool ceEnable;
+ double loHistogram;
+ double loLevel;
+ double loMax;
+ double hiHistogram;
+ double hiLevel;
+ double hiMax;
+ Pwl gammaCurve;
};
class Contrast : public ContrastAlgorithm
{
public:
Contrast(Controller *controller = NULL);
- char const *Name() const override;
- void Read(boost::property_tree::ptree const ¶ms) override;
- void SetBrightness(double brightness) override;
- void SetContrast(double contrast) override;
- void Initialise() override;
- void Prepare(Metadata *image_metadata) override;
- void Process(StatisticsPtr &stats, Metadata *image_metadata) override;
+ char const *name() const override;
+ void read(boost::property_tree::ptree const ¶ms) override;
+ void setBrightness(double brightness) override;
+ void setContrast(double contrast) override;
+ void initialise() override;
+ void prepare(Metadata *imageMetadata) override;
+ void process(StatisticsPtr &stats, Metadata *imageMetadata) override;
private:
ContrastConfig config_;
diff --git a/src/ipa/raspberrypi/controller/rpi/dpc.cpp b/src/ipa/raspberrypi/controller/rpi/dpc.cpp
index 110f50560e76..42154cf300b8 100644
--- a/src/ipa/raspberrypi/controller/rpi/dpc.cpp
+++ b/src/ipa/raspberrypi/controller/rpi/dpc.cpp
@@ -24,30 +24,30 @@ Dpc::Dpc(Controller *controller)
{
}
-char const *Dpc::Name() const
+char const *Dpc::name() const
{
return NAME;
}
-void Dpc::Read(boost::property_tree::ptree const ¶ms)
+void Dpc::read(boost::property_tree::ptree const ¶ms)
{
config_.strength = params.get<int>("strength", 1);
if (config_.strength < 0 || config_.strength > 2)
throw std::runtime_error("Dpc: bad strength value");
}
-void Dpc::Prepare(Metadata *image_metadata)
+void Dpc::prepare(Metadata *imageMetadata)
{
- DpcStatus dpc_status = {};
+ DpcStatus dpcStatus = {};
// Should we vary this with lux level or analogue gain? TBD.
- dpc_status.strength = config_.strength;
- LOG(RPiDpc, Debug) << "strength " << dpc_status.strength;
- image_metadata->Set("dpc.status", dpc_status);
+ dpcStatus.strength = config_.strength;
+ LOG(RPiDpc, Debug) << "strength " << dpcStatus.strength;
+ imageMetadata->set("dpc.status", dpcStatus);
}
// Register algorithm with the system.
-static Algorithm *Create(Controller *controller)
+static Algorithm *create(Controller *controller)
{
return (Algorithm *)new Dpc(controller);
}
-static RegisterAlgorithm reg(NAME, &Create);
+static RegisterAlgorithm reg(NAME, &create);
diff --git a/src/ipa/raspberrypi/controller/rpi/dpc.hpp b/src/ipa/raspberrypi/controller/rpi/dpc.hpp
index d90285c4eb56..039310cc8d05 100644
--- a/src/ipa/raspberrypi/controller/rpi/dpc.hpp
+++ b/src/ipa/raspberrypi/controller/rpi/dpc.hpp
@@ -21,9 +21,9 @@ class Dpc : public Algorithm
{
public:
Dpc(Controller *controller);
- char const *Name() const override;
- void Read(boost::property_tree::ptree const ¶ms) override;
- void Prepare(Metadata *image_metadata) override;
+ char const *name() const override;
+ void read(boost::property_tree::ptree const ¶ms) override;
+ void prepare(Metadata *imageMetadata) override;
private:
DpcConfig config_;
--
2.25.1
More information about the libcamera-devel
mailing list