GRASS GIS 8 Programmer's Manual 8.3.2(2024)-exported
Loading...
Searching...
No Matches
compress.h
Go to the documentation of this file.
1#include <grass/config.h>
2#include <grass/gis.h>
3
4/* compressors:
5 * 0: no compression
6 * 1: RLE, unit is one byte
7 * 2: ZLIB's DEFLATE (default)
8 * 3: LZ4, fastest but lowest compression ratio
9 * 4: BZIP2: slowest but highest compression ratio
10 * 5: ZSTD: faster than ZLIB, higher compression than ZLIB
11 */
12
13/* adding a new compressor:
14 * add the corresponding functions G_*compress() and G_*_expand()
15 * if needed, add checks to configure.ac and include/grass/config.h.in
16 * modify compress.h (this file)
17 * nothing to change in compress.c
18 */
19
20/* upper bounds of the size of the compressed buffer */
21int G_no_compress_bound(int);
27
28typedef int compress_fn(unsigned char *src, int src_sz, unsigned char *dst,
29 int dst_sz);
30typedef int expand_fn(unsigned char *src, int src_sz, unsigned char *dst,
31 int dst_sz);
32typedef int bound_fn(int src_sz);
33
41
42/* DO NOT CHANGE the order
43 * 0: None
44 * 1: RLE
45 * 2: ZLIB
46 * 3: LZ4
47 * 4: BZIP2
48 * 5: ZSTD
49 */
50
51static int n_compressors = 6;
52
56 {1, G_zlib_compress, G_zlib_expand, G_zlib_compress_bound, "ZLIB"},
58#ifdef HAVE_BZLIB_H
60#else
62#endif
63#ifdef HAVE_ZSTD_H
65#else
67#endif
68 {0, NULL, NULL, NULL, NULL}};
#define NULL
Definition ccmath.h:32
int G_bz2_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition cmprbzip.c:85
int G_bz2_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition cmprbzip.c:168
int G_lz4_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition cmprlz4.c:78
int G_lz4_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition cmprlz4.c:146
int G_rle_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition cmprrle.c:73
int G_rle_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition cmprrle.c:139
int G_zstd_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition cmprzstd.c:86
int G_zstd_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition cmprzstd.c:162
int G_no_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition compress.c:155
int G_no_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition compress.c:176
int G_bz2_compress_bound(int)
Definition cmprbzip.c:72
int G_lz4_compress_bound(int)
Definition cmprlz4.c:70
int G_zlib_compress_bound(int)
int expand_fn(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition compress.h:30
struct compressor_list compressor[]
Definition compress.h:53
int G_zstd_compress_bound(int)
Definition cmprzstd.c:72
int compress_fn(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition compress.h:28
int bound_fn(int src_sz)
Definition compress.h:32
int G_rle_compress_bound(int)
Definition cmprrle.c:68
int G_no_compress_bound(int)
Definition compress.c:150
bound_fn * bound
Definition compress.h:38
compress_fn * compress
Definition compress.h:36
expand_fn * expand
Definition compress.h:37