include/bitshuffle/bitshuffle_internals.h

Go to the documentation of this file.
00001 /*
00002  * Bitshuffle - Filter for improving compression of typed binary data.
00003  *
00004  * This file is part of Bitshuffle
00005  * Author: Kiyoshi Masui <kiyo@physics.ubc.ca>
00006  * Website: http://www.github.com/kiyo-masui/bitshuffle
00007  * Created: 2014
00008  *
00009  * See LICENSE file for details about copyright and rights to use.
00010  */
00011 
00012 
00013 #ifndef BITSHUFFLE_INTERNALS_H
00014 #define BITSHUFFLE_INTERNALS_H
00015 
00016 // We assume GNU g++ defining `__cplusplus` has stdint.h
00017 #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199900L) || defined(__cplusplus)
00018 #include <stdint.h>
00019 #else
00020   typedef unsigned char       uint8_t;
00021   typedef unsigned short      uint16_t;
00022   typedef unsigned int        uint32_t;
00023   typedef   signed int        int32_t;
00024   typedef unsigned long long  uint64_t;
00025   typedef long long           int64_t;
00026 #endif
00027 
00028 #include <stdlib.h>
00029 #include "iochain.h"
00030 
00031 
00032 // Constants.
00033 #ifndef BSHUF_MIN_RECOMMEND_BLOCK
00034 #define BSHUF_MIN_RECOMMEND_BLOCK 128
00035 #define BSHUF_BLOCKED_MULT 8    // Block sizes must be multiple of this.
00036 #define BSHUF_TARGET_BLOCK_SIZE_B 8192
00037 #endif
00038 
00039 
00040 // Macros.
00041 #define CHECK_ERR_FREE(count, buf) if (count < 0) { free(buf); return count; }
00042 
00043 
00044 #ifdef __cplusplus
00045 extern "C" {
00046 #endif
00047 
00048 /* ---- Utility functions for internal use only ---- */
00049 
00050 int64_t bshuf_trans_bit_elem(const void* in, void* out, const size_t size,
00051         const size_t elem_size);
00052 
00053 /* Read a 32 bit unsigned integer from a buffer big endian order. */
00054 uint32_t bshuf_read_uint32_BE(const void* buf);
00055 
00056 /* Write a 32 bit unsigned integer to a buffer in big endian order. */
00057 void bshuf_write_uint32_BE(void* buf, uint32_t num);
00058 
00059 int64_t bshuf_untrans_bit_elem(const void* in, void* out, const size_t size,
00060         const size_t elem_size);
00061 
00062 /* Function definition for worker functions that process a single block. */
00063 typedef int64_t (*bshufBlockFunDef)(ioc_chain* C_ptr,
00064         const size_t size, const size_t elem_size);
00065 
00066 /* Wrap a function for processing a single block to process an entire buffer in
00067  * parallel. */
00068 int64_t bshuf_blocked_wrap_fun(bshufBlockFunDef fun, const void* in, void* out,
00069         const size_t size, const size_t elem_size, size_t block_size);
00070 
00071 #ifdef __cplusplus
00072 } // extern "C"
00073 #endif
00074 
00075 #endif  // BITSHUFFLE_INTERNALS_H

Generated on 28 May 2018 for CAFE by  doxygen 1.6.1