Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc #230

Merged
merged 5 commits into from
Feb 11, 2024
Merged

misc #230

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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ if( BUILD_CLI_UTILITIES )
set( CLI11_SINGLE_FILE OFF CACHE INTERNAL "Don't use single file CLI11")
FetchContent_Declare( cli11
GIT_REPOSITORY https://github.com/CLIUtils/CLI11
GIT_TAG 88e9bb17418ee730817d5942894d99a4bdd78fb3 # v2.4.0
GIT_TAG f4d0731cebb123ff0ace712c099dffbcd2c58e5a # v2.4.1
)
FetchContent_MakeAvailable(cli11)

Expand Down
1 change: 1 addition & 0 deletions include/SPERR3D_OMP_D.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class SPERR3D_OMP_D {
auto decompress(const void* bitstream, bool multi_res = false) -> RTNType;

auto view_decoded_data() const -> const sperr::vecd_type&;
auto view_hierarchy() const -> const std::vector<vecd_type>&;
auto release_decoded_data() -> sperr::vecd_type&&;
auto release_hierarchy() -> std::vector<vecd_type>&&;

Expand Down
5 changes: 5 additions & 0 deletions src/SPERR3D_OMP_D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ auto sperr::SPERR3D_OMP_D::release_hierarchy() -> std::vector<vecd_type>&&
return std::move(m_hierarchy);
}

auto sperr::SPERR3D_OMP_D::view_hierarchy() const -> const std::vector<vecd_type>&
{
return m_hierarchy;
}

auto sperr::SPERR3D_OMP_D::view_decoded_data() const -> const sperr::vecd_type&
{
return m_vol_buf;
Expand Down
9 changes: 7 additions & 2 deletions utilities/sperr2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ int main(int argc, char* argv[])
//
auto bitstream = std::string();
app.add_option("--bitstream", bitstream, "Output compressed bitstream.")
->needs(cptr)
->group("Output settings");

auto decomp_f32 = std::string();
Expand Down Expand Up @@ -188,6 +189,10 @@ int main(int argc, char* argv[])
//
// A little extra sanity check.
//
if (input_file.empty()) {
std::cout << "What's the input file?" << std::endl;
return __LINE__;
}
if (!cflag && !dflag) {
std::cout << "Is this compressing (-c) or decompressing (-d) ?" << std::endl;
return __LINE__;
Expand Down Expand Up @@ -228,7 +233,7 @@ int main(int argc, char* argv[])
if ((ftype == 32 && (total_vals * 4 != input.size())) ||
(ftype == 64 && (total_vals * 8 != input.size()))) {
std::cout << "Input file size wrong!" << std::endl;
return __LINE__;
return __LINE__ % 256;
}
auto encoder = std::make_unique<sperr::SPECK2D_FLT>();
encoder->set_dims(dims);
Expand Down Expand Up @@ -259,7 +264,7 @@ int main(int argc, char* argv[])
auto rtn = encoder->compress();
if (rtn != sperr::RTNType::Good) {
std::cout << "Compression failed!" << std::endl;
return __LINE__;
return __LINE__ % 256;
}

// Assemble the output bitstream.
Expand Down
24 changes: 23 additions & 1 deletion utilities/sperr3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ int main(int argc, char* argv[])
//
auto bitstream = std::string();
app.add_option("--bitstream", bitstream, "Output compressed bitstream.")
->needs(cptr)
->group("Output settings");

auto decomp_f32 = std::string();
Expand Down Expand Up @@ -205,6 +206,10 @@ int main(int argc, char* argv[])
//
// A little extra sanity check.
//
if (input_file.empty()) {
std::cout << "What's the input file?" << std::endl;
return __LINE__;
}
if (!cflag && !dflag) {
std::cout << "Is this compressing (-c) or decompressing (-d) ?" << std::endl;
return __LINE__;
Expand Down Expand Up @@ -232,6 +237,23 @@ int main(int argc, char* argv[])
std::cout << "SPERR needs an output destination when decoding!" << std::endl;
return __LINE__;
}
// Also check if the chunk dims can support multi-resolution decoding.
if (cflag && (!decomp_lowres_f64.empty() || !decomp_lowres_f32.empty())) {
auto name = decomp_lowres_f64;
if (name.empty())
name = decomp_lowres_f32;
assert(!name.empty());
auto filenames = create_filenames(name, dims, chunks);
if (filenames.empty()) {
std::printf(
" Warning: the combo of volume dimension (%lu, %lu, %lu) and chunk dimension"
" (%lu, %lu, %lu)\n cannot support multi-resolution decoding. "
" Try to use chunk dimensions that\n are similar in length and"
" can divide the volume dimension.\n",
dims[0], dims[1], dims[2], chunks[0], chunks[1], chunks[2]);
return __LINE__ % 256;
}
}

//
// Really starting the real work!
Expand All @@ -242,7 +264,7 @@ int main(int argc, char* argv[])
if ((ftype == 32 && (total_vals * 4 != input.size())) ||
(ftype == 64 && (total_vals * 8 != input.size()))) {
std::cout << "Input file size wrong!" << std::endl;
return __LINE__;
return __LINE__ % 256;
}
auto encoder = std::make_unique<sperr::SPERR3D_OMP_C>();
encoder->set_dims_and_chunks(dims, chunks);
Expand Down
Loading