Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Li authored and Samuel Li committed Sep 21, 2023
1 parent 2910ca7 commit 9cad37c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions include/SPERR3D_Stream_Tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ class SPERR3D_Stream_Tools {
auto progressive_read(std::string filename, unsigned pct) const -> vec8_type;

// Function that truncates a bitstream to facilitate progressive access.
// Note on `stream_len`: it does not to be the full length of the original bitstream, rather,
// it can be just long enough for the requested truncation:
// - one chunk: (full_bitstream_length * percent + 64) bytes.
// - multiple chunks: probably easier to just use the full bitstream length.
auto progressive_truncate(const void* stream, size_t stream_len, unsigned pct) const -> vec8_type;

private:
Expand Down
6 changes: 5 additions & 1 deletion include/SPERR_C_API.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ int sperr_decomp_3d(

/*
* Truncate a 3D SPERR-compressed bitstream to a percentage of its original length.
* Note on `src_len`: it does not to be the full length of the original bitstream, rather,
* it can be just long enough for the requested truncation:
* - one chunk: (full_bitstream_length * percent + 64) bytes.
* - multiple chunks: probably easier to just use the full bitstream length.
*
* Return value meanings:
* 0: success
Expand All @@ -128,7 +132,7 @@ int sperr_decomp_3d(
int sperr_trunc_3d(
const void* src, /* Input: buffer that contains a compressed bitstream */
size_t src_len, /* Input: length of the input bitstream in byte */
unsigned pct, /* Input: percentage of the bitstream to keep (0 <= pct <= 100) */
unsigned pct, /* Input: percentage of the bitstream to keep (1 <= pct <= 100) */
void** dst, /* Output: buffer for the truncated bitstream, allocated by this function */
size_t* dst_len); /* Output: length of `dst` in byte */

Expand Down
2 changes: 1 addition & 1 deletion utilities/sperr3d_trunc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ int main(int argc, char* argv[])
{
// Parse command line options
CLI::App app(
"Truncate a SPERR3D bitstream to a specific bit-per-point (BPP).\n"
"Truncate a SPERR3D bitstream to keep a percentage of its original length.\n"
"Optionally, it can also evaluate the compression quality after truncation.\n");

// Input specification
Expand Down

0 comments on commit 9cad37c

Please sign in to comment.