ipa: rpi: Replace last users of math.h
As described in the coding style document, libcamera favours <cmath> over <math.h>. Replace the last few occurrences of the latter with the former in the Raspberry Pi IPA and adapt the code accordingly. In some cases, the <math.h> include is simply dropped as it isn't needed. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include "cam_helper.h"
|
||||
#include "math.h"
|
||||
|
||||
using namespace RPiController;
|
||||
|
||||
class CamHelperImx283 : public CamHelper
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* camera helper for imx290 sensor
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
#include "cam_helper.h"
|
||||
|
||||
@@ -37,13 +37,13 @@ CamHelperImx290::CamHelperImx290()
|
||||
|
||||
uint32_t CamHelperImx290::gainCode(double gain) const
|
||||
{
|
||||
int code = 66.6667 * log10(gain);
|
||||
int code = 66.6667 * std::log10(gain);
|
||||
return std::max(0, std::min(code, 0xf0));
|
||||
}
|
||||
|
||||
double CamHelperImx290::gain(uint32_t gainCode) const
|
||||
{
|
||||
return pow(10, 0.015 * gainCode);
|
||||
return std::pow(10, 0.015 * gainCode);
|
||||
}
|
||||
|
||||
void CamHelperImx290::getDelays(int &exposureDelay, int &gainDelay,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* histogram calculations
|
||||
*/
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "histogram.h"
|
||||
@@ -49,9 +49,9 @@ double Histogram::interBinMean(double binLo, double binHi) const
|
||||
{
|
||||
assert(binHi >= binLo);
|
||||
double sumBinFreq = 0, cumulFreq = 0;
|
||||
for (double binNext = floor(binLo) + 1.0; binNext <= ceil(binHi);
|
||||
for (double binNext = std::floor(binLo) + 1.0; binNext <= std::ceil(binHi);
|
||||
binLo = binNext, binNext += 1.0) {
|
||||
int bin = floor(binLo);
|
||||
int bin = std::floor(binLo);
|
||||
double freq = (cumulative_[bin + 1] - cumulative_[bin]) *
|
||||
(std::min(binNext, binHi) - binLo);
|
||||
sumBinFreq += bin * freq;
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
|
||||
#include "af.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <iomanip>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <libcamera/base/log.h>
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
* black level control algorithm
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <libcamera/base/log.h>
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*
|
||||
* Lux control algorithm
|
||||
*/
|
||||
#include <math.h>
|
||||
|
||||
#include <libcamera/base/log.h>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Noise control algorithm
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
#include <libcamera/base/log.h>
|
||||
|
||||
@@ -69,7 +69,7 @@ void Noise::prepare(Metadata *imageMetadata)
|
||||
* make some adjustments based on the camera mode (such as
|
||||
* binning), if we knew how to discover it...
|
||||
*/
|
||||
double factor = sqrt(deviceStatus.analogueGain) / modeFactor_;
|
||||
double factor = std::sqrt(deviceStatus.analogueGain) / modeFactor_;
|
||||
struct NoiseStatus status;
|
||||
status.noiseConstant = referenceConstant_ * factor;
|
||||
status.noiseSlope = referenceSlope_ * factor;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* sharpening control algorithm
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
#include <libcamera/base/log.h>
|
||||
|
||||
@@ -68,7 +68,7 @@ void Sharpen::prepare(Metadata *imageMetadata)
|
||||
* we adjust the limit and threshold less aggressively. Using a sqrt
|
||||
* function is an arbitrary but gentle way of accomplishing this.
|
||||
*/
|
||||
double userStrengthSqrt = sqrt(userStrength_);
|
||||
double userStrengthSqrt = std::sqrt(userStrength_);
|
||||
struct SharpenStatus status;
|
||||
/*
|
||||
* Binned modes seem to need the sharpening toned down with this
|
||||
|
||||
Reference in New Issue
Block a user