src/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 
00021   typedef unsigned char       uint8_t;
00022   typedef unsigned short      uint16_t;
00023   typedef unsigned int        uint32_t;
00024   typedef   signed int        int32_t;
00025   typedef unsigned long long  uint64_t;
00026   //typedef long long           int64_t;
00027         
00028 #endif
00029 
00030 #include <stdlib.h>
00031 #include "iochain.h"
00032 
00033 
00034 // Constants.
00035 #ifndef BSHUF_MIN_RECOMMEND_BLOCK
00036 #define BSHUF_MIN_RECOMMEND_BLOCK 128
00037 #define BSHUF_BLOCKED_MULT 8    // Block sizes must be multiple of this.
00038 #define BSHUF_TARGET_BLOCK_SIZE_B 8192
00039 #endif
00040 
00041 
00042 // Macros.
00043 #define CHECK_ERR_FREE(count, buf) if (count < 0) { free(buf); return count; }
00044 
00045 
00046 #ifdef __cplusplus
00047 extern "C" {
00048 #endif
00049 
00050 /* ---- Utility functions for internal use only ---- */
00051 
00052 int64_t bshuf_trans_bit_elem(const void* in, void* out, const size_t size,
00053         const size_t elem_size);
00054 
00055 /* Read a 32 bit unsigned integer from a buffer big endian order. */
00056 uint32_t bshuf_read_uint32_BE(const void* buf);
00057 
00058 /* Write a 32 bit unsigned integer to a buffer in big endian order. */
00059 void bshuf_write_uint32_BE(void* buf, uint32_t num);
00060 
00061 int64_t bshuf_untrans_bit_elem(const void* in, void* out, const size_t size,
00062         const size_t elem_size);
00063 
00064 /* Function definition for worker functions that process a single block. */
00065 typedef int64_t (*bshufBlockFunDef)(ioc_chain* C_ptr,
00066         const size_t size, const size_t elem_size);
00067 
00068 /* Wrap a function for processing a single block to process an entire buffer in
00069  * parallel. */
00070 int64_t bshuf_blocked_wrap_fun(bshufBlockFunDef fun, const void* in, void* out,
00071         const size_t size, const size_t elem_size, size_t block_size);
00072 
00073 #ifdef __cplusplus
00074 } // extern "C"
00075 #endif
00076 
00077 #endif  // BITSHUFFLE_INTERNALS_H

Generated on 28 May 2018 for CAFE by  doxygen 1.6.1