[libcamera-devel,03/15] DNI: ipa: raspberrypi: Code refactoring to match style guidelines
diff mbox series

Message ID 20220725134639.4572-4-naush@raspberrypi.com
State Superseded
Headers show
Series
  • Raspberry Pi IPA code refactor
Related show

Commit Message

Naushir Patuck July 25, 2022, 1:46 p.m. UTC
Refactor the source files under src/ipa/raspberrypi/controller/a* 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@raspberrypi.com>
---
 .../raspberrypi/controller/agc_algorithm.hpp  | 19 +++++++-------
 src/ipa/raspberrypi/controller/agc_status.h   | 22 ++++++++--------
 src/ipa/raspberrypi/controller/algorithm.cpp  | 20 +++++++-------
 src/ipa/raspberrypi/controller/algorithm.hpp  | 26 +++++++++----------
 .../raspberrypi/controller/awb_algorithm.hpp  |  6 ++---
 src/ipa/raspberrypi/controller/awb_status.h   |  8 +++---
 6 files changed, 51 insertions(+), 50 deletions(-)

Comments

Laurent Pinchart July 25, 2022, 7:50 p.m. UTC | #1
Hi Naush,

Thank you for the patch.

On Mon, Jul 25, 2022 at 02:46:27PM +0100, Naushir Patuck via libcamera-devel wrote:
> Refactor the source files under src/ipa/raspberrypi/controller/a* 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@raspberrypi.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  .../raspberrypi/controller/agc_algorithm.hpp  | 19 +++++++-------
>  src/ipa/raspberrypi/controller/agc_status.h   | 22 ++++++++--------
>  src/ipa/raspberrypi/controller/algorithm.cpp  | 20 +++++++-------
>  src/ipa/raspberrypi/controller/algorithm.hpp  | 26 +++++++++----------
>  .../raspberrypi/controller/awb_algorithm.hpp  |  6 ++---
>  src/ipa/raspberrypi/controller/awb_status.h   |  8 +++---
>  6 files changed, 51 insertions(+), 50 deletions(-)

Patch
diff mbox series

diff --git a/src/ipa/raspberrypi/controller/agc_algorithm.hpp b/src/ipa/raspberrypi/controller/agc_algorithm.hpp
index 61595ea2b006..51900b687778 100644
--- a/src/ipa/raspberrypi/controller/agc_algorithm.hpp
+++ b/src/ipa/raspberrypi/controller/agc_algorithm.hpp
@@ -17,16 +17,15 @@  class AgcAlgorithm : public Algorithm
 public:
 	AgcAlgorithm(Controller *controller) : Algorithm(controller) {}
 	// An AGC algorithm must provide the following:
-	virtual unsigned int GetConvergenceFrames() const = 0;
-	virtual void SetEv(double ev) = 0;
-	virtual void SetFlickerPeriod(libcamera::utils::Duration flicker_period) = 0;
-	virtual void SetFixedShutter(libcamera::utils::Duration fixed_shutter) = 0;
-	virtual void SetMaxShutter(libcamera::utils::Duration max_shutter) = 0;
-	virtual void SetFixedAnalogueGain(double fixed_analogue_gain) = 0;
-	virtual void SetMeteringMode(std::string const &metering_mode_name) = 0;
-	virtual void SetExposureMode(std::string const &exposure_mode_name) = 0;
-	virtual void
-	SetConstraintMode(std::string const &contraint_mode_name) = 0;
+	virtual unsigned int getConvergenceFrames() const = 0;
+	virtual void setEv(double ev) = 0;
+	virtual void setFlickerPeriod(libcamera::utils::Duration flickerPeriod) = 0;
+	virtual void setFixedShutter(libcamera::utils::Duration fixedShutter) = 0;
+	virtual void setMaxShutter(libcamera::utils::Duration maxShutter) = 0;
+	virtual void setFixedAnalogueGain(double fixedAnalogueGain) = 0;
+	virtual void setMeteringMode(std::string const &meteringModeName) = 0;
+	virtual void setExposureMode(std::string const &exposureModeName) = 0;
+	virtual void setConstraintMode(std::string const &contraintModeName) = 0;
 };
 
 } // namespace RPiController
diff --git a/src/ipa/raspberrypi/controller/agc_status.h b/src/ipa/raspberrypi/controller/agc_status.h
index 20cb1b624b33..5d04c61d04bd 100644
--- a/src/ipa/raspberrypi/controller/agc_status.h
+++ b/src/ipa/raspberrypi/controller/agc_status.h
@@ -20,19 +20,19 @@  extern "C" {
 // ignored until then.
 
 struct AgcStatus {
-	libcamera::utils::Duration total_exposure_value; // value for all exposure and gain for this image
-	libcamera::utils::Duration target_exposure_value; // (unfiltered) target total exposure AGC is aiming for
-	libcamera::utils::Duration shutter_time;
-	double analogue_gain;
-	char exposure_mode[32];
+	libcamera::utils::Duration totalExposureValue; // value for all exposure and gain for this image
+	libcamera::utils::Duration targetExposureValue; // (unfiltered) target total exposure AGC is aiming for
+	libcamera::utils::Duration shutterTime;
+	double analogueGain;
+	char exposureMode[32];
 	char constraint_mode[32];
-	char metering_mode[32];
+	char meteringMode[32];
 	double ev;
-	libcamera::utils::Duration flicker_period;
-	int floating_region_enable;
-	libcamera::utils::Duration fixed_shutter;
-	double fixed_analogue_gain;
-	double digital_gain;
+	libcamera::utils::Duration flickerPeriod;
+	int floatingRegionEnable;
+	libcamera::utils::Duration fixedShutter;
+	double fixedAnalogueGain;
+	double digitalGain;
 	int locked;
 };
 
diff --git a/src/ipa/raspberrypi/controller/algorithm.cpp b/src/ipa/raspberrypi/controller/algorithm.cpp
index 43ad0a2be222..cfcd18a96c93 100644
--- a/src/ipa/raspberrypi/controller/algorithm.cpp
+++ b/src/ipa/raspberrypi/controller/algorithm.cpp
@@ -9,36 +9,38 @@ 
 
 using namespace RPiController;
 
-void Algorithm::Read([[maybe_unused]] boost::property_tree::ptree const &params)
+void Algorithm::read([[maybe_unused]] boost::property_tree::ptree const &params)
 {
 }
 
-void Algorithm::Initialise() {}
+void Algorithm::initialise()
+{
+}
 
-void Algorithm::SwitchMode([[maybe_unused]] CameraMode const &camera_mode,
+void Algorithm::switchMode([[maybe_unused]] CameraMode const &cameraMode,
 			   [[maybe_unused]] Metadata *metadata)
 {
 }
 
-void Algorithm::Prepare([[maybe_unused]] Metadata *image_metadata)
+void Algorithm::prepare([[maybe_unused]] Metadata *imageMetadata)
 {
 }
 
-void Algorithm::Process([[maybe_unused]] StatisticsPtr &stats,
-			[[maybe_unused]] Metadata *image_metadata)
+void Algorithm::process([[maybe_unused]] StatisticsPtr &stats,
+			[[maybe_unused]] Metadata *imageMetadata)
 {
 }
 
 // For registering algorithms with the system:
 
 static std::map<std::string, AlgoCreateFunc> algorithms;
-std::map<std::string, AlgoCreateFunc> const &RPiController::GetAlgorithms()
+std::map<std::string, AlgoCreateFunc> const &RPiController::getAlgorithms()
 {
 	return algorithms;
 }
 
 RegisterAlgorithm::RegisterAlgorithm(char const *name,
-				     AlgoCreateFunc create_func)
+				     AlgoCreateFunc createFunc)
 {
-	algorithms[std::string(name)] = create_func;
+	algorithms[std::string(name)] = createFunc;
 }
diff --git a/src/ipa/raspberrypi/controller/algorithm.hpp b/src/ipa/raspberrypi/controller/algorithm.hpp
index 5123c87bab34..a33b14da2726 100644
--- a/src/ipa/raspberrypi/controller/algorithm.hpp
+++ b/src/ipa/raspberrypi/controller/algorithm.hpp
@@ -29,18 +29,18 @@  public:
 	{
 	}
 	virtual ~Algorithm() = default;
-	virtual char const *Name() const = 0;
-	virtual bool IsPaused() const { return paused_; }
-	virtual void Pause() { paused_ = true; }
-	virtual void Resume() { paused_ = false; }
-	virtual void Read(boost::property_tree::ptree const &params);
-	virtual void Initialise();
-	virtual void SwitchMode(CameraMode const &camera_mode, Metadata *metadata);
-	virtual void Prepare(Metadata *image_metadata);
-	virtual void Process(StatisticsPtr &stats, Metadata *image_metadata);
-	Metadata &GetGlobalMetadata() const
+	virtual char const *name() const = 0;
+	virtual bool isPaused() const { return paused_; }
+	virtual void pause() { paused_ = true; }
+	virtual void resume() { paused_ = false; }
+	virtual void read(boost::property_tree::ptree const &params);
+	virtual void initialise();
+	virtual void switchMode(CameraMode const &cameraMode, Metadata *metadata);
+	virtual void prepare(Metadata *imageMetadata);
+	virtual void process(StatisticsPtr &stats, Metadata *imageMetadata);
+	Metadata &getGlobalMetadata() const
 	{
-		return controller_->GetGlobalMetadata();
+		return controller_->getGlobalMetadata();
 	}
 
 private:
@@ -53,8 +53,8 @@  private:
 
 typedef Algorithm *(*AlgoCreateFunc)(Controller *controller);
 struct RegisterAlgorithm {
-	RegisterAlgorithm(char const *name, AlgoCreateFunc create_func);
+	RegisterAlgorithm(char const *name, AlgoCreateFunc createFunc);
 };
-std::map<std::string, AlgoCreateFunc> const &GetAlgorithms();
+std::map<std::string, AlgoCreateFunc> const &getAlgorithms();
 
 } // namespace RPiController
diff --git a/src/ipa/raspberrypi/controller/awb_algorithm.hpp b/src/ipa/raspberrypi/controller/awb_algorithm.hpp
index 96f88afc3a8d..c5d2ca90263c 100644
--- a/src/ipa/raspberrypi/controller/awb_algorithm.hpp
+++ b/src/ipa/raspberrypi/controller/awb_algorithm.hpp
@@ -15,9 +15,9 @@  class AwbAlgorithm : public Algorithm
 public:
 	AwbAlgorithm(Controller *controller) : Algorithm(controller) {}
 	// An AWB algorithm must provide the following:
-	virtual unsigned int GetConvergenceFrames() const = 0;
-	virtual void SetMode(std::string const &mode_name) = 0;
-	virtual void SetManualGains(double manual_r, double manual_b) = 0;
+	virtual unsigned int getConvergenceFrames() const = 0;
+	virtual void setMode(std::string const &modeName) = 0;
+	virtual void setManualGains(double manualR, double manualB) = 0;
 };
 
 } // namespace RPiController
diff --git a/src/ipa/raspberrypi/controller/awb_status.h b/src/ipa/raspberrypi/controller/awb_status.h
index 46d7c842299a..bc428ed3206a 100644
--- a/src/ipa/raspberrypi/controller/awb_status.h
+++ b/src/ipa/raspberrypi/controller/awb_status.h
@@ -15,10 +15,10 @@  extern "C" {
 
 struct AwbStatus {
 	char mode[32];
-	double temperature_K;
-	double gain_r;
-	double gain_g;
-	double gain_b;
+	double temperatureK;
+	double gainR;
+	double gainG;
+	double gainB;
 };
 
 #ifdef __cplusplus