GRASS GIS 7 Programmer's Manual  7.4.3(2018)-exported
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  */
11 
12 /* adding a new compressor:
13  * add the corresponding functions G_*compress() and G_*_expand()
14  * if needed, add checks to configure.in and include/config.in
15  * modify compress.h
16  * modify G_compress(), G_expand()
17  */
18 
19 typedef int compress_fn(unsigned char *src, int src_sz, unsigned char *dst,
20  int dst_sz);
21 typedef int expand_fn(unsigned char *src, int src_sz, unsigned char *dst,
22  int dst_sz);
23 
25 {
26  int available;
29  char *name;
30 };
31 
32 /* DO NOT CHANGE the order
33  * 0: None
34  * 1: RLE
35  * 2: ZLIB
36  * 3: LZ4
37  * 4: BZIP2 */
38 
39 static int n_compressors = 5;
40 
42  {1, G_no_compress, G_no_expand, "NONE"},
43  {1, G_rle_compress, G_rle_expand, "RLE"},
44  {1, G_zlib_compress, G_zlib_expand, "ZLIB"},
45  {1, G_lz4_compress, G_lz4_expand, "LZ4"},
46 #ifdef HAVE_BZLIB_H
47  {1, G_bz2_compress, G_bz2_expand, "BZIP2"},
48 #else
49  {0, G_bz2_compress, G_bz2_expand, "BZIP2"},
50 #endif
51  {0, NULL, NULL, NULL}
52 };
53 
int G_lz4_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition: cmprlz4.c:130
struct compressor_list compressor[]
Definition: compress.h:41
compress_fn * compress
Definition: compress.h:27
int G_rle_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition: cmprrle.c:68
expand_fn * expand
Definition: compress.h:28
char * dst
Definition: lz4.h:354
int expand_fn(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition: compress.h:21
#define NULL
Definition: ccmath.h:32
int G_rle_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition: cmprrle.c:135
int G_no_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition: compress.c:162
int G_lz4_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition: cmprlz4.c:72
char * name
Definition: compress.h:29
int G_no_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition: compress.c:140
int G_bz2_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition: cmprbzip.c:74
int compress_fn(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition: compress.h:19
int G_bz2_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition: cmprbzip.c:150