From bbe681be1086fa754da1367a7244550f123e3188 Mon Sep 17 00:00:00 2001 From: Gregor Weiss Date: Mon, 1 Jul 2024 16:00:41 +0000 Subject: [PATCH] Documentation aktualisiert --- Documentation.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Documentation.md b/Documentation.md index 78b1e05..21ed6a3 100644 --- a/Documentation.md +++ b/Documentation.md @@ -30,13 +30,16 @@ bwc_codec *coder = bwc_alloc_coder(countDim1, countDim2 countDim3, countDim4, nP bwc_stream *stream = bwc_init_stream(orig_in, comp_out, comp); bwc_create_compression(coder, stream, rate); bwc_compress(coder, stream); +bwc_free_codec(coder); ``` The first line allocates an instance `coder` that holds the settings and operations for compression. The first four function arguments describe the number of elements in each dimension of the original data set, which can have up to four dimensions. Data sets with less than four dimensions pass `1` for the unused dimensionality. The parameter `nPar` is a count for the number of independent parameters that can be stacked inside the data set. The function argument `precision` passes the precision of the data set that can take one of three values `bwc_precision_half`, `bwc_precision_single`, and `bwc_precision_double`. After allocation, the `coder` can be reused for multiple data sets that are described by the same dimensionality, number of parameters, and floating point precision. The second line initializes the `bwc_stream` that handles the data set and the resulting compressed bitstream. The incoming pointers `orig_in` and `comp_out` must be managed by the user. This way, the BWC can be used on-the-fly for in-memory compression using readily existing pointers and buffers from the user applications. The argument `comp` is of type `bwc_mode` and classifies the `stream` to be input for compression. -The last to lines combine `coder` and `stream` to compress the data set with the given `rate`. +The third and fourth lines combine `coder` and `stream` to compress the data set with the given `rate`. + +Finally, the `coder` must be freed. ### Advanced Settings @@ -49,15 +52,18 @@ Implement the following steps for decompressing an BWC-compressed data set: ```c bwc_codec *decoder = bwc_alloc_decoder(); bwc_stream *stream = bwc_init_stream(comp_in, decomp_out, decomp); -bwc_create_decompression(coder, stream, layer); -bwc_compress(coder, stream); +bwc_create_decompression(decoder, stream, layer); +bwc_decompress(decoder, stream); +bwc_free_codec(decoder); ``` Allocation of a `bwc_codec` for decompression, in the first line, is considerably simpler than for compression because the properties dimensionality, number of parameter, and precision of the original data set is encoded in the header of a compressed `bwc_stream`. The second line passes the incoming, compressed stream as the pointer `comp_in` and provides a user defined buffer `decomp_out` for the decompressed output. The `decomp` flag signals the mode of the `stream` to be decompressed. -The last to lines parse and decompress the data choosing a given quality layer. +The third and fourth line parse and decompress the data choosing a given quality layer. + +Finally, the `decoder` must be freed.