ipa: raspberrypi: Replace void cast with [[maybe_unused]]

The standard way in C++17 to specify that a function or function
argument may be unused it to specify the [[maybe_unused]] attribute.
Replace manual void casts to silence compiler warnings.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
Laurent Pinchart 2020-08-22 18:53:54 +03:00
parent dbafe16da7
commit de012767e7
5 changed files with 15 additions and 23 deletions

View file

@ -9,28 +9,24 @@
using namespace RPi;
void Algorithm::Read(boost::property_tree::ptree const &params)
void Algorithm::Read([[maybe_unused]] boost::property_tree::ptree const &params)
{
(void)params;
}
void Algorithm::Initialise() {}
void Algorithm::SwitchMode(CameraMode const &camera_mode, Metadata *metadata)
void Algorithm::SwitchMode([[maybe_unused]] CameraMode const &camera_mode,
[[maybe_unused]] Metadata *metadata)
{
(void)camera_mode;
(void)metadata;
}
void Algorithm::Prepare(Metadata *image_metadata)
void Algorithm::Prepare([[maybe_unused]] Metadata *image_metadata)
{
(void)image_metadata;
}
void Algorithm::Process(StatisticsPtr &stats, Metadata *image_metadata)
void Algorithm::Process([[maybe_unused]] StatisticsPtr &stats,
[[maybe_unused]] Metadata *image_metadata)
{
(void)stats;
(void)image_metadata;
}
// For registering algorithms with the system:

View file

@ -200,10 +200,9 @@ static bool compare_modes(CameraMode const &cm0, CameraMode const &cm1)
top_diff > threshold_y || bottom_diff > threshold_y;
}
void Alsc::SwitchMode(CameraMode const &camera_mode, Metadata *metadata)
void Alsc::SwitchMode(CameraMode const &camera_mode,
[[maybe_unused]] Metadata *metadata)
{
(void)metadata;
// We're going to start over with the tables if there's any "significant"
// change.
bool reset_tables = first_time_ || compare_modes(camera_mode_, camera_mode);
@ -490,7 +489,7 @@ void compensate_lambdas_for_cal(double const cal_table[XY],
new_lambdas[i] /= min_new_lambda;
}
static void print_cal_table(double const C[XY])
[[maybe_unused]] static void print_cal_table(double const C[XY])
{
printf("table: [\n");
for (int j = 0; j < Y; j++) {
@ -710,7 +709,6 @@ void Alsc::doAlsc()
resample_cal_table(cal_table_tmp, camera_mode_, cal_table_b);
// You could print out the cal tables for this image here, if you're
// tuning the algorithm...
(void)print_cal_table;
// Apply any calibration to the statistics, so the adaptive algorithm
// makes only the extra adjustments.
apply_cal_table(cal_table_r, Cr);

View file

@ -137,9 +137,9 @@ Pwl apply_manual_contrast(Pwl const &gamma_curve, double brightness,
return new_gamma_curve;
}
void Contrast::Process(StatisticsPtr &stats, Metadata *image_metadata)
void Contrast::Process(StatisticsPtr &stats,
[[maybe_unused]] Metadata *image_metadata)
{
(void)image_metadata;
double brightness = brightness_, contrast = contrast_;
Histogram histogram(stats->hist[0].g_hist, NUM_HISTOGRAM_BINS);
// We look at the histogram and adjust the gamma curve in the following

View file

@ -27,10 +27,9 @@ char const *Noise::Name() const
return NAME;
}
void Noise::SwitchMode(CameraMode const &camera_mode, Metadata *metadata)
void Noise::SwitchMode(CameraMode const &camera_mode,
[[maybe_unused]] Metadata *metadata)
{
(void)metadata;
// For example, we would expect a 2x2 binned mode to have a "noise
// factor" of sqrt(2x2) = 2. (can't be less than one, right?)
mode_factor_ = std::max(1.0, camera_mode.noise_factor);

View file

@ -26,10 +26,9 @@ char const *Sharpen::Name() const
return NAME;
}
void Sharpen::SwitchMode(CameraMode const &camera_mode, Metadata *metadata)
void Sharpen::SwitchMode(CameraMode const &camera_mode,
[[maybe_unused]] Metadata *metadata)
{
(void)metadata;
// can't be less than one, right?
mode_factor_ = std::max(1.0, camera_mode.noise_factor);
}