[libcamera-devel] [PATCH 11/17] ipa: raspberrypi: Change to C style code comments

Laurent Pinchart laurent.pinchart at ideasonboard.com
Wed Jul 27 03:43:55 CEST 2022


Hi Naush,

Thank you for the patch.

On Tue, Jul 26, 2022 at 01:45:43PM +0100, Naushir Patuck wrote:
> As part of the on-going refactor efforts for the source files in
> src/ipa/raspberrypi/, switch all C++ style comments to C style comments.
> 
> Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
> Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> ---
>  src/ipa/raspberrypi/cam_helper.hpp            |  98 ++++---
>  .../raspberrypi/controller/agc_algorithm.hpp  |   4 +-
>  src/ipa/raspberrypi/controller/agc_status.h   |  18 +-
>  src/ipa/raspberrypi/controller/algorithm.cpp  |   2 +-
>  src/ipa/raspberrypi/controller/algorithm.hpp  |  16 +-
>  src/ipa/raspberrypi/controller/alsc_status.h  |   6 +-
>  .../raspberrypi/controller/awb_algorithm.hpp  |   4 +-
>  src/ipa/raspberrypi/controller/awb_status.h   |   6 +-
>  .../controller/black_level_status.h           |   4 +-
>  src/ipa/raspberrypi/controller/camera_mode.h  |  30 +-
>  .../raspberrypi/controller/ccm_algorithm.hpp  |   4 +-
>  src/ipa/raspberrypi/controller/ccm_status.h   |   2 +-
>  .../controller/contrast_algorithm.hpp         |   4 +-
>  .../raspberrypi/controller/contrast_status.h  |   6 +-
>  src/ipa/raspberrypi/controller/controller.cpp |   6 +-
>  src/ipa/raspberrypi/controller/controller.hpp |  20 +-
>  .../controller/denoise_algorithm.hpp          |   4 +-
>  .../raspberrypi/controller/denoise_status.h   |   2 +-
>  src/ipa/raspberrypi/controller/dpc_status.h   |   4 +-
>  src/ipa/raspberrypi/controller/focus_status.h |   8 +-
>  src/ipa/raspberrypi/controller/geq_status.h   |   2 +-
>  src/ipa/raspberrypi/controller/histogram.cpp  |   8 +-
>  src/ipa/raspberrypi/controller/histogram.hpp  |  18 +-
>  src/ipa/raspberrypi/controller/lux_status.h   |  18 +-
>  src/ipa/raspberrypi/controller/metadata.hpp   |  20 +-
>  src/ipa/raspberrypi/controller/noise_status.h |   2 +-
>  src/ipa/raspberrypi/controller/pwl.cpp        |  40 ++-
>  src/ipa/raspberrypi/controller/pwl.hpp        |  60 ++--
>  src/ipa/raspberrypi/controller/rpi/agc.cpp    | 269 +++++++++++-------
>  src/ipa/raspberrypi/controller/rpi/agc.hpp    |  24 +-
>  src/ipa/raspberrypi/controller/rpi/alsc.cpp   | 180 +++++++-----
>  src/ipa/raspberrypi/controller/rpi/alsc.hpp   |  50 ++--
>  src/ipa/raspberrypi/controller/rpi/awb.cpp    | 192 ++++++++-----
>  src/ipa/raspberrypi/controller/rpi/awb.hpp    | 112 ++++----
>  .../controller/rpi/black_level.cpp            |  10 +-
>  .../controller/rpi/black_level.hpp            |   4 +-
>  src/ipa/raspberrypi/controller/rpi/ccm.cpp    |  20 +-
>  src/ipa/raspberrypi/controller/rpi/ccm.hpp    |   4 +-
>  .../raspberrypi/controller/rpi/contrast.cpp   |  74 +++--
>  .../raspberrypi/controller/rpi/contrast.hpp   |   8 +-
>  src/ipa/raspberrypi/controller/rpi/dpc.cpp    |  10 +-
>  src/ipa/raspberrypi/controller/rpi/dpc.hpp    |   4 +-
>  src/ipa/raspberrypi/controller/rpi/geq.cpp    |  10 +-
>  src/ipa/raspberrypi/controller/rpi/geq.hpp    |   6 +-
>  src/ipa/raspberrypi/controller/rpi/lux.cpp    |  16 +-
>  src/ipa/raspberrypi/controller/rpi/lux.hpp    |  14 +-
>  src/ipa/raspberrypi/controller/rpi/noise.cpp  |  24 +-
>  src/ipa/raspberrypi/controller/rpi/noise.hpp  |   6 +-
>  src/ipa/raspberrypi/controller/rpi/sdn.cpp    |  12 +-
>  src/ipa/raspberrypi/controller/rpi/sdn.hpp    |   4 +-
>  .../raspberrypi/controller/rpi/sharpen.cpp    |  32 ++-
>  .../raspberrypi/controller/rpi/sharpen.hpp    |   4 +-
>  .../controller/sharpen_algorithm.hpp          |   4 +-
>  .../raspberrypi/controller/sharpen_status.h   |  10 +-
>  src/ipa/raspberrypi/md_parser.hpp             |   2 +-
>  55 files changed, 890 insertions(+), 631 deletions(-)

[snip]

> diff --git a/src/ipa/raspberrypi/controller/rpi/awb.cpp b/src/ipa/raspberrypi/controller/rpi/awb.cpp
> index a305237f31fb..4a7bc869cee4 100644
> --- a/src/ipa/raspberrypi/controller/rpi/awb.cpp
> +++ b/src/ipa/raspberrypi/controller/rpi/awb.cpp

[snip]

> @@ -383,14 +401,16 @@ void Awb::prepareStats()
>  
>  double Awb::computeDelta2Sum(double gainR, double gainB)
>  {
> -	// Compute the sum of the squared colour error (non-greyness) as it
> -	// appears in the log likelihood equation.
> +	/*
> +	 * Compute the sum of the squared colour error (non-greyness) as it
> +	 * appears in the log likelihood equation.
> +	 */
>  	double delta2Sum = 0;
>  	for (auto &z : zones_) {
>  		double deltaR = gainR * z.R - 1 - config_.whitepointR;
>  		double deltaB = gainB * z.B - 1 - config_.whitepointB;
>  		double delta2 = deltaR * deltaR + deltaB * deltaB;
> -		//LOG(RPiAwb, Debug) << "delta_r " << delta_r << " delta_b " << delta_b << " delta2 " << delta2;
> +		/*LOG(RPiAwb, Debug) << "delta_r " << delta_r << " delta_b " << delta_b << " delta2 " << delta2; */

Missing space after /*.

>  		delta2 = std::min(delta2, config_.deltaLimit);
>  		delta2Sum += delta2;
>  	}

[snip]

> diff --git a/src/ipa/raspberrypi/controller/rpi/awb.hpp b/src/ipa/raspberrypi/controller/rpi/awb.hpp
> index 91251d6be2da..597f3182da44 100644
> --- a/src/ipa/raspberrypi/controller/rpi/awb.hpp
> +++ b/src/ipa/raspberrypi/controller/rpi/awb.hpp
> @@ -16,63 +16,73 @@
>  
>  namespace RPiController {
>  
> -// Control algorithm to perform AWB calculations.
> +/* Control algorithm to perform AWB calculations. */
>  
>  struct AwbMode {
>  	void read(boost::property_tree::ptree const &params);
> -	double ctLo; // low CT value for search
> -	double ctHi; // high CT value for search
> +	double ctLo; /* low CT value for search */
> +	double ctHi; /* high CT value for search */
>  };
>  
>  struct AwbPrior {
>  	void read(boost::property_tree::ptree const &params);
> -	double lux; // lux level
> -	Pwl prior; // maps CT to prior log likelihood for this lux level
> +	double lux; /* lux level */
> +	Pwl prior; /* maps CT to prior log likelihood for this lux level */
>  };
>  
>  struct AwbConfig {
>  	AwbConfig() : defaultMode(nullptr) {}
>  	void read(boost::property_tree::ptree const &params);
> -	// Only repeat the AWB calculation every "this many" frames
> +	/* Only repeat the AWB calculation every "this many" frames */
>  	uint16_t framePeriod;
> -	// number of initial frames for which speed taken as 1.0 (maximum)
> +	/* number of initial frames for which speed taken as 1.0 (maximum) */
>  	uint16_t startupFrames;
> -	unsigned int convergenceFrames; // approx number of frames to converge
> -	double speed; // IIR filter speed applied to algorithm results
> -	bool fast; // "fast" mode uses a 16x16 rather than 32x32 grid
> -	Pwl ctR; // function maps CT to r (= R/G)
> -	Pwl ctB; // function maps CT to b (= B/G)
> -	// table of illuminant priors at different lux levels
> +	unsigned int convergenceFrames; /* approx number of frames to converge */
> +	double speed; /* IIR filter speed applied to algorithm results */
> +	bool fast; /* "fast" mode uses a 16x16 rather than 32x32 grid */
> +	Pwl ctR; /* function maps CT to r (= R/G) */
> +	Pwl ctB; /*
> +	Pwl ctB;  * function maps CT to b (= B/G)
> +	 * table of illuminant priors at different lux levels
> +	 */

This doesn't look right.

>  	std::vector<AwbPrior> priors;
> -	// AWB "modes" (determines the search range)
> +	/* AWB "modes" (determines the search range) */
>  	std::map<std::string, AwbMode> modes;
> -	AwbMode *defaultMode; // mode used if no mode selected
> -	// minimum proportion of pixels counted within AWB region for it to be
> -	// "useful"
> +	AwbMode *defaultMode; /* mode used if no mode selected */
> +	/*
> +	 * minimum proportion of pixels counted within AWB region for it to be
> +	 * "useful"
> +	 */
>  	double minPixels;
> -	// minimum G value of those pixels, to be regarded a "useful"
> +	/* minimum G value of those pixels, to be regarded a "useful" */
>  	uint16_t minG;
> -	// number of AWB regions that must be "useful" in order to do the AWB
> -	// calculation
> +	/*
> +	 * number of AWB regions that must be "useful" in order to do the AWB
> +	 * calculation
> +	 */
>  	uint32_t minRegions;
> -	// clamp on colour error term (so as not to penalise non-grey excessively)
> +	/* clamp on colour error term (so as not to penalise non-grey excessively) */
>  	double deltaLimit;
> -	// step size control in coarse search
> +	/* step size control in coarse search */
>  	double coarseStep;
> -	// how far to wander off CT curve towards "more purple"
> +	/* how far to wander off CT curve towards "more purple" */
>  	double transversePos;
> -	// how far to wander off CT curve towards "more green"
> +	/* how far to wander off CT curve towards "more green" */
>  	double transverseNeg;
> -	// red sensitivity ratio (set to canonical sensor's R/G divided by this
> -	// sensor's R/G)
> +	/*
> +	 * red sensitivity ratio (set to canonical sensor's R/G divided by this
> +	 * sensor's R/G)
> +	 */
>  	double sensitivityR;
> -	// blue sensitivity ratio (set to canonical sensor's B/G divided by this
> -	// sensor's B/G)
> +	/*
> +	 * blue sensitivity ratio (set to canonical sensor's B/G divided by this
> +	 * sensor's B/G)
> +	 */
>  	double sensitivityB;
> -	// The whitepoint (which we normally "aim" for) can be moved.
> +	/* The whitepoint (which we normally "aim" for) can be moved. */
>  	double whitepointR;
>  	double whitepointB;
> -	bool bayes; // use Bayesian algorithm
> +	bool bayes; /* use Bayesian algorithm */
>  };
>  
>  class Awb : public AwbAlgorithm

[snip]

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list