![]() |
NHS31xx SW API
|
The application can adapt the compress module to better fit the different application scenarios through the use of diversity flags in the form of defines below. Sensible defaults are chosen; to override the default settings, place the defines with their desired values in the application app_sel.h header file: the compiler will pick up your defines before parsing this file.
Macros | |
#define | COMPRESS_WINDOW_BITS 10 |
#define | COMPRESS_LOOKAHEAD_BITS 4 |
#define | COMPRESS_USE_INDEX 0 |
#define COMPRESS_WINDOW_BITS 10 |
The window size determines how far back in the input can be searched for repeated patterns. A value of 8 will only use 2^8 == 256 bytes, while a value of 10 will use 2^10 == 1024 bytes. The latter uses more memory, but may also compress more effectively by detecting more repetition. It is a buffer size parameter that is explicit trade-off between compression effectiveness and working memory.
#define COMPRESS_LOOKAHEAD_BITS 4 |
The lookahead size determines the maximum length for repeated patterns that are found. If equal to 4, a 50-byte run of 'a' characters will be represented as several repeated 2^4 == 16-byte patterns, whereas a larger value may be able to represent it all at once. The number of bits used for the lookahead size is fixed, so an overly large lookahead size can reduce compression by adding unused size bits to small patterns.
#define COMPRESS_USE_INDEX 0 |
Enables indexing. Indexing greatly reduces the compression time - possibly up to a factor of 5 (!). It is not used for decompression. Enabling it roughly doubles the required stack size for compression, plus requires temporarily an extra 512 bytes while the index being built up.