Skip to content

CLI: Flexible Rate Decoding by Truncating a SPERR Bitstream

Samuel Li edited this page Dec 14, 2023 · 1 revision

SPERR supports "Flexible Rate Decoding," meaning that any prefix of a SPERR bitstream produced by a simple truncation is still valid to reconstruct the data. The tradeoff is that the less bitstream is used for reconstruction, the lower the reconstruction quality is. A truncated bitstream can be useful when data size is prioritized over quality, e.g., fast transmission.

CLI utility program sperr3d_trunc truncates an existing 3D SPERR bitstream and produces a smaller bitstream. The smaller bitstream can be decompressed by sperr3d as normal. Users just need to provide a percentage value (between 1 and 100) to indicate how much of the original bitstream to keep. The full usage of sperr3d_trunc is again available in its help message:

Truncate a SPERR3D bitstream to keep a percentage of its original length.
Optionally, it can also evaluate the compression quality after truncation.

Usage: ./bin/sperr3d_trunc [OPTIONS] [filename]

Positionals:
  filename TEXT:FILE          The original SPERR3D bitstream to be truncated.
                              

Options:
  -h,--help                   Print this help message and exit


Truncation settings:
  --pct UINT REQUIRED         Percentage (1--100) of the original bitstream to truncate.
  --omp UINT                  Number of OpenMP threads to use. Default (or 0) to use all.


Output settings:
  -o TEXT                     Write out the truncated bitstream.


Input settings:
  --orig32 TEXT               Original raw data in 32-bit precision to calculate compression
                              quality using the truncated bitstream.
  --orig64 TEXT               Original raw data in 64-bit precision to calculate compression
                              quality using the truncated bitstream.

Note: sperr3d_trunc can only truncate a 3D SPERR bitstream.