source: branches/threaded/src/blosc.h @ 60

Revision 60, 3.3 KB checked in by faltet, 4 years ago (diff)

Replaced blosc_init_threads() by a more powerful blosc_set_nthreads().

The new routine allows to dinamically change the number of threads per
each compression/decompression call.

Line 
1/*********************************************************************
2  Blosc - Blocked Suffling and Compression Library
3
4  Author: Francesc Alted (faltet@pytables.org)
5
6  See LICENSES/BLOSC.txt for details about copyright and rights to use.
7**********************************************************************/
8
9
10#ifndef BLOSC_H
11#define BLOSC_H
12
13/* Version numbers */
14#define BLOSC_VERSION_MAJOR    0    /* for major interface/format changes  */
15#define BLOSC_VERSION_MINOR    9    /* for minor interface/format changes  */
16#define BLOSC_VERSION_RELEASE  0    /* for tweaks, bug-fixes, or development */
17
18#define BLOSC_VERSION_STRING   "0.9.0.dev"  /* string version.  Sync with above! */
19#define BLOSC_VERSION_DATE     "2010-03-30"      /* date version */
20
21/* The *_VERS_FORMAT should be just 1-byte long */
22#define BLOSC_VERSION_FORMAT    1   /* Blosc format version, starting at 1 */
23#define BLOSCLZ_VERSION_FORMAT  1   /* Blosclz format version, starting at 1 */
24
25/* The combined blosc and blosclz formats */
26#define BLOSC_VERSION_CFORMAT (BLOSC_VERSION_FORMAT << 8) & (BLOSCLZ_VERSION_FORMAT)
27
28
29/**
30
31   Initialize a pool of threads for compression/decompression.  If
32   `nthreads` is 1, then the serial version is chosen and a possible
33   previous existing pool is ended.  Returns the previous number of
34   threads.
35
36*/
37
38int
39blosc_set_nthreads(int nthreads);
40
41
42/**
43
44  Compress a block of data in the `src` buffer and returns the size of
45  compressed block.  The size of `src` buffer is specified by
46  `nbytes`.
47
48  `clevel` is the desired compression level and must be a number
49  between 0 (no compression) and 9 (maximum compression).
50
51  `doshuffle` specifies whether the shuffle compression preconditioner
52  should be applyied or not.  0 means not applying it and 1 means
53  applying it.
54
55  `bytesoftype` is the number of bytes for the atomic type in binary
56  `src` buffer.  This is only useful for the shuffle preconditioner.
57  Only a bytesoftype > 1 the will allow the shuffle to work.
58
59  The minimum `src` buffer size is 16.  The `dest` buffer must have at
60  least the size of the `src` buffer and can not be smaller than 66
61  bytes.  The `src` buffer and the `dest` buffer can not overlap.
62
63  If `src` buffer is not compressible (len(`dest`) >= len(`src`)), the
64  return value is zero and you should discard the contents of the
65  `dest` buffer.
66
67  A negative return value means that an internal error happened.  This
68  should never happen.  If you see this, please report it back
69  together with the buffer data causing this and compression settings.
70
71  Compression is memory safe and guaranteed not to write the `dest`
72  buffer more than what is specified in `nbytes`.
73
74 */
75
76unsigned int
77blosc_compress(int clevel, int doshuffle, size_t bytesoftype, size_t nbytes,
78               const void *src, void *dest);
79
80
81/**
82
83  Decompress a block of compressed data in `src`, put the result in
84  `dest` and returns the size of the decompressed block. If error
85  occurs, e.g. the compressed data is corrupted or the output buffer
86  is not large enough, then 0 (zero) or a negative value will be
87  returned instead.
88
89  The `src` buffer and the `dest` buffer can not overlap.
90
91  Decompression is memory safe and guaranteed not to write the `dest`
92  buffer more than what is specified in `dest_size`.
93
94*/
95
96unsigned int
97blosc_decompress(const void *src, void *dest, size_t dest_size);
98
99#endif
Note: See TracBrowser for help on using the repository browser.