#ifndef ZFP_H
#define ZFP_H
#include "zfp/types.h"
#include "zfp/system.h"
#include "bitstream.h"
#define _zfp_str_(x) # x
#define _zfp_str(x) _zfp_str_(x)
#define ZFP_VERSION_MAJOR 0
#define ZFP_VERSION_MINOR 5
#define ZFP_VERSION_PATCH 5
#define ZFP_VERSION_RELEASE ZFP_VERSION_PATCH
#define ZFP_CODEC 5
#define ZFP_VERSION \
((ZFP_VERSION_MAJOR << 8) + \
(ZFP_VERSION_MINOR << 4) + \
(ZFP_VERSION_PATCH << 0))
#define ZFP_VERSION_STRING \
_zfp_str(ZFP_VERSION_MAJOR) "." \
_zfp_str(ZFP_VERSION_MINOR) "." \
_zfp_str(ZFP_VERSION_PATCH)
#define ZFP_MIN_BITS 1
#define ZFP_MAX_BITS 16657
#define ZFP_MAX_PREC 64
#define ZFP_MIN_EXP -1074
#define ZFP_HEADER_MAGIC 0x1u
#define ZFP_HEADER_META 0x2u
#define ZFP_HEADER_MODE 0x4u
#define ZFP_HEADER_FULL 0x7u
#define ZFP_META_NULL (UINT64C(-1))
#define ZFP_MAGIC_BITS 32
#define ZFP_META_BITS 52
#define ZFP_MODE_SHORT_BITS 12
#define ZFP_MODE_LONG_BITS 64
#define ZFP_HEADER_MAX_BITS 148
#define ZFP_MODE_SHORT_MAX ((1u << ZFP_MODE_SHORT_BITS) - 2)
typedef enum {
zfp_exec_serial = 0,
zfp_exec_omp = 1,
zfp_exec_cuda = 2
} zfp_exec_policy;
typedef struct {
uint threads;
uint chunk_size;
} zfp_exec_params_omp;
typedef union {
zfp_exec_params_omp omp;
} zfp_exec_params;
typedef struct {
zfp_exec_policy policy;
zfp_exec_params params;
} zfp_execution;
typedef struct {
uint minbits;
uint maxbits;
uint maxprec;
int minexp;
bitstream* stream;
zfp_execution exec;
} zfp_stream;
typedef enum {
zfp_mode_null = 0,
zfp_mode_expert = 1,
zfp_mode_fixed_rate = 2,
zfp_mode_fixed_precision = 3,
zfp_mode_fixed_accuracy = 4,
zfp_mode_reversible = 5
} zfp_mode;
typedef enum {
zfp_type_none = 0,
zfp_type_int32 = 1,
zfp_type_int64 = 2,
zfp_type_float = 3,
zfp_type_double = 4
} zfp_type;
typedef struct {
zfp_type type;
uint nx, ny, nz, nw;
int sx, sy, sz, sw;
void* data;
} zfp_field;
#ifdef __cplusplus
extern "C" {
#endif
extern_ const uint zfp_codec_version;
extern_ const uint zfp_library_version;
extern_ const char* const zfp_version_string;
size_t
zfp_type_size(
zfp_type type
);
zfp_stream*
zfp_stream_open(
bitstream* stream
);
void
zfp_stream_close(
zfp_stream* stream
);
bitstream*
zfp_stream_bit_stream(
const zfp_stream* stream
);
zfp_mode
zfp_stream_compression_mode(
const zfp_stream* stream
);
uint64
zfp_stream_mode(
const zfp_stream* stream
);
void
zfp_stream_params(
const zfp_stream* stream,
uint* minbits,
uint* maxbits,
uint* maxprec,
int* minexp
);
size_t
zfp_stream_compressed_size(
const zfp_stream* stream
);
size_t
zfp_stream_maximum_size(
const zfp_stream* stream,
const zfp_field* field
);
void
zfp_stream_rewind(
zfp_stream* stream
);
void
zfp_stream_set_bit_stream(
zfp_stream* stream,
bitstream* bs
);
void
zfp_stream_set_reversible(
zfp_stream* stream
);
double
zfp_stream_set_rate(
zfp_stream* stream,
double rate,
zfp_type type,
uint dims,
int wra
);
uint
zfp_stream_set_precision(
zfp_stream* stream,
uint precision
);
double
zfp_stream_set_accuracy(
zfp_stream* stream,
double tolerance
);
zfp_mode
zfp_stream_set_mode(
zfp_stream* stream,
uint64 mode
);
int
zfp_stream_set_params(
zfp_stream* stream,
uint minbits,
uint maxbits,
uint maxprec,
int minexp
);
zfp_exec_policy
zfp_stream_execution(
const zfp_stream* stream
);
uint
zfp_stream_omp_threads(
const zfp_stream* stream
);
uint
zfp_stream_omp_chunk_size(
const zfp_stream* stream
);
int
zfp_stream_set_execution(
zfp_stream* stream,
zfp_exec_policy policy
);
int
zfp_stream_set_omp_threads(
zfp_stream* stream,
uint threads
);
int
zfp_stream_set_omp_chunk_size(
zfp_stream* stream,
uint chunk_size
);
zfp_field*
zfp_field_alloc();
zfp_field*
zfp_field_1d(
void* pointer,
zfp_type type,
uint nx
);
zfp_field*
zfp_field_2d(
void* pointer,
zfp_type type,
uint nx,
uint ny
);
zfp_field*
zfp_field_3d(
void* pointer,
zfp_type type,
uint nx,
uint ny,
uint nz
);
zfp_field*
zfp_field_4d(
void* pointer,
zfp_type type,
uint nx,
uint ny,
uint nz,
uint nw
);
void
zfp_field_free(
zfp_field* field
);
void*
zfp_field_pointer(
const zfp_field* field
);
zfp_type
zfp_field_type(
const zfp_field* field
);
uint
zfp_field_precision(
const zfp_field* field
);
uint
zfp_field_dimensionality(
const zfp_field* field
);
size_t
zfp_field_size(
const zfp_field* field,
uint* size
);
int
zfp_field_stride(
const zfp_field* field,
int* stride
);
uint64
zfp_field_metadata(
const zfp_field* field
);
void
zfp_field_set_pointer(
zfp_field* field,
void* pointer
);
zfp_type
zfp_field_set_type(
zfp_field* field,
zfp_type type
);
void
zfp_field_set_size_1d(
zfp_field* field,
uint nx
);
void
zfp_field_set_size_2d(
zfp_field* field,
uint nx,
uint ny
);
void
zfp_field_set_size_3d(
zfp_field* field,
uint nx,
uint ny,
uint nz
);
void
zfp_field_set_size_4d(
zfp_field* field,
uint nx,
uint ny,
uint nz,
uint nw
);
void
zfp_field_set_stride_1d(
zfp_field* field,
int sx
);
void
zfp_field_set_stride_2d(
zfp_field* field,
int sx,
int sy
);
void
zfp_field_set_stride_3d(
zfp_field* field,
int sx,
int sy,
int sz
);
void
zfp_field_set_stride_4d(
zfp_field* field,
int sx,
int sy,
int sz,
int sw
);
int
zfp_field_set_metadata(
zfp_field* field,
uint64 meta
);
size_t
zfp_compress(
zfp_stream* stream,
const zfp_field* field
);
size_t
zfp_decompress(
zfp_stream* stream,
zfp_field* field
);
size_t
zfp_write_header(
zfp_stream* stream,
const zfp_field* field,
uint mask
);
size_t
zfp_read_header(
zfp_stream* stream,
zfp_field* field,
uint mask
);
size_t
zfp_stream_flush(
zfp_stream* stream
);
size_t
zfp_stream_align(
zfp_stream* stream
);
uint zfp_encode_block_int32_1(zfp_stream* stream, const int32* block);
uint zfp_encode_block_int64_1(zfp_stream* stream, const int64* block);
uint zfp_encode_block_float_1(zfp_stream* stream, const float* block);
uint zfp_encode_block_double_1(zfp_stream* stream, const double* block);
uint zfp_encode_block_strided_int32_1(zfp_stream* stream, const int32* p, int sx);
uint zfp_encode_block_strided_int64_1(zfp_stream* stream, const int64* p, int sx);
uint zfp_encode_block_strided_float_1(zfp_stream* stream, const float* p, int sx);
uint zfp_encode_block_strided_double_1(zfp_stream* stream, const double* p, int sx);
uint zfp_encode_partial_block_strided_int32_1(zfp_stream* stream, const int32* p, uint nx, int sx);
uint zfp_encode_partial_block_strided_int64_1(zfp_stream* stream, const int64* p, uint nx, int sx);
uint zfp_encode_partial_block_strided_float_1(zfp_stream* stream, const float* p, uint nx, int sx);
uint zfp_encode_partial_block_strided_double_1(zfp_stream* stream, const double* p, uint nx, int sx);
uint zfp_encode_block_int32_2(zfp_stream* stream, const int32* block);
uint zfp_encode_block_int64_2(zfp_stream* stream, const int64* block);
uint zfp_encode_block_float_2(zfp_stream* stream, const float* block);
uint zfp_encode_block_double_2(zfp_stream* stream, const double* block);
uint zfp_encode_partial_block_strided_int32_2(zfp_stream* stream, const int32* p, uint nx, uint ny, int sx, int sy);
uint zfp_encode_partial_block_strided_int64_2(zfp_stream* stream, const int64* p, uint nx, uint ny, int sx, int sy);
uint zfp_encode_partial_block_strided_float_2(zfp_stream* stream, const float* p, uint nx, uint ny, int sx, int sy);
uint zfp_encode_partial_block_strided_double_2(zfp_stream* stream, const double* p, uint nx, uint ny, int sx, int sy);
uint zfp_encode_block_strided_int32_2(zfp_stream* stream, const int32* p, int sx, int sy);
uint zfp_encode_block_strided_int64_2(zfp_stream* stream, const int64* p, int sx, int sy);
uint zfp_encode_block_strided_float_2(zfp_stream* stream, const float* p, int sx, int sy);
uint zfp_encode_block_strided_double_2(zfp_stream* stream, const double* p, int sx, int sy);
uint zfp_encode_block_int32_3(zfp_stream* stream, const int32* block);
uint zfp_encode_block_int64_3(zfp_stream* stream, const int64* block);
uint zfp_encode_block_float_3(zfp_stream* stream, const float* block);
uint zfp_encode_block_double_3(zfp_stream* stream, const double* block);
uint zfp_encode_block_strided_int32_3(zfp_stream* stream, const int32* p, int sx, int sy, int sz);
uint zfp_encode_block_strided_int64_3(zfp_stream* stream, const int64* p, int sx, int sy, int sz);
uint zfp_encode_block_strided_float_3(zfp_stream* stream, const float* p, int sx, int sy, int sz);
uint zfp_encode_block_strided_double_3(zfp_stream* stream, const double* p, int sx, int sy, int sz);
uint zfp_encode_partial_block_strided_int32_3(zfp_stream* stream, const int32* p, uint nx, uint ny, uint nz, int sx, int sy, int sz);
uint zfp_encode_partial_block_strided_int64_3(zfp_stream* stream, const int64* p, uint nx, uint ny, uint nz, int sx, int sy, int sz);
uint zfp_encode_partial_block_strided_float_3(zfp_stream* stream, const float* p, uint nx, uint ny, uint nz, int sx, int sy, int sz);
uint zfp_encode_partial_block_strided_double_3(zfp_stream* stream, const double* p, uint nx, uint ny, uint nz, int sx, int sy, int sz);
uint zfp_encode_block_int32_4(zfp_stream* stream, const int32* block);
uint zfp_encode_block_int64_4(zfp_stream* stream, const int64* block);
uint zfp_encode_block_float_4(zfp_stream* stream, const float* block);
uint zfp_encode_block_double_4(zfp_stream* stream, const double* block);
uint zfp_encode_block_strided_int32_4(zfp_stream* stream, const int32* p, int sx, int sy, int sz, int sw);
uint zfp_encode_block_strided_int64_4(zfp_stream* stream, const int64* p, int sx, int sy, int sz, int sw);
uint zfp_encode_block_strided_float_4(zfp_stream* stream, const float* p, int sx, int sy, int sz, int sw);
uint zfp_encode_block_strided_double_4(zfp_stream* stream, const double* p, int sx, int sy, int sz, int sw);
uint zfp_encode_partial_block_strided_int32_4(zfp_stream* stream, const int32* p, uint nx, uint ny, uint nz, uint nw, int sx, int sy, int sz, int sw);
uint zfp_encode_partial_block_strided_int64_4(zfp_stream* stream, const int64* p, uint nx, uint ny, uint nz, uint nw, int sx, int sy, int sz, int sw);
uint zfp_encode_partial_block_strided_float_4(zfp_stream* stream, const float* p, uint nx, uint ny, uint nz, uint nw, int sx, int sy, int sz, int sw);
uint zfp_encode_partial_block_strided_double_4(zfp_stream* stream, const double* p, uint nx, uint ny, uint nz, uint nw, int sx, int sy, int sz, int sw);
uint zfp_decode_block_int32_1(zfp_stream* stream, int32* block);
uint zfp_decode_block_int64_1(zfp_stream* stream, int64* block);
uint zfp_decode_block_float_1(zfp_stream* stream, float* block);
uint zfp_decode_block_double_1(zfp_stream* stream, double* block);
uint zfp_decode_block_strided_int32_1(zfp_stream* stream, int32* p, int sx);
uint zfp_decode_block_strided_int64_1(zfp_stream* stream, int64* p, int sx);
uint zfp_decode_block_strided_float_1(zfp_stream* stream, float* p, int sx);
uint zfp_decode_block_strided_double_1(zfp_stream* stream, double* p, int sx);
uint zfp_decode_partial_block_strided_int32_1(zfp_stream* stream, int32* p, uint nx, int sx);
uint zfp_decode_partial_block_strided_int64_1(zfp_stream* stream, int64* p, uint nx, int sx);
uint zfp_decode_partial_block_strided_float_1(zfp_stream* stream, float* p, uint nx, int sx);
uint zfp_decode_partial_block_strided_double_1(zfp_stream* stream, double* p, uint nx, int sx);
uint zfp_decode_block_int32_2(zfp_stream* stream, int32* block);
uint zfp_decode_block_int64_2(zfp_stream* stream, int64* block);
uint zfp_decode_block_float_2(zfp_stream* stream, float* block);
uint zfp_decode_block_double_2(zfp_stream* stream, double* block);
uint zfp_decode_block_strided_int32_2(zfp_stream* stream, int32* p, int sx, int sy);
uint zfp_decode_block_strided_int64_2(zfp_stream* stream, int64* p, int sx, int sy);
uint zfp_decode_block_strided_float_2(zfp_stream* stream, float* p, int sx, int sy);
uint zfp_decode_block_strided_double_2(zfp_stream* stream, double* p, int sx, int sy);
uint zfp_decode_partial_block_strided_int32_2(zfp_stream* stream, int32* p, uint nx, uint ny, int sx, int sy);
uint zfp_decode_partial_block_strided_int64_2(zfp_stream* stream, int64* p, uint nx, uint ny, int sx, int sy);
uint zfp_decode_partial_block_strided_float_2(zfp_stream* stream, float* p, uint nx, uint ny, int sx, int sy);
uint zfp_decode_partial_block_strided_double_2(zfp_stream* stream, double* p, uint nx, uint ny, int sx, int sy);
uint zfp_decode_block_int32_3(zfp_stream* stream, int32* block);
uint zfp_decode_block_int64_3(zfp_stream* stream, int64* block);
uint zfp_decode_block_float_3(zfp_stream* stream, float* block);
uint zfp_decode_block_double_3(zfp_stream* stream, double* block);
uint zfp_decode_block_strided_int32_3(zfp_stream* stream, int32* p, int sx, int sy, int sz);
uint zfp_decode_block_strided_int64_3(zfp_stream* stream, int64* p, int sx, int sy, int sz);
uint zfp_decode_block_strided_float_3(zfp_stream* stream, float* p, int sx, int sy, int sz);
uint zfp_decode_block_strided_double_3(zfp_stream* stream, double* p, int sx, int sy, int sz);
uint zfp_decode_partial_block_strided_int32_3(zfp_stream* stream, int32* p, uint nx, uint ny, uint nz, int sx, int sy, int sz);
uint zfp_decode_partial_block_strided_int64_3(zfp_stream* stream, int64* p, uint nx, uint ny, uint nz, int sx, int sy, int sz);
uint zfp_decode_partial_block_strided_float_3(zfp_stream* stream, float* p, uint nx, uint ny, uint nz, int sx, int sy, int sz);
uint zfp_decode_partial_block_strided_double_3(zfp_stream* stream, double* p, uint nx, uint ny, uint nz, int sx, int sy, int sz);
uint zfp_decode_block_int32_4(zfp_stream* stream, int32* block);
uint zfp_decode_block_int64_4(zfp_stream* stream, int64* block);
uint zfp_decode_block_float_4(zfp_stream* stream, float* block);
uint zfp_decode_block_double_4(zfp_stream* stream, double* block);
uint zfp_decode_block_strided_int32_4(zfp_stream* stream, int32* p, int sx, int sy, int sz, int sw);
uint zfp_decode_block_strided_int64_4(zfp_stream* stream, int64* p, int sx, int sy, int sz, int sw);
uint zfp_decode_block_strided_float_4(zfp_stream* stream, float* p, int sx, int sy, int sz, int sw);
uint zfp_decode_block_strided_double_4(zfp_stream* stream, double* p, int sx, int sy, int sz, int sw);
uint zfp_decode_partial_block_strided_int32_4(zfp_stream* stream, int32* p, uint nx, uint ny, uint nz, uint nw, int sx, int sy, int sz, int sw);
uint zfp_decode_partial_block_strided_int64_4(zfp_stream* stream, int64* p, uint nx, uint ny, uint nz, uint nw, int sx, int sy, int sz, int sw);
uint zfp_decode_partial_block_strided_float_4(zfp_stream* stream, float* p, uint nx, uint ny, uint nz, uint nw, int sx, int sy, int sz, int sw);
uint zfp_decode_partial_block_strided_double_4(zfp_stream* stream, double* p, uint nx, uint ny, uint nz, uint nw, int sx, int sy, int sz, int sw);
void zfp_promote_int8_to_int32(int32* oblock, const int8* iblock, uint dims);
void zfp_promote_uint8_to_int32(int32* oblock, const uint8* iblock, uint dims);
void zfp_promote_int16_to_int32(int32* oblock, const int16* iblock, uint dims);
void zfp_promote_uint16_to_int32(int32* oblock, const uint16* iblock, uint dims);
void zfp_demote_int32_to_int8(int8* oblock, const int32* iblock, uint dims);
void zfp_demote_int32_to_uint8(uint8* oblock, const int32* iblock, uint dims);
void zfp_demote_int32_to_int16(int16* oblock, const int32* iblock, uint dims);
void zfp_demote_int32_to_uint16(uint16* oblock, const int32* iblock, uint dims);
#ifdef __cplusplus
}
#endif
#endif