GRASS 8 Programmer's Manual
8.5.0(2026)-8d6ceba290
Toggle main menu visibility
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 */
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
34
struct
compressor_list
{
35
int
available
;
36
compress_fn
*
compress
;
37
expand_fn
*
expand
;
38
bound_fn
*
bound
;
39
char
*
name
;
40
};
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
51
static
int
n_compressors = 6;
52
53
struct
compressor_list
compressor
[] = {
54
{1,
G_no_compress
,
G_no_expand
,
G_no_compress_bound
,
"NONE"
},
55
{1,
G_rle_compress
,
G_rle_expand
,
G_rle_compress_bound
,
"RLE"
},
56
{1, G_zlib_compress, G_zlib_expand,
G_zlib_compress_bound
,
"ZLIB"
},
57
{1,
G_lz4_compress
,
G_lz4_expand
,
G_lz4_compress_bound
,
"LZ4"
},
58
#ifdef HAVE_BZLIB_H
59
{1,
G_bz2_compress
,
G_bz2_expand
,
G_bz2_compress_bound
,
"BZIP2"
},
60
#else
61
{0,
G_bz2_compress
,
G_bz2_expand
,
G_bz2_compress_bound
,
"BZIP2"
},
62
#endif
63
#ifdef HAVE_ZSTD_H
64
{1,
G_zstd_compress
,
G_zstd_expand
,
G_zstd_compress_bound
,
"ZSTD"
},
65
#else
66
{0,
G_zstd_compress
,
G_zstd_expand
,
G_zstd_compress_bound
,
"ZSTD"
},
67
#endif
68
{0,
NULL
,
NULL
,
NULL
,
NULL
}};
NULL
#define NULL
Definition
ccmath.h:32
G_bz2_compress
int G_bz2_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition
cmprbzip.c:85
G_bz2_expand
int G_bz2_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition
cmprbzip.c:168
G_bz2_compress_bound
int G_bz2_compress_bound(int src_sz)
Definition
cmprbzip.c:72
G_lz4_compress
int G_lz4_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition
cmprlz4.c:78
G_lz4_expand
int G_lz4_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition
cmprlz4.c:146
G_lz4_compress_bound
int G_lz4_compress_bound(int src_sz)
Definition
cmprlz4.c:70
G_rle_compress_bound
int G_rle_compress_bound(int src_sz)
Definition
cmprrle.c:68
G_rle_compress
int G_rle_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition
cmprrle.c:73
G_rle_expand
int G_rle_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition
cmprrle.c:139
G_zstd_compress_bound
int G_zstd_compress_bound(int src_sz)
Definition
cmprzstd.c:72
G_zstd_compress
int G_zstd_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition
cmprzstd.c:86
G_zstd_expand
int G_zstd_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition
cmprzstd.c:162
G_no_compress
int G_no_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition
compress.c:155
G_no_compress_bound
int G_no_compress_bound(int src_sz)
Definition
compress.c:150
G_no_expand
int G_no_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition
compress.c:176
G_zlib_compress_bound
int G_zlib_compress_bound(int)
expand_fn
int expand_fn(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition
compress.h:30
compressor
struct compressor_list compressor[]
Definition
compress.h:53
compress_fn
int compress_fn(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
Definition
compress.h:28
bound_fn
int bound_fn(int src_sz)
Definition
compress.h:32
compressor_list
Definition
compress.h:34
compressor_list::bound
bound_fn * bound
Definition
compress.h:38
compressor_list::compress
compress_fn * compress
Definition
compress.h:36
compressor_list::expand
expand_fn * expand
Definition
compress.h:37
compressor_list::available
int available
Definition
compress.h:35
compressor_list::name
char * name
Definition
compress.h:39
gis
compress.h
Generated on
for GRASS 8 Programmer's Manual by
1.18.0