├── .gitmodules ├── src ├── miniz │ ├── zlib.h │ └── LICENSE ├── blosc2 │ ├── plugins │ │ ├── codecs │ │ │ ├── zfp │ │ │ │ ├── src │ │ │ │ │ ├── block1.h │ │ │ │ │ ├── block2.h │ │ │ │ │ ├── block3.h │ │ │ │ │ ├── block4.h │ │ │ │ │ ├── bitstream.c │ │ │ │ │ ├── template │ │ │ │ │ │ ├── codec1.c │ │ │ │ │ │ ├── codec.c │ │ │ │ │ │ ├── codec.h │ │ │ │ │ │ ├── revdecode1.c │ │ │ │ │ │ ├── revencode1.c │ │ │ │ │ │ ├── template.h │ │ │ │ │ │ ├── revcodecf.c │ │ │ │ │ │ ├── revdecode2.c │ │ │ │ │ │ ├── revencode2.c │ │ │ │ │ │ ├── decodei.c │ │ │ │ │ │ ├── revdecode3.c │ │ │ │ │ │ ├── revencode3.c │ │ │ │ │ │ ├── encodei.c │ │ │ │ │ │ ├── codec2.c │ │ │ │ │ │ ├── revdecode4.c │ │ │ │ │ │ ├── revencode4.c │ │ │ │ │ │ ├── codecf.c │ │ │ │ │ │ ├── revdecode.c │ │ │ │ │ │ ├── decodef.c │ │ │ │ │ │ ├── encode1.c │ │ │ │ │ │ ├── decode1.c │ │ │ │ │ │ ├── decode2.c │ │ │ │ │ │ ├── encode2.c │ │ │ │ │ │ ├── revdecodef.c │ │ │ │ │ │ ├── revencode.c │ │ │ │ │ │ ├── codec3.c │ │ │ │ │ │ ├── decode3.c │ │ │ │ │ │ ├── encode3.c │ │ │ │ │ │ └── revencodef.c │ │ │ │ │ ├── inline │ │ │ │ │ │ └── inline.h │ │ │ │ │ ├── traitsi.h │ │ │ │ │ ├── traitsl.h │ │ │ │ │ ├── decode1i.c │ │ │ │ │ ├── decode1l.c │ │ │ │ │ ├── decode2i.c │ │ │ │ │ ├── decode2l.c │ │ │ │ │ ├── decode3i.c │ │ │ │ │ ├── decode3l.c │ │ │ │ │ ├── decode4i.c │ │ │ │ │ ├── decode4l.c │ │ │ │ │ ├── encode1i.c │ │ │ │ │ ├── encode1l.c │ │ │ │ │ ├── encode2i.c │ │ │ │ │ ├── encode2l.c │ │ │ │ │ ├── encode3i.c │ │ │ │ │ ├── encode3l.c │ │ │ │ │ ├── encode4i.c │ │ │ │ │ ├── encode4l.c │ │ │ │ │ ├── decode1d.c │ │ │ │ │ ├── decode1f.c │ │ │ │ │ ├── decode2d.c │ │ │ │ │ ├── decode2f.c │ │ │ │ │ ├── decode3d.c │ │ │ │ │ ├── decode3f.c │ │ │ │ │ ├── decode4d.c │ │ │ │ │ ├── decode4f.c │ │ │ │ │ ├── encode1d.c │ │ │ │ │ ├── encode1f.c │ │ │ │ │ ├── encode2d.c │ │ │ │ │ ├── encode2f.c │ │ │ │ │ ├── encode3d.c │ │ │ │ │ ├── encode3f.c │ │ │ │ │ ├── encode4d.c │ │ │ │ │ ├── encode4f.c │ │ │ │ │ ├── traitsd.h │ │ │ │ │ ├── traitsf.h │ │ │ │ │ └── share │ │ │ │ │ │ └── omp.c │ │ │ │ ├── include │ │ │ │ │ └── zfp │ │ │ │ │ │ ├── macros.h │ │ │ │ │ │ ├── version.h │ │ │ │ │ │ └── system.h │ │ │ │ ├── zfp-private.h │ │ │ │ └── blosc2-zfp.h │ │ │ ├── CMakeLists.txt │ │ │ ├── ndlz │ │ │ │ ├── ndlz-private.h │ │ │ │ ├── ndlz.h │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── xxhash.c │ │ │ │ ├── ndlz8x8.h │ │ │ │ ├── ndlz.c │ │ │ │ └── ndlz4x4.h │ │ │ └── codecs-registry.c │ │ ├── filters │ │ │ ├── CMakeLists.txt │ │ │ ├── filters-registry.c │ │ │ ├── ndcell │ │ │ │ ├── ndcell.h │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── README.md │ │ │ └── ndmean │ │ │ │ ├── ndmean.h │ │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── plugin_utils.h │ ├── internal-complibs │ │ └── zstd │ │ │ ├── .gitignore │ │ │ ├── libzstd.pc.in │ │ │ ├── common │ │ │ ├── xxhash.c │ │ │ ├── debug.c │ │ │ ├── allocations.h │ │ │ └── zstd_common.c │ │ │ ├── module.modulemap │ │ │ ├── deprecated │ │ │ ├── zbuff_common.c │ │ │ └── zbuff_decompress.c │ │ │ ├── compress │ │ │ ├── zstd_compress_superblock.h │ │ │ ├── zstd_fast.h │ │ │ ├── zstd_double_fast.h │ │ │ ├── zstd_compress_literals.h │ │ │ ├── zstd_opt.h │ │ │ └── zstd_compress_sequences.h │ │ │ ├── dll │ │ │ └── example │ │ │ │ ├── fullbench-dll.sln │ │ │ │ └── Makefile │ │ │ ├── decompress │ │ │ ├── zstd_ddict.h │ │ │ └── zstd_decompress_block.h │ │ │ └── dictBuilder │ │ │ └── divsufsort.h │ ├── blosc │ │ ├── config.h │ │ ├── CTestTestfile.cmake │ │ ├── config.h.in │ │ ├── trunc-prec.h │ │ ├── fastcopy.h │ │ ├── delta.h │ │ ├── sframe.h │ │ ├── b2nd_utils.h │ │ ├── shuffle-generic.c │ │ ├── shuffle-avx2.h │ │ ├── shuffle-sse2.h │ │ ├── shuffle-altivec.h │ │ ├── bitshuffle-avx2.h │ │ ├── shuffle-neon.h │ │ ├── bitshuffle-neon.h │ │ ├── stune.h │ │ ├── bitshuffle-sse2.h │ │ ├── bitshuffle-altivec.h │ │ ├── cmake_install.cmake │ │ ├── timestamp.c │ │ ├── blosc2-stdio.c │ │ └── blosclz.h │ ├── Makefile │ ├── include │ │ └── blosc2 │ │ │ ├── filters-registry.h │ │ │ ├── codecs-registry.h │ │ │ ├── tuners-registry.h │ │ │ ├── blosc2-stdio.h │ │ │ └── blosc2-export.h │ ├── LICENSE.txt │ └── THANKS.rst ├── runcmake.sh ├── easylzma │ ├── README │ ├── pavlov │ │ ├── 7zVersion.h │ │ ├── 7zCrc.h │ │ ├── 7zBuf.c │ │ ├── Alloc.h │ │ ├── 7zBuf.h │ │ ├── Bcj2.h │ │ ├── 7zCrc.c │ │ ├── 7zBuf2.c │ │ ├── 7zFile.h │ │ ├── LzmaLib.c │ │ ├── BraIA64.c │ │ ├── Bra.h │ │ ├── LzHash.h │ │ ├── CpuArch.h │ │ └── Bra86.c │ ├── lzma_header.h │ ├── lzip_header.h │ ├── common_internal.c │ ├── easylzma │ │ ├── decompress.h │ │ └── compress.h │ ├── common_internal.h │ └── lzip_header.c └── lz4 │ └── LICENSE ├── INDEX ├── images ├── zmat_logo.png └── zmat_media.png ├── private ├── zipmat.mexa64 ├── zipmat.mexw64 ├── zipmat.mexmaca64 └── zipmat.mexmaci64 ├── .miss_hit ├── octave ├── darwin-x86_64 │ └── zipmat.mex ├── darwin-aarch64 │ └── zipmat.mex ├── gnu-linux-x86_64 │ └── zipmat.mex └── mingw32-x86_64 │ └── zipmat.mex ├── example ├── c │ └── Makefile ├── f90 │ └── Makefile ├── demo_zmat_basic.m └── zmat_speedbench.m ├── PKG_ADD ├── DESCRIPTION ├── Makefile ├── AUTHORS.txt ├── test └── test_zmat.m └── .travis.yml /.gitmodules: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/miniz/zlib.h: -------------------------------------------------------------------------------- 1 | miniz.h -------------------------------------------------------------------------------- /INDEX: -------------------------------------------------------------------------------- 1 | zmat >> ZMat 2 | zmat 3 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/block1.h: -------------------------------------------------------------------------------- 1 | #define DIMS 1 2 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/block2.h: -------------------------------------------------------------------------------- 1 | #define DIMS 2 2 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/block3.h: -------------------------------------------------------------------------------- 1 | #define DIMS 3 2 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/block4.h: -------------------------------------------------------------------------------- 1 | #define DIMS 4 2 | -------------------------------------------------------------------------------- /images/zmat_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeuroJSON/zmat/HEAD/images/zmat_logo.png -------------------------------------------------------------------------------- /images/zmat_media.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeuroJSON/zmat/HEAD/images/zmat_media.png -------------------------------------------------------------------------------- /private/zipmat.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeuroJSON/zmat/HEAD/private/zipmat.mexa64 -------------------------------------------------------------------------------- /private/zipmat.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeuroJSON/zmat/HEAD/private/zipmat.mexw64 -------------------------------------------------------------------------------- /private/zipmat.mexmaca64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeuroJSON/zmat/HEAD/private/zipmat.mexmaca64 -------------------------------------------------------------------------------- /private/zipmat.mexmaci64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeuroJSON/zmat/HEAD/private/zipmat.mexmaci64 -------------------------------------------------------------------------------- /.miss_hit: -------------------------------------------------------------------------------- 1 | project_root 2 | 3 | suppress_rule: "redundant_brackets" 4 | indent_function_file_body: false 5 | -------------------------------------------------------------------------------- /src/blosc2/internal-complibs/zstd/.gitignore: -------------------------------------------------------------------------------- 1 | # make install artefact 2 | libzstd.pc 3 | libzstd-nomt 4 | -------------------------------------------------------------------------------- /octave/darwin-x86_64/zipmat.mex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeuroJSON/zmat/HEAD/octave/darwin-x86_64/zipmat.mex -------------------------------------------------------------------------------- /octave/darwin-aarch64/zipmat.mex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeuroJSON/zmat/HEAD/octave/darwin-aarch64/zipmat.mex -------------------------------------------------------------------------------- /octave/gnu-linux-x86_64/zipmat.mex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeuroJSON/zmat/HEAD/octave/gnu-linux-x86_64/zipmat.mex -------------------------------------------------------------------------------- /octave/mingw32-x86_64/zipmat.mex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeuroJSON/zmat/HEAD/octave/mingw32-x86_64/zipmat.mex -------------------------------------------------------------------------------- /src/runcmake.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | rm -rf build 4 | mkdir build && cd build 5 | cmake $@ ../ 6 | make clean 7 | make 8 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/bitstream.c: -------------------------------------------------------------------------------- 1 | #include "bitstream.h" 2 | #include "inline/bitstream.c" 3 | 4 | const size_t stream_word_bits = wsize; 5 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(ndlz) 2 | add_subdirectory(zfp) 3 | 4 | set(SOURCES ${SOURCES} ../plugins/codecs/codecs-registry.c PARENT_SCOPE) -------------------------------------------------------------------------------- /src/blosc2/plugins/filters/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(ndcell) 2 | add_subdirectory(ndmean) 3 | 4 | set(SOURCES ${SOURCES} ../plugins/filters/filters-registry.c PARENT_SCOPE) -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/codec1.c: -------------------------------------------------------------------------------- 1 | /* order coefficients by polynomial degree/frequency */ 2 | cache_align_(static const uchar perm_1[4]) = { 3 | 0, 1, 2, 3 4 | }; 5 | -------------------------------------------------------------------------------- /src/blosc2/plugins/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(codecs) 2 | add_subdirectory(filters) 3 | 4 | set(SOURCES ${SOURCES} ../plugins/plugin_utils.c ../plugins/plugin_utils.h PARENT_SCOPE) 5 | -------------------------------------------------------------------------------- /example/c/Makefile: -------------------------------------------------------------------------------- 1 | LIBTYPE?=-static 2 | 3 | all: 4 | $(CC) -g -Wall -pedantic testzmat.c -o testzmat -I../../include -L../../lib $(LIBTYPE) -lzmat -lz -lpthread 5 | clean: 6 | -rm -f testzmat 7 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/include/zfp/macros.h: -------------------------------------------------------------------------------- 1 | #ifndef ZFP_MACROS_H 2 | #define ZFP_MACROS_H 3 | 4 | #define MIN(x, y) ((x) < (y) ? (x) : (y)) 5 | #define MAX(x, y) ((x) > (y) ? (x) : (y)) 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /src/easylzma/README: -------------------------------------------------------------------------------- 1 | pavlov/ - contains original lzma compress/decompress source from Igor Pavlov 2 | easylzma/ - contains the public api of this library 3 | ./ - contains the implementation of this wrapper library 4 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/codec.c: -------------------------------------------------------------------------------- 1 | /* true if max compressed size exceeds maxbits */ 2 | static int 3 | with_maxbits(uint maxbits, uint maxprec, uint size) 4 | { 5 | return (maxprec + 1) * size - 1 > maxbits; 6 | } 7 | -------------------------------------------------------------------------------- /example/f90/Makefile: -------------------------------------------------------------------------------- 1 | F90 :=gfortran 2 | 3 | all: 4 | $(F90) -g -Wall -pedantic -c ../../fortran90/zmatlib.f90 5 | $(F90) -g -Wall -pedantic testzmat.f90 -o testzmat -L../../lib -lzmat -lz -lpthread 6 | clean: 7 | -rm -f testzmat *.o *.mod 8 | -------------------------------------------------------------------------------- /PKG_ADD: -------------------------------------------------------------------------------- 1 | if(exist(file_in_loadpath('zipmat.mex'))) 2 | autoload('zipmat',file_in_loadpath('zipmat.mex')) 3 | else 4 | autoload('zipmat',file_in_loadpath(['octave' filesep regexprep(computer('arch'), 'darwin[0-9.]+-', 'darwin-') filesep 'zipmat.mex'])) 5 | end 6 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/inline/inline.h: -------------------------------------------------------------------------------- 1 | #ifndef INLINE_H 2 | #define INLINE_H 3 | 4 | #ifndef inline_ 5 | #if __STDC_VERSION__ >= 199901L 6 | #define inline_ static inline 7 | #else 8 | #define inline_ static 9 | #endif 10 | #endif 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /src/easylzma/pavlov/7zVersion.h: -------------------------------------------------------------------------------- 1 | #define MY_VER_MAJOR 4 2 | #define MY_VER_MINOR 63 3 | #define MY_VER_BUILD 0 4 | #define MY_VERSION "4.63" 5 | #define MY_DATE "2008-12-31" 6 | #define MY_COPYRIGHT ": Igor Pavlov : Public domain" 7 | #define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " : " MY_DATE 8 | -------------------------------------------------------------------------------- /src/blosc2/blosc/config.h: -------------------------------------------------------------------------------- 1 | #ifndef _CONFIGURATION_HEADER_GUARD_H_ 2 | #define _CONFIGURATION_HEADER_GUARD_H_ 3 | 4 | #define HAVE_ZLIB TRUE 5 | #define HAVE_ZLIB_NG TRUE 6 | #define HAVE_ZSTD TRUE 7 | /* #undef HAVE_IPP */ 8 | /* #undef BLOSC_DLL_EXPORT */ 9 | #define HAVE_PLUGINS TRUE 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /src/easylzma/lzma_header.h: -------------------------------------------------------------------------------- 1 | #ifndef __EASYLZMA_LZMA_HEADER__ 2 | #define __EASYLZMA_LZMA_HEADER__ 3 | 4 | #include "common_internal.h" 5 | 6 | /* LZMA-Alone header format gleaned from reading Igor's code */ 7 | 8 | void initializeLZMAFormatHandler(struct elzma_format_handler * hand); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/codec.h: -------------------------------------------------------------------------------- 1 | #define PERM _t1(perm, DIMS) /* coefficient order */ 2 | #define BLOCK_SIZE (1 << (2 * DIMS)) /* values per block */ 3 | #define EBIAS ((1 << (EBITS - 1)) - 1) /* exponent bias */ 4 | #define REVERSIBLE(zfp) ((zfp)->minexp < ZFP_MIN_EXP) /* reversible mode? */ 5 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/revdecode1.c: -------------------------------------------------------------------------------- 1 | /* private functions ------------------------------------------------------- */ 2 | 3 | /* reversible inverse decorrelating 1D transform */ 4 | static void 5 | _t2(rev_inv_xform, Int, 1)(Int* p) 6 | { 7 | /* transform along x */ 8 | _t1(rev_inv_lift, Int)(p, 1); 9 | } 10 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/revencode1.c: -------------------------------------------------------------------------------- 1 | /* private functions ------------------------------------------------------- */ 2 | 3 | /* reversible forward decorrelating 1D transform */ 4 | static void 5 | _t2(rev_fwd_xform, Int, 1)(Int* p) 6 | { 7 | /* transform along x */ 8 | _t1(rev_fwd_lift, Int)(p, 1); 9 | } 10 | -------------------------------------------------------------------------------- /src/blosc2/blosc/CTestTestfile.cmake: -------------------------------------------------------------------------------- 1 | # CMake generated Testfile for 2 | # Source directory: /home/fangq/space/git/Temp/c-blosc2/blosc 3 | # Build directory: /home/fangq/space/git/Temp/c-blosc2/blosc 4 | # 5 | # This file includes the relevant testing commands required for 6 | # testing this directory and lists subdirectories to be tested as well. 7 | -------------------------------------------------------------------------------- /src/easylzma/lzip_header.h: -------------------------------------------------------------------------------- 1 | #ifndef __EASYLZMA_LZIP_HEADER__ 2 | #define __EASYLZMA_LZIP_HEADER__ 3 | 4 | #include "common_internal.h" 5 | 6 | /* lzip file format documented here: 7 | * http://download.savannah.gnu.org/releases-noredirect/lzip/manual/ */ 8 | 9 | void initializeLZIPFormatHandler(struct elzma_format_handler * hand); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /src/blosc2/blosc/config.h.in: -------------------------------------------------------------------------------- 1 | #ifndef _CONFIGURATION_HEADER_GUARD_H_ 2 | #define _CONFIGURATION_HEADER_GUARD_H_ 3 | 4 | #cmakedefine HAVE_ZLIB @HAVE_ZLIB@ 5 | #cmakedefine HAVE_ZLIB_NG @HAVE_ZLIB_NG@ 6 | #cmakedefine HAVE_ZSTD @HAVE_ZSTD@ 7 | #cmakedefine HAVE_IPP @HAVE_IPP@ 8 | #cmakedefine BLOSC_DLL_EXPORT @DLL_EXPORT@ 9 | #cmakedefine HAVE_PLUGINS @HAVE_PLUGINS@ 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/traitsi.h: -------------------------------------------------------------------------------- 1 | /* 32-bit integer traits */ 2 | 3 | #define Scalar int32 /* integer type */ 4 | #define Int int32 /* corresponding signed integer type */ 5 | #define UInt uint32 /* corresponding unsigned integer type */ 6 | #define PBITS 5 /* number of bits needed to encode precision */ 7 | #define NBMASK 0xaaaaaaaau /* negabinary mask */ 8 | -------------------------------------------------------------------------------- /src/blosc2/plugins/plugin_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2021 The Blosc Developers 3 | http://blosc.org 4 | License: BSD 3-Clause (see LICENSE.txt) 5 | */ 6 | 7 | void swap_store(void *dest, const void *pa, int size); 8 | 9 | int32_t deserialize_meta(uint8_t *smeta, int32_t smeta_len, int8_t *ndim, int64_t *shape, 10 | int32_t *chunkshape, int32_t *blockshape); 11 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/template.h: -------------------------------------------------------------------------------- 1 | #ifndef TEMPLATE_H 2 | #define TEMPLATE_H 3 | 4 | /* concatenation */ 5 | #define _cat2(x, y) x ## _ ## y 6 | #define _cat3(x, y, z) x ## _ ## y ## _ ## z 7 | 8 | /* 1- and 2-argument function templates */ 9 | #define _t1(function, arg) _cat2(function, arg) 10 | #define _t2(function, type, dims) _cat3(function, type, dims) 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/revcodecf.c: -------------------------------------------------------------------------------- 1 | /* inverse block-floating-point transform from signed integers */ 2 | static void 3 | _t1(rev_inv_cast, Scalar)(const Int* iblock, Scalar* fblock, uint n, int emax) 4 | { 5 | /* test for all-zero block, which needs special treatment */ 6 | if (emax != -EBIAS) 7 | _t1(inv_cast, Scalar)(iblock, fblock, n, emax); 8 | else 9 | while (n--) 10 | *fblock++ = 0; 11 | } 12 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/traitsl.h: -------------------------------------------------------------------------------- 1 | /* 64-bit integer traits */ 2 | 3 | #define Scalar int64 /* integer type */ 4 | #define Int int64 /* corresponding signed integer type */ 5 | #define UInt uint64 /* corresponding unsigned integer type */ 6 | #define PBITS 6 /* number of bits needed to encode precision */ 7 | #define NBMASK UINT64C(0xaaaaaaaaaaaaaaaa) /* negabinary mask */ 8 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/revdecode2.c: -------------------------------------------------------------------------------- 1 | /* private functions ------------------------------------------------------- */ 2 | 3 | /* reversible inverse decorrelating 2D transform */ 4 | static void 5 | _t2(rev_inv_xform, Int, 2)(Int* p) 6 | { 7 | uint x, y; 8 | /* transform along y */ 9 | for (x = 0; x < 4; x++) 10 | _t1(rev_inv_lift, Int)(p + 1 * x, 4); 11 | /* transform along x */ 12 | for (y = 0; y < 4; y++) 13 | _t1(rev_inv_lift, Int)(p + 4 * y, 1); 14 | } 15 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/revencode2.c: -------------------------------------------------------------------------------- 1 | /* private functions ------------------------------------------------------- */ 2 | 3 | /* reversible forward decorrelating 2D transform */ 4 | static void 5 | _t2(rev_fwd_xform, Int, 2)(Int* p) 6 | { 7 | uint x, y; 8 | /* transform along x */ 9 | for (y = 0; y < 4; y++) 10 | _t1(rev_fwd_lift, Int)(p + 4 * y, 1); 11 | /* transform along y */ 12 | for (x = 0; x < 4; x++) 13 | _t1(rev_fwd_lift, Int)(p + 1 * x, 4); 14 | } 15 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/decode1i.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block1.h" 5 | #include "traitsi.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codec1.c" 11 | #include "template/decode.c" 12 | #include "template/decodei.c" 13 | #include "template/decode1.c" 14 | #include "template/revdecode.c" 15 | #include "template/revdecode1.c" 16 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/decode1l.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block1.h" 5 | #include "traitsl.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codec1.c" 11 | #include "template/decode.c" 12 | #include "template/decodei.c" 13 | #include "template/decode1.c" 14 | #include "template/revdecode.c" 15 | #include "template/revdecode1.c" 16 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/decode2i.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block2.h" 5 | #include "traitsi.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codec2.c" 11 | #include "template/decode.c" 12 | #include "template/decodei.c" 13 | #include "template/decode2.c" 14 | #include "template/revdecode.c" 15 | #include "template/revdecode2.c" 16 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/decode2l.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block2.h" 5 | #include "traitsl.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codec2.c" 11 | #include "template/decode.c" 12 | #include "template/decodei.c" 13 | #include "template/decode2.c" 14 | #include "template/revdecode.c" 15 | #include "template/revdecode2.c" 16 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/decode3i.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block3.h" 5 | #include "traitsi.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codec3.c" 11 | #include "template/decode.c" 12 | #include "template/decodei.c" 13 | #include "template/decode3.c" 14 | #include "template/revdecode.c" 15 | #include "template/revdecode3.c" 16 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/decode3l.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block3.h" 5 | #include "traitsl.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codec3.c" 11 | #include "template/decode.c" 12 | #include "template/decodei.c" 13 | #include "template/decode3.c" 14 | #include "template/revdecode.c" 15 | #include "template/revdecode3.c" 16 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/decode4i.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block4.h" 5 | #include "traitsi.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codec4.c" 11 | #include "template/decode.c" 12 | #include "template/decodei.c" 13 | #include "template/decode4.c" 14 | #include "template/revdecode.c" 15 | #include "template/revdecode4.c" 16 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/decode4l.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block4.h" 5 | #include "traitsl.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codec4.c" 11 | #include "template/decode.c" 12 | #include "template/decodei.c" 13 | #include "template/decode4.c" 14 | #include "template/revdecode.c" 15 | #include "template/revdecode4.c" 16 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/encode1i.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block1.h" 5 | #include "traitsi.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codec1.c" 11 | #include "template/encode.c" 12 | #include "template/encodei.c" 13 | #include "template/encode1.c" 14 | #include "template/revencode.c" 15 | #include "template/revencode1.c" 16 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/encode1l.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block1.h" 5 | #include "traitsl.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codec1.c" 11 | #include "template/encode.c" 12 | #include "template/encodei.c" 13 | #include "template/encode1.c" 14 | #include "template/revencode.c" 15 | #include "template/revencode1.c" 16 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/encode2i.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block2.h" 5 | #include "traitsi.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codec2.c" 11 | #include "template/encode.c" 12 | #include "template/encodei.c" 13 | #include "template/encode2.c" 14 | #include "template/revencode.c" 15 | #include "template/revencode2.c" 16 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/encode2l.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block2.h" 5 | #include "traitsl.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codec2.c" 11 | #include "template/encode.c" 12 | #include "template/encodei.c" 13 | #include "template/encode2.c" 14 | #include "template/revencode.c" 15 | #include "template/revencode2.c" 16 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/encode3i.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block3.h" 5 | #include "traitsi.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codec3.c" 11 | #include "template/encode.c" 12 | #include "template/encodei.c" 13 | #include "template/encode3.c" 14 | #include "template/revencode.c" 15 | #include "template/revencode3.c" 16 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/encode3l.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block3.h" 5 | #include "traitsl.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codec3.c" 11 | #include "template/encode.c" 12 | #include "template/encodei.c" 13 | #include "template/encode3.c" 14 | #include "template/revencode.c" 15 | #include "template/revencode3.c" 16 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/encode4i.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block4.h" 5 | #include "traitsi.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codec4.c" 11 | #include "template/encode.c" 12 | #include "template/encodei.c" 13 | #include "template/encode4.c" 14 | #include "template/revencode.c" 15 | #include "template/revencode4.c" 16 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/encode4l.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block4.h" 5 | #include "traitsl.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codec4.c" 11 | #include "template/encode.c" 12 | #include "template/encodei.c" 13 | #include "template/encode4.c" 14 | #include "template/revencode.c" 15 | #include "template/revencode4.c" 16 | -------------------------------------------------------------------------------- /src/blosc2/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # blosc2 makefile 3 | ############################################################ 4 | 5 | BLOSC_SRC=blosc 6 | ZSTD_SRC=internal-complibs/zstd 7 | LIBBLOSC2=$(BLOSC_SRC)/lib/libblosc2.a 8 | 9 | export 10 | 11 | all: lib zstd 12 | 13 | lib: 14 | -$(MAKE) -C $(BLOSC_SRC) lib 15 | zstd: 16 | -$(MAKE) -C $(ZSTD_SRC) libzstd.a 17 | clean: 18 | -$(MAKE) -C $(BLOSC_SRC) clean 19 | -$(MAKE) -C $(ZSTD_SRC) clean 20 | 21 | .PHONY: all lib zstd clean 22 | 23 | .DEFAULT_GOAL := all 24 | -------------------------------------------------------------------------------- /src/blosc2/internal-complibs/zstd/libzstd.pc.in: -------------------------------------------------------------------------------- 1 | # ZSTD - standard compression algorithm 2 | # Copyright (c) Meta Platforms, Inc. and affiliates. 3 | # BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) 4 | 5 | prefix=@PREFIX@ 6 | exec_prefix=@EXEC_PREFIX@ 7 | includedir=@INCLUDEDIR@ 8 | libdir=@LIBDIR@ 9 | 10 | Name: zstd 11 | Description: fast lossless compression algorithm library 12 | URL: https://facebook.github.io/zstd/ 13 | Version: @VERSION@ 14 | Libs: -L${libdir} -lzstd 15 | Libs.private: @LIBS_PRIVATE@ 16 | Cflags: -I${includedir} 17 | -------------------------------------------------------------------------------- /example/demo_zmat_basic.m: -------------------------------------------------------------------------------- 1 | % addpath('../') 2 | 3 | % compression 4 | [dzip,info]=zmat(uint8(eye(5,5))) 5 | 6 | % decompression 7 | orig=reshape(zmat(dzip,0),info.size) 8 | 9 | % base64 encoding and decoding 10 | base64=zmat('zmat toolbox',1,'base64'); 11 | char(base64) 12 | 13 | orig=zmat(base64,0,'base64'); 14 | char(orig) 15 | 16 | % encode ND numeric array 17 | orig=single(rand(5)); 18 | [Aencoded,info]=zmat(orig,1,'lzma') 19 | 20 | % decode compressed ND array and restore size/type 21 | Adecoded=zmat(Aencoded,info) 22 | 23 | all(all(Adecoded==orig)) 24 | class(Adecoded) 25 | 26 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/decodei.c: -------------------------------------------------------------------------------- 1 | static uint _t2(rev_decode_block, Int, DIMS)(bitstream* stream, int minbits, int maxbits, Int* iblock); 2 | 3 | /* public functions -------------------------------------------------------- */ 4 | 5 | /* decode contiguous integer block */ 6 | size_t 7 | _t2(zfp_decode_block, Int, DIMS)(zfp_stream* zfp, Int* iblock) 8 | { 9 | return REVERSIBLE(zfp) ? _t2(rev_decode_block, Int, DIMS)(zfp->stream, zfp->minbits, zfp->maxbits, iblock) : _t2(decode_block, Int, DIMS)(zfp->stream, zfp->minbits, zfp->maxbits, zfp->maxprec, iblock); 10 | } 11 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/decode1d.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block1.h" 5 | #include "traitsd.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codecf.c" 11 | #include "template/codec1.c" 12 | #include "template/decode.c" 13 | #include "template/decodef.c" 14 | #include "template/decode1.c" 15 | #include "template/revcodecf.c" 16 | #include "template/revdecode.c" 17 | #include "template/revdecodef.c" 18 | #include "template/revdecode1.c" 19 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/decode1f.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block1.h" 5 | #include "traitsf.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codecf.c" 11 | #include "template/codec1.c" 12 | #include "template/decode.c" 13 | #include "template/decodef.c" 14 | #include "template/decode1.c" 15 | #include "template/revcodecf.c" 16 | #include "template/revdecode.c" 17 | #include "template/revdecodef.c" 18 | #include "template/revdecode1.c" 19 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/decode2d.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block2.h" 5 | #include "traitsd.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codecf.c" 11 | #include "template/codec2.c" 12 | #include "template/decode.c" 13 | #include "template/decodef.c" 14 | #include "template/decode2.c" 15 | #include "template/revcodecf.c" 16 | #include "template/revdecode.c" 17 | #include "template/revdecodef.c" 18 | #include "template/revdecode2.c" 19 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/decode2f.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block2.h" 5 | #include "traitsf.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codecf.c" 11 | #include "template/codec2.c" 12 | #include "template/decode.c" 13 | #include "template/decodef.c" 14 | #include "template/decode2.c" 15 | #include "template/revcodecf.c" 16 | #include "template/revdecode.c" 17 | #include "template/revdecodef.c" 18 | #include "template/revdecode2.c" 19 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/decode3d.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block3.h" 5 | #include "traitsd.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codecf.c" 11 | #include "template/codec3.c" 12 | #include "template/decode.c" 13 | #include "template/decodef.c" 14 | #include "template/decode3.c" 15 | #include "template/revcodecf.c" 16 | #include "template/revdecode.c" 17 | #include "template/revdecodef.c" 18 | #include "template/revdecode3.c" 19 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/decode3f.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block3.h" 5 | #include "traitsf.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codecf.c" 11 | #include "template/codec3.c" 12 | #include "template/decode.c" 13 | #include "template/decodef.c" 14 | #include "template/decode3.c" 15 | #include "template/revcodecf.c" 16 | #include "template/revdecode.c" 17 | #include "template/revdecodef.c" 18 | #include "template/revdecode3.c" 19 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/decode4d.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block4.h" 5 | #include "traitsd.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codecf.c" 11 | #include "template/codec4.c" 12 | #include "template/decode.c" 13 | #include "template/decodef.c" 14 | #include "template/decode4.c" 15 | #include "template/revcodecf.c" 16 | #include "template/revdecode.c" 17 | #include "template/revdecodef.c" 18 | #include "template/revdecode4.c" 19 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/decode4f.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block4.h" 5 | #include "traitsf.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codecf.c" 11 | #include "template/codec4.c" 12 | #include "template/decode.c" 13 | #include "template/decodef.c" 14 | #include "template/decode4.c" 15 | #include "template/revcodecf.c" 16 | #include "template/revdecode.c" 17 | #include "template/revdecodef.c" 18 | #include "template/revdecode4.c" 19 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/encode1d.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block1.h" 5 | #include "traitsd.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codecf.c" 11 | #include "template/codec1.c" 12 | #include "template/encode.c" 13 | #include "template/encodef.c" 14 | #include "template/encode1.c" 15 | #include "template/revcodecf.c" 16 | #include "template/revencode.c" 17 | #include "template/revencodef.c" 18 | #include "template/revencode1.c" 19 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/encode1f.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block1.h" 5 | #include "traitsf.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codecf.c" 11 | #include "template/codec1.c" 12 | #include "template/encode.c" 13 | #include "template/encodef.c" 14 | #include "template/encode1.c" 15 | #include "template/revcodecf.c" 16 | #include "template/revencode.c" 17 | #include "template/revencodef.c" 18 | #include "template/revencode1.c" 19 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/encode2d.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block2.h" 5 | #include "traitsd.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codecf.c" 11 | #include "template/codec2.c" 12 | #include "template/encode.c" 13 | #include "template/encodef.c" 14 | #include "template/encode2.c" 15 | #include "template/revcodecf.c" 16 | #include "template/revencode.c" 17 | #include "template/revencodef.c" 18 | #include "template/revencode2.c" 19 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/encode2f.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block2.h" 5 | #include "traitsf.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codecf.c" 11 | #include "template/codec2.c" 12 | #include "template/encode.c" 13 | #include "template/encodef.c" 14 | #include "template/encode2.c" 15 | #include "template/revcodecf.c" 16 | #include "template/revencode.c" 17 | #include "template/revencodef.c" 18 | #include "template/revencode2.c" 19 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/encode3d.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block3.h" 5 | #include "traitsd.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codecf.c" 11 | #include "template/codec3.c" 12 | #include "template/encode.c" 13 | #include "template/encodef.c" 14 | #include "template/encode3.c" 15 | #include "template/revcodecf.c" 16 | #include "template/revencode.c" 17 | #include "template/revencodef.c" 18 | #include "template/revencode3.c" 19 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/encode3f.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block3.h" 5 | #include "traitsf.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codecf.c" 11 | #include "template/codec3.c" 12 | #include "template/encode.c" 13 | #include "template/encodef.c" 14 | #include "template/encode3.c" 15 | #include "template/revcodecf.c" 16 | #include "template/revencode.c" 17 | #include "template/revencodef.c" 18 | #include "template/revencode3.c" 19 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/encode4d.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block4.h" 5 | #include "traitsd.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codecf.c" 11 | #include "template/codec4.c" 12 | #include "template/encode.c" 13 | #include "template/encodef.c" 14 | #include "template/encode4.c" 15 | #include "template/revcodecf.c" 16 | #include "template/revencode.c" 17 | #include "template/revencodef.c" 18 | #include "template/revencode4.c" 19 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/encode4f.c: -------------------------------------------------------------------------------- 1 | #include "inline/inline.h" 2 | #include "zfp.h" 3 | #include "zfp/macros.h" 4 | #include "block4.h" 5 | #include "traitsf.h" 6 | #include "template/template.h" 7 | #include "template/codec.h" 8 | #include "inline/bitstream.c" 9 | #include "template/codec.c" 10 | #include "template/codecf.c" 11 | #include "template/codec4.c" 12 | #include "template/encode.c" 13 | #include "template/encodef.c" 14 | #include "template/encode4.c" 15 | #include "template/revcodecf.c" 16 | #include "template/revencode.c" 17 | #include "template/revencodef.c" 18 | #include "template/revencode4.c" 19 | -------------------------------------------------------------------------------- /src/blosc2/include/blosc2/filters-registry.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | enum { 12 | BLOSC_FILTER_NDCELL = 32, 13 | BLOSC_FILTER_NDMEAN = 33, 14 | BLOSC_FILTER_BYTEDELTA = 34, 15 | }; 16 | 17 | void register_filters(void); 18 | -------------------------------------------------------------------------------- /src/easylzma/pavlov/7zCrc.h: -------------------------------------------------------------------------------- 1 | /* 7zCrc.h -- CRC32 calculation 2 | 2008-03-13 3 | Igor Pavlov 4 | Public domain */ 5 | 6 | #ifndef __7Z_CRC_H 7 | #define __7Z_CRC_H 8 | 9 | #include 10 | 11 | #include "Types.h" 12 | 13 | extern UInt32 g_CrcTable[]; 14 | 15 | void MY_FAST_CALL CrcGenerateTable(void); 16 | 17 | #define CRC_INIT_VAL 0xFFFFFFFF 18 | #define CRC_GET_DIGEST(crc) ((crc) ^ 0xFFFFFFFF) 19 | #define CRC_UPDATE_BYTE(crc, b) (g_CrcTable[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8)) 20 | 21 | UInt32 MY_FAST_CALL CrcUpdate(UInt32 crc, const void *data, size_t size); 22 | UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /src/blosc2/include/blosc2/codecs-registry.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | enum { 12 | BLOSC_CODEC_NDLZ = 32, 13 | BLOSC_CODEC_ZFP_FIXED_ACCURACY = 33, 14 | BLOSC_CODEC_ZFP_FIXED_PRECISION = 34, 15 | BLOSC_CODEC_ZFP_FIXED_RATE = 35, 16 | }; 17 | 18 | void register_codecs(void); 19 | -------------------------------------------------------------------------------- /src/easylzma/pavlov/7zBuf.c: -------------------------------------------------------------------------------- 1 | /* 7zBuf.c -- Byte Buffer 2 | 2008-03-28 3 | Igor Pavlov 4 | Public domain */ 5 | 6 | #include "7zBuf.h" 7 | 8 | void Buf_Init(CBuf *p) 9 | { 10 | p->data = 0; 11 | p->size = 0; 12 | } 13 | 14 | int Buf_Create(CBuf *p, size_t size, ISzAlloc *alloc) 15 | { 16 | p->size = 0; 17 | if (size == 0) 18 | { 19 | p->data = 0; 20 | return 1; 21 | } 22 | p->data = (Byte *)alloc->Alloc(alloc, size); 23 | if (p->data != 0) 24 | { 25 | p->size = size; 26 | return 1; 27 | } 28 | return 0; 29 | } 30 | 31 | void Buf_Free(CBuf *p, ISzAlloc *alloc) 32 | { 33 | alloc->Free(alloc, p->data); 34 | p->data = 0; 35 | p->size = 0; 36 | } 37 | -------------------------------------------------------------------------------- /src/easylzma/pavlov/Alloc.h: -------------------------------------------------------------------------------- 1 | /* Alloc.h -- Memory allocation functions 2 | 2008-03-13 3 | Igor Pavlov 4 | Public domain */ 5 | 6 | #ifndef __COMMON_ALLOC_H 7 | #define __COMMON_ALLOC_H 8 | 9 | #include 10 | 11 | void *MyAlloc(size_t size); 12 | void MyFree(void *address); 13 | 14 | #ifdef _WIN32 15 | 16 | void SetLargePageSize(); 17 | 18 | void *MidAlloc(size_t size); 19 | void MidFree(void *address); 20 | void *BigAlloc(size_t size); 21 | void BigFree(void *address); 22 | 23 | #else 24 | 25 | #define MidAlloc(size) MyAlloc(size) 26 | #define MidFree(address) MyFree(address) 27 | #define BigAlloc(size) MyAlloc(size) 28 | #define BigFree(address) MyFree(address) 29 | 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/revdecode3.c: -------------------------------------------------------------------------------- 1 | /* private functions ------------------------------------------------------- */ 2 | 3 | /* reversible inverse decorrelating 3D transform */ 4 | static void 5 | _t2(rev_inv_xform, Int, 3)(Int* p) 6 | { 7 | uint x, y, z; 8 | /* transform along z */ 9 | for (y = 0; y < 4; y++) 10 | for (x = 0; x < 4; x++) 11 | _t1(rev_inv_lift, Int)(p + 1 * x + 4 * y, 16); 12 | /* transform along y */ 13 | for (x = 0; x < 4; x++) 14 | for (z = 0; z < 4; z++) 15 | _t1(rev_inv_lift, Int)(p + 16 * z + 1 * x, 4); 16 | /* transform along x */ 17 | for (z = 0; z < 4; z++) 18 | for (y = 0; y < 4; y++) 19 | _t1(rev_inv_lift, Int)(p + 4 * y + 16 * z, 1); 20 | } 21 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/revencode3.c: -------------------------------------------------------------------------------- 1 | /* private functions ------------------------------------------------------- */ 2 | 3 | /* reversible forward decorrelating 3D transform */ 4 | static void 5 | _t2(rev_fwd_xform, Int, 3)(Int* p) 6 | { 7 | uint x, y, z; 8 | /* transform along x */ 9 | for (z = 0; z < 4; z++) 10 | for (y = 0; y < 4; y++) 11 | _t1(rev_fwd_lift, Int)(p + 4 * y + 16 * z, 1); 12 | /* transform along y */ 13 | for (x = 0; x < 4; x++) 14 | for (z = 0; z < 4; z++) 15 | _t1(rev_fwd_lift, Int)(p + 16 * z + 1 * x, 4); 16 | /* transform along z */ 17 | for (y = 0; y < 4; y++) 18 | for (x = 0; x < 4; x++) 19 | _t1(rev_fwd_lift, Int)(p + 1 * x + 4 * y, 16); 20 | } 21 | -------------------------------------------------------------------------------- /src/easylzma/pavlov/7zBuf.h: -------------------------------------------------------------------------------- 1 | /* 7zBuf.h -- Byte Buffer 2 | 2008-10-04 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_BUF_H 5 | #define __7Z_BUF_H 6 | 7 | #include "Types.h" 8 | 9 | typedef struct 10 | { 11 | Byte *data; 12 | size_t size; 13 | } CBuf; 14 | 15 | void Buf_Init(CBuf *p); 16 | int Buf_Create(CBuf *p, size_t size, ISzAlloc *alloc); 17 | void Buf_Free(CBuf *p, ISzAlloc *alloc); 18 | 19 | typedef struct 20 | { 21 | Byte *data; 22 | size_t size; 23 | size_t pos; 24 | } CDynBuf; 25 | 26 | void DynBuf_Construct(CDynBuf *p); 27 | void DynBuf_SeekToBeg(CDynBuf *p); 28 | int DynBuf_Write(CDynBuf *p, const Byte *buf, size_t size, ISzAlloc *alloc); 29 | void DynBuf_Free(CDynBuf *p, ISzAlloc *alloc); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/blosc2/blosc/trunc-prec.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | #ifndef BLOSC_TRUNC_PREC_H 12 | #define BLOSC_TRUNC_PREC_H 13 | 14 | #include 15 | #include 16 | 17 | int truncate_precision(int8_t prec_bits, int32_t typesize, int32_t nbytes, 18 | const uint8_t* src, uint8_t* dest); 19 | 20 | #endif //BLOSC_TRUNC_PREC_H 21 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/encodei.c: -------------------------------------------------------------------------------- 1 | static uint _t2(rev_encode_block, Int, DIMS)(bitstream* stream, int minbits, int maxbits, int maxprec, Int* iblock); 2 | 3 | /* public functions -------------------------------------------------------- */ 4 | 5 | /* encode contiguous integer block */ 6 | size_t 7 | _t2(zfp_encode_block, Int, DIMS)(zfp_stream* zfp, const Int* iblock) 8 | { 9 | cache_align_(Int block[BLOCK_SIZE]); 10 | uint i; 11 | /* copy block */ 12 | for (i = 0; i < BLOCK_SIZE; i++) 13 | block[i] = iblock[i]; 14 | return REVERSIBLE(zfp) ? _t2(rev_encode_block, Int, DIMS)(zfp->stream, zfp->minbits, zfp->maxbits, zfp->maxprec, block) : _t2(encode_block, Int, DIMS)(zfp->stream, zfp->minbits, zfp->maxbits, zfp->maxprec, block); 15 | } 16 | -------------------------------------------------------------------------------- /src/easylzma/pavlov/Bcj2.h: -------------------------------------------------------------------------------- 1 | /* Bcj2.h -- Converter for x86 code (BCJ2) 2 | 2008-10-04 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __BCJ2_H 5 | #define __BCJ2_H 6 | 7 | #include "Types.h" 8 | 9 | /* 10 | Conditions: 11 | outSize <= FullOutputSize, 12 | where FullOutputSize is full size of output stream of x86_2 filter. 13 | 14 | If buf0 overlaps outBuf, there are two required conditions: 15 | 1) (buf0 >= outBuf) 16 | 2) (buf0 + size0 >= outBuf + FullOutputSize). 17 | 18 | Returns: 19 | SZ_OK 20 | SZ_ERROR_DATA - Data error 21 | */ 22 | 23 | int Bcj2_Decode( 24 | const Byte *buf0, SizeT size0, 25 | const Byte *buf1, SizeT size1, 26 | const Byte *buf2, SizeT size2, 27 | const Byte *buf3, SizeT size3, 28 | Byte *outBuf, SizeT outSize); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/codec2.c: -------------------------------------------------------------------------------- 1 | #define index(i, j) ((i) + 4 * (j)) 2 | 3 | /* order coefficients (i, j) by i + j, then i^2 + j^2 */ 4 | cache_align_(static const uchar perm_2[16]) = { 5 | index(0, 0), /* 0 : 0 */ 6 | 7 | index(1, 0), /* 1 : 1 */ 8 | index(0, 1), /* 2 : 1 */ 9 | 10 | index(1, 1), /* 3 : 2 */ 11 | 12 | index(2, 0), /* 4 : 2 */ 13 | index(0, 2), /* 5 : 2 */ 14 | 15 | index(2, 1), /* 6 : 3 */ 16 | index(1, 2), /* 7 : 3 */ 17 | 18 | index(3, 0), /* 8 : 3 */ 19 | index(0, 3), /* 9 : 3 */ 20 | 21 | index(2, 2), /* 10 : 4 */ 22 | 23 | index(3, 1), /* 11 : 4 */ 24 | index(1, 3), /* 12 : 4 */ 25 | 26 | index(3, 2), /* 13 : 5 */ 27 | index(2, 3), /* 14 : 5 */ 28 | 29 | index(3, 3), /* 15 : 6 */ 30 | }; 31 | 32 | #undef index 33 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Name: zmat 2 | Version: 0.9.9 3 | Date: 2023-22-10 4 | Title: In-memory data compression with zlib/gzip/lzma/lz4/zstd/blosc2 for Octave 5 | Author: Qianqian Fang 6 | Maintainer: Qianqian Fang 7 | Description: ZMat is a portable mex function to enable zlib/gzip/lzma/lz4/zstd/blosc2 8 | based data compression/decompression and base64 encoding/decoding support 9 | in MATLAB and GNU Octave. It is fast and compact, can process a large 10 | array within a fraction of a second. Among the supported compression 11 | methods, lz4 is the fastest for compression/decompression; lzma is the 12 | slowest but has the highest compression ratio; zlib/gzip have excellent 13 | balance between speed and compression time. 14 | URL: https://neurojson.org/zmat 15 | License: GPLv3+ 16 | Categories: Compression 17 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/traitsd.h: -------------------------------------------------------------------------------- 1 | /* double-precision floating-point traits */ 2 | 3 | #define Scalar double /* floating-point type */ 4 | #define Int int64 /* corresponding signed integer type */ 5 | #define UInt uint64 /* corresponding unsigned integer type */ 6 | #define EBITS 11 /* number of exponent bits */ 7 | #define PBITS 6 /* number of bits needed to encode precision */ 8 | #define NBMASK UINT64C(0xaaaaaaaaaaaaaaaa) /* negabinary mask */ 9 | #define TCMASK UINT64C(0x7fffffffffffffff) /* two's complement mask */ 10 | #define SCALAR_MIN DBL_MIN /* smallest positive normal number */ 11 | 12 | #define FABS(x) fabs(x) 13 | #define FREXP(x, e) frexp(x, e) 14 | #define LDEXP(x, e) ldexp(x, e) 15 | -------------------------------------------------------------------------------- /src/easylzma/pavlov/7zCrc.c: -------------------------------------------------------------------------------- 1 | /* 7zCrc.c -- CRC32 calculation 2 | 2008-08-05 3 | Igor Pavlov 4 | Public domain */ 5 | 6 | #include "7zCrc.h" 7 | 8 | #define kCrcPoly 0xEDB88320 9 | UInt32 g_CrcTable[256]; 10 | 11 | void MY_FAST_CALL CrcGenerateTable(void) 12 | { 13 | UInt32 i; 14 | for (i = 0; i < 256; i++) 15 | { 16 | UInt32 r = i; 17 | int j; 18 | for (j = 0; j < 8; j++) 19 | r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1)); 20 | g_CrcTable[i] = r; 21 | } 22 | } 23 | 24 | UInt32 MY_FAST_CALL CrcUpdate(UInt32 v, const void *data, size_t size) 25 | { 26 | const Byte *p = (const Byte *)data; 27 | for (; size > 0 ; size--, p++) 28 | v = CRC_UPDATE_BYTE(v, *p); 29 | return v; 30 | } 31 | 32 | UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size) 33 | { 34 | return CrcUpdate(CRC_INIT_VAL, data, size) ^ 0xFFFFFFFF; 35 | } 36 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # ZMat: A portable C-library and MATLAB/Octave toolbox for inline data compression 3 | # 4 | # Author: Qianqian Fang 5 | ############################################################ 6 | 7 | PKGNAME=zmat 8 | LIBNAME=lib$(PKGNAME) 9 | MEXNAME=zipmat 10 | VERSION=0.9.9 11 | SOURCE=src 12 | EXAMPLE=example/c 13 | 14 | all: mex oct lib dll example 15 | 16 | lib: 17 | -$(MAKE) -C $(SOURCE) lib 18 | dll: 19 | -$(MAKE) -C $(SOURCE) dll 20 | mex: 21 | -$(MAKE) -C $(SOURCE) mex 22 | oct: 23 | -$(MAKE) -C $(SOURCE) oct 24 | example: lib 25 | -$(MAKE) -C $(EXAMPLE) all 26 | clean: 27 | -rm -rf $(LIBNAME).* $(MEXNAME).mex* 28 | -$(MAKE) -C $(SOURCE) clean 29 | -$(MAKE) -C $(EXAMPLE) clean 30 | 31 | .DEFAULT_GOAL := mex 32 | 33 | .PHONY: all lib dll mex oct example clean 34 | -------------------------------------------------------------------------------- /src/blosc2/blosc/fastcopy.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | #ifndef BLOSC_FASTCOPY_H 12 | #define BLOSC_FASTCOPY_H 13 | 14 | /* Same semantics than memcpy() */ 15 | unsigned char *fastcopy(unsigned char *out, const unsigned char *from, unsigned len); 16 | 17 | /* Same as fastcopy() but without overwriting origin or destination when they overlap */ 18 | unsigned char* copy_match(unsigned char *out, const unsigned char *from, unsigned len); 19 | 20 | #endif //BLOSC_FASTCOPY_H 21 | -------------------------------------------------------------------------------- /src/blosc2/plugins/filters/filters-registry.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2021 The Blosc Developers 3 | http://blosc.org 4 | License: BSD 3-Clause (see LICENSE.txt) 5 | */ 6 | 7 | #include 8 | #include "blosc2/filters-registry.h" 9 | #include "ndmean/ndmean.h" 10 | #include "ndcell/ndcell.h" 11 | 12 | void register_filters(void) { 13 | 14 | blosc2_filter ndcell; 15 | ndcell.id = BLOSC_FILTER_NDCELL; 16 | ndcell.forward = (blosc2_filter_forward_cb) ndcell_encoder; 17 | ndcell.backward = (blosc2_filter_backward_cb) ndcell_decoder; 18 | register_filter_private(&ndcell); 19 | 20 | blosc2_filter ndmean; 21 | ndmean.id = BLOSC_FILTER_NDMEAN; 22 | ndmean.forward = (blosc2_filter_forward_cb) ndmean_encoder; 23 | ndmean.backward = (blosc2_filter_backward_cb) ndmean_decoder; 24 | register_filter_private(&ndmean); 25 | 26 | } -------------------------------------------------------------------------------- /src/blosc2/blosc/delta.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | #ifndef BLOSC_DELTA_H 12 | #define BLOSC_DELTA_H 13 | 14 | #include 15 | #include 16 | 17 | void delta_encoder(const uint8_t* dref, int32_t offset, int32_t nbytes, 18 | int32_t typesize, const uint8_t* src, uint8_t* dest); 19 | 20 | void delta_decoder(const uint8_t* dref, int32_t offset, int32_t nbytes, 21 | int32_t typesize, uint8_t* dest); 22 | 23 | #endif //BLOSC_DELTA_H 24 | -------------------------------------------------------------------------------- /src/blosc2/plugins/filters/ndcell/ndcell.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | #ifndef CATERVA_NDCELL_H 12 | #define CATERVA_NDCELL_H 13 | 14 | #include 15 | 16 | #define NDCELL_MAX_DIM 8 17 | 18 | 19 | int ndcell_encoder(const uint8_t* input, uint8_t* output, int32_t length, uint8_t meta, blosc2_cparams* cparams); 20 | 21 | int ndcell_decoder(const uint8_t* input, uint8_t* output, int32_t length, uint8_t meta, blosc2_dparams* dparams); 22 | 23 | #endif //CATERVA_NDCELL_H 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/blosc2/plugins/filters/ndmean/ndmean.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | #ifndef CATERVA_NDMEAN_H 12 | #define CATERVA_NDMEAN_H 13 | 14 | #include "blosc2.h" 15 | 16 | #define NDMEAN_MAX_DIM 8 17 | 18 | 19 | int ndmean_encoder(const uint8_t* input, uint8_t* output, int32_t length, uint8_t meta, blosc2_cparams* cparams); 20 | 21 | int ndmean_decoder(const uint8_t* input, uint8_t* output, int32_t length, uint8_t meta, blosc2_dparams* dparams); 22 | 23 | #endif //CATERVA_NDMEAN_H 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/blosc2/internal-complibs/zstd/common/xxhash.c: -------------------------------------------------------------------------------- 1 | /* 2 | * xxHash - Fast Hash algorithm 3 | * Copyright (c) Meta Platforms, Inc. and affiliates. 4 | * 5 | * You can contact the author at : 6 | * - xxHash homepage: https://cyan4973.github.io/xxHash/ 7 | * - xxHash source repository : https://github.com/Cyan4973/xxHash 8 | * 9 | * This source code is licensed under both the BSD-style license (found in the 10 | * LICENSE file in the root directory of this source tree) and the GPLv2 (found 11 | * in the COPYING file in the root directory of this source tree). 12 | * You may select, at your option, one of the above-listed licenses. 13 | */ 14 | 15 | 16 | 17 | /* 18 | * xxhash.c instantiates functions defined in xxhash.h 19 | */ 20 | 21 | #define XXH_STATIC_LINKING_ONLY /* access advanced declarations */ 22 | #define XXH_IMPLEMENTATION /* access definitions */ 23 | 24 | #include "xxhash.h" 25 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/traitsf.h: -------------------------------------------------------------------------------- 1 | /* single-precision floating-point traits */ 2 | 3 | #define Scalar float /* floating-point type */ 4 | #define Int int32 /* corresponding signed integer type */ 5 | #define UInt uint32 /* corresponding unsigned integer type */ 6 | #define EBITS 8 /* number of exponent bits */ 7 | #define PBITS 5 /* number of bits needed to encode precision */ 8 | #define NBMASK 0xaaaaaaaau /* negabinary mask */ 9 | #define TCMASK 0x7fffffffu /* two's complement mask */ 10 | #define SCALAR_MIN FLT_MIN /* smallest positive normal number */ 11 | 12 | #if __STDC_VERSION__ >= 199901L 13 | #define FABS(x) fabsf(x) 14 | #define FREXP(x, e) frexpf(x, e) 15 | #define LDEXP(x, e) ldexpf(x, e) 16 | #else 17 | #define FABS(x) (float)fabs(x) 18 | #define FREXP(x, e) (void)frexp(x, e) 19 | #define LDEXP(x, e) (float)ldexp(x, e) 20 | #endif 21 | -------------------------------------------------------------------------------- /src/blosc2/internal-complibs/zstd/common/debug.c: -------------------------------------------------------------------------------- 1 | /* ****************************************************************** 2 | * debug 3 | * Part of FSE library 4 | * Copyright (c) Meta Platforms, Inc. and affiliates. 5 | * 6 | * You can contact the author at : 7 | * - Source repository : https://github.com/Cyan4973/FiniteStateEntropy 8 | * 9 | * This source code is licensed under both the BSD-style license (found in the 10 | * LICENSE file in the root directory of this source tree) and the GPLv2 (found 11 | * in the COPYING file in the root directory of this source tree). 12 | * You may select, at your option, one of the above-listed licenses. 13 | ****************************************************************** */ 14 | 15 | 16 | /* 17 | * This module only hosts one global variable 18 | * which can be used to dynamically influence the verbosity of traces, 19 | * such as DEBUGLOG and RAWLOG 20 | */ 21 | 22 | #include "debug.h" 23 | 24 | int g_debuglevel = DEBUGLEVEL; 25 | -------------------------------------------------------------------------------- /src/blosc2/plugins/filters/ndcell/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # sources 2 | set(SOURCES ${SOURCES} ../plugins/filters/ndcell/ndcell.c ../plugins/filters/ndcell/ndcell.h PARENT_SCOPE) 3 | 4 | if(BUILD_TESTS) 5 | 6 | # targets 7 | add_executable(test_ndcell test_ndcell.c) 8 | # Define the BLOSC_TESTING symbol so normally-hidden functions 9 | # aren't hidden from the view of the test programs. 10 | set_property( 11 | TARGET test_ndcell 12 | APPEND PROPERTY COMPILE_DEFINITIONS BLOSC_TESTING) 13 | 14 | target_link_libraries(test_ndcell blosc_testing) 15 | 16 | # tests 17 | add_test(NAME test_plugin_test_ndcell 18 | COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) 19 | 20 | # Copy test files 21 | file(GLOB TESTS_DATA ../../test_data/*.caterva) 22 | foreach (data ${TESTS_DATA}) 23 | file(COPY ${data} 24 | DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) 25 | endforeach(data) 26 | endif() 27 | -------------------------------------------------------------------------------- /src/blosc2/include/blosc2/tuners-registry.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | #ifndef BLOSC_BLOSC2_TUNERS_UTILS_H 12 | #define BLOSC_BLOSC2_TUNERS_UTILS_H 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | enum { 19 | BLOSC_BTUNE = 32, 20 | }; 21 | 22 | void register_tuners(void); 23 | 24 | // For dynamically loaded tuners 25 | typedef struct { 26 | char *init; 27 | char *next_blocksize; 28 | char *next_cparams; 29 | char *update; 30 | char *free; 31 | } tuner_info; 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | #endif /* BLOSC_BLOSC2_TUNERS_UTILS_H */ 38 | -------------------------------------------------------------------------------- /src/blosc2/blosc/sframe.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | #ifndef BLOSC_SFRAME_H 12 | #define BLOSC_SFRAME_H 13 | 14 | void* sframe_open_index(const char* urlpath, const char* mode, const blosc2_io *io); 15 | void* sframe_open_chunk(const char* urlpath, int64_t nchunk, const char* mode, const blosc2_io *io); 16 | int sframe_delete_chunk(const char* urlpath, int64_t nchunk); 17 | void* sframe_create_chunk(blosc2_frame_s* frame, uint8_t* chunk, int64_t nchunk, int64_t cbytes); 18 | int32_t sframe_get_chunk(blosc2_frame_s* frame, int64_t nchunk, uint8_t** chunk, bool* needs_free); 19 | 20 | #endif //BLOSC_SFRAME_H 21 | -------------------------------------------------------------------------------- /AUTHORS.txt: -------------------------------------------------------------------------------- 1 | ZMAT is written by Qianqian Fang. Qianqian is currently an 2 | Associate Professor in the Department of Bioengineering at 3 | Northeastern University. 4 | 5 | Address: Dept. of Bioengineering 6 | Northeastern University 7 | 360 Huntington Ave, ISEC 206, Boston, MA 02115, USA 8 | URL: http://fanglab.org 9 | Email: 10 | 11 | ZMAT Website : https://github.com/NeuroJSON/zmat 12 | 13 | 14 | 15 | The base64_{encode,decode} functions in the zmat.cpp functions were copied from 16 | http://web.mit.edu/freebsd/head/contrib/wpa/src/utils/base64.c 17 | http://web.mit.edu/freebsd/head/contrib/wpa/src/utils/base64.h 18 | written by Jouni Malinen licensed under the BSD license 19 | 20 | 21 | The optional LZMA/LZIP compression support is provided by 22 | the EazyLZMA library written by Lloyd Hilaiel. EazyLZMA was 23 | built on Igor Pavlov's LZMA library (both previous works 24 | were released under the public domain) 25 | 26 | https://github.com/lloyd/easylzma 27 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/ndlz/ndlz-private.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | 12 | 13 | #ifndef NDLZ_PRIVATE_H 14 | #define NDLZ_PRIVATE_H 15 | #include "context.h" 16 | 17 | #if defined (__cplusplus) 18 | extern "C" { 19 | #endif 20 | #define XXH_INLINE_ALL 21 | 22 | #define NDLZ_ERROR_NULL(pointer) \ 23 | do { \ 24 | if ((pointer) == NULL) { \ 25 | return 0; \ 26 | } \ 27 | } while (0) 28 | 29 | 30 | #if defined (__cplusplus) 31 | } 32 | #endif 33 | 34 | #endif /* NDLZ_PRIVATE_H */ 35 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/include/zfp/version.h: -------------------------------------------------------------------------------- 1 | #ifndef ZFP_VERSION_H 2 | #define ZFP_VERSION_H 3 | 4 | /* stringification */ 5 | #define _zfp_str_(x) # x 6 | #define _zfp_str(x) _zfp_str_(x) 7 | 8 | /* library version information */ 9 | #define ZFP_VERSION_MAJOR 0 /* library major version number */ 10 | #define ZFP_VERSION_MINOR 5 /* library minor version number */ 11 | #define ZFP_VERSION_PATCH 5 /* library patch version number */ 12 | #define ZFP_VERSION_RELEASE ZFP_VERSION_PATCH 13 | 14 | /* codec version number (see also zfp_codec_version) */ 15 | #define ZFP_CODEC 5 16 | 17 | /* library version number (see also zfp_library_version) */ 18 | #define ZFP_VERSION \ 19 | ((ZFP_VERSION_MAJOR << 8) + \ 20 | (ZFP_VERSION_MINOR << 4) + \ 21 | (ZFP_VERSION_PATCH << 0)) 22 | 23 | /* library version string (see also zfp_version_string) */ 24 | #define ZFP_VERSION_STRING \ 25 | _zfp_str(ZFP_VERSION_MAJOR) "." \ 26 | _zfp_str(ZFP_VERSION_MINOR) "." \ 27 | _zfp_str(ZFP_VERSION_PATCH) 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/share/omp.c: -------------------------------------------------------------------------------- 1 | #ifdef _OPENMP 2 | #include 3 | #include 4 | 5 | /* number of omp threads to use */ 6 | static uint 7 | thread_count_omp(const zfp_stream* stream) 8 | { 9 | uint count = stream->exec.params.omp.threads; 10 | /* if no thread count is specified, use default number of threads */ 11 | if (!count) 12 | count = omp_get_max_threads(); 13 | return count; 14 | } 15 | 16 | /* number of chunks to partition array into */ 17 | static size_t 18 | chunk_count_omp(const zfp_stream* stream, size_t blocks, uint threads) 19 | { 20 | size_t chunk_size = stream->exec.params.omp.chunk_size; 21 | /* if no chunk size is specified, assign one chunk per thread */ 22 | size_t chunks = chunk_size ? (blocks + chunk_size - 1) / chunk_size : threads; 23 | /* each chunk must contain at least one block */ 24 | chunks = MIN(chunks, blocks); 25 | /* OpenMP 2.0 loop counters must be ints */ 26 | chunks = MIN(chunks, INT_MAX); 27 | return chunks; 28 | } 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/zfp-private.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | 12 | 13 | #ifndef ZFP_PRIVATE_H 14 | #define ZFP_PRIVATE_H 15 | 16 | #define ZFP_MAX_DIM 4 17 | #define ZFP_CELL_SHAPE 4 18 | 19 | 20 | #if defined (__cplusplus) 21 | extern "C" { 22 | #endif 23 | #define XXH_INLINE_ALL 24 | 25 | #define ZFP_ERROR_NULL(pointer) \ 26 | do { \ 27 | if ((pointer) == NULL) { \ 28 | return 0; \ 29 | } \ 30 | } while (0) 31 | 32 | 33 | #if defined (__cplusplus) 34 | } 35 | #endif 36 | 37 | #endif /* ZFP_PRIVATE_H */ 38 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/ndlz/ndlz.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | 12 | 13 | #ifndef NDLZ_H 14 | #define NDLZ_H 15 | #include "context.h" 16 | 17 | #if defined (__cplusplus) 18 | extern "C" { 19 | #endif 20 | 21 | int ndlz_compress(const uint8_t *input, int32_t input_len, uint8_t *output, int32_t output_len, 22 | uint8_t meta, blosc2_cparams *cparams, const void* chunk); 23 | 24 | int ndlz_decompress(const uint8_t *input, int32_t input_len, uint8_t *output, int32_t output_len, 25 | uint8_t meta, blosc2_dparams *dparams, const void* chunk); 26 | 27 | #if defined (__cplusplus) 28 | } 29 | #endif 30 | 31 | #endif /* NDLZ_H */ 32 | -------------------------------------------------------------------------------- /src/easylzma/pavlov/7zBuf2.c: -------------------------------------------------------------------------------- 1 | /* 7zBuf2.c -- Byte Buffer 2 | 2008-10-04 : Igor Pavlov : Public domain */ 3 | 4 | #include 5 | #include "7zBuf.h" 6 | 7 | void DynBuf_Construct(CDynBuf *p) 8 | { 9 | p->data = 0; 10 | p->size = 0; 11 | p->pos = 0; 12 | } 13 | 14 | void DynBuf_SeekToBeg(CDynBuf *p) 15 | { 16 | p->pos = 0; 17 | } 18 | 19 | int DynBuf_Write(CDynBuf *p, const Byte *buf, size_t size, ISzAlloc *alloc) 20 | { 21 | if (size > p->size - p->pos) 22 | { 23 | size_t newSize = p->pos + size; 24 | Byte *data; 25 | newSize += newSize / 4; 26 | data = (Byte *)alloc->Alloc(alloc, newSize); 27 | if (data == 0) 28 | return 0; 29 | p->size = newSize; 30 | memcpy(data, p->data, p->pos); 31 | alloc->Free(alloc, p->data); 32 | p->data = data; 33 | } 34 | memcpy(p->data + p->pos, buf, size); 35 | p->pos += size; 36 | return 1; 37 | } 38 | 39 | void DynBuf_Free(CDynBuf *p, ISzAlloc *alloc) 40 | { 41 | alloc->Free(alloc, p->data); 42 | p->data = 0; 43 | p->size = 0; 44 | p->pos = 0; 45 | } 46 | -------------------------------------------------------------------------------- /src/blosc2/blosc/b2nd_utils.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | #ifndef B2ND_B2ND_UTILS_H_ 12 | #define B2ND_B2ND_UTILS_H_ 13 | 14 | #include 15 | #include <../plugins/plugin_utils.h> 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | 22 | int b2nd_copy_buffer(int8_t ndim, 23 | uint8_t itemsize, 24 | void *src, const int64_t *src_pad_shape, 25 | int64_t *src_start, const int64_t *src_stop, 26 | void *dst, const int64_t *dst_pad_shape, 27 | int64_t *dst_start); 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | 33 | #endif // B2ND_B2ND_UTILS_H_ 34 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/revdecode4.c: -------------------------------------------------------------------------------- 1 | /* private functions ------------------------------------------------------- */ 2 | 3 | /* reversible inverse decorrelating 4D transform */ 4 | static void 5 | _t2(rev_inv_xform, Int, 4)(Int* p) 6 | { 7 | uint x, y, z, w; 8 | /* transform along w */ 9 | for (z = 0; z < 4; z++) 10 | for (y = 0; y < 4; y++) 11 | for (x = 0; x < 4; x++) 12 | _t1(rev_inv_lift, Int)(p + 1 * x + 4 * y + 16 * z, 64); 13 | /* transform along z */ 14 | for (y = 0; y < 4; y++) 15 | for (x = 0; x < 4; x++) 16 | for (w = 0; w < 4; w++) 17 | _t1(rev_inv_lift, Int)(p + 64 * w + 1 * x + 4 * y, 16); 18 | /* transform along y */ 19 | for (x = 0; x < 4; x++) 20 | for (w = 0; w < 4; w++) 21 | for (z = 0; z < 4; z++) 22 | _t1(rev_inv_lift, Int)(p + 16 * z + 64 * w + 1 * x, 4); 23 | /* transform along x */ 24 | for (w = 0; w < 4; w++) 25 | for (z = 0; z < 4; z++) 26 | for (y = 0; y < 4; y++) 27 | _t1(rev_inv_lift, Int)(p + 4 * y + 16 * z + 64 * w, 1); 28 | } 29 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/revencode4.c: -------------------------------------------------------------------------------- 1 | /* private functions ------------------------------------------------------- */ 2 | 3 | /* reversible forward decorrelating 4D transform */ 4 | static void 5 | _t2(rev_fwd_xform, Int, 4)(Int* p) 6 | { 7 | uint x, y, z, w; 8 | /* transform along x */ 9 | for (w = 0; w < 4; w++) 10 | for (z = 0; z < 4; z++) 11 | for (y = 0; y < 4; y++) 12 | _t1(rev_fwd_lift, Int)(p + 4 * y + 16 * z + 64 * w, 1); 13 | /* transform along y */ 14 | for (x = 0; x < 4; x++) 15 | for (w = 0; w < 4; w++) 16 | for (z = 0; z < 4; z++) 17 | _t1(rev_fwd_lift, Int)(p + 16 * z + 64 * w + 1 * x, 4); 18 | /* transform along z */ 19 | for (y = 0; y < 4; y++) 20 | for (x = 0; x < 4; x++) 21 | for (w = 0; w < 4; w++) 22 | _t1(rev_fwd_lift, Int)(p + 64 * w + 1 * x + 4 * y, 16); 23 | /* transform along w */ 24 | for (z = 0; z < 4; z++) 25 | for (y = 0; y < 4; y++) 26 | for (x = 0; x < 4; x++) 27 | _t1(rev_fwd_lift, Int)(p + 1 * x + 4 * y + 16 * z, 64); 28 | } 29 | -------------------------------------------------------------------------------- /src/blosc2/internal-complibs/zstd/module.modulemap: -------------------------------------------------------------------------------- 1 | module libzstd [extern_c] { 2 | header "zstd.h" 3 | export * 4 | config_macros [exhaustive] \ 5 | /* zstd.h */ \ 6 | ZSTD_STATIC_LINKING_ONLY, \ 7 | ZSTDLIB_VISIBILITY, \ 8 | ZSTDLIB_VISIBLE, \ 9 | ZSTDLIB_HIDDEN, \ 10 | ZSTD_DLL_EXPORT, \ 11 | ZSTDLIB_STATIC_API, \ 12 | ZSTD_DISABLE_DEPRECATE_WARNINGS, \ 13 | ZSTD_CLEVEL_DEFAULT, \ 14 | /* zdict.h */ \ 15 | ZDICT_STATIC_LINKING_ONLY, \ 16 | ZDICTLIB_VISIBLE, \ 17 | ZDICTLIB_HIDDEN, \ 18 | ZDICTLIB_VISIBILITY, \ 19 | ZDICTLIB_STATIC_API, \ 20 | ZDICT_DISABLE_DEPRECATE_WARNINGS, \ 21 | /* zstd_errors.h */ \ 22 | ZSTDERRORLIB_VISIBLE, \ 23 | ZSTDERRORLIB_HIDDEN, \ 24 | ZSTDERRORLIB_VISIBILITY 25 | 26 | module dictbuilder [extern_c] { 27 | header "zdict.h" 28 | export * 29 | } 30 | 31 | module errors [extern_c] { 32 | header "zstd_errors.h" 33 | export * 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/blosc2/blosc/shuffle-generic.c: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | #include "shuffle-generic.h" 12 | 13 | /* Shuffle a block. This can never fail. */ 14 | void shuffle_generic(const int32_t bytesoftype, const int32_t blocksize, 15 | const uint8_t *_src, uint8_t *_dest) { 16 | /* Non-optimized shuffle */ 17 | shuffle_generic_inline(bytesoftype, 0, blocksize, _src, _dest); 18 | } 19 | 20 | /* Unshuffle a block. This can never fail. */ 21 | void unshuffle_generic(const int32_t bytesoftype, const int32_t blocksize, 22 | const uint8_t *_src, uint8_t *_dest) { 23 | /* Non-optimized unshuffle */ 24 | unshuffle_generic_inline(bytesoftype, 0, blocksize, _src, _dest); 25 | } 26 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/codecf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* maximum number of bit planes to encode */ 5 | static uint 6 | precision(int maxexp, uint maxprec, int minexp, int dims) 7 | { 8 | #if (ZFP_ROUNDING_MODE != ZFP_ROUND_NEVER) && defined(ZFP_WITH_TIGHT_ERROR) 9 | return MIN(maxprec, (uint)MAX(0, maxexp - minexp + 2 * dims + 1)); 10 | #else 11 | return MIN(maxprec, (uint)MAX(0, maxexp - minexp + 2 * dims + 2)); 12 | #endif 13 | } 14 | 15 | /* map integer x relative to exponent e to floating-point number */ 16 | static Scalar 17 | _t1(dequantize, Scalar)(Int x, int e) 18 | { 19 | return LDEXP((Scalar)x, e - ((int)(CHAR_BIT * sizeof(Scalar)) - 2)); 20 | } 21 | 22 | /* inverse block-floating-point transform from signed integers */ 23 | static void 24 | _t1(inv_cast, Scalar)(const Int* iblock, Scalar* fblock, uint n, int emax) 25 | { 26 | /* compute power-of-two scale factor s */ 27 | Scalar s = _t1(dequantize, Scalar)(1, emax); 28 | /* compute p-bit float x = s*y where |y| <= 2^(p-2) - 1 */ 29 | do 30 | *fblock++ = (Scalar)(s * *iblock++); 31 | while (--n); 32 | } 33 | -------------------------------------------------------------------------------- /src/blosc2/internal-complibs/zstd/deprecated/zbuff_common.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under both the BSD-style license (found in the 6 | * LICENSE file in the root directory of this source tree) and the GPLv2 (found 7 | * in the COPYING file in the root directory of this source tree). 8 | * You may select, at your option, one of the above-listed licenses. 9 | */ 10 | 11 | /*-************************************* 12 | * Dependencies 13 | ***************************************/ 14 | #include "../common/error_private.h" 15 | #include "zbuff.h" 16 | 17 | /*-**************************************** 18 | * ZBUFF Error Management (deprecated) 19 | ******************************************/ 20 | 21 | /*! ZBUFF_isError() : 22 | * tells if a return value is an error code */ 23 | unsigned ZBUFF_isError(size_t errorCode) { return ERR_isError(errorCode); } 24 | /*! ZBUFF_getErrorName() : 25 | * provides error code string from function result (useful for debugging) */ 26 | const char* ZBUFF_getErrorName(size_t errorCode) { return ERR_getErrorName(errorCode); } 27 | -------------------------------------------------------------------------------- /src/blosc2/blosc/shuffle-avx2.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | /* AVX2-accelerated shuffle/unshuffle routines. */ 12 | 13 | #ifndef SHUFFLE_AVX2_H 14 | #define SHUFFLE_AVX2_H 15 | 16 | #include "blosc2/blosc2-common.h" 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | /** 23 | AVX2-accelerated shuffle routine. 24 | */ 25 | BLOSC_NO_EXPORT void shuffle_avx2(const int32_t bytesoftype, const int32_t blocksize, 26 | const uint8_t *_src, uint8_t *_dest); 27 | 28 | /** 29 | AVX2-accelerated unshuffle routine. 30 | */ 31 | BLOSC_NO_EXPORT void unshuffle_avx2(const int32_t bytesoftype, const int32_t blocksize, 32 | const uint8_t *_src, uint8_t *_dest); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif /* SHUFFLE_AVX2_H */ 39 | -------------------------------------------------------------------------------- /src/blosc2/blosc/shuffle-sse2.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | /* SSE2-accelerated shuffle/unshuffle routines. */ 12 | 13 | #ifndef SHUFFLE_SSE2_H 14 | #define SHUFFLE_SSE2_H 15 | 16 | #include "blosc2/blosc2-common.h" 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | /** 23 | SSE2-accelerated shuffle routine. 24 | */ 25 | BLOSC_NO_EXPORT void shuffle_sse2(const int32_t bytesoftype, const int32_t blocksize, 26 | const uint8_t *_src, uint8_t *_dest); 27 | 28 | /** 29 | SSE2-accelerated unshuffle routine. 30 | */ 31 | BLOSC_NO_EXPORT void unshuffle_sse2(const int32_t bytesoftype, const int32_t blocksize, 32 | const uint8_t *_src, uint8_t *_dest); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif /* SHUFFLE_SSE2_H */ 39 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/ndlz/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # sources 2 | set(SOURCES ${SOURCES} ../plugins/codecs/ndlz/ndlz.c ../plugins/codecs/ndlz/ndlz.h ../plugins/codecs/ndlz/ndlz-private.h 3 | ../plugins/codecs/ndlz/ndlz4x4.c ../plugins/codecs/ndlz/ndlz4x4.h ../plugins/codecs/ndlz/ndlz8x8.c 4 | ../plugins/codecs/ndlz/ndlz8x8.h ../plugins/codecs/ndlz/xxhash.c ../plugins/codecs/ndlz/xxhash.h PARENT_SCOPE) 5 | 6 | # targets 7 | if(BUILD_TESTS) 8 | add_executable(test_ndlz test_ndlz.c) 9 | # Define the BLOSC_TESTING symbol so normally-hidden functions 10 | # aren't hidden from the view of the test programs. 11 | set_property( 12 | TARGET test_ndlz 13 | APPEND PROPERTY COMPILE_DEFINITIONS BLOSC_TESTING) 14 | 15 | target_link_libraries(test_ndlz blosc_testing) 16 | 17 | # tests 18 | add_test(NAME test_plugin_test_ndlz 19 | COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) 20 | 21 | # Copy test files 22 | file(GLOB TESTS_DATA ../../test_data/example_s*.caterva) 23 | foreach (data ${TESTS_DATA}) 24 | file(COPY ${data} 25 | DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) 26 | endforeach(data) 27 | endif() 28 | -------------------------------------------------------------------------------- /src/blosc2/blosc/shuffle-altivec.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | /* ALTIVEC-accelerated shuffle/unshuffle routines. */ 12 | 13 | #ifndef SHUFFLE_ALTIVEC_H 14 | #define SHUFFLE_ALTIVEC_H 15 | 16 | #include "blosc2/blosc2-common.h" 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | /** 23 | ALTIVEC-accelerated shuffle routine. 24 | */ 25 | BLOSC_NO_EXPORT void shuffle_altivec(const int32_t bytesoftype, const int32_t blocksize, 26 | const uint8_t *_src, uint8_t *_dest); 27 | 28 | /** 29 | ALTIVEC-accelerated unshuffle routine. 30 | */ 31 | BLOSC_NO_EXPORT void unshuffle_altivec(const int32_t bytesoftype, const int32_t blocksize, 32 | const uint8_t *_src, uint8_t *_dest); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif /* SHUFFLE_ALTIVEC_H */ 39 | -------------------------------------------------------------------------------- /src/blosc2/blosc/bitshuffle-avx2.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | /* AVX2-accelerated shuffle/unshuffle routines. */ 12 | 13 | #ifndef BITSHUFFLE_AVX2_H 14 | #define BITSHUFFLE_AVX2_H 15 | 16 | #include 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | /** 23 | AVX2-accelerated bitshuffle routine. 24 | */ 25 | BLOSC_NO_EXPORT int64_t 26 | bshuf_trans_bit_elem_avx2(void* in, void* out, const size_t size, 27 | const size_t elem_size, void* tmp_buf); 28 | 29 | /** 30 | AVX2-accelerated bitunshuffle routine. 31 | */ 32 | BLOSC_NO_EXPORT int64_t 33 | bshuf_untrans_bit_elem_avx2(void* in, void* out, const size_t size, 34 | const size_t elem_size, void* tmp_buf); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif /* BITSHUFFLE_AVX2_H */ 41 | -------------------------------------------------------------------------------- /src/blosc2/blosc/shuffle-neon.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | Note: Adapted for NEON by Lucian Marc. 9 | 10 | See LICENSE.txt for details about copyright and rights to use. 11 | **********************************************************************/ 12 | 13 | /* NEON-accelerated shuffle/unshuffle routines. */ 14 | 15 | #ifndef SHUFFLE_NEON_H 16 | #define SHUFFLE_NEON_H 17 | 18 | #include "blosc2/blosc2-common.h" 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | /** 25 | NEON-accelerated shuffle routine. 26 | */ 27 | BLOSC_NO_EXPORT void shuffle_neon(const int32_t bytesoftype, const int32_t blocksize, 28 | const uint8_t* const _src, uint8_t* const _dest); 29 | 30 | /** 31 | NEON-accelerated unshuffle routine. 32 | */ 33 | BLOSC_NO_EXPORT void unshuffle_neon(const int32_t bytesoftype, const int32_t blocksize, 34 | const uint8_t *_src, uint8_t *_dest); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif /* SHUFFLE_NEON_H */ 41 | -------------------------------------------------------------------------------- /src/miniz/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2013-2014 RAD Game Tools and Valve Software 2 | Copyright 2010-2014 Rich Geldreich and Tenacious Software LLC 3 | 4 | All Rights Reserved. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /src/blosc2/blosc/bitshuffle-neon.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | Note: Adapted for NEON by Lucian Marc. 9 | 10 | See LICENSE.txt for details about copyright and rights to use. 11 | **********************************************************************/ 12 | 13 | /* NEON-accelerated bitshuffle/bitunshuffle routines. */ 14 | 15 | #ifndef BITSHUFFLE_NEON_H 16 | #define BITSHUFFLE_NEON_H 17 | 18 | #include "blosc2/blosc2-common.h" 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | /** 25 | NEON-accelerated bitshuffle routine. 26 | */ 27 | BLOSC_NO_EXPORT int64_t bitshuffle_neon(void* _src, void* _dest, const size_t blocksize, 28 | const size_t bytesoftype, void* tmp_buf); 29 | 30 | /** 31 | NEON-accelerated bitunshuffle routine. 32 | */ 33 | BLOSC_NO_EXPORT int64_t bitunshuffle_neon(void* _src, void* _dest, const size_t blocksize, 34 | const size_t bytesoftype, void* tmp_buf); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif /* BITSHUFFLE_NEON_H */ 41 | -------------------------------------------------------------------------------- /src/blosc2/internal-complibs/zstd/compress/zstd_compress_superblock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under both the BSD-style license (found in the 6 | * LICENSE file in the root directory of this source tree) and the GPLv2 (found 7 | * in the COPYING file in the root directory of this source tree). 8 | * You may select, at your option, one of the above-listed licenses. 9 | */ 10 | 11 | #ifndef ZSTD_COMPRESS_ADVANCED_H 12 | #define ZSTD_COMPRESS_ADVANCED_H 13 | 14 | /*-************************************* 15 | * Dependencies 16 | ***************************************/ 17 | 18 | #include "../zstd.h" /* ZSTD_CCtx */ 19 | 20 | /*-************************************* 21 | * Target Compressed Block Size 22 | ***************************************/ 23 | 24 | /* ZSTD_compressSuperBlock() : 25 | * Used to compress a super block when targetCBlockSize is being used. 26 | * The given block will be compressed into multiple sub blocks that are around targetCBlockSize. */ 27 | size_t ZSTD_compressSuperBlock(ZSTD_CCtx* zc, 28 | void* dst, size_t dstCapacity, 29 | void const* src, size_t srcSize, 30 | unsigned lastBlock); 31 | 32 | #endif /* ZSTD_COMPRESS_ADVANCED_H */ 33 | -------------------------------------------------------------------------------- /src/blosc2/plugins/filters/ndmean/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # sources 2 | set(SOURCES ${SOURCES} ../plugins/filters/ndmean/ndmean.c ../plugins/filters/ndmean/ndmean.h PARENT_SCOPE) 3 | 4 | if(BUILD_TESTS) 5 | # targets 6 | add_executable(test_ndmean_repart test_ndmean_repart.c) 7 | add_executable(test_ndmean_mean test_ndmean_mean.c) 8 | # Define the BLOSC_TESTING symbol so normally-hidden functions 9 | # aren't hidden from the view of the test programs. 10 | set_property( 11 | TARGET test_ndmean_mean 12 | APPEND PROPERTY COMPILE_DEFINITIONS BLOSC_TESTING) 13 | set_property( 14 | TARGET test_ndmean_repart 15 | APPEND PROPERTY COMPILE_DEFINITIONS BLOSC_TESTING) 16 | 17 | target_link_libraries(test_ndmean_repart blosc_testing) 18 | target_link_libraries(test_ndmean_mean blosc_testing) 19 | 20 | # tests 21 | add_test(NAME test_plugin_ndmean_repart 22 | COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) 23 | add_test(NAME test_plugin_ndmean_mean 24 | COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) 25 | 26 | # Copy test files 27 | file(GLOB TESTS_DATA *.caterva) 28 | foreach (data ${TESTS_DATA}) 29 | file(COPY ${data} 30 | DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) 31 | endforeach(data) 32 | endif() 33 | -------------------------------------------------------------------------------- /example/zmat_speedbench.m: -------------------------------------------------------------------------------- 1 | function zmat_speedbench(varargin) 2 | % 3 | % Usage: 4 | % zmat_speedbench 5 | % zmat_speedbench('nthread', 8, 'shuffle', 1, 'typesize', 8) 6 | % 7 | % Author: Qianqian Fang 8 | % 9 | 10 | codecs={'zlib', 'gzip', 'lzma', 'lz4', 'lz4hc', 'zstd', ... 11 | 'blosc2blosclz', 'blosc2lz4', 'blosc2lz4hc', ... 12 | 'blosc2zlib', 'blosc2zstd'}; 13 | 14 | runbench('1. eye(2000)', eye(2000), codecs, varargin{:}); 15 | runbench('2. rand(2000)', rand(2000), codecs, varargin{:}); 16 | runbench('3. magic(2000)', uint32(magic(2000)), codecs, varargin{:}); 17 | runbench('4. peaks(2000)', single(peaks(2000)), codecs, varargin{:}); 18 | 19 | %---------------------------------------------------------- 20 | function runbench(name, mat, codecs, varargin) 21 | disp(name) 22 | res=cellfun(@(x) benchmark(x, mat, varargin{:}), codecs, 'UniformOutput', false); 23 | if(exist('OCTAVE_VERSION','builtin')) 24 | disp(res) 25 | else 26 | res=sortrows(struct2table(cell2mat(res)),'total') 27 | end 28 | 29 | %---------------------------------------------------------- 30 | function res=benchmark(codec, x, varargin) 31 | tic; 32 | [a,info]=zmat(x, 1, codec, varargin{:}); 33 | res.codec=codec; 34 | res.save=toc; 35 | res.size=uint32(numel(a)); 36 | tic; 37 | b=zmat(a, info); 38 | res.load=toc; 39 | res.total=res.load+res.save; 40 | res.sum=sum(b(:)); 41 | -------------------------------------------------------------------------------- /src/lz4/LICENSE: -------------------------------------------------------------------------------- 1 | LZ4 Library 2 | Copyright (c) 2011-2020, Yann Collet 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, this 12 | list of conditions and the following disclaimer in the documentation and/or 13 | other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 19 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 22 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /src/blosc2/internal-complibs/zstd/dll/example/fullbench-dll.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio Express 2012 for Windows Desktop 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fullbench-dll", "fullbench-dll.vcxproj", "{13992FD2-077E-4954-B065-A428198201A9}" 4 | EndProject 5 | Global 6 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 7 | Debug|Win32 = Debug|Win32 8 | Debug|x64 = Debug|x64 9 | Release|Win32 = Release|Win32 10 | Release|x64 = Release|x64 11 | EndGlobalSection 12 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 13 | {13992FD2-077E-4954-B065-A428198201A9}.Debug|Win32.ActiveCfg = Debug|Win32 14 | {13992FD2-077E-4954-B065-A428198201A9}.Debug|Win32.Build.0 = Debug|Win32 15 | {13992FD2-077E-4954-B065-A428198201A9}.Debug|x64.ActiveCfg = Debug|x64 16 | {13992FD2-077E-4954-B065-A428198201A9}.Debug|x64.Build.0 = Debug|x64 17 | {13992FD2-077E-4954-B065-A428198201A9}.Release|Win32.ActiveCfg = Release|Win32 18 | {13992FD2-077E-4954-B065-A428198201A9}.Release|Win32.Build.0 = Release|Win32 19 | {13992FD2-077E-4954-B065-A428198201A9}.Release|x64.ActiveCfg = Release|x64 20 | {13992FD2-077E-4954-B065-A428198201A9}.Release|x64.Build.0 = Release|x64 21 | EndGlobalSection 22 | GlobalSection(SolutionProperties) = preSolution 23 | HideSolutionNode = FALSE 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /src/blosc2/internal-complibs/zstd/compress/zstd_fast.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under both the BSD-style license (found in the 6 | * LICENSE file in the root directory of this source tree) and the GPLv2 (found 7 | * in the COPYING file in the root directory of this source tree). 8 | * You may select, at your option, one of the above-listed licenses. 9 | */ 10 | 11 | #ifndef ZSTD_FAST_H 12 | #define ZSTD_FAST_H 13 | 14 | #if defined (__cplusplus) 15 | extern "C" { 16 | #endif 17 | 18 | #include "../common/mem.h" /* U32 */ 19 | #include "zstd_compress_internal.h" 20 | 21 | void ZSTD_fillHashTable(ZSTD_matchState_t* ms, 22 | void const* end, ZSTD_dictTableLoadMethod_e dtlm, 23 | ZSTD_tableFillPurpose_e tfp); 24 | size_t ZSTD_compressBlock_fast( 25 | ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], 26 | void const* src, size_t srcSize); 27 | size_t ZSTD_compressBlock_fast_dictMatchState( 28 | ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], 29 | void const* src, size_t srcSize); 30 | size_t ZSTD_compressBlock_fast_extDict( 31 | ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], 32 | void const* src, size_t srcSize); 33 | 34 | #if defined (__cplusplus) 35 | } 36 | #endif 37 | 38 | #endif /* ZSTD_FAST_H */ 39 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/include/zfp/system.h: -------------------------------------------------------------------------------- 1 | #ifndef ZFP_SYSTEM_H 2 | #define ZFP_SYSTEM_H 3 | 4 | #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 5 | /* C99: use restrict */ 6 | #define restrict_ restrict 7 | #else 8 | /* C89: no restrict keyword */ 9 | #define restrict_ 10 | #endif 11 | 12 | /* macros for exporting and importing symbols */ 13 | #if defined(_MSC_VER) && defined(ZFP_SHARED_LIBS) 14 | /* export (import) symbols when ZFP_SOURCE is (is not) defined */ 15 | #ifdef ZFP_SOURCE 16 | #ifdef __cplusplus 17 | #define extern_ extern "C" __declspec(dllexport) 18 | #else 19 | #define extern_ extern __declspec(dllexport) 20 | #endif 21 | #else 22 | #ifdef __cplusplus 23 | #define extern_ extern "C" __declspec(dllimport) 24 | #else 25 | #define extern_ extern __declspec(dllimport) 26 | #endif 27 | #endif 28 | #else /* !(_MSC_VER && ZFP_SHARED_LIBS) */ 29 | #ifdef __cplusplus 30 | #define extern_ extern "C" 31 | #else 32 | #define extern_ extern 33 | #endif 34 | #endif 35 | 36 | /* L1 cache line size for alignment purposes */ 37 | #ifndef ZFP_CACHE_LINE_SIZE 38 | #define ZFP_CACHE_LINE_SIZE 0x100 39 | #endif 40 | /* ZFP_CACHE_LINE_SIZE=0 disables alignment */ 41 | #if defined(__GNUC__) && ZFP_CACHE_LINE_SIZE 42 | #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE))) 43 | #else 44 | #define cache_align_(x) x 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/easylzma/common_internal.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Written in 2009 by Lloyd Hilaiel 3 | * 4 | * License 5 | * 6 | * All the cruft you find here is public domain. You don't have to credit 7 | * anyone to use this code, but my personal request is that you mention 8 | * Igor Pavlov for his hard, high quality work. 9 | */ 10 | 11 | #include "common_internal.h" 12 | 13 | static void *elzmaAlloc(void *p, size_t size) { 14 | struct elzma_alloc_struct * as = (struct elzma_alloc_struct *) p; 15 | if (as->clientMallocFunc) { 16 | return as->clientMallocFunc(as->clientMallocContext, size); 17 | } 18 | return malloc(size); 19 | } 20 | 21 | static void elzmaFree(void *p, void *address) { 22 | struct elzma_alloc_struct * as = (struct elzma_alloc_struct *) p; 23 | if (as->clientFreeFunc) { 24 | as->clientFreeFunc(as->clientMallocContext, address); 25 | } else { 26 | free(address); 27 | } 28 | } 29 | 30 | void 31 | init_alloc_struct(struct elzma_alloc_struct * as, 32 | elzma_malloc clientMallocFunc, 33 | void * clientMallocContext, 34 | elzma_free clientFreeFunc, 35 | void * clientFreeContext) 36 | { 37 | as->Alloc = elzmaAlloc; 38 | as->Free = elzmaFree; 39 | as->clientMallocFunc = clientMallocFunc; 40 | as->clientMallocContext = clientMallocContext; 41 | as->clientFreeFunc = clientFreeFunc; 42 | as->clientFreeContext = clientFreeContext; 43 | } 44 | -------------------------------------------------------------------------------- /src/blosc2/internal-complibs/zstd/decompress/zstd_ddict.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under both the BSD-style license (found in the 6 | * LICENSE file in the root directory of this source tree) and the GPLv2 (found 7 | * in the COPYING file in the root directory of this source tree). 8 | * You may select, at your option, one of the above-listed licenses. 9 | */ 10 | 11 | 12 | #ifndef ZSTD_DDICT_H 13 | #define ZSTD_DDICT_H 14 | 15 | /*-******************************************************* 16 | * Dependencies 17 | *********************************************************/ 18 | #include "../common/zstd_deps.h" /* size_t */ 19 | #include "../zstd.h" /* ZSTD_DDict, and several public functions */ 20 | 21 | 22 | /*-******************************************************* 23 | * Interface 24 | *********************************************************/ 25 | 26 | /* note: several prototypes are already published in `zstd.h` : 27 | * ZSTD_createDDict() 28 | * ZSTD_createDDict_byReference() 29 | * ZSTD_createDDict_advanced() 30 | * ZSTD_freeDDict() 31 | * ZSTD_initStaticDDict() 32 | * ZSTD_sizeof_DDict() 33 | * ZSTD_estimateDDictSize() 34 | * ZSTD_getDictID_fromDict() 35 | */ 36 | 37 | const void* ZSTD_DDict_dictContent(const ZSTD_DDict* ddict); 38 | size_t ZSTD_DDict_dictSize(const ZSTD_DDict* ddict); 39 | 40 | void ZSTD_copyDDictParameters(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict); 41 | 42 | 43 | 44 | #endif /* ZSTD_DDICT_H */ 45 | -------------------------------------------------------------------------------- /src/blosc2/internal-complibs/zstd/compress/zstd_double_fast.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under both the BSD-style license (found in the 6 | * LICENSE file in the root directory of this source tree) and the GPLv2 (found 7 | * in the COPYING file in the root directory of this source tree). 8 | * You may select, at your option, one of the above-listed licenses. 9 | */ 10 | 11 | #ifndef ZSTD_DOUBLE_FAST_H 12 | #define ZSTD_DOUBLE_FAST_H 13 | 14 | #if defined (__cplusplus) 15 | extern "C" { 16 | #endif 17 | 18 | #include "../common/mem.h" /* U32 */ 19 | #include "zstd_compress_internal.h" /* ZSTD_CCtx, size_t */ 20 | 21 | void ZSTD_fillDoubleHashTable(ZSTD_matchState_t* ms, 22 | void const* end, ZSTD_dictTableLoadMethod_e dtlm, 23 | ZSTD_tableFillPurpose_e tfp); 24 | size_t ZSTD_compressBlock_doubleFast( 25 | ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], 26 | void const* src, size_t srcSize); 27 | size_t ZSTD_compressBlock_doubleFast_dictMatchState( 28 | ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], 29 | void const* src, size_t srcSize); 30 | size_t ZSTD_compressBlock_doubleFast_extDict( 31 | ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], 32 | void const* src, size_t srcSize); 33 | 34 | 35 | #if defined (__cplusplus) 36 | } 37 | #endif 38 | 39 | #endif /* ZSTD_DOUBLE_FAST_H */ 40 | -------------------------------------------------------------------------------- /src/easylzma/pavlov/7zFile.h: -------------------------------------------------------------------------------- 1 | /* 7zFile.h -- File IO 2 | 2008-11-22 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_FILE_H 5 | #define __7Z_FILE_H 6 | 7 | #ifdef _WIN32 8 | #define USE_WINDOWS_FILE 9 | #endif 10 | 11 | #ifdef USE_WINDOWS_FILE 12 | #include 13 | #else 14 | #include 15 | #endif 16 | 17 | #include "Types.h" 18 | 19 | 20 | /* ---------- File ---------- */ 21 | 22 | typedef struct 23 | { 24 | #ifdef USE_WINDOWS_FILE 25 | HANDLE handle; 26 | #else 27 | FILE *file; 28 | #endif 29 | } CSzFile; 30 | 31 | void File_Construct(CSzFile *p); 32 | WRes InFile_Open(CSzFile *p, const char *name); 33 | WRes OutFile_Open(CSzFile *p, const char *name); 34 | WRes File_Close(CSzFile *p); 35 | 36 | /* reads max(*size, remain file's size) bytes */ 37 | WRes File_Read(CSzFile *p, void *data, size_t *size); 38 | 39 | /* writes *size bytes */ 40 | WRes File_Write(CSzFile *p, const void *data, size_t *size); 41 | 42 | WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin); 43 | WRes File_GetLength(CSzFile *p, UInt64 *length); 44 | 45 | 46 | /* ---------- FileInStream ---------- */ 47 | 48 | typedef struct 49 | { 50 | ISeqInStream s; 51 | CSzFile file; 52 | } CFileSeqInStream; 53 | 54 | void FileSeqInStream_CreateVTable(CFileSeqInStream *p); 55 | 56 | 57 | typedef struct 58 | { 59 | ISeekInStream s; 60 | CSzFile file; 61 | } CFileInStream; 62 | 63 | void FileInStream_CreateVTable(CFileInStream *p); 64 | 65 | 66 | typedef struct 67 | { 68 | ISeqOutStream s; 69 | CSzFile file; 70 | } CFileOutStream; 71 | 72 | void FileOutStream_CreateVTable(CFileOutStream *p); 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/revdecode.c: -------------------------------------------------------------------------------- 1 | static void _t2(rev_inv_xform, Int, DIMS)(Int* p); 2 | 3 | /* private functions ------------------------------------------------------- */ 4 | 5 | /* reversible inverse lifting transform of 4-vector */ 6 | static void 7 | _t1(rev_inv_lift, Int)(Int* p, uint s) 8 | { 9 | Int x, y, z, w; 10 | x = *p; p += s; 11 | y = *p; p += s; 12 | z = *p; p += s; 13 | w = *p; p += s; 14 | 15 | /* 16 | ** high-order Lorenzo transform (P4 Pascal matrix) 17 | ** ( 1 0 0 0) (x) 18 | ** ( 1 1 0 0) (y) 19 | ** ( 1 2 1 0) (z) 20 | ** ( 1 3 3 1) (w) 21 | */ 22 | w += z; 23 | z += y; w += z; 24 | y += x; z += y; w += z; 25 | 26 | p -= s; *p = w; 27 | p -= s; *p = z; 28 | p -= s; *p = y; 29 | p -= s; *p = x; 30 | } 31 | 32 | /* decode block of integers using reversible algorithm */ 33 | static uint 34 | _t2(rev_decode_block, Int, DIMS)(bitstream* stream, int minbits, int maxbits, Int* iblock) 35 | { 36 | /* decode number of significant bits */ 37 | int bits = PBITS; 38 | int prec = (int)stream_read_bits(stream, PBITS) + 1; 39 | cache_align_(UInt ublock[BLOCK_SIZE]); 40 | /* decode integer coefficients */ 41 | bits += _t1(decode_ints, UInt)(stream, maxbits - bits, prec, ublock, BLOCK_SIZE); 42 | /* read at least minbits bits */ 43 | if (bits < minbits) { 44 | stream_skip(stream, minbits - bits); 45 | bits = minbits; 46 | } 47 | /* reorder unsigned coefficients and convert to signed integer */ 48 | _t1(inv_order, Int)(ublock, iblock, PERM, BLOCK_SIZE); 49 | /* perform decorrelating transform */ 50 | _t2(rev_inv_xform, Int, DIMS)(iblock); 51 | return bits; 52 | } 53 | -------------------------------------------------------------------------------- /src/easylzma/pavlov/LzmaLib.c: -------------------------------------------------------------------------------- 1 | /* LzmaLib.c -- LZMA library wrapper 2 | 2008-08-05 3 | Igor Pavlov 4 | Public domain */ 5 | 6 | #include "LzmaEnc.h" 7 | #include "LzmaDec.h" 8 | #include "Alloc.h" 9 | #include "LzmaLib.h" 10 | 11 | static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); } 12 | static void SzFree(void *p, void *address) { p = p; MyFree(address); } 13 | static ISzAlloc g_Alloc = { SzAlloc, SzFree }; 14 | 15 | MY_STDAPI LzmaCompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen, 16 | unsigned char *outProps, size_t *outPropsSize, 17 | int level, /* 0 <= level <= 9, default = 5 */ 18 | unsigned dictSize, /* use (1 << N) or (3 << N). 4 KB < dictSize <= 128 MB */ 19 | int lc, /* 0 <= lc <= 8, default = 3 */ 20 | int lp, /* 0 <= lp <= 4, default = 0 */ 21 | int pb, /* 0 <= pb <= 4, default = 2 */ 22 | int fb, /* 5 <= fb <= 273, default = 32 */ 23 | int numThreads /* 1 or 2, default = 2 */ 24 | ) 25 | { 26 | CLzmaEncProps props; 27 | LzmaEncProps_Init(&props); 28 | props.level = level; 29 | props.dictSize = dictSize; 30 | props.lc = lc; 31 | props.lp = lp; 32 | props.pb = pb; 33 | props.fb = fb; 34 | props.numThreads = numThreads; 35 | 36 | return LzmaEncode(dest, destLen, src, srcLen, &props, outProps, outPropsSize, 0, 37 | NULL, &g_Alloc, &g_Alloc); 38 | } 39 | 40 | 41 | MY_STDAPI LzmaUncompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t *srcLen, 42 | const unsigned char *props, size_t propsSize) 43 | { 44 | ELzmaStatus status; 45 | return LzmaDecode(dest, destLen, src, srcLen, props, (unsigned)propsSize, LZMA_FINISH_ANY, &status, &g_Alloc); 46 | } 47 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/codecs-registry.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2021 The Blosc Developers 3 | http://blosc.org 4 | License: BSD 3-Clause (see LICENSE.txt) 5 | */ 6 | 7 | #include 8 | #include "blosc2/codecs-registry.h" 9 | #include "ndlz/ndlz.h" 10 | #include "zfp/blosc2-zfp.h" 11 | 12 | void register_codecs(void) { 13 | 14 | blosc2_codec ndlz; 15 | ndlz.compcode = BLOSC_CODEC_NDLZ; 16 | ndlz.compver = 1; 17 | ndlz.complib = BLOSC_CODEC_NDLZ; 18 | ndlz.encoder = ndlz_compress; 19 | ndlz.decoder = ndlz_decompress; 20 | ndlz.compname = "ndlz"; 21 | register_codec_private(&ndlz); 22 | 23 | blosc2_codec zfp_acc; 24 | zfp_acc.compcode = BLOSC_CODEC_ZFP_FIXED_ACCURACY; 25 | zfp_acc.compver = 1; 26 | zfp_acc.complib = BLOSC_CODEC_ZFP_FIXED_ACCURACY; 27 | zfp_acc.encoder = zfp_acc_compress; 28 | zfp_acc.decoder = zfp_acc_decompress; 29 | zfp_acc.compname = "zfp_acc"; 30 | register_codec_private(&zfp_acc); 31 | 32 | blosc2_codec zfp_prec; 33 | zfp_prec.compcode = BLOSC_CODEC_ZFP_FIXED_PRECISION; 34 | zfp_prec.compver = 1; 35 | zfp_prec.complib = BLOSC_CODEC_ZFP_FIXED_PRECISION; 36 | zfp_prec.encoder = zfp_prec_compress; 37 | zfp_prec.decoder = zfp_prec_decompress; 38 | zfp_prec.compname = "zfp_prec"; 39 | register_codec_private(&zfp_prec); 40 | 41 | blosc2_codec zfp_rate; 42 | zfp_rate.compcode = BLOSC_CODEC_ZFP_FIXED_RATE; 43 | zfp_rate.compver = 1; 44 | zfp_rate.complib = BLOSC_CODEC_ZFP_FIXED_RATE; 45 | zfp_rate.encoder = zfp_rate_compress; 46 | zfp_rate.decoder = zfp_rate_decompress; 47 | zfp_rate.compname = "zfp_rate"; 48 | register_codec_private(&zfp_rate); 49 | } 50 | -------------------------------------------------------------------------------- /src/blosc2/internal-complibs/zstd/dll/example/Makefile: -------------------------------------------------------------------------------- 1 | # ################################################################ 2 | # Copyright (c) Meta Platforms, Inc. and affiliates. 3 | # All rights reserved. 4 | # 5 | # This source code is licensed under both the BSD-style license (found in the 6 | # LICENSE file in the root directory of this source tree) and the GPLv2 (found 7 | # in the COPYING file in the root directory of this source tree). 8 | # You may select, at your option, one of the above-listed licenses. 9 | # ################################################################ 10 | 11 | VOID := /dev/null 12 | ZSTDDIR := ../include 13 | LIBDIR := ../static 14 | DLLDIR := ../dll 15 | 16 | CFLAGS ?= -O3 # can select custom flags. For example : CFLAGS="-O2 -g" make 17 | CFLAGS += -Wall -Wextra -Wundef -Wcast-qual -Wcast-align -Wshadow -Wswitch-enum \ 18 | -Wdeclaration-after-statement -Wstrict-prototypes \ 19 | -Wpointer-arith -Wstrict-aliasing=1 20 | CFLAGS += $(MOREFLAGS) 21 | CPPFLAGS:= -I$(ZSTDDIR) -DXXH_NAMESPACE=ZSTD_ 22 | FLAGS := $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) 23 | 24 | 25 | # Define *.exe as extension for Windows systems 26 | ifneq (,$(filter Windows%,$(OS))) 27 | EXT =.exe 28 | else 29 | EXT = 30 | endif 31 | 32 | .PHONY: default fullbench-dll fullbench-lib 33 | 34 | 35 | default: all 36 | 37 | all: fullbench-dll fullbench-lib 38 | 39 | 40 | fullbench-lib: fullbench.c datagen.c 41 | $(CC) $(FLAGS) $^ -o $@$(EXT) $(LIBDIR)/libzstd_static.lib 42 | 43 | fullbench-dll: fullbench.c datagen.c 44 | $(CC) $(FLAGS) $^ -o $@$(EXT) -DZSTD_DLL_IMPORT=1 $(DLLDIR)/libzstd.dll 45 | 46 | clean: 47 | @$(RM) fullbench-dll$(EXT) fullbench-lib$(EXT) \ 48 | @echo Cleaning completed 49 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/decodef.c: -------------------------------------------------------------------------------- 1 | static uint _t2(rev_decode_block, Scalar, DIMS)(zfp_stream* zfp, Scalar* fblock); 2 | 3 | /* private functions ------------------------------------------------------- */ 4 | 5 | /* decode contiguous floating-point block using lossy algorithm */ 6 | static uint 7 | _t2(decode_block, Scalar, DIMS)(zfp_stream* zfp, Scalar* fblock) 8 | { 9 | uint bits = 1; 10 | /* test if block has nonzero values */ 11 | if (stream_read_bit(zfp->stream)) { 12 | cache_align_(Int iblock[BLOCK_SIZE]); 13 | int emax, maxprec; 14 | /* decode common exponent */ 15 | bits += EBITS; 16 | emax = (int)stream_read_bits(zfp->stream, EBITS) - EBIAS; 17 | maxprec = precision(emax, zfp->maxprec, zfp->minexp, DIMS); 18 | /* decode integer block */ 19 | bits += _t2(decode_block, Int, DIMS)(zfp->stream, zfp->minbits - bits, zfp->maxbits - bits, maxprec, iblock); 20 | /* perform inverse block-floating-point transform */ 21 | _t1(inv_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax); 22 | } 23 | else { 24 | /* set all values to zero */ 25 | uint i; 26 | for (i = 0; i < BLOCK_SIZE; i++) 27 | *fblock++ = 0; 28 | if (zfp->minbits > bits) { 29 | stream_skip(zfp->stream, zfp->minbits - bits); 30 | bits = zfp->minbits; 31 | } 32 | } 33 | return bits; 34 | } 35 | 36 | /* public functions -------------------------------------------------------- */ 37 | 38 | /* decode contiguous floating-point block */ 39 | size_t 40 | _t2(zfp_decode_block, Scalar, DIMS)(zfp_stream* zfp, Scalar* fblock) 41 | { 42 | return REVERSIBLE(zfp) ? _t2(rev_decode_block, Scalar, DIMS)(zfp, fblock) : _t2(decode_block, Scalar, DIMS)(zfp, fblock); 43 | } 44 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/encode1.c: -------------------------------------------------------------------------------- 1 | /* private functions ------------------------------------------------------- */ 2 | 3 | /* gather 4-value block from strided array */ 4 | static void 5 | _t2(gather, Scalar, 1)(Scalar* q, const Scalar* p, ptrdiff_t sx) 6 | { 7 | uint x; 8 | for (x = 0; x < 4; x++, p += sx) 9 | *q++ = *p; 10 | } 11 | 12 | /* gather nx-value block from strided array */ 13 | static void 14 | _t2(gather_partial, Scalar, 1)(Scalar* q, const Scalar* p, size_t nx, ptrdiff_t sx) 15 | { 16 | size_t x; 17 | for (x = 0; x < nx; x++, p += sx) 18 | q[x] = *p; 19 | _t1(pad_block, Scalar)(q, nx, 1); 20 | } 21 | 22 | /* forward decorrelating 1D transform */ 23 | static void 24 | _t2(fwd_xform, Int, 1)(Int* p) 25 | { 26 | /* transform along x */ 27 | _t1(fwd_lift, Int)(p, 1); 28 | } 29 | 30 | /* public functions -------------------------------------------------------- */ 31 | 32 | /* encode 4-value block stored at p using stride sx */ 33 | size_t 34 | _t2(zfp_encode_block_strided, Scalar, 1)(zfp_stream* stream, const Scalar* p, ptrdiff_t sx) 35 | { 36 | /* gather block from strided array */ 37 | cache_align_(Scalar block[4]); 38 | _t2(gather, Scalar, 1)(block, p, sx); 39 | /* encode block */ 40 | return _t2(zfp_encode_block, Scalar, 1)(stream, block); 41 | } 42 | 43 | /* encode nx-value block stored at p using stride sx */ 44 | size_t 45 | _t2(zfp_encode_partial_block_strided, Scalar, 1)(zfp_stream* stream, const Scalar* p, size_t nx, ptrdiff_t sx) 46 | { 47 | /* gather block from strided array */ 48 | cache_align_(Scalar block[4]); 49 | _t2(gather_partial, Scalar, 1)(block, p, nx, sx); 50 | /* encode block */ 51 | return _t2(zfp_encode_block, Scalar, 1)(stream, block); 52 | } 53 | -------------------------------------------------------------------------------- /src/blosc2/blosc/stune.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | #ifndef STUNE_H 12 | #define STUNE_H 13 | 14 | #include "context.h" 15 | 16 | /* The size of L1 cache. 32 KB is quite common nowadays. */ 17 | #define L1 (32 * 1024) 18 | /* The size of L2 cache. 256 KB is quite common nowadays. */ 19 | #define L2 (256 * 1024) 20 | 21 | /* The maximum number of compressed data streams in a block for compression */ 22 | #define MAX_STREAMS 16 /* Cannot be larger than 128 */ 23 | 24 | 25 | void blosc_stune_init(void * config, blosc2_context* cctx, blosc2_context* dctx); 26 | 27 | void blosc_stune_next_blocksize(blosc2_context * context); 28 | 29 | void blosc_stune_next_cparams(blosc2_context * context); 30 | 31 | void blosc_stune_update(blosc2_context * context, double ctime); 32 | 33 | void blosc_stune_free(blosc2_context * context); 34 | 35 | static blosc2_btune BTUNE_DEFAULTS = { 36 | .btune_init = blosc_stune_init, 37 | .btune_free = blosc_stune_free, 38 | .btune_update = blosc_stune_update, 39 | .btune_next_cparams = blosc_stune_next_cparams, 40 | .btune_next_blocksize = blosc_stune_next_blocksize, 41 | .btune_config = NULL, 42 | }; 43 | 44 | 45 | /* Conditions for splitting a block before compressing with a codec. */ 46 | int split_block(blosc2_context *context, int32_t typesize, int32_t blocksize); 47 | 48 | #endif /* STUNE_H */ 49 | -------------------------------------------------------------------------------- /src/blosc2/include/blosc2/blosc2-stdio.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | 12 | #ifndef BLOSC_BLOSC2_STDIO_H 13 | #define BLOSC_BLOSC2_STDIO_H 14 | 15 | 16 | #include 17 | #include 18 | #include "blosc2-export.h" 19 | 20 | 21 | #if defined(_WIN32) && !defined(__MINGW32__) 22 | 23 | /* stdint.h only available in VS2010 (VC++ 16.0) and newer */ 24 | #if defined(_MSC_VER) && _MSC_VER < 1600 25 | #include "win32/stdint-windows.h" 26 | #else 27 | #include 28 | #endif 29 | 30 | #else 31 | #include 32 | #endif 33 | 34 | #if defined(_MSC_VER) && (_MSC_VER >= 1400) 35 | #include 36 | #else 37 | #include 38 | #endif 39 | 40 | typedef struct { 41 | FILE *file; 42 | } blosc2_stdio_file; 43 | 44 | BLOSC_EXPORT void *blosc2_stdio_open(const char *urlpath, const char *mode, void* params); 45 | BLOSC_EXPORT int blosc2_stdio_close(void *stream); 46 | BLOSC_EXPORT int64_t blosc2_stdio_tell(void *stream); 47 | BLOSC_EXPORT int blosc2_stdio_seek(void *stream, int64_t offset, int whence); 48 | BLOSC_EXPORT int64_t blosc2_stdio_write(const void *ptr, int64_t size, int64_t nitems, void *stream); 49 | BLOSC_EXPORT int64_t blosc2_stdio_read(void *ptr, int64_t size, int64_t nitems, void *stream); 50 | BLOSC_EXPORT int blosc2_stdio_truncate(void *stream, int64_t size); 51 | 52 | #endif //BLOSC_BLOSC2_STDIO_H 53 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/decode1.c: -------------------------------------------------------------------------------- 1 | /* private functions ------------------------------------------------------- */ 2 | 3 | /* scatter 4-value block to strided array */ 4 | static void 5 | _t2(scatter, Scalar, 1)(const Scalar* q, Scalar* p, ptrdiff_t sx) 6 | { 7 | uint x; 8 | for (x = 0; x < 4; x++, p += sx) 9 | *p = *q++; 10 | } 11 | 12 | /* scatter nx-value block to strided array */ 13 | static void 14 | _t2(scatter_partial, Scalar, 1)(const Scalar* q, Scalar* p, size_t nx, ptrdiff_t sx) 15 | { 16 | size_t x; 17 | for (x = 0; x < nx; x++, p += sx) 18 | *p = *q++; 19 | } 20 | 21 | /* inverse decorrelating 1D transform */ 22 | static void 23 | _t2(inv_xform, Int, 1)(Int* p) 24 | { 25 | /* transform along x */ 26 | _t1(inv_lift, Int)(p, 1); 27 | } 28 | 29 | /* public functions -------------------------------------------------------- */ 30 | 31 | /* decode 4-value block and store at p using stride sx */ 32 | size_t 33 | _t2(zfp_decode_block_strided, Scalar, 1)(zfp_stream* stream, Scalar* p, ptrdiff_t sx) 34 | { 35 | /* decode contiguous block */ 36 | cache_align_(Scalar block[4]); 37 | size_t bits = _t2(zfp_decode_block, Scalar, 1)(stream, block); 38 | /* scatter block to strided array */ 39 | _t2(scatter, Scalar, 1)(block, p, sx); 40 | return bits; 41 | } 42 | 43 | /* decode nx-value block and store at p using stride sx */ 44 | size_t 45 | _t2(zfp_decode_partial_block_strided, Scalar, 1)(zfp_stream* stream, Scalar* p, size_t nx, ptrdiff_t sx) 46 | { 47 | /* decode contiguous block */ 48 | cache_align_(Scalar block[4]); 49 | size_t bits = _t2(zfp_decode_block, Scalar, 1)(stream, block); 50 | /* scatter block to strided array */ 51 | _t2(scatter_partial, Scalar, 1)(block, p, nx, sx); 52 | return bits; 53 | } 54 | -------------------------------------------------------------------------------- /src/blosc2/LICENSE.txt: -------------------------------------------------------------------------------- 1 | BSD License 2 | 3 | For Blosc - A blocking, shuffling and lossless compression library 4 | 5 | Copyright (C) 2009-2018 Francesc Alted 6 | Copyright (C) 2019-present Blosc Development team 7 | 8 | Redistribution and use in source and binary forms, with or without modification, 9 | are permitted provided that the following conditions are met: 10 | 11 | * Redistributions of source code must retain the above copyright notice, this 12 | list of conditions and the following disclaimer. 13 | 14 | * Redistributions in binary form must reproduce the above copyright notice, 15 | this list of conditions and the following disclaimer in the documentation 16 | and/or other materials provided with the distribution. 17 | 18 | * Neither the name Francesc Alted nor the names of its contributors may be used 19 | to endorse or promote products derived from this software without specific 20 | prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 23 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 26 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 29 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | -------------------------------------------------------------------------------- /src/blosc2/blosc/bitshuffle-sse2.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | /* SSE2-accelerated shuffle/unshuffle routines. */ 12 | 13 | #ifndef BITSHUFFLE_SSE2_H 14 | #define BITSHUFFLE_SSE2_H 15 | 16 | #include "blosc2/blosc2-common.h" 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | 23 | BLOSC_NO_EXPORT int64_t 24 | bshuf_trans_byte_elem_sse2(void* in, void* out, const size_t size, 25 | const size_t elem_size, void* tmp_buf); 26 | 27 | BLOSC_NO_EXPORT int64_t 28 | bshuf_trans_byte_bitrow_sse2(void* in, void* out, const size_t size, 29 | const size_t elem_size); 30 | 31 | BLOSC_NO_EXPORT int64_t 32 | bshuf_shuffle_bit_eightelem_sse2(void* in, void* out, const size_t size, 33 | const size_t elem_size); 34 | 35 | /** 36 | SSE2-accelerated bitshuffle routine. 37 | */ 38 | BLOSC_NO_EXPORT int64_t 39 | bshuf_trans_bit_elem_sse2(void* in, void* out, const size_t size, 40 | const size_t elem_size, void* tmp_buf); 41 | 42 | /** 43 | SSE2-accelerated bitunshuffle routine. 44 | */ 45 | BLOSC_NO_EXPORT int64_t 46 | bshuf_untrans_bit_elem_sse2(void* in, void* out, const size_t size, 47 | const size_t elem_size, void* tmp_buf); 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | 54 | #endif /* BITSHUFFLE_SSE2_H */ 55 | -------------------------------------------------------------------------------- /src/blosc2/internal-complibs/zstd/compress/zstd_compress_literals.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under both the BSD-style license (found in the 6 | * LICENSE file in the root directory of this source tree) and the GPLv2 (found 7 | * in the COPYING file in the root directory of this source tree). 8 | * You may select, at your option, one of the above-listed licenses. 9 | */ 10 | 11 | #ifndef ZSTD_COMPRESS_LITERALS_H 12 | #define ZSTD_COMPRESS_LITERALS_H 13 | 14 | #include "zstd_compress_internal.h" /* ZSTD_hufCTables_t, ZSTD_minGain() */ 15 | 16 | 17 | size_t ZSTD_noCompressLiterals (void* dst, size_t dstCapacity, const void* src, size_t srcSize); 18 | 19 | /* ZSTD_compressRleLiteralsBlock() : 20 | * Conditions : 21 | * - All bytes in @src are identical 22 | * - dstCapacity >= 4 */ 23 | size_t ZSTD_compressRleLiteralsBlock (void* dst, size_t dstCapacity, const void* src, size_t srcSize); 24 | 25 | /* ZSTD_compressLiterals(): 26 | * @entropyWorkspace: must be aligned on 4-bytes boundaries 27 | * @entropyWorkspaceSize : must be >= HUF_WORKSPACE_SIZE 28 | * @suspectUncompressible: sampling checks, to potentially skip huffman coding 29 | */ 30 | size_t ZSTD_compressLiterals (void* dst, size_t dstCapacity, 31 | const void* src, size_t srcSize, 32 | void* entropyWorkspace, size_t entropyWorkspaceSize, 33 | const ZSTD_hufCTables_t* prevHuf, 34 | ZSTD_hufCTables_t* nextHuf, 35 | ZSTD_strategy strategy, int disableLiteralCompression, 36 | int suspectUncompressible, 37 | int bmi2); 38 | 39 | #endif /* ZSTD_COMPRESS_LITERALS_H */ 40 | -------------------------------------------------------------------------------- /src/blosc2/blosc/bitshuffle-altivec.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | /* ALTIVEC-accelerated shuffle/unshuffle routines. */ 12 | 13 | #ifndef BITSHUFFLE_ALTIVEC_H 14 | #define BITSHUFFLE_ALTIVEC_H 15 | 16 | #include "blosc2/blosc2-common.h" 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | 23 | BLOSC_NO_EXPORT int64_t 24 | bshuf_trans_byte_elem_altivec(void* in, void* out, const size_t size, 25 | const size_t elem_size, void* tmp_buf); 26 | 27 | BLOSC_NO_EXPORT int64_t 28 | bshuf_trans_byte_bitrow_altivec(void* in, void* out, const size_t size, 29 | const size_t elem_size); 30 | 31 | BLOSC_NO_EXPORT int64_t 32 | bshuf_shuffle_bit_eightelem_altivec(void* in, void* out, const size_t size, 33 | const size_t elem_size); 34 | 35 | /** 36 | ALTIVEC-accelerated bitshuffle routine. 37 | */ 38 | BLOSC_NO_EXPORT int64_t 39 | bshuf_trans_bit_elem_altivec(void* in, void* out, const size_t size, 40 | const size_t elem_size, void* tmp_buf); 41 | 42 | /** 43 | ALTIVEC-accelerated bitunshuffle routine. 44 | */ 45 | BLOSC_NO_EXPORT int64_t 46 | bshuf_untrans_bit_elem_altivec(void* in, void* out, const size_t size, 47 | const size_t elem_size, void* tmp_buf); 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | 54 | #endif /* BITSHUFFLE_ALTIVEC_H */ 55 | -------------------------------------------------------------------------------- /src/blosc2/internal-complibs/zstd/common/allocations.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under both the BSD-style license (found in the 6 | * LICENSE file in the root directory of this source tree) and the GPLv2 (found 7 | * in the COPYING file in the root directory of this source tree). 8 | * You may select, at your option, one of the above-listed licenses. 9 | */ 10 | 11 | /* This file provides custom allocation primitives 12 | */ 13 | 14 | #define ZSTD_DEPS_NEED_MALLOC 15 | #include "zstd_deps.h" /* ZSTD_malloc, ZSTD_calloc, ZSTD_free, ZSTD_memset */ 16 | 17 | #include "mem.h" /* MEM_STATIC */ 18 | #define ZSTD_STATIC_LINKING_ONLY 19 | #include "../zstd.h" /* ZSTD_customMem */ 20 | 21 | #ifndef ZSTD_ALLOCATIONS_H 22 | #define ZSTD_ALLOCATIONS_H 23 | 24 | /* custom memory allocation functions */ 25 | 26 | MEM_STATIC void* ZSTD_customMalloc(size_t size, ZSTD_customMem customMem) 27 | { 28 | if (customMem.customAlloc) 29 | return customMem.customAlloc(customMem.opaque, size); 30 | return ZSTD_malloc(size); 31 | } 32 | 33 | MEM_STATIC void* ZSTD_customCalloc(size_t size, ZSTD_customMem customMem) 34 | { 35 | if (customMem.customAlloc) { 36 | /* calloc implemented as malloc+memset; 37 | * not as efficient as calloc, but next best guess for custom malloc */ 38 | void* const ptr = customMem.customAlloc(customMem.opaque, size); 39 | ZSTD_memset(ptr, 0, size); 40 | return ptr; 41 | } 42 | return ZSTD_calloc(1, size); 43 | } 44 | 45 | MEM_STATIC void ZSTD_customFree(void* ptr, ZSTD_customMem customMem) 46 | { 47 | if (ptr!=NULL) { 48 | if (customMem.customFree) 49 | customMem.customFree(customMem.opaque, ptr); 50 | else 51 | ZSTD_free(ptr); 52 | } 53 | } 54 | 55 | #endif /* ZSTD_ALLOCATIONS_H */ 56 | -------------------------------------------------------------------------------- /src/blosc2/internal-complibs/zstd/common/zstd_common.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under both the BSD-style license (found in the 6 | * LICENSE file in the root directory of this source tree) and the GPLv2 (found 7 | * in the COPYING file in the root directory of this source tree). 8 | * You may select, at your option, one of the above-listed licenses. 9 | */ 10 | 11 | 12 | 13 | /*-************************************* 14 | * Dependencies 15 | ***************************************/ 16 | #define ZSTD_DEPS_NEED_MALLOC 17 | #include "error_private.h" 18 | #include "zstd_internal.h" 19 | 20 | 21 | /*-**************************************** 22 | * Version 23 | ******************************************/ 24 | unsigned ZSTD_versionNumber(void) { return ZSTD_VERSION_NUMBER; } 25 | 26 | const char* ZSTD_versionString(void) { return ZSTD_VERSION_STRING; } 27 | 28 | 29 | /*-**************************************** 30 | * ZSTD Error Management 31 | ******************************************/ 32 | #undef ZSTD_isError /* defined within zstd_internal.h */ 33 | /*! ZSTD_isError() : 34 | * tells if a return value is an error code 35 | * symbol is required for external callers */ 36 | unsigned ZSTD_isError(size_t code) { return ERR_isError(code); } 37 | 38 | /*! ZSTD_getErrorName() : 39 | * provides error code string from function result (useful for debugging) */ 40 | const char* ZSTD_getErrorName(size_t code) { return ERR_getErrorName(code); } 41 | 42 | /*! ZSTD_getError() : 43 | * convert a `size_t` function result into a proper ZSTD_errorCode enum */ 44 | ZSTD_ErrorCode ZSTD_getErrorCode(size_t code) { return ERR_getErrorCode(code); } 45 | 46 | /*! ZSTD_getErrorString() : 47 | * provides error code string from enum */ 48 | const char* ZSTD_getErrorString(ZSTD_ErrorCode code) { return ERR_getErrorString(code); } 49 | -------------------------------------------------------------------------------- /src/easylzma/easylzma/decompress.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Written in 2009 by Lloyd Hilaiel 3 | * 4 | * License 5 | * 6 | * All the cruft you find here is public domain. You don't have to credit 7 | * anyone to use this code, but my personal request is that you mention 8 | * Igor Pavlov for his hard, high quality work. 9 | * 10 | * easylzma/decompress.h - The API for LZMA decompression using easylzma 11 | */ 12 | 13 | #ifndef __EASYLZMADECOMPRESS_H__ 14 | #define __EASYLZMADECOMPRESS_H__ 15 | 16 | #include "easylzma/common.h" 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | /** an opaque handle to an lzma decompressor */ 23 | typedef struct _elzma_decompress_handle * elzma_decompress_handle; 24 | 25 | /** 26 | * Allocate a handle to an LZMA decompressor object. 27 | */ 28 | elzma_decompress_handle EASYLZMA_API elzma_decompress_alloc(); 29 | 30 | /** 31 | * set allocation routines (optional, if not called malloc & free will 32 | * be used) 33 | */ 34 | void EASYLZMA_API elzma_decompress_set_allocation_callbacks( 35 | elzma_decompress_handle hand, 36 | elzma_malloc mallocFunc, void * mallocFuncContext, 37 | elzma_free freeFunc, void * freeFuncContext); 38 | 39 | /** 40 | * Free all data associated with an LZMA decompressor object. 41 | */ 42 | void EASYLZMA_API elzma_decompress_free(elzma_decompress_handle * hand); 43 | 44 | /** 45 | * Perform decompression 46 | * 47 | * XXX: should the library automatically detect format by reading stream? 48 | * currently it's based on data external to stream (such as extension 49 | * or convention) 50 | */ 51 | int EASYLZMA_API elzma_decompress_run( 52 | elzma_decompress_handle hand, 53 | elzma_read_callback inputStream, void * inputContext, 54 | elzma_write_callback outputStream, void * outputContext, 55 | elzma_file_format format); 56 | 57 | 58 | #ifdef __cplusplus 59 | }; 60 | #endif 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/blosc2/blosc/cmake_install.cmake: -------------------------------------------------------------------------------- 1 | # Install script for directory: /home/fangq/space/git/Project/github/zmat/src/blosc2/blosc 2 | 3 | # Set the install prefix 4 | if(NOT DEFINED CMAKE_INSTALL_PREFIX) 5 | set(CMAKE_INSTALL_PREFIX "/usr/local") 6 | endif() 7 | string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") 8 | 9 | # Set the install configuration name. 10 | if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) 11 | if(BUILD_TYPE) 12 | string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" 13 | CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") 14 | else() 15 | set(CMAKE_INSTALL_CONFIG_NAME "") 16 | endif() 17 | message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") 18 | endif() 19 | 20 | # Set the component getting installed. 21 | if(NOT CMAKE_INSTALL_COMPONENT) 22 | if(COMPONENT) 23 | message(STATUS "Install component: \"${COMPONENT}\"") 24 | set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") 25 | else() 26 | set(CMAKE_INSTALL_COMPONENT) 27 | endif() 28 | endif() 29 | 30 | # Install shared libraries without execute permission? 31 | if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) 32 | set(CMAKE_INSTALL_SO_NO_EXE "1") 33 | endif() 34 | 35 | # Is this installation the result of a crosscompile? 36 | if(NOT DEFINED CMAKE_CROSSCOMPILING) 37 | set(CMAKE_CROSSCOMPILING "FALSE") 38 | endif() 39 | 40 | # Set default install directory permissions. 41 | if(NOT DEFINED CMAKE_OBJDUMP) 42 | set(CMAKE_OBJDUMP "/usr/bin/objdump") 43 | endif() 44 | 45 | if(CMAKE_INSTALL_COMPONENT) 46 | set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt") 47 | else() 48 | set(CMAKE_INSTALL_MANIFEST "install_manifest.txt") 49 | endif() 50 | 51 | string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT 52 | "${CMAKE_INSTALL_MANIFEST_FILES}") 53 | file(WRITE "/home/fangq/space/git/Project/github/zmat/src/blosc2/blosc/${CMAKE_INSTALL_MANIFEST}" 54 | "${CMAKE_INSTALL_MANIFEST_CONTENT}") 55 | -------------------------------------------------------------------------------- /src/blosc2/include/blosc2/blosc2-export.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | #ifndef BLOSC_EXPORT_H 12 | #define BLOSC_EXPORT_H 13 | 14 | /* Macros for specifying exported symbols. 15 | BLOSC_EXPORT is used to decorate symbols that should be 16 | exported by the blosc shared library. 17 | BLOSC_NO_EXPORT is used to decorate symbols that should NOT 18 | be exported by the blosc shared library. 19 | */ 20 | #if defined(BLOSC_SHARED_LIBRARY) 21 | #if defined(_MSC_VER) 22 | #define BLOSC_EXPORT __declspec(dllexport) 23 | #elif (defined(__GNUC__) && __GNUC__ >= 4) || defined(__clang__) 24 | #if defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) 25 | #define BLOSC_EXPORT __attribute__((dllexport)) 26 | #else 27 | #define BLOSC_EXPORT __attribute__((visibility("default"))) 28 | #endif /* defined(_WIN32) || defined(__CYGWIN__) */ 29 | #else 30 | #error Cannot determine how to define BLOSC_EXPORT for this compiler. 31 | #endif 32 | #else 33 | #define BLOSC_EXPORT 34 | #endif /* defined(BLOSC_SHARED_LIBRARY) */ 35 | 36 | #if defined(__GNUC__) || defined(__clang__) 37 | #define BLOSC_NO_EXPORT __attribute__((visibility("hidden"))) 38 | #else 39 | #define BLOSC_NO_EXPORT 40 | #endif /* defined(__GNUC__) || defined(__clang__) */ 41 | 42 | /* When testing, export everything to make it easier to implement tests. */ 43 | #if defined(BLOSC_TESTING) 44 | #undef BLOSC_NO_EXPORT 45 | #define BLOSC_NO_EXPORT BLOSC_EXPORT 46 | #endif /* defined(BLOSC_TESTING) */ 47 | 48 | #endif /* BLOSC_EXPORT_H */ 49 | -------------------------------------------------------------------------------- /src/blosc2/THANKS.rst: -------------------------------------------------------------------------------- 1 | Thanks 2 | ====== 3 | 4 | * Valentin Haenel did a terrific work implementing the support for the Snappy compression, fixing typos and improving docs and the plotting script. 5 | 6 | * Thibault North, with ideas from Oscar Villellas, contributed a way to call Blosc from different threads in a safe way. Christopher 7 | Speller introduced contexts so that a global lock is not necessary anymore. 8 | 9 | * The CMake support was initially contributed by Thibault North, and Antonio Valentino and Mark Wiebe made great enhancements to it. 10 | 11 | * Christopher Speller also introduced the two new '_ctx' calls to avoid the use of the blosc_init() and blosc_destroy(). 12 | 13 | * Jack Pappas contributed important portability enhancements, specially runtime and cross-platform detection of SSE2/AVX2 as well as high precision timers (HPET) for the benchmark program. 14 | 15 | * @littlezhou implemented the AVX2 version of shuffle routines. 16 | 17 | * Julian Taylor contributed a way to detect AVX2 in runtime and calling the appropriate routines only if the underlying hardware supports it. 18 | 19 | * Lucian Marc provided the support for ARM/NEON for the shuffle filter. 20 | 21 | * Jerome Kieffer contributed support for PowerPC/ALTIVEC for the shuffle/bitshuffle filter. 22 | 23 | * Alberto Sabater, for his great efforts on producing really nice Blosc2 docs, among other aspects. 24 | 25 | * Kiyo Masui for relicensing his bitshuffle project for allowing the inclusion of part of his code in Blosc. 26 | 27 | * Aleix Alcacer for his implementation of mutable super-chunks, multiple variable length metalayers and many other things. 28 | 29 | * Oscar Guiñón for the optimization of reading a (sparse) set of blocks of a chunk in parallel. 30 | 31 | * Nathan Moinvaziri for his outstanding work on the security side of the things via `fuzzer testing `_. 32 | 33 | * Marta Iborra for her implementation of sparse storage for persistent super-chunks. 34 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/ndlz/xxhash.c: -------------------------------------------------------------------------------- 1 | /* 2 | * xxHash - Extremely Fast Hash algorithm 3 | * Copyright (C) 2012-2020 Yann Collet 4 | * 5 | * BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php) 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are 9 | * met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above 14 | * copyright notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | * You can contact the author at: 31 | * - xxHash homepage: https://www.xxhash.com 32 | * - xxHash source repository: https://github.com/Cyan4973/xxHash 33 | */ 34 | 35 | 36 | /* 37 | * xxhash.c instantiates functions defined in xxhash.h 38 | */ 39 | 40 | #define XXH_STATIC_LINKING_ONLY /* access advanced declarations */ 41 | #define XXH_IMPLEMENTATION /* access definitions */ 42 | 43 | #include "xxhash.h" 44 | -------------------------------------------------------------------------------- /src/easylzma/pavlov/BraIA64.c: -------------------------------------------------------------------------------- 1 | /* BraIA64.c -- Converter for IA-64 code 2 | 2008-10-04 : Igor Pavlov : Public domain */ 3 | 4 | #include "Bra.h" 5 | 6 | static const Byte kBranchTable[32] = 7 | { 8 | 0, 0, 0, 0, 0, 0, 0, 0, 9 | 0, 0, 0, 0, 0, 0, 0, 0, 10 | 4, 4, 6, 6, 0, 0, 7, 7, 11 | 4, 4, 0, 0, 4, 4, 0, 0 12 | }; 13 | 14 | SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding) 15 | { 16 | SizeT i; 17 | if (size < 16) 18 | return 0; 19 | size -= 16; 20 | for (i = 0; i <= size; i += 16) 21 | { 22 | UInt32 instrTemplate = data[i] & 0x1F; 23 | UInt32 mask = kBranchTable[instrTemplate]; 24 | UInt32 bitPos = 5; 25 | int slot; 26 | for (slot = 0; slot < 3; slot++, bitPos += 41) 27 | { 28 | UInt32 bytePos, bitRes; 29 | UInt64 instruction, instNorm; 30 | int j; 31 | if (((mask >> slot) & 1) == 0) 32 | continue; 33 | bytePos = (bitPos >> 3); 34 | bitRes = bitPos & 0x7; 35 | instruction = 0; 36 | for (j = 0; j < 6; j++) 37 | instruction += (UInt64)data[i + j + bytePos] << (8 * j); 38 | 39 | instNorm = instruction >> bitRes; 40 | if (((instNorm >> 37) & 0xF) == 0x5 && ((instNorm >> 9) & 0x7) == 0) 41 | { 42 | UInt32 src = (UInt32)((instNorm >> 13) & 0xFFFFF); 43 | UInt32 dest; 44 | src |= ((UInt32)(instNorm >> 36) & 1) << 20; 45 | 46 | src <<= 4; 47 | 48 | if (encoding) 49 | dest = ip + (UInt32)i + src; 50 | else 51 | dest = src - (ip + (UInt32)i); 52 | 53 | dest >>= 4; 54 | 55 | instNorm &= ~((UInt64)(0x8FFFFF) << 13); 56 | instNorm |= ((UInt64)(dest & 0xFFFFF) << 13); 57 | instNorm |= ((UInt64)(dest & 0x100000) << (36 - 20)); 58 | 59 | instruction &= (1 << bitRes) - 1; 60 | instruction |= (instNorm << bitRes); 61 | for (j = 0; j < 6; j++) 62 | data[i + j + bytePos] = (Byte)(instruction >> (8 * j)); 63 | } 64 | } 65 | } 66 | return i; 67 | } 68 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/blosc2-zfp.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | 12 | 13 | #ifndef BLOSC2_ZFP_H 14 | #define BLOSC2_ZFP_H 15 | #include "zfp-private.h" 16 | #include "../plugins/plugin_utils.h" 17 | 18 | #if defined (__cplusplus) 19 | extern "C" { 20 | #endif 21 | 22 | 23 | int zfp_acc_compress(const uint8_t *input, int32_t input_len, uint8_t *output, int32_t output_len, 24 | uint8_t meta, blosc2_cparams *cparams, const void* chunk); 25 | 26 | int zfp_acc_decompress(const uint8_t *input, int32_t input_len, uint8_t *output, int32_t output_len, 27 | uint8_t meta, blosc2_dparams *dparams, const void* chunk); 28 | 29 | int zfp_prec_compress(const uint8_t *input, int32_t input_len, uint8_t *output, int32_t output_len, 30 | uint8_t meta, blosc2_cparams *cparams, const void* chunk); 31 | 32 | int zfp_prec_decompress(const uint8_t *input, int32_t input_len, uint8_t *output, int32_t output_len, 33 | uint8_t meta, blosc2_dparams *dparams, const void* chunk); 34 | 35 | int zfp_rate_compress(const uint8_t *input, int32_t input_len, uint8_t *output, int32_t output_len, 36 | uint8_t meta, blosc2_cparams *cparams, const void* chunk); 37 | 38 | int zfp_rate_decompress(const uint8_t *input, int32_t input_len, uint8_t *output, int32_t output_len, 39 | uint8_t meta, blosc2_dparams *dparams, const void* chunk); 40 | 41 | int zfp_getcell(void *thread_context, const uint8_t *block, int32_t cbytes, uint8_t *dest, int32_t destsize); 42 | 43 | 44 | #if defined (__cplusplus) 45 | } 46 | #endif 47 | 48 | #endif /* BLOSC2_ZFP_H */ 49 | -------------------------------------------------------------------------------- /src/easylzma/pavlov/Bra.h: -------------------------------------------------------------------------------- 1 | /* Bra.h -- Branch converters for executables 2 | 2008-10-04 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __BRA_H 5 | #define __BRA_H 6 | 7 | #include "Types.h" 8 | 9 | /* 10 | These functions convert relative addresses to absolute addresses 11 | in CALL instructions to increase the compression ratio. 12 | 13 | In: 14 | data - data buffer 15 | size - size of data 16 | ip - current virtual Instruction Pinter (IP) value 17 | state - state variable for x86 converter 18 | encoding - 0 (for decoding), 1 (for encoding) 19 | 20 | Out: 21 | state - state variable for x86 converter 22 | 23 | Returns: 24 | The number of processed bytes. If you call these functions with multiple calls, 25 | you must start next call with first byte after block of processed bytes. 26 | 27 | Type Endian Alignment LookAhead 28 | 29 | x86 little 1 4 30 | ARMT little 2 2 31 | ARM little 4 0 32 | PPC big 4 0 33 | SPARC big 4 0 34 | IA64 little 16 0 35 | 36 | size must be >= Alignment + LookAhead, if it's not last block. 37 | If (size < Alignment + LookAhead), converter returns 0. 38 | 39 | Example: 40 | 41 | UInt32 ip = 0; 42 | for () 43 | { 44 | ; size must be >= Alignment + LookAhead, if it's not last block 45 | SizeT processed = Convert(data, size, ip, 1); 46 | data += processed; 47 | size -= processed; 48 | ip += processed; 49 | } 50 | */ 51 | 52 | #define x86_Convert_Init(state) { state = 0; } 53 | SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding); 54 | SizeT ARM_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); 55 | SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); 56 | SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); 57 | SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); 58 | SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/decode2.c: -------------------------------------------------------------------------------- 1 | /* private functions ------------------------------------------------------- */ 2 | 3 | /* scatter 4*4 block to strided array */ 4 | static void 5 | _t2(scatter, Scalar, 2)(const Scalar* q, Scalar* p, ptrdiff_t sx, ptrdiff_t sy) 6 | { 7 | uint x, y; 8 | for (y = 0; y < 4; y++, p += sy - 4 * sx) 9 | for (x = 0; x < 4; x++, p += sx) 10 | *p = *q++; 11 | } 12 | 13 | /* scatter nx*ny block to strided array */ 14 | static void 15 | _t2(scatter_partial, Scalar, 2)(const Scalar* q, Scalar* p, size_t nx, size_t ny, ptrdiff_t sx, ptrdiff_t sy) 16 | { 17 | size_t x, y; 18 | for (y = 0; y < ny; y++, p += sy - (ptrdiff_t)nx * sx, q += 4 - nx) 19 | for (x = 0; x < nx; x++, p += sx, q++) 20 | *p = *q; 21 | } 22 | 23 | /* inverse decorrelating 2D transform */ 24 | static void 25 | _t2(inv_xform, Int, 2)(Int* p) 26 | { 27 | uint x, y; 28 | /* transform along y */ 29 | for (x = 0; x < 4; x++) 30 | _t1(inv_lift, Int)(p + 1 * x, 4); 31 | /* transform along x */ 32 | for (y = 0; y < 4; y++) 33 | _t1(inv_lift, Int)(p + 4 * y, 1); 34 | } 35 | 36 | /* public functions -------------------------------------------------------- */ 37 | 38 | /* decode 4*4 block and store at p using strides (sx, sy) */ 39 | size_t 40 | _t2(zfp_decode_block_strided, Scalar, 2)(zfp_stream* stream, Scalar* p, ptrdiff_t sx, ptrdiff_t sy) 41 | { 42 | /* decode contiguous block */ 43 | cache_align_(Scalar block[16]); 44 | size_t bits = _t2(zfp_decode_block, Scalar, 2)(stream, block); 45 | /* scatter block to strided array */ 46 | _t2(scatter, Scalar, 2)(block, p, sx, sy); 47 | return bits; 48 | } 49 | 50 | /* decode nx*ny block and store at p using strides (sx, sy) */ 51 | size_t 52 | _t2(zfp_decode_partial_block_strided, Scalar, 2)(zfp_stream* stream, Scalar* p, size_t nx, size_t ny, ptrdiff_t sx, ptrdiff_t sy) 53 | { 54 | /* decode contiguous block */ 55 | cache_align_(Scalar block[16]); 56 | size_t bits = _t2(zfp_decode_block, Scalar, 2)(stream, block); 57 | /* scatter block to strided array */ 58 | _t2(scatter_partial, Scalar, 2)(block, p, nx, ny, sx, sy); 59 | return bits; 60 | } 61 | -------------------------------------------------------------------------------- /src/easylzma/pavlov/LzHash.h: -------------------------------------------------------------------------------- 1 | /* LzHash.h -- HASH functions for LZ algorithms 2 | 2008-10-04 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __LZHASH_H 5 | #define __LZHASH_H 6 | 7 | #define kHash2Size (1 << 10) 8 | #define kHash3Size (1 << 16) 9 | #define kHash4Size (1 << 20) 10 | 11 | #define kFix3HashSize (kHash2Size) 12 | #define kFix4HashSize (kHash2Size + kHash3Size) 13 | #define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size) 14 | 15 | #define HASH2_CALC hashValue = cur[0] | ((UInt32)cur[1] << 8); 16 | 17 | #define HASH3_CALC { \ 18 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 19 | hash2Value = temp & (kHash2Size - 1); \ 20 | hashValue = (temp ^ ((UInt32)cur[2] << 8)) & p->hashMask; } 21 | 22 | #define HASH4_CALC { \ 23 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 24 | hash2Value = temp & (kHash2Size - 1); \ 25 | hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ 26 | hashValue = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & p->hashMask; } 27 | 28 | #define HASH5_CALC { \ 29 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 30 | hash2Value = temp & (kHash2Size - 1); \ 31 | hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ 32 | hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)); \ 33 | hashValue = (hash4Value ^ (p->crc[cur[4]] << 3)) & p->hashMask; \ 34 | hash4Value &= (kHash4Size - 1); } 35 | 36 | /* #define HASH_ZIP_CALC hashValue = ((cur[0] | ((UInt32)cur[1] << 8)) ^ p->crc[cur[2]]) & 0xFFFF; */ 37 | #define HASH_ZIP_CALC hashValue = ((cur[2] | ((UInt32)cur[0] << 8)) ^ p->crc[cur[1]]) & 0xFFFF; 38 | 39 | 40 | #define MT_HASH2_CALC \ 41 | hash2Value = (p->crc[cur[0]] ^ cur[1]) & (kHash2Size - 1); 42 | 43 | #define MT_HASH3_CALC { \ 44 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 45 | hash2Value = temp & (kHash2Size - 1); \ 46 | hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); } 47 | 48 | #define MT_HASH4_CALC { \ 49 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 50 | hash2Value = temp & (kHash2Size - 1); \ 51 | hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ 52 | hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & (kHash4Size - 1); } 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /test/test_zmat.m: -------------------------------------------------------------------------------- 1 | function test_zmat(testname, method, input, expected, varargin) 2 | opt=struct('level',1); 3 | 4 | if(length(varargin)>1 && rem(length(varargin),2)==0 && ischar(varargin{1})) 5 | for i=1:2:length(varargin) 6 | opt.(varargin{i})=varargin{i+1}; 7 | end 8 | end 9 | 10 | try 11 | [res, info] = zmat(input, opt.level, method); 12 | if(strcmp(method,'gzip') && opt.level && length(res)>=10) 13 | res(10)=0; % the 10th byte of the gzip header is OS ID 14 | end 15 | catch ME 16 | if(ischar(expected) && ~isempty(strfind(ME.message, expected))) 17 | fprintf(1, 'Testing exception %s: ok\n\toutput:''%s''\n', testname, ME.message); 18 | else 19 | warning('Test exception %s: failed: expected ''%s'', obtained ''%s''', testname, expected, ME.message); 20 | end 21 | return; 22 | end 23 | 24 | if(isfield(opt,'info')) 25 | res=info.(opt.info); 26 | end 27 | 28 | if(isfield(opt,'status')) 29 | if(info.status~=opt.status) 30 | warning('Test %s: failed: expected ''%s'', obtained ''%s''', testname, mat2str(expected), mat2str(res)); 31 | else 32 | fprintf(1, 'Testing %s error: ok\n\tstatus:''%d''\n', testname, info.status); 33 | end 34 | return; 35 | end 36 | 37 | if (~isequal(res, expected)) 38 | warning('Test %s: failed: expected ''%s'', obtained ''%s''', testname, mat2str(expected), mat2str(res)); 39 | else 40 | if(ischar(res)) 41 | fprintf(1, 'Testing %s: ok\n\toutput:''%s''\n', testname, res); 42 | else 43 | fprintf(1, 'Testing %s: ok\n\toutput:''%s''\n', testname, mat2str(res)); 44 | end 45 | if(isfield(opt,'info') || opt.level == 0) 46 | return; 47 | end 48 | newres = zmat(res, info); 49 | if (exist('isequaln')) 50 | try 51 | if (isequaln(newres, input)) 52 | fprintf(1, '\t%s successfully restored the input\n', method); 53 | end 54 | catch 55 | end 56 | else 57 | try 58 | if (newres == input) 59 | fprintf(1, '\t%s successfully restored the input\n', method); 60 | end 61 | catch 62 | end 63 | end 64 | end 65 | end 66 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/encode2.c: -------------------------------------------------------------------------------- 1 | /* private functions ------------------------------------------------------- */ 2 | 3 | /* gather 4*4 block from strided array */ 4 | static void 5 | _t2(gather, Scalar, 2)(Scalar* q, const Scalar* p, ptrdiff_t sx, ptrdiff_t sy) 6 | { 7 | uint x, y; 8 | for (y = 0; y < 4; y++, p += sy - 4 * sx) 9 | for (x = 0; x < 4; x++, p += sx) 10 | *q++ = *p; 11 | } 12 | 13 | /* gather nx*ny block from strided array */ 14 | static void 15 | _t2(gather_partial, Scalar, 2)(Scalar* q, const Scalar* p, size_t nx, size_t ny, ptrdiff_t sx, ptrdiff_t sy) 16 | { 17 | size_t x, y; 18 | for (y = 0; y < ny; y++, p += sy - (ptrdiff_t)nx * sx) { 19 | for (x = 0; x < nx; x++, p += sx) 20 | q[4 * y + x] = *p; 21 | _t1(pad_block, Scalar)(q + 4 * y, nx, 1); 22 | } 23 | for (x = 0; x < 4; x++) 24 | _t1(pad_block, Scalar)(q + x, ny, 4); 25 | } 26 | 27 | /* forward decorrelating 2D transform */ 28 | static void 29 | _t2(fwd_xform, Int, 2)(Int* p) 30 | { 31 | uint x, y; 32 | /* transform along x */ 33 | for (y = 0; y < 4; y++) 34 | _t1(fwd_lift, Int)(p + 4 * y, 1); 35 | /* transform along y */ 36 | for (x = 0; x < 4; x++) 37 | _t1(fwd_lift, Int)(p + 1 * x, 4); 38 | } 39 | 40 | /* public functions -------------------------------------------------------- */ 41 | 42 | /* encode 4*4 block stored at p using strides (sx, sy) */ 43 | size_t 44 | _t2(zfp_encode_block_strided, Scalar, 2)(zfp_stream* stream, const Scalar* p, ptrdiff_t sx, ptrdiff_t sy) 45 | { 46 | /* gather block from strided array */ 47 | cache_align_(Scalar block[16]); 48 | _t2(gather, Scalar, 2)(block, p, sx, sy); 49 | /* encode block */ 50 | return _t2(zfp_encode_block, Scalar, 2)(stream, block); 51 | } 52 | 53 | /* encode nx*ny block stored at p using strides (sx, sy) */ 54 | size_t 55 | _t2(zfp_encode_partial_block_strided, Scalar, 2)(zfp_stream* stream, const Scalar* p, size_t nx, size_t ny, ptrdiff_t sx, ptrdiff_t sy) 56 | { 57 | /* gather block from strided array */ 58 | cache_align_(Scalar block[16]); 59 | _t2(gather_partial, Scalar, 2)(block, p, nx, ny, sx, sy); 60 | /* encode block */ 61 | return _t2(zfp_encode_block, Scalar, 2)(stream, block); 62 | } 63 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/revdecodef.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* private functions ------------------------------------------------------- */ 4 | 5 | /* reinterpret two's complement integers as floating values */ 6 | static void 7 | _t1(rev_inv_reinterpret, Scalar)(Int* iblock, Scalar* fblock, uint n) 8 | { 9 | /* convert two's complement integers to sign-magnitude integers */ 10 | uint i; 11 | for (i = 0; i < n; i++) { 12 | Int x = iblock[i]; 13 | if (x < 0) 14 | iblock[i] = (Int)((UInt)x ^ TCMASK); 15 | } 16 | /* reinterpret sign-magnitude integers as floating values */ 17 | memcpy(fblock, iblock, n * sizeof(*fblock)); 18 | } 19 | 20 | /* decode contiguous floating-point block using reversible algorithm */ 21 | static uint 22 | _t2(rev_decode_block, Scalar, DIMS)(zfp_stream* zfp, Scalar* fblock) 23 | { 24 | uint bits = 0; 25 | cache_align_(Int iblock[BLOCK_SIZE]); 26 | /* test whether block is all-zero */ 27 | bits++; 28 | if (stream_read_bit(zfp->stream)) { 29 | /* non-zero block; test whether to use block-floating-point transform */ 30 | bits++; 31 | if (stream_read_bit(zfp->stream)) { 32 | /* decode integer block */ 33 | bits += _t2(rev_decode_block, Int, DIMS)(zfp->stream, zfp->minbits - bits, zfp->maxbits - bits, iblock); 34 | /* reinterpret integers as floating values */ 35 | _t1(rev_inv_reinterpret, Scalar)(iblock, fblock, BLOCK_SIZE); 36 | } 37 | else { 38 | /* decode common exponent */ 39 | int emax; 40 | bits += EBITS; 41 | emax = (int)stream_read_bits(zfp->stream, EBITS) - EBIAS; 42 | /* decode integer block */ 43 | bits += _t2(rev_decode_block, Int, DIMS)(zfp->stream, zfp->minbits - bits, zfp->maxbits - bits, iblock); 44 | /* perform inverse block-floating-point transform */ 45 | _t1(rev_inv_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax); 46 | } 47 | } 48 | else { 49 | /* all-zero block; set all values to zero */ 50 | uint i; 51 | for (i = 0; i < BLOCK_SIZE; i++) 52 | *fblock++ = 0; 53 | if (zfp->minbits > bits) { 54 | stream_skip(zfp->stream, zfp->minbits - bits); 55 | bits = zfp->minbits; 56 | } 57 | } 58 | return bits; 59 | } 60 | -------------------------------------------------------------------------------- /src/easylzma/pavlov/CpuArch.h: -------------------------------------------------------------------------------- 1 | /* CpuArch.h 2 | 2008-08-05 3 | Igor Pavlov 4 | Public domain */ 5 | 6 | #ifndef __CPUARCH_H 7 | #define __CPUARCH_H 8 | 9 | /* 10 | LITTLE_ENDIAN_UNALIGN means: 11 | 1) CPU is LITTLE_ENDIAN 12 | 2) it's allowed to make unaligned memory accesses 13 | if LITTLE_ENDIAN_UNALIGN is not defined, it means that we don't know 14 | about these properties of platform. 15 | */ 16 | 17 | #if defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64) || defined(__i386__) || defined(__x86_64__) 18 | #define LITTLE_ENDIAN_UNALIGN 19 | #endif 20 | 21 | #ifdef LITTLE_ENDIAN_UNALIGN 22 | 23 | #define GetUi16(p) (*(const UInt16 *)(p)) 24 | #define GetUi32(p) (*(const UInt32 *)(p)) 25 | #define GetUi64(p) (*(const UInt64 *)(p)) 26 | #define SetUi32(p, d) *(UInt32 *)(p) = (d); 27 | 28 | #else 29 | 30 | #define GetUi16(p) (((const Byte *)(p))[0] | ((UInt16)((const Byte *)(p))[1] << 8)) 31 | 32 | #define GetUi32(p) ( \ 33 | ((const Byte *)(p))[0] | \ 34 | ((UInt32)((const Byte *)(p))[1] << 8) | \ 35 | ((UInt32)((const Byte *)(p))[2] << 16) | \ 36 | ((UInt32)((const Byte *)(p))[3] << 24)) 37 | 38 | #define GetUi64(p) (GetUi32(p) | ((UInt64)GetUi32(((const Byte *)(p)) + 4) << 32)) 39 | 40 | #define SetUi32(p, d) { UInt32 _x_ = (d); \ 41 | ((Byte *)(p))[0] = (Byte)_x_; \ 42 | ((Byte *)(p))[1] = (Byte)(_x_ >> 8); \ 43 | ((Byte *)(p))[2] = (Byte)(_x_ >> 16); \ 44 | ((Byte *)(p))[3] = (Byte)(_x_ >> 24); } 45 | 46 | #endif 47 | 48 | #if defined(LITTLE_ENDIAN_UNALIGN) && defined(_WIN64) && (_MSC_VER >= 1300) 49 | 50 | #pragma intrinsic(_byteswap_ulong) 51 | #pragma intrinsic(_byteswap_uint64) 52 | #define GetBe32(p) _byteswap_ulong(*(const UInt32 *)(const Byte *)(p)) 53 | #define GetBe64(p) _byteswap_uint64(*(const UInt64 *)(const Byte *)(p)) 54 | 55 | #else 56 | 57 | #define GetBe32(p) ( \ 58 | ((UInt32)((const Byte *)(p))[0] << 24) | \ 59 | ((UInt32)((const Byte *)(p))[1] << 16) | \ 60 | ((UInt32)((const Byte *)(p))[2] << 8) | \ 61 | ((const Byte *)(p))[3] ) 62 | 63 | #define GetBe64(p) (((UInt64)GetBe32(p) << 32) | GetBe32(((const Byte *)(p)) + 4)) 64 | 65 | #endif 66 | 67 | #define GetBe16(p) (((UInt16)((const Byte *)(p))[0] << 8) | ((const Byte *)(p))[1]) 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /src/blosc2/internal-complibs/zstd/compress/zstd_opt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under both the BSD-style license (found in the 6 | * LICENSE file in the root directory of this source tree) and the GPLv2 (found 7 | * in the COPYING file in the root directory of this source tree). 8 | * You may select, at your option, one of the above-listed licenses. 9 | */ 10 | 11 | #ifndef ZSTD_OPT_H 12 | #define ZSTD_OPT_H 13 | 14 | #if defined (__cplusplus) 15 | extern "C" { 16 | #endif 17 | 18 | #include "zstd_compress_internal.h" 19 | 20 | /* used in ZSTD_loadDictionaryContent() */ 21 | void ZSTD_updateTree(ZSTD_matchState_t* ms, const BYTE* ip, const BYTE* iend); 22 | 23 | size_t ZSTD_compressBlock_btopt( 24 | ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], 25 | void const* src, size_t srcSize); 26 | size_t ZSTD_compressBlock_btultra( 27 | ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], 28 | void const* src, size_t srcSize); 29 | size_t ZSTD_compressBlock_btultra2( 30 | ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], 31 | void const* src, size_t srcSize); 32 | 33 | 34 | size_t ZSTD_compressBlock_btopt_dictMatchState( 35 | ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], 36 | void const* src, size_t srcSize); 37 | size_t ZSTD_compressBlock_btultra_dictMatchState( 38 | ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], 39 | void const* src, size_t srcSize); 40 | 41 | size_t ZSTD_compressBlock_btopt_extDict( 42 | ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], 43 | void const* src, size_t srcSize); 44 | size_t ZSTD_compressBlock_btultra_extDict( 45 | ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], 46 | void const* src, size_t srcSize); 47 | 48 | /* note : no btultra2 variant for extDict nor dictMatchState, 49 | * because btultra2 is not meant to work with dictionaries 50 | * and is only specific for the first block (no prefix) */ 51 | 52 | #if defined (__cplusplus) 53 | } 54 | #endif 55 | 56 | #endif /* ZSTD_OPT_H */ 57 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | 3 | compiler: 4 | - gcc 5 | 6 | jobs: 7 | include: 8 | - os: linux 9 | name: Ubuntu 14.04 10 | dist: trusty 11 | env: 12 | - BADGE=Ubuntu_14.04 13 | - MAKE=make 14 | - os: linux 15 | name: Ubuntu 16.04 16 | dist: xenial 17 | env: 18 | - BADGE=Ubuntu_16.04 19 | - MAKE=make 20 | - os: linux 21 | name: Ubuntu 18.04 22 | dist: bionic 23 | env: 24 | - BADGE=Ubuntu_18.04 25 | - MAKE=make 26 | - os: linux 27 | name: Ubuntu 20.04 28 | dist: focal 29 | env: 30 | - BADGE=Ubuntu_20.04 31 | - MAKE=make 32 | - os: linux 33 | name: Ubuntu 22.04 34 | dist: jammy 35 | env: 36 | - BADGE=Ubuntu_22.04 37 | - MAKE=make 38 | - os: windows 39 | name: Windows 40 | env: 41 | - BADGE=Windows 42 | - MAKE=mingw32-make 43 | - os: osx 44 | name: OSX 45 | osx_image: xcode13.4 46 | env: 47 | - BADGE=OSX 48 | - MAKE=make 49 | 50 | before_install: 51 | - if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get install liboctave-dev; fi 52 | # - if [ "$TRAVIS_OS_NAME" = "windows" ]; then 53 | # choco install octave.portable --version=4.2.1; 54 | # export PATH=/c/ProgramData/chocolatey/lib/octave.portable/tools/octave/bin:.:${PATH}; 55 | # fi 56 | 57 | addons: 58 | apt: 59 | packages: 60 | - liboctave-dev 61 | update: true 62 | 63 | script: 64 | - if [ "$TRAVIS_OS_NAME" = "linux" ]; then 65 | octave-cli --eval "addpath(pwd);cd test;run_zmat_test"; 66 | fi 67 | - ${MAKE} -C src lib 68 | - ${MAKE} -C example/c all LIBTYPE= 69 | - if [ "$TRAVIS_OS_NAME" = "osx" ]; then 70 | DYLD_LIBRARY_PATH=lib example/c/testzmat; 71 | else 72 | LD_LIBRARY_PATH=lib example/c/testzmat; 73 | fi 74 | - ${MAKE} -C src dll 75 | - ${MAKE} -C example/c all LIBTYPE= 76 | - if [ "$TRAVIS_OS_NAME" = "osx" ]; then 77 | DYLD_LIBRARY_PATH=lib example/c/testzmat; 78 | else 79 | LD_LIBRARY_PATH=lib example/c/testzmat; 80 | fi 81 | - if [ "$TRAVIS_OS_NAME" = "linux" ]; then 82 | ${MAKE} -C src oct; 83 | octave-cli --eval "addpath(pwd);cd test;run_zmat_test"; 84 | fi 85 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/revencode.c: -------------------------------------------------------------------------------- 1 | static void _t2(rev_fwd_xform, Int, DIMS)(Int* p); 2 | 3 | /* private functions ------------------------------------------------------- */ 4 | 5 | /* reversible forward lifting transform of 4-vector */ 6 | static void 7 | _t1(rev_fwd_lift, Int)(Int* p, uint s) 8 | { 9 | Int x, y, z, w; 10 | x = *p; p += s; 11 | y = *p; p += s; 12 | z = *p; p += s; 13 | w = *p; p += s; 14 | 15 | /* 16 | ** high-order Lorenzo transform 17 | ** ( 1 0 0 0) (x) 18 | ** (-1 1 0 0) (y) 19 | ** ( 1 -2 1 0) (z) 20 | ** (-1 3 -3 1) (w) 21 | */ 22 | w -= z; z -= y; y -= x; 23 | w -= z; z -= y; 24 | w -= z; 25 | 26 | p -= s; *p = w; 27 | p -= s; *p = z; 28 | p -= s; *p = y; 29 | p -= s; *p = x; 30 | } 31 | 32 | /* return precision required to encode block reversibly */ 33 | static uint 34 | _t1(rev_precision, UInt)(const UInt* block, uint n) 35 | { 36 | uint p = 0; 37 | uint s; 38 | /* compute bitwise OR of all values */ 39 | UInt m = 0; 40 | while (n--) 41 | m |= *block++; 42 | /* count trailing zeros via binary search */ 43 | for (s = (uint)(CHAR_BIT * sizeof(UInt)); m; s /= 2) 44 | if ((UInt)(m << (s - 1))) { 45 | m <<= s - 1; 46 | m <<= 1; 47 | p += s; 48 | } 49 | return p; 50 | } 51 | 52 | /* encode block of integers using reversible algorithm */ 53 | static uint 54 | _t2(rev_encode_block, Int, DIMS)(bitstream* stream, int minbits, int maxbits, int maxprec, Int* iblock) 55 | { 56 | int bits = PBITS; 57 | int prec; 58 | cache_align_(UInt ublock[BLOCK_SIZE]); 59 | /* perform decorrelating transform */ 60 | _t2(rev_fwd_xform, Int, DIMS)(iblock); 61 | /* reorder signed coefficients and convert to unsigned integer */ 62 | _t1(fwd_order, Int)(ublock, iblock, PERM, BLOCK_SIZE); 63 | /* determine and encode number of significant bits */ 64 | prec = _t1(rev_precision, UInt)(ublock, BLOCK_SIZE); 65 | prec = MIN(prec, maxprec); 66 | prec = MAX(prec, 1); 67 | stream_write_bits(stream, prec - 1, PBITS); 68 | /* encode integer coefficients */ 69 | bits += _t1(encode_ints, UInt)(stream, maxbits - bits, prec, ublock, BLOCK_SIZE); 70 | /* write at least minbits bits by padding with zeros */ 71 | if (bits < minbits) { 72 | stream_pad(stream, minbits - bits); 73 | bits = minbits; 74 | } 75 | return bits; 76 | } 77 | -------------------------------------------------------------------------------- /src/blosc2/blosc/timestamp.c: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | #include "blosc2.h" 12 | 13 | /* System-specific high-precision timing functions. */ 14 | #if defined(_WIN32) 15 | 16 | /* Set a timestamp value to the current time. */ 17 | void blosc_set_timestamp(blosc_timestamp_t* timestamp) { 18 | /* Ignore the return value, assume the call always succeeds. */ 19 | QueryPerformanceCounter(timestamp); 20 | } 21 | 22 | /* Given two timestamp values, return the difference in nanoseconds. */ 23 | double blosc_elapsed_nsecs(blosc_timestamp_t start_time, 24 | blosc_timestamp_t end_time) { 25 | LARGE_INTEGER CounterFreq; 26 | QueryPerformanceFrequency(&CounterFreq); 27 | 28 | return (double)(end_time.QuadPart - start_time.QuadPart) / 29 | ((double)CounterFreq.QuadPart / 1e9); 30 | } 31 | 32 | #else 33 | 34 | /* Set a timestamp value to the current time. */ 35 | void blosc_set_timestamp(blosc_timestamp_t* timestamp) { 36 | #ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time 37 | clock_serv_t cclock; 38 | mach_timespec_t mts; 39 | host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); 40 | clock_get_time(cclock, &mts); 41 | mach_port_deallocate(mach_task_self(), cclock); 42 | timestamp->tv_sec = mts.tv_sec; 43 | timestamp->tv_nsec = mts.tv_nsec; 44 | #else 45 | clock_gettime(CLOCK_MONOTONIC, timestamp); 46 | #endif 47 | } 48 | 49 | /* Given two timestamp values, return the difference in nanoseconds. */ 50 | double blosc_elapsed_nsecs(blosc_timestamp_t start_time, 51 | blosc_timestamp_t end_time) { 52 | return (1e9 * (double)(end_time.tv_sec - start_time.tv_sec)) + 53 | (double)(end_time.tv_nsec - start_time.tv_nsec); 54 | } 55 | 56 | #endif 57 | 58 | /* Given two timeval stamps, return the difference in seconds */ 59 | double blosc_elapsed_secs(blosc_timestamp_t last, blosc_timestamp_t current) { 60 | return 1e-9 * blosc_elapsed_nsecs(last, current); 61 | } 62 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/ndlz/ndlz8x8.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | 12 | 13 | #ifndef NDLZ8_H 14 | #define NDLZ8_H 15 | #include "context.h" 16 | 17 | #if defined (__cplusplus) 18 | extern "C" { 19 | #endif 20 | #include "ndlz.h" 21 | #include "ndlz-private.h" 22 | 23 | /** 24 | Compress a block of data in the input buffer and returns the size of 25 | compressed block. The size of input buffer is specified by 26 | length. The minimum input buffer size is 16. 27 | 28 | The output buffer must be at least 5% larger than the input buffer 29 | and can not be smaller than 66 bytes. 30 | 31 | If the input is not compressible, or output does not fit in maxout 32 | bytes, the return value will be 0 and you will have to discard the 33 | output buffer. 34 | 35 | The acceleration parameter is related with the frequency for 36 | updating the internal hash. An acceleration of 1 means that the 37 | internal hash is updated at full rate. A value < 1 is not allowed 38 | and will be silently set to 1. 39 | 40 | The input buffer and the output buffer can not overlap. 41 | */ 42 | 43 | int ndlz8_compress(const uint8_t *input, int32_t input_len, uint8_t *output, int32_t output_len, 44 | uint8_t meta, blosc2_cparams *cparams); 45 | 46 | /** 47 | Decompress a block of compressed data and returns the size of the 48 | decompressed block. If error occurs, e.g. the compressed data is 49 | corrupted or the output buffer is not large enough, then 0 (zero) 50 | will be returned instead. 51 | 52 | The input buffer and the output buffer can not overlap. 53 | 54 | Decompression is memory safe and guaranteed not to write the output buffer 55 | more than what is specified in maxout. 56 | */ 57 | 58 | int ndlz8_decompress(const uint8_t *input, int32_t input_len, uint8_t *output, int32_t output_len, 59 | uint8_t meta, blosc2_dparams *dparams); 60 | 61 | #if defined (__cplusplus) 62 | } 63 | #endif 64 | 65 | #endif /* NDLZ8_H */ 66 | -------------------------------------------------------------------------------- /src/easylzma/common_internal.h: -------------------------------------------------------------------------------- 1 | #ifndef __ELZMA_COMMON_INTERNAL_H__ 2 | #define __ELZMA_COMMON_INTERNAL_H__ 3 | 4 | #include "easylzma/common.h" 5 | 6 | /** a structure which may be cast and passed into Igor's allocate 7 | * routines */ 8 | struct elzma_alloc_struct { 9 | void *(*Alloc)(void *p, size_t size); 10 | void (*Free)(void *p, void *address); /* address can be 0 */ 11 | 12 | elzma_malloc clientMallocFunc; 13 | void * clientMallocContext; 14 | 15 | elzma_free clientFreeFunc; 16 | void * clientFreeContext; 17 | }; 18 | 19 | /* initialize an allocation structure, may be called safely multiple 20 | * times */ 21 | void init_alloc_struct(struct elzma_alloc_struct * allocStruct, 22 | elzma_malloc clientMallocFunc, 23 | void * clientMallocContext, 24 | elzma_free clientFreeFunc, 25 | void * clientFreeContext); 26 | 27 | /** superset representation of a compressed file header */ 28 | struct elzma_file_header { 29 | unsigned char pb; 30 | unsigned char lp; 31 | unsigned char lc; 32 | unsigned char isStreamed; 33 | long long unsigned int uncompressedSize; 34 | unsigned int dictSize; 35 | }; 36 | 37 | /** superset representation of a compressed file footer */ 38 | struct elzma_file_footer { 39 | unsigned int crc32; 40 | long long unsigned int uncompressedSize; 41 | }; 42 | 43 | /** a structure which encapsulates information about the particular 44 | * file header and footer in use (lzip vs lzma vs (eventually) xz. 45 | * The intention of this structure is to simplify compression and 46 | * decompression logic by abstracting the file format details a bit. */ 47 | struct elzma_format_handler 48 | { 49 | unsigned int header_size; 50 | void (*init_header)(struct elzma_file_header * hdr); 51 | int (*parse_header)(const unsigned char * hdrBuf, 52 | struct elzma_file_header * hdr); 53 | int (*serialize_header)(unsigned char * hdrBuf, 54 | const struct elzma_file_header * hdr); 55 | 56 | unsigned int footer_size; 57 | int (*serialize_footer)(struct elzma_file_footer * ftr, 58 | unsigned char * ftrBuf); 59 | int (*parse_footer)(const unsigned char * ftrBuf, 60 | struct elzma_file_footer * ftr); 61 | }; 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /src/blosc2/internal-complibs/zstd/compress/zstd_compress_sequences.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under both the BSD-style license (found in the 6 | * LICENSE file in the root directory of this source tree) and the GPLv2 (found 7 | * in the COPYING file in the root directory of this source tree). 8 | * You may select, at your option, one of the above-listed licenses. 9 | */ 10 | 11 | #ifndef ZSTD_COMPRESS_SEQUENCES_H 12 | #define ZSTD_COMPRESS_SEQUENCES_H 13 | 14 | #include "../common/fse.h" /* FSE_repeat, FSE_CTable */ 15 | #include "../common/zstd_internal.h" /* symbolEncodingType_e, ZSTD_strategy */ 16 | 17 | typedef enum { 18 | ZSTD_defaultDisallowed = 0, 19 | ZSTD_defaultAllowed = 1 20 | } ZSTD_defaultPolicy_e; 21 | 22 | symbolEncodingType_e 23 | ZSTD_selectEncodingType( 24 | FSE_repeat* repeatMode, unsigned const* count, unsigned const max, 25 | size_t const mostFrequent, size_t nbSeq, unsigned const FSELog, 26 | FSE_CTable const* prevCTable, 27 | short const* defaultNorm, U32 defaultNormLog, 28 | ZSTD_defaultPolicy_e const isDefaultAllowed, 29 | ZSTD_strategy const strategy); 30 | 31 | size_t 32 | ZSTD_buildCTable(void* dst, size_t dstCapacity, 33 | FSE_CTable* nextCTable, U32 FSELog, symbolEncodingType_e type, 34 | unsigned* count, U32 max, 35 | const BYTE* codeTable, size_t nbSeq, 36 | const S16* defaultNorm, U32 defaultNormLog, U32 defaultMax, 37 | const FSE_CTable* prevCTable, size_t prevCTableSize, 38 | void* entropyWorkspace, size_t entropyWorkspaceSize); 39 | 40 | size_t ZSTD_encodeSequences( 41 | void* dst, size_t dstCapacity, 42 | FSE_CTable const* CTable_MatchLength, BYTE const* mlCodeTable, 43 | FSE_CTable const* CTable_OffsetBits, BYTE const* ofCodeTable, 44 | FSE_CTable const* CTable_LitLength, BYTE const* llCodeTable, 45 | seqDef const* sequences, size_t nbSeq, int longOffsets, int bmi2); 46 | 47 | size_t ZSTD_fseBitCost( 48 | FSE_CTable const* ctable, 49 | unsigned const* count, 50 | unsigned const max); 51 | 52 | size_t ZSTD_crossEntropyCost(short const* norm, unsigned accuracyLog, 53 | unsigned const* count, unsigned const max); 54 | #endif /* ZSTD_COMPRESS_SEQUENCES_H */ 55 | -------------------------------------------------------------------------------- /src/blosc2/internal-complibs/zstd/deprecated/zbuff_decompress.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under both the BSD-style license (found in the 6 | * LICENSE file in the root directory of this source tree) and the GPLv2 (found 7 | * in the COPYING file in the root directory of this source tree). 8 | * You may select, at your option, one of the above-listed licenses. 9 | */ 10 | 11 | 12 | 13 | /* ************************************* 14 | * Dependencies 15 | ***************************************/ 16 | #define ZSTD_DISABLE_DEPRECATE_WARNINGS /* suppress warning on ZSTD_initDStream_usingDict */ 17 | #include "../zstd.h" /* ZSTD_CStream, ZSTD_DStream, ZSTDLIB_API */ 18 | #define ZBUFF_STATIC_LINKING_ONLY 19 | #include "zbuff.h" 20 | 21 | 22 | ZBUFF_DCtx* ZBUFF_createDCtx(void) 23 | { 24 | return ZSTD_createDStream(); 25 | } 26 | 27 | ZBUFF_DCtx* ZBUFF_createDCtx_advanced(ZSTD_customMem customMem) 28 | { 29 | return ZSTD_createDStream_advanced(customMem); 30 | } 31 | 32 | size_t ZBUFF_freeDCtx(ZBUFF_DCtx* zbd) 33 | { 34 | return ZSTD_freeDStream(zbd); 35 | } 36 | 37 | 38 | /* *** Initialization *** */ 39 | 40 | size_t ZBUFF_decompressInitDictionary(ZBUFF_DCtx* zbd, const void* dict, size_t dictSize) 41 | { 42 | return ZSTD_initDStream_usingDict(zbd, dict, dictSize); 43 | } 44 | 45 | size_t ZBUFF_decompressInit(ZBUFF_DCtx* zbd) 46 | { 47 | return ZSTD_initDStream(zbd); 48 | } 49 | 50 | 51 | /* *** Decompression *** */ 52 | 53 | size_t ZBUFF_decompressContinue(ZBUFF_DCtx* zbd, 54 | void* dst, size_t* dstCapacityPtr, 55 | const void* src, size_t* srcSizePtr) 56 | { 57 | ZSTD_outBuffer outBuff; 58 | ZSTD_inBuffer inBuff; 59 | size_t result; 60 | outBuff.dst = dst; 61 | outBuff.pos = 0; 62 | outBuff.size = *dstCapacityPtr; 63 | inBuff.src = src; 64 | inBuff.pos = 0; 65 | inBuff.size = *srcSizePtr; 66 | result = ZSTD_decompressStream(zbd, &outBuff, &inBuff); 67 | *dstCapacityPtr = outBuff.pos; 68 | *srcSizePtr = inBuff.pos; 69 | return result; 70 | } 71 | 72 | 73 | /* ************************************* 74 | * Tool functions 75 | ***************************************/ 76 | size_t ZBUFF_recommendedDInSize(void) { return ZSTD_DStreamInSize(); } 77 | size_t ZBUFF_recommendedDOutSize(void) { return ZSTD_DStreamOutSize(); } 78 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/ndlz/ndlz.c: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Author: Francesc Alted 5 | Author: Oscar Griñón 6 | Author: Aleix Alcacer 7 | Creation date: 2020-06-12 8 | 9 | See LICENSE.txt for details about copyright and rights to use. 10 | **********************************************************************/ 11 | 12 | /********************************************************************* 13 | This codec is meant to leverage multidimensionality for getting 14 | better compression ratios. The idea is to look for similarities 15 | in places that are closer in a euclidean metric, not the typical 16 | linear one. 17 | **********************************************************************/ 18 | 19 | 20 | #include 21 | #include "ndlz.h" 22 | #include "ndlz-private.h" 23 | #include "ndlz4x4.h" 24 | #include "ndlz8x8.h" 25 | 26 | int ndlz_compress(const uint8_t *input, int32_t input_len, uint8_t *output, int32_t output_len, 27 | uint8_t meta, blosc2_cparams *cparams, const void* chunk) { 28 | NDLZ_ERROR_NULL(input); 29 | NDLZ_ERROR_NULL(output); 30 | NDLZ_ERROR_NULL(cparams); 31 | BLOSC_UNUSED_PARAM(chunk); 32 | 33 | switch (meta) { 34 | case 4: 35 | return ndlz4_compress(input, input_len, output, output_len, meta, cparams); 36 | case 8: 37 | return ndlz8_compress(input, input_len, output, output_len, meta, cparams); 38 | default: 39 | printf("\n NDLZ is not available for this cellsize \n"); 40 | return 0; 41 | } 42 | } 43 | 44 | int ndlz_decompress(const uint8_t *input, int32_t input_len, uint8_t *output, int32_t output_len, 45 | uint8_t meta, blosc2_dparams *dparams, const void* chunk) { 46 | NDLZ_ERROR_NULL(input); 47 | NDLZ_ERROR_NULL(output); 48 | NDLZ_ERROR_NULL(dparams); 49 | BLOSC_UNUSED_PARAM(chunk); 50 | 51 | switch (meta) { 52 | case 4: 53 | return ndlz4_decompress(input, input_len, output, output_len, meta, dparams); 54 | case 8: 55 | return ndlz8_decompress(input, input_len, output, output_len, meta, dparams); 56 | default: 57 | printf("\n NDLZ is not available for this cellsize \n"); 58 | return 0; 59 | } 60 | } 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/ndlz/ndlz4x4.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | 12 | 13 | #ifndef NDLZ4_H 14 | #define NDLZ4_H 15 | #include "context.h" 16 | 17 | #if defined (__cplusplus) 18 | extern "C" { 19 | #endif 20 | #include "ndlz.h" 21 | #include "ndlz-private.h" 22 | /* 23 | #include 24 | #include "blosc2/blosc2-common.h" 25 | #include "fastcopy.h" 26 | */ 27 | 28 | 29 | 30 | /** 31 | Compress a block of data in the input buffer and returns the size of 32 | compressed block. The size of input buffer is specified by 33 | length. The minimum input buffer size is 16. 34 | 35 | The output buffer must be at least 5% larger than the input buffer 36 | and can not be smaller than 66 bytes. 37 | 38 | If the input is not compressible, or output does not fit in maxout 39 | bytes, the return value will be 0 and you will have to discard the 40 | output buffer. 41 | 42 | The acceleration parameter is related with the frequency for 43 | updating the internal hash. An acceleration of 1 means that the 44 | internal hash is updated at full rate. A value < 1 is not allowed 45 | and will be silently set to 1. 46 | 47 | The input buffer and the output buffer can not overlap. 48 | */ 49 | 50 | int ndlz4_compress(const uint8_t *input, int32_t input_len, uint8_t *output, int32_t output_len, 51 | uint8_t meta, blosc2_cparams *cparams); 52 | 53 | /** 54 | Decompress a block of compressed data and returns the size of the 55 | decompressed block. If error occurs, e.g. the compressed data is 56 | corrupted or the output buffer is not large enough, then 0 (zero) 57 | will be returned instead. 58 | 59 | The input buffer and the output buffer can not overlap. 60 | 61 | Decompression is memory safe and guaranteed not to write the output buffer 62 | more than what is specified in maxout. 63 | */ 64 | 65 | int ndlz4_decompress(const uint8_t *input, int32_t input_len, uint8_t *output, int32_t output_len, 66 | uint8_t meta, blosc2_dparams *dparams); 67 | 68 | #if defined (__cplusplus) 69 | } 70 | #endif 71 | 72 | #endif /* NDLZ4_H */ 73 | -------------------------------------------------------------------------------- /src/easylzma/pavlov/Bra86.c: -------------------------------------------------------------------------------- 1 | /* Bra86.c -- Converter for x86 code (BCJ) 2 | 2008-10-04 : Igor Pavlov : Public domain */ 3 | 4 | #include "Bra.h" 5 | 6 | #define Test86MSByte(b) ((b) == 0 || (b) == 0xFF) 7 | 8 | const Byte kMaskToAllowedStatus[8] = {1, 1, 1, 0, 1, 0, 0, 0}; 9 | const Byte kMaskToBitNumber[8] = {0, 1, 2, 2, 3, 3, 3, 3}; 10 | 11 | SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding) 12 | { 13 | SizeT bufferPos = 0, prevPosT; 14 | UInt32 prevMask = *state & 0x7; 15 | if (size < 5) 16 | return 0; 17 | ip += 5; 18 | prevPosT = (SizeT)0 - 1; 19 | 20 | for (;;) 21 | { 22 | Byte *p = data + bufferPos; 23 | Byte *limit = data + size - 4; 24 | for (; p < limit; p++) 25 | if ((*p & 0xFE) == 0xE8) 26 | break; 27 | bufferPos = (SizeT)(p - data); 28 | if (p >= limit) 29 | break; 30 | prevPosT = bufferPos - prevPosT; 31 | if (prevPosT > 3) 32 | prevMask = 0; 33 | else 34 | { 35 | prevMask = (prevMask << ((int)prevPosT - 1)) & 0x7; 36 | if (prevMask != 0) 37 | { 38 | Byte b = p[4 - kMaskToBitNumber[prevMask]]; 39 | if (!kMaskToAllowedStatus[prevMask] || Test86MSByte(b)) 40 | { 41 | prevPosT = bufferPos; 42 | prevMask = ((prevMask << 1) & 0x7) | 1; 43 | bufferPos++; 44 | continue; 45 | } 46 | } 47 | } 48 | prevPosT = bufferPos; 49 | 50 | if (Test86MSByte(p[4])) 51 | { 52 | UInt32 src = ((UInt32)p[4] << 24) | ((UInt32)p[3] << 16) | ((UInt32)p[2] << 8) | ((UInt32)p[1]); 53 | UInt32 dest; 54 | for (;;) 55 | { 56 | Byte b; 57 | int index; 58 | if (encoding) 59 | dest = (ip + (UInt32)bufferPos) + src; 60 | else 61 | dest = src - (ip + (UInt32)bufferPos); 62 | if (prevMask == 0) 63 | break; 64 | index = kMaskToBitNumber[prevMask] * 8; 65 | b = (Byte)(dest >> (24 - index)); 66 | if (!Test86MSByte(b)) 67 | break; 68 | src = dest ^ ((1 << (32 - index)) - 1); 69 | } 70 | p[4] = (Byte)(~(((dest >> 24) & 1) - 1)); 71 | p[3] = (Byte)(dest >> 16); 72 | p[2] = (Byte)(dest >> 8); 73 | p[1] = (Byte)dest; 74 | bufferPos += 5; 75 | } 76 | else 77 | { 78 | prevMask = ((prevMask << 1) & 0x7) | 1; 79 | bufferPos++; 80 | } 81 | } 82 | prevPosT = bufferPos - prevPosT; 83 | *state = ((prevPosT > 3) ? 0 : ((prevMask << ((int)prevPosT - 1)) & 0x7)); 84 | return bufferPos; 85 | } 86 | -------------------------------------------------------------------------------- /src/blosc2/blosc/blosc2-stdio.c: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | 12 | #include "blosc2/blosc2-stdio.h" 13 | #include "blosc2.h" 14 | 15 | void *blosc2_stdio_open(const char *urlpath, const char *mode, void *params) { 16 | BLOSC_UNUSED_PARAM(params); 17 | FILE *file = fopen(urlpath, mode); 18 | if (file == NULL) 19 | return NULL; 20 | blosc2_stdio_file *my_fp = malloc(sizeof(blosc2_stdio_file)); 21 | my_fp->file = file; 22 | return my_fp; 23 | } 24 | 25 | int blosc2_stdio_close(void *stream) { 26 | blosc2_stdio_file *my_fp = (blosc2_stdio_file *) stream; 27 | int err = fclose(my_fp->file); 28 | free(my_fp); 29 | return err; 30 | } 31 | 32 | int64_t blosc2_stdio_tell(void *stream) { 33 | blosc2_stdio_file *my_fp = (blosc2_stdio_file *) stream; 34 | int64_t pos; 35 | #if defined(_MSC_VER) && (_MSC_VER >= 1400) 36 | pos = _ftelli64(my_fp->file); 37 | #else 38 | pos = (int64_t)ftell(my_fp->file); 39 | #endif 40 | return pos; 41 | } 42 | 43 | int blosc2_stdio_seek(void *stream, int64_t offset, int whence) { 44 | blosc2_stdio_file *my_fp = (blosc2_stdio_file *) stream; 45 | int rc; 46 | #if defined(_MSC_VER) && (_MSC_VER >= 1400) 47 | rc = _fseeki64(my_fp->file, offset, whence); 48 | #else 49 | rc = fseek(my_fp->file, (long) offset, whence); 50 | #endif 51 | return rc; 52 | } 53 | 54 | int64_t blosc2_stdio_write(const void *ptr, int64_t size, int64_t nitems, void *stream) { 55 | blosc2_stdio_file *my_fp = (blosc2_stdio_file *) stream; 56 | 57 | size_t nitems_ = fwrite(ptr, (size_t) size, (size_t) nitems, my_fp->file); 58 | return (int64_t) nitems_; 59 | } 60 | 61 | int64_t blosc2_stdio_read(void *ptr, int64_t size, int64_t nitems, void *stream) { 62 | blosc2_stdio_file *my_fp = (blosc2_stdio_file *) stream; 63 | size_t nitems_ = fread(ptr, (size_t) size, (size_t) nitems, my_fp->file); 64 | return (int64_t) nitems_; 65 | } 66 | 67 | int blosc2_stdio_truncate(void *stream, int64_t size) { 68 | blosc2_stdio_file *my_fp = (blosc2_stdio_file *) stream; 69 | int rc; 70 | #if defined(_MSC_VER) && (_MSC_VER >= 1400) 71 | rc = _chsize_s(_fileno(my_fp->file), size); 72 | #else 73 | rc = ftruncate(fileno(my_fp->file), size); 74 | #endif 75 | return rc; 76 | } 77 | -------------------------------------------------------------------------------- /src/blosc2/blosc/blosclz.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (C) 2021 The Blosc Developers 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | See LICENSE.txt for details about copyright and rights to use. 9 | **********************************************************************/ 10 | 11 | /********************************************************************* 12 | The code in this file is heavily based on FastLZ, a lightning-fast 13 | lossless compression library. See LICENSES/FASTLZ.txt for details 14 | about copyright and rights to use. 15 | **********************************************************************/ 16 | 17 | 18 | #ifndef BLOSCLZ_H 19 | #define BLOSCLZ_H 20 | #include "context.h" 21 | 22 | #if defined (__cplusplus) 23 | extern "C" { 24 | #endif 25 | 26 | #define BLOSCLZ_VERSION_STRING "2.5.2" 27 | 28 | 29 | /** 30 | Compress a block of data in the input buffer and returns the size of 31 | compressed block. The size of input buffer is specified by 32 | length. The minimum input buffer size is 16. 33 | 34 | The output buffer must be at least 5% larger than the input buffer 35 | and can not be smaller than 66 bytes. 36 | 37 | If the input is not compressible, or output does not fit in maxout 38 | bytes, the return value will be 0 and you will have to discard the 39 | output buffer. 40 | 41 | The acceleration parameter is related with the frequency for 42 | updating the internal hash. An acceleration of 1 means that the 43 | internal hash is updated at full rate. A value < 1 is not allowed 44 | and will be silently set to 1. 45 | 46 | The input buffer and the output buffer can not overlap. 47 | */ 48 | 49 | int blosclz_compress(int opt_level, const void* input, int length, 50 | void* output, int maxout, blosc2_context* ctx); 51 | 52 | /** 53 | Decompress a block of compressed data and returns the size of the 54 | decompressed block. If error occurs, e.g. the compressed data is 55 | corrupted or the output buffer is not large enough, then 0 (zero) 56 | will be returned instead. 57 | 58 | The input buffer and the output buffer can not overlap. 59 | 60 | Decompression is memory safe and guaranteed not to write the output buffer 61 | more than what is specified in maxout. 62 | */ 63 | 64 | int blosclz_decompress(const void* input, int length, void* output, int maxout); 65 | 66 | #if defined (__cplusplus) 67 | } 68 | #endif 69 | 70 | #endif /* BLOSCLZ_H */ 71 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/codec3.c: -------------------------------------------------------------------------------- 1 | #define index(i, j, k) ((i) + 4 * ((j) + 4 * (k))) 2 | 3 | /* order coefficients (i, j, k) by i + j + k, then i^2 + j^2 + k^2 */ 4 | cache_align_(static const uchar perm_3[64]) = { 5 | index(0, 0, 0), /* 0 : 0 */ 6 | 7 | index(1, 0, 0), /* 1 : 1 */ 8 | index(0, 1, 0), /* 2 : 1 */ 9 | index(0, 0, 1), /* 3 : 1 */ 10 | 11 | index(0, 1, 1), /* 4 : 2 */ 12 | index(1, 0, 1), /* 5 : 2 */ 13 | index(1, 1, 0), /* 6 : 2 */ 14 | 15 | index(2, 0, 0), /* 7 : 2 */ 16 | index(0, 2, 0), /* 8 : 2 */ 17 | index(0, 0, 2), /* 9 : 2 */ 18 | 19 | index(1, 1, 1), /* 10 : 3 */ 20 | 21 | index(2, 1, 0), /* 11 : 3 */ 22 | index(2, 0, 1), /* 12 : 3 */ 23 | index(0, 2, 1), /* 13 : 3 */ 24 | index(1, 2, 0), /* 14 : 3 */ 25 | index(1, 0, 2), /* 15 : 3 */ 26 | index(0, 1, 2), /* 16 : 3 */ 27 | 28 | index(3, 0, 0), /* 17 : 3 */ 29 | index(0, 3, 0), /* 18 : 3 */ 30 | index(0, 0, 3), /* 19 : 3 */ 31 | 32 | index(2, 1, 1), /* 20 : 4 */ 33 | index(1, 2, 1), /* 21 : 4 */ 34 | index(1, 1, 2), /* 22 : 4 */ 35 | 36 | index(0, 2, 2), /* 23 : 4 */ 37 | index(2, 0, 2), /* 24 : 4 */ 38 | index(2, 2, 0), /* 25 : 4 */ 39 | 40 | index(3, 1, 0), /* 26 : 4 */ 41 | index(3, 0, 1), /* 27 : 4 */ 42 | index(0, 3, 1), /* 28 : 4 */ 43 | index(1, 3, 0), /* 29 : 4 */ 44 | index(1, 0, 3), /* 30 : 4 */ 45 | index(0, 1, 3), /* 31 : 4 */ 46 | 47 | index(1, 2, 2), /* 32 : 5 */ 48 | index(2, 1, 2), /* 33 : 5 */ 49 | index(2, 2, 1), /* 34 : 5 */ 50 | 51 | index(3, 1, 1), /* 35 : 5 */ 52 | index(1, 3, 1), /* 36 : 5 */ 53 | index(1, 1, 3), /* 37 : 5 */ 54 | 55 | index(3, 2, 0), /* 38 : 5 */ 56 | index(3, 0, 2), /* 39 : 5 */ 57 | index(0, 3, 2), /* 40 : 5 */ 58 | index(2, 3, 0), /* 41 : 5 */ 59 | index(2, 0, 3), /* 42 : 5 */ 60 | index(0, 2, 3), /* 43 : 5 */ 61 | 62 | index(2, 2, 2), /* 44 : 6 */ 63 | 64 | index(3, 2, 1), /* 45 : 6 */ 65 | index(3, 1, 2), /* 46 : 6 */ 66 | index(1, 3, 2), /* 47 : 6 */ 67 | index(2, 3, 1), /* 48 : 6 */ 68 | index(2, 1, 3), /* 49 : 6 */ 69 | index(1, 2, 3), /* 50 : 6 */ 70 | 71 | index(0, 3, 3), /* 51 : 6 */ 72 | index(3, 0, 3), /* 52 : 6 */ 73 | index(3, 3, 0), /* 53 : 6 */ 74 | 75 | index(3, 2, 2), /* 54 : 7 */ 76 | index(2, 3, 2), /* 55 : 7 */ 77 | index(2, 2, 3), /* 56 : 7 */ 78 | 79 | index(1, 3, 3), /* 57 : 7 */ 80 | index(3, 1, 3), /* 58 : 7 */ 81 | index(3, 3, 1), /* 59 : 7 */ 82 | 83 | index(2, 3, 3), /* 60 : 8 */ 84 | index(3, 2, 3), /* 61 : 8 */ 85 | index(3, 3, 2), /* 62 : 8 */ 86 | 87 | index(3, 3, 3), /* 63 : 9 */ 88 | }; 89 | 90 | #undef index 91 | -------------------------------------------------------------------------------- /src/blosc2/plugins/filters/ndcell/README.md: -------------------------------------------------------------------------------- 1 | NDCELL: a multidimensional filter for lossless compression 2 | ============================================================================= 3 | 4 | Given an n-dim array or matrix, *NDCELL* is a filter based on the codec *NDLZ* 5 | that divides data into multidimensional cells, reordering the dataset so 6 | that the codec compress cell by cell. 7 | 8 | Plugin motivation 9 | -------------------- 10 | 11 | *NDCELL* was created in order to make easy for codecs to search for patterns repetitions in multidimensional datasets using the Caterva blocking machinery. 12 | 13 | Plugin usage 14 | ------------------- 15 | 16 | The codec consists of an encoder called *ndcell_encoder()* to reorder data and 17 | a decoder called *ndcell_decoder()* to recover the original data. 18 | 19 | The parameters used by *NDCELL* are the ones specified in the *blosc2_filter* 20 | structure of *blosc2.h*. 21 | Furthermore, since *NDCELL* goes through dataset blocks dividing them into fixed size cells, 22 | user must specify the parameter meta as the cellshape, so if in a 23 | 3-dim dataset user specifies meta = 4, then cellshape will be 4x4x4. 24 | 25 | Plugin behaviour 26 | ------------------- 27 | 28 | This filter is meant to leverage multidimensionality for helping codecs to get 29 | better compression ratios. The idea is to order the data so that when the 30 | dataset is traversed the elements of a cell are all in a row. 31 | 32 | 33 | 34 | ------------------------ ----------------------------- 35 | | 0 1 | 2 3 | 4 5 | 6 7 | | 0 1 8 9 | 2 3 10 11 | 36 | | 8 9 |10 11|12 13|14 15| NDCELL encoder ----------------------------- 37 | ------------------------- ------> | 4 5 12 13 | 6 7 14 15 | 38 | |16 17|18 19|20 21|22 23| ----------------------------- 39 | |24 25|26 27|28 29|30 31| | 16 17 24 25 | 18 19 26 27 | 40 | ------------------------- ----------------------------- 41 | | 20 21 28 29 | 22 23 30 31 | 42 | ----------------------------- 43 | 44 | 45 | 46 | 47 | Advantages and disadvantages 48 | ------------------------------ 49 | 50 | The particularity of *NDCELL* is that this filter 51 | considers datasets multidimensionality and takes advantage of it instead 52 | of processing all data as serial. 53 | 54 | The main disadvantage of *NDCELL* is that only a few codecs are benefited 55 | by it and only for multidimensional datasets. 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/decode3.c: -------------------------------------------------------------------------------- 1 | /* private functions ------------------------------------------------------- */ 2 | 3 | /* scatter 4*4*4 block to strided array */ 4 | static void 5 | _t2(scatter, Scalar, 3)(const Scalar* q, Scalar* p, ptrdiff_t sx, ptrdiff_t sy, ptrdiff_t sz) 6 | { 7 | uint x, y, z; 8 | for (z = 0; z < 4; z++, p += sz - 4 * sy) 9 | for (y = 0; y < 4; y++, p += sy - 4 * sx) 10 | for (x = 0; x < 4; x++, p += sx) 11 | *p = *q++; 12 | } 13 | 14 | /* scatter nx*ny*nz block to strided array */ 15 | static void 16 | _t2(scatter_partial, Scalar, 3)(const Scalar* q, Scalar* p, size_t nx, size_t ny, size_t nz, ptrdiff_t sx, ptrdiff_t sy, ptrdiff_t sz) 17 | { 18 | size_t x, y, z; 19 | for (z = 0; z < nz; z++, p += sz - (ptrdiff_t)ny * sy, q += 4 * (4 - ny)) 20 | for (y = 0; y < ny; y++, p += sy - (ptrdiff_t)nx * sx, q += 1 * (4 - nx)) 21 | for (x = 0; x < nx; x++, p += sx, q++) 22 | *p = *q; 23 | } 24 | 25 | /* inverse decorrelating 3D transform */ 26 | static void 27 | _t2(inv_xform, Int, 3)(Int* p) 28 | { 29 | uint x, y, z; 30 | /* transform along z */ 31 | for (y = 0; y < 4; y++) 32 | for (x = 0; x < 4; x++) 33 | _t1(inv_lift, Int)(p + 1 * x + 4 * y, 16); 34 | /* transform along y */ 35 | for (x = 0; x < 4; x++) 36 | for (z = 0; z < 4; z++) 37 | _t1(inv_lift, Int)(p + 16 * z + 1 * x, 4); 38 | /* transform along x */ 39 | for (z = 0; z < 4; z++) 40 | for (y = 0; y < 4; y++) 41 | _t1(inv_lift, Int)(p + 4 * y + 16 * z, 1); 42 | } 43 | 44 | /* public functions -------------------------------------------------------- */ 45 | 46 | /* decode 4*4*4 block and store at p using strides (sx, sy, sz) */ 47 | size_t 48 | _t2(zfp_decode_block_strided, Scalar, 3)(zfp_stream* stream, Scalar* p, ptrdiff_t sx, ptrdiff_t sy, ptrdiff_t sz) 49 | { 50 | /* decode contiguous block */ 51 | cache_align_(Scalar block[64]); 52 | size_t bits = _t2(zfp_decode_block, Scalar, 3)(stream, block); 53 | /* scatter block to strided array */ 54 | _t2(scatter, Scalar, 3)(block, p, sx, sy, sz); 55 | return bits; 56 | } 57 | 58 | /* decode nx*ny*nz block and store at p using strides (sx, sy, sz) */ 59 | size_t 60 | _t2(zfp_decode_partial_block_strided, Scalar, 3)(zfp_stream* stream, Scalar* p, size_t nx, size_t ny, size_t nz, ptrdiff_t sx, ptrdiff_t sy, ptrdiff_t sz) 61 | { 62 | /* decode contiguous block */ 63 | cache_align_(Scalar block[64]); 64 | size_t bits = _t2(zfp_decode_block, Scalar, 3)(stream, block); 65 | /* scatter block to strided array */ 66 | _t2(scatter_partial, Scalar, 3)(block, p, nx, ny, nz, sx, sy, sz); 67 | return bits; 68 | } 69 | -------------------------------------------------------------------------------- /src/blosc2/internal-complibs/zstd/dictBuilder/divsufsort.h: -------------------------------------------------------------------------------- 1 | /* 2 | * divsufsort.h for libdivsufsort-lite 3 | * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef _DIVSUFSORT_H 28 | #define _DIVSUFSORT_H 1 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif /* __cplusplus */ 33 | 34 | 35 | /*- Prototypes -*/ 36 | 37 | /** 38 | * Constructs the suffix array of a given string. 39 | * @param T [0..n-1] The input string. 40 | * @param SA [0..n-1] The output array of suffixes. 41 | * @param n The length of the given string. 42 | * @param openMP enables OpenMP optimization. 43 | * @return 0 if no error occurred, -1 or -2 otherwise. 44 | */ 45 | int 46 | divsufsort(const unsigned char *T, int *SA, int n, int openMP); 47 | 48 | /** 49 | * Constructs the burrows-wheeler transformed string of a given string. 50 | * @param T [0..n-1] The input string. 51 | * @param U [0..n-1] The output string. (can be T) 52 | * @param A [0..n-1] The temporary array. (can be NULL) 53 | * @param n The length of the given string. 54 | * @param num_indexes The length of secondary indexes array. (can be NULL) 55 | * @param indexes The secondary indexes array. (can be NULL) 56 | * @param openMP enables OpenMP optimization. 57 | * @return The primary index if no error occurred, -1 or -2 otherwise. 58 | */ 59 | int 60 | divbwt(const unsigned char *T, unsigned char *U, int *A, int n, unsigned char * num_indexes, int * indexes, int openMP); 61 | 62 | 63 | #ifdef __cplusplus 64 | } /* extern "C" */ 65 | #endif /* __cplusplus */ 66 | 67 | #endif /* _DIVSUFSORT_H */ 68 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/encode3.c: -------------------------------------------------------------------------------- 1 | /* private functions ------------------------------------------------------- */ 2 | 3 | /* gather 4*4*4 block from strided array */ 4 | static void 5 | _t2(gather, Scalar, 3)(Scalar* q, const Scalar* p, ptrdiff_t sx, ptrdiff_t sy, ptrdiff_t sz) 6 | { 7 | uint x, y, z; 8 | for (z = 0; z < 4; z++, p += sz - 4 * sy) 9 | for (y = 0; y < 4; y++, p += sy - 4 * sx) 10 | for (x = 0; x < 4; x++, p += sx) 11 | *q++ = *p; 12 | } 13 | 14 | /* gather nx*ny*nz block from strided array */ 15 | static void 16 | _t2(gather_partial, Scalar, 3)(Scalar* q, const Scalar* p, size_t nx, size_t ny, size_t nz, ptrdiff_t sx, ptrdiff_t sy, ptrdiff_t sz) 17 | { 18 | size_t x, y, z; 19 | for (z = 0; z < nz; z++, p += sz - (ptrdiff_t)ny * sy) { 20 | for (y = 0; y < ny; y++, p += sy - (ptrdiff_t)nx * sx) { 21 | for (x = 0; x < nx; x++, p += sx) 22 | q[16 * z + 4 * y + x] = *p; 23 | _t1(pad_block, Scalar)(q + 16 * z + 4 * y, nx, 1); 24 | } 25 | for (x = 0; x < 4; x++) 26 | _t1(pad_block, Scalar)(q + 16 * z + x, ny, 4); 27 | } 28 | for (y = 0; y < 4; y++) 29 | for (x = 0; x < 4; x++) 30 | _t1(pad_block, Scalar)(q + 4 * y + x, nz, 16); 31 | } 32 | 33 | /* forward decorrelating 3D transform */ 34 | static void 35 | _t2(fwd_xform, Int, 3)(Int* p) 36 | { 37 | uint x, y, z; 38 | /* transform along x */ 39 | for (z = 0; z < 4; z++) 40 | for (y = 0; y < 4; y++) 41 | _t1(fwd_lift, Int)(p + 4 * y + 16 * z, 1); 42 | /* transform along y */ 43 | for (x = 0; x < 4; x++) 44 | for (z = 0; z < 4; z++) 45 | _t1(fwd_lift, Int)(p + 16 * z + 1 * x, 4); 46 | /* transform along z */ 47 | for (y = 0; y < 4; y++) 48 | for (x = 0; x < 4; x++) 49 | _t1(fwd_lift, Int)(p + 1 * x + 4 * y, 16); 50 | } 51 | 52 | /* public functions -------------------------------------------------------- */ 53 | 54 | /* encode 4*4*4 block stored at p using strides (sx, sy, sz) */ 55 | size_t 56 | _t2(zfp_encode_block_strided, Scalar, 3)(zfp_stream* stream, const Scalar* p, ptrdiff_t sx, ptrdiff_t sy, ptrdiff_t sz) 57 | { 58 | /* gather block from strided array */ 59 | cache_align_(Scalar block[64]); 60 | _t2(gather, Scalar, 3)(block, p, sx, sy, sz); 61 | /* encode block */ 62 | return _t2(zfp_encode_block, Scalar, 3)(stream, block); 63 | } 64 | 65 | /* encode nx*ny*nz block stored at p using strides (sx, sy, sz) */ 66 | size_t 67 | _t2(zfp_encode_partial_block_strided, Scalar, 3)(zfp_stream* stream, const Scalar* p, size_t nx, size_t ny, size_t nz, ptrdiff_t sx, ptrdiff_t sy, ptrdiff_t sz) 68 | { 69 | /* gather block from strided array */ 70 | cache_align_(Scalar block[64]); 71 | _t2(gather_partial, Scalar, 3)(block, p, nx, ny, nz, sx, sy, sz); 72 | /* encode block */ 73 | return _t2(zfp_encode_block, Scalar, 3)(stream, block); 74 | } 75 | -------------------------------------------------------------------------------- /src/easylzma/easylzma/compress.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Written in 2009 by Lloyd Hilaiel 3 | * 4 | * License 5 | * 6 | * All the cruft you find here is public domain. You don't have to credit 7 | * anyone to use this code, but my personal request is that you mention 8 | * Igor Pavlov for his hard, high quality work. 9 | * 10 | * easylzma/compress.h - the API for LZMA compression using easylzma 11 | */ 12 | 13 | #ifndef __EASYLZMACOMPRESS_H__ 14 | #define __EASYLZMACOMPRESS_H__ 15 | 16 | #include "easylzma/common.h" 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | /** suggested default values */ 24 | #define ELZMA_LC_DEFAULT 3 25 | #define ELZMA_LP_DEFAULT 0 26 | #define ELZMA_PB_DEFAULT 2 27 | #define ELZMA_DICT_SIZE_DEFAULT_MAX (1 << 24) 28 | 29 | /** an opaque handle to an lzma compressor */ 30 | typedef struct _elzma_compress_handle * elzma_compress_handle; 31 | 32 | /** 33 | * Allocate a handle to an LZMA compressor object. 34 | */ 35 | elzma_compress_handle EASYLZMA_API elzma_compress_alloc(); 36 | 37 | /** 38 | * set allocation routines (optional, if not called malloc & free will 39 | * be used) 40 | */ 41 | void EASYLZMA_API elzma_compress_set_allocation_callbacks( 42 | elzma_compress_handle hand, 43 | elzma_malloc mallocFunc, void * mallocFuncContext, 44 | elzma_free freeFunc, void * freeFuncContext); 45 | 46 | /** 47 | * Free all data associated with an LZMA compressor object. 48 | */ 49 | void EASYLZMA_API elzma_compress_free(elzma_compress_handle * hand); 50 | 51 | /** 52 | * Set configuration paramters for a compression run. If not called, 53 | * reasonable defaults will be used. 54 | */ 55 | int EASYLZMA_API elzma_compress_config(elzma_compress_handle hand, 56 | unsigned char lc, 57 | unsigned char lp, 58 | unsigned char pb, 59 | unsigned char level, 60 | unsigned int dictionarySize, 61 | elzma_file_format format, 62 | unsigned long long uncompressedSize); 63 | 64 | /** 65 | * Run compression 66 | */ 67 | int EASYLZMA_API elzma_compress_run( 68 | elzma_compress_handle hand, 69 | elzma_read_callback inputStream, void * inputContext, 70 | elzma_write_callback outputStream, void * outputContext, 71 | elzma_progress_callback progressCallback, void * progressContext); 72 | 73 | 74 | /** 75 | * a heuristic utility routine to guess a dictionary size that gets near 76 | * optimal compression while reducing memory usage. 77 | * accepts a size in bytes, returns a proposed dictionary size 78 | */ 79 | unsigned int EASYLZMA_API elzma_get_dict_size(unsigned long long size); 80 | 81 | #ifdef __cplusplus 82 | }; 83 | #endif 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /src/blosc2/plugins/codecs/zfp/src/template/revencodef.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* private functions ------------------------------------------------------- */ 4 | 5 | /* test if block-floating-point encoding is reversible */ 6 | static int 7 | _t1(rev_fwd_reversible, Scalar)(const Int* iblock, const Scalar* fblock, uint n, int emax) 8 | { 9 | /* reconstruct block */ 10 | cache_align_(Scalar gblock[BLOCK_SIZE]); 11 | _t1(rev_inv_cast, Scalar)(iblock, gblock, n, emax); 12 | /* perform bit-wise comparison */ 13 | return !memcmp(fblock, gblock, n * sizeof(*fblock)); 14 | } 15 | 16 | /* forward block-floating-point transform to signed integers */ 17 | static void 18 | _t1(rev_fwd_cast, Scalar)(Int* iblock, const Scalar* fblock, uint n, int emax) 19 | { 20 | /* test for all-zero block, which needs special treatment */ 21 | if (emax != -EBIAS) 22 | _t1(fwd_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax); 23 | else 24 | while (n--) 25 | *iblock++ = 0; 26 | } 27 | 28 | /* reinterpret floating values as two's complement integers */ 29 | static void 30 | _t1(rev_fwd_reinterpret, Scalar)(Int* iblock, const Scalar* fblock, uint n) 31 | { 32 | /* reinterpret floating values as sign-magnitude integers */ 33 | memcpy(iblock, fblock, n * sizeof(*iblock)); 34 | /* convert sign-magnitude integers to two's complement integers */ 35 | while (n--) { 36 | Int x = *iblock; 37 | if (x < 0) 38 | *iblock = (Int)((UInt)x ^ TCMASK); 39 | iblock++; 40 | } 41 | } 42 | 43 | /* encode contiguous floating-point block using reversible algorithm */ 44 | static uint 45 | _t2(rev_encode_block, Scalar, DIMS)(zfp_stream* zfp, const Scalar* fblock) 46 | { 47 | uint bits = 0; 48 | cache_align_(Int iblock[BLOCK_SIZE]); 49 | /* compute maximum exponent */ 50 | int emax = _t1(exponent_block, Scalar)(fblock, BLOCK_SIZE); 51 | /* perform forward block-floating-point transform */ 52 | _t1(rev_fwd_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax); 53 | /* test if block-floating-point transform is reversible */ 54 | if (_t1(rev_fwd_reversible, Scalar)(iblock, fblock, BLOCK_SIZE, emax)) { 55 | /* transform is reversible; test if block has any non-zeros */ 56 | uint e = emax + EBIAS; 57 | if (e) { 58 | /* encode common exponent */ 59 | bits += 2; 60 | stream_write_bits(zfp->stream, 1, 2); 61 | bits += EBITS; 62 | stream_write_bits(zfp->stream, e, EBITS); 63 | } 64 | else { 65 | /* emit single bit for all-zero block */ 66 | bits++; 67 | stream_write_bit(zfp->stream, 0); 68 | return bits; 69 | } 70 | } 71 | else { 72 | /* transform is irreversible; reinterpret floating values as integers */ 73 | _t1(rev_fwd_reinterpret, Scalar)(iblock, fblock, BLOCK_SIZE); 74 | bits += 2; 75 | stream_write_bits(zfp->stream, 3, 2); 76 | } 77 | /* losslessly encode integers */ 78 | bits += _t2(rev_encode_block, Int, DIMS)(zfp->stream, zfp->minbits - bits, zfp->maxbits - bits, zfp->maxprec, iblock); 79 | return bits; 80 | } 81 | -------------------------------------------------------------------------------- /src/easylzma/lzip_header.c: -------------------------------------------------------------------------------- 1 | #include "lzip_header.h" 2 | 3 | #include 4 | 5 | #define ELZMA_LZIP_HEADER_SIZE 6 6 | #define ELZMA_LZIP_FOOTER_SIZE 12 7 | 8 | static 9 | void initLzipHeader(struct elzma_file_header * hdr) 10 | { 11 | memset((void *) hdr, 0, sizeof(struct elzma_file_header)); 12 | } 13 | 14 | static 15 | int parseLzipHeader(const unsigned char * hdrBuf, 16 | struct elzma_file_header * hdr) 17 | { 18 | if (0 != strncmp("LZIP", (char *) hdrBuf, 4)) return 1; 19 | /* XXX: ignore version for now */ 20 | hdr->pb = 2; 21 | hdr->lp = 0; 22 | hdr->lc = 3; 23 | /* unknown at this point */ 24 | hdr->isStreamed = 1; 25 | hdr->uncompressedSize = 0; 26 | hdr->dictSize = 1 << (hdrBuf[5] & 0x1F); 27 | return 0; 28 | } 29 | 30 | static int 31 | serializeLzipHeader(unsigned char * hdrBuf, 32 | const struct elzma_file_header * hdr) 33 | { 34 | hdrBuf[0] = 'L'; 35 | hdrBuf[1] = 'Z'; 36 | hdrBuf[2] = 'I'; 37 | hdrBuf[3] = 'P'; 38 | hdrBuf[4] = 0; 39 | { 40 | int r = 0; 41 | while ((hdr->dictSize >> r) != 0) r++; 42 | hdrBuf[5] = (unsigned char) (r-1) & 0x1F; 43 | } 44 | return 0; 45 | } 46 | 47 | static int 48 | serializeLzipFooter(struct elzma_file_footer * ftr, 49 | unsigned char * ftrBuf) 50 | { 51 | unsigned int i = 0; 52 | 53 | /* first crc32 */ 54 | for (i = 0; i < 4; i++) { 55 | *(ftrBuf++) = (unsigned char) (ftr->crc32 >> (i * 8)); 56 | } 57 | 58 | /* next data size */ 59 | for (i = 0; i < 8; i++) { 60 | *(ftrBuf++) = (unsigned char) (ftr->uncompressedSize >> (i * 8)); 61 | } 62 | 63 | /* write version 0 files, omit member length for now*/ 64 | 65 | return 0; 66 | } 67 | 68 | static int 69 | parseLzipFooter(const unsigned char * ftrBuf, 70 | struct elzma_file_footer * ftr) 71 | { 72 | unsigned int i = 0; 73 | ftr->crc32 = 0; 74 | ftr->uncompressedSize = 0; 75 | 76 | /* first crc32 */ 77 | for (i = 0; i < 4; i++) 78 | { 79 | ftr->crc32 += ((unsigned int) *(ftrBuf++) << (i * 8)); 80 | } 81 | 82 | /* next data size */ 83 | for (i = 0; i < 8; i++) { 84 | ftr->uncompressedSize += 85 | (unsigned long long) *(ftrBuf++) << (i * 8); 86 | } 87 | /* read version 0 files, omit member length for now*/ 88 | 89 | return 0; 90 | } 91 | 92 | void 93 | initializeLZIPFormatHandler(struct elzma_format_handler * hand) 94 | { 95 | hand->header_size = ELZMA_LZIP_HEADER_SIZE; 96 | hand->init_header = initLzipHeader; 97 | hand->parse_header = parseLzipHeader; 98 | hand->serialize_header = serializeLzipHeader; 99 | hand->footer_size = ELZMA_LZIP_FOOTER_SIZE; 100 | hand->serialize_footer = serializeLzipFooter; 101 | hand->parse_footer = parseLzipFooter; 102 | } 103 | 104 | -------------------------------------------------------------------------------- /src/blosc2/internal-complibs/zstd/decompress/zstd_decompress_block.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under both the BSD-style license (found in the 6 | * LICENSE file in the root directory of this source tree) and the GPLv2 (found 7 | * in the COPYING file in the root directory of this source tree). 8 | * You may select, at your option, one of the above-listed licenses. 9 | */ 10 | 11 | 12 | #ifndef ZSTD_DEC_BLOCK_H 13 | #define ZSTD_DEC_BLOCK_H 14 | 15 | /*-******************************************************* 16 | * Dependencies 17 | *********************************************************/ 18 | #include "../common/zstd_deps.h" /* size_t */ 19 | #include "../zstd.h" /* DCtx, and some public functions */ 20 | #include "../common/zstd_internal.h" /* blockProperties_t, and some public functions */ 21 | #include "zstd_decompress_internal.h" /* ZSTD_seqSymbol */ 22 | 23 | 24 | /* === Prototypes === */ 25 | 26 | /* note: prototypes already published within `zstd.h` : 27 | * ZSTD_decompressBlock() 28 | */ 29 | 30 | /* note: prototypes already published within `zstd_internal.h` : 31 | * ZSTD_getcBlockSize() 32 | * ZSTD_decodeSeqHeaders() 33 | */ 34 | 35 | 36 | /* Streaming state is used to inform allocation of the literal buffer */ 37 | typedef enum { 38 | not_streaming = 0, 39 | is_streaming = 1 40 | } streaming_operation; 41 | 42 | /* ZSTD_decompressBlock_internal() : 43 | * decompress block, starting at `src`, 44 | * into destination buffer `dst`. 45 | * @return : decompressed block size, 46 | * or an error code (which can be tested using ZSTD_isError()) 47 | */ 48 | size_t ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx, 49 | void* dst, size_t dstCapacity, 50 | const void* src, size_t srcSize, const int frame, const streaming_operation streaming); 51 | 52 | /* ZSTD_buildFSETable() : 53 | * generate FSE decoding table for one symbol (ll, ml or off) 54 | * this function must be called with valid parameters only 55 | * (dt is large enough, normalizedCounter distribution total is a power of 2, max is within range, etc.) 56 | * in which case it cannot fail. 57 | * The workspace must be 4-byte aligned and at least ZSTD_BUILD_FSE_TABLE_WKSP_SIZE bytes, which is 58 | * defined in zstd_decompress_internal.h. 59 | * Internal use only. 60 | */ 61 | void ZSTD_buildFSETable(ZSTD_seqSymbol* dt, 62 | const short* normalizedCounter, unsigned maxSymbolValue, 63 | const U32* baseValue, const U8* nbAdditionalBits, 64 | unsigned tableLog, void* wksp, size_t wkspSize, 65 | int bmi2); 66 | 67 | /* Internal definition of ZSTD_decompressBlock() to avoid deprecation warnings. */ 68 | size_t ZSTD_decompressBlock_deprecated(ZSTD_DCtx* dctx, 69 | void* dst, size_t dstCapacity, 70 | const void* src, size_t srcSize); 71 | 72 | 73 | #endif /* ZSTD_DEC_BLOCK_H */ 74 | --------------------------------------------------------------------------------