├── .editorconfig ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ └── bug_report.md ├── dependabot.yml └── workflows │ ├── cmake.yml │ └── fuzz.yml ├── .gitignore ├── .guix-channel ├── .guix └── modules │ └── c-blosc2-package.scm ├── .mailmap ├── .readthedocs.yaml ├── ANNOUNCE.md ├── Blosc2Config.cmake.in ├── CMakeLists.txt ├── COMPILING_WITH_WHEELS.rst ├── CONTRIBUTING.rst ├── DEVELOPING-GUIDE.rst ├── FAQ.md ├── FUNDING.yml ├── LICENSE.txt ├── LICENSES ├── BITSHUFFLE.txt ├── FASTLZ.txt ├── LZ4.txt ├── ZLIB.txt └── ZSTD.txt ├── README.rst ├── README_ARM.rst ├── README_B2ND_FORMAT.rst ├── README_B2ND_METALAYER.rst ├── README_CFRAME_FORMAT.rst ├── README_CHUNK_FORMAT.rst ├── README_EXTENSION_FILENAMES.rst ├── README_FORMAT.rst ├── README_FUZZER.md ├── README_SFRAME_FORMAT.rst ├── README_THREADED.rst ├── RELEASE_NOTES.md ├── RELEASING.rst ├── ROADMAP.rst ├── THANKS.rst ├── TODO-refactorization.txt ├── bench ├── CMakeLists.txt ├── Makefile ├── Makefile.mingw ├── aggregate_multiple.py ├── b2bench.c ├── b2nd │ ├── CMakeLists.txt │ ├── bench_concatenate.c │ ├── bench_get_slice.c │ ├── bench_stack_append.c │ └── bench_zfp_getitem.c ├── create_frame.c ├── delta_schunk.c ├── plot-speeds.py ├── plot-sum_openmp-results.py ├── rainfall-grid-150x150.bin ├── read-grid-150x150.py ├── results-corex │ ├── blosclz-cl1-sum_openmp-corex.out │ ├── blosclz-suite-corex.out │ ├── lz4-cl1-sum_openmp-corex.out │ ├── lz4-suite-corex.out │ ├── lz4hc-cl1-sum_openmp-corex.out │ ├── zlib-cl1-sum_openmp-corex.out │ └── zstd-cl1-sum_openmp-corex.out ├── sframe_bench.c ├── sum_openmp.c ├── trunc_prec_schunk.c └── zero_runlen.c ├── blosc ├── CMakeLists.txt ├── b2nd-private.h ├── b2nd.c ├── b2nd_utils.c ├── bitshuffle-altivec.c ├── bitshuffle-altivec.h ├── bitshuffle-avx2.c ├── bitshuffle-avx2.h ├── bitshuffle-avx512.c ├── bitshuffle-avx512.h ├── bitshuffle-generic.c ├── bitshuffle-generic.h ├── bitshuffle-neon.c ├── bitshuffle-neon.h ├── bitshuffle-sse2.c ├── bitshuffle-sse2.h ├── blosc-private.h ├── blosc2-stdio.c ├── blosc2.c ├── blosclz.c ├── blosclz.h ├── config.h.in ├── context.h ├── delta.c ├── delta.h ├── directories.c ├── fastcopy.c ├── fastcopy.h ├── frame.c ├── frame.h ├── schunk-private.h ├── schunk.c ├── sframe.c ├── sframe.h ├── shuffle-altivec.c ├── shuffle-altivec.h ├── shuffle-avx2.c ├── shuffle-avx2.h ├── shuffle-generic.c ├── shuffle-generic.h ├── shuffle-neon.c ├── shuffle-neon.h ├── shuffle-sse2.c ├── shuffle-sse2.h ├── shuffle.c ├── shuffle.h ├── stune.c ├── stune.h ├── timestamp.c ├── transpose-altivec.h ├── trunc-prec.c ├── trunc-prec.h └── win32 │ ├── pthread.c │ └── pthread.h ├── blosc2-cframe.png ├── blosc2.pc.in ├── cmake ├── FindIPP.cmake ├── FindLZ4.cmake ├── FindSIMD.cmake ├── FindZLIB_NG.cmake ├── FindZSTD.cmake ├── toolchain-aarch64.cmake ├── toolchain-armhf.cmake └── toolchain-armsf.cmake ├── cmake_uninstall.cmake.in ├── code_of_conduct.md ├── compat ├── CMakeLists.txt ├── README.rst ├── blosc-1.11.1-blosclz.cdata ├── blosc-1.11.1-lz4.cdata ├── blosc-1.11.1-lz4hc.cdata ├── blosc-1.11.1-zlib.cdata ├── blosc-1.11.1-zstd.cdata ├── blosc-1.14.0-blosclz.cdata ├── blosc-1.14.0-lz4.cdata ├── blosc-1.14.0-lz4hc.cdata ├── blosc-1.14.0-zlib.cdata ├── blosc-1.14.0-zstd.cdata ├── blosc-1.17.1-lz4-bitshuffle4-memcpy.cdata ├── blosc-1.17.1-lz4-bitshuffle8-nomemcpy.cdata ├── blosc-1.18.0-lz4-bitshuffle4-memcpy.cdata ├── blosc-1.18.0-lz4-bitshuffle8-nomemcpy.cdata ├── blosc-1.3.0-blosclz.cdata ├── blosc-1.3.0-lz4.cdata ├── blosc-1.3.0-lz4hc.cdata ├── blosc-1.3.0-zlib.cdata ├── blosc-1.7.0-blosclz.cdata ├── blosc-1.7.0-lz4.cdata ├── blosc-1.7.0-lz4hc.cdata ├── blosc-1.7.0-zlib.cdata ├── blosc-2.0.0-lz4-bitshuffle4-memcpy.cdata ├── blosc-2.0.0-lz4-bitshuffle8-nomemcpy.cdata └── filegen.c ├── doc ├── Doxyfile ├── _static │ ├── blosc-logo_256.png │ └── css │ │ └── custom.css ├── c-blosc2.rst ├── conf.py ├── development │ ├── contributing.rst │ ├── index.rst │ ├── releasing.rst │ └── roadmap.rst ├── environment.yml ├── format │ ├── b2nd_format.rst │ ├── b2nd_metalayer.rst │ ├── cframe_format.rst │ ├── chunk_format.rst │ ├── extension_filenames.rst │ ├── index.rst │ └── sframe_format.rst ├── index.rst ├── reference │ ├── b2nd.rst │ ├── blosc1.rst │ ├── context.rst │ ├── index.rst │ ├── metalayers.rst │ ├── plugins.rst │ ├── schunk.rst │ ├── utility_functions.rst │ └── utility_variables.rst └── requirements.txt ├── examples ├── CMakeLists.txt ├── README.rst ├── b2nd │ ├── CMakeLists.txt │ ├── example_empty_shape.c │ ├── example_frame_generator.c │ ├── example_oindex.c │ ├── example_plainbuffer.c │ ├── example_plugins_codecs.c │ ├── example_plugins_filters.c │ ├── example_print_meta.c │ ├── example_serialize.c │ └── example_stack_images.c ├── compress_file.c ├── contexts.c ├── decompress_file.c ├── delta_schunk_ex.c ├── find_roots.c ├── frame_backed_schunk.c ├── frame_big.c ├── frame_metalayers.c ├── frame_offset.c ├── frame_roundtrip.c ├── frame_simple.c ├── frame_vlmetalayers.c ├── get_blocksize.c ├── get_set_slice.c ├── instrument_codec.c ├── many_compressors.c ├── multithread.c ├── noinit.c ├── schunk_postfilter.c ├── schunk_simple.c ├── sframe_simple.c ├── simple.c ├── urcodecs.c ├── urfilters.c ├── win-dynamic-linking.c └── zstd_dict.c ├── guix.scm ├── images ├── Complete-Write-Read-B2ND.png ├── Read-Partial-Slices-B2ND.png ├── b2nd-2level-parts.png ├── blosc2-pipeline.png └── blosc2-pipeline.svg ├── include ├── b2nd.h ├── blosc2.h └── blosc2 │ ├── blosc2-common.h │ ├── blosc2-export.h │ ├── blosc2-stdio.h │ ├── codecs-registry.h │ ├── filters-registry.h │ └── tuners-registry.h ├── internal-complibs ├── lz4-1.10.0 │ ├── lz4.c │ ├── lz4.h │ ├── lz4hc.c │ └── lz4hc.h ├── zlib-ng-2.0.7 │ ├── .shellcheckrc │ ├── CMakeLists.txt │ ├── FAQ.zlib │ ├── INDEX.md │ ├── LICENSE.md │ ├── Makefile.in │ ├── PORTING.md │ ├── README.md │ ├── adler32.c │ ├── adler32_p.h │ ├── arch │ │ ├── .gitignore │ │ ├── arm │ │ │ ├── Makefile.in │ │ │ ├── adler32_neon.c │ │ │ ├── arm.h │ │ │ ├── armfeature.c │ │ │ ├── chunkset_neon.c │ │ │ ├── crc32_acle.c │ │ │ ├── ctzl.h │ │ │ ├── insert_string_acle.c │ │ │ └── slide_neon.c │ │ ├── generic │ │ │ └── Makefile.in │ │ ├── power │ │ │ ├── Makefile.in │ │ │ ├── adler32_power8.c │ │ │ ├── power.c │ │ │ ├── power.h │ │ │ └── slide_hash_power8.c │ │ ├── s390 │ │ │ ├── Makefile.in │ │ │ ├── README.md │ │ │ ├── dfltcc_common.c │ │ │ ├── dfltcc_common.h │ │ │ ├── dfltcc_deflate.c │ │ │ ├── dfltcc_deflate.h │ │ │ ├── dfltcc_detail.h │ │ │ ├── dfltcc_inflate.c │ │ │ ├── dfltcc_inflate.h │ │ │ └── self-hosted-builder │ │ │ │ ├── actions-runner.Dockerfile │ │ │ │ ├── actions-runner.service │ │ │ │ ├── fs │ │ │ │ └── usr │ │ │ │ │ └── bin │ │ │ │ │ ├── actions-runner │ │ │ │ │ └── entrypoint │ │ │ │ └── qemu-user-static.service │ │ └── x86 │ │ │ ├── INDEX.md │ │ │ ├── Makefile.in │ │ │ ├── adler32_avx.c │ │ │ ├── adler32_ssse3.c │ │ │ ├── chunkset_avx.c │ │ │ ├── chunkset_sse.c │ │ │ ├── compare258_avx.c │ │ │ ├── compare258_sse.c │ │ │ ├── crc_folding.c │ │ │ ├── crc_folding.h │ │ │ ├── insert_string_sse.c │ │ │ ├── slide_avx.c │ │ │ ├── slide_sse.c │ │ │ ├── x86.c │ │ │ └── x86.h │ ├── chunkset.c │ ├── chunkset_tpl.h │ ├── cmake │ │ ├── detect-arch.c │ │ ├── detect-arch.cmake │ │ ├── detect-coverage.cmake │ │ ├── detect-install-dirs.cmake │ │ ├── detect-sanitizer.cmake │ │ ├── run-and-compare.cmake │ │ ├── run-and-redirect.cmake │ │ ├── test-compress.cmake │ │ ├── test-tools.cmake │ │ ├── toolchain-aarch64.cmake │ │ ├── toolchain-arm.cmake │ │ ├── toolchain-armhf.cmake │ │ ├── toolchain-mingw-i686.cmake │ │ ├── toolchain-mingw-x86_64.cmake │ │ ├── toolchain-powerpc.cmake │ │ ├── toolchain-powerpc64.cmake │ │ ├── toolchain-powerpc64le.cmake │ │ ├── toolchain-s390x.cmake │ │ └── toolchain-sparc64.cmake │ ├── compare258.c │ ├── compress.c │ ├── configure │ ├── crc32.c │ ├── crc32_comb.c │ ├── crc32_comb_tbl._h │ ├── crc32_comb_tbl.h │ ├── crc32_p.h │ ├── crc32_tbl._h │ ├── crc32_tbl.h │ ├── deflate.c │ ├── deflate.h │ ├── deflate_fast.c │ ├── deflate_medium.c │ ├── deflate_p.h │ ├── deflate_quick.c │ ├── deflate_slow.c │ ├── doc │ │ ├── algorithm.txt │ │ ├── rfc1950.txt │ │ ├── rfc1951.txt │ │ ├── rfc1952.txt │ │ └── txtvsbin.txt │ ├── fallback_builtins.h │ ├── functable.c │ ├── functable.h │ ├── gzguts.h │ ├── gzlib.c │ ├── gzread.c │ ├── gzwrite.c │ ├── infback.c │ ├── inffast.c │ ├── inffast.h │ ├── inffixed_tbl._h │ ├── inffixed_tbl.h │ ├── inflate.c │ ├── inflate.h │ ├── inflate_p.h │ ├── inftrees.c │ ├── inftrees.h │ ├── insert_string.c │ ├── insert_string_tpl.h │ ├── match_tpl.h │ ├── test │ │ ├── .gitignore │ │ ├── CVE-2002-0059 │ │ │ └── test.gz │ │ ├── CVE-2003-0107.c │ │ ├── CVE-2004-0797 │ │ │ └── test.gz │ │ ├── CVE-2005-1849 │ │ │ └── test.gz │ │ ├── CVE-2005-2096 │ │ │ └── test.gz │ │ ├── CVE-2018-25032 │ │ │ ├── default.txt │ │ │ └── fixed.txt │ │ ├── GH-361 │ │ │ └── test.txt │ │ ├── GH-364 │ │ │ └── test.bin │ │ ├── GH-382 │ │ │ └── defneg3.dat │ │ ├── GH-751 │ │ │ └── test.txt │ │ ├── GH-979 │ │ │ └── pigz-2.6.tar.gz │ │ ├── Makefile.in │ │ ├── README.md │ │ ├── abi │ │ │ ├── ignore │ │ │ ├── zlib-v1.2.11-arm-linux-gnueabihf.abi │ │ │ └── zlib-v1.2.11-x86_64-linux-gnu.abi │ │ ├── abicheck.md │ │ ├── abicheck.sh │ │ ├── adler32_test.c │ │ ├── crc32_test.c │ │ ├── data │ │ │ ├── fireworks.jpg │ │ │ ├── lcet10.txt │ │ │ └── paper-100k.pdf │ │ ├── deflate_quick_bi_valid.c │ │ ├── deflate_quick_block_open.c │ │ ├── example.c │ │ ├── fuzz │ │ │ ├── checksum_fuzzer.c │ │ │ ├── compress_fuzzer.c │ │ │ ├── example_dict_fuzzer.c │ │ │ ├── example_flush_fuzzer.c │ │ │ ├── example_large_fuzzer.c │ │ │ ├── example_small_fuzzer.c │ │ │ ├── minigzip_fuzzer.c │ │ │ └── standalone_fuzz_target_runner.c │ │ ├── gh1235.c │ │ ├── hash_head_0.c │ │ ├── infcover.c │ │ ├── inflate_adler32.c │ │ ├── minideflate.c │ │ ├── minigzip.c │ │ ├── pigz │ │ │ └── CMakeLists.txt │ │ ├── pkgcheck.sh │ │ ├── switchlevels.c │ │ └── testCVEinputs.sh │ ├── tools │ │ ├── codecov-upload.sh │ │ ├── config.sub │ │ ├── makecrct.c │ │ ├── makefixed.c │ │ └── maketrees.c │ ├── trees.c │ ├── trees.h │ ├── trees_emit.h │ ├── trees_tbl._h │ ├── trees_tbl.h │ ├── uncompr.c │ ├── win32 │ │ ├── DLL_FAQ.txt │ │ ├── Makefile.a64 │ │ ├── Makefile.arm │ │ ├── Makefile.msc │ │ ├── README-WIN32.txt │ │ ├── zlib-ng.def │ │ ├── zlib-ng1.rc │ │ ├── zlib.def │ │ ├── zlib1.rc │ │ └── zlibcompat.def │ ├── zbuild.h │ ├── zconf-ng.h.in │ ├── zconf.h │ ├── zconf.h.in │ ├── zconf.h.included │ ├── zendian.h │ ├── zlib-ng.h │ ├── zlib-ng.map │ ├── zlib.h │ ├── zlib.map │ ├── zlib.pc.cmakein │ ├── zlib.pc.in │ ├── zutil.c │ ├── zutil.h │ └── zutil_p.h └── zstd-1.5.7 │ ├── .gitignore │ ├── BUCK │ ├── Makefile │ ├── README.md │ ├── common │ ├── allocations.h │ ├── bits.h │ ├── bitstream.h │ ├── compiler.h │ ├── cpu.h │ ├── debug.c │ ├── debug.h │ ├── entropy_common.c │ ├── error_private.c │ ├── error_private.h │ ├── fse.h │ ├── fse_decompress.c │ ├── huf.h │ ├── mem.h │ ├── pool.c │ ├── pool.h │ ├── portability_macros.h │ ├── threading.c │ ├── threading.h │ ├── xxhash.c │ ├── xxhash.h │ ├── zstd_common.c │ ├── zstd_deps.h │ ├── zstd_internal.h │ └── zstd_trace.h │ ├── compress │ ├── clevels.h │ ├── fse_compress.c │ ├── hist.c │ ├── hist.h │ ├── huf_compress.c │ ├── zstd_compress.c │ ├── zstd_compress_internal.h │ ├── zstd_compress_literals.c │ ├── zstd_compress_literals.h │ ├── zstd_compress_sequences.c │ ├── zstd_compress_sequences.h │ ├── zstd_compress_superblock.c │ ├── zstd_compress_superblock.h │ ├── zstd_cwksp.h │ ├── zstd_double_fast.c │ ├── zstd_double_fast.h │ ├── zstd_fast.c │ ├── zstd_fast.h │ ├── zstd_lazy.c │ ├── zstd_lazy.h │ ├── zstd_ldm.c │ ├── zstd_ldm.h │ ├── zstd_ldm_geartab.h │ ├── zstd_opt.c │ ├── zstd_opt.h │ ├── zstd_preSplit.c │ ├── zstd_preSplit.h │ ├── zstdmt_compress.c │ └── zstdmt_compress.h │ ├── decompress │ ├── huf_decompress.c │ ├── huf_decompress_amd64.S │ ├── zstd_ddict.c │ ├── zstd_ddict.h │ ├── zstd_decompress.c │ ├── zstd_decompress_block.c │ ├── zstd_decompress_block.h │ └── zstd_decompress_internal.h │ ├── deprecated │ ├── zbuff.h │ ├── zbuff_common.c │ ├── zbuff_compress.c │ └── zbuff_decompress.c │ ├── dictBuilder │ ├── cover.c │ ├── cover.h │ ├── divsufsort.c │ ├── divsufsort.h │ ├── fastcover.c │ └── zdict.c │ ├── dll │ └── example │ │ ├── Makefile │ │ ├── README.md │ │ ├── fullbench-dll.sln │ │ └── fullbench-dll.vcxproj │ ├── legacy │ ├── zstd_legacy.h │ ├── zstd_v01.c │ ├── zstd_v01.h │ ├── zstd_v02.c │ ├── zstd_v02.h │ ├── zstd_v03.c │ ├── zstd_v03.h │ ├── zstd_v04.c │ ├── zstd_v04.h │ ├── zstd_v05.c │ ├── zstd_v05.h │ ├── zstd_v06.c │ ├── zstd_v06.h │ ├── zstd_v07.c │ └── zstd_v07.h │ ├── libzstd.mk │ ├── libzstd.pc.in │ ├── module.modulemap │ ├── zdict.h │ ├── zstd.h │ └── zstd_errors.h ├── plugins ├── CMakeLists.txt ├── README.md ├── codecs │ ├── CMakeLists.txt │ ├── codecs-registry.c │ ├── ndlz │ │ ├── CMakeLists.txt │ │ ├── README.md │ │ ├── ndlz-private.h │ │ ├── ndlz.c │ │ ├── ndlz.h │ │ ├── ndlz4x4.c │ │ ├── ndlz4x4.h │ │ ├── ndlz8x8.c │ │ ├── ndlz8x8.h │ │ ├── test_ndlz.c │ │ ├── xxhash.c │ │ └── xxhash.h │ └── zfp │ │ ├── CMakeLists.txt │ │ ├── README.md │ │ ├── blosc2-zfp.c │ │ ├── blosc2-zfp.h │ │ ├── include │ │ ├── bitstream.h │ │ ├── zfp.h │ │ └── zfp │ │ │ ├── macros.h │ │ │ ├── system.h │ │ │ ├── types.h │ │ │ └── version.h │ │ ├── src │ │ ├── bitstream.c │ │ ├── block1.h │ │ ├── block2.h │ │ ├── block3.h │ │ ├── block4.h │ │ ├── decode1d.c │ │ ├── decode1f.c │ │ ├── decode1i.c │ │ ├── decode1l.c │ │ ├── decode2d.c │ │ ├── decode2f.c │ │ ├── decode2i.c │ │ ├── decode2l.c │ │ ├── decode3d.c │ │ ├── decode3f.c │ │ ├── decode3i.c │ │ ├── decode3l.c │ │ ├── decode4d.c │ │ ├── decode4f.c │ │ ├── decode4i.c │ │ ├── decode4l.c │ │ ├── encode1d.c │ │ ├── encode1f.c │ │ ├── encode1i.c │ │ ├── encode1l.c │ │ ├── encode2d.c │ │ ├── encode2f.c │ │ ├── encode2i.c │ │ ├── encode2l.c │ │ ├── encode3d.c │ │ ├── encode3f.c │ │ ├── encode3i.c │ │ ├── encode3l.c │ │ ├── encode4d.c │ │ ├── encode4f.c │ │ ├── encode4i.c │ │ ├── encode4l.c │ │ ├── inline │ │ │ ├── bitstream.c │ │ │ └── inline.h │ │ ├── share │ │ │ ├── omp.c │ │ │ └── parallel.c │ │ ├── template │ │ │ ├── codec.c │ │ │ ├── codec.h │ │ │ ├── codec1.c │ │ │ ├── codec2.c │ │ │ ├── codec3.c │ │ │ ├── codec4.c │ │ │ ├── codecf.c │ │ │ ├── compress.c │ │ │ ├── decode.c │ │ │ ├── decode1.c │ │ │ ├── decode2.c │ │ │ ├── decode3.c │ │ │ ├── decode4.c │ │ │ ├── decodef.c │ │ │ ├── decodei.c │ │ │ ├── decompress.c │ │ │ ├── encode.c │ │ │ ├── encode1.c │ │ │ ├── encode2.c │ │ │ ├── encode3.c │ │ │ ├── encode4.c │ │ │ ├── encodef.c │ │ │ ├── encodei.c │ │ │ ├── ompcompress.c │ │ │ ├── revcodecf.c │ │ │ ├── revdecode.c │ │ │ ├── revdecode1.c │ │ │ ├── revdecode2.c │ │ │ ├── revdecode3.c │ │ │ ├── revdecode4.c │ │ │ ├── revdecodef.c │ │ │ ├── revencode.c │ │ │ ├── revencode1.c │ │ │ ├── revencode2.c │ │ │ ├── revencode3.c │ │ │ ├── revencode4.c │ │ │ ├── revencodef.c │ │ │ └── template.h │ │ ├── traitsd.h │ │ ├── traitsf.h │ │ ├── traitsi.h │ │ ├── traitsl.h │ │ └── zfp.c │ │ ├── test_zfp_acc_float.c │ │ ├── test_zfp_prec_float.c │ │ ├── test_zfp_rate_float.c │ │ ├── test_zfp_rate_getitem.c │ │ └── zfp-private.h ├── filters │ ├── CMakeLists.txt │ ├── bytedelta │ │ ├── CMakeLists.txt │ │ ├── bytedelta.c │ │ ├── bytedelta.h │ │ └── test_bytedelta.c │ ├── filters-registry.c │ ├── int_trunc │ │ ├── CMakeLists.txt │ │ ├── int_trunc.c │ │ ├── int_trunc.h │ │ └── test_int_trunc.c │ ├── ndcell │ │ ├── CMakeLists.txt │ │ ├── README.md │ │ ├── ndcell.c │ │ ├── ndcell.h │ │ └── test_ndcell.c │ └── ndmean │ │ ├── CMakeLists.txt │ │ ├── README.md │ │ ├── ndmean.c │ │ ├── ndmean.h │ │ ├── test_ndmean_mean.c │ │ └── test_ndmean_repart.c ├── test_data │ ├── README.md │ ├── example_day_month_temp.b2nd │ └── example_item_prices.b2nd └── tuners │ ├── CMakeLists.txt │ └── tuners-registry.c └── tests ├── .gitignore ├── CMakeLists.txt ├── Makefile ├── b2nd ├── CMakeLists.txt ├── cutest.h ├── test_b2nd_append.c ├── test_b2nd_concatenate.c ├── test_b2nd_copy.c ├── test_b2nd_copy_buffer.c ├── test_b2nd_delete.c ├── test_b2nd_full.c ├── test_b2nd_get_slice.c ├── test_b2nd_get_slice_buffer.c ├── test_b2nd_insert.c ├── test_b2nd_metalayers.c ├── test_b2nd_nans.c ├── test_b2nd_open_offset.c ├── test_b2nd_persistency.c ├── test_b2nd_resize.c ├── test_b2nd_roundtrip.c ├── test_b2nd_save.c ├── test_b2nd_serialize.c ├── test_b2nd_set_slice_buffer.c ├── test_b2nd_squeeze.c ├── test_b2nd_squeeze_index.c ├── test_b2nd_uninit.c ├── test_b2nd_zeros.c └── test_common.h ├── cutest.h ├── fuzz ├── CMakeLists.txt ├── README.md ├── corpus │ ├── README.md │ ├── frame_simple-blosclz.b2frame │ ├── frame_simple-lz4.b2frame │ ├── frame_simple-lz4hc.b2frame │ ├── frame_simple-zlib.b2frame │ └── frame_simple-zstd.b2frame ├── fuzz_compress_chunk.c ├── fuzz_compress_frame.c ├── fuzz_decompress_chunk.c ├── fuzz_decompress_frame.c ├── generate_inputs_corpus.c └── standalone.c ├── gcc-segfault-issue.c ├── print_versions.c ├── test_all.sh ├── test_api.c ├── test_bitshuffle_leftovers.c ├── test_blosc1_compat.c ├── test_change_nthreads_append.c ├── test_common.h ├── test_compress_roundtrip.c ├── test_compress_roundtrip.csv ├── test_compressor.c ├── test_contexts.c ├── test_copy.c ├── test_delete_chunk.c ├── test_delta.c ├── test_delta_schunk.c ├── test_dict_schunk.c ├── test_empty_buffer.c ├── test_fill_special.c ├── test_filters.c ├── test_frame.c ├── test_frame_get_offsets.c ├── test_frame_offset.c ├── test_get_slice_buffer.c ├── test_get_slice_nchunks.c ├── test_getitem.c ├── test_getitem.csv ├── test_getitem_delta.c ├── test_insert_chunk.c ├── test_lazychunk.c ├── test_lazychunk_memcpyed.c ├── test_maskout.c ├── test_maxout.c ├── test_mmap.c ├── test_noinit.c ├── test_nolock.c ├── test_nthreads.c ├── test_postfilter.c ├── test_prefilter.c ├── test_reorder_offsets.c ├── test_schunk.c ├── test_schunk_frame.c ├── test_schunk_header.c ├── test_set_slice_buffer.c ├── test_sframe.c ├── test_sframe_lazychunk.c ├── test_shuffle_roundtrip_altivec.c ├── test_shuffle_roundtrip_altivec.csv ├── test_shuffle_roundtrip_avx2.c ├── test_shuffle_roundtrip_avx2.csv ├── test_shuffle_roundtrip_generic.c ├── test_shuffle_roundtrip_generic.csv ├── test_shuffle_roundtrip_neon.c ├── test_shuffle_roundtrip_neon.csv ├── test_shuffle_roundtrip_sse2.c ├── test_shuffle_roundtrip_sse2.csv ├── test_small_chunks.c ├── test_udio.c ├── test_update_chunk.c ├── test_urcodecs.c ├── test_urfilters.c └── test_zero_runlen.c /.editorconfig: -------------------------------------------------------------------------------- 1 | ; Top-most EditorConfig file 2 | root = true 3 | 4 | ; Global settings 5 | [*] 6 | end_of_line = LF 7 | indent_style = space 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | ; C source files 12 | [*.{h,c}] 13 | indent_size = 2 14 | 15 | ; CMake 16 | [CMakeLists.txt] 17 | indent_size = 4 18 | 19 | [*.cmake] 20 | indent_size = 4 21 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: FrancescAlted 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Provide a minimal program reproducing the error. 15 | 16 | **Expected behavior** 17 | A clear and concise description of what you expected to happen. 18 | 19 | **Logs** 20 | If applicable, add logs to help explain your problem. 21 | 22 | **System information:** 23 | - OS: [e.g. OSX] 24 | - Compiler [e.g. gcc, clang] 25 | - Version [e.g. 2.0.1] 26 | 27 | **Additional context** 28 | Add any other context about the problem here. 29 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file 2 | version: 2 3 | updates: 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | interval: "weekly" 8 | -------------------------------------------------------------------------------- /.github/workflows/fuzz.yml: -------------------------------------------------------------------------------- 1 | name: CI Fuzz 2 | on: [push, pull_request] 3 | jobs: 4 | Fuzzing: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - name: Build Fuzzers 8 | uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master 9 | with: 10 | oss-fuzz-project-name: 'c-blosc2' 11 | dry-run: false 12 | 13 | - name: Run Fuzzers 14 | uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master 15 | with: 16 | oss-fuzz-project-name: 'c-blosc2' 17 | fuzz-seconds: 600 18 | dry-run: false 19 | 20 | - name: Upload Crash 21 | uses: actions/upload-artifact@v4 22 | if: failure() 23 | with: 24 | name: artifacts 25 | path: ./out/artifacts 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bench/bench 2 | build* 3 | .idea 4 | .*.swp 5 | cmake-build-* 6 | /blosc/config.h 7 | /doc/doxygen/xml/ 8 | /doc/xml 9 | .vs/ 10 | -------------------------------------------------------------------------------- /.guix-channel: -------------------------------------------------------------------------------- 1 | (channel 2 | (version 0) 3 | (directory ".guix/modules")) 4 | -------------------------------------------------------------------------------- /.mailmap: -------------------------------------------------------------------------------- 1 | Francesc Alted FrancescAlted 2 | Francesc Alted FrancescAlted 3 | Francesc Alted FrancescAlted 4 | Francesc Alted FrancescAlted 5 | -------------------------------------------------------------------------------- /.readthedocs.yaml: -------------------------------------------------------------------------------- 1 | # .readthedocs.yaml 2 | # Read the Docs configuration file 3 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details 4 | 5 | # Required 6 | version: 2 7 | 8 | # Set the version of Python and other tools you might need 9 | build: 10 | os: ubuntu-20.04 11 | tools: 12 | python: "mambaforge-4.10" 13 | 14 | conda: 15 | environment: doc/environment.yml 16 | 17 | # Build documentation in the docs/ directory with Sphinx 18 | sphinx: 19 | configuration: doc/conf.py 20 | 21 | # If using Sphinx, optionally build your docs in additional formats such as PDF 22 | # formats: 23 | # - pdf 24 | 25 | # Optionally declare the Python requirements required to build your docs 26 | python: 27 | install: 28 | - requirements: doc/requirements.txt 29 | -------------------------------------------------------------------------------- /CONTRIBUTING.rst: -------------------------------------------------------------------------------- 1 | Contributing guidelines 2 | ======================= 3 | 4 | We want to make contributing to this project as easy and transparent as 5 | possible. 6 | 7 | Our Development Process 8 | ----------------------- 9 | New versions are being developed in the "main" branch, 10 | or in their own feature branch. 11 | When they are deemed ready for a release, they are merged back into "main" 12 | again. 13 | 14 | So all contributions must stage first through "main" 15 | or their own feature branch. 16 | 17 | Pull Requests 18 | ------------- 19 | We actively welcome your pull requests. 20 | 21 | 1. Fork the repo and create your branch from `main`. 22 | 2. If you've added code that should be tested, add tests. 23 | 3. If you've changed APIs, update the documentation. 24 | 4. Ensure the test suite passes. 25 | 5. Make sure your code does not issue new compiler warnings. 26 | 27 | Issues 28 | ------ 29 | We use GitHub issues to track public bugs. Please ensure your description is 30 | clear and has sufficient instructions to be able to reproduce the issue. 31 | 32 | Coding Style 33 | ------------ 34 | * 2 spaces for indentation rather than tabs. 35 | 36 | License 37 | ------- 38 | By contributing to C-Blosc2, you agree that your contributions will be licensed 39 | under the `LICENSE `_ 40 | file of the project. 41 | -------------------------------------------------------------------------------- /DEVELOPING-GUIDE.rst: -------------------------------------------------------------------------------- 1 | Some conventions used in C-Blosc2 2 | ================================= 3 | 4 | * Use C99 designated initialization only in examples. Libraries should use C89 initialization, which is more portable, specially with C++ (designated initialization in C++ is supported only since C++20). 5 | 6 | * Use _new and _free for memory allocating constructors and destructors and _init and _destroy for non-memory allocating constructors and destructors. 7 | 8 | * Lines must not exceed 120 characters. If a line is too long, it must be broken into several lines. 9 | 10 | * Conditional bodies must always use braces, even if they are one-liners. The only exception that can be is when the conditional is a single line and the body is a single line: 11 | 12 | if (condition) whatever(); 13 | -------------------------------------------------------------------------------- /FAQ.md: -------------------------------------------------------------------------------- 1 | ## Which is the compatibility policy for the Blosc library and format? 2 | 3 | ### Compatibility among libraries with different minor versions 4 | 5 | The compatibility between minor versions (e.g. 2.0 <-> 2.1) will always be *both* backward and forward. This means that any version of the library will be able to read any data produced with another version differing only in the patch level or minor version. Not being able to achieve that will be considered a bug, and action will be taken to fix that as soon as possible (see e.g.https://github.com/Blosc/c-blosc/issues/215). 6 | 7 | ### Compatibility among libraries with different major versions 8 | 9 | There will be an *attempt* (but not an absolute guarantee) of backward compatibility, but it won’t be an effort for guaranteeing forward compatibility. For example, Blosc2 2.1 is be able to read any data produced by Blosc 1.x, but Blosc 1.x are not able to read data produced by Blosc2 2.x. 10 | -------------------------------------------------------------------------------- /FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [numfocus] 2 | custom: ['https://numfocus.org/donate-to-blosc'] 3 | -------------------------------------------------------------------------------- /LICENSES/BITSHUFFLE.txt: -------------------------------------------------------------------------------- 1 | Bitshuffle - Filter for improving compression of typed binary data. 2 | 3 | Copyright (c) 2014 Kiyoshi Masui (kiyo@physics.ubc.ca) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /LICENSES/FASTLZ.txt: -------------------------------------------------------------------------------- 1 | FastLZ - Byte-aligned LZ77 compression library 2 | Copyright (C) 2005-2020 Ariya Hidayat 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /LICENSES/LZ4.txt: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /LICENSES/ZLIB.txt: -------------------------------------------------------------------------------- 1 | (C) 1995-2013 Jean-loup Gailly and Mark Adler 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgment in the product documentation would be 14 | appreciated but is not required. 15 | 16 | 2. Altered source versions must be plainly marked as such, and must not be 17 | misrepresented as being the original software. 18 | 19 | 3. This notice may not be removed or altered from any source distribution. 20 | -------------------------------------------------------------------------------- /LICENSES/ZSTD.txt: -------------------------------------------------------------------------------- 1 | BSD License 2 | 3 | For Zstandard software 4 | 5 | Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | 17 | * Neither the name Facebook nor the names of its contributors may be used to 18 | endorse or promote products derived from this software without specific 19 | prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 22 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 25 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 28 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /README_B2ND_FORMAT.rst: -------------------------------------------------------------------------------- 1 | B2ND Format 2 | =========== 3 | 4 | The B2ND format is meant for storing multidimensional datasets defined by a shape and a data type. 5 | Both the shape and the data type follow the NumPy conventions. 6 | 7 | It is just a `B2ND metalayer `_ 8 | on top of a Blosc2 `CFrame `_ 9 | (for contiguous storage) or `SFrame `_ 10 | (for sparse storage). 11 | -------------------------------------------------------------------------------- /README_EXTENSION_FILENAMES.rst: -------------------------------------------------------------------------------- 1 | Extensions for Blosc2 Filenames 2 | =============================== 3 | 4 | Blosc2 has some recommendations for different file extensions for different purposes. Here is a list of the currently supported ones: 5 | 6 | - `.b2frame` (but also `.b2f` or `.b2`) (Blosc2 Frame): this is the main extension for storing `Blosc2 Contiguous Frames `_. 7 | 8 | - `.b2nd` (Blosc2 N-Dim): this is just a contiguous frame file with `a metalayer for storing n-dimensional information `_ like shape, chunkshape, blockshape and dtype. 9 | -------------------------------------------------------------------------------- /README_FORMAT.rst: -------------------------------------------------------------------------------- 1 | Blosc2 Format 2 | ============= 3 | 4 | The Blosc2 format is a specification for storing compressed data in a way that is simple to read and parse, 5 | and that allows for fast random access to the compressed data. The format is designed to be used with 6 | the Blosc2 library, but it is not tied to it, and can be used independently. Emphasis has been put on 7 | simplicity and robustness, so that the format can be used in a wide range of applications. 8 | 9 | See a diagram of a Contiguous Frame (aka CFrame), the most important part of the Blosc2 format below: 10 | 11 | .. image:: blosc2-cframe.png 12 | :width: 25% 13 | :alt: Blosc2 CFrame format diagram 14 | 15 | And here, the list of the different parts of the format, from the highest level to the lowest: 16 | 17 | - `B2ND format `_ 18 | - `B2ND metalayer `_ 19 | - `SFrame format `_ 20 | - `CFrame format `_ 21 | - `Chunk format `_ 22 | 23 | Finally, the recommended extension file names for the different parts of the format: 24 | 25 | - `Blosc2 extension file names `_ 26 | -------------------------------------------------------------------------------- /README_FUZZER.md: -------------------------------------------------------------------------------- 1 | How to look into fuzzer issues 2 | ============================== 3 | 4 | * Look into the output of the test case in the logs in CI (look for something like `Test unit written to ./crash-85283a6341337b0ede4bf3b9b2657dcce83ee0b4\nBase64: AiACDQEAAAAPAAAAFAAAABMAbZ0=\n".`). Use the blosc.oss.fuzz@gmail.com account so as to access it. 5 | 6 | * This output always gives the base64 of the data that reproduced it (e.g. AiACDQEAAAAPAAAAFAAAABMAbZ0=). This can be converted to hex and saved to a file. 7 | 8 | * This file can be passed as an argument to the corresponding test of `tests/fuzz/` folder, so as to test it locally. 9 | -------------------------------------------------------------------------------- /TODO-refactorization.txt: -------------------------------------------------------------------------------- 1 | compcode -> codec 2 | 3 | look into the packed offsets and come with an standard -------------------------------------------------------------------------------- /bench/Makefile: -------------------------------------------------------------------------------- 1 | CC = gcc # or clang 2 | CFLAGS = -O3 -g -msse2 -Wall 3 | LDFLAGS = -lpthread # for UNIX or for Windows with pthread installed 4 | #LDFLAGS = -static # for mingw 5 | SOURCES = $(wildcard ../blosc/*.c) 6 | EXECUTABLE = bench 7 | 8 | # Support for internal LZ4 and LZ4HC 9 | LZ4_DIR = ../internal-complibs/lz4-1.7.0 10 | CFLAGS += -I$(LZ4_DIR) 11 | SOURCES += $(wildcard $(LZ4_DIR)/*.c) 12 | 13 | # Support for external LZ4 and LZ4HC 14 | #LDFLAGS += -llz4 15 | 16 | # Support for external Zlib 17 | LDFLAGS += -DHAVE_ZLIB -lz 18 | 19 | # Support for internal Zlib 20 | #ZLIB_DIR = ../internal-complibs/zlib-1.2.8 21 | #CFLAGS += -DHAVE_ZLIB -I$(ZLIB_DIR) 22 | #SOURCES += $(wildcard $(ZLIB_DIR)/*.c) 23 | 24 | SOURCES += bench.c 25 | 26 | all: $(SOURCES) $(EXECUTABLE) 27 | 28 | $(EXECUTABLE): $(SOURCES) 29 | $(CC) $(CFLAGS) $(SOURCES) -o $@ $(LDFLAGS) 30 | 31 | clean: 32 | rm -rf $(EXECUTABLE) 33 | -------------------------------------------------------------------------------- /bench/Makefile.mingw: -------------------------------------------------------------------------------- 1 | # Makefile for the MinGW suite for Windows 2 | CC = g++ # or clang 3 | CFLAGS = -O3 -g -msse2 -Wall 4 | #LDFLAGS = -lpthread # for UNIX or for Windows with pthread installed 5 | LDFLAGS = -static # for mingw 6 | SOURCES = $(wildcard ../blosc/*.c) 7 | EXECUTABLE = bench 8 | 9 | # Support for internal LZ4 10 | LZ4_DIR = ../internal-complibs/lz4-1.7.0 11 | CFLAGS += -I$(LZ4_DIR) 12 | SOURCES += $(wildcard $(LZ4_DIR)/*.c) 13 | 14 | # Support for external LZ4 15 | #LDFLAGS += -llz4 16 | 17 | # Support for the msvc zlib: 18 | ZLIB_ROOT=/libs/zlib128 19 | LDFLAGS=-DHAVE_ZLIB -I$(ZLIB_ROOT)/include -lzdll -L$(ZLIB_ROOT)/lib 20 | 21 | # Support for the mingw zlib: 22 | #ZLIB_ROOT=/libs/libz-1.2.8 23 | #LDFLAGS=-DHAVE_ZLIB -I$(ZLIB_ROOT)/include -lz -L$(ZLIB_ROOT)/lib 24 | 25 | # Support for internal Zlib 26 | #ZLIB_DIR = ../internal-complibs/zlib-1.2.8 27 | #CFLAGS += -DHAVE_ZLIB -I$(ZLIB_DIR) 28 | #SOURCES += $(wildcard $(ZLIB_DIR)/*.c) 29 | 30 | 31 | all: $(SOURCES) $(EXECUTABLE) 32 | 33 | $(EXECUTABLE): $(SOURCES) 34 | $(CC) $(CFLAGS) bench.c $(SOURCES) -o $@ $(LDFLAGS) 35 | 36 | clean: 37 | rm -rf $(EXECUTABLE) 38 | -------------------------------------------------------------------------------- /bench/b2nd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Blosc - Blocked Shuffling and Compression Library 2 | # 3 | # Copyright (c) 2021 Blosc Development Team 4 | # https://blosc.org 5 | # License: BSD 3-Clause (see LICENSE.txt) 6 | # 7 | # See LICENSE.txt for details about copyright and rights to use. 8 | 9 | file(GLOB SOURCES bench_*.c) 10 | 11 | foreach (source ${SOURCES}) 12 | get_filename_component(target_name ${source} NAME_WE) 13 | set(target b2nd_${target_name}) 14 | add_executable(${target} ${target_name}.c) 15 | target_link_libraries(${target} PUBLIC blosc_testing ${LIBS}) 16 | endforeach (source) 17 | -------------------------------------------------------------------------------- /bench/rainfall-grid-150x150.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/bench/rainfall-grid-150x150.bin -------------------------------------------------------------------------------- /bench/read-grid-150x150.py: -------------------------------------------------------------------------------- 1 | """ 2 | Copyright (c) 2021 Blosc Development Team 3 | https://blosc.org 4 | License: BSD 3-Clause (see LICENSE.txt) 5 | 6 | Script to extract a small grid of precipitation out of this file: 7 | 8 | ftp://ftp-cdc.dwd.de/pub/REA/COSMO_REA6/hourly/2D/TOT_PRECIP/TOT_PRECIP.2D.201512.grb.bz2 9 | 10 | After downloading it and uncompressing it, just run this script for extracting a small grid. 11 | 12 | For more info on these datasets, see https://reanalysis.meteo.uni-bonn.de. 13 | """ 14 | 15 | from osgeo import gdal 16 | import numpy as np 17 | import blosc 18 | 19 | # Read a 150x150 grid from the first band 20 | dataset = gdal.Open("TOT_PRECIP.2D.201512.grb", gdal.GA_ReadOnly) 21 | band = dataset.GetRasterBand(1) 22 | precip_data = band.ReadAsArray(0, 0, 150, 150).astype(np.float32) 23 | 24 | # Compress the chunk and write it to a file 25 | cdata = blosc.compress(precip_data, cname="blosclz", clevel=9, typesize=4) 26 | open("rainfall-band-150x150.bin", "wb").write(cdata) 27 | -------------------------------------------------------------------------------- /blosc/b2nd-private.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (c) 2021 Blosc Development Team 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_B2ND_PRIVATE_H 13 | #define BLOSC_B2ND_PRIVATE_H 14 | 15 | #include "b2nd.h" 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | /********************************************************************* 22 | 23 | Functions meant to be used internally. 24 | 25 | *********************************************************************/ 26 | 27 | /** 28 | * @brief Get the chunk indexes needed to get the slice. 29 | * 30 | * @param array The b2nd array. 31 | * @param start The coordinates where the slice will begin. 32 | * @param stop The coordinates where the slice will end. 33 | * @param chunks_idx The pointer to the buffer where the indexes of the chunks will be written. 34 | * 35 | * @return The number of chunks needed to get the slice. If some problem is 36 | * detected, a negative code is returned instead. 37 | */ 38 | int b2nd_get_slice_nchunks(b2nd_array_t *array, const int64_t *start, const int64_t *stop, int64_t **chunks_idx); 39 | 40 | #endif /* BLOSC_B2ND_PRIVATE_H */ 41 | -------------------------------------------------------------------------------- /blosc/bitshuffle-avx512.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (c) 2021 Blosc Development Team 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 | /* AVX512-accelerated shuffle/unshuffle routines. */ 12 | 13 | #ifndef BLOSC_BITSHUFFLE_AVX512_H 14 | #define BLOSC_BITSHUFFLE_AVX512_H 15 | 16 | #include "blosc2/blosc2-common.h" 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | /** 23 | * AVX512-accelerated bit(un)shuffle routines availability. 24 | */ 25 | extern const bool is_bshuf_AVX512; 26 | 27 | BLOSC_NO_EXPORT int64_t 28 | bshuf_trans_bit_elem_AVX512(const void* in, void* out, const size_t size, 29 | const size_t elem_size); 30 | 31 | BLOSC_NO_EXPORT int64_t 32 | bshuf_untrans_bit_elem_AVX512(const void* in, void* out, const size_t size, 33 | const size_t elem_size); 34 | 35 | #endif /* BLOSC_BITSHUFFLE_AVX512_H */ 36 | -------------------------------------------------------------------------------- /blosc/bitshuffle-neon.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (c) 2021 Blosc Development Team 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 | /* NEON-accelerated bitshuffle/bitunshuffle routines. */ 12 | 13 | #ifndef BLOSC_BITSHUFFLE_NEON_H 14 | #define BLOSC_BITSHUFFLE_NEON_H 15 | 16 | #include "blosc2/blosc2-common.h" 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | /** 23 | * NEON-accelerated bit(un)shuffle routines availability. 24 | */ 25 | extern const bool is_bshuf_NEON; 26 | 27 | /** 28 | NEON-accelerated bitshuffle routine. 29 | */ 30 | BLOSC_NO_EXPORT int64_t bshuf_trans_bit_elem_NEON(const void* in, void* out, const size_t size, 31 | const size_t elem_size); 32 | 33 | /** 34 | NEON-accelerated bitunshuffle routine. 35 | */ 36 | BLOSC_NO_EXPORT int64_t bshuf_untrans_bit_elem_NEON(const void* in, void* out, const size_t size, 37 | const size_t elem_size); 38 | 39 | #endif /* BLOSC_BITSHUFFLE_NEON_H */ 40 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /blosc/delta.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (c) 2021 Blosc Development Team 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 | 16 | void delta_encoder(const uint8_t* dref, int32_t offset, int32_t nbytes, 17 | int32_t typesize, const uint8_t* src, uint8_t* dest); 18 | 19 | void delta_decoder(const uint8_t* dref, int32_t offset, int32_t nbytes, 20 | int32_t typesize, uint8_t* dest); 21 | 22 | #endif /* BLOSC_DELTA_H */ 23 | -------------------------------------------------------------------------------- /blosc/fastcopy.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (c) 2021 Blosc Development Team 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 | -------------------------------------------------------------------------------- /blosc/schunk-private.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (c) 2021 Blosc Development Team 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_SCHUNK_PRIVATE_H 13 | #define BLOSC_SCHUNK_PRIVATE_H 14 | 15 | #include "b2nd.h" 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | /********************************************************************* 22 | 23 | Functions meant to be used internally. 24 | 25 | *********************************************************************/ 26 | 27 | /** 28 | * @brief Get the chunk indexes needed to get the slice. 29 | * 30 | * @param schunk The super-chunk. 31 | * @param start Index (0-based) where the slice begins. 32 | * @param stop The first index (0-based) that is not in the selected slice. 33 | * @param chunks_idx The pointer to the buffer where the indexes will be written. 34 | * 35 | * 36 | * @return The number of chunks needed to get the slice. If some problem is 37 | * detected, a negative code is returned instead. 38 | */ 39 | int schunk_get_slice_nchunks(blosc2_schunk *schunk, int64_t start, int64_t stop, int64_t **chunks_idx); 40 | #endif /* BLOSC_SCHUNK_PRIVATE_H */ 41 | -------------------------------------------------------------------------------- /blosc/sframe.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (c) 2021 Blosc Development Team 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 | #include "frame.h" 15 | 16 | #include 17 | #include 18 | 19 | void* sframe_open_index(const char* urlpath, const char* mode, const blosc2_io *io); 20 | void* sframe_open_chunk(const char* urlpath, int64_t nchunk, const char* mode, const blosc2_io *io); 21 | int sframe_delete_chunk(const char* urlpath, int64_t nchunk); 22 | void* sframe_create_chunk(blosc2_frame_s* frame, uint8_t* chunk, int64_t nchunk, int64_t cbytes); 23 | int32_t sframe_get_chunk(blosc2_frame_s* frame, int64_t nchunk, uint8_t** chunk, bool* needs_free); 24 | 25 | #endif /* BLOSC_SFRAME_H */ 26 | -------------------------------------------------------------------------------- /blosc/shuffle-altivec.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (c) 2021 Blosc Development Team 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 BLOSC_SHUFFLE_ALTIVEC_H 14 | #define BLOSC_SHUFFLE_ALTIVEC_H 15 | 16 | #include "blosc2/blosc2-common.h" 17 | 18 | #include 19 | #include 20 | 21 | /** 22 | * ALTIVEC-accelerated (un)shuffle routines availability. 23 | */ 24 | extern const bool is_shuffle_altivec; 25 | 26 | /** 27 | ALTIVEC-accelerated shuffle routine. 28 | */ 29 | BLOSC_NO_EXPORT void shuffle_altivec(const int32_t bytesoftype, const int32_t blocksize, 30 | const uint8_t *_src, uint8_t *_dest); 31 | 32 | /** 33 | ALTIVEC-accelerated unshuffle routine. 34 | */ 35 | BLOSC_NO_EXPORT void unshuffle_altivec(const int32_t bytesoftype, const int32_t blocksize, 36 | const uint8_t *_src, uint8_t *_dest); 37 | 38 | #endif /* BLOSC_SHUFFLE_ALTIVEC_H */ 39 | -------------------------------------------------------------------------------- /blosc/shuffle-avx2.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (c) 2021 Blosc Development Team 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 | #include 19 | #include 20 | 21 | /** 22 | * AVX2-accelerated (un)shuffle routines availability. 23 | */ 24 | extern const bool is_shuffle_avx2; 25 | 26 | /** 27 | AVX2-accelerated shuffle routine. 28 | */ 29 | BLOSC_NO_EXPORT void shuffle_avx2(const int32_t bytesoftype, const int32_t blocksize, 30 | const uint8_t *_src, uint8_t *_dest); 31 | 32 | /** 33 | AVX2-accelerated unshuffle routine. 34 | */ 35 | BLOSC_NO_EXPORT void unshuffle_avx2(const int32_t bytesoftype, const int32_t blocksize, 36 | const uint8_t *_src, uint8_t *_dest); 37 | 38 | #endif /* SHUFFLE_AVX2_H */ 39 | -------------------------------------------------------------------------------- /blosc/shuffle-generic.c: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (c) 2021 Blosc Development Team 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 | -------------------------------------------------------------------------------- /blosc/shuffle-neon.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (c) 2021 Blosc Development Team 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 BLOSC_SHUFFLE_NEON_H 16 | #define BLOSC_SHUFFLE_NEON_H 17 | 18 | #include "blosc2/blosc2-common.h" 19 | 20 | #include 21 | #include 22 | 23 | /** 24 | * NEON-accelerated (un)shuffle routines availability. 25 | */ 26 | extern const bool is_shuffle_neon; 27 | 28 | /** 29 | NEON-accelerated shuffle routine. 30 | */ 31 | BLOSC_NO_EXPORT void shuffle_neon(const int32_t bytesoftype, const int32_t blocksize, 32 | const uint8_t* const _src, uint8_t* const _dest); 33 | 34 | /** 35 | NEON-accelerated unshuffle routine. 36 | */ 37 | BLOSC_NO_EXPORT void unshuffle_neon(const int32_t bytesoftype, const int32_t blocksize, 38 | const uint8_t *_src, uint8_t *_dest); 39 | 40 | #endif /* BLOSC_SHUFFLE_NEON_H */ 41 | -------------------------------------------------------------------------------- /blosc/shuffle-sse2.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (c) 2021 Blosc Development Team 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 BLOSC_SHUFFLE_SSE2_H 14 | #define BLOSC_SHUFFLE_SSE2_H 15 | 16 | #include "blosc2/blosc2-common.h" 17 | 18 | #include 19 | #include 20 | 21 | /** 22 | * SSE2-accelerated (un)shuffle routines availability. 23 | */ 24 | extern const bool is_shuffle_sse2; 25 | 26 | /** 27 | SSE2-accelerated shuffle routine. 28 | */ 29 | BLOSC_NO_EXPORT void shuffle_sse2(const int32_t bytesoftype, const int32_t blocksize, 30 | const uint8_t *_src, uint8_t *_dest); 31 | 32 | /** 33 | SSE2-accelerated unshuffle routine. 34 | */ 35 | BLOSC_NO_EXPORT void unshuffle_sse2(const int32_t bytesoftype, const int32_t blocksize, 36 | const uint8_t *_src, uint8_t *_dest); 37 | 38 | #endif /* BLOSC_SHUFFLE_SSE2_H */ 39 | -------------------------------------------------------------------------------- /blosc/stune.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (c) 2021 Blosc Development Team 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_STUNE_H 12 | #define BLOSC_STUNE_H 13 | 14 | #include "context.h" 15 | 16 | #include 17 | 18 | /* The size of L1 cache. 32 KB is quite common nowadays. */ 19 | #define L1 (32 * 1024) 20 | /* The size of L2 cache. 256 KB is quite common nowadays. */ 21 | #define L2 (256 * 1024) 22 | 23 | /* The maximum number of compressed data streams in a block for compression */ 24 | #define MAX_STREAMS 16 /* Cannot be larger than 128 */ 25 | 26 | #define BLOSC_STUNE 0 27 | 28 | int blosc_stune_init(void * config, blosc2_context* cctx, blosc2_context* dctx); 29 | 30 | int blosc_stune_next_blocksize(blosc2_context * context); 31 | 32 | int blosc_stune_next_cparams(blosc2_context * context); 33 | 34 | int blosc_stune_update(blosc2_context * context, double ctime); 35 | 36 | int blosc_stune_free(blosc2_context * context); 37 | 38 | /* Conditions for splitting a block before compressing with a codec. */ 39 | int split_block(blosc2_context *context, int32_t typesize, int32_t blocksize); 40 | 41 | #endif /* BLOSC_STUNE_H */ 42 | -------------------------------------------------------------------------------- /blosc/trunc-prec.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (c) 2021 Blosc Development Team 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 | 16 | int truncate_precision(int8_t prec_bits, int32_t typesize, int32_t nbytes, 17 | const uint8_t* src, uint8_t* dest); 18 | 19 | #endif /* BLOSC_TRUNC_PREC_H */ 20 | -------------------------------------------------------------------------------- /blosc2-cframe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/blosc2-cframe.png -------------------------------------------------------------------------------- /blosc2.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ 4 | sharedlibdir=${libdir} 5 | includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ 6 | 7 | Name: blosc2 8 | Description: A blocking, shuffling and lossless compression library 9 | URL: https://blosc.org/ 10 | Version: @BLOSC2_VERSION_STRING@ 11 | 12 | Requires: 13 | Libs: -L${libdir} -L${sharedlibdir} -lblosc2 14 | Cflags: -I${includedir} 15 | -------------------------------------------------------------------------------- /cmake/FindLZ4.cmake: -------------------------------------------------------------------------------- 1 | find_path(LZ4_INCLUDE_DIR lz4.h) 2 | 3 | find_library(LZ4_LIBRARY NAMES lz4 liblz4) 4 | 5 | if(LZ4_INCLUDE_DIR AND LZ4_LIBRARY) 6 | set(LZ4_FOUND TRUE) 7 | message(STATUS "Found LZ4 library: ${LZ4_LIBRARY}") 8 | else() 9 | message(STATUS "No LZ4 library found. Using internal sources.") 10 | endif() 11 | -------------------------------------------------------------------------------- /cmake/FindZSTD.cmake: -------------------------------------------------------------------------------- 1 | find_path(ZSTD_INCLUDE_DIR zstd.h) 2 | 3 | find_library(ZSTD_LIBRARY NAMES zstd) 4 | 5 | if(ZSTD_INCLUDE_DIR AND ZSTD_LIBRARY) 6 | set(ZSTD_FOUND TRUE) 7 | message(STATUS "Found ZSTD library: ${ZSTD_LIBRARY}") 8 | endif() 9 | -------------------------------------------------------------------------------- /cmake/toolchain-aarch64.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR aarch64) 3 | set(CMAKE_SYSTEM_VERSION 1) 4 | 5 | message(STATUS "Using cross-compile toolchain: ${CROSS_COMPILE_TOOLCHAIN}") 6 | 7 | set(CMAKE_C_COMPILER_TARGET "aarch64-linux-gnu") 8 | set(CMAKE_CXX_COMPILER_TARGET "aarch64-linux-gnu") 9 | 10 | set(CMAKE_CROSSCOMPILING TRUE) 11 | set(CMAKE_CROSSCOMPILING_EMULATOR qemu-aarch64 -L /usr/${CMAKE_C_COMPILER_TARGET}/) 12 | 13 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 14 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 15 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 16 | 17 | find_program(C_COMPILER_FULL_PATH NAMES ${CMAKE_C_COMPILER_TARGET}-gcc) 18 | if(NOT C_COMPILER_FULL_PATH) 19 | message(FATAL_ERROR "Cross-compiler for ${CMAKE_C_COMPILER_TARGET} not found") 20 | endif() 21 | set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) 22 | 23 | find_program(CXX_COMPILER_FULL_PATH NAMES g++-${CMAKE_CXX_COMPILER_TARGET} ${CMAKE_CXX_COMPILER_TARGET}-g++) 24 | if(CXX_COMPILER_FULL_PATH) 25 | set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) 26 | endif() 27 | -------------------------------------------------------------------------------- /cmake/toolchain-armhf.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR arm) 3 | set(CMAKE_SYSTEM_VERSION 1) 4 | 5 | message(STATUS "Using cross-compile toolchain: ${CROSS_COMPILE_TOOLCHAIN}") 6 | 7 | set(CMAKE_C_COMPILER_TARGET arm-linux-gnueabihf) 8 | set(CMAKE_CXX_COMPILER_TARGET arm-linux-gnueabihf) 9 | 10 | set(CMAKE_CROSSCOMPILING TRUE) 11 | set(CMAKE_CROSSCOMPILING_EMULATOR qemu-arm -L /usr/${CMAKE_C_COMPILER_TARGET}/) 12 | 13 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 14 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 15 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 16 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 17 | 18 | find_program(C_COMPILER_FULL_PATH NAMES ${CMAKE_C_COMPILER_TARGET}-gcc) 19 | if(NOT C_COMPILER_FULL_PATH) 20 | message(FATAL_ERROR "Cross-compiler for ${CMAKE_C_COMPILER_TARGET} not found") 21 | endif() 22 | set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) 23 | 24 | find_program(CXX_COMPILER_FULL_PATH NAMES g++-${CMAKE_CXX_COMPILER_TARGET} ${CMAKE_CXX_COMPILER_TARGET}-g++) 25 | if(CXX_COMPILER_FULL_PATH) 26 | set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) 27 | endif() 28 | -------------------------------------------------------------------------------- /cmake/toolchain-armsf.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR arm) 3 | set(CMAKE_SYSTEM_VERSION 1) 4 | 5 | message(STATUS "Using cross-compile toolchain: ${CROSS_COMPILE_TOOLCHAIN}") 6 | 7 | if(NOT DEFINED CMAKE_C_COMPILER_TARGET) 8 | set(CMAKE_C_COMPILER_TARGET arm-linux-gnueabi) 9 | endif() 10 | if(NOT DEFINED CMAKE_CXX_COMPILER_TARGET) 11 | set(CMAKE_CXX_COMPILER_TARGET arm-linux-gnueabi) 12 | endif() 13 | 14 | set(CMAKE_CROSSCOMPILING TRUE) 15 | set(CMAKE_CROSSCOMPILING_EMULATOR qemu-arm -L /usr/${CMAKE_C_COMPILER_TARGET}/) 16 | 17 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 18 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 19 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 20 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 21 | 22 | find_program(C_COMPILER_FULL_PATH NAMES ${CMAKE_C_COMPILER_TARGET}-gcc) 23 | if(NOT C_COMPILER_FULL_PATH) 24 | message(FATAL_ERROR "Cross-compiler for ${CMAKE_C_COMPILER_TARGET} not found") 25 | endif() 26 | set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) 27 | 28 | find_program(CXX_COMPILER_FULL_PATH NAMES g++-${CMAKE_CXX_COMPILER_TARGET} ${CMAKE_CXX_COMPILER_TARGET}-g++) 29 | if(CXX_COMPILER_FULL_PATH) 30 | set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) 31 | endif() 32 | -------------------------------------------------------------------------------- /cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 2 | message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") 3 | endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 4 | 5 | file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 6 | string(REGEX REPLACE "\n" ";" files "${files}") 7 | list(REVERSE files) 8 | foreach (file ${files}) 9 | message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") 10 | if (EXISTS "$ENV{DESTDIR}${file}") 11 | execute_process( 12 | COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}" 13 | OUTPUT_VARIABLE rm_out 14 | RESULT_VARIABLE rm_retval 15 | ) 16 | if(NOT ${rm_retval} EQUAL 0) 17 | message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 18 | endif (NOT ${rm_retval} EQUAL 0) 19 | else (EXISTS "$ENV{DESTDIR}${file}") 20 | message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") 21 | endif (EXISTS "$ENV{DESTDIR}${file}") 22 | endforeach(file) 23 | -------------------------------------------------------------------------------- /code_of_conduct.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | The Blosc community has adopted a Code of Conduct that we expect project participants to adhere to. 4 | Please read the [full text](https://github.com/Blosc/community/blob/master/code_of_conduct.md) 5 | so that you can understand what actions will and will not be tolerated. 6 | -------------------------------------------------------------------------------- /compat/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # build the filegen utility 2 | link_directories(${PROJECT_BINARY_DIR}/blosc) 3 | add_executable(filegen filegen.c) 4 | target_link_libraries(filegen blosc_testing) 5 | add_dependencies(filegen blosc_testing) 6 | 7 | # tests 8 | if(BUILD_TESTS) 9 | option(TEST_INCLUDE_COMPAT "Include compat checks in the tests" ON) 10 | if(TEST_INCLUDE_COMPAT) 11 | file(GLOB DATAFILES *.cdata) 12 | foreach(datafile ${DATAFILES}) 13 | # Don't test data if compressor is deactivated 14 | if((datafile MATCHES "zlib" AND DEACTIVATE_ZLIB) OR 15 | (datafile MATCHES "zstd" AND DEACTIVATE_ZSTD)) 16 | continue() 17 | endif() 18 | get_filename_component(fname ${datafile} NAME) 19 | add_test(NAME test_compat_${fname} 20 | COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ decompress ${datafile}) 21 | endforeach() 22 | endif() 23 | endif() 24 | -------------------------------------------------------------------------------- /compat/README.rst: -------------------------------------------------------------------------------- 1 | Compressed datafiles for testing backward/forward compatibility 2 | =============================================================== 3 | 4 | The files here have been created with different versions of the C-Blosc library and are meant to test backward/forward compatibility among different versions of the library. 5 | -------------------------------------------------------------------------------- /compat/blosc-1.11.1-blosclz.cdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/compat/blosc-1.11.1-blosclz.cdata -------------------------------------------------------------------------------- /compat/blosc-1.11.1-lz4.cdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/compat/blosc-1.11.1-lz4.cdata -------------------------------------------------------------------------------- /compat/blosc-1.11.1-lz4hc.cdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/compat/blosc-1.11.1-lz4hc.cdata -------------------------------------------------------------------------------- /compat/blosc-1.11.1-zlib.cdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/compat/blosc-1.11.1-zlib.cdata -------------------------------------------------------------------------------- /compat/blosc-1.11.1-zstd.cdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/compat/blosc-1.11.1-zstd.cdata -------------------------------------------------------------------------------- /compat/blosc-1.14.0-blosclz.cdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/compat/blosc-1.14.0-blosclz.cdata -------------------------------------------------------------------------------- /compat/blosc-1.14.0-lz4.cdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/compat/blosc-1.14.0-lz4.cdata -------------------------------------------------------------------------------- /compat/blosc-1.14.0-lz4hc.cdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/compat/blosc-1.14.0-lz4hc.cdata -------------------------------------------------------------------------------- /compat/blosc-1.14.0-zlib.cdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/compat/blosc-1.14.0-zlib.cdata -------------------------------------------------------------------------------- /compat/blosc-1.14.0-zstd.cdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/compat/blosc-1.14.0-zstd.cdata -------------------------------------------------------------------------------- /compat/blosc-1.17.1-lz4-bitshuffle4-memcpy.cdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/compat/blosc-1.17.1-lz4-bitshuffle4-memcpy.cdata -------------------------------------------------------------------------------- /compat/blosc-1.17.1-lz4-bitshuffle8-nomemcpy.cdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/compat/blosc-1.17.1-lz4-bitshuffle8-nomemcpy.cdata -------------------------------------------------------------------------------- /compat/blosc-1.18.0-lz4-bitshuffle4-memcpy.cdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/compat/blosc-1.18.0-lz4-bitshuffle4-memcpy.cdata -------------------------------------------------------------------------------- /compat/blosc-1.18.0-lz4-bitshuffle8-nomemcpy.cdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/compat/blosc-1.18.0-lz4-bitshuffle8-nomemcpy.cdata -------------------------------------------------------------------------------- /compat/blosc-1.3.0-blosclz.cdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/compat/blosc-1.3.0-blosclz.cdata -------------------------------------------------------------------------------- /compat/blosc-1.3.0-lz4.cdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/compat/blosc-1.3.0-lz4.cdata -------------------------------------------------------------------------------- /compat/blosc-1.3.0-lz4hc.cdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/compat/blosc-1.3.0-lz4hc.cdata -------------------------------------------------------------------------------- /compat/blosc-1.3.0-zlib.cdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/compat/blosc-1.3.0-zlib.cdata -------------------------------------------------------------------------------- /compat/blosc-1.7.0-blosclz.cdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/compat/blosc-1.7.0-blosclz.cdata -------------------------------------------------------------------------------- /compat/blosc-1.7.0-lz4.cdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/compat/blosc-1.7.0-lz4.cdata -------------------------------------------------------------------------------- /compat/blosc-1.7.0-lz4hc.cdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/compat/blosc-1.7.0-lz4hc.cdata -------------------------------------------------------------------------------- /compat/blosc-1.7.0-zlib.cdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/compat/blosc-1.7.0-zlib.cdata -------------------------------------------------------------------------------- /compat/blosc-2.0.0-lz4-bitshuffle4-memcpy.cdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/compat/blosc-2.0.0-lz4-bitshuffle4-memcpy.cdata -------------------------------------------------------------------------------- /compat/blosc-2.0.0-lz4-bitshuffle8-nomemcpy.cdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/compat/blosc-2.0.0-lz4-bitshuffle8-nomemcpy.cdata -------------------------------------------------------------------------------- /doc/Doxyfile: -------------------------------------------------------------------------------- 1 | PROJECT_NAME = "blosc2" 2 | XML_OUTPUT = xml 3 | INPUT = ../include/ 4 | GENERATE_LATEX = NO 5 | GENERATE_MAN = NO 6 | GENERATE_RTF = NO 7 | CASE_SENSE_NAMES = NO 8 | GENERATE_HTML = NO 9 | GENERATE_XML = YES 10 | RECURSIVE = YES 11 | QUIET = YES 12 | JAVADOC_AUTOBRIEF = YES 13 | WARN_IF_UNDOCUMENTED = NO 14 | MACRO_EXPANSION = YES 15 | PREDEFINED = IN_DOXYGEN 16 | EXTRACT_ALL = YES 17 | -------------------------------------------------------------------------------- /doc/_static/blosc-logo_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/doc/_static/blosc-logo_256.png -------------------------------------------------------------------------------- /doc/c-blosc2.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../README.rst 2 | 3 | Contents 4 | ======== 5 | 6 | .. toctree:: 7 | :maxdepth: 2 8 | 9 | API Reference 10 | Format 11 | Development 12 | -------------------------------------------------------------------------------- /doc/development/contributing.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../../CONTRIBUTING.rst 2 | -------------------------------------------------------------------------------- /doc/development/index.rst: -------------------------------------------------------------------------------- 1 | Contributing to c-blosc2 2 | ======================== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | :caption: Contents: 7 | 8 | contributing 9 | releasing 10 | roadmap 11 | 12 | -------------------------------------------------------------------------------- /doc/development/releasing.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../../RELEASING.rst 2 | -------------------------------------------------------------------------------- /doc/development/roadmap.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../../ROADMAP.rst 2 | -------------------------------------------------------------------------------- /doc/environment.yml: -------------------------------------------------------------------------------- 1 | iname: RTD 2 | channels: 3 | - conda-forge 4 | - defaults 5 | dependencies: 6 | - python=3.9 7 | - doxygen=1.9 8 | - breathe 9 | - sphinx 10 | - pydata-sphinx-theme 11 | -------------------------------------------------------------------------------- /doc/format/b2nd_format.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../../README_B2ND_FORMAT.rst 2 | -------------------------------------------------------------------------------- /doc/format/b2nd_metalayer.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../../README_B2ND_METALAYER.rst 2 | -------------------------------------------------------------------------------- /doc/format/cframe_format.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../../README_CFRAME_FORMAT.rst 2 | -------------------------------------------------------------------------------- /doc/format/chunk_format.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../../README_CHUNK_FORMAT.rst 2 | -------------------------------------------------------------------------------- /doc/format/extension_filenames.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../../README_EXTENSION_FILENAMES.rst 2 | -------------------------------------------------------------------------------- /doc/format/index.rst: -------------------------------------------------------------------------------- 1 | 2 | Blosc2 Format 3 | ============= 4 | 5 | .. toctree:: 6 | :maxdepth: 1 7 | :caption: Contents: 8 | 9 | b2nd_format 10 | b2nd_metalayer 11 | sframe_format 12 | cframe_format 13 | chunk_format 14 | extension_filenames 15 | 16 | The Blosc2 format is a specification for storing compressed data in a way that is simple to read and parse, and that allows for fast random access to the compressed data. The format is designed to be used with the Blosc2 library, but it is not tied to it, and can be used independently. Emphasis has been put on simplicity and robustness, so that the format can be used in a wide range of applications. 17 | 18 | In this section there is a list of the different parts of the format, from the highest level to the lowest. 19 | -------------------------------------------------------------------------------- /doc/format/sframe_format.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../../README_SFRAME_FORMAT.rst 2 | -------------------------------------------------------------------------------- /doc/index.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :hidden: 3 | 4 | C-Blosc2 5 | -------------------------------------------------------------------------------- /doc/reference/context.rst: -------------------------------------------------------------------------------- 1 | Context 2 | ======= 3 | 4 | In Blosc 2 there is a special `blosc2_context` struct that is created from 5 | compression and decompression parameters. This allows the compression and 6 | decompression to happen in multithreaded scenarios, without the need for 7 | using the global lock. 8 | 9 | .. 10 | .. doxygenstruct:: blosc2_cparams 11 | .. 12 | :members: 13 | .. 14 | .. doxygenvariable:: BLOSC2_CPARAMS_DEFAULTS 15 | 16 | .. doxygenstruct:: blosc2_dparams 17 | :members: 18 | .. doxygenvariable:: BLOSC2_DPARAMS_DEFAULTS 19 | 20 | .. doxygenfunction:: blosc2_create_cctx 21 | 22 | .. doxygenfunction:: blosc2_create_dctx 23 | 24 | .. doxygenfunction:: blosc2_free_ctx 25 | 26 | .. doxygenfunction:: blosc2_compress_ctx 27 | 28 | .. doxygenfunction:: blosc2_decompress_ctx 29 | 30 | .. doxygenfunction:: blosc2_set_maskout 31 | 32 | .. doxygenfunction:: blosc2_getitem_ctx 33 | 34 | .. doxygenfunction:: blosc2_ctx_get_cparams 35 | 36 | .. doxygenfunction:: blosc2_ctx_get_dparams 37 | -------------------------------------------------------------------------------- /doc/reference/index.rst: -------------------------------------------------------------------------------- 1 | C-Blosc2 API 2 | ============ 3 | 4 | This section contains the C-Blosc2 public API and the structures needed to 5 | use it. C-Blosc2 tries to be backward compatible with both the C-Blosc1 API 6 | and format. Furthermore, if you just use the C-Blosc1 API you are guaranteed 7 | to generate compressed data containers that can be read with a Blosc1 library. 8 | 9 | Having said that, the C-Blosc2 API gives you much more functionality, like 10 | 64-bit data containers, more filters, more support for vector instructions, 11 | support for accelerated versions of some codecs in Intel's IPP (like LZ4), 12 | the ability to work with data either in-memory or on-disk (frames) or attach 13 | metainfo to your datasets (metalayers). 14 | 15 | 16 | .. toctree:: 17 | :maxdepth: 2 18 | :caption: Contents: 19 | 20 | utility_variables 21 | utility_functions 22 | blosc1 23 | context 24 | plugins 25 | schunk 26 | metalayers 27 | b2nd 28 | -------------------------------------------------------------------------------- /doc/reference/metalayers.rst: -------------------------------------------------------------------------------- 1 | Metalayers 2 | ========== 3 | 4 | Metalayers are meta-information that can be attached to super-chunks. They can 5 | also be serialized to disk. 6 | 7 | .. doxygenstruct:: blosc2_metalayer 8 | :members: 9 | 10 | Fixed-length metalayers 11 | ----------------------- 12 | 13 | .. doxygenfunction:: blosc2_meta_exists 14 | 15 | .. doxygenfunction:: blosc2_meta_add 16 | 17 | .. doxygenfunction:: blosc2_meta_update 18 | 19 | .. doxygenfunction:: blosc2_meta_get 20 | 21 | 22 | Variable-length metalayers 23 | -------------------------- 24 | 25 | .. doxygenfunction:: blosc2_vlmeta_exists 26 | 27 | .. doxygenfunction:: blosc2_vlmeta_add 28 | 29 | .. doxygenfunction:: blosc2_vlmeta_update 30 | 31 | .. doxygenfunction:: blosc2_vlmeta_get 32 | 33 | .. doxygenfunction:: blosc2_vlmeta_delete 34 | 35 | .. doxygenfunction:: blosc2_vlmeta_get_names 36 | -------------------------------------------------------------------------------- /doc/reference/plugins.rst: -------------------------------------------------------------------------------- 1 | Plugins 2 | ======= 3 | 4 | Filters 5 | ------- 6 | 7 | .. doxygentypedef:: blosc2_filter_forward_cb 8 | .. doxygentypedef:: blosc2_filter_backward_cb 9 | 10 | .. doxygenstruct:: blosc2_filter 11 | :members: 12 | 13 | .. doxygenfunction:: blosc2_register_filter 14 | 15 | Codecs 16 | ------ 17 | 18 | .. doxygentypedef:: blosc2_codec_encoder_cb 19 | .. doxygentypedef:: blosc2_codec_decoder_cb 20 | 21 | .. doxygenstruct:: blosc2_codec 22 | :members: 23 | 24 | .. doxygenfunction:: blosc2_register_codec 25 | 26 | Tuners 27 | ------ 28 | 29 | .. doxygenstruct:: blosc2_tuner 30 | :members: 31 | 32 | .. doxygenfunction:: blosc2_register_tuner 33 | 34 | 35 | IO backends 36 | ----------- 37 | 38 | .. doxygentypedef:: blosc2_open_cb 39 | .. doxygentypedef:: blosc2_close_cb 40 | .. doxygentypedef:: blosc2_write_cb 41 | .. doxygentypedef:: blosc2_read_cb 42 | .. doxygentypedef:: blosc2_truncate_cb 43 | 44 | 45 | .. doxygenstruct:: blosc2_io_cb 46 | :members: 47 | 48 | .. doxygenstruct:: blosc2_io 49 | :members: 50 | 51 | .. doxygenfunction:: blosc2_register_io_cb 52 | 53 | .. doxygenfunction:: blosc2_get_io_cb 54 | -------------------------------------------------------------------------------- /doc/reference/utility_functions.rst: -------------------------------------------------------------------------------- 1 | Utility functions 2 | +++++++++++++++++ 3 | 4 | Timing functions 5 | ---------------- 6 | 7 | .. doxygenfunction:: blosc_set_timestamp 8 | 9 | .. doxygenfunction:: blosc_elapsed_nsecs 10 | 11 | .. doxygenfunction:: blosc_elapsed_secs 12 | 13 | 14 | File and directory utilities 15 | ---------------------------- 16 | 17 | .. doxygenfunction:: blosc2_remove_dir 18 | 19 | .. doxygenfunction:: blosc2_remove_urlpath 20 | 21 | .. doxygenfunction:: blosc2_rename_urlpath 22 | 23 | 24 | Slice utilities 25 | --------------- 26 | 27 | .. doxygenfunction:: blosc2_get_slice_nchunks 28 | 29 | .. doxygenfunction:: blosc2_unidim_to_multidim 30 | 31 | .. doxygenfunction:: blosc2_multidim_to_unidim 32 | -------------------------------------------------------------------------------- /doc/requirements.txt: -------------------------------------------------------------------------------- 1 | breathe 2 | sphinx 3 | pydata-sphinx-theme 4 | -------------------------------------------------------------------------------- /examples/README.rst: -------------------------------------------------------------------------------- 1 | Examples on how to add Blosc support for your programs 2 | ====================================================== 3 | 4 | In this directory you can find a series of examples on how to link 5 | your apps with the Blosc library. A few of them are: 6 | 7 | * simple.c -- The simplest way to add Blosc to your app 8 | * schunk_simple.c -- Adding the more powerful super-chunk into the equation 9 | * frame_simple.c -- Use a frame to serialize Blosc2 super-chunks 10 | * compress_file.c -- Compress a file into a Blosc2 file-frame 11 | 12 | For more info, please visit the `official API documentation 13 | `_. 14 | -------------------------------------------------------------------------------- /examples/b2nd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Blosc - Blocked Shuffling and Compression Library 2 | # 3 | # Copyright (c) 2021 Blosc Development Team 4 | # https://blosc.org 5 | # License: BSD 3-Clause (see LICENSE.txt) 6 | # 7 | # See LICENSE.txt for details about copyright and rights to use. 8 | 9 | file(GLOB SOURCES example_*.c) 10 | list(REMOVE_ITEM SOURCES example_print_meta.c) 11 | if (NOT HAVE_PLUGINS) 12 | file(GLOB NEED_PLUGINS example_plugins_*.c) 13 | list(REMOVE_ITEM SOURCES ${NEED_PLUGINS}) 14 | endif () 15 | 16 | foreach (source ${SOURCES}) 17 | get_filename_component(target_name ${source} NAME_WE) 18 | set(target b2nd_${target_name}) 19 | add_executable(${target} ${target_name}.c) 20 | target_link_libraries(${target} blosc_testing ${LIBS}) 21 | if (${target_name} STREQUAL example_print_meta) 22 | add_test(NAME ${target} COMMAND ${target} 23 | "${PROJECT_BINARY_DIR}/examples/b2nd/example_big_float_frame.b2nd") 24 | else () 25 | add_test(NAME ${target} COMMAND ${target}) 26 | endif () 27 | set_tests_properties(${target} PROPERTIES LABELS "b2nd") 28 | endforeach (source) 29 | -------------------------------------------------------------------------------- /examples/b2nd/example_print_meta.c: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (c) 2021 Blosc Development Team 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 | /* Example program demonstrating how to print metainfo from a b2nd frame. 12 | * You can build frames with example_frame_generator.c 13 | * 14 | * Usage: 15 | * $ ./example_print_meta 16 | * 17 | * Example of output: 18 | * $ ./example_print_meta example_big_float_frame.b2nd 19 | * Blosc2 NDim metalayer parameters: 20 | * Ndim: 3 21 | * Shape: 200, 310, 214 22 | * Chunkshape: 110, 120, 76 23 | * Blockshape: 57, 52, 35 24 | * 25 | */ 26 | 27 | # include 28 | 29 | int print_meta(char *urlpath) { 30 | 31 | b2nd_array_t *arr; 32 | BLOSC_ERROR(b2nd_open(urlpath, &arr)); 33 | BLOSC_ERROR(b2nd_print_meta(arr)); 34 | BLOSC_ERROR(b2nd_free(arr)); 35 | 36 | return 0; 37 | } 38 | 39 | int main(int argc, char *argv[]) { 40 | if (argc != 2) { 41 | printf("Usage: %s urlpath", argv[0]); 42 | exit(-1); 43 | } 44 | 45 | blosc2_init(); 46 | 47 | char *urlpath = argv[1]; 48 | print_meta(urlpath); 49 | 50 | blosc2_destroy(); 51 | 52 | return 0; 53 | } 54 | -------------------------------------------------------------------------------- /guix.scm: -------------------------------------------------------------------------------- 1 | .guix/modules/c-blosc2-package.scm -------------------------------------------------------------------------------- /images/Complete-Write-Read-B2ND.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/images/Complete-Write-Read-B2ND.png -------------------------------------------------------------------------------- /images/Read-Partial-Slices-B2ND.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/images/Read-Partial-Slices-B2ND.png -------------------------------------------------------------------------------- /images/b2nd-2level-parts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/images/b2nd-2level-parts.png -------------------------------------------------------------------------------- /images/blosc2-pipeline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/images/blosc2-pipeline.png -------------------------------------------------------------------------------- /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_REGISTRY_H 12 | #define BLOSC_BLOSC2_TUNERS_REGISTRY_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_REGISTRY_H */ 38 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/.shellcheckrc: -------------------------------------------------------------------------------- 1 | disable=SC2140,SC2086,SC2046,SC2015,SC1097,SC1035,SC1036,SC1007,SC2154,SC2155,SC2000,SC2034,SC2016,SC1091,SC1090,SC2212,SC2143,SC2129,SC2102,SC2069,SC1041,SC1042,SC1044,SC1046,SC1119,SC1110,SC1111,SC1112,SC1102,SC1105,SC1101,SC1004,SC1003,SC1012,SC2068,SC2065,SC2064,SC2063,SC2059,SC2053,SC2048,SC2044,SC2032,SC2031,SC2030,SC2029,SC2025,SC2024,SC2022,SC2018,SC2019,SC2017,SC2014,SC2013,SC2012,SC2009,SC2001,SC2098,SC2096,SC2094,SC2091,SC2092,SC2088,SC2087,SC2076,SC2072,SC2071,SC2223,SC2221,SC2222,SC2217,SC2207,SC2206,SC2205,SC2190,SC2188,SC2187,SC2185,SC2179,SC2178,SC2174,SC2168,SC2167,SC2163,SC2161,SC2160,SC2153,SC2150,SC2148,SC2147,SC2146,SC2142,SC2139,SC2126,SC2123,SC2120,SC2119,SC2117,SC2114,SC1117,SC2164,SC1083,SC2004,SC2125,SC2128,SC2011,SC1008,SC1019,SC2093,SC1132,SC1129,SC2236,SC2237,SC2231,SC2230,SC2229,SC2106,SC2102,SC2243,SC2244,SC2245,SC2247,SC2248,SC2249,SC2250,SC2251,SC2252,SC2181 2 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/LICENSE.md: -------------------------------------------------------------------------------- 1 | (C) 1995-2013 Jean-loup Gailly and Mark Adler 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgment in the product documentation would be 14 | appreciated but is not required. 15 | 16 | 2. Altered source versions must be plainly marked as such, and must not be 17 | misrepresented as being the original software. 18 | 19 | 3. This notice may not be removed or altered from any source distribution. 20 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/arch/.gitignore: -------------------------------------------------------------------------------- 1 | # ignore Makefiles; they're all automatically generated 2 | Makefile 3 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/arch/arm/arm.h: -------------------------------------------------------------------------------- 1 | /* arm.h -- check for ARM features. 2 | * For conditions of distribution and use, see copyright notice in zlib.h 3 | */ 4 | 5 | #ifndef ARM_H_ 6 | #define ARM_H_ 7 | 8 | extern int arm_cpu_has_neon; 9 | extern int arm_cpu_has_crc32; 10 | 11 | void Z_INTERNAL arm_check_features(void); 12 | 13 | #endif /* ARM_H_ */ 14 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/arch/arm/ctzl.h: -------------------------------------------------------------------------------- 1 | #ifndef ARM_CTZL_H 2 | #define ARM_CTZL_H 3 | 4 | #include 5 | 6 | #if defined(_MSC_VER) && !defined(__clang__) 7 | static __forceinline unsigned long __builtin_ctzl(unsigned long value) { 8 | return _arm_clz(_arm_rbit(value)); 9 | } 10 | #endif 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/arch/arm/insert_string_acle.c: -------------------------------------------------------------------------------- 1 | /* insert_string_acle.c -- insert_string variant using ACLE's CRC instructions 2 | * 3 | * Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler 4 | * For conditions of distribution and use, see copyright notice in zlib.h 5 | * 6 | */ 7 | 8 | #ifdef ARM_ACLE_CRC_HASH 9 | #ifndef _MSC_VER 10 | # include 11 | #endif 12 | #include "../../zbuild.h" 13 | #include "../../deflate.h" 14 | 15 | #define UPDATE_HASH(s, h, val) \ 16 | h = __crc32w(0, val) 17 | 18 | #define INSERT_STRING insert_string_acle 19 | #define QUICK_INSERT_STRING quick_insert_string_acle 20 | 21 | #include "../../insert_string_tpl.h" 22 | #endif 23 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/arch/generic/Makefile.in: -------------------------------------------------------------------------------- 1 | # Makefile for zlib 2 | # Copyright (C) 1995-2013 Jean-loup Gailly, Mark Adler 3 | # For conditions of distribution and use, see copyright notice in zlib.h 4 | 5 | CC= 6 | CFLAGS= 7 | SFLAGS= 8 | INCLUDES= 9 | 10 | SRCDIR=. 11 | SRCTOP=../.. 12 | TOPDIR=$(SRCTOP) 13 | 14 | all: 15 | 16 | 17 | mostlyclean: clean 18 | clean: 19 | rm -f *.o *.lo *~ \ 20 | rm -rf objs 21 | rm -f *.gcda *.gcno *.gcov 22 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/arch/power/Makefile.in: -------------------------------------------------------------------------------- 1 | # Makefile for POWER-specific files 2 | # Copyright (C) 2020 Matheus Castanho , IBM 3 | # For conditions of distribution and use, see copyright notice in zlib.h 4 | 5 | CC= 6 | CFLAGS= 7 | SFLAGS= 8 | INCLUDES= 9 | SUFFIX= 10 | 11 | P8FLAGS=-mcpu=power8 12 | NOLTOFLAG= 13 | 14 | SRCDIR=. 15 | SRCTOP=../.. 16 | TOPDIR=$(SRCTOP) 17 | 18 | all: power.o \ 19 | power.lo \ 20 | adler32_power8.o \ 21 | adler32_power8.lo \ 22 | slide_hash_power8.o \ 23 | slide_hash_power8.lo 24 | 25 | power.o: 26 | $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/power.c 27 | 28 | power.lo: 29 | $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/power.c 30 | 31 | adler32_power8.o: 32 | $(CC) $(CFLAGS) $(P8FLAGS) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_power8.c 33 | 34 | adler32_power8.lo: 35 | $(CC) $(SFLAGS) $(P8FLAGS) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_power8.c 36 | 37 | slide_hash_power8.o: 38 | $(CC) $(CFLAGS) $(P8FLAGS) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_hash_power8.c 39 | 40 | slide_hash_power8.lo: 41 | $(CC) $(SFLAGS) $(P8FLAGS) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_hash_power8.c 42 | 43 | mostlyclean: clean 44 | clean: 45 | rm -f *.o *.lo *~ 46 | rm -rf objs 47 | rm -f *.gcda *.gcno *.gcov 48 | 49 | distclean: 50 | rm -f Makefile 51 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/arch/power/power.c: -------------------------------------------------------------------------------- 1 | /* POWER feature check 2 | * Copyright (C) 2020 Matheus Castanho , IBM 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | #include 7 | #include "../../zutil.h" 8 | 9 | Z_INTERNAL int power_cpu_has_arch_2_07; 10 | 11 | void Z_INTERNAL power_check_features(void) { 12 | unsigned long hwcap2; 13 | hwcap2 = getauxval(AT_HWCAP2); 14 | 15 | #ifdef POWER8 16 | if (hwcap2 & PPC_FEATURE2_ARCH_2_07) 17 | power_cpu_has_arch_2_07 = 1; 18 | #endif 19 | } 20 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/arch/power/power.h: -------------------------------------------------------------------------------- 1 | /* power.h -- check for POWER CPU features 2 | * Copyright (C) 2020 Matheus Castanho , IBM 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | #ifndef POWER_H_ 7 | #define POWER_H_ 8 | 9 | extern int power_cpu_has_arch_2_07; 10 | 11 | void Z_INTERNAL power_check_features(void); 12 | 13 | #endif /* POWER_H_ */ 14 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/arch/s390/Makefile.in: -------------------------------------------------------------------------------- 1 | # Makefile for zlib-ng 2 | # Copyright (C) 1995-2013 Jean-loup Gailly, Mark Adler 3 | # For conditions of distribution and use, see copyright notice in zlib.h 4 | 5 | CC= 6 | CFLAGS= 7 | SFLAGS= 8 | INCLUDES= 9 | SUFFIX= 10 | 11 | SRCDIR=. 12 | SRCTOP=../.. 13 | TOPDIR=$(SRCTOP) 14 | 15 | dfltcc_common.o: 16 | $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/dfltcc_common.c 17 | 18 | dfltcc_common.lo: 19 | $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/dfltcc_common.c 20 | 21 | dfltcc_deflate.o: 22 | $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/dfltcc_deflate.c 23 | 24 | dfltcc_deflate.lo: 25 | $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/dfltcc_deflate.c 26 | 27 | dfltcc_inflate.o: 28 | $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/dfltcc_inflate.c 29 | 30 | dfltcc_inflate.lo: 31 | $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/dfltcc_inflate.c 32 | 33 | mostlyclean: clean 34 | clean: 35 | rm -f *.o *.lo *~ 36 | rm -rf objs 37 | rm -f *.gcda *.gcno *.gcov 38 | 39 | distclean: 40 | rm -f Makefile 41 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/arch/s390/self-hosted-builder/actions-runner.Dockerfile: -------------------------------------------------------------------------------- 1 | # Self-Hosted IBM Z Github Actions Runner. 2 | 3 | # Temporary image: amd64 dependencies. 4 | FROM amd64/ubuntu:20.04 as ld-prefix 5 | ENV DEBIAN_FRONTEND=noninteractive 6 | RUN apt-get update && apt-get -y install ca-certificates libicu66 libssl1.1 7 | 8 | # Main image. 9 | FROM s390x/ubuntu:20.04 10 | 11 | # Packages for zlib-ng testing. 12 | ENV DEBIAN_FRONTEND=noninteractive 13 | RUN apt-get update && apt-get -y install \ 14 | clang-11 \ 15 | cmake \ 16 | curl \ 17 | gcc \ 18 | git \ 19 | jq \ 20 | llvm-11-tools \ 21 | ninja-build \ 22 | python-is-python3 \ 23 | python3 \ 24 | python3-pip 25 | 26 | # amd64 dependencies. 27 | COPY --from=ld-prefix / /usr/x86_64-linux-gnu/ 28 | RUN ln -fs ../lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 /usr/x86_64-linux-gnu/lib64/ 29 | RUN ln -fs /etc/resolv.conf /usr/x86_64-linux-gnu/etc/ 30 | ENV QEMU_LD_PREFIX=/usr/x86_64-linux-gnu 31 | 32 | # amd64 Github Actions Runner. 33 | RUN useradd -m actions-runner 34 | USER actions-runner 35 | WORKDIR /home/actions-runner 36 | RUN curl -L https://github.com/actions/runner/releases/download/v2.283.2/actions-runner-linux-x64-2.283.2.tar.gz | tar -xz 37 | VOLUME /home/actions-runner 38 | 39 | # Scripts. 40 | COPY fs/ / 41 | ENTRYPOINT ["/usr/bin/entrypoint"] 42 | CMD ["/usr/bin/actions-runner"] 43 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/arch/s390/self-hosted-builder/actions-runner.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Self-Hosted IBM Z Github Actions Runner 3 | Wants=qemu-user-static 4 | After=qemu-user-static 5 | StartLimitIntervalSec=0 6 | 7 | [Service] 8 | Type=simple 9 | Restart=always 10 | ExecStart=/usr/bin/docker run \ 11 | --env-file=/etc/actions-runner \ 12 | --init \ 13 | --interactive \ 14 | --name=actions-runner \ 15 | --rm \ 16 | --volume=actions-runner:/home/actions-runner \ 17 | iiilinuxibmcom/actions-runner 18 | ExecStop=/bin/sh -c "docker exec actions-runner kill -INT -- -1" 19 | ExecStop=/bin/sh -c "docker wait actions-runner" 20 | ExecStop=/bin/sh -c "docker rm actions-runner" 21 | 22 | [Install] 23 | WantedBy=multi-user.target 24 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/arch/s390/self-hosted-builder/fs/usr/bin/actions-runner: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # Ephemeral runner startup script. 5 | # 6 | # Expects the following environment variables: 7 | # 8 | # - repo=/ 9 | # - access_token= 10 | # 11 | 12 | set -e -u 13 | 14 | # Check the cached registration token. 15 | token_file=registration-token.json 16 | set +e 17 | expires_at=$(jq --raw-output .expires_at "$token_file" 2>/dev/null) 18 | status=$? 19 | set -e 20 | if [[ $status -ne 0 || $(date +%s) -ge $(date -d "$expires_at" +%s) ]]; then 21 | # Refresh the cached registration token. 22 | curl \ 23 | -X POST \ 24 | -H "Accept: application/vnd.github.v3+json" \ 25 | -H "Authorization: token $access_token" \ 26 | "https://api.github.com/repos/$repo/actions/runners/registration-token" \ 27 | -o "$token_file" 28 | fi 29 | 30 | # (Re-)register the runner. 31 | registration_token=$(jq --raw-output .token "$token_file") 32 | ./config.sh remove --token "$registration_token" || true 33 | ./config.sh \ 34 | --url "https://github.com/$repo" \ 35 | --token "$registration_token" \ 36 | --labels z15 \ 37 | --ephemeral 38 | 39 | # Run one job. 40 | ./run.sh 41 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/arch/s390/self-hosted-builder/fs/usr/bin/entrypoint: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # Container entrypoint that waits for all spawned processes. 5 | # 6 | 7 | set -e -u 8 | 9 | # Create a FIFO and start reading from its read end. 10 | tempdir=$(mktemp -d "/tmp/done.XXXXXXXXXX") 11 | trap 'rm -r "$tempdir"' EXIT 12 | done="$tempdir/pipe" 13 | mkfifo "$done" 14 | cat "$done" & waiter=$! 15 | 16 | # Start the workload. Its descendants will inherit the FIFO's write end. 17 | status=0 18 | if [ "$#" -eq 0 ]; then 19 | bash 9>"$done" || status=$? 20 | else 21 | "$@" 9>"$done" || status=$? 22 | fi 23 | 24 | # When the workload and all of its descendants exit, the FIFO's write end will 25 | # be closed and `cat "$done"` will exit. Wait until it happens. This is needed 26 | # in order to handle SelfUpdater, which the workload may start in background 27 | # before exiting. 28 | wait "$waiter" 29 | 30 | exit "$status" 31 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/arch/s390/self-hosted-builder/qemu-user-static.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Support for transparent execution of non-native binaries with QEMU user emulation 3 | 4 | [Service] 5 | Type=oneshot 6 | # The source code for iiilinuxibmcom/qemu-user-static is at https://github.com/iii-i/qemu-user-static/tree/v6.1.0-1 7 | # TODO: replace it with multiarch/qemu-user-static once version >6.1 is available 8 | ExecStart=/usr/bin/docker run --rm --interactive --privileged iiilinuxibmcom/qemu-user-static --reset -p yes 9 | 10 | [Install] 11 | WantedBy=multi-user.target 12 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/arch/x86/INDEX.md: -------------------------------------------------------------------------------- 1 | Contents 2 | -------- 3 | 4 | |Name|Description| 5 | |:-|:-| 6 | |deflate_quick.c|SSE4 optimized deflate strategy for use as level 1| 7 | |crc_folding.c|SSE4 + PCLMULQDQ optimized CRC folding implementation| 8 | |slide_sse2.c|SSE2 optimized slide_hash| 9 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/arch/x86/chunkset_avx.c: -------------------------------------------------------------------------------- 1 | /* chunkset_avx.c -- AVX inline functions to copy small data chunks. 2 | * For conditions of distribution and use, see copyright notice in zlib.h 3 | */ 4 | #include "zbuild.h" 5 | #include "zutil.h" 6 | 7 | #ifdef X86_AVX_CHUNKSET 8 | #include 9 | 10 | typedef __m256i chunk_t; 11 | 12 | #define CHUNK_SIZE 32 13 | 14 | #define HAVE_CHUNKMEMSET_2 15 | #define HAVE_CHUNKMEMSET_4 16 | #define HAVE_CHUNKMEMSET_8 17 | 18 | static inline void chunkmemset_2(uint8_t *from, chunk_t *chunk) { 19 | int16_t tmp; 20 | memcpy(&tmp, from, sizeof(tmp)); 21 | *chunk = _mm256_set1_epi16(tmp); 22 | } 23 | 24 | static inline void chunkmemset_4(uint8_t *from, chunk_t *chunk) { 25 | int32_t tmp; 26 | memcpy(&tmp, from, sizeof(tmp)); 27 | *chunk = _mm256_set1_epi32(tmp); 28 | } 29 | 30 | static inline void chunkmemset_8(uint8_t *from, chunk_t *chunk) { 31 | int64_t tmp; 32 | memcpy(&tmp, from, sizeof(tmp)); 33 | *chunk = _mm256_set1_epi64x(tmp); 34 | } 35 | 36 | static inline void loadchunk(uint8_t const *s, chunk_t *chunk) { 37 | *chunk = _mm256_loadu_si256((__m256i *)s); 38 | } 39 | 40 | static inline void storechunk(uint8_t *out, chunk_t *chunk) { 41 | _mm256_storeu_si256((__m256i *)out, *chunk); 42 | } 43 | 44 | #define CHUNKSIZE chunksize_avx 45 | #define CHUNKCOPY chunkcopy_avx 46 | #define CHUNKCOPY_SAFE chunkcopy_safe_avx 47 | #define CHUNKUNROLL chunkunroll_avx 48 | #define CHUNKMEMSET chunkmemset_avx 49 | #define CHUNKMEMSET_SAFE chunkmemset_safe_avx 50 | 51 | #include "chunkset_tpl.h" 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/arch/x86/chunkset_sse.c: -------------------------------------------------------------------------------- 1 | /* chunkset_sse.c -- SSE inline functions to copy small data chunks. 2 | * For conditions of distribution and use, see copyright notice in zlib.h 3 | */ 4 | 5 | #include "zbuild.h" 6 | #include "zutil.h" 7 | 8 | #ifdef X86_SSE2 9 | #include 10 | 11 | typedef __m128i chunk_t; 12 | 13 | #define CHUNK_SIZE 16 14 | 15 | #define HAVE_CHUNKMEMSET_2 16 | #define HAVE_CHUNKMEMSET_4 17 | #define HAVE_CHUNKMEMSET_8 18 | 19 | static inline void chunkmemset_2(uint8_t *from, chunk_t *chunk) { 20 | int16_t tmp; 21 | memcpy(&tmp, from, sizeof(tmp)); 22 | *chunk = _mm_set1_epi16(tmp); 23 | } 24 | 25 | static inline void chunkmemset_4(uint8_t *from, chunk_t *chunk) { 26 | int32_t tmp; 27 | memcpy(&tmp, from, sizeof(tmp)); 28 | *chunk = _mm_set1_epi32(tmp); 29 | } 30 | 31 | static inline void chunkmemset_8(uint8_t *from, chunk_t *chunk) { 32 | int64_t tmp; 33 | memcpy(&tmp, from, sizeof(tmp)); 34 | *chunk = _mm_set1_epi64x(tmp); 35 | } 36 | 37 | static inline void loadchunk(uint8_t const *s, chunk_t *chunk) { 38 | *chunk = _mm_loadu_si128((__m128i *)s); 39 | } 40 | 41 | static inline void storechunk(uint8_t *out, chunk_t *chunk) { 42 | _mm_storeu_si128((__m128i *)out, *chunk); 43 | } 44 | 45 | #define CHUNKSIZE chunksize_sse2 46 | #define CHUNKCOPY chunkcopy_sse2 47 | #define CHUNKCOPY_SAFE chunkcopy_safe_sse2 48 | #define CHUNKUNROLL chunkunroll_sse2 49 | #define CHUNKMEMSET chunkmemset_sse2 50 | #define CHUNKMEMSET_SAFE chunkmemset_safe_sse2 51 | 52 | #include "chunkset_tpl.h" 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/arch/x86/crc_folding.h: -------------------------------------------------------------------------------- 1 | /* crc_folding.h 2 | * 3 | * Compute the CRC32 using a parallelized folding approach with the PCLMULQDQ 4 | * instruction. 5 | * 6 | * Copyright (C) 2013 Intel Corporation Jim Kukunas 7 | * For conditions of distribution and use, see copyright notice in zlib.h 8 | */ 9 | 10 | #ifndef CRC_FOLDING_H_ 11 | #define CRC_FOLDING_H_ 12 | 13 | #include "../../deflate.h" 14 | 15 | Z_INTERNAL void crc_fold_init(deflate_state *const); 16 | Z_INTERNAL uint32_t crc_fold_512to32(deflate_state *const); 17 | Z_INTERNAL void crc_fold_copy(deflate_state *const, unsigned char *, const unsigned char *, long); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/arch/x86/insert_string_sse.c: -------------------------------------------------------------------------------- 1 | /* insert_string_sse -- insert_string variant using SSE4.2's CRC instructions 2 | * 3 | * Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler 4 | * For conditions of distribution and use, see copyright notice in zlib.h 5 | * 6 | */ 7 | 8 | #include "../../zbuild.h" 9 | #include 10 | #ifdef _MSC_VER 11 | # include 12 | #endif 13 | #include "../../deflate.h" 14 | 15 | #ifdef X86_SSE42_CRC_INTRIN 16 | # ifdef _MSC_VER 17 | # define UPDATE_HASH(s, h, val)\ 18 | h = _mm_crc32_u32(h, val) 19 | # else 20 | # define UPDATE_HASH(s, h, val)\ 21 | h = __builtin_ia32_crc32si(h, val) 22 | # endif 23 | #else 24 | # ifdef _MSC_VER 25 | # define UPDATE_HASH(s, h, val) {\ 26 | __asm mov edx, h\ 27 | __asm mov eax, val\ 28 | __asm crc32 eax, edx\ 29 | __asm mov val, eax\ 30 | } 31 | # else 32 | # define UPDATE_HASH(s, h, val) \ 33 | __asm__ __volatile__ (\ 34 | "crc32 %1,%0\n\t"\ 35 | : "+r" (h)\ 36 | : "r" (val)\ 37 | ); 38 | # endif 39 | #endif 40 | 41 | #define INSERT_STRING insert_string_sse4 42 | #define QUICK_INSERT_STRING quick_insert_string_sse4 43 | 44 | #ifdef X86_SSE42_CRC_HASH 45 | # include "../../insert_string_tpl.h" 46 | #endif 47 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/arch/x86/slide_avx.c: -------------------------------------------------------------------------------- 1 | /* 2 | * AVX2 optimized hash slide, based on Intel's slide_sse implementation 3 | * 4 | * Copyright (C) 2017 Intel Corporation 5 | * Authors: 6 | * Arjan van de Ven 7 | * Jim Kukunas 8 | * Mika T. Lindqvist 9 | * 10 | * For conditions of distribution and use, see copyright notice in zlib.h 11 | */ 12 | #include "../../zbuild.h" 13 | #include "../../deflate.h" 14 | 15 | #include 16 | 17 | Z_INTERNAL void slide_hash_avx2(deflate_state *s) { 18 | Pos *p; 19 | unsigned n; 20 | uint16_t wsize = (uint16_t)s->w_size; 21 | const __m256i ymm_wsize = _mm256_set1_epi16((short)wsize); 22 | 23 | n = HASH_SIZE; 24 | p = &s->head[n] - 16; 25 | do { 26 | __m256i value, result; 27 | 28 | value = _mm256_loadu_si256((__m256i *)p); 29 | result= _mm256_subs_epu16(value, ymm_wsize); 30 | _mm256_storeu_si256((__m256i *)p, result); 31 | p -= 16; 32 | n -= 16; 33 | } while (n > 0); 34 | 35 | n = wsize; 36 | p = &s->prev[n] - 16; 37 | do { 38 | __m256i value, result; 39 | 40 | value = _mm256_loadu_si256((__m256i *)p); 41 | result= _mm256_subs_epu16(value, ymm_wsize); 42 | _mm256_storeu_si256((__m256i *)p, result); 43 | 44 | p -= 16; 45 | n -= 16; 46 | } while (n > 0); 47 | } 48 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/arch/x86/slide_sse.c: -------------------------------------------------------------------------------- 1 | /* 2 | * SSE optimized hash slide 3 | * 4 | * Copyright (C) 2017 Intel Corporation 5 | * Authors: 6 | * Arjan van de Ven 7 | * Jim Kukunas 8 | * 9 | * For conditions of distribution and use, see copyright notice in zlib.h 10 | */ 11 | #include "../../zbuild.h" 12 | #include "../../deflate.h" 13 | 14 | #include 15 | 16 | Z_INTERNAL void slide_hash_sse2(deflate_state *s) { 17 | Pos *p; 18 | unsigned n; 19 | uint16_t wsize = (uint16_t)s->w_size; 20 | const __m128i xmm_wsize = _mm_set1_epi16((short)wsize); 21 | 22 | n = HASH_SIZE; 23 | p = &s->head[n] - 8; 24 | do { 25 | __m128i value, result; 26 | 27 | value = _mm_loadu_si128((__m128i *)p); 28 | result= _mm_subs_epu16(value, xmm_wsize); 29 | _mm_storeu_si128((__m128i *)p, result); 30 | p -= 8; 31 | n -= 8; 32 | } while (n > 0); 33 | 34 | n = wsize; 35 | p = &s->prev[n] - 8; 36 | do { 37 | __m128i value, result; 38 | 39 | value = _mm_loadu_si128((__m128i *)p); 40 | result= _mm_subs_epu16(value, xmm_wsize); 41 | _mm_storeu_si128((__m128i *)p, result); 42 | 43 | p -= 8; 44 | n -= 8; 45 | } while (n > 0); 46 | } 47 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/arch/x86/x86.h: -------------------------------------------------------------------------------- 1 | /* cpu.h -- check for CPU features 2 | * Copyright (C) 2013 Intel Corporation Jim Kukunas 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | #ifndef CPU_H_ 7 | #define CPU_H_ 8 | 9 | extern int x86_cpu_has_avx2; 10 | extern int x86_cpu_has_sse2; 11 | extern int x86_cpu_has_ssse3; 12 | extern int x86_cpu_has_sse42; 13 | extern int x86_cpu_has_pclmulqdq; 14 | extern int x86_cpu_has_tzcnt; 15 | 16 | void Z_INTERNAL x86_check_features(void); 17 | 18 | #endif /* CPU_H_ */ 19 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/chunkset.c: -------------------------------------------------------------------------------- 1 | /* chunkset.c -- inline functions to copy small data chunks. 2 | * For conditions of distribution and use, see copyright notice in zlib.h 3 | */ 4 | 5 | #include "zbuild.h" 6 | #include "zutil.h" 7 | 8 | // We need sizeof(chunk_t) to be 8, no matter what. 9 | #if defined(UNALIGNED64_OK) 10 | typedef uint64_t chunk_t; 11 | #elif defined(UNALIGNED_OK) 12 | typedef struct chunk_t { uint32_t u32[2]; } chunk_t; 13 | #else 14 | typedef struct chunk_t { uint8_t u8[8]; } chunk_t; 15 | #endif 16 | 17 | #define CHUNK_SIZE 8 18 | 19 | #define HAVE_CHUNKMEMSET_4 20 | #define HAVE_CHUNKMEMSET_8 21 | 22 | static inline void chunkmemset_4(uint8_t *from, chunk_t *chunk) { 23 | uint8_t *dest = (uint8_t *)chunk; 24 | memcpy(dest, from, sizeof(uint32_t)); 25 | memcpy(dest+4, from, sizeof(uint32_t)); 26 | } 27 | 28 | static inline void chunkmemset_8(uint8_t *from, chunk_t *chunk) { 29 | memcpy(chunk, from, sizeof(uint64_t)); 30 | } 31 | 32 | static inline void loadchunk(uint8_t const *s, chunk_t *chunk) { 33 | memcpy(chunk, (uint8_t *)s, sizeof(uint64_t)); 34 | } 35 | 36 | static inline void storechunk(uint8_t *out, chunk_t *chunk) { 37 | memcpy(out, chunk, sizeof(uint64_t)); 38 | } 39 | 40 | #define CHUNKSIZE chunksize_c 41 | #define CHUNKCOPY chunkcopy_c 42 | #define CHUNKCOPY_SAFE chunkcopy_safe_c 43 | #define CHUNKUNROLL chunkunroll_c 44 | #define CHUNKMEMSET chunkmemset_c 45 | #define CHUNKMEMSET_SAFE chunkmemset_safe_c 46 | 47 | #include "chunkset_tpl.h" 48 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/cmake/test-tools.cmake: -------------------------------------------------------------------------------- 1 | # test-tools.cmake -- Tests targeting tool coverage 2 | 3 | # Test --help and invalid parameters for our tools 4 | set(TEST_COMMAND ${MINIGZIP_COMMAND} "--help") 5 | add_test(NAME minigzip-help 6 | COMMAND ${CMAKE_COMMAND} 7 | "-DCOMMAND=${TEST_COMMAND}" 8 | -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-redirect.cmake) 9 | 10 | set(TEST_COMMAND ${MINIGZIP_COMMAND} "--invalid") 11 | add_test(NAME minigzip-invalid 12 | COMMAND ${CMAKE_COMMAND} 13 | "-DCOMMAND=${TEST_COMMAND}" 14 | -DSUCCESS_EXIT=64 15 | -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-redirect.cmake) 16 | 17 | set(TEST_COMMAND ${MINIDEFLATE_COMMAND} "--help") 18 | add_test(NAME minideflate-help 19 | COMMAND ${CMAKE_COMMAND} 20 | "-DCOMMAND=${TEST_COMMAND}" 21 | -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-redirect.cmake) 22 | 23 | set(TEST_COMMAND ${MINIDEFLATE_COMMAND} "--invalid") 24 | add_test(NAME minideflate-invalid 25 | COMMAND ${CMAKE_COMMAND} 26 | "-DCOMMAND=${TEST_COMMAND}" 27 | -DSUCCESS_EXIT=64 28 | -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-redirect.cmake) 29 | 30 | set(TEST_COMMAND ${SWITCHLEVELS_COMMAND} "--help") 31 | add_test(NAME switchlevels-help 32 | COMMAND ${CMAKE_COMMAND} 33 | "-DCOMMAND=${TEST_COMMAND}" 34 | -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-redirect.cmake) 35 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/cmake/toolchain-aarch64.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR aarch64) 3 | set(CMAKE_SYSTEM_VERSION 1) 4 | 5 | set(CMAKE_C_COMPILER_TARGET "aarch64-linux-gnu") 6 | set(CMAKE_CXX_COMPILER_TARGET "aarch64-linux-gnu") 7 | 8 | set(CMAKE_CROSSCOMPILING TRUE) 9 | set(CMAKE_CROSSCOMPILING_EMULATOR qemu-aarch64 -L /usr/${CMAKE_C_COMPILER_TARGET}/) 10 | 11 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | 15 | find_program(C_COMPILER_FULL_PATH NAMES ${CMAKE_C_COMPILER_TARGET}-gcc) 16 | if(NOT C_COMPILER_FULL_PATH) 17 | message(FATAL_ERROR "Cross-compiler for ${CMAKE_C_COMPILER_TARGET} not found") 18 | endif() 19 | set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) 20 | 21 | find_program(CXX_COMPILER_FULL_PATH NAMES g++-${CMAKE_CXX_COMPILER_TARGET} ${CMAKE_CXX_COMPILER_TARGET}-g++) 22 | if(CXX_COMPILER_FULL_PATH) 23 | set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) 24 | endif() 25 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/cmake/toolchain-arm.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR arm) 3 | set(CMAKE_SYSTEM_VERSION 1) 4 | 5 | if(NOT DEFINED CMAKE_C_COMPILER_TARGET) 6 | set(CMAKE_C_COMPILER_TARGET arm-linux-gnueabi) 7 | endif() 8 | if(NOT DEFINED CMAKE_CXX_COMPILER_TARGET) 9 | set(CMAKE_CXX_COMPILER_TARGET arm-linux-gnueabi) 10 | endif() 11 | 12 | set(CMAKE_CROSSCOMPILING TRUE) 13 | set(CMAKE_CROSSCOMPILING_EMULATOR qemu-arm -L /usr/${CMAKE_C_COMPILER_TARGET}/) 14 | 15 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 16 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 17 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 18 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 19 | 20 | find_program(C_COMPILER_FULL_PATH NAMES ${CMAKE_C_COMPILER_TARGET}-gcc) 21 | if(NOT C_COMPILER_FULL_PATH) 22 | message(FATAL_ERROR "Cross-compiler for ${CMAKE_C_COMPILER_TARGET} not found") 23 | endif() 24 | set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) 25 | 26 | find_program(CXX_COMPILER_FULL_PATH NAMES g++-${CMAKE_CXX_COMPILER_TARGET} ${CMAKE_CXX_COMPILER_TARGET}-g++) 27 | if(CXX_COMPILER_FULL_PATH) 28 | set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) 29 | endif() 30 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/cmake/toolchain-armhf.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR arm) 3 | set(CMAKE_SYSTEM_VERSION 1) 4 | 5 | set(CMAKE_C_COMPILER_TARGET arm-linux-gnueabihf) 6 | set(CMAKE_CXX_COMPILER_TARGET arm-linux-gnueabihf) 7 | 8 | set(CMAKE_CROSSCOMPILING TRUE) 9 | set(CMAKE_CROSSCOMPILING_EMULATOR qemu-arm -L /usr/${CMAKE_C_COMPILER_TARGET}/) 10 | 11 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 15 | 16 | find_program(C_COMPILER_FULL_PATH NAMES ${CMAKE_C_COMPILER_TARGET}-gcc) 17 | if(NOT C_COMPILER_FULL_PATH) 18 | message(FATAL_ERROR "Cross-compiler for ${CMAKE_C_COMPILER_TARGET} not found") 19 | endif() 20 | set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) 21 | 22 | find_program(CXX_COMPILER_FULL_PATH NAMES g++-${CMAKE_CXX_COMPILER_TARGET} ${CMAKE_CXX_COMPILER_TARGET}-g++) 23 | if(CXX_COMPILER_FULL_PATH) 24 | set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) 25 | endif() 26 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/cmake/toolchain-mingw-i686.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Windows) 2 | 3 | set(CMAKE_C_COMPILER_TARGET i686-w64-mingw32) 4 | set(CMAKE_CXX_COMPILER_TARGET i686-w64-mingw32) 5 | set(CMAKE_RC_COMPILER_TARGET i686-w64-mingw32) 6 | 7 | set(CMAKE_CROSSCOMPILING TRUE) 8 | set(CMAKE_CROSSCOMPILING_EMULATOR wine) 9 | 10 | set(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32) 11 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | 15 | # Prefer posix gcc variant for gtest pthread support 16 | find_program(C_COMPILER_FULL_PATH NAMES 17 | ${CMAKE_C_COMPILER_TARGET}-gcc-posix 18 | ${CMAKE_C_COMPILER_TARGET}-gcc) 19 | if(NOT C_COMPILER_FULL_PATH) 20 | message(FATAL_ERROR "Cross-compiler for ${CMAKE_C_COMPILER_TARGET} not found") 21 | endif() 22 | set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) 23 | 24 | find_program(CXX_COMPILER_FULL_PATH NAMES 25 | ${CMAKE_CXX_COMPILER_TARGET}-g++-posix 26 | ${CMAKE_CXX_COMPILER_TARGET}-g++) 27 | if(CXX_COMPILER_FULL_PATH) 28 | set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) 29 | endif() 30 | 31 | find_program(RC_COMPILER_FULL_PATH NAMES 32 | ${CMAKE_RC_COMPILER_TARGET}-windres) 33 | if(RC_COMPILER_FULL_PATH) 34 | set(CMAKE_RC_COMPILER ${RC_COMPILER_FULL_PATH}) 35 | endif() 36 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/cmake/toolchain-mingw-x86_64.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Windows) 2 | 3 | set(CMAKE_C_COMPILER_TARGET x86_64-w64-mingw32) 4 | set(CMAKE_CXX_COMPILER_TARGET x86_64-w64-mingw32) 5 | set(CMAKE_RC_COMPILER_TARGET x86_64-w64-mingw32) 6 | 7 | set(CMAKE_CROSSCOMPILING TRUE) 8 | set(CMAKE_CROSSCOMPILING_EMULATOR wine) 9 | 10 | set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32) 11 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | 15 | # Prefer posix gcc variant for gtest pthread support 16 | find_program(C_COMPILER_FULL_PATH NAMES 17 | ${CMAKE_C_COMPILER_TARGET}-gcc-posix 18 | ${CMAKE_C_COMPILER_TARGET}-gcc) 19 | if(NOT C_COMPILER_FULL_PATH) 20 | message(FATAL_ERROR "Cross-compiler for ${CMAKE_C_COMPILER_TARGET} not found") 21 | endif() 22 | set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) 23 | 24 | find_program(CXX_COMPILER_FULL_PATH NAMES 25 | ${CMAKE_CXX_COMPILER_TARGET}-g++-posix 26 | ${CMAKE_CXX_COMPILER_TARGET}-g++) 27 | if(CXX_COMPILER_FULL_PATH) 28 | set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) 29 | endif() 30 | 31 | find_program(RC_COMPILER_FULL_PATH NAMES ${CMAKE_RC_COMPILER_TARGET}-windres) 32 | if(RC_COMPILER_FULL_PATH) 33 | set(CMAKE_RC_COMPILER ${RC_COMPILER_FULL_PATH}) 34 | endif() 35 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/cmake/toolchain-powerpc.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR powerpc) 3 | set(CMAKE_SYSTEM_VERSION 1) 4 | 5 | set(CMAKE_C_COMPILER_TARGET powerpc-linux-gnu) 6 | set(CMAKE_CXX_COMPILER_TARGET powerpc-linux-gnu) 7 | 8 | set(CMAKE_CROSSCOMPILING TRUE) 9 | set(CMAKE_CROSSCOMPILING_EMULATOR qemu-ppc -cpu 7400 -L /usr/${CMAKE_C_COMPILER_TARGET}/) 10 | 11 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 15 | 16 | find_program(C_COMPILER_FULL_PATH NAMES ${CMAKE_C_COMPILER_TARGET}-gcc) 17 | if(NOT C_COMPILER_FULL_PATH) 18 | message(FATAL_ERROR "Cross-compiler for ${CMAKE_C_COMPILER_TARGET} not found") 19 | endif() 20 | set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) 21 | 22 | find_program(CXX_COMPILER_FULL_PATH NAMES g++-${CMAKE_CXX_COMPILER_TARGET} ${CMAKE_CXX_COMPILER_TARGET}-g++) 23 | if(CXX_COMPILER_FULL_PATH) 24 | set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) 25 | endif() 26 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/cmake/toolchain-powerpc64.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR ppc64) 3 | set(CMAKE_SYSTEM_VERSION 1) 4 | 5 | set(CMAKE_C_COMPILER_TARGET powerpc64-linux-gnu) 6 | set(CMAKE_CXX_COMPILER_TARGET powerpc64-linux-gnu) 7 | 8 | set(CMAKE_CROSSCOMPILING TRUE) 9 | set(CMAKE_CROSSCOMPILING_EMULATOR qemu-ppc64 -cpu power8 -L /usr/${CMAKE_C_COMPILER_TARGET}/) 10 | 11 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 15 | 16 | find_program(C_COMPILER_FULL_PATH NAMES ${CMAKE_C_COMPILER_TARGET}-gcc) 17 | if(NOT C_COMPILER_FULL_PATH) 18 | message(FATAL_ERROR "Cross-compiler for ${CMAKE_C_COMPILER_TARGET} not found") 19 | endif() 20 | set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) 21 | 22 | find_program(CXX_COMPILER_FULL_PATH NAMES g++-${CMAKE_CXX_COMPILER_TARGET} ${CMAKE_CXX_COMPILER_TARGET}-g++) 23 | if(CXX_COMPILER_FULL_PATH) 24 | set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) 25 | endif() 26 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/cmake/toolchain-powerpc64le.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR ppc64le) 3 | set(CMAKE_SYSTEM_VERSION 1) 4 | 5 | set(CMAKE_C_COMPILER_TARGET powerpc64le-linux-gnu) 6 | set(CMAKE_CXX_COMPILER_TARGET powerpc64le-linux-gnu) 7 | 8 | set(CMAKE_CROSSCOMPILING TRUE) 9 | set(CMAKE_CROSSCOMPILING_EMULATOR qemu-ppc64le -cpu power8 -L /usr/${CMAKE_C_COMPILER_TARGET}/) 10 | 11 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 15 | 16 | find_program(C_COMPILER_FULL_PATH NAMES ${CMAKE_C_COMPILER_TARGET}-gcc) 17 | if(NOT C_COMPILER_FULL_PATH) 18 | message(FATAL_ERROR "Cross-compiler for ${CMAKE_C_COMPILER_TARGET} not found") 19 | endif() 20 | set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) 21 | 22 | find_program(CXX_COMPILER_FULL_PATH NAMES g++-${CMAKE_CXX_COMPILER_TARGET} ${CMAKE_CXX_COMPILER_TARGET}-g++) 23 | if(CXX_COMPILER_FULL_PATH) 24 | set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) 25 | endif() 26 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/cmake/toolchain-s390x.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR s390x) 3 | set(CMAKE_SYSTEM_VERSION 1) 4 | 5 | set(CMAKE_C_COMPILER_TARGET s390x-linux-gnu) 6 | set(CMAKE_CXX_COMPILER_TARGET s390x-linux-gnu) 7 | 8 | set(CMAKE_CROSSCOMPILING TRUE) 9 | set(CMAKE_CROSSCOMPILING_EMULATOR qemu-s390x -L /usr/${CMAKE_C_COMPILER_TARGET}/) 10 | 11 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 15 | 16 | find_program(C_COMPILER_FULL_PATH NAMES ${CMAKE_C_COMPILER_TARGET}-gcc) 17 | if(NOT C_COMPILER_FULL_PATH) 18 | message(FATAL_ERROR "Cross-compiler for ${CMAKE_C_COMPILER_TARGET} not found") 19 | endif() 20 | set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) 21 | 22 | find_program(CXX_COMPILER_FULL_PATH NAMES g++-${CMAKE_CXX_COMPILER_TARGET} ${CMAKE_CXX_COMPILER_TARGET}-g++) 23 | if(CXX_COMPILER_FULL_PATH) 24 | set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) 25 | endif() 26 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/cmake/toolchain-sparc64.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR sparc64) 3 | set(CMAKE_SYSTEM_VERSION 1) 4 | 5 | set(CMAKE_C_COMPILER_TARGET sparc64-linux-gnu) 6 | set(CMAKE_CXX_COMPILER_TARGET sparc64-linux-gnu) 7 | 8 | set(CMAKE_CROSSCOMPILING TRUE) 9 | set(CMAKE_CROSSCOMPILING_EMULATOR qemu-sparc64 -L /usr/${CMAKE_C_COMPILER_TARGET}/) 10 | 11 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 15 | 16 | find_program(C_COMPILER_FULL_PATH NAMES ${CMAKE_C_COMPILER_TARGET}-gcc) 17 | if(NOT C_COMPILER_FULL_PATH) 18 | message(FATAL_ERROR "Cross-compiler for ${CMAKE_C_COMPILER_TARGET} not found") 19 | endif() 20 | set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) 21 | 22 | find_program(CXX_COMPILER_FULL_PATH NAMES g++-${CMAKE_CXX_COMPILER_TARGET} ${CMAKE_CXX_COMPILER_TARGET}-g++) 23 | if(CXX_COMPILER_FULL_PATH) 24 | set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) 25 | endif() 26 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/crc32_p.h: -------------------------------------------------------------------------------- 1 | #ifndef CRC32_P_H_ 2 | #define CRC32_P_H_ 3 | 4 | #define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */ 5 | 6 | 7 | static inline uint32_t gf2_matrix_times(const uint32_t *mat, uint32_t vec) { 8 | uint32_t sum = 0; 9 | while (vec) { 10 | if (vec & 1) 11 | sum ^= *mat; 12 | vec >>= 1; 13 | mat++; 14 | } 15 | return sum; 16 | } 17 | 18 | 19 | #endif /* CRC32_P_H_ */ 20 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/functable.h: -------------------------------------------------------------------------------- 1 | /* functable.h -- Struct containing function pointers to optimized functions 2 | * Copyright (C) 2017 Hans Kristian Rosbach 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | #ifndef FUNCTABLE_H_ 7 | #define FUNCTABLE_H_ 8 | 9 | #include "deflate.h" 10 | 11 | struct functable_s { 12 | void (* insert_string) (deflate_state *const s, const uint32_t str, uint32_t count); 13 | Pos (* quick_insert_string)(deflate_state *const s, const uint32_t str); 14 | uint32_t (* adler32) (uint32_t adler, const unsigned char *buf, size_t len); 15 | uint32_t (* crc32) (uint32_t crc, const unsigned char *buf, uint64_t len); 16 | void (* slide_hash) (deflate_state *s); 17 | uint32_t (* compare258) (const unsigned char *src0, const unsigned char *src1); 18 | uint32_t (* longest_match) (deflate_state *const s, Pos cur_match); 19 | uint32_t (* chunksize) (void); 20 | uint8_t* (* chunkcopy) (uint8_t *out, uint8_t const *from, unsigned len); 21 | uint8_t* (* chunkcopy_safe) (uint8_t *out, uint8_t const *from, unsigned len, uint8_t *safe); 22 | uint8_t* (* chunkunroll) (uint8_t *out, unsigned *dist, unsigned *len); 23 | uint8_t* (* chunkmemset) (uint8_t *out, unsigned dist, unsigned len); 24 | uint8_t* (* chunkmemset_safe) (uint8_t *out, unsigned dist, unsigned len, unsigned left); 25 | }; 26 | 27 | Z_INTERNAL extern Z_TLS struct functable_s functable; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/inffast.h: -------------------------------------------------------------------------------- 1 | #ifndef INFFAST_H_ 2 | #define INFFAST_H_ 3 | /* inffast.h -- header to use inffast.c 4 | * Copyright (C) 1995-2003, 2010 Mark Adler 5 | * For conditions of distribution and use, see copyright notice in zlib.h 6 | */ 7 | 8 | /* WARNING: this file should *not* be used by applications. It is 9 | part of the implementation of the compression library and is 10 | subject to change. Applications should only use zlib.h. 11 | */ 12 | 13 | void Z_INTERNAL zng_inflate_fast(PREFIX3(stream) *strm, unsigned long start); 14 | 15 | #define INFLATE_FAST_MIN_HAVE 8 16 | #define INFLATE_FAST_MIN_LEFT 258 17 | 18 | #endif /* INFFAST_H_ */ 19 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/insert_string.c: -------------------------------------------------------------------------------- 1 | /* insert_string_c -- insert_string variant for c 2 | * 3 | * Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler 4 | * For conditions of distribution and use, see copyright notice in zlib.h 5 | * 6 | */ 7 | 8 | #include "zbuild.h" 9 | #include "deflate.h" 10 | 11 | /* =========================================================================== 12 | * Update a hash value with the given input byte 13 | * IN assertion: all calls to to UPDATE_HASH are made with consecutive 14 | * input characters, so that a running hash key can be computed from the 15 | * previous key instead of complete recalculation each time. 16 | */ 17 | #define HASH_SLIDE 16 // Number of bits to slide hash 18 | 19 | #define UPDATE_HASH(s, h, val) \ 20 | h = ((val * 2654435761U) >> HASH_SLIDE); 21 | 22 | #define INSERT_STRING insert_string_c 23 | #define QUICK_INSERT_STRING quick_insert_string_c 24 | 25 | #include "insert_string_tpl.h" 26 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/test/.gitignore: -------------------------------------------------------------------------------- 1 | # ignore Makefiles; they're all automatically generated 2 | Makefile 3 | /switchlevels 4 | /switchlevels.dSYM/ 5 | /switchlevels.exe 6 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/test/CVE-2002-0059/test.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/internal-complibs/zlib-ng-2.0.7/test/CVE-2002-0059/test.gz -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/test/CVE-2003-0107.c: -------------------------------------------------------------------------------- 1 | // https://www.securityfocus.com/archive/1/312869 --- originally by Richard Kettlewell 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | int main(void) { 8 | gzFile f; 9 | int ret; 10 | 11 | if(!(f = gzopen("/dev/null", "w"))) { 12 | perror("/dev/null"); 13 | exit(1); 14 | } 15 | 16 | ret = gzprintf(f, "%10240s", ""); 17 | printf("gzprintf -> %d\n", ret); 18 | ret = gzclose(f); 19 | printf("gzclose -> %d [%d]\n", ret, errno); 20 | 21 | exit(0); 22 | } 23 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/test/CVE-2004-0797/test.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/internal-complibs/zlib-ng-2.0.7/test/CVE-2004-0797/test.gz -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/test/CVE-2005-1849/test.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/internal-complibs/zlib-ng-2.0.7/test/CVE-2005-1849/test.gz -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/test/CVE-2005-2096/test.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/internal-complibs/zlib-ng-2.0.7/test/CVE-2005-2096/test.gz -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/test/GH-361/test.txt: -------------------------------------------------------------------------------- 1 | .....-.u..|u....-...!..A.#?)9.._B..F..| 2 | 00000650 fa 13 88 89 2c 1f 81 0f e4 e9 ce 39 a0 87 2e 2e |....,......9....| 3 | 00000660 a5 0c 08 9c ec fc 88 6d 16 02 0a a0 3d fc 36 29 |.......m....=.6)| 4 | 00000670 8d f5 c3 ba 1d 07 f4 78 e1 a0 41 f9 89 15 a5 69 |.......x..A.... -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/test/GH-364/test.bin: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/test/GH-382/defneg3.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/internal-complibs/zlib-ng-2.0.7/test/GH-382/defneg3.dat -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/test/GH-979/pigz-2.6.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/internal-complibs/zlib-ng-2.0.7/test/GH-979/pigz-2.6.tar.gz -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/test/abi/ignore: -------------------------------------------------------------------------------- 1 | # See https://sourceware.org/libabigail/manual/libabigail-concepts.html#suppression-specifications 2 | 3 | [suppress_type] 4 | name = internal_state 5 | 6 | [suppress_type] 7 | name_regexp = z_stream.* 8 | 9 | # Size varies with version number 10 | [suppress_variable] 11 | name = zlibng_string 12 | 13 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/test/data/fireworks.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/internal-complibs/zlib-ng-2.0.7/test/data/fireworks.jpg -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/test/data/paper-100k.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/internal-complibs/zlib-ng-2.0.7/test/data/paper-100k.pdf -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/test/fuzz/standalone_fuzz_target_runner.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "zbuild.h" 6 | 7 | extern int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size); 8 | 9 | int main(int argc, char **argv) { 10 | int i; 11 | fprintf(stderr, "StandaloneFuzzTargetMain: running %d inputs\n", argc - 1); 12 | 13 | for (i = 1; i < argc; i++) { 14 | size_t len, n_read, err; 15 | unsigned char *buf; 16 | FILE *f = fopen(argv[i], "rb+"); 17 | if (!f) { 18 | /* Failed to open this file: it may be a directory. */ 19 | fprintf(stderr, "Skipping: %s\n", argv[i]); 20 | continue; 21 | } 22 | fprintf(stderr, "Running: %s %s\n", argv[0], argv[i]); 23 | fseek(f, 0, SEEK_END); 24 | len = ftell(f); 25 | fseek(f, 0, SEEK_SET); 26 | buf = (unsigned char *)malloc(len); 27 | n_read = fread(buf, 1, len, f); 28 | assert(n_read == len); 29 | LLVMFuzzerTestOneInput(buf, len); 30 | free(buf); 31 | err = fclose(f); 32 | assert(err == 0); 33 | Z_UNUSED(err); 34 | fprintf(stderr, "Done: %s: (%d bytes)\n", argv[i], (int)n_read); 35 | } 36 | 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/test/gh1235.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "zutil.h" 5 | 6 | int main(void) { 7 | unsigned char plain[32]; 8 | unsigned char compressed[130]; 9 | PREFIX3(stream) strm; 10 | int bound; 11 | z_size_t bytes; 12 | 13 | for (int i = 0; i <= 32; i++) { 14 | memset(plain, 6, i); 15 | memset(&strm, 0, sizeof(strm)); 16 | PREFIX(deflateInit2)(&strm, 0, 8, 31, 1, Z_DEFAULT_STRATEGY); 17 | bound = PREFIX(deflateBound)(&strm, i); 18 | strm.next_in = plain; 19 | strm.next_out = compressed; 20 | strm.avail_in = i; 21 | strm.avail_out = sizeof(compressed); 22 | if (PREFIX(deflate)(&strm, Z_FINISH) != Z_STREAM_END) return -1; 23 | if (strm.avail_in != 0) return -1; 24 | printf("bytes = %2i, deflateBound = %2i, total_out = %2zi\n", i, bound, strm.total_out); 25 | if (bound < strm.total_out) return -1; 26 | if (PREFIX(deflateEnd)(&strm) != Z_OK) return -1; 27 | } 28 | for (int i = 0; i <= 32; i++) { 29 | bytes = sizeof(compressed); 30 | for (int j = 0; j < i; j++) { 31 | plain[j] = j; 32 | } 33 | bound = PREFIX(compressBound)(i); 34 | if (PREFIX(compress2)(compressed, &bytes, plain, i, 1) != Z_OK) return -1; 35 | printf("bytes = %2i, compressBound = %2i, total_out = %2zi\n", i, bound, (size_t)bytes); 36 | if (bytes > bound) return -1; 37 | } 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/test/testCVEinputs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | TESTDIR="$(dirname "$0")" 3 | 4 | # check for QEMU if QEMU_RUN is set 5 | if [ ! -z "${QEMU_RUN}" ]; then 6 | QEMU_VERSION=$(${QEMU_RUN} --version 2> /dev/null) 7 | if [ -z "${QEMU_VERSION}" ]; then 8 | echo "**** You need QEMU to run tests on non-native platform" 9 | exit 1 10 | fi 11 | fi 12 | 13 | CVEs="CVE-2002-0059 CVE-2004-0797 CVE-2005-1849 CVE-2005-2096" 14 | 15 | for CVE in $CVEs; do 16 | fail=0 17 | for testcase in ${TESTDIR}/${CVE}/*.gz; do 18 | ${QEMU_RUN} ../minigzip${EXE} -d < "$testcase" 19 | # we expect that a 1 error code is OK 20 | # for a vulnerable failure we'd expect 134 or similar 21 | if [ $? -ne 1 ] && [ $? -ne 0 ]; then 22 | fail=1 23 | fi 24 | done 25 | if [ $fail -eq 0 ]; then 26 | echo " --- zlib not vulnerable to $CVE ---"; 27 | else 28 | echo " --- zlib VULNERABLE to $CVE ---"; exit 1; 29 | fi 30 | done 31 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/tools/codecov-upload.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -ux 3 | cd "$CODECOV_DIR" 4 | python -m codecov --required --flags "$CODECOV_FLAGS" --name "$CODECOV_NAME" --gcov-exec="$CODECOV_EXEC" 5 | if [ $? -ne 0 ]; then 6 | sleep 30 7 | python -m codecov --required --flags "$CODECOV_FLAGS" --name "$CODECOV_NAME" --gcov-exec="$CODECOV_EXEC" --tries=25 8 | fi 9 | exit $? 10 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/tools/config.sub: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Canonicalize CHOST. 3 | # In particular, converts Debian multiarch tuples into GNU triplets. 4 | # See also 5 | # https://wiki.debian.org/Multiarch/Tuples 6 | # https://wiki.gentoo.org/wiki/CHOST 7 | # If you need an architecture not listed here, file a bug at github.com/zlib-ng/zlib-ng 8 | # and work around the problem by dropping libtool's much more comprehensive config.sub 9 | # on top of this file, see 10 | # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub 11 | 12 | case "$1" in 13 | *-*-linux-gnu*) echo $1;; 14 | i686-linux-gnu*|x86_64-linux-gnu*) echo $1 | sed 's/-linux-gnu/-pc-linux-gnu/';; 15 | *-linux-gnu*) echo $1 | sed 's/-linux-gnu/-unknown-linux-gnu/';; 16 | *) echo $1;; 17 | esac 18 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/trees.h: -------------------------------------------------------------------------------- 1 | #ifndef TREES_H_ 2 | #define TREES_H_ 3 | 4 | /* Constants */ 5 | 6 | #define DIST_CODE_LEN 512 7 | /* see definition of array dist_code in trees.c */ 8 | 9 | #define MAX_BL_BITS 7 10 | /* Bit length codes must not exceed MAX_BL_BITS bits */ 11 | 12 | #define REP_3_6 16 13 | /* repeat previous bit length 3-6 times (2 bits of repeat count) */ 14 | 15 | #define REPZ_3_10 17 16 | /* repeat a zero length 3-10 times (3 bits of repeat count) */ 17 | 18 | #define REPZ_11_138 18 19 | /* repeat a zero length 11-138 times (7 bits of repeat count) */ 20 | 21 | static const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */ 22 | = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}; 23 | 24 | static const int extra_dbits[D_CODES] /* extra bits for each distance code */ 25 | = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; 26 | 27 | static const int extra_blbits[BL_CODES] /* extra bits for each bit length code */ 28 | = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}; 29 | 30 | static const unsigned char bl_order[BL_CODES] 31 | = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; 32 | /* The lengths of the bit length codes are sent in order of decreasing 33 | * probability, to avoid transmitting the lengths for unused bit length codes. 34 | */ 35 | 36 | 37 | /* Function definitions */ 38 | void gen_codes (ct_data *tree, int max_code, uint16_t *bl_count); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/win32/zlib-ng.def: -------------------------------------------------------------------------------- 1 | ; zlib-ng data compression library 2 | EXPORTS 3 | ; basic functions 4 | zlibng_version 5 | zng_deflate 6 | zng_deflateEnd 7 | zng_inflate 8 | zng_inflateEnd 9 | ; advanced functions 10 | zng_deflateSetDictionary 11 | zng_deflateGetDictionary 12 | zng_deflateCopy 13 | zng_deflateReset 14 | zng_deflateParams 15 | zng_deflateTune 16 | zng_deflateBound 17 | zng_deflatePending 18 | zng_deflatePrime 19 | zng_deflateSetHeader 20 | zng_deflateSetParams 21 | zng_deflateGetParams 22 | zng_inflateSetDictionary 23 | zng_inflateGetDictionary 24 | zng_inflateSync 25 | zng_inflateCopy 26 | zng_inflateReset 27 | zng_inflateReset2 28 | zng_inflatePrime 29 | zng_inflateMark 30 | zng_inflateGetHeader 31 | zng_inflateBack 32 | zng_inflateBackEnd 33 | zng_zlibCompileFlags 34 | ; utility functions 35 | zng_compress 36 | zng_compress2 37 | zng_compressBound 38 | zng_uncompress 39 | zng_uncompress2 40 | ; checksum functions 41 | zng_adler32 42 | zng_adler32_z 43 | zng_crc32 44 | zng_crc32_z 45 | zng_adler32_combine 46 | zng_crc32_combine 47 | ; various hacks, don't look :) 48 | zng_deflateInit_ 49 | zng_deflateInit2_ 50 | zng_inflateInit_ 51 | zng_inflateInit2_ 52 | zng_inflateBackInit_ 53 | zng_zError 54 | zng_inflateSyncPoint 55 | zng_get_crc_table 56 | zng_inflateUndermine 57 | zng_inflateValidate 58 | zng_inflateCodesUsed 59 | zng_inflateResetKeep 60 | zng_deflateResetKeep 61 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/win32/zlib-ng1.rc: -------------------------------------------------------------------------------- 1 | #include 2 | #include "../zlib-ng.h" 3 | 4 | VS_VERSION_INFO VERSIONINFO 5 | FILEVERSION ZLIBNG_VER_MAJOR,ZLIBNG_VER_MINOR,ZLIBNG_VER_REVISION,0 6 | PRODUCTVERSION ZLIBNG_VER_MAJOR,ZLIBNG_VER_MINOR,ZLIBNG_VER_REVISION,0 7 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 8 | #ifdef _DEBUG 9 | FILEFLAGS 1 10 | #else 11 | FILEFLAGS 0 12 | #endif 13 | FILEOS VOS__WINDOWS32 14 | FILETYPE VFT_DLL 15 | FILESUBTYPE 0 // not used 16 | BEGIN 17 | BLOCK "StringFileInfo" 18 | BEGIN 19 | BLOCK "040904E4" 20 | //language ID = U.S. English, char set = Windows, Multilingual 21 | BEGIN 22 | VALUE "FileDescription", "zlib data compression library\0" 23 | VALUE "FileVersion", ZLIBNG_VERSION "\0" 24 | VALUE "InternalName", "zlib-ng1.dll\0" 25 | VALUE "LegalCopyright", "(C) 1995-2013 Jean-loup Gailly & Mark Adler\0" 26 | VALUE "OriginalFilename", "zlib-ng1.dll\0" 27 | VALUE "ProductName", "zlib\0" 28 | VALUE "ProductVersion", ZLIBNG_VERSION "\0" 29 | VALUE "Comments", "For more information visit https://www.zlib.net/\0" 30 | END 31 | END 32 | BLOCK "VarFileInfo" 33 | BEGIN 34 | VALUE "Translation", 0x0409, 1252 35 | END 36 | END 37 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/win32/zlib.def: -------------------------------------------------------------------------------- 1 | ; zlib data compression library 2 | EXPORTS 3 | ; basic functions 4 | zlibVersion 5 | deflate 6 | deflateEnd 7 | inflate 8 | inflateEnd 9 | ; advanced functions 10 | deflateSetDictionary 11 | deflateGetDictionary 12 | deflateCopy 13 | deflateReset 14 | deflateParams 15 | deflateTune 16 | deflateBound 17 | deflatePending 18 | deflatePrime 19 | deflateSetHeader 20 | inflateSetDictionary 21 | inflateGetDictionary 22 | inflateSync 23 | inflateCopy 24 | inflateReset 25 | inflateReset2 26 | inflatePrime 27 | inflateMark 28 | inflateGetHeader 29 | inflateBack 30 | inflateBackEnd 31 | zlibCompileFlags 32 | ; utility functions 33 | compress 34 | compress2 35 | compressBound 36 | uncompress 37 | uncompress2 38 | ; large file functions 39 | adler32_combine64 40 | crc32_combine64 41 | ; checksum functions 42 | adler32 43 | adler32_z 44 | crc32 45 | crc32_z 46 | adler32_combine 47 | crc32_combine 48 | ; various hacks, don't look :) 49 | deflateInit_ 50 | deflateInit2_ 51 | inflateInit_ 52 | inflateInit2_ 53 | inflateBackInit_ 54 | zError 55 | inflateSyncPoint 56 | get_crc_table 57 | inflateUndermine 58 | inflateValidate 59 | inflateCodesUsed 60 | inflateResetKeep 61 | deflateResetKeep 62 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/win32/zlib1.rc: -------------------------------------------------------------------------------- 1 | #include 2 | #include "../zlib.h" 3 | 4 | VS_VERSION_INFO VERSIONINFO 5 | FILEVERSION ZLIB_VER_MAJOR,ZLIB_VER_MINOR,ZLIB_VER_REVISION,0 6 | PRODUCTVERSION ZLIB_VER_MAJOR,ZLIB_VER_MINOR,ZLIB_VER_REVISION,0 7 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 8 | #ifdef _DEBUG 9 | FILEFLAGS 1 10 | #else 11 | FILEFLAGS 0 12 | #endif 13 | FILEOS VOS__WINDOWS32 14 | FILETYPE VFT_DLL 15 | FILESUBTYPE 0 // not used 16 | BEGIN 17 | BLOCK "StringFileInfo" 18 | BEGIN 19 | BLOCK "040904E4" 20 | //language ID = U.S. English, char set = Windows, Multilingual 21 | BEGIN 22 | VALUE "FileDescription", "zlib data compression library\0" 23 | VALUE "FileVersion", ZLIB_VERSION "\0" 24 | VALUE "InternalName", "zlib1.dll\0" 25 | VALUE "LegalCopyright", "(C) 1995-2013 Jean-loup Gailly & Mark Adler\0" 26 | VALUE "OriginalFilename", "zlib1.dll\0" 27 | VALUE "ProductName", "zlib\0" 28 | VALUE "ProductVersion", ZLIB_VERSION "\0" 29 | VALUE "Comments", "For more information visit https://www.zlib.net/\0" 30 | END 31 | END 32 | BLOCK "VarFileInfo" 33 | BEGIN 34 | VALUE "Translation", 0x0409, 1252 35 | END 36 | END 37 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/zbuild.h: -------------------------------------------------------------------------------- 1 | #ifndef _ZBUILD_H 2 | #define _ZBUILD_H 3 | 4 | #ifndef _ISOC11_SOURCE 5 | # define _ISOC11_SOURCE 1 /* aligned_alloc */ 6 | #endif 7 | 8 | /* This has to be first include that defines any types */ 9 | #if defined(_MSC_VER) 10 | # if defined(_WIN64) 11 | typedef __int64 ssize_t; 12 | # else 13 | typedef long ssize_t; 14 | # endif 15 | #endif 16 | 17 | #if defined(ZLIB_COMPAT) 18 | # define PREFIX(x) x 19 | # define PREFIX2(x) ZLIB_ ## x 20 | # define PREFIX3(x) z_ ## x 21 | # define PREFIX4(x) x ## 64 22 | # define zVersion zlibVersion 23 | # define z_size_t unsigned long 24 | #else 25 | # define PREFIX(x) zng_ ## x 26 | # define PREFIX2(x) ZLIBNG_ ## x 27 | # define PREFIX3(x) zng_ ## x 28 | # define PREFIX4(x) zng_ ## x 29 | # define zVersion zlibng_version 30 | # define z_size_t size_t 31 | #endif 32 | 33 | /* Minimum of a and b. */ 34 | #define MIN(a, b) ((a) > (b) ? (b) : (a)) 35 | /* Maximum of a and b. */ 36 | #define MAX(a, b) ((a) < (b) ? (b) : (a)) 37 | /* Ignore unused variable warning */ 38 | #define Z_UNUSED(var) (void)(var) 39 | 40 | #if defined(__has_feature) 41 | # if __has_feature(memory_sanitizer) 42 | # define Z_MEMORY_SANITIZER 1 43 | # include 44 | # endif 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/zlib.pc.cmakein: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=${prefix} 3 | libdir=@PC_LIB_INSTALL_DIR@ 4 | sharedlibdir=${libdir} 5 | includedir=@PC_INC_INSTALL_DIR@ 6 | 7 | Name: zlib@SUFFIX@ 8 | Description: zlib-ng compression library 9 | Version: @ZLIB_FULL_VERSION@ 10 | 11 | Requires: 12 | Libs: -L${libdir} -L${sharedlibdir} -lz@SUFFIX@ 13 | Cflags: -I${includedir} 14 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/zlib.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | sharedlibdir=@sharedlibdir@ 5 | includedir=@includedir@ 6 | 7 | Name: zlib@SUFFIX@ 8 | Description: zlib-ng compression library 9 | Version: @VERSION@ 10 | 11 | Requires: 12 | Libs: -L${libdir} -L${sharedlibdir} -lz@SUFFIX@ 13 | Cflags: -I${includedir} 14 | -------------------------------------------------------------------------------- /internal-complibs/zlib-ng-2.0.7/zutil_p.h: -------------------------------------------------------------------------------- 1 | /* zutil_p.h -- Private inline functions used internally in zlib-ng 2 | * 3 | */ 4 | 5 | #ifndef ZUTIL_P_H 6 | #define ZUTIL_P_H 7 | 8 | #if defined(HAVE_POSIX_MEMALIGN) && !defined(_POSIX_C_SOURCE) 9 | # define _POSIX_C_SOURCE 200112L /* For posix_memalign(). */ 10 | #endif 11 | 12 | #if defined(__APPLE__) || defined(HAVE_POSIX_MEMALIGN) || defined(HAVE_ALIGNED_ALLOC) 13 | # include 14 | #elif defined(__FreeBSD__) 15 | # include 16 | # include 17 | #else 18 | # include 19 | #endif 20 | 21 | /* Function to allocate 16 or 64-byte aligned memory */ 22 | static inline void *zng_alloc(size_t size) { 23 | #ifdef HAVE_POSIX_MEMALIGN 24 | void *ptr; 25 | return posix_memalign(&ptr, 64, size) ? NULL : ptr; 26 | #elif defined(_WIN32) 27 | return (void *)_aligned_malloc(size, 64); 28 | #elif defined(__APPLE__) 29 | return (void *)malloc(size); /* MacOS always aligns to 16 bytes */ 30 | #elif defined(HAVE_ALIGNED_ALLOC) 31 | return (void *)aligned_alloc(64, size); 32 | #else 33 | return (void *)memalign(64, size); 34 | #endif 35 | } 36 | 37 | /* Function that can free aligned memory */ 38 | static inline void zng_free(void *ptr) { 39 | #if defined(_WIN32) 40 | _aligned_free(ptr); 41 | #else 42 | free(ptr); 43 | #endif 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /internal-complibs/zstd-1.5.7/.gitignore: -------------------------------------------------------------------------------- 1 | # make install artefact 2 | libzstd.pc 3 | libzstd-nomt 4 | -------------------------------------------------------------------------------- /internal-complibs/zstd-1.5.7/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 | #if !defined(ZSTD_LINUX_KERNEL) || (DEBUGLEVEL>=2) 25 | /* We only use this when DEBUGLEVEL>=2, but we get -Werror=pedantic errors if a 26 | * translation unit is empty. So remove this from Linux kernel builds, but 27 | * otherwise just leave it in. 28 | */ 29 | int g_debuglevel = DEBUGLEVEL; 30 | #endif 31 | -------------------------------------------------------------------------------- /internal-complibs/zstd-1.5.7/common/xxhash.c: -------------------------------------------------------------------------------- 1 | /* 2 | * xxHash - Extremely Fast Hash algorithm 3 | * Copyright (c) Yann Collet - Meta Platforms, Inc 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 | * xxhash.c instantiates functions defined in xxhash.h 13 | */ 14 | 15 | #define XXH_STATIC_LINKING_ONLY /* access advanced declarations */ 16 | #define XXH_IMPLEMENTATION /* access definitions */ 17 | 18 | #include "xxhash.h" 19 | -------------------------------------------------------------------------------- /internal-complibs/zstd-1.5.7/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 | -------------------------------------------------------------------------------- /internal-complibs/zstd-1.5.7/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 | #include "../common/mem.h" /* U32 */ 15 | #include "zstd_compress_internal.h" 16 | 17 | void ZSTD_fillHashTable(ZSTD_MatchState_t* ms, 18 | void const* end, ZSTD_dictTableLoadMethod_e dtlm, 19 | ZSTD_tableFillPurpose_e tfp); 20 | size_t ZSTD_compressBlock_fast( 21 | ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], 22 | void const* src, size_t srcSize); 23 | size_t ZSTD_compressBlock_fast_dictMatchState( 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_fast_extDict( 27 | ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], 28 | void const* src, size_t srcSize); 29 | 30 | #endif /* ZSTD_FAST_H */ 31 | -------------------------------------------------------------------------------- /internal-complibs/zstd-1.5.7/compress/zstd_preSplit.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_PRESPLIT_H 12 | #define ZSTD_PRESPLIT_H 13 | 14 | #include /* size_t */ 15 | 16 | #define ZSTD_SLIPBLOCK_WORKSPACESIZE 8208 17 | 18 | /* ZSTD_splitBlock(): 19 | * @level must be a value between 0 and 4. 20 | * higher levels spend more energy to detect block boundaries. 21 | * @workspace must be aligned for size_t. 22 | * @wkspSize must be at least >= ZSTD_SLIPBLOCK_WORKSPACESIZE 23 | * note: 24 | * For the time being, this function only accepts full 128 KB blocks. 25 | * Therefore, @blockSize must be == 128 KB. 26 | * While this could be extended to smaller sizes in the future, 27 | * it is not yet clear if this would be useful. TBD. 28 | */ 29 | size_t ZSTD_splitBlock(const void* blockStart, size_t blockSize, 30 | int level, 31 | void* workspace, size_t wkspSize); 32 | 33 | #endif /* ZSTD_PRESPLIT_H */ 34 | -------------------------------------------------------------------------------- /internal-complibs/zstd-1.5.7/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 | -------------------------------------------------------------------------------- /internal-complibs/zstd-1.5.7/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 | -------------------------------------------------------------------------------- /internal-complibs/zstd-1.5.7/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 | -------------------------------------------------------------------------------- /internal-complibs/zstd-1.5.7/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 @LIBS_MT@ 15 | Libs.private: @LIBS_PRIVATE@ 16 | Cflags: -I${includedir} @LIBS_MT@ 17 | -------------------------------------------------------------------------------- /internal-complibs/zstd-1.5.7/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 | -------------------------------------------------------------------------------- /plugins/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Blosc - Blocked Shuffling and Compression Library 2 | # 3 | # Copyright (c) 2021 Blosc Development Team 4 | # https://blosc.org 5 | # License: BSD 3-Clause (see LICENSE.txt) 6 | # 7 | # See LICENSE.txt for details about copyright and rights to use. 8 | 9 | add_subdirectory(codecs) 10 | add_subdirectory(tuners) 11 | add_subdirectory(filters) 12 | 13 | set(SOURCES ${SOURCES} PARENT_SCOPE) 14 | -------------------------------------------------------------------------------- /plugins/codecs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(ndlz) 2 | add_subdirectory(zfp) 3 | 4 | set(SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/plugins/codecs/codecs-registry.c PARENT_SCOPE) 5 | -------------------------------------------------------------------------------- /plugins/codecs/ndlz/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Blosc - Blocked Shuffling and Compression Library 2 | # 3 | # Copyright (c) 2021 Blosc Development Team 4 | # https://blosc.org 5 | # License: BSD 3-Clause (see LICENSE.txt) 6 | # 7 | # See LICENSE.txt for details about copyright and rights to use. 8 | 9 | # sources 10 | set(SOURCES ${SOURCES} 11 | ${PROJECT_SOURCE_DIR}/plugins/codecs/ndlz/ndlz.c 12 | ${PROJECT_SOURCE_DIR}/plugins/codecs/ndlz/ndlz4x4.c 13 | ${PROJECT_SOURCE_DIR}/plugins/codecs/ndlz/ndlz8x8.c 14 | ${PROJECT_SOURCE_DIR}/plugins/codecs/ndlz/xxhash.c 15 | PARENT_SCOPE) 16 | 17 | # targets 18 | if(BUILD_TESTS) 19 | add_executable(test_ndlz test_ndlz.c) 20 | # Define the BLOSC_TESTING symbol so normally-hidden functions 21 | # aren't hidden from the view of the test programs. 22 | target_compile_definitions(test_ndlz PUBLIC BLOSC_TESTING) 23 | 24 | target_link_libraries(test_ndlz PUBLIC blosc_testing) 25 | 26 | # tests 27 | add_test(NAME test_plugin_test_ndlz 28 | COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) 29 | 30 | # Copy test files 31 | file(GLOB TESTS_DATA ../../test_data/example_s*.b2nd) 32 | foreach (data ${TESTS_DATA}) 33 | file(COPY ${data} 34 | DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) 35 | endforeach(data) 36 | endif() 37 | -------------------------------------------------------------------------------- /plugins/codecs/ndlz/ndlz-private.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (c) 2021 Blosc Development Team 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 NDLZ_PRIVATE_H 12 | #define NDLZ_PRIVATE_H 13 | 14 | #include 15 | 16 | #define XXH_INLINE_ALL 17 | 18 | #define NDLZ_ERROR_NULL(pointer) \ 19 | do { \ 20 | if ((pointer) == NULL) { \ 21 | return 0; \ 22 | } \ 23 | } while (0) 24 | 25 | #endif /* NDLZ_PRIVATE_H */ 26 | -------------------------------------------------------------------------------- /plugins/codecs/ndlz/ndlz.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (c) 2021 Blosc Development Team 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_PLUGINS_CODECS_NDLZ_NDLZ_H 12 | #define BLOSC_PLUGINS_CODECS_NDLZ_NDLZ_H 13 | 14 | #include "blosc2.h" 15 | 16 | #include 17 | 18 | int ndlz_compress(const uint8_t *input, int32_t input_len, uint8_t *output, int32_t output_len, 19 | uint8_t meta, blosc2_cparams *cparams, const void* chunk); 20 | 21 | int ndlz_decompress(const uint8_t *input, int32_t input_len, uint8_t *output, int32_t output_len, 22 | uint8_t meta, blosc2_dparams *dparams, const void* chunk); 23 | 24 | #endif /* BLOSC_PLUGINS_CODECS_NDLZ_NDLZ_H */ 25 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /plugins/codecs/zfp/src/block1.h: -------------------------------------------------------------------------------- 1 | #define DIMS 1 2 | -------------------------------------------------------------------------------- /plugins/codecs/zfp/src/block2.h: -------------------------------------------------------------------------------- 1 | #define DIMS 2 2 | -------------------------------------------------------------------------------- /plugins/codecs/zfp/src/block3.h: -------------------------------------------------------------------------------- 1 | #define DIMS 3 2 | -------------------------------------------------------------------------------- /plugins/codecs/zfp/src/block4.h: -------------------------------------------------------------------------------- 1 | #define DIMS 4 2 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /plugins/codecs/zfp/zfp-private.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (c) 2021 Blosc Development Team 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_PLUGINS_CODECS_ZFP_ZFP_PRIVATE_H 12 | #define BLOSC_PLUGINS_CODECS_ZFP_ZFP_PRIVATE_H 13 | 14 | #include 15 | 16 | #define ZFP_MAX_DIM 4 17 | #define ZFP_CELL_SHAPE 4 18 | 19 | #define XXH_INLINE_ALL 20 | 21 | #define ZFP_ERROR_NULL(pointer) \ 22 | do { \ 23 | if ((pointer) == NULL) { \ 24 | return 0; \ 25 | } \ 26 | } while (0) 27 | 28 | #endif /* BLOSC_PLUGINS_CODECS_ZFP_ZFP_PRIVATE_H */ 29 | -------------------------------------------------------------------------------- /plugins/filters/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Blosc - Blocked Shuffling and Compression Library 2 | # 3 | # Copyright (c) 2021 Blosc Development Team 4 | # https://blosc.org 5 | # License: BSD 3-Clause (see LICENSE.txt) 6 | # 7 | # See LICENSE.txt for details about copyright and rights to use. 8 | 9 | add_subdirectory(ndcell) 10 | add_subdirectory(ndmean) 11 | add_subdirectory(bytedelta) 12 | add_subdirectory(int_trunc) 13 | 14 | set(SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/plugins/filters/filters-registry.c PARENT_SCOPE) 15 | -------------------------------------------------------------------------------- /plugins/filters/bytedelta/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Blosc - Blocked Shuffling and Compression Library 2 | # 3 | # Copyright (c) 2021 Blosc Development Team 4 | # https://blosc.org 5 | # License: BSD 3-Clause (see LICENSE.txt) 6 | # 7 | # See LICENSE.txt for details about copyright and rights to use. 8 | 9 | # sources 10 | set(SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/plugins/filters/bytedelta/bytedelta.c PARENT_SCOPE) 11 | 12 | if(BUILD_TESTS) 13 | # targets 14 | add_executable(test_bytedelta test_bytedelta.c) 15 | # Define the BLOSC_TESTING symbol so normally-hidden functions 16 | # are available to the test programs. 17 | set_property( 18 | TARGET test_bytedelta 19 | APPEND PROPERTY COMPILE_DEFINITIONS BLOSC_TESTING) 20 | target_link_libraries(test_bytedelta blosc_testing) 21 | 22 | # tests 23 | add_test(NAME test_plugin_bytedelta 24 | COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) 25 | 26 | endif() 27 | -------------------------------------------------------------------------------- /plugins/filters/bytedelta/bytedelta.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (c) 2021 Blosc Development Team 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_PLUGINS_FILTERS_BYTEDELTA_BYTEDELTA_H 12 | #define BLOSC_PLUGINS_FILTERS_BYTEDELTA_BYTEDELTA_H 13 | 14 | #include "blosc2.h" 15 | 16 | #include 17 | 18 | int bytedelta_forward(const uint8_t* input, uint8_t* output, int32_t length, uint8_t meta, 19 | blosc2_cparams* cparams, uint8_t id); 20 | 21 | int bytedelta_backward(const uint8_t* input, uint8_t* output, int32_t length, uint8_t meta, 22 | blosc2_dparams* dparams, uint8_t id); 23 | 24 | int bytedelta_forward_buggy(const uint8_t* input, uint8_t* output, int32_t length, uint8_t meta, 25 | blosc2_cparams* cparams, uint8_t id); 26 | 27 | int bytedelta_backward_buggy(const uint8_t* input, uint8_t* output, int32_t length, uint8_t meta, 28 | blosc2_dparams* dparams, uint8_t id); 29 | 30 | #endif /* BLOSC_PLUGINS_FILTERS_BYTEDELTA_BYTEDELTA_H */ 31 | -------------------------------------------------------------------------------- /plugins/filters/int_trunc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Blosc - Blocked Shuffling and Compression Library 2 | # 3 | # Copyright (c) 2021 Blosc Development Team 4 | # https://blosc.org 5 | # License: BSD 3-Clause (see LICENSE.txt) 6 | # 7 | # See LICENSE.txt for details about copyright and rights to use. 8 | 9 | # sources 10 | set(SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/plugins/filters/int_trunc/int_trunc.c PARENT_SCOPE) 11 | 12 | if(BUILD_TESTS) 13 | # targets 14 | add_executable(test_int_trunc test_int_trunc.c) 15 | # Define the BLOSC_TESTING symbol so normally-hidden functions 16 | # are available to the test programs. 17 | set_property( 18 | TARGET test_int_trunc 19 | APPEND PROPERTY COMPILE_DEFINITIONS BLOSC_TESTING) 20 | target_link_libraries(test_int_trunc blosc_testing) 21 | 22 | # tests 23 | add_test(NAME test_plugin_int_trunc 24 | COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) 25 | 26 | endif() 27 | -------------------------------------------------------------------------------- /plugins/filters/int_trunc/int_trunc.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (c) 2021 Blosc Development Team 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_FILTER_INT_TRUNC_H 12 | #define BLOSC_FILTER_INT_TRUNC_H 13 | 14 | #include 15 | 16 | int int_trunc_forward(const uint8_t* input, uint8_t* output, int32_t length, uint8_t meta, 17 | blosc2_cparams* cparams, uint8_t id); 18 | 19 | int int_trunc_backward(const uint8_t* input, uint8_t* output, int32_t length, uint8_t meta, 20 | blosc2_dparams* dparams, uint8_t id); 21 | 22 | #endif /* BLOSC_FILTER_INT_TRUNC_H */ 23 | -------------------------------------------------------------------------------- /plugins/filters/ndcell/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # sources 2 | set(SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/plugins/filters/ndcell/ndcell.c 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/*.b2nd) 22 | foreach (data ${TESTS_DATA}) 23 | file(COPY ${data} 24 | DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) 25 | endforeach(data) 26 | endif() 27 | -------------------------------------------------------------------------------- /plugins/filters/ndcell/ndcell.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (c) 2021 Blosc Development Team 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_PLUGINS_FILTERS_NDCELL_NDCELL_H 12 | #define BLOSC_PLUGINS_FILTERS_NDCELL_NDCELL_H 13 | 14 | #include "blosc2.h" 15 | 16 | #define NDCELL_MAX_DIM 8 17 | 18 | 19 | int ndcell_forward(const uint8_t* input, uint8_t* output, int32_t length, uint8_t meta, blosc2_cparams* cparams, uint8_t id); 20 | 21 | int ndcell_backward(const uint8_t* input, uint8_t* output, int32_t length, uint8_t meta, blosc2_dparams* dparams, uint8_t id); 22 | 23 | #endif /* BLOSC_PLUGINS_FILTERS_NDCELL_NDCELL_H */ 24 | -------------------------------------------------------------------------------- /plugins/filters/ndmean/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # sources 2 | set(SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/plugins/filters/ndmean/ndmean.c 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 | endif() 27 | -------------------------------------------------------------------------------- /plugins/filters/ndmean/ndmean.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Copyright (c) 2021 Blosc Development Team 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_PLUGINS_FILTERS_NDMEAN_NDMEAN_H 12 | #define BLOSC_PLUGINS_FILTERS_NDMEAN_NDMEAN_H 13 | 14 | #include "blosc2.h" 15 | 16 | #define NDMEAN_MAX_DIM 8 17 | 18 | 19 | int ndmean_forward(const uint8_t* input, uint8_t* output, int32_t length, uint8_t meta, blosc2_cparams* cparams, uint8_t id); 20 | 21 | int ndmean_backward(const uint8_t* input, uint8_t* output, int32_t length, uint8_t meta, blosc2_dparams* dparams, uint8_t id); 22 | 23 | #endif /* BLOSC_PLUGINS_FILTERS_NDMEAN_NDMEAN_H */ 24 | -------------------------------------------------------------------------------- /plugins/test_data/example_day_month_temp.b2nd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/plugins/test_data/example_day_month_temp.b2nd -------------------------------------------------------------------------------- /plugins/test_data/example_item_prices.b2nd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/plugins/test_data/example_item_prices.b2nd -------------------------------------------------------------------------------- /plugins/tuners/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/plugins/tuners/tuners-registry.c PARENT_SCOPE) 2 | -------------------------------------------------------------------------------- /plugins/tuners/tuners-registry.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2021 The Blosc Developers 3 | https://blosc.org 4 | License: BSD 3-Clause (see LICENSE.txt) 5 | */ 6 | 7 | #include "blosc2/tuners-registry.h" 8 | #include "blosc-private.h" 9 | #include "blosc2.h" 10 | 11 | #include 12 | 13 | void register_tuners(void) { 14 | 15 | blosc2_tuner btune; 16 | btune.id = BLOSC_BTUNE; 17 | btune.name = "btune"; 18 | btune.init = NULL; 19 | btune.next_cparams = NULL; 20 | btune.next_blocksize = NULL; 21 | btune.update = NULL; 22 | btune.free = NULL; 23 | 24 | register_tuner_private(&btune); 25 | } 26 | -------------------------------------------------------------------------------- /tests/.gitignore: -------------------------------------------------------------------------------- 1 | *.exe 2 | -------------------------------------------------------------------------------- /tests/Makefile: -------------------------------------------------------------------------------- 1 | CC=gcc 2 | CFLAGS=-O3 -Wall -pthread 3 | LDFLAGS=-pthread 4 | BLOSC_LIB= $(wildcard ../blosc/*.c) 5 | 6 | # The list of executables 7 | # Generated PNG (intermediate) files 8 | SOURCES := $(wildcard *.c) 9 | EXECUTABLES := $(patsubst %.c, %.exe, $(SOURCES)) 10 | 11 | # Support for internal LZ4 and LZ4HC 12 | LZ4_DIR = ../internal-complibs/lz4-1.7.0 13 | CFLAGS += -I$(LZ4_DIR) 14 | BLOSC_LIB += $(wildcard $(LZ4_DIR)/*.c) 15 | 16 | # Support for external LZ4 and LZ4HC 17 | #LDFLAGS += -llz4 18 | 19 | # Support for external Zlib 20 | LDFLAGS += -DHAVE_ZLIB -lz 21 | 22 | # Support for internal Zlib 23 | #ZLIB_DIR = ../internal-complibs/zlib-1.2.8 24 | #CFLAGS += -DHAVE_ZLIB -I$(ZLIB_DIR) 25 | #BLOSC_LIB += $(wildcard $(ZLIB_DIR)/*.c) 26 | 27 | 28 | # Support for internal Zstd 29 | ZSTD_DIR = ../internal-complibs/zstd-1.2.0 30 | CFLAGS += -DHAVE_ZSTD -I$(ZSTD_DIR) -I$(ZSTD_DIR)/common 31 | BLOSC_LIB += $(wildcard $(ZSTD_DIR)/*/*.c) 32 | 33 | 34 | .PHONY: all 35 | all: $(EXECUTABLES) 36 | 37 | test: $(EXECUTABLES) 38 | sh test_all.sh 39 | 40 | %.exe: %.c $(BLOSC_LIB) 41 | $(CC) $(CFLAGS) $(LDFLAGS) "$<" $(BLOSC_LIB) -o "$@" 42 | 43 | clean: 44 | rm -rf $(EXECUTABLES) 45 | -------------------------------------------------------------------------------- /tests/b2nd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Blosc - Blocked Shuffling and Compression Library 2 | # 3 | # Copyright (c) 2021 Blosc Development Team 4 | # https://blosc.org 5 | # License: BSD 3-Clause (see LICENSE.txt) 6 | # 7 | # See LICENSE.txt for details about copyright and rights to use. 8 | 9 | file(GLOB SOURCES test_*.c) 10 | 11 | foreach (source ${SOURCES}) 12 | get_filename_component(target_name ${source} NAME_WE) 13 | set(target b2nd_${target_name}) 14 | add_executable(${target} ${target_name}.c) 15 | target_link_libraries(${target} blosc2_static ${LIBS}) 16 | add_test(NAME ${target} COMMAND ${target}) 17 | set_tests_properties(${target} PROPERTIES LABELS "b2nd") 18 | endforeach (source) 19 | -------------------------------------------------------------------------------- /tests/fuzz/corpus/README.md: -------------------------------------------------------------------------------- 1 | # Corpus files 2 | 3 | Here are the files for the fuzzer to check. These can be generated with: 4 | 5 | ``` 6 | $ ./tests/generate_inputs_corpus 7 | Blosc version info: 2.0.0.beta.6.dev ($Date:: 2020-04-21 #$) 8 | 9 | *** Creating simple frame for blosclz 10 | Compression ratio: 1953.1 KB -> 32.1 KB (60.8x) 11 | Compression time: 0.00403 s, 472.9 MB/s 12 | Successfully created frame_simple-blosclz.b2frame 13 | 14 | *** Creating simple frame for lz4 15 | Compression ratio: 1953.1 KB -> 40.1 KB (48.7x) 16 | Compression time: 0.00335 s, 569.1 MB/s 17 | Successfully created frame_simple-lz4.b2frame 18 | 19 | *** Creating simple frame for lz4hc 20 | Compression ratio: 1953.1 KB -> 23.2 KB (84.1x) 21 | Compression time: 0.00582 s, 327.9 MB/s 22 | Successfully created frame_simple-lz4hc.b2frame 23 | 24 | *** Creating simple frame for zlib 25 | Compression ratio: 1953.1 KB -> 20.8 KB (94.1x) 26 | Compression time: 0.0082 s, 232.6 MB/s 27 | Successfully created frame_simple-zlib.b2frame 28 | 29 | *** Creating simple frame for zstd 30 | Compression ratio: 1953.1 KB -> 10.8 KB (180.2x) 31 | Compression time: 0.00916 s, 208.3 MB/s 32 | Successfully created frame_simple-zstd.b2frame 33 | ``` 34 | 35 | If you want to copy the new files to the corpus directory, do: 36 | 37 | ``` 38 | $ cp *.b2frame ../tests/fuzz/corpus 39 | ``` 40 | -------------------------------------------------------------------------------- /tests/fuzz/corpus/frame_simple-blosclz.b2frame: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/tests/fuzz/corpus/frame_simple-blosclz.b2frame -------------------------------------------------------------------------------- /tests/fuzz/corpus/frame_simple-lz4.b2frame: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/tests/fuzz/corpus/frame_simple-lz4.b2frame -------------------------------------------------------------------------------- /tests/fuzz/corpus/frame_simple-lz4hc.b2frame: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/tests/fuzz/corpus/frame_simple-lz4hc.b2frame -------------------------------------------------------------------------------- /tests/fuzz/corpus/frame_simple-zlib.b2frame: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/tests/fuzz/corpus/frame_simple-zlib.b2frame -------------------------------------------------------------------------------- /tests/fuzz/corpus/frame_simple-zstd.b2frame: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blosc/c-blosc2/1c2f8bb0c914c43e23b751fbcf6642cd7aec09db/tests/fuzz/corpus/frame_simple-zstd.b2frame -------------------------------------------------------------------------------- /tests/fuzz/fuzz_decompress_chunk.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { 11 | size_t nbytes = 0, cbytes = 0, blocksize = 0; 12 | void *output = NULL; 13 | 14 | if (size < BLOSC_MIN_HEADER_LENGTH) { 15 | return 0; 16 | } 17 | 18 | blosc2_init(); 19 | blosc2_set_nthreads(1); 20 | blosc1_cbuffer_sizes(data, &nbytes, &cbytes, &blocksize); 21 | 22 | if (cbytes != size || nbytes == 0) { 23 | blosc2_destroy(); 24 | return 0; 25 | } 26 | if (blosc1_cbuffer_validate(data, size, &nbytes) != 0) { 27 | /* Unexpected `nbytes` specified in blosc header */ 28 | blosc2_destroy(); 29 | return 0; 30 | } 31 | 32 | output = malloc(cbytes); 33 | if (output != NULL) { 34 | blosc2_decompress(data, (int32_t)size, output, (int32_t)cbytes); 35 | free(output); 36 | } 37 | 38 | blosc2_destroy(); 39 | return 0; 40 | } 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | -------------------------------------------------------------------------------- /tests/fuzz/fuzz_decompress_frame.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { 12 | int32_t i = 0, dsize = 0; 13 | int32_t nchunk = 0; 14 | 15 | blosc2_init(); 16 | blosc2_set_nthreads(1); 17 | 18 | /* Create a super-chunk backed by an in-memory frame */ 19 | blosc2_schunk* schunk = blosc2_schunk_from_buffer((uint8_t *) data, (int64_t)size, false); 20 | if (schunk == NULL) { 21 | blosc2_destroy(); 22 | return 0; 23 | } 24 | /* Don't allow address sanitizer to allocate more than INT32_MAX */ 25 | if (schunk->nbytes >= INT32_MAX) { 26 | blosc2_schunk_free(schunk); 27 | blosc2_destroy(); 28 | return 0; 29 | } 30 | /* Decompress data */ 31 | uint8_t *uncompressed_data = (uint8_t *)malloc((size_t)schunk->nbytes+1); 32 | if (uncompressed_data != NULL) { 33 | for (i = 0, nchunk = 0; nchunk < schunk->nchunks-1; nchunk++) { 34 | dsize = blosc2_schunk_decompress_chunk(schunk, nchunk, uncompressed_data + i, schunk->chunksize); 35 | if (dsize < 0) { 36 | printf("Decompression error. Error code: %d\n", dsize); 37 | break; 38 | } 39 | i += dsize; 40 | } 41 | 42 | free(uncompressed_data); 43 | } 44 | 45 | blosc2_schunk_free(schunk); 46 | blosc2_destroy(); 47 | return 0; 48 | } 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | -------------------------------------------------------------------------------- /tests/fuzz/standalone.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | extern int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); 7 | 8 | int main(int argc, char **argv) { 9 | int i; 10 | fprintf(stderr, "Running %d inputs\n", argc - 1); 11 | 12 | for (i = 1; i < argc; i++) { 13 | size_t len, err, n_read = 0; 14 | uint8_t *buf; 15 | FILE *f = NULL; 16 | 17 | f = fopen(argv[i], "rb+"); 18 | if (f == NULL) { 19 | /* Failed to open this file: it may be a directory. */ 20 | fprintf(stderr, "Skipping: %s\n", argv[i]); 21 | continue; 22 | } 23 | fprintf(stderr, "Running: %s %s\n", argv[0], argv[i]); 24 | 25 | fseek(f, 0, SEEK_END); 26 | len = ftell(f); 27 | fseek(f, 0, SEEK_SET); 28 | 29 | buf = (unsigned char *)malloc(len); 30 | if (buf != NULL) { 31 | n_read = fread(buf, 1, len, f); 32 | assert(n_read == len); 33 | LLVMFuzzerTestOneInput(buf, len); 34 | free(buf); 35 | } 36 | 37 | err = fclose(f); 38 | assert(err == 0); 39 | (void)err; 40 | 41 | fprintf(stderr, "Done: %s: (%d bytes)\n", argv[i], (int)n_read); 42 | } 43 | 44 | return 0; 45 | } 46 | -------------------------------------------------------------------------------- /tests/print_versions.c: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Print versions for Blosc and all its internal compressors. 3 | 4 | Copyright (c) 2021 Blosc Development Team 5 | https://blosc.org 6 | License: BSD 3-Clause (see LICENSE.txt) 7 | 8 | *********************************************************************/ 9 | 10 | #include 11 | #include 12 | #include 13 | #include "blosc2.h" 14 | 15 | 16 | int main(int argc, char* argv[]) { 17 | 18 | char* name = NULL, * version = NULL; 19 | int ret; 20 | 21 | printf("Blosc version: %s (%s)\n", BLOSC2_VERSION_STRING, BLOSC2_VERSION_DATE); 22 | 23 | printf("List of supported compressors in this build: %s\n", 24 | blosc_list_compressors()); 25 | 26 | printf("Supported compression libraries:\n"); 27 | ret = blosc_get_complib_info("blosclz", &name, &version); 28 | if (ret >= 0) printf(" %s: %s\n", name, version); 29 | ret = blosc_get_complib_info("lz4", &name, &version); 30 | if (ret >= 0) printf(" %s: %s\n", name, version); 31 | ret = blosc_get_complib_info("zlib", &name, &version); 32 | if (ret >= 0) printf(" %s: %s\n", name, version); 33 | ret = blosc_get_complib_info("zstd", &name, &version); 34 | if (ret >= 0) printf(" %s: %s\n", name, version); 35 | 36 | return (0); 37 | } 38 | -------------------------------------------------------------------------------- /tests/test_all.sh: -------------------------------------------------------------------------------- 1 | #********************************************************************* 2 | # Blosc - Blocked Shuffling and Compression Library 3 | # 4 | # Unit tests for basic features in Blosc. 5 | # 6 | # Copyright (c) 2010 Blosc Development Team 7 | # https://blosc.org 8 | # License: BSD 3-Clause (see LICENSE.txt) 9 | # 10 | # See LICENSE.txt for details about copyright and rights to use. 11 | #********************************************************************** 12 | 13 | for exe in $(ls *.exe); do 14 | ./$exe 15 | done 16 | -------------------------------------------------------------------------------- /tests/test_empty_buffer.c: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Blosc - Blocked Shuffling and Compression Library 3 | 4 | Unit tests for the blosc1_decompress() function. 5 | 6 | Copyright (c) 2021 Blosc Development Team 7 | https://blosc.org 8 | License: BSD 3-Clause (see LICENSE.txt) 9 | 10 | See LICENSE.txt for details about copyright and rights to use. 11 | **********************************************************************/ 12 | 13 | #include 14 | #include "test_common.h" 15 | 16 | /** Test the blosc1_decompress function. */ 17 | static char* test_empty_buffer(int clevel, int do_shuffle, int32_t typesize) { 18 | void* buf = NULL; 19 | int buf_size = 0; 20 | int csize, dsize; 21 | void* dest = malloc(0 + BLOSC2_MAX_OVERHEAD); 22 | 23 | csize = blosc2_compress(clevel, do_shuffle, typesize, buf, buf_size, dest, 0 + BLOSC2_MAX_OVERHEAD); 24 | mu_assert("ERROR: Compression error.", csize > 0); 25 | 26 | void* decomp = NULL; 27 | dsize = blosc1_decompress(dest, decomp, 0); 28 | free(dest); 29 | mu_assert("ERROR: in blosc1_decompress.", dsize >= 0); 30 | 31 | return EXIT_SUCCESS; 32 | } 33 | 34 | 35 | int main(void) { 36 | /* Initialize blosc before running tests. */ 37 | blosc2_init(); 38 | char* result = test_empty_buffer(3, BLOSC_NOSHUFFLE, 1); 39 | if (result != EXIT_SUCCESS) { 40 | printf(" (%s)\n", result); 41 | } 42 | else { 43 | printf(" ALL TESTS PASSED"); 44 | } 45 | 46 | /* Cleanup blosc resources. */ 47 | blosc2_destroy(); 48 | return result != EXIT_SUCCESS; 49 | 50 | } 51 | -------------------------------------------------------------------------------- /tests/test_filters.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define NCHUNKS 1 6 | #define TYPESIZE 2 7 | #define LEN 39 8 | #define CHUNKSIZE (TYPESIZE * LEN) 9 | 10 | int main(void) { 11 | blosc2_init(); 12 | srand(0); 13 | if (blosc2_compname_to_compcode("zstd") < 0) { 14 | // We need ZSTD for the test here... 15 | return 0; 16 | } 17 | 18 | uint16_t *ref_data = (uint16_t *)malloc(CHUNKSIZE); 19 | uint16_t *data_dest = (uint16_t *)malloc(CHUNKSIZE); 20 | for (int i = 0; i < LEN; i++) { 21 | ref_data[i] = rand() % 118; 22 | } 23 | blosc2_cparams cparams = BLOSC2_CPARAMS_DEFAULTS; 24 | cparams.compcode = BLOSC_ZSTD; 25 | cparams.filters[BLOSC2_MAX_FILTERS - 2] = BLOSC_BITSHUFFLE; 26 | cparams.filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_SHUFFLE; 27 | 28 | blosc2_dparams dparams = BLOSC2_DPARAMS_DEFAULTS; 29 | 30 | cparams.typesize = TYPESIZE; 31 | blosc2_storage storage = {.contiguous=false, .urlpath=NULL, .cparams=&cparams, .dparams=&dparams}; 32 | 33 | blosc2_schunk* schunk = blosc2_schunk_new(&storage); 34 | blosc2_schunk_append_buffer(schunk, ref_data, CHUNKSIZE); 35 | 36 | blosc2_schunk_decompress_chunk(schunk, 0, data_dest, CHUNKSIZE); 37 | for (int i = 0; i < LEN; i++) { 38 | if (data_dest[i] != ref_data[i]) { 39 | printf("Decompressed data differs from original %d, %d, %d!\n", 40 | i, ref_data[i], data_dest[i]); 41 | return -1; 42 | } 43 | } 44 | 45 | printf("Successful roundtrip data <-> schunk !\n"); 46 | 47 | blosc2_schunk_free(schunk); 48 | blosc2_destroy(); 49 | return 0; 50 | } 51 | --------------------------------------------------------------------------------