diff --git a/cpp/sopt/utilities.cc b/cpp/sopt/utilities.cc index b9e0514b6..b77f2ef93 100644 --- a/cpp/sopt/utilities.cc +++ b/cpp/sopt/utilities.cc @@ -20,7 +20,7 @@ double convert_to_greyscale(uint32_t &pixel) { //! Converts greyscale double value to RGBA uint32_t convert_from_greyscale(double pixel) { uint32_t result = 0; - uint8_t *ptr = (uint8_t *)&result; + auto *ptr = (uint8_t *)&result; auto const g = [](double p) -> uint8_t { auto const scaled = 255e0 * p; if (scaled < 0) return 0; @@ -48,12 +48,12 @@ Image<> read_tiff(std::string const &filename) { SOPT_LOW_LOG("- image size {}, {} ", width, height); Image<> result = Image<>::Zero(height, width); - uint32_t *raster = static_cast(_TIFFmalloc(width * height * sizeof(uint32_t))); + auto *raster = static_cast(_TIFFmalloc(width * height * sizeof(uint32_t))); if (not raster) SOPT_THROW("Could not allocate memory to read file ") << filename; if (not TIFFReadRGBAImage(tif, width, height, raster, 0)) SOPT_THROW("Could not read file ") << filename; - uint32_t *pixel = (uint32_t *)raster; + auto *pixel = (uint32_t *)raster; for (uint32_t i(0); i < height; ++i) for (uint32_t j(0); j < width; ++j, ++pixel) result(i, j) = convert_to_greyscale(*pixel); diff --git a/cpp/sopt/wavelets/direct.h b/cpp/sopt/wavelets/direct.h index ab0d0562d..c5631b237 100644 --- a/cpp/sopt/wavelets/direct.h +++ b/cpp/sopt/wavelets/direct.h @@ -19,7 +19,7 @@ template typename std::enable_if::type direct_transform_impl( Eigen::ArrayBase const &coeffs_, Eigen::ArrayBase const &signal, WaveletData const &wavelet) { - Eigen::ArrayBase &coeffs = const_cast &>(coeffs_); + auto &coeffs = const_cast &>(coeffs_); assert(coeffs.size() == signal.size()); assert(wavelet.direct_filter.low.size() == wavelet.direct_filter.high.size()); @@ -36,8 +36,8 @@ template typename std::enable_if::type direct_transform_impl( Eigen::ArrayBase const &coeffs_, Eigen::ArrayBase const &signal_, WaveletData const &wavelet) { - Eigen::ArrayBase &coeffs = const_cast &>(coeffs_); - Eigen::ArrayBase &signal = const_cast &>(signal_); + auto &coeffs = const_cast &>(coeffs_); + auto &signal = const_cast &>(signal_); assert(coeffs.rows() == signal.rows()); assert(coeffs.cols() == signal.cols()); assert(wavelet.direct_filter.low.size() == wavelet.direct_filter.high.size()); @@ -83,7 +83,7 @@ typename std::enable_if::type direct_transf WaveletData const &wavelet) { assert(coeffs_.rows() == signal.rows()); assert(coeffs_.cols() == signal.cols()); - Eigen::ArrayBase &coeffs = const_cast &>(coeffs_); + auto &coeffs = const_cast &>(coeffs_); if (levels == 0) { coeffs = signal; diff --git a/cpp/sopt/wavelets/indirect.h b/cpp/sopt/wavelets/indirect.h index a74014f90..0d6aec474 100644 --- a/cpp/sopt/wavelets/indirect.h +++ b/cpp/sopt/wavelets/indirect.h @@ -19,7 +19,7 @@ template typename std::enable_if::type indirect_transform_impl( Eigen::ArrayBase const &coeffs, Eigen::ArrayBase const &signal_, WaveletData const &wavelet) { - Eigen::ArrayBase &signal = const_cast &>(signal_); + auto &signal = const_cast &>(signal_); assert(coeffs.size() == signal.size()); assert(coeffs.size() % 2 == 0); @@ -35,8 +35,8 @@ template typename std::enable_if::type indirect_transform_impl( Eigen::ArrayBase const &coeffs_, Eigen::ArrayBase const &signal_, WaveletData const &wavelet) { - Eigen::ArrayBase &coeffs = const_cast &>(coeffs_); - Eigen::ArrayBase &signal = const_cast &>(signal_); + auto &coeffs = const_cast &>(coeffs_); + auto &signal = const_cast &>(signal_); assert(coeffs.rows() == signal.rows() and coeffs.cols() == signal.cols()); assert(coeffs.rows() % 2 == 0 and coeffs.cols() % 2 == 0); @@ -82,8 +82,8 @@ template typename std::enable_if::type indirect_transform( Eigen::ArrayBase const &coeffs_, Eigen::ArrayBase const &signal_, t_uint levels, WaveletData const &wavelet) { - Eigen::ArrayBase &coeffs = const_cast &>(coeffs_); - Eigen::ArrayBase &signal = const_cast &>(signal_); + auto &coeffs = const_cast &>(coeffs_); + auto &signal = const_cast &>(signal_); assert(coeffs.rows() == signal.rows()); assert(coeffs.cols() == signal.cols()); assert(coeffs.size() % (1u << levels) == 0);