Commit 7bdee465 authored by Mathis Rosenhauer's avatar Mathis Rosenhauer

Fix markdown

parent 2db4a26c
...@@ -9,22 +9,22 @@ supported, they can also be efficiently coded by grouping exponents ...@@ -9,22 +9,22 @@ supported, they can also be efficiently coded by grouping exponents
and mantissa. and mantissa.
Libaec implements Libaec implements
"Golomb-Rice":http://en.wikipedia.org/wiki/Golomb_coding coding as [Golomb-Rice](http://en.wikipedia.org/wiki/Golomb_coding) coding as
defined in the Space Data System Standard documents [121.0-B-2][1] and defined in the Space Data System Standard documents [121.0-B-2][1] and
[120.0-G-2][2]. [120.0-G-2][2].
## Patents ## Patents
In [doc/license.txt] a clarification on potentially applying In [license.txt](doc/license.txt) a clarification on potentially
intellectual property rights is given. applying intellectual property rights is given.
## Installation ## Installation
See [INSTALL] for details. See [INSTALL](INSTALL) for details.
## SZIP Compatibility ## SZIP Compatibility
[Libaec can replace SZIP][README.SZIP]. [Libaec can replace SZIP](README.SZIP).
## Encoding ## Encoding
...@@ -32,8 +32,8 @@ In this context efficiency refers to the size of the encoded ...@@ -32,8 +32,8 @@ In this context efficiency refers to the size of the encoded
data. Performance refers to the time it takes to encode data. data. Performance refers to the time it takes to encode data.
Suppose you have an array of 32 bit signed integers you want to Suppose you have an array of 32 bit signed integers you want to
compress. The pointer pointing to the data shall be called *source, compress. The pointer pointing to the data shall be called `*source`,
output goes into *dest. output goes into `*dest`.
```C++ ```C++
#include <libaec.h> #include <libaec.h>
...@@ -82,12 +82,12 @@ output goes into *dest. ...@@ -82,12 +82,12 @@ output goes into *dest.
... ...
``` ```
block_size can vary from 8 to 64 samples. Smaller blocks allow the `block_size` can vary from 8 to 64 samples. Smaller blocks allow the
compression to adapt more rapidly to changing source compression to adapt more rapidly to changing source
statistics. Larger blocks create less overhead but can be less statistics. Larger blocks create less overhead but can be less
efficient if source statistics change across the block. efficient if source statistics change across the block.
rsi sets the reference sample interval. A large RSI will improve `rsi` sets the reference sample interval. A large RSI will improve
performance and efficiency. It will also increase memory requirements performance and efficiency. It will also increase memory requirements
since internal buffering is based on RSI size. A smaller RSI may be since internal buffering is based on RSI size. A smaller RSI may be
desirable in situations where each RSI will be packetized and possible desirable in situations where each RSI will be packetized and possible
...@@ -95,41 +95,42 @@ error propagation has to be minimized. ...@@ -95,41 +95,42 @@ error propagation has to be minimized.
### Flags: ### Flags:
* AEC_DATA_SIGNED: input data are signed integers. Specifying this * `AEC_DATA_SIGNED`: input data are signed integers. Specifying this
correctly increases compression efficiency. Default is unsigned. correctly increases compression efficiency. Default is unsigned.
* AEC_DATA_PREPROCESS: preprocessing input will improve compression * `AEC_DATA_PREPROCESS`: preprocessing input will improve compression
efficiency if data samples are correlated. It will only cost efficiency if data samples are correlated. It will only cost
performance for no gain in efficiency if the data is already performance for no gain in efficiency if the data is already
uncorrelated. uncorrelated.
* AEC_DATA_MSB: input data is stored most significant byte first * `AEC_DATA_MSB`: input data is stored most significant byte first
i.e. big endian. You have to specify AEC_DATA_MSB even if your host i.e. big endian. You have to specify `AEC_DATA_MSB` even if your host
architecture is big endian. Default is little endian on all architecture is big endian. Default is little endian on all
architectures. architectures.
* AEC_DATA_3BYTE: the 17 to 24 bit input data is stored in three * `AEC_DATA_3BYTE`: the 17 to 24 bit input data is stored in three
bytes. This flag has no effect for other sample sizes. bytes. This flag has no effect for other sample sizes.
* AEC_RESTRICTED: use a restricted set of code options. This option is * `AEC_RESTRICTED`: use a restricted set of code options. This option is
only valid for bits_per_sample <= 4. only valid for `bits_per_sample` <= 4.
* AEC_PAD_RSI: assume that the encoded RSI is padded to the next byte * `AEC_PAD_RSI`: assume that the encoded RSI is padded to the next byte
boundary while decoding. The preprocessor macro ENABLE_RSI_PADDING boundary while decoding. The preprocessor macro `ENABLE_RSI_PADDING`
needs to be defined while compiling for the encoder to honour this needs to be defined while compiling for the encoder to honour this
flag. flag.
### Data size: ### Data size:
The following rules apply for deducing storage size from sample size The following rules apply for deducing storage size from sample size
(bits_per_sample): (`bits_per_sample`):
|_. sample size |_. storage size| **sample size** | **storage size**
| 1 - 8 bits | 1 byte| --- | ---
| 9 - 16 bits | 2 bytes| 1 - 8 bits | 1 byte
|17 - 24 bits | 3 bytes (only if AEC_DATA_3BYTE is set)| 9 - 16 bits | 2 bytes
|25 - 32 bits | 4 bytes (if AEC_DATA_3BYTE is set)| 17 - 24 bits | 3 bytes (only if `AEC_DATA_3BYTE` is set)
|17 - 32 bits | 4 bytes (if AEC_DATA_3BYTE is not set)| 25 - 32 bits | 4 bytes (if `AEC_DATA_3BYTE` is set)
17 - 32 bits | 4 bytes (if `AEC_DATA_3BYTE` is not set)
If a sample requires less bits than the storage size provides, then If a sample requires less bits than the storage size provides, then
you have to make sure that unused bits are not set. Libaec does not you have to make sure that unused bits are not set. Libaec does not
...@@ -138,23 +139,23 @@ if unused bits are set. All input data must be a multiple of the ...@@ -138,23 +139,23 @@ if unused bits are set. All input data must be a multiple of the
storage size in bytes. Remaining bytes which do not form a complete storage size in bytes. Remaining bytes which do not form a complete
sample will be ignored. sample will be ignored.
Libaec accesses next_in and next_out buffers only bytewise. There are Libaec accesses `next_in` and `next_out` buffers only bytewise. There
no alignment requirements for these buffers. are no alignment requirements for these buffers.
### Flushing: ### Flushing:
aec_encode can be used in a streaming fashion by chunking input and `aec_encode` can be used in a streaming fashion by chunking input and
output and specifying AEC_NO_FLUSH. The function will return if either output and specifying `AEC_NO_FLUSH`. The function will return if either
the input runs empty or the output buffer is full. The calling the input runs empty or the output buffer is full. The calling
function can check avail_in and avail_out to see what occurred. The function can check `avail_in` and `avail_out` to see what occurred. The
last call to aec_encode() must set AEC_FLUSH to drain all last call to `aec_encode()` must set `AEC_FLUSH` to drain all
output. aec.c is an example of streaming usage of encoding and output. aec.c is an example of streaming usage of encoding and
decoding. decoding.
### Output: ### Output:
Encoded data will be written to the buffer submitted with Encoded data will be written to the buffer submitted with
next_out. The length of the compressed data is total_out. `next_out`. The length of the compressed data is `total_out`.
See libaec.h for a detailed description of all relevant structure See libaec.h for a detailed description of all relevant structure
members and constants. members and constants.
...@@ -192,12 +193,12 @@ and output is reversed. ...@@ -192,12 +193,12 @@ and output is reversed.
``` ```
It is strongly recommended that the size of the output buffer It is strongly recommended that the size of the output buffer
(next_out) is a multiple of the storage size in bytes. If the buffer (`next_out`) is a multiple of the storage size in bytes. If the buffer
is not a multiple of the storage size and the buffer gets filled to is not a multiple of the storage size and the buffer gets filled to
the last sample, the error code AEC_MEM_ERROR is returned. the last sample, the error code `AEC_MEM_ERROR` is returned.
It is essential for decoding that parameters like bits_per_sample, It is essential for decoding that parameters like `bits_per_sample`,
block_size, rsi, and flags are exactly the same as they were for `block_size`, `rsi`, and `flags` are exactly the same as they were for
encoding. Libaec does not store these parameters in the coded stream encoding. Libaec does not store these parameters in the coded stream
so it is up to the calling program to keep the correct parameters so it is up to the calling program to keep the correct parameters
between encoding and decoding. between encoding and decoding.
...@@ -212,9 +213,9 @@ of the parameters. ...@@ -212,9 +213,9 @@ of the parameters.
[Consultative Committee for Space Data Systems. Lossless Data [Consultative Committee for Space Data Systems. Lossless Data
Compression. Recommendation for Space Data System Standards, CCSDS Compression. Recommendation for Space Data System Standards, CCSDS
121.0-B-2. Blue Book. Issue 2. Washington, D.C.: CCSDS, May 2012.][1] 121.0-B-2. Blue Book. Issue 2. Washington, D.C.: CCSDS, May 2012.][1]
[1] http://public.ccsds.org/publications/archive/121x0b2.pdf [1]: http://public.ccsds.org/publications/archive/121x0b2.pdf
[Consultative Committee for Space Data Systems. Lossless Data [Consultative Committee for Space Data Systems. Lossless Data
Compression. Recommendation for Space Data System Standards, CCSDS Compression. Recommendation for Space Data System Standards, CCSDS
120.0-G-3. Green Book. Issue 3. Washington, D.C.: CCSDS, April 2013.][2] 120.0-G-3. Green Book. Issue 3. Washington, D.C.: CCSDS, April 2013.][2]
[2] http://public.ccsds.org/publications/archive/120x0g3.pdf [2]: http://public.ccsds.org/publications/archive/120x0g3.pdf
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment