GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
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.in and include/config.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 */
21 int G_no_compress_bound(int);
22 int G_rle_compress_bound(int);
23 int G_zlib_compress_bound(int);
24 int G_lz4_compress_bound(int);
25 int G_bz2_compress_bound(int);
26 int G_zstd_compress_bound(int);
27 
28 typedef int compress_fn(unsigned char *src, int src_sz, unsigned char *dst,
29  int dst_sz);
30 typedef int expand_fn(unsigned char *src, int src_sz, unsigned char *dst,
31  int dst_sz);
32 typedef int bound_fn(int src_sz);
33 
35 {
36  int available;
40  char *name;
41 };
42 
43 /* DO NOT CHANGE the order
44  * 0: None
45  * 1: RLE
46  * 2: ZLIB
47  * 3: LZ4
48  * 4: BZIP2
49  * 5: ZSTD
50  */
51 
52 static int n_compressors = 6;
53 
59 #ifdef HAVE_BZLIB_H
61 #else
63 #endif
64 #ifdef HAVE_ZSTD_H
66 #else
68 #endif
69  {0, NULL, NULL, NULL, NULL}
70 };
71 
int G_zstd_compress_bound(int)
Definition: cmprzstd.c:74
struct compressor_list compressor[]
Definition: compress.h:54
int G_no_compress_bound(int)
Definition: compress.c:150
int G_no_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition: compress.c:178
compress_fn * compress
Definition: compress.h:37
int G_zlib_compress_bound(int)
Definition: cmprzlib.c:79
int G_zstd_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition: cmprzstd.c:163
int G_lz4_compress_bound(int)
Definition: cmprlz4.c:71
int G_lz4_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition: cmprlz4.c:148
expand_fn * expand
Definition: compress.h:38
int G_no_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition: compress.c:156
char * dst
Definition: lz4.h:599
int expand_fn(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition: compress.h:30
#define NULL
Definition: ccmath.h:32
int G_zstd_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition: cmprzstd.c:88
int G_lz4_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition: cmprlz4.c:80
char * name
Definition: compress.h:40
int G_bz2_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition: cmprbzip.c:169
int bound_fn(int src_sz)
Definition: compress.h:32
int G_zlib_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition: cmprzlib.c:91
int G_rle_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition: cmprrle.c:74
int G_rle_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition: cmprrle.c:141
bound_fn * bound
Definition: compress.h:39
int G_bz2_compress_bound(int)
Definition: cmprbzip.c:74
int G_rle_compress_bound(int)
Definition: cmprrle.c:68
int G_bz2_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition: cmprbzip.c:88
int compress_fn(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition: compress.h:28
int G_zlib_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition: cmprzlib.c:170