diff --git a/SperrConfig.h.in b/SperrConfig.h.in index 8a2fb5b1..f2e9b733 100644 --- a/SperrConfig.h.in +++ b/SperrConfig.h.in @@ -5,8 +5,8 @@ #define SPERR_VERSION_MINOR @SPERR_VERSION_MINOR@ #define SPERR_VERSION_PATCH @SPERR_VERSION_PATCH@ -static const char* SPERR_GIT_SHA1 = "@GIT_SHA1@"; -static const char* SPERR_GIT_BRANCH = "@GIT_BRANCH@"; +#define SPERR_GIT_SHA1 "@GIT_SHA1@" +#define SPERR_GIT_BRANCH "@GIT_BRANCH@" #cmakedefine USE_OMP diff --git a/include/Bitmask.h b/include/Bitmask.h index a786b198..762735fd 100644 --- a/include/Bitmask.h +++ b/include/Bitmask.h @@ -70,6 +70,6 @@ class Bitmask { std::vector m_buf; }; -}; // namespace sperr +} // namespace sperr #endif diff --git a/include/Bitstream.h b/include/Bitstream.h index 2a5e0764..c21429a1 100644 --- a/include/Bitstream.h +++ b/include/Bitstream.h @@ -76,6 +76,6 @@ class Bitstream { std::vector m_buf; }; -}; // namespace sperr +} // namespace sperr #endif diff --git a/include/CDF97.h b/include/CDF97.h index f16c4b92..bf1222de 100644 --- a/include/CDF97.h +++ b/include/CDF97.h @@ -156,6 +156,6 @@ class CDF97 { // }; -}; // namespace sperr +} // namespace sperr #endif diff --git a/include/Conditioner.h b/include/Conditioner.h index 22eeea7b..33c9eb5a 100644 --- a/include/Conditioner.h +++ b/include/Conditioner.h @@ -39,6 +39,6 @@ class Conditioner { void m_adjust_strides(size_t len); }; -}; // namespace sperr +} // namespace sperr #endif diff --git a/include/SPECK1D_FLT.h b/include/SPECK1D_FLT.h index dd1d92d6..020f3ef1 100644 --- a/include/SPECK1D_FLT.h +++ b/include/SPECK1D_FLT.h @@ -14,6 +14,6 @@ class SPECK1D_FLT : public SPECK_FLT { void m_inverse_wavelet_xform(bool) override; }; -}; // namespace sperr +} // namespace sperr #endif diff --git a/include/SPECK1D_INT.h b/include/SPECK1D_INT.h index c4e26653..82a0ec44 100644 --- a/include/SPECK1D_INT.h +++ b/include/SPECK1D_INT.h @@ -69,6 +69,6 @@ class SPECK1D_INT : public SPECK_INT { std::vector> m_LIS; }; -}; // namespace sperr +} // namespace sperr #endif diff --git a/include/SPECK1D_INT_DEC.h b/include/SPECK1D_INT_DEC.h index 4ee78593..32ffdedd 100644 --- a/include/SPECK1D_INT_DEC.h +++ b/include/SPECK1D_INT_DEC.h @@ -28,6 +28,6 @@ class SPECK1D_INT_DEC final : public SPECK1D_INT { void m_code_S(size_t idx1, size_t idx2); }; -}; // namespace sperr +} // namespace sperr #endif diff --git a/include/SPECK1D_INT_ENC.h b/include/SPECK1D_INT_ENC.h index 68cac0c7..d55f65b3 100644 --- a/include/SPECK1D_INT_ENC.h +++ b/include/SPECK1D_INT_ENC.h @@ -36,6 +36,6 @@ class SPECK1D_INT_ENC final : public SPECK1D_INT { auto m_decide_significance(const Set1D&) const -> std::optional; }; -}; // namespace sperr +} // namespace sperr #endif diff --git a/include/SPECK2D_FLT.h b/include/SPECK2D_FLT.h index aaec0678..321604a1 100644 --- a/include/SPECK2D_FLT.h +++ b/include/SPECK2D_FLT.h @@ -14,6 +14,6 @@ class SPECK2D_FLT : public SPECK_FLT { void m_inverse_wavelet_xform(bool) override; }; -}; // namespace sperr +} // namespace sperr #endif diff --git a/include/SPECK2D_INT.h b/include/SPECK2D_INT.h index 6ee2946f..21f1fea5 100644 --- a/include/SPECK2D_INT.h +++ b/include/SPECK2D_INT.h @@ -56,6 +56,6 @@ class SPECK2D_INT : public SPECK_INT { std::vector> m_LIS; }; -}; // namespace sperr +} // namespace sperr #endif diff --git a/include/SPECK2D_INT_DEC.h b/include/SPECK2D_INT_DEC.h index 4ad44480..b0adae0e 100644 --- a/include/SPECK2D_INT_DEC.h +++ b/include/SPECK2D_INT_DEC.h @@ -29,6 +29,6 @@ class SPECK2D_INT_DEC final : public SPECK2D_INT { void m_process_I(bool need_decide) final; }; -}; // namespace sperr +} // namespace sperr #endif diff --git a/include/SPECK2D_INT_ENC.h b/include/SPECK2D_INT_ENC.h index ebafb4a4..8a40ce21 100644 --- a/include/SPECK2D_INT_ENC.h +++ b/include/SPECK2D_INT_ENC.h @@ -42,6 +42,6 @@ class SPECK2D_INT_ENC final : public SPECK2D_INT { int8_t m_msb_threshold = -1; }; -}; // namespace sperr +} // namespace sperr #endif diff --git a/include/SPECK3D_FLT.h b/include/SPECK3D_FLT.h index 2944985b..8e612a1e 100644 --- a/include/SPECK3D_FLT.h +++ b/include/SPECK3D_FLT.h @@ -14,6 +14,6 @@ class SPECK3D_FLT : public SPECK_FLT { void m_inverse_wavelet_xform(bool) override; }; -}; // namespace sperr +} // namespace sperr #endif diff --git a/include/SPECK3D_INT.h b/include/SPECK3D_INT.h index 0aed3824..3c684f80 100644 --- a/include/SPECK3D_INT.h +++ b/include/SPECK3D_INT.h @@ -56,6 +56,6 @@ class SPECK3D_INT : public SPECK_INT { std::vector> m_LIS; }; -}; // namespace sperr +} // namespace sperr #endif diff --git a/include/SPECK3D_INT_DEC.h b/include/SPECK3D_INT_DEC.h index 3ccb6799..f5ed07e3 100644 --- a/include/SPECK3D_INT_DEC.h +++ b/include/SPECK3D_INT_DEC.h @@ -26,6 +26,6 @@ class SPECK3D_INT_DEC final : public SPECK3D_INT { void m_process_P_lite(size_t idx) final; }; -}; // namespace sperr +} // namespace sperr #endif diff --git a/include/SPECK3D_INT_ENC.h b/include/SPECK3D_INT_ENC.h index f1faff67..adb7d6a4 100644 --- a/include/SPECK3D_INT_ENC.h +++ b/include/SPECK3D_INT_ENC.h @@ -49,6 +49,6 @@ class SPECK3D_INT_ENC final : public SPECK3D_INT { void m_deposit_set(Set3D); }; -}; // namespace sperr +} // namespace sperr #endif diff --git a/include/SPECK_FLT.h b/include/SPECK_FLT.h index b5f85626..5c84aef2 100644 --- a/include/SPECK_FLT.h +++ b/include/SPECK_FLT.h @@ -122,6 +122,6 @@ class SPECK_FLT { auto m_estimate_q(double param, bool high_prec) const -> double; }; -}; // namespace sperr +} // namespace sperr #endif diff --git a/include/SPECK_INT.h b/include/SPECK_INT.h index 4b055d25..2c4a6ca1 100644 --- a/include/SPECK_INT.h +++ b/include/SPECK_INT.h @@ -88,6 +88,6 @@ class SPECK_INT { Bitstream m_bit_buffer; }; -}; // namespace sperr +} // namespace sperr #endif diff --git a/include/SPERR_C_API.h b/include/SPERR_C_API.h index 4be76f98..5044f150 100644 --- a/include/SPERR_C_API.h +++ b/include/SPERR_C_API.h @@ -6,10 +6,6 @@ #ifndef SPERR_C_API_H #define SPERR_C_API_H -#ifndef USE_VANILLA_CONFIG -#include "SperrConfig.h" -#endif - #include /* for size_t */ #include /* for fixed-width integers */ diff --git a/include/sperr_helper.h b/include/sperr_helper.h index 7e90a58a..8adf3d47 100644 --- a/include/sperr_helper.h +++ b/include/sperr_helper.h @@ -188,6 +188,6 @@ auto chunk_volume(dims_type vol_dim, dims_type chunk_dim) -> std::vector auto calc_mean_var(const T*, size_t len, size_t omp_nthreads = 0) -> std::array; -}; // namespace sperr +} // namespace sperr #endif diff --git a/src/SPERR3D_OMP_D.cpp b/src/SPERR3D_OMP_D.cpp index a487bff0..03666c4a 100644 --- a/src/SPERR3D_OMP_D.cpp +++ b/src/SPERR3D_OMP_D.cpp @@ -119,7 +119,7 @@ auto sperr::SPERR3D_OMP_D::decompress(const void* p, bool multi_res) -> RTNType const auto& low_res = decompressor->view_hierarchy(); assert(low_res.size() == m_hierarchy.size()); for (size_t h = 0; h < low_res.size(); h++) { - const auto& small_dim = chunk_res[h]; + [[maybe_unused]] const auto& small_dim = chunk_res[h]; assert(low_res[h].size() == small_dim[0] * small_dim[1] * small_dim[2]); m_scatter_chunk(m_hierarchy[h], vol_res[h], low_res[h], hierarchy_chunks[h][chunkI]); } diff --git a/src/graveyard/bit_buffer.h b/src/graveyard/bit_buffer.h index 865ac7a7..549bad23 100644 --- a/src/graveyard/bit_buffer.h +++ b/src/graveyard/bit_buffer.h @@ -72,6 +72,6 @@ class bit_buffer { }; // end of class bvec -}; // end of namespace speck +} // end of namespace speck #endif diff --git a/src/sperr_helper.cpp b/src/sperr_helper.cpp index 421b6c87..bcc4fef1 100644 --- a/src/sperr_helper.cpp +++ b/src/sperr_helper.cpp @@ -298,8 +298,8 @@ auto sperr::read_n_bytes(std::string filename, size_t n_bytes) -> vec8_type // POSIX systems require the size of a file to be specified, so // one can fseek to the end of the file. - auto sk = std::fseek(fp.get(), 0, SEEK_END); - assert(sk == 0); + if (std::fseek(fp.get(), 0, SEEK_END) != 0) + return buf; if (std::ftell(fp.get()) < n_bytes) return buf; @@ -323,8 +323,8 @@ auto sperr::read_whole_file(std::string filename) -> vec_type // POSIX systems require the size of a file to be specified, so // one can fseek to the end of the file. - auto sk = std::fseek(fp.get(), 0, SEEK_END); - assert(sk == 0); + if (std::fseek(fp.get(), 0, SEEK_END) != 0) + return buf; const size_t file_size = std::ftell(fp.get()); if (file_size % sizeof(T) != 0) return buf; diff --git a/test_scripts/dwt_unit_test.cpp b/test_scripts/dwt_unit_test.cpp index 62d559a7..0d8c08b1 100644 --- a/test_scripts/dwt_unit_test.cpp +++ b/test_scripts/dwt_unit_test.cpp @@ -35,6 +35,7 @@ TEST(dwt1d, big_image_even) // Apply the conditioner auto rtn = condi.inverse_condition(result, {dim_x, 1, 1}, meta); + ASSERT_EQ(rtn, sperr::RTNType::Good); for (size_t i = 0; i < total_vals; i++) { EXPECT_EQ(fptr[i], float(result[i])); @@ -71,6 +72,7 @@ TEST(dwt1d, big_image_odd) // Apply the conditioner again auto rtn = condi.inverse_condition(result, {dim_x, 1, 1}, meta); + ASSERT_EQ(rtn, sperr::RTNType::Good); for (size_t i = 0; i < total_vals; i++) { EXPECT_EQ(fptr[i], float(result[i])); @@ -106,6 +108,7 @@ TEST(dwt2d, small_image_even) // Apply the conditioner again auto rtn = condi.inverse_condition(result, {dim_x, dim_y, 1}, meta); + ASSERT_EQ(rtn, sperr::RTNType::Good); for (size_t i = 0; i < total_vals; i++) { EXPECT_EQ(in_buf[i], float(result[i])); @@ -141,6 +144,7 @@ TEST(dwt2d, small_image_odd) // Apply the conditioner auto rtn = condi.inverse_condition(result, {dim_x, dim_y, 1}, meta); + ASSERT_EQ(rtn, sperr::RTNType::Good); for (size_t i = 0; i < total_vals; i++) { EXPECT_EQ(in_buf[i], float(result[i])); @@ -176,6 +180,7 @@ TEST(dwt2d, big_image_even) // Apply the conditioner auto rtn = condi.inverse_condition(result, {dim_x, dim_y, 1}, meta); + ASSERT_EQ(rtn, sperr::RTNType::Good); for (size_t i = 0; i < total_vals; i++) { EXPECT_EQ(in_buf[i], float(result[i])); @@ -211,6 +216,7 @@ TEST(dwt2d, big_image_odd) // Apply the conditioner auto rtn = condi.inverse_condition(result, {dim_x, dim_y, 1}, meta); + ASSERT_EQ(rtn, sperr::RTNType::Good); for (size_t i = 0; i < total_vals; i++) { EXPECT_EQ(in_buf[i], float(result[i])); @@ -246,6 +252,7 @@ TEST(dwt2d, image_multi_res) // Apply the conditioner auto rtn = condi.inverse_condition(result, {dim_x, dim_y, 1}, meta); + ASSERT_EQ(rtn, sperr::RTNType::Good); for (size_t i = 0; i < total_vals; i++) ASSERT_EQ(in_buf[i], float(result[i])) << " i = " << i; @@ -288,6 +295,7 @@ TEST(dwt3d, small_even_cube) // Apply the conditioner auto rtn = condi.inverse_condition(result, {dim_x, dim_y, dim_z}, meta); + ASSERT_EQ(rtn, sperr::RTNType::Good); for (size_t i = 0; i < total_vals; i++) { ASSERT_EQ(in_buf[i], float(result[i])) << "i = " << i; } @@ -322,6 +330,7 @@ TEST(dwt3d, big_odd_cube) // Apply the conditioner auto rtn = condi.inverse_condition(result, {dim_x, dim_y, dim_z}, meta); + ASSERT_EQ(rtn, sperr::RTNType::Good); for (size_t i = 0; i < total_vals; i++) { ASSERT_EQ(in_buf[i], float(result[i])) << "i = " << i; } @@ -356,6 +365,7 @@ TEST(dwt3d, big_even_cube) // Apply the conditioner auto rtn = condi.inverse_condition(result, {dim_x, dim_y, dim_z}, meta); + ASSERT_EQ(rtn, sperr::RTNType::Good); for (size_t i = 0; i < total_vals; i++) { ASSERT_EQ(in_buf[i], float(result[i])) << "i = " << i; } @@ -391,6 +401,7 @@ TEST(dwt3d, multi_res) // Apply the conditioner auto rtn = condi.inverse_condition(result, dims, meta); + ASSERT_EQ(rtn, sperr::RTNType::Good); for (size_t i = 0; i < total_vals; i++) ASSERT_EQ(in_buf[i], float(result[i])) << " i = " << i; diff --git a/test_scripts/sperr3d_omp_unit_test.cpp b/test_scripts/sperr3d_omp_unit_test.cpp index d0997cc0..bd18931d 100644 --- a/test_scripts/sperr3d_omp_unit_test.cpp +++ b/test_scripts/sperr3d_omp_unit_test.cpp @@ -86,7 +86,6 @@ TEST(sperr3d_target_pwe, small_data_range) auto input = sperr::read_whole_file("../test_data/vorticity.128_128_41"); const auto dims = sperr::dims_type{128, 128, 41}; const auto chunks = sperr::dims_type{64, 64, 41}; - const auto total_len = dims[0] * dims[1] * dims[2]; // Use an encoder double tol = 1.5e-7; @@ -126,7 +125,6 @@ TEST(sperr3d_target_pwe, big) auto input = sperr::read_whole_file("../test_data/wmag128.float"); const auto dims = sperr::dims_type{128, 128, 128}; const auto chunks = sperr::dims_type{64, 70, 80}; - const auto total_len = dims[0] * dims[1] * dims[2]; // Use an encoder double tol = 1.5e-2; diff --git a/test_scripts/sperr_helper_unit_test.cpp b/test_scripts/sperr_helper_unit_test.cpp index b8bccead..7c7ffdc6 100644 --- a/test_scripts/sperr_helper_unit_test.cpp +++ b/test_scripts/sperr_helper_unit_test.cpp @@ -289,7 +289,7 @@ TEST(sperr_helper, read_sections) auto full_input = sperr::read_whole_file("test.tmp"); auto buf2 = sperr::vec8_type(); auto rtn2 = sperr::extract_sections(full_input.data(), full_input.size(), secs, buf2); - EXPECT_EQ(rtn, sperr::RTNType::Good); + EXPECT_EQ(rtn2, sperr::RTNType::Good); EXPECT_EQ(buf, buf2); } diff --git a/utilities/show_version.cpp b/utilities/show_version.cpp index d1e23358..23f2bb64 100644 --- a/utilities/show_version.cpp +++ b/utilities/show_version.cpp @@ -4,7 +4,7 @@ int main() { - std::cout << "SPERR version: " << SPERR_VERSION_MAJOR << "." << SPERR_VERSION_MINOR << "." + std::cout << "SPERR version : " << SPERR_VERSION_MAJOR << "." << SPERR_VERSION_MINOR << "." << SPERR_VERSION_PATCH << std::endl; std::cout << "Based on code Branch: " << SPERR_GIT_BRANCH << std::endl; std::cout << "Based on code SHA1 : " << SPERR_GIT_SHA1 << std::endl; diff --git a/utilities/sperr2d.cpp b/utilities/sperr2d.cpp index 89a7313b..77a9c812 100644 --- a/utilities/sperr2d.cpp +++ b/utilities/sperr2d.cpp @@ -108,9 +108,9 @@ int main(int argc, char* argv[]) auto* cptr = app.add_flag("-c", cflag, "Perform a compression task.")->group("Execution settings"); auto dflag = bool{false}; - auto* dptr = app.add_flag("-d", dflag, "Perform a decompression task.") - ->excludes(cptr) - ->group("Execution settings"); + app.add_flag("-d", dflag, "Perform a decompression task.") + ->excludes(cptr) + ->group("Execution settings"); // // Input properties @@ -169,11 +169,12 @@ int main(int argc, char* argv[]) ->group("Compression settings"); auto bpp = 0.0; - auto* bpp_ptr = app.add_option("--bpp", bpp, "Target bit-per-pixel (bpp) to achieve.") - ->check(CLI::Range(0.0, 64.0)) - ->excludes(pwe_ptr) - ->excludes(psnr_ptr) - ->group("Compression settings"); + [[maybe_unused]] auto* bpp_ptr = + app.add_option("--bpp", bpp, "Target bit-per-pixel (bpp) to achieve.") + ->check(CLI::Range(0.0, 64.0)) + ->excludes(pwe_ptr) + ->excludes(psnr_ptr) + ->group("Compression settings"); #ifdef EXPERIMENTING auto direct_q = 0.0; diff --git a/utilities/sperr3d.cpp b/utilities/sperr3d.cpp index b23bf66a..f0f86f01 100644 --- a/utilities/sperr3d.cpp +++ b/utilities/sperr3d.cpp @@ -113,9 +113,9 @@ int main(int argc, char* argv[]) auto* cptr = app.add_flag("-c", cflag, "Perform a compression task.")->group("Execution settings"); auto dflag = bool{false}; - auto* dptr = app.add_flag("-d", dflag, "Perform a decompression task.") - ->excludes(cptr) - ->group("Execution settings"); + app.add_flag("-d", dflag, "Perform a decompression task.") + ->excludes(cptr) + ->group("Execution settings"); auto omp_num_threads = size_t{0}; // meaning to use the maximum number of threads. #ifdef USE_OMP @@ -187,11 +187,12 @@ int main(int argc, char* argv[]) ->group("Compression settings"); auto bpp = 0.0; - auto* bpp_ptr = app.add_option("--bpp", bpp, "Target bit-per-pixel (bpp) to achieve.") - ->check(CLI::Range(0.0, 64.0)) - ->excludes(pwe_ptr) - ->excludes(psnr_ptr) - ->group("Compression settings"); + [[maybe_unused]] auto* bpp_ptr = + app.add_option("--bpp", bpp, "Target bit-per-pixel (bpp) to achieve.") + ->check(CLI::Range(0.0, 64.0)) + ->excludes(pwe_ptr) + ->excludes(psnr_ptr) + ->group("Compression settings"); #ifdef EXPERIMENTING auto direct_q = 0.0;