Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions SperrConfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion include/Bitmask.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ class Bitmask {
std::vector<uint64_t> m_buf;
};

}; // namespace sperr
} // namespace sperr

#endif
2 changes: 1 addition & 1 deletion include/Bitstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@ class Bitstream {
std::vector<uint64_t> m_buf;
};

}; // namespace sperr
} // namespace sperr

#endif
2 changes: 1 addition & 1 deletion include/CDF97.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,6 @@ class CDF97 {
//
};

}; // namespace sperr
} // namespace sperr

#endif
2 changes: 1 addition & 1 deletion include/Conditioner.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ class Conditioner {
void m_adjust_strides(size_t len);
};

}; // namespace sperr
} // namespace sperr

#endif
2 changes: 1 addition & 1 deletion include/SPECK1D_FLT.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ class SPECK1D_FLT : public SPECK_FLT {
void m_inverse_wavelet_xform(bool) override;
};

}; // namespace sperr
} // namespace sperr

#endif
2 changes: 1 addition & 1 deletion include/SPECK1D_INT.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ class SPECK1D_INT : public SPECK_INT<T> {
std::vector<std::vector<Set1D>> m_LIS;
};

}; // namespace sperr
} // namespace sperr

#endif
2 changes: 1 addition & 1 deletion include/SPECK1D_INT_DEC.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ class SPECK1D_INT_DEC final : public SPECK1D_INT<T> {
void m_code_S(size_t idx1, size_t idx2);
};

}; // namespace sperr
} // namespace sperr

#endif
2 changes: 1 addition & 1 deletion include/SPECK1D_INT_ENC.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ class SPECK1D_INT_ENC final : public SPECK1D_INT<T> {
auto m_decide_significance(const Set1D&) const -> std::optional<size_t>;
};

}; // namespace sperr
} // namespace sperr

#endif
2 changes: 1 addition & 1 deletion include/SPECK2D_FLT.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ class SPECK2D_FLT : public SPECK_FLT {
void m_inverse_wavelet_xform(bool) override;
};

}; // namespace sperr
} // namespace sperr

#endif
2 changes: 1 addition & 1 deletion include/SPECK2D_INT.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ class SPECK2D_INT : public SPECK_INT<T> {
std::vector<std::vector<Set2D>> m_LIS;
};

}; // namespace sperr
} // namespace sperr

#endif
2 changes: 1 addition & 1 deletion include/SPECK2D_INT_DEC.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ class SPECK2D_INT_DEC final : public SPECK2D_INT<T> {
void m_process_I(bool need_decide) final;
};

}; // namespace sperr
} // namespace sperr

#endif
2 changes: 1 addition & 1 deletion include/SPECK2D_INT_ENC.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ class SPECK2D_INT_ENC final : public SPECK2D_INT<T> {
int8_t m_msb_threshold = -1;
};

}; // namespace sperr
} // namespace sperr

#endif
2 changes: 1 addition & 1 deletion include/SPECK3D_FLT.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ class SPECK3D_FLT : public SPECK_FLT {
void m_inverse_wavelet_xform(bool) override;
};

}; // namespace sperr
} // namespace sperr

#endif
2 changes: 1 addition & 1 deletion include/SPECK3D_INT.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ class SPECK3D_INT : public SPECK_INT<T> {
std::vector<std::vector<Set3D>> m_LIS;
};

}; // namespace sperr
} // namespace sperr

#endif
2 changes: 1 addition & 1 deletion include/SPECK3D_INT_DEC.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ class SPECK3D_INT_DEC final : public SPECK3D_INT<T> {
void m_process_P_lite(size_t idx) final;
};

}; // namespace sperr
} // namespace sperr

#endif
2 changes: 1 addition & 1 deletion include/SPECK3D_INT_ENC.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ class SPECK3D_INT_ENC final : public SPECK3D_INT<T> {
void m_deposit_set(Set3D);
};

}; // namespace sperr
} // namespace sperr

#endif
2 changes: 1 addition & 1 deletion include/SPECK_FLT.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,6 @@ class SPECK_FLT {
auto m_estimate_q(double param, bool high_prec) const -> double;
};

}; // namespace sperr
} // namespace sperr

#endif
2 changes: 1 addition & 1 deletion include/SPECK_INT.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,6 @@ class SPECK_INT {
Bitstream m_bit_buffer;
};

}; // namespace sperr
} // namespace sperr

#endif
4 changes: 0 additions & 4 deletions include/SPERR_C_API.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
#ifndef SPERR_C_API_H
#define SPERR_C_API_H

#ifndef USE_VANILLA_CONFIG
#include "SperrConfig.h"
#endif

#include <stddef.h> /* for size_t */
#include <stdint.h> /* for fixed-width integers */

Expand Down
2 changes: 1 addition & 1 deletion include/sperr_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,6 @@ auto chunk_volume(dims_type vol_dim, dims_type chunk_dim) -> std::vector<std::ar
template <typename T>
auto calc_mean_var(const T*, size_t len, size_t omp_nthreads = 0) -> std::array<T, 2>;

}; // namespace sperr
} // namespace sperr

#endif
2 changes: 1 addition & 1 deletion src/SPERR3D_OMP_D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/graveyard/bit_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ class bit_buffer {

}; // end of class bvec

}; // end of namespace speck
} // end of namespace speck

#endif
8 changes: 4 additions & 4 deletions src/sperr_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -323,8 +323,8 @@ auto sperr::read_whole_file(std::string filename) -> vec_type<T>

// 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;
Expand Down
11 changes: 11 additions & 0 deletions test_scripts/dwt_unit_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]));
Expand Down Expand Up @@ -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]));
Expand Down Expand Up @@ -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]));
Expand Down Expand Up @@ -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]));
Expand Down Expand Up @@ -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]));
Expand Down Expand Up @@ -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]));
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 0 additions & 2 deletions test_scripts/sperr3d_omp_unit_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ TEST(sperr3d_target_pwe, small_data_range)
auto input = sperr::read_whole_file<float>("../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;
Expand Down Expand Up @@ -126,7 +125,6 @@ TEST(sperr3d_target_pwe, big)
auto input = sperr::read_whole_file<float>("../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;
Expand Down
2 changes: 1 addition & 1 deletion test_scripts/sperr_helper_unit_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ TEST(sperr_helper, read_sections)
auto full_input = sperr::read_whole_file<uint8_t>("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);
}

Expand Down
2 changes: 1 addition & 1 deletion utilities/show_version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
17 changes: 9 additions & 8 deletions utilities/sperr2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
17 changes: 9 additions & 8 deletions utilities/sperr3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
Loading