diff --git a/ThirdParty/zfp/CMakeLists.txt b/ThirdParty/zfp/CMakeLists.txt deleted file mode 100644 index 9039e12c651ab9746530fe855466602520ba0b10..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -vtk_module_third_party_internal( - LICENSE_FILES - "vtkzfp/LICENSE" - SPDX_LICENSE_IDENTIFIER - "BSD-3-Clause" - SPDX_COPYRIGHT_TEXT - "Copyright (c) 2014-2019, Lawrence Livermore National Security, LLC." - SPDX_DOWNLOAD_LOCATION - "git+https://gitlab.kitware.com/third-party/zfp.git@for/vtk-20190605-0.5.5" - VERSION - "0.5.5" - STANDARD_INCLUDE_DIRS) - -configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/vtk_zfp.h.in" - "${CMAKE_CURRENT_BINARY_DIR}/vtk_zfp.h") - -vtk_module_install_headers( - FILES "${CMAKE_CURRENT_BINARY_DIR}/vtk_zfp.h") diff --git a/ThirdParty/zfp/Testing/CMakeLists.txt b/ThirdParty/zfp/Testing/CMakeLists.txt deleted file mode 100644 index 35f9732a938a3b073bdf94e86007916ffcd31b49..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/Testing/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(Cxx) diff --git a/ThirdParty/zfp/Testing/Cxx/CMakeLists.txt b/ThirdParty/zfp/Testing/Cxx/CMakeLists.txt deleted file mode 100644 index bbd0f7ac83e4c17e4fea8fed5adbba7f07e40a79..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/Testing/Cxx/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -vtk_add_test_cxx(vtkzfpCxxTests tests - NO_DATA NO_VALID NO_OUTPUT - TestIncludeZFP.cxx) -vtk_test_cxx_executable(vtkzfpCxxTests tests) diff --git a/ThirdParty/zfp/Testing/Cxx/TestIncludeZFP.cxx b/ThirdParty/zfp/Testing/Cxx/TestIncludeZFP.cxx deleted file mode 100644 index c876d12ef92b597a75fc699d2968efe752d921fa..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/Testing/Cxx/TestIncludeZFP.cxx +++ /dev/null @@ -1,8 +0,0 @@ -#include "vtk_zfp.h" - -#include <cstdlib> - -int TestIncludeZFP(int /*argc*/, char* /*argv*/[]) -{ - return EXIT_SUCCESS; -} diff --git a/ThirdParty/zfp/update.sh b/ThirdParty/zfp/update.sh deleted file mode 100755 index 8cd7463d0d30a83f6c30a1a20bd7c99dfe21d674..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/update.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -x -shopt -s dotglob - -readonly name="zfp" -readonly ownership="Zfp Upstream <kwrobot@kitware.com>" -readonly subtree="ThirdParty/$name/vtk$name" -readonly repo="https://gitlab.kitware.com/third-party/zfp.git" -readonly tag="for/vtk-20190605-0.5.5" -readonly paths=" -.gitattributes -CMakeLists.vtk.txt - -include/ -array/ -src/inline/ -src/template/ -src/share/ -src/*.c -src/*.h - -LICENSE -README.md -README.kitware.md -" - -extract_source () { - git_archive - pushd "$extractdir/$name-reduced" - mv -v CMakeLists.vtk.txt CMakeLists.txt - mv -v array/zfp/* include/zfp/ - rmdir -v array/zfp/ - mv -v array/* include/ - rmdir -v array/ - popd -} - -. "${BASH_SOURCE%/*}/../update-common.sh" diff --git a/ThirdParty/zfp/vtk.module b/ThirdParty/zfp/vtk.module deleted file mode 100644 index f3dca65fdc86880a416c6e1ba2877fdb98e6e38e..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtk.module +++ /dev/null @@ -1,7 +0,0 @@ -NAME - VTK::zfp -LIBRARY_NAME - vtkzfp -TEST_DEPENDS - VTK::TestingCore -THIRD_PARTY diff --git a/ThirdParty/zfp/vtk_zfp.h.in b/ThirdParty/zfp/vtk_zfp.h.in deleted file mode 100644 index 18d8234c956b3a511f019cb4e9fc5dd9897bcc46..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtk_zfp.h.in +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen -// SPDX-License-Identifier: BSD-3-Clause -#ifndef vtk_zfp_h -#define vtk_zfp_h - -/* Use the zfp library configured for VTK. */ -#cmakedefine01 VTK_MODULE_USE_EXTERNAL_vtkzfp - -#if VTK_MODULE_USE_EXTERNAL_vtkzfp -# include <zfp.h> -#else -# include <vtkzfp/include/zfp.h> -#endif - -#endif diff --git a/ThirdParty/zfp/vtkzfp/.gitattributes b/ThirdParty/zfp/vtkzfp/.gitattributes deleted file mode 100644 index f3a990fba170ea628e3adf771d1f82988fbeffe8..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -# XXX(kitware): Ignore whitespace issues. -* -whitespace diff --git a/ThirdParty/zfp/vtkzfp/CMakeLists.txt b/ThirdParty/zfp/vtkzfp/CMakeLists.txt deleted file mode 100644 index 3423c692f34950940f6a8bd2ef406047d17137e5..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/CMakeLists.txt +++ /dev/null @@ -1,62 +0,0 @@ -set(sources - src/bitstream.c - src/block1.h - src/block2.h - src/block3.h - src/block4.h - src/decode1d.c - src/decode1f.c - src/decode1i.c - src/decode1l.c - src/decode2d.c - src/decode2f.c - src/decode2i.c - src/decode2l.c - src/decode3d.c - src/decode3f.c - src/decode3i.c - src/decode3l.c - src/decode4d.c - src/decode4f.c - src/decode4i.c - src/decode4l.c - src/encode1d.c - src/encode1f.c - src/encode1i.c - src/encode1l.c - src/encode2d.c - src/encode2f.c - src/encode2i.c - src/encode2l.c - src/encode3d.c - src/encode3f.c - src/encode3i.c - src/encode3l.c - src/encode4d.c - src/encode4f.c - src/encode4i.c - src/encode4l.c - src/traitsd.h - src/traitsf.h - src/zfp.c) - -vtk_module_add_module(VTK::zfp - SOURCES ${sources}) -target_include_directories(zfp - PRIVATE - "${CMAKE_CURRENT_SOURCE_DIR}/include") - -if (NOT WIN32 OR CYGWIN) - target_link_libraries(zfp - PRIVATE - m) -endif () -if (WIN32) - target_compile_definitions(zfp - PRIVATE - ZFP_SOURCE) -endif () - -vtk_module_install_headers( - DIRECTORIES "include" - SUBDIR "vtkzfp") diff --git a/ThirdParty/zfp/vtkzfp/LICENSE b/ThirdParty/zfp/vtkzfp/LICENSE deleted file mode 100644 index 093449a33882bdddac369d06d16b81734ae01f09..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/LICENSE +++ /dev/null @@ -1,57 +0,0 @@ -Copyright (c) 2014-2019, Lawrence Livermore National Security, LLC. -Produced at the Lawrence Livermore National Laboratory. -Written by Peter Lindstrom, Markus Salasoo, Matt Larsen, and Stephen Herbein. -LLNL-CODE-663824. -All rights reserved. - -This file is part of the zfp library. -For details, see http://computation.llnl.gov/casc/zfp/. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, -this list of conditions and the disclaimer below. - -2. Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the disclaimer (as noted below) in the -documentation and/or other materials provided with the distribution. - -3. Neither the name of the LLNS/LLNL nor the names of its contributors may -be used to endorse or promote products derived from this software without -specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY, -LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -Additional BSD Notice - -1. This notice is required to be provided under our contract with the U.S. -Department of Energy (DOE). This work was produced at Lawrence Livermore -National Laboratory under Contract No. DE-AC52-07NA27344 with the DOE. - -2. Neither the United States Government nor Lawrence Livermore National -Security, LLC nor any of their employees, makes any warranty, express or -implied, or assumes any liability or responsibility for the accuracy, -completeness, or usefulness of any information, apparatus, product, or -process disclosed, or represents that its use would not infringe -privately-owned rights. - -3. Also, reference herein to any specific commercial products, process, or -services by trade name, trademark, manufacturer or otherwise does not -necessarily constitute or imply its endorsement, recommendation, or -favoring by the United States Government or Lawrence Livermore National -Security, LLC. The views and opinions of authors expressed herein do not -necessarily state or reflect those of the United States Government or -Lawrence Livermore National Security, LLC, and shall not be used for -advertising or product endorsement purposes. diff --git a/ThirdParty/zfp/vtkzfp/README.kitware.md b/ThirdParty/zfp/vtkzfp/README.kitware.md deleted file mode 100644 index 0a0472baf6b95bdfaf3c3b84d29a70b23e853d3a..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/README.kitware.md +++ /dev/null @@ -1,11 +0,0 @@ -# ZFP for for VTK - -This branch contains changes required to embed the ZFP library into VTK. This -includes changes made primarily to the build system to allow it to be embedded -into another source tree as well as a header to facilitate mangling of the -symbols to avoid conflicts with other copies of the library within a single -process. - - * Add attributes to pass commit checks within VTK. - * Add a CMake build system to the project. - * Mangle all exported symbols to have a `vtkzfp_` prefix. diff --git a/ThirdParty/zfp/vtkzfp/README.md b/ThirdParty/zfp/vtkzfp/README.md deleted file mode 100644 index 2fd5fa328967559a6708c892dd12761a7a9e14e5..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/README.md +++ /dev/null @@ -1,142 +0,0 @@ -ZFP -=== -[](https://travis-ci.org/LLNL/zfp) -[](https://ci.appveyor.com/project/salasoom/zfp) -[](https://zfp.readthedocs.io/en/release0.5.5/?badge=release0.5.5) -[](https://codecov.io/gh/LLNL/zfp) - -INTRODUCTION ------------- - -zfp is an open source C/C++ library for compressed numerical arrays that -support high throughput read and write random access. zfp also supports -streaming compression of integer and floating-point data, e.g., for -applications that read and write large data sets to and from disk. -zfp is primarily written in C and C++ but also includes Python and -Fortran bindings. - -zfp was developed at Lawrence Livermore National Laboratory and is loosely -based on the algorithm described in the following paper: - - Peter Lindstrom - "Fixed-Rate Compressed Floating-Point Arrays" - IEEE Transactions on Visualization and Computer Graphics - 20(12):2674-2683, December 2014 - doi:10.1109/TVCG.2014.2346458 - -zfp was originally designed for floating-point arrays only, but has been -extended to also support integer data and could for instance be used to -compress images and quantized volumetric data. To achieve high compression -ratios, zfp generally uses lossy but optionally error-bounded compression. -Bit-for-bit lossless compression is also possible through one of zfp's -compression modes. - -zfp works best for 2D and 3D arrays that exhibit spatial correlation, such as -continuous fields from physics simulations, images, regularly sampled terrain -surfaces, etc. Although zfp also provides a 1D array class that can be used -for 1D signals such as audio, or even unstructured floating-point streams, -the compression scheme has not been well optimized for this use case, and -rate and quality may not be competitive with floating-point compressors -designed specifically for 1D streams. zfp also supports compression of -4D arrays. - -zfp is freely available as open source under a BSD license, as outlined in -the file 'LICENSE'. For more information on zfp and comparisons with other -compressors, please see the -[zfp website](https://computation.llnl.gov/projects/floating-point-compression). -For bug reports, please consult the -[GitHub issue tracker](https://github.com/LLNL/zfp/issues). -For questions, comments, and requests, please contact -[Peter Lindstrom](mailto:pl@llnl.gov). - - -DOCUMENTATION -------------- - -Full -[documentation](http://zfp.readthedocs.io/en/release0.5.5/) -is available online via Read the Docs. A -[PDF](http://readthedocs.org/projects/zfp/downloads/pdf/release0.5.5/) -version is also available. - - -INSTALLATION ------------- - -zfp consists of three distinct parts: a compression library written in C; -a set of C++ header files with C wrappers that implement compressed arrays; -and a set of C and C++ examples. The main compression codec is written in -C and should conform to both the ISO C89 and C99 standards. The C++ array -classes are implemented entirely in header files and can be included as is, -but since they call the compression library, applications must link with -libzfp. - -On Linux, macOS, and MinGW, zfp is easiest compiled using gcc and gmake. -CMake support is also available, e.g., for Windows builds. See below for -instructions on GNU and CMake builds. - -zfp has successfully been built and tested using these compilers: - - gcc versions 4.4.7, 4.9.4, 5.5.0, 6.1.0, 6.4.0, 7.1.0, 7.3.0, 8.1.0 - icc versions 15.0.6, 16.0.4, 17.0.2, 18.0.2, 19.0.0 - clang versions 3.9.1, 4.0.0, 5.0.0, 6.0.0 - MinGW version 5.3.0 - Visual Studio versions 14 (2015), 15 (2017) - -zfp conforms to various language standards, including C89, C99, C11, -C++98, C++11, and C++14. - -NOTE: zfp requires 64-bit compiler and operating system support. - -## GNU builds - -To build zfp using gcc, type - - make - -from this directory. This builds libzfp as a static library as well as -utilities and example programs. See documentation for complete build -instructions. - -## CMake builds - -To build zfp using CMake on Linux or macOS, start a Unix shell and type - - mkdir build - cd build - cmake .. - make - -To also build the examples, replace the cmake line with - - cmake -DBUILD_EXAMPLES=ON .. - -To build zfp using Visual Studio on Windows, start a DOS shell, cd to the -top-level zfp directory, and type - - mkdir build - cd build - cmake .. - cmake --build . --config Release - -This builds zfp in release mode. Replace 'Release' with 'Debug' to build -zfp in debug mode. See the instructions for Linux on how to change the -cmake line to also build the example programs. - -## Testing - -To test that zfp is working properly, type - - make test - -or using CMake - - ctest - -If the compilation or regression tests fail, it is possible that some of the -macros in the file 'Config' have to be adjusted. Also, the tests may fail -due to minute differences in the computed floating-point fields being -compressed, which will be indicated by checksum errors. If most tests -succeed and the failures result in byte sizes and error values reasonably -close to the expected values, then it is likely that the compressor is -working correctly. diff --git a/ThirdParty/zfp/vtkzfp/include/bitstream.h b/ThirdParty/zfp/vtkzfp/include/bitstream.h deleted file mode 100644 index 3bd25214a78449f92e04c853c6261b9d2eeb40ea..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/bitstream.h +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef ZFP_BITSTREAM_H -#define ZFP_BITSTREAM_H - -#include <stddef.h> -#include "zfp/types.h" -#include "zfp/system.h" - -#include "vtk_zfp_mangle.h" - -/* forward declaration of opaque type */ -typedef struct bitstream bitstream; - -extern_ const size_t stream_word_bits; /* bit stream granularity */ - -#ifndef inline_ -#ifdef __cplusplus -extern "C" { -#endif - -/* allocate and initialize bit stream */ -bitstream* stream_open(void* buffer, size_t bytes); - -/* close and deallocate bit stream */ -void stream_close(bitstream* stream); - -/* make a copy of bit stream to shared memory buffer */ -bitstream* stream_clone(const bitstream* stream); - -/* pointer to beginning of stream */ -void* stream_data(const bitstream* stream); - -/* current byte size of stream (if flushed) */ -size_t stream_size(const bitstream* stream); - -/* byte capacity of stream */ -size_t stream_capacity(const bitstream* stream); - -/* number of words per block */ -size_t stream_stride_block(const bitstream* stream); - -/* number of blocks between consecutive blocks */ -ptrdiff_t stream_stride_delta(const bitstream* stream); - -/* read single bit (0 or 1) */ -uint stream_read_bit(bitstream* stream); - -/* write single bit */ -uint stream_write_bit(bitstream* stream, uint bit); - -/* read 0 <= n <= 64 bits */ -uint64 stream_read_bits(bitstream* stream, uint n); - -/* write 0 <= n <= 64 low bits of value and return remaining bits */ -uint64 stream_write_bits(bitstream* stream, uint64 value, uint n); - -/* return bit offset to next bit to be read */ -size_t stream_rtell(const bitstream* stream); - -/* return bit offset to next bit to be written */ -size_t stream_wtell(const bitstream* stream); - -/* rewind stream to beginning */ -void stream_rewind(bitstream* stream); - -/* position stream for reading at given bit offset */ -void stream_rseek(bitstream* stream, size_t offset); - -/* position stream for writing at given bit offset */ -void stream_wseek(bitstream* stream, size_t offset); - -/* skip over the next n bits */ -void stream_skip(bitstream* stream, uint n); - -/* append n zero-bits to stream */ -void stream_pad(bitstream* stream, uint n); - -/* align stream on next word boundary */ -size_t stream_align(bitstream* stream); - -/* flush out any remaining buffered bits */ -size_t stream_flush(bitstream* stream); - -/* copy n bits from one bit stream to another */ -void stream_copy(bitstream* dst, bitstream* src, size_t n); - -#ifdef BIT_STREAM_STRIDED -/* set block size in number of words and spacing in number of blocks */ -int stream_set_stride(bitstream* stream, size_t block, ptrdiff_t delta); -#endif - -#ifdef __cplusplus -} -#endif -#endif /* !inline_ */ - -#endif diff --git a/ThirdParty/zfp/vtkzfp/include/vtk_zfp_mangle.h b/ThirdParty/zfp/vtkzfp/include/vtk_zfp_mangle.h deleted file mode 100644 index bc2e7874ac819412cbff655ffac56d24e5ac5697..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/vtk_zfp_mangle.h +++ /dev/null @@ -1,178 +0,0 @@ -#ifndef ZFP_MANGLE_H -#define ZFP_MANGLE_H - -#define stream_align vtkzfp_stream_align -#define stream_capacity vtkzfp_stream_capacity -#define stream_close vtkzfp_stream_close -#define stream_data vtkzfp_stream_data -#define stream_flush vtkzfp_stream_flush -#define stream_open vtkzfp_stream_open -#define stream_pad vtkzfp_stream_pad -#define stream_read_bit vtkzfp_stream_read_bit -#define stream_read_bits vtkzfp_stream_read_bits -#define stream_rewind vtkzfp_stream_rewind -#define stream_rseek vtkzfp_stream_rseek -#define stream_rtell vtkzfp_stream_rtell -#define stream_size vtkzfp_stream_size -#define stream_skip vtkzfp_stream_skip -#define stream_stride_block vtkzfp_stream_stride_block -#define stream_stride_delta vtkzfp_stream_stride_delta -#define stream_word_bits vtkzfp_stream_word_bits -#define stream_write_bit vtkzfp_stream_write_bit -#define stream_write_bits vtkzfp_stream_write_bits -#define stream_wseek vtkzfp_stream_wseek -#define stream_wtell vtkzfp_stream_wtell -#define zfp_codec_version vtkzfp_zfp_codec_version -#define zfp_compress vtkzfp_zfp_compress -#define zfp_decode_block_double_1 vtkzfp_zfp_decode_block_double_1 -#define zfp_decode_block_double_2 vtkzfp_zfp_decode_block_double_2 -#define zfp_decode_block_double_3 vtkzfp_zfp_decode_block_double_3 -#define zfp_decode_block_double_4 vtkzfp_zfp_decode_block_double_4 -#define zfp_decode_block_float_1 vtkzfp_zfp_decode_block_float_1 -#define zfp_decode_block_float_2 vtkzfp_zfp_decode_block_float_2 -#define zfp_decode_block_float_3 vtkzfp_zfp_decode_block_float_3 -#define zfp_decode_block_float_4 vtkzfp_zfp_decode_block_float_4 -#define zfp_decode_block_int32_1 vtkzfp_zfp_decode_block_int32_1 -#define zfp_decode_block_int32_2 vtkzfp_zfp_decode_block_int32_2 -#define zfp_decode_block_int32_3 vtkzfp_zfp_decode_block_int32_3 -#define zfp_decode_block_int32_4 vtkzfp_zfp_decode_block_int32_4 -#define zfp_decode_block_int64_1 vtkzfp_zfp_decode_block_int64_1 -#define zfp_decode_block_int64_2 vtkzfp_zfp_decode_block_int64_2 -#define zfp_decode_block_int64_3 vtkzfp_zfp_decode_block_int64_3 -#define zfp_decode_block_int64_4 vtkzfp_zfp_decode_block_int64_4 -#define zfp_decode_block_strided_double_1 vtkzfp_zfp_decode_block_strided_double_1 -#define zfp_decode_block_strided_double_2 vtkzfp_zfp_decode_block_strided_double_2 -#define zfp_decode_block_strided_double_3 vtkzfp_zfp_decode_block_strided_double_3 -#define zfp_decode_block_strided_double_4 vtkzfp_zfp_decode_block_strided_double_4 -#define zfp_decode_block_strided_float_1 vtkzfp_zfp_decode_block_strided_float_1 -#define zfp_decode_block_strided_float_2 vtkzfp_zfp_decode_block_strided_float_2 -#define zfp_decode_block_strided_float_3 vtkzfp_zfp_decode_block_strided_float_3 -#define zfp_decode_block_strided_float_4 vtkzfp_zfp_decode_block_strided_float_4 -#define zfp_decode_block_strided_int32_1 vtkzfp_zfp_decode_block_strided_int32_1 -#define zfp_decode_block_strided_int32_2 vtkzfp_zfp_decode_block_strided_int32_2 -#define zfp_decode_block_strided_int32_3 vtkzfp_zfp_decode_block_strided_int32_3 -#define zfp_decode_block_strided_int32_4 vtkzfp_zfp_decode_block_strided_int32_4 -#define zfp_decode_block_strided_int64_1 vtkzfp_zfp_decode_block_strided_int64_1 -#define zfp_decode_block_strided_int64_2 vtkzfp_zfp_decode_block_strided_int64_2 -#define zfp_decode_block_strided_int64_3 vtkzfp_zfp_decode_block_strided_int64_3 -#define zfp_decode_block_strided_int64_4 vtkzfp_zfp_decode_block_strided_int64_4 -#define zfp_decode_partial_block_strided_double_1 vtkzfp_zfp_decode_partial_block_strided_double_1 -#define zfp_decode_partial_block_strided_double_2 vtkzfp_zfp_decode_partial_block_strided_double_2 -#define zfp_decode_partial_block_strided_double_3 vtkzfp_zfp_decode_partial_block_strided_double_3 -#define zfp_decode_partial_block_strided_double_4 vtkzfp_zfp_decode_partial_block_strided_double_4 -#define zfp_decode_partial_block_strided_float_1 vtkzfp_zfp_decode_partial_block_strided_float_1 -#define zfp_decode_partial_block_strided_float_2 vtkzfp_zfp_decode_partial_block_strided_float_2 -#define zfp_decode_partial_block_strided_float_3 vtkzfp_zfp_decode_partial_block_strided_float_3 -#define zfp_decode_partial_block_strided_float_4 vtkzfp_zfp_decode_partial_block_strided_float_4 -#define zfp_decode_partial_block_strided_int32_1 vtkzfp_zfp_decode_partial_block_strided_int32_1 -#define zfp_decode_partial_block_strided_int32_2 vtkzfp_zfp_decode_partial_block_strided_int32_2 -#define zfp_decode_partial_block_strided_int32_3 vtkzfp_zfp_decode_partial_block_strided_int32_3 -#define zfp_decode_partial_block_strided_int32_4 vtkzfp_zfp_decode_partial_block_strided_int32_4 -#define zfp_decode_partial_block_strided_int64_1 vtkzfp_zfp_decode_partial_block_strided_int64_1 -#define zfp_decode_partial_block_strided_int64_2 vtkzfp_zfp_decode_partial_block_strided_int64_2 -#define zfp_decode_partial_block_strided_int64_3 vtkzfp_zfp_decode_partial_block_strided_int64_3 -#define zfp_decode_partial_block_strided_int64_4 vtkzfp_zfp_decode_partial_block_strided_int64_4 -#define zfp_decompress vtkzfp_zfp_decompress -#define zfp_demote_int32_to_int16 vtkzfp_zfp_demote_int32_to_int16 -#define zfp_demote_int32_to_int8 vtkzfp_zfp_demote_int32_to_int8 -#define zfp_demote_int32_to_uint16 vtkzfp_zfp_demote_int32_to_uint16 -#define zfp_demote_int32_to_uint8 vtkzfp_zfp_demote_int32_to_uint8 -#define zfp_encode_block_double_1 vtkzfp_zfp_encode_block_double_1 -#define zfp_encode_block_double_2 vtkzfp_zfp_encode_block_double_2 -#define zfp_encode_block_double_3 vtkzfp_zfp_encode_block_double_3 -#define zfp_encode_block_double_4 vtkzfp_zfp_encode_block_double_4 -#define zfp_encode_block_float_1 vtkzfp_zfp_encode_block_float_1 -#define zfp_encode_block_float_2 vtkzfp_zfp_encode_block_float_2 -#define zfp_encode_block_float_3 vtkzfp_zfp_encode_block_float_3 -#define zfp_encode_block_float_4 vtkzfp_zfp_encode_block_float_4 -#define zfp_encode_block_int32_1 vtkzfp_zfp_encode_block_int32_1 -#define zfp_encode_block_int32_2 vtkzfp_zfp_encode_block_int32_2 -#define zfp_encode_block_int32_3 vtkzfp_zfp_encode_block_int32_3 -#define zfp_encode_block_int32_4 vtkzfp_zfp_encode_block_int32_4 -#define zfp_encode_block_int64_1 vtkzfp_zfp_encode_block_int64_1 -#define zfp_encode_block_int64_2 vtkzfp_zfp_encode_block_int64_2 -#define zfp_encode_block_int64_3 vtkzfp_zfp_encode_block_int64_3 -#define zfp_encode_block_int64_4 vtkzfp_zfp_encode_block_int64_4 -#define zfp_encode_block_strided_double_1 vtkzfp_zfp_encode_block_strided_double_1 -#define zfp_encode_block_strided_double_2 vtkzfp_zfp_encode_block_strided_double_2 -#define zfp_encode_block_strided_double_3 vtkzfp_zfp_encode_block_strided_double_3 -#define zfp_encode_block_strided_double_4 vtkzfp_zfp_encode_block_strided_double_4 -#define zfp_encode_block_strided_float_1 vtkzfp_zfp_encode_block_strided_float_1 -#define zfp_encode_block_strided_float_2 vtkzfp_zfp_encode_block_strided_float_2 -#define zfp_encode_block_strided_float_3 vtkzfp_zfp_encode_block_strided_float_3 -#define zfp_encode_block_strided_float_4 vtkzfp_zfp_encode_block_strided_float_4 -#define zfp_encode_block_strided_int32_1 vtkzfp_zfp_encode_block_strided_int32_1 -#define zfp_encode_block_strided_int32_2 vtkzfp_zfp_encode_block_strided_int32_2 -#define zfp_encode_block_strided_int32_3 vtkzfp_zfp_encode_block_strided_int32_3 -#define zfp_encode_block_strided_int32_4 vtkzfp_zfp_encode_block_strided_int32_4 -#define zfp_encode_block_strided_int64_1 vtkzfp_zfp_encode_block_strided_int64_1 -#define zfp_encode_block_strided_int64_2 vtkzfp_zfp_encode_block_strided_int64_2 -#define zfp_encode_block_strided_int64_3 vtkzfp_zfp_encode_block_strided_int64_3 -#define zfp_encode_block_strided_int64_4 vtkzfp_zfp_encode_block_strided_int64_4 -#define zfp_encode_partial_block_strided_double_1 vtkzfp_zfp_encode_partial_block_strided_double_1 -#define zfp_encode_partial_block_strided_double_2 vtkzfp_zfp_encode_partial_block_strided_double_2 -#define zfp_encode_partial_block_strided_double_3 vtkzfp_zfp_encode_partial_block_strided_double_3 -#define zfp_encode_partial_block_strided_double_4 vtkzfp_zfp_encode_partial_block_strided_double_4 -#define zfp_encode_partial_block_strided_float_1 vtkzfp_zfp_encode_partial_block_strided_float_1 -#define zfp_encode_partial_block_strided_float_2 vtkzfp_zfp_encode_partial_block_strided_float_2 -#define zfp_encode_partial_block_strided_float_3 vtkzfp_zfp_encode_partial_block_strided_float_3 -#define zfp_encode_partial_block_strided_float_4 vtkzfp_zfp_encode_partial_block_strided_float_4 -#define zfp_encode_partial_block_strided_int32_1 vtkzfp_zfp_encode_partial_block_strided_int32_1 -#define zfp_encode_partial_block_strided_int32_2 vtkzfp_zfp_encode_partial_block_strided_int32_2 -#define zfp_encode_partial_block_strided_int32_3 vtkzfp_zfp_encode_partial_block_strided_int32_3 -#define zfp_encode_partial_block_strided_int32_4 vtkzfp_zfp_encode_partial_block_strided_int32_4 -#define zfp_encode_partial_block_strided_int64_1 vtkzfp_zfp_encode_partial_block_strided_int64_1 -#define zfp_encode_partial_block_strided_int64_2 vtkzfp_zfp_encode_partial_block_strided_int64_2 -#define zfp_encode_partial_block_strided_int64_3 vtkzfp_zfp_encode_partial_block_strided_int64_3 -#define zfp_encode_partial_block_strided_int64_4 vtkzfp_zfp_encode_partial_block_strided_int64_4 -#define zfp_field_1d vtkzfp_zfp_field_1d -#define zfp_field_2d vtkzfp_zfp_field_2d -#define zfp_field_3d vtkzfp_zfp_field_3d -#define zfp_field_4d vtkzfp_zfp_field_4d -#define zfp_field_alloc vtkzfp_zfp_field_alloc -#define zfp_field_dimensionality vtkzfp_zfp_field_dimensionality -#define zfp_field_free vtkzfp_zfp_field_free -#define zfp_field_metadata vtkzfp_zfp_field_metadata -#define zfp_field_pointer vtkzfp_zfp_field_pointer -#define zfp_field_precision vtkzfp_zfp_field_precision -#define zfp_field_set_metadata vtkzfp_zfp_field_set_metadata -#define zfp_field_set_pointer vtkzfp_zfp_field_set_pointer -#define zfp_field_set_size_1d vtkzfp_zfp_field_set_size_1d -#define zfp_field_set_size_2d vtkzfp_zfp_field_set_size_2d -#define zfp_field_set_size_3d vtkzfp_zfp_field_set_size_3d -#define zfp_field_set_size_4d vtkzfp_zfp_field_set_size_4d -#define zfp_field_set_stride_1d vtkzfp_zfp_field_set_stride_1d -#define zfp_field_set_stride_2d vtkzfp_zfp_field_set_stride_2d -#define zfp_field_set_stride_3d vtkzfp_zfp_field_set_stride_3d -#define zfp_field_set_stride_4d vtkzfp_zfp_field_set_stride_4d -#define zfp_field_set_type vtkzfp_zfp_field_set_type -#define zfp_field_size vtkzfp_zfp_field_size -#define zfp_field_stride vtkzfp_zfp_field_stride -#define zfp_field_type vtkzfp_zfp_field_type -#define zfp_library_version vtkzfp_zfp_library_version -#define zfp_promote_int16_to_int32 vtkzfp_zfp_promote_int16_to_int32 -#define zfp_promote_int8_to_int32 vtkzfp_zfp_promote_int8_to_int32 -#define zfp_promote_uint16_to_int32 vtkzfp_zfp_promote_uint16_to_int32 -#define zfp_promote_uint8_to_int32 vtkzfp_zfp_promote_uint8_to_int32 -#define zfp_read_header vtkzfp_zfp_read_header -#define zfp_stream_align vtkzfp_zfp_stream_align -#define zfp_stream_bit_stream vtkzfp_zfp_stream_bit_stream -#define zfp_stream_close vtkzfp_zfp_stream_close -#define zfp_stream_compressed_size vtkzfp_zfp_stream_compressed_size -#define zfp_stream_flush vtkzfp_zfp_stream_flush -#define zfp_stream_maximum_size vtkzfp_zfp_stream_maximum_size -#define zfp_stream_mode vtkzfp_zfp_stream_mode -#define zfp_stream_open vtkzfp_zfp_stream_open -#define zfp_stream_params vtkzfp_zfp_stream_params -#define zfp_stream_rewind vtkzfp_zfp_stream_rewind -#define zfp_stream_set_accuracy vtkzfp_zfp_stream_set_accuracy -#define zfp_stream_set_bit_stream vtkzfp_zfp_stream_set_bit_stream -#define zfp_stream_set_mode vtkzfp_zfp_stream_set_mode -#define zfp_stream_set_params vtkzfp_zfp_stream_set_params -#define zfp_stream_set_precision vtkzfp_zfp_stream_set_precision -#define zfp_stream_set_rate vtkzfp_zfp_stream_set_rate -#define zfp_type_size vtkzfp_zfp_type_size -#define zfp_version_string vtkzfp_zfp_version_string -#define zfp_write_header vtkzfp_zfp_write_header - -#endif diff --git a/ThirdParty/zfp/vtkzfp/include/zfp.h b/ThirdParty/zfp/vtkzfp/include/zfp.h deleted file mode 100644 index f3105983de581e3c09bb11e0ab73d68c24fd967d..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/zfp.h +++ /dev/null @@ -1,758 +0,0 @@ -/* -** Copyright (c) 2014-2019, Lawrence Livermore National Security, LLC. -** Produced at the Lawrence Livermore National Laboratory. -** Authors: Peter Lindstrom, Markus Salasoo, Matt Larsen, Stephen Herbein. -** LLNL-CODE-663824. -** All rights reserved. -** -** This file is part of the zfp library. -** For details, see http://computation.llnl.gov/casc/zfp/. -** -** Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are met: -** -** 1. Redistributions of source code must retain the above copyright notice, -** this list of conditions and the disclaimer below. -** -** 2. Redistributions in binary form must reproduce the above copyright notice, -** this list of conditions and the disclaimer (as noted below) in the -** documentation and/or other materials provided with the distribution. -** -** 3. Neither the name of the LLNS/LLNL nor the names of its contributors may -** be used to endorse or promote products derived from this software without -** specific prior written permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -** ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY, -** LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -** INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -** -** -** Additional BSD Notice -** -** 1. This notice is required to be provided under our contract with the U.S. -** Department of Energy (DOE). This work was produced at Lawrence Livermore -** National Laboratory under Contract No. DE-AC52-07NA27344 with the DOE. - -** 2. Neither the United States Government nor Lawrence Livermore National -** Security, LLC nor any of their employees, makes any warranty, express or -** implied, or assumes any liability or responsibility for the accuracy, -** completeness, or usefulness of any information, apparatus, product, or -** process disclosed, or represents that its use would not infringe -** privately-owned rights. -** -** 3. Also, reference herein to any specific commercial products, process, or -** services by trade name, trademark, manufacturer or otherwise does not -** necessarily constitute or imply its endorsement, recommendation, or -** favoring by the United States Government or Lawrence Livermore National -** Security, LLC. The views and opinions of authors expressed herein do not -** necessarily state or reflect those of the United States Government or -** Lawrence Livermore National Security, LLC, and shall not be used for -** advertising or product endorsement purposes. -*/ - -#ifndef ZFP_H -#define ZFP_H - -#include "vtk_zfp_mangle.h" - -#include "zfp/types.h" -#include "zfp/system.h" -#include "bitstream.h" - -/* macros ------------------------------------------------------------------ */ - -/* stringification */ -#define _zfp_str_(x) # x -#define _zfp_str(x) _zfp_str_(x) - -/* library version information */ -#define ZFP_VERSION_MAJOR 0 /* library major version number */ -#define ZFP_VERSION_MINOR 5 /* library minor version number */ -#define ZFP_VERSION_PATCH 5 /* library patch version number */ -#define ZFP_VERSION_RELEASE ZFP_VERSION_PATCH - -/* codec version number (see also zfp_codec_version) */ -#define ZFP_CODEC 5 - -/* library version number (see also zfp_library_version) */ -#define ZFP_VERSION \ - ((ZFP_VERSION_MAJOR << 8) + \ - (ZFP_VERSION_MINOR << 4) + \ - (ZFP_VERSION_PATCH << 0)) - -/* library version string (see also zfp_version_string) */ -#define ZFP_VERSION_STRING \ - _zfp_str(ZFP_VERSION_MAJOR) "." \ - _zfp_str(ZFP_VERSION_MINOR) "." \ - _zfp_str(ZFP_VERSION_PATCH) - -/* default compression parameters */ -#define ZFP_MIN_BITS 1 /* minimum number of bits per block */ -#define ZFP_MAX_BITS 16657 /* maximum number of bits per block */ -#define ZFP_MAX_PREC 64 /* maximum precision supported */ -#define ZFP_MIN_EXP -1074 /* minimum floating-point base-2 exponent */ - -/* header masks (enable via bitwise or; reader must use same mask) */ -#define ZFP_HEADER_MAGIC 0x1u /* embed 64-bit magic */ -#define ZFP_HEADER_META 0x2u /* embed 52-bit field metadata */ -#define ZFP_HEADER_MODE 0x4u /* embed 12- or 64-bit compression mode */ -#define ZFP_HEADER_FULL 0x7u /* embed all of the above */ - -/* field metadata indeterminate state and error code */ -#define ZFP_META_NULL (UINT64C(-1)) - -/* number of bits per header entry */ -#define ZFP_MAGIC_BITS 32 /* number of magic word bits */ -#define ZFP_META_BITS 52 /* number of field metadata bits */ -#define ZFP_MODE_SHORT_BITS 12 /* number of mode bits in short format */ -#define ZFP_MODE_LONG_BITS 64 /* number of mode bits in long format */ -#define ZFP_HEADER_MAX_BITS 148 /* max number of header bits */ -#define ZFP_MODE_SHORT_MAX ((1u << ZFP_MODE_SHORT_BITS) - 2) - -/* types ------------------------------------------------------------------- */ - -/* execution policy */ -typedef enum { - zfp_exec_serial = 0, /* serial execution (default) */ - zfp_exec_omp = 1, /* OpenMP multi-threaded execution */ - zfp_exec_cuda = 2 /* CUDA parallel execution */ -} zfp_exec_policy; - -/* OpenMP execution parameters */ -typedef struct { - uint threads; /* number of requested threads */ - uint chunk_size; /* number of blocks per chunk (1D only) */ -} zfp_exec_params_omp; - -/* execution parameters */ -typedef union { - zfp_exec_params_omp omp; /* OpenMP parameters */ -} zfp_exec_params; - -typedef struct { - zfp_exec_policy policy; /* execution policy (serial, omp, ...) */ - zfp_exec_params params; /* execution parameters */ -} zfp_execution; - -/* compressed stream; use accessors to get/set members */ -typedef struct { - uint minbits; /* minimum number of bits to store per block */ - uint maxbits; /* maximum number of bits to store per block */ - uint maxprec; /* maximum number of bit planes to store */ - int minexp; /* minimum floating point bit plane number to store */ - bitstream* stream; /* compressed bit stream */ - zfp_execution exec; /* execution policy and parameters */ -} zfp_stream; - -/* compression mode */ -typedef enum { - zfp_mode_null = 0, /* an invalid configuration of the 4 params */ - zfp_mode_expert = 1, /* expert mode (4 params set manually) */ - zfp_mode_fixed_rate = 2, /* fixed rate mode */ - zfp_mode_fixed_precision = 3, /* fixed precision mode */ - zfp_mode_fixed_accuracy = 4, /* fixed accuracy mode */ - zfp_mode_reversible = 5 /* reversible (lossless) mode */ -} zfp_mode; - -/* scalar type */ -typedef enum { - zfp_type_none = 0, /* unspecified type */ - zfp_type_int32 = 1, /* 32-bit signed integer */ - zfp_type_int64 = 2, /* 64-bit signed integer */ - zfp_type_float = 3, /* single precision floating point */ - zfp_type_double = 4 /* double precision floating point */ -} zfp_type; - -/* uncompressed array; use accessors to get/set members */ -typedef struct { - zfp_type type; /* scalar type (e.g. int32, double) */ - uint nx, ny, nz, nw; /* sizes (zero for unused dimensions) */ - int sx, sy, sz, sw; /* strides (zero for contiguous array a[nw][nz][ny][nx]) */ - void* data; /* pointer to array data */ -} zfp_field; - -#ifdef __cplusplus -extern "C" { -#endif - -/* public data ------------------------------------------------------------- */ - -extern_ const uint zfp_codec_version; /* codec version ZFP_CODEC */ -extern_ const uint zfp_library_version; /* library version ZFP_VERSION */ -extern_ const char* const zfp_version_string; /* verbose version string */ - -/* high-level API: utility functions --------------------------------------- */ - -size_t /* byte size of scalar type */ -zfp_type_size( - zfp_type type /* scalar type */ -); - -/* high-level API: compressed stream construction/destruction -------------- */ - -/* open compressed stream and associate with bit stream */ -zfp_stream* /* allocated compressed stream */ -zfp_stream_open( - bitstream* stream /* bit stream to read from and write to (may be NULL) */ -); - -/* close and deallocate compressed stream (does not affect bit stream) */ -void -zfp_stream_close( - zfp_stream* stream /* compressed stream */ -); - -/* high-level API: compressed stream inspectors ---------------------------- */ - -/* bit stream associated with compressed stream */ -bitstream* /* bit stream associated with compressed stream */ -zfp_stream_bit_stream( - const zfp_stream* stream /* compressed stream */ -); - -/* returns enum of compression mode */ -zfp_mode /* enum for compression mode */ -zfp_stream_compression_mode( - const zfp_stream* stream /* compressed stream */ -); - -/* get all compression parameters in a compact representation */ -uint64 /* 12- or 64-bit encoding of parameters */ -zfp_stream_mode( - const zfp_stream* stream /* compressed stream */ -); - -/* get all compression parameters (pointers may be NULL) */ -void -zfp_stream_params( - const zfp_stream* stream, /* compressed stream */ - uint* minbits, /* minimum number of bits per 4^d block */ - uint* maxbits, /* maximum number of bits per 4^d block */ - uint* maxprec, /* maximum precision (# bit planes coded) */ - int* minexp /* minimum base-2 exponent; error <= 2^minexp */ -); - -/* byte size of sequentially compressed stream (call after compression) */ -size_t /* actual number of bytes of compressed storage */ -zfp_stream_compressed_size( - const zfp_stream* stream /* compressed stream */ -); - -/* conservative estimate of compressed size in bytes */ -size_t /* maximum number of bytes of compressed storage */ -zfp_stream_maximum_size( - const zfp_stream* stream, /* compressed stream */ - const zfp_field* field /* array to compress */ -); - -/* high-level API: initialization of compressed stream parameters ---------- */ - -/* rewind bit stream to beginning for compression or decompression */ -void -zfp_stream_rewind( - zfp_stream* stream /* compressed bit stream */ -); - -/* associate bit stream with compressed stream */ -void -zfp_stream_set_bit_stream( - zfp_stream* stream, /* compressed stream */ - bitstream* bs /* bit stream to read from and write to */ -); - -/* enable reversible (lossless) compression */ -void -zfp_stream_set_reversible( - zfp_stream* stream /* compressed stream */ -); - -/* set size in compressed bits/scalar (fixed-rate mode) */ -double /* actual rate in compressed bits/scalar */ -zfp_stream_set_rate( - zfp_stream* stream, /* compressed stream */ - double rate, /* desired rate in compressed bits/scalar */ - zfp_type type, /* scalar type to compress */ - uint dims, /* array dimensionality (1, 2, 3, or 4) */ - int wra /* nonzero if write random access is needed */ -); - -/* set precision in uncompressed bits/scalar (fixed-precision mode) */ -uint /* actual precision */ -zfp_stream_set_precision( - zfp_stream* stream, /* compressed stream */ - uint precision /* desired precision in uncompressed bits/scalar */ -); - -/* set accuracy as absolute error tolerance (fixed-accuracy mode) */ -double /* actual error tolerance */ -zfp_stream_set_accuracy( - zfp_stream* stream, /* compressed stream */ - double tolerance /* desired error tolerance */ -); - -/* set parameters from compact encoding; leaves stream intact on failure */ -zfp_mode /* compression mode or zfp_mode_null upon failure */ -zfp_stream_set_mode( - zfp_stream* stream, /* compressed stream */ - uint64 mode /* 12- or 64-bit encoding of parameters */ -); - -/* set all parameters (expert mode); leaves stream intact on failure */ -int /* nonzero upon success */ -zfp_stream_set_params( - zfp_stream* stream, /* compressed stream */ - uint minbits, /* minimum number of bits per 4^d block */ - uint maxbits, /* maximum number of bits per 4^d block */ - uint maxprec, /* maximum precision (# bit planes coded) */ - int minexp /* minimum base-2 exponent; error <= 2^minexp */ -); - -/* high-level API: execution policy ---------------------------------------- */ - -/* current execution policy */ -zfp_exec_policy -zfp_stream_execution( - const zfp_stream* stream /* compressed stream */ -); - -/* number of OpenMP threads to use */ -uint /* number of threads (0 for default) */ -zfp_stream_omp_threads( - const zfp_stream* stream /* compressed stream */ -); - -/* number of blocks per OpenMP chunk (1D only) */ -uint /* number of blocks per chunk (0 for default) */ -zfp_stream_omp_chunk_size( - const zfp_stream* stream /* compressed stream */ -); - -/* set execution policy */ -int /* nonzero upon success */ -zfp_stream_set_execution( - zfp_stream* stream, /* compressed stream */ - zfp_exec_policy policy /* execution policy */ -); - -/* set OpenMP execution policy and number of threads */ -int /* nonzero upon success */ -zfp_stream_set_omp_threads( - zfp_stream* stream, /* compressed stream */ - uint threads /* number of OpenMP threads to use (0 for default) */ -); - -/* set OpenMP execution policy and number of blocks per chunk (1D only) */ -int /* nonzero upon success */ -zfp_stream_set_omp_chunk_size( - zfp_stream* stream, /* compressed stream */ - uint chunk_size /* number of blocks per chunk (0 for default) */ -); - -/* high-level API: uncompressed array construction/destruction ------------- */ - -/* allocate field struct */ -zfp_field* /* pointer to default initialized field */ -zfp_field_alloc(); - -/* allocate metadata for 1D field f[nx] */ -zfp_field* /* allocated field metadata */ -zfp_field_1d( - void* pointer, /* pointer to uncompressed scalars (may be NULL) */ - zfp_type type, /* scalar type */ - uint nx /* number of scalars */ -); - -/* allocate metadata for 2D field f[ny][nx] */ -zfp_field* /* allocated field metadata */ -zfp_field_2d( - void* pointer, /* pointer to uncompressed scalars (may be NULL) */ - zfp_type type, /* scalar type */ - uint nx, /* number of scalars in x dimension */ - uint ny /* number of scalars in y dimension */ -); - -/* allocate metadata for 3D field f[nz][ny][nx] */ -zfp_field* /* allocated field metadata */ -zfp_field_3d( - void* pointer, /* pointer to uncompressed scalars (may be NULL) */ - zfp_type type, /* scalar type */ - uint nx, /* number of scalars in x dimension */ - uint ny, /* number of scalars in y dimension */ - uint nz /* number of scalars in z dimension */ -); - -/* allocate metadata for 4D field f[nw][nz][ny][nx] */ -zfp_field* /* allocated field metadata */ -zfp_field_4d( - void* pointer, /* pointer to uncompressed scalars (may be NULL) */ - zfp_type type, /* scalar type */ - uint nx, /* number of scalars in x dimension */ - uint ny, /* number of scalars in y dimension */ - uint nz, /* number of scalars in z dimension */ - uint nw /* number of scalars in w dimension */ -); - -/* deallocate field metadata */ -void -zfp_field_free( - zfp_field* field /* field metadata */ -); - -/* high-level API: uncompressed array inspectors --------------------------- */ - -/* pointer to first scalar in field */ -void* /* array pointer */ -zfp_field_pointer( - const zfp_field* field /* field metadata */ -); - -/* field scalar type */ -zfp_type /* scalar type */ -zfp_field_type( - const zfp_field* field /* field metadata */ -); - -/* precision of field scalar type */ -uint /* scalar type precision in number of bits */ -zfp_field_precision( - const zfp_field* field /* field metadata */ -); - -/* field dimensionality (1, 2, or 3) */ -uint /* number of dimensions */ -zfp_field_dimensionality( - const zfp_field* field /* field metadata */ -); - -/* field size in number of scalars */ -size_t /* total number of scalars */ -zfp_field_size( - const zfp_field* field, /* field metadata */ - uint* size /* number of scalars per dimension (may be NULL) */ -); - -/* field strides per dimension */ -int /* zero if array is contiguous */ -zfp_field_stride( - const zfp_field* field, /* field metadata */ - int* stride /* stride in scalars per dimension (may be NULL) */ -); - -/* field scalar type and dimensions */ -uint64 /* compact 52-bit encoding of metadata */ -zfp_field_metadata( - const zfp_field* field /* field metadata */ -); - -/* high-level API: uncompressed array specification ------------------------ */ - -/* set pointer to first scalar in field */ -void -zfp_field_set_pointer( - zfp_field* field, /* field metadata */ - void* pointer /* pointer to first scalar */ -); - -/* set field scalar type */ -zfp_type /* actual scalar type */ -zfp_field_set_type( - zfp_field* field, /* field metadata */ - zfp_type type /* desired scalar type */ -); - -/* set 1D field size */ -void -zfp_field_set_size_1d( - zfp_field* field, /* field metadata */ - uint nx /* number of scalars */ -); - -/* set 2D field size */ -void -zfp_field_set_size_2d( - zfp_field* field, /* field metadata */ - uint nx, /* number of scalars in x dimension */ - uint ny /* number of scalars in y dimension */ -); - -/* set 3D field size */ -void -zfp_field_set_size_3d( - zfp_field* field, /* field metadata */ - uint nx, /* number of scalars in x dimension */ - uint ny, /* number of scalars in y dimension */ - uint nz /* number of scalars in z dimension */ -); - -/* set 4D field size */ -void -zfp_field_set_size_4d( - zfp_field* field, /* field metadata */ - uint nx, /* number of scalars in x dimension */ - uint ny, /* number of scalars in y dimension */ - uint nz, /* number of scalars in z dimension */ - uint nw /* number of scalars in w dimension */ -); - -/* set 1D field stride in number of scalars */ -void -zfp_field_set_stride_1d( - zfp_field* field, /* field metadata */ - int sx /* stride in number of scalars: &f[1] - &f[0] */ -); - -/* set 2D field strides in number of scalars */ -void -zfp_field_set_stride_2d( - zfp_field* field, /* field metadata */ - int sx, /* stride in x dimension: &f[0][1] - &f[0][0] */ - int sy /* stride in y dimension: &f[1][0] - &f[0][0] */ -); - -/* set 3D field strides in number of scalars */ -void -zfp_field_set_stride_3d( - zfp_field* field, /* field metadata */ - int sx, /* stride in x dimension: &f[0][0][1] - &f[0][0][0] */ - int sy, /* stride in y dimension: &f[0][1][0] - &f[0][0][0] */ - int sz /* stride in z dimension: &f[1][0][0] - &f[0][0][0] */ -); - -/* set 4D field strides in number of scalars */ -void -zfp_field_set_stride_4d( - zfp_field* field, /* field metadata */ - int sx, /* stride in x dimension: &f[0][0][0][1] - &f[0][0][0][0] */ - int sy, /* stride in y dimension: &f[0][0][1][0] - &f[0][0][0][0] */ - int sz, /* stride in z dimension: &f[0][1][0][0] - &f[0][0][0][0] */ - int sw /* stride in w dimension: &f[1][0][0][0] - &f[0][0][0][0] */ -); - -/* set field scalar type and dimensions */ -int /* nonzero upon success */ -zfp_field_set_metadata( - zfp_field* field, /* field metadata */ - uint64 meta /* compact 52-bit encoding of metadata */ -); - -/* high-level API: compression and decompression --------------------------- */ - -/* compress entire field (nonzero return value upon success) */ -size_t /* cumulative number of bytes of compressed storage */ -zfp_compress( - zfp_stream* stream, /* compressed stream */ - const zfp_field* field /* field metadata */ -); - -/* decompress entire field (nonzero return value upon success) */ -size_t /* cumulative number of bytes of compressed storage */ -zfp_decompress( - zfp_stream* stream, /* compressed stream */ - zfp_field* field /* field metadata */ -); - -/* write compression parameters and field metadata (optional) */ -size_t /* number of bits written or zero upon failure */ -zfp_write_header( - zfp_stream* stream, /* compressed stream */ - const zfp_field* field, /* field metadata */ - uint mask /* information to write */ -); - -/* read compression parameters and field metadata when previously written */ -size_t /* number of bits read or zero upon failure */ -zfp_read_header( - zfp_stream* stream, /* compressed stream */ - zfp_field* field, /* field metadata */ - uint mask /* information to read */ -); - -/* low-level API: stream manipulation -------------------------------------- */ - -/* flush bit stream--must be called after last encode call or between seeks */ -size_t -zfp_stream_flush( - zfp_stream* stream /* compressed bit stream */ -); - -/* align bit stream on next word boundary (decoding analogy to flush) */ -size_t -zfp_stream_align( - zfp_stream* stream /* compressed bit stream */ -); - -/* low-level API: encoder -------------------------------------------------- */ - -/* -The functions below all compress either a complete contiguous d-dimensional -block of 4^d scalars or a complete or partial block assembled from a strided -array. In the latter case, p points to the first scalar; (nx, ny, nz) specify -the size of the block, with 1 <= nx, ny, nz <= 4; and (sx, sy, sz) specify the -strides, i.e. the number of scalars to advance to get to the next scalar along -each dimension. The functions return the number of bits of compressed storage -needed for the compressed block. -*/ - -/* encode 1D contiguous block of 4 values */ -uint zfp_encode_block_int32_1(zfp_stream* stream, const int32* block); -uint zfp_encode_block_int64_1(zfp_stream* stream, const int64* block); -uint zfp_encode_block_float_1(zfp_stream* stream, const float* block); -uint zfp_encode_block_double_1(zfp_stream* stream, const double* block); - -/* encode 1D complete or partial block from strided array */ -uint zfp_encode_block_strided_int32_1(zfp_stream* stream, const int32* p, int sx); -uint zfp_encode_block_strided_int64_1(zfp_stream* stream, const int64* p, int sx); -uint zfp_encode_block_strided_float_1(zfp_stream* stream, const float* p, int sx); -uint zfp_encode_block_strided_double_1(zfp_stream* stream, const double* p, int sx); -uint zfp_encode_partial_block_strided_int32_1(zfp_stream* stream, const int32* p, uint nx, int sx); -uint zfp_encode_partial_block_strided_int64_1(zfp_stream* stream, const int64* p, uint nx, int sx); -uint zfp_encode_partial_block_strided_float_1(zfp_stream* stream, const float* p, uint nx, int sx); -uint zfp_encode_partial_block_strided_double_1(zfp_stream* stream, const double* p, uint nx, int sx); - -/* encode 2D contiguous block of 4x4 values */ -uint zfp_encode_block_int32_2(zfp_stream* stream, const int32* block); -uint zfp_encode_block_int64_2(zfp_stream* stream, const int64* block); -uint zfp_encode_block_float_2(zfp_stream* stream, const float* block); -uint zfp_encode_block_double_2(zfp_stream* stream, const double* block); - -/* encode 2D complete or partial block from strided array */ -uint zfp_encode_partial_block_strided_int32_2(zfp_stream* stream, const int32* p, uint nx, uint ny, int sx, int sy); -uint zfp_encode_partial_block_strided_int64_2(zfp_stream* stream, const int64* p, uint nx, uint ny, int sx, int sy); -uint zfp_encode_partial_block_strided_float_2(zfp_stream* stream, const float* p, uint nx, uint ny, int sx, int sy); -uint zfp_encode_partial_block_strided_double_2(zfp_stream* stream, const double* p, uint nx, uint ny, int sx, int sy); -uint zfp_encode_block_strided_int32_2(zfp_stream* stream, const int32* p, int sx, int sy); -uint zfp_encode_block_strided_int64_2(zfp_stream* stream, const int64* p, int sx, int sy); -uint zfp_encode_block_strided_float_2(zfp_stream* stream, const float* p, int sx, int sy); -uint zfp_encode_block_strided_double_2(zfp_stream* stream, const double* p, int sx, int sy); - -/* encode 3D contiguous block of 4x4x4 values */ -uint zfp_encode_block_int32_3(zfp_stream* stream, const int32* block); -uint zfp_encode_block_int64_3(zfp_stream* stream, const int64* block); -uint zfp_encode_block_float_3(zfp_stream* stream, const float* block); -uint zfp_encode_block_double_3(zfp_stream* stream, const double* block); - -/* encode 3D complete or partial block from strided array */ -uint zfp_encode_block_strided_int32_3(zfp_stream* stream, const int32* p, int sx, int sy, int sz); -uint zfp_encode_block_strided_int64_3(zfp_stream* stream, const int64* p, int sx, int sy, int sz); -uint zfp_encode_block_strided_float_3(zfp_stream* stream, const float* p, int sx, int sy, int sz); -uint zfp_encode_block_strided_double_3(zfp_stream* stream, const double* p, int sx, int sy, int sz); -uint zfp_encode_partial_block_strided_int32_3(zfp_stream* stream, const int32* p, uint nx, uint ny, uint nz, int sx, int sy, int sz); -uint zfp_encode_partial_block_strided_int64_3(zfp_stream* stream, const int64* p, uint nx, uint ny, uint nz, int sx, int sy, int sz); -uint zfp_encode_partial_block_strided_float_3(zfp_stream* stream, const float* p, uint nx, uint ny, uint nz, int sx, int sy, int sz); -uint zfp_encode_partial_block_strided_double_3(zfp_stream* stream, const double* p, uint nx, uint ny, uint nz, int sx, int sy, int sz); - -/* encode 4D contiguous block of 4x4x4x4 values */ -uint zfp_encode_block_int32_4(zfp_stream* stream, const int32* block); -uint zfp_encode_block_int64_4(zfp_stream* stream, const int64* block); -uint zfp_encode_block_float_4(zfp_stream* stream, const float* block); -uint zfp_encode_block_double_4(zfp_stream* stream, const double* block); - -/* encode 4D complete or partial block from strided array */ -uint zfp_encode_block_strided_int32_4(zfp_stream* stream, const int32* p, int sx, int sy, int sz, int sw); -uint zfp_encode_block_strided_int64_4(zfp_stream* stream, const int64* p, int sx, int sy, int sz, int sw); -uint zfp_encode_block_strided_float_4(zfp_stream* stream, const float* p, int sx, int sy, int sz, int sw); -uint zfp_encode_block_strided_double_4(zfp_stream* stream, const double* p, int sx, int sy, int sz, int sw); -uint zfp_encode_partial_block_strided_int32_4(zfp_stream* stream, const int32* p, uint nx, uint ny, uint nz, uint nw, int sx, int sy, int sz, int sw); -uint zfp_encode_partial_block_strided_int64_4(zfp_stream* stream, const int64* p, uint nx, uint ny, uint nz, uint nw, int sx, int sy, int sz, int sw); -uint zfp_encode_partial_block_strided_float_4(zfp_stream* stream, const float* p, uint nx, uint ny, uint nz, uint nw, int sx, int sy, int sz, int sw); -uint zfp_encode_partial_block_strided_double_4(zfp_stream* stream, const double* p, uint nx, uint ny, uint nz, uint nw, int sx, int sy, int sz, int sw); - -/* low-level API: decoder -------------------------------------------------- */ - -/* -Each function below decompresses a single block and returns the number of bits -of compressed storage consumed. See corresponding encoder functions above for -further details. -*/ - -/* decode 1D contiguous block of 4 values */ -uint zfp_decode_block_int32_1(zfp_stream* stream, int32* block); -uint zfp_decode_block_int64_1(zfp_stream* stream, int64* block); -uint zfp_decode_block_float_1(zfp_stream* stream, float* block); -uint zfp_decode_block_double_1(zfp_stream* stream, double* block); - -/* decode 1D complete or partial block from strided array */ -uint zfp_decode_block_strided_int32_1(zfp_stream* stream, int32* p, int sx); -uint zfp_decode_block_strided_int64_1(zfp_stream* stream, int64* p, int sx); -uint zfp_decode_block_strided_float_1(zfp_stream* stream, float* p, int sx); -uint zfp_decode_block_strided_double_1(zfp_stream* stream, double* p, int sx); -uint zfp_decode_partial_block_strided_int32_1(zfp_stream* stream, int32* p, uint nx, int sx); -uint zfp_decode_partial_block_strided_int64_1(zfp_stream* stream, int64* p, uint nx, int sx); -uint zfp_decode_partial_block_strided_float_1(zfp_stream* stream, float* p, uint nx, int sx); -uint zfp_decode_partial_block_strided_double_1(zfp_stream* stream, double* p, uint nx, int sx); - -/* decode 2D contiguous block of 4x4 values */ -uint zfp_decode_block_int32_2(zfp_stream* stream, int32* block); -uint zfp_decode_block_int64_2(zfp_stream* stream, int64* block); -uint zfp_decode_block_float_2(zfp_stream* stream, float* block); -uint zfp_decode_block_double_2(zfp_stream* stream, double* block); - -/* decode 2D complete or partial block from strided array */ -uint zfp_decode_block_strided_int32_2(zfp_stream* stream, int32* p, int sx, int sy); -uint zfp_decode_block_strided_int64_2(zfp_stream* stream, int64* p, int sx, int sy); -uint zfp_decode_block_strided_float_2(zfp_stream* stream, float* p, int sx, int sy); -uint zfp_decode_block_strided_double_2(zfp_stream* stream, double* p, int sx, int sy); -uint zfp_decode_partial_block_strided_int32_2(zfp_stream* stream, int32* p, uint nx, uint ny, int sx, int sy); -uint zfp_decode_partial_block_strided_int64_2(zfp_stream* stream, int64* p, uint nx, uint ny, int sx, int sy); -uint zfp_decode_partial_block_strided_float_2(zfp_stream* stream, float* p, uint nx, uint ny, int sx, int sy); -uint zfp_decode_partial_block_strided_double_2(zfp_stream* stream, double* p, uint nx, uint ny, int sx, int sy); - -/* decode 3D contiguous block of 4x4x4 values */ -uint zfp_decode_block_int32_3(zfp_stream* stream, int32* block); -uint zfp_decode_block_int64_3(zfp_stream* stream, int64* block); -uint zfp_decode_block_float_3(zfp_stream* stream, float* block); -uint zfp_decode_block_double_3(zfp_stream* stream, double* block); - -/* decode 3D complete or partial block from strided array */ -uint zfp_decode_block_strided_int32_3(zfp_stream* stream, int32* p, int sx, int sy, int sz); -uint zfp_decode_block_strided_int64_3(zfp_stream* stream, int64* p, int sx, int sy, int sz); -uint zfp_decode_block_strided_float_3(zfp_stream* stream, float* p, int sx, int sy, int sz); -uint zfp_decode_block_strided_double_3(zfp_stream* stream, double* p, int sx, int sy, int sz); -uint zfp_decode_partial_block_strided_int32_3(zfp_stream* stream, int32* p, uint nx, uint ny, uint nz, int sx, int sy, int sz); -uint zfp_decode_partial_block_strided_int64_3(zfp_stream* stream, int64* p, uint nx, uint ny, uint nz, int sx, int sy, int sz); -uint zfp_decode_partial_block_strided_float_3(zfp_stream* stream, float* p, uint nx, uint ny, uint nz, int sx, int sy, int sz); -uint zfp_decode_partial_block_strided_double_3(zfp_stream* stream, double* p, uint nx, uint ny, uint nz, int sx, int sy, int sz); - -/* decode 4D contiguous block of 4x4x4x4 values */ -uint zfp_decode_block_int32_4(zfp_stream* stream, int32* block); -uint zfp_decode_block_int64_4(zfp_stream* stream, int64* block); -uint zfp_decode_block_float_4(zfp_stream* stream, float* block); -uint zfp_decode_block_double_4(zfp_stream* stream, double* block); - -/* decode 4D complete or partial block from strided array */ -uint zfp_decode_block_strided_int32_4(zfp_stream* stream, int32* p, int sx, int sy, int sz, int sw); -uint zfp_decode_block_strided_int64_4(zfp_stream* stream, int64* p, int sx, int sy, int sz, int sw); -uint zfp_decode_block_strided_float_4(zfp_stream* stream, float* p, int sx, int sy, int sz, int sw); -uint zfp_decode_block_strided_double_4(zfp_stream* stream, double* p, int sx, int sy, int sz, int sw); -uint zfp_decode_partial_block_strided_int32_4(zfp_stream* stream, int32* p, uint nx, uint ny, uint nz, uint nw, int sx, int sy, int sz, int sw); -uint zfp_decode_partial_block_strided_int64_4(zfp_stream* stream, int64* p, uint nx, uint ny, uint nz, uint nw, int sx, int sy, int sz, int sw); -uint zfp_decode_partial_block_strided_float_4(zfp_stream* stream, float* p, uint nx, uint ny, uint nz, uint nw, int sx, int sy, int sz, int sw); -uint zfp_decode_partial_block_strided_double_4(zfp_stream* stream, double* p, uint nx, uint ny, uint nz, uint nw, int sx, int sy, int sz, int sw); - -/* low-level API: utility functions ---------------------------------------- */ - -/* convert dims-dimensional contiguous block to 32-bit integer type */ -void zfp_promote_int8_to_int32(int32* oblock, const int8* iblock, uint dims); -void zfp_promote_uint8_to_int32(int32* oblock, const uint8* iblock, uint dims); -void zfp_promote_int16_to_int32(int32* oblock, const int16* iblock, uint dims); -void zfp_promote_uint16_to_int32(int32* oblock, const uint16* iblock, uint dims); - -/* convert dims-dimensional contiguous block from 32-bit integer type */ -void zfp_demote_int32_to_int8(int8* oblock, const int32* iblock, uint dims); -void zfp_demote_int32_to_uint8(uint8* oblock, const int32* iblock, uint dims); -void zfp_demote_int32_to_int16(int16* oblock, const int32* iblock, uint dims); -void zfp_demote_int32_to_uint16(uint16* oblock, const int32* iblock, uint dims); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ThirdParty/zfp/vtkzfp/include/zfp/cache.h b/ThirdParty/zfp/vtkzfp/include/zfp/cache.h deleted file mode 100644 index 3630910a08c98a4830cc3f9a872bfee6a9deedcc..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/zfp/cache.h +++ /dev/null @@ -1,261 +0,0 @@ -#ifndef ZFP_CACHE_H -#define ZFP_CACHE_H - -#include "memory.h" - -#ifdef ZFP_WITH_CACHE_PROFILE - // maintain stats on hit and miss rates - #include <iostream> -#endif - -namespace zfp { - -// direct-mapped or two-way skew-associative write-back cache -template <class Line> -class Cache { -public: - // cache line index (zero is reserved for unused lines) - typedef uint Index; - - // cache tag containing line meta data - class Tag { - public: - Tag() : x(0) {} - - Tag(Index x, bool d) : x(2 * x + d) {} - - // cache line index - Index index() const { return x >> 1; } - - // is line dirty? - bool dirty() const { return x & 1; } - - // is line used? - bool used() const { return x != 0; } - - // mark line as dirty - void mark() { x |= 1u; } - - // mark line as unused - void clear() { x = 0; } - - protected: - Index x; - }; - - // sequential iterator for looping over cache lines - class const_iterator { - public: - friend class Cache; - class Pair { - public: - Pair(Line* l, Tag t) : line(l), tag(t) {} - Line* line; - Tag tag; - }; - const_iterator& operator++() - { - advance(); - return *this; - } - const_iterator operator++(int) - { - const_iterator iter = *this; - advance(); - return iter; - } - const Pair& operator*() const { return pair; } - const Pair* operator->() const { return &pair; } - operator const void*() const { return pair.line ? this : 0; } - - protected: - const_iterator(Cache* cache) : c(cache), pair(cache->line, cache->tag[0]) - { - if (!pair.tag.used()) - advance(); - } - void advance() - { - if (pair.line) { - uint i; - for (i = uint(pair.line - c->line) + 1; i <= c->mask && !c->tag[i].used(); i++); - pair = (i <= c->mask ? Pair(c->line + i, c->tag[i]) : Pair(0, Tag())); - } - } - Cache* c; - Pair pair; - }; - - // allocate cache with at least minsize lines - Cache(uint minsize = 0) : tag(0), line(0) - { - resize(minsize); -#ifdef ZFP_WITH_CACHE_PROFILE - std::cerr << "cache lines=" << mask + 1 << std::endl; - hit[0][0] = hit[1][0] = miss[0] = back[0] = 0; - hit[0][1] = hit[1][1] = miss[1] = back[1] = 0; -#endif - } - - // copy constructor--performs a deep copy - Cache(const Cache& c) : tag(0), line(0) - { - deep_copy(c); - } - - // destructor - ~Cache() - { - zfp::deallocate_aligned(tag); - zfp::deallocate_aligned(line); -#ifdef ZFP_WITH_CACHE_PROFILE - std::cerr << "cache R1=" << hit[0][0] << " R2=" << hit[1][0] << " RM=" << miss[0] << " RB=" << back[0] - << " W1=" << hit[0][1] << " W2=" << hit[1][1] << " WM=" << miss[1] << " WB=" << back[1] << std::endl; -#endif - } - - // assignment operator--performs a deep copy - Cache& operator=(const Cache& c) - { - if (this != &c) - deep_copy(c); - return *this; - } - - // cache size in number of lines - uint size() const { return mask + 1; } - - // change cache size to at least minsize lines (all contents will be lost) - void resize(uint minsize) - { - for (mask = minsize ? minsize - 1 : 1; mask & (mask + 1); mask |= mask + 1); - zfp::reallocate_aligned(tag, ((size_t)mask + 1) * sizeof(Tag), 0x100); - zfp::reallocate_aligned(line, ((size_t)mask + 1) * sizeof(Line), 0x100); - clear(); - } - - // look up cache line #x and return pointer to it if in the cache; - // otherwise return null - const Line* lookup(Index x) const - { - uint i = primary(x); - if (tag[i].index() == x) - return line + i; -#ifdef ZFP_WITH_CACHE_TWOWAY - uint j = secondary(x); - if (tag[j].index() == x) - return line + j; -#endif - return 0; - } - - // look up cache line #x and set ptr to where x is or should be stored; - // if the returned tag does not match x, then the caller must implement - // write-back (if the line is in use) and then fetch the requested line - Tag access(Line*& ptr, Index x, bool write) - { - uint i = primary(x); - if (tag[i].index() == x) { - ptr = line + i; - if (write) - tag[i].mark(); -#ifdef ZFP_WITH_CACHE_PROFILE - hit[0][write]++; -#endif - return tag[i]; - } -#ifdef ZFP_WITH_CACHE_TWOWAY - uint j = secondary(x); - if (tag[j].index() == x) { - ptr = line + j; - if (write) - tag[j].mark(); -#ifdef ZFP_WITH_CACHE_PROFILE - hit[1][write]++; -#endif - return tag[j]; - } - // cache line not found; prefer primary and not dirty slots - i = tag[j].used() && (!tag[i].dirty() || tag[j].dirty()) ? i : j; -#endif - ptr = line + i; - Tag t = tag[i]; - tag[i] = Tag(x, write); -#ifdef ZFP_WITH_CACHE_PROFILE - miss[write]++; - if (tag[i].dirty()) - back[write]++; -#endif - return t; - } - - // clear cache without writing back - void clear() - { - for (uint i = 0; i <= mask; i++) - tag[i].clear(); - } - - // flush cache line - void flush(const Line* l) - { - uint i = uint(l - line); - tag[i].clear(); - } - - // return iterator to first cache line - const_iterator first() { return const_iterator(this); } - -protected: - // perform a deep copy - void deep_copy(const Cache& c) - { - mask = c.mask; - zfp::clone_aligned(tag, c.tag, mask + 1, 0x100u); - zfp::clone_aligned(line, c.line, mask + 1, 0x100u); -#ifdef ZFP_WITH_CACHE_PROFILE - hit[0][0] = c.hit[0][0]; - hit[0][1] = c.hit[0][1]; - hit[1][0] = c.hit[1][0]; - hit[1][1] = c.hit[1][1]; - miss[0] = c.miss[0]; - miss[1] = c.miss[1]; - back[0] = c.back[0]; - back[1] = c.back[1]; -#endif - } - - uint primary(Index x) const { return x & mask; } - uint secondary(Index x) const - { -#ifdef ZFP_WITH_CACHE_FAST_HASH - // max entropy hash for 26- to 16-bit mapping (not full avalanche) - x -= x << 7; - x ^= x >> 16; - x -= x << 3; -#else - // Jenkins hash; see http://burtleburtle.net/bob/hash/integer.html - x -= x << 6; - x ^= x >> 17; - x -= x << 9; - x ^= x << 4; - x -= x << 3; - x ^= x << 10; - x ^= x >> 15; -#endif - return x & mask; - } - - Index mask; // cache line mask - Tag* tag; // cache line tags - Line* line; // actual decompressed cache lines -#ifdef ZFP_WITH_CACHE_PROFILE - uint64 hit[2][2]; // number of primary/secondary read/write hits - uint64 miss[2]; // number of read/write misses - uint64 back[2]; // number of write-backs due to read/writes -#endif -}; - -} - -#endif diff --git a/ThirdParty/zfp/vtkzfp/include/zfp/header.h b/ThirdParty/zfp/vtkzfp/include/zfp/header.h deleted file mode 100644 index ad6433cf1a5a2591477555ef3ac722a30db6f37a..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/zfp/header.h +++ /dev/null @@ -1,19 +0,0 @@ -class header { -public: - class exception : public std::runtime_error { - public: - exception(const std::string& msg) : runtime_error(msg) {} - - virtual ~exception() throw (){} - }; - - static void concat_sentence(std::string& s, const std::string& msg) - { - if (!s.empty()) - s += " "; - s += msg; - } - - uchar buffer[BITS_TO_BYTES(ZFP_HEADER_SIZE_BITS)]; -}; - diff --git a/ThirdParty/zfp/vtkzfp/include/zfp/headerHelpers.h b/ThirdParty/zfp/vtkzfp/include/zfp/headerHelpers.h deleted file mode 100644 index ed33816a3e65fe4d424627b29fdb1393e4b22156..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/zfp/headerHelpers.h +++ /dev/null @@ -1,144 +0,0 @@ -// "Handle" classes useful when throwing exceptions - -// buffer holds aligned memory for header, suitable for bitstream r/w (word-aligned) -class AlignedBufferHandle { - public: - size_t buffer_size_bytes; - // uint64 alignment guarantees bitstream alignment - uint64* buffer; - - // can copy a header into aligned buffer - AlignedBufferHandle(const zfp::array::header* h = 0) { - size_t num_64bit_entries = DIV_ROUND_UP(ZFP_HEADER_SIZE_BITS, CHAR_BIT * sizeof(uint64)); - buffer = new uint64[num_64bit_entries]; - buffer_size_bytes = num_64bit_entries * sizeof(uint64); - - if (h) - memcpy(buffer, h->buffer, BITS_TO_BYTES(ZFP_HEADER_SIZE_BITS)); - } - - ~AlignedBufferHandle() { - delete[] buffer; - } - - void copy_to_header(zfp::array::header* h) { - memcpy(h, buffer, BITS_TO_BYTES(ZFP_HEADER_SIZE_BITS)); - } -}; - -// redirect zfp_stream->bitstream to header while object remains in scope -class DualBitstreamHandle { - public: - bitstream* old_bs; - bitstream* new_bs; - zfp_stream* zfp; - - DualBitstreamHandle(zfp_stream* zfp, AlignedBufferHandle& abh) : - zfp(zfp) - { - old_bs = zfp_stream_bit_stream(zfp); - new_bs = stream_open(abh.buffer, abh.buffer_size_bytes); - - stream_rewind(new_bs); - zfp_stream_set_bit_stream(zfp, new_bs); - } - - ~DualBitstreamHandle() { - zfp_stream_set_bit_stream(zfp, old_bs); - stream_close(new_bs); - } -}; - -class ZfpFieldHandle { - public: - zfp_field* field; - - ZfpFieldHandle() { - field = zfp_field_alloc(); - } - - ZfpFieldHandle(zfp_type type, int nx, int ny, int nz) { - field = zfp_field_3d(0, type, nx, ny, nz); - } - - ~ZfpFieldHandle() { - zfp_field_free(field); - } -}; - -class ZfpStreamHandle { - public: - bitstream* bs; - zfp_stream* stream; - - ZfpStreamHandle(AlignedBufferHandle& abh) { - bs = stream_open(abh.buffer, abh.buffer_size_bytes); - stream = zfp_stream_open(bs); - } - - ~ZfpStreamHandle() { - zfp_stream_close(stream); - stream_close(bs); - } -}; - -// verify buffer is large enough, with what header describes -static bool is_valid_buffer_size(const zfp_stream* stream, uint nx, uint ny, uint nz, size_t expected_buffer_size_bytes) -{ - uint mx = ((std::max(nx, 1u)) + 3) / 4; - uint my = ((std::max(ny, 1u)) + 3) / 4; - uint mz = ((std::max(nz, 1u)) + 3) / 4; - size_t blocks = (size_t)mx * (size_t)my * (size_t)mz; - // no rounding because fixed-rate wra implies rate is multiple of word size - size_t described_buffer_size_bytes = blocks * stream->maxbits / CHAR_BIT; - - return expected_buffer_size_bytes >= described_buffer_size_bytes; -} - -static void read_header_contents(const zfp::array::header& header, size_t expected_buffer_size_bytes, uint& dims, zfp_type& type, double& rate, uint n[4]) -{ - // create zfp_stream and zfp_field structs to call C API zfp_read_header() - AlignedBufferHandle abh; - memcpy(abh.buffer, header.buffer, BITS_TO_BYTES(ZFP_HEADER_SIZE_BITS)); - - ZfpStreamHandle zsh(abh); - ZfpFieldHandle zfh; - - if (!zfp_read_header(zsh.stream, zfh.field, ZFP_HEADER_FULL)) - throw zfp::array::header::exception("Invalid ZFP header."); - - // gather metadata - dims = zfp_field_dimensionality(zfh.field); - type = zfp_field_type(zfh.field); - - uint num_block_entries = 1u << (2 * dims); - rate = (double)zsh.stream->maxbits / num_block_entries; - - zfp_field_size(zfh.field, n); - - // validate header - std::string err_msg = ""; - verify_header_contents(zsh.stream, zfh.field, err_msg); - - if (!err_msg.empty()) - throw zfp::array::header::exception(err_msg); - - if (expected_buffer_size_bytes && !is_valid_buffer_size(zsh.stream, zfh.field->nx, zfh.field->ny, zfh.field->nz, expected_buffer_size_bytes)) - throw zfp::array::header::exception("ZFP header expects a longer buffer than what was passed in."); -} - -// verifies metadata on zfp_stream and zfp_field describe a valid compressed array -static void verify_header_contents(const zfp_stream* stream, const zfp_field* field, std::string& err_msg) -{ - // verify read-header contents - zfp_type type = zfp_field_type(field); - if (type != zfp_type_float && type != zfp_type_double) - zfp::array::header::concat_sentence(err_msg, "ZFP compressed arrays do not yet support scalar types beyond floats and doubles."); - - uint dims = zfp_field_dimensionality(field); - if (dims < 1 || dims > 3) - zfp::array::header::concat_sentence(err_msg, "ZFP compressed arrays do not yet support dimensionalities beyond 1, 2, and 3."); - - if (zfp_stream_compression_mode(stream) != zfp_mode_fixed_rate) - zfp::array::header::concat_sentence(err_msg, "ZFP header specified a non fixed-rate mode, unsupported by this object."); -} diff --git a/ThirdParty/zfp/vtkzfp/include/zfp/iterator1.h b/ThirdParty/zfp/vtkzfp/include/zfp/iterator1.h deleted file mode 100644 index 310e8e2dd397072fa2f49a5c7519c23cb49ef625..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/zfp/iterator1.h +++ /dev/null @@ -1,38 +0,0 @@ -// random access iterator that visits 1D array block by block; this class is nested within zfp::array1 -class iterator { -public: - // typedefs for STL compatibility - typedef Scalar value_type; - typedef ptrdiff_t difference_type; - typedef typename array1::reference reference; - typedef typename array1::pointer pointer; - typedef std::random_access_iterator_tag iterator_category; - - iterator() : ref(0, 0) {} - iterator operator=(const iterator& it) { ref.array = it.ref.array; ref.i = it.ref.i; return *this; } - reference operator*() const { return ref; } - reference operator[](difference_type d) const { return *operator+(d); } - iterator& operator++() { increment(); return *this; } - iterator& operator--() { decrement(); return *this; } - iterator operator++(int) { iterator it = *this; increment(); return it; } - iterator operator--(int) { iterator it = *this; decrement(); return it; } - iterator operator+=(difference_type d) { ref.i += d; return *this; } - iterator operator-=(difference_type d) { ref.i -= d; return *this; } - iterator operator+(difference_type d) const { return iterator(ref.array, ref.i + d); } - iterator operator-(difference_type d) const { return iterator(ref.array, ref.i - d); } - difference_type operator-(const iterator& it) const { return static_cast<difference_type>(ref.i) - static_cast<difference_type>(it.ref.i); } - bool operator==(const iterator& it) const { return ref.array == it.ref.array && ref.i == it.ref.i; } - bool operator!=(const iterator& it) const { return !operator==(it); } - bool operator<=(const iterator& it) const { return ref.array == it.ref.array && ref.i <= it.ref.i; } - bool operator>=(const iterator& it) const { return ref.array == it.ref.array && ref.i >= it.ref.i; } - bool operator<(const iterator& it) const { return !operator>=(it); } - bool operator>(const iterator& it) const { return !operator<=(it); } - uint i() const { return ref.i; } - -protected: - friend class array1; - explicit iterator(array1* array, uint i) : ref(array, i) {} - void increment() { ref.i++; } - void decrement() { ref.i--; } - reference ref; -}; diff --git a/ThirdParty/zfp/vtkzfp/include/zfp/iterator2.h b/ThirdParty/zfp/vtkzfp/include/zfp/iterator2.h deleted file mode 100644 index 03052c4e6806a8b2dd09d04dd346f9504a9aeddd..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/zfp/iterator2.h +++ /dev/null @@ -1,42 +0,0 @@ -// forward iterator that visits 2D array block by block; this class is nested within zfp::array2 -class iterator { -public: - // typedefs for STL compatibility - typedef Scalar value_type; - typedef ptrdiff_t difference_type; - typedef typename array2::reference reference; - typedef typename array2::pointer pointer; - typedef std::forward_iterator_tag iterator_category; - - iterator() : ref(0, 0, 0) {} - iterator operator=(const iterator& it) { ref.array = it.ref.array; ref.i = it.ref.i; ref.j = it.ref.j; return *this; } - reference operator*() const { return ref; } - iterator& operator++() { increment(); return *this; } - iterator operator++(int) { iterator it = *this; increment(); return it; } - bool operator==(const iterator& it) const { return ref.array == it.ref.array && ref.i == it.ref.i && ref.j == it.ref.j; } - bool operator!=(const iterator& it) const { return !operator==(it); } - uint i() const { return ref.i; } - uint j() const { return ref.j; } - -protected: - friend class array2; - explicit iterator(array2* array, uint i, uint j) : ref(array, i, j) {} - void increment() - { - ref.i++; - if (!(ref.i & 3u) || ref.i == ref.array->nx) { - ref.i = (ref.i - 1) & ~3u; - ref.j++; - if (!(ref.j & 3u) || ref.j == ref.array->ny) { - ref.j = (ref.j - 1) & ~3u; - // done with block; advance to next - if ((ref.i += 4) >= ref.array->nx) { - ref.i = 0; - if ((ref.j += 4) >= ref.array->ny) - ref.j = ref.array->ny; - } - } - } - } - reference ref; -}; diff --git a/ThirdParty/zfp/vtkzfp/include/zfp/iterator3.h b/ThirdParty/zfp/vtkzfp/include/zfp/iterator3.h deleted file mode 100644 index 3889fc1cacdcd4c87d07930e391bc60ba94baa1b..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/zfp/iterator3.h +++ /dev/null @@ -1,50 +0,0 @@ -// forward iterator that visits 3D array block by block; this class is nested within zfp::array3 -class iterator { -public: - // typedefs for STL compatibility - typedef Scalar value_type; - typedef ptrdiff_t difference_type; - typedef typename array3::reference reference; - typedef typename array3::pointer pointer; - typedef std::forward_iterator_tag iterator_category; - - iterator() : ref(0, 0, 0, 0) {} - iterator operator=(const iterator& it) { ref.array = it.ref.array; ref.i = it.ref.i; ref.j = it.ref.j; ref.k = it.ref.k; return *this; } - reference operator*() const { return ref; } - iterator& operator++() { increment(); return *this; } - iterator operator++(int) { iterator it = *this; increment(); return it; } - bool operator==(const iterator& it) const { return ref.array == it.ref.array && ref.i == it.ref.i && ref.j == it.ref.j && ref.k == it.ref.k; } - bool operator!=(const iterator& it) const { return !operator==(it); } - uint i() const { return ref.i; } - uint j() const { return ref.j; } - uint k() const { return ref.k; } - -protected: - friend class array3; - explicit iterator(array3* array, uint i, uint j, uint k) : ref(array, i, j, k) {} - void increment() - { - ref.i++; - if (!(ref.i & 3u) || ref.i == ref.array->nx) { - ref.i = (ref.i - 1) & ~3u; - ref.j++; - if (!(ref.j & 3u) || ref.j == ref.array->ny) { - ref.j = (ref.j - 1) & ~3u; - ref.k++; - if (!(ref.k & 3u) || ref.k == ref.array->nz) { - ref.k = (ref.k - 1) & ~3u; - // done with block; advance to next - if ((ref.i += 4) >= ref.array->nx) { - ref.i = 0; - if ((ref.j += 4) >= ref.array->ny) { - ref.j = 0; - if ((ref.k += 4) >= ref.array->nz) - ref.k = ref.array->nz; - } - } - } - } - } - } - reference ref; -}; diff --git a/ThirdParty/zfp/vtkzfp/include/zfp/macros.h b/ThirdParty/zfp/vtkzfp/include/zfp/macros.h deleted file mode 100644 index be3655c701356db28da52af3ee63bf2a13615b7e..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/zfp/macros.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef ZFP_MACROS_H -#define ZFP_MACROS_H - -#define MIN(x, y) ((x) < (y) ? (x) : (y)) -#define MAX(x, y) ((x) > (y) ? (x) : (y)) - -#endif diff --git a/ThirdParty/zfp/vtkzfp/include/zfp/memory.h b/ThirdParty/zfp/vtkzfp/include/zfp/memory.h deleted file mode 100644 index 852559da3c8d7df6ded47ffd77f51a926d3c3d8f..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/zfp/memory.h +++ /dev/null @@ -1,145 +0,0 @@ -#ifndef ZFP_MEMORY_H -#define ZFP_MEMORY_H - -#ifdef _WIN32 -extern "C" { - #ifdef __MINGW32__ - #include <x86intrin.h> - #endif - - #include <malloc.h> -} -#endif - -#include <algorithm> -#include <cstdlib> -#include "zfp/types.h" - -#define unused_(x) ((void)(x)) - -namespace zfp { - -// allocate size bytes -inline void* -allocate(size_t size) -{ - return new uchar[size]; -} - -// allocate size bytes with alignment -inline void* -allocate_aligned(size_t size, size_t alignment) -{ - void* ptr; - bool is_mem_failed = false; - -#ifdef ZFP_WITH_ALIGNED_ALLOC - #ifdef __INTEL_COMPILER - ptr = _mm_malloc(size, alignment); - - #elif defined(__MINGW32__) - ptr = __mingw_aligned_malloc(size, alignment); - - #elif defined(_WIN32) - ptr = _aligned_malloc(size, alignment); - - #elif (_POSIX_C_SOURCE >= 200112L) || (_XOPEN_SOURCE >= 600) || defined(__MACH__) - is_mem_failed = posix_memalign(&ptr, alignment, size); - - #else - unused_(alignment); - ptr = malloc(size); - - #endif - -#else - unused_(alignment); - ptr = malloc(size); - -#endif - - if (is_mem_failed || (ptr == NULL)) - throw std::bad_alloc(); - - return ptr; -} - -// deallocate memory pointed to by ptr -template <typename T> -inline void -deallocate(T* ptr) -{ - delete[] ptr; -} - -template <typename T> -inline void -deallocate_aligned(T* ptr) -{ -#ifdef ZFP_WITH_ALIGNED_ALLOC - if (ptr) - #ifdef __INTEL_COMPILER - _mm_free(ptr); - #elif defined(__MINGW32__) - __mingw_aligned_free(ptr); - #elif defined(_WIN32) - _aligned_free(ptr); - #else - free(ptr); - #endif - -#else - if (ptr) - free(ptr); -#endif -} - -// reallocate size bytes -template <typename T> -inline void -reallocate(T*& ptr, size_t size) -{ - zfp::deallocate(ptr); - ptr = static_cast<T*>(zfp::allocate(size)); -} - -template <typename T> -inline void -reallocate_aligned(T*& ptr, size_t size, size_t alignment) -{ - zfp::deallocate_aligned(ptr); - ptr = static_cast<T*>(zfp::allocate_aligned(size, alignment)); -} - -// clone array 'T src[count]' -template <typename T> -inline void -clone(T*& dst, const T* src, size_t count) -{ - zfp::deallocate(dst); - if (src) { - dst = static_cast<T*>(zfp::allocate(count * sizeof(T))); - std::copy(src, src + count, dst); - } - else - dst = 0; -} - -template <typename T> -inline void -clone_aligned(T*& dst, const T* src, size_t count, size_t alignment) -{ - zfp::deallocate_aligned(dst); - if (src) { - dst = static_cast<T*>(zfp::allocate_aligned(count * sizeof(T), alignment)); - std::copy(src, src + count, dst); - } - else - dst = 0; -} - -} - -#undef unused_ - -#endif diff --git a/ThirdParty/zfp/vtkzfp/include/zfp/pointer1.h b/ThirdParty/zfp/vtkzfp/include/zfp/pointer1.h deleted file mode 100644 index f58557c0df368b5672164ad61c268b6bcdc02b21..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/zfp/pointer1.h +++ /dev/null @@ -1,30 +0,0 @@ -// pointer to a 1D array element; this class is nested within zfp::array1 -class pointer { -public: - pointer() : ref(0, 0) {} - pointer operator=(const pointer& p) { ref.array = p.ref.array; ref.i = p.ref.i; return *this; } - reference operator*() const { return ref; } - reference operator[](ptrdiff_t d) const { return *operator+(d); } - pointer& operator++() { increment(); return *this; } - pointer& operator--() { decrement(); return *this; } - pointer operator++(int) { pointer p = *this; increment(); return p; } - pointer operator--(int) { pointer p = *this; decrement(); return p; } - pointer operator+=(ptrdiff_t d) { ref.i += d; return *this; } - pointer operator-=(ptrdiff_t d) { ref.i -= d; return *this; } - pointer operator+(ptrdiff_t d) const { pointer p = *this; p += d; return p; } - pointer operator-(ptrdiff_t d) const { pointer p = *this; p -= d; return p; } - ptrdiff_t operator-(const pointer& p) const { return index() - p.index(); } - bool operator==(const pointer& p) const { return ref.array == p.ref.array && ref.i == p.ref.i; } - bool operator!=(const pointer& p) const { return !operator==(p); } - -protected: - friend class array1; - friend class reference; - explicit pointer(reference r) : ref(r) {} - explicit pointer(array1* array, uint i) : ref(array, i) {} - ptrdiff_t index() const { return ref.i; } - void set(ptrdiff_t index) { ref.i = index; } - void increment() { ref.i++; } - void decrement() { ref.i--; } - reference ref; -}; diff --git a/ThirdParty/zfp/vtkzfp/include/zfp/pointer2.h b/ThirdParty/zfp/vtkzfp/include/zfp/pointer2.h deleted file mode 100644 index dcdb518fb90072a282dccb4f61a36d5d289667b2..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/zfp/pointer2.h +++ /dev/null @@ -1,42 +0,0 @@ -// pointer to a 2D array element; this class is nested within zfp::array2 -class pointer { -public: - pointer() : ref(0, 0, 0) {} - pointer operator=(const pointer& p) { ref.array = p.ref.array; ref.i = p.ref.i; ref.j = p.ref.j; return *this; } - reference operator*() const { return ref; } - reference operator[](ptrdiff_t d) const { return *operator+(d); } - pointer& operator++() { increment(); return *this; } - pointer& operator--() { decrement(); return *this; } - pointer operator++(int) { pointer p = *this; increment(); return p; } - pointer operator--(int) { pointer p = *this; decrement(); return p; } - pointer operator+=(ptrdiff_t d) { set(index() + d); return *this; } - pointer operator-=(ptrdiff_t d) { set(index() - d); return *this; } - pointer operator+(ptrdiff_t d) const { pointer p = *this; p += d; return p; } - pointer operator-(ptrdiff_t d) const { pointer p = *this; p -= d; return p; } - ptrdiff_t operator-(const pointer& p) const { return index() - p.index(); } - bool operator==(const pointer& p) const { return ref.array == p.ref.array && ref.i == p.ref.i && ref.j == p.ref.j; } - bool operator!=(const pointer& p) const { return !operator==(p); } - -protected: - friend class array2; - friend class reference; - explicit pointer(reference r) : ref(r) {} - explicit pointer(array2* array, uint i, uint j) : ref(array, i, j) {} - ptrdiff_t index() const { return ref.i + ref.array->nx * ref.j; } - void set(ptrdiff_t index) { ref.array->ij(ref.i, ref.j, index); } - void increment() - { - if (++ref.i == ref.array->nx) { - ref.i = 0; - ref.j++; - } - } - void decrement() - { - if (!ref.i--) { - ref.i = ref.array->nx - 1; - ref.j--; - } - } - reference ref; -}; diff --git a/ThirdParty/zfp/vtkzfp/include/zfp/pointer3.h b/ThirdParty/zfp/vtkzfp/include/zfp/pointer3.h deleted file mode 100644 index 091af6044b45cf96db396edc44a3ee7bd5b2c5c6..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/zfp/pointer3.h +++ /dev/null @@ -1,48 +0,0 @@ -// pointer to a 3D array element; this class is nested within zfp::array3 -class pointer { -public: - pointer() : ref(0, 0, 0, 0) {} - pointer operator=(const pointer& p) { ref.array = p.ref.array; ref.i = p.ref.i; ref.j = p.ref.j; ref.k = p.ref.k; return *this; } - reference operator*() const { return ref; } - reference operator[](ptrdiff_t d) const { return *operator+(d); } - pointer& operator++() { increment(); return *this; } - pointer& operator--() { decrement(); return *this; } - pointer operator++(int) { pointer p = *this; increment(); return p; } - pointer operator--(int) { pointer p = *this; decrement(); return p; } - pointer operator+=(ptrdiff_t d) { set(index() + d); return *this; } - pointer operator-=(ptrdiff_t d) { set(index() - d); return *this; } - pointer operator+(ptrdiff_t d) const { pointer p = *this; p += d; return p; } - pointer operator-(ptrdiff_t d) const { pointer p = *this; p -= d; return p; } - ptrdiff_t operator-(const pointer& p) const { return index() - p.index(); } - bool operator==(const pointer& p) const { return ref.array == p.ref.array && ref.i == p.ref.i && ref.j == p.ref.j && ref.k == p.ref.k; } - bool operator!=(const pointer& p) const { return !operator==(p); } - -protected: - friend class array3; - friend class reference; - explicit pointer(reference r) : ref(r) {} - explicit pointer(array3* array, uint i, uint j, uint k) : ref(array, i, j, k) {} - ptrdiff_t index() const { return ref.i + ref.array->nx * (ref.j + ref.array->ny * ref.k); } - void set(ptrdiff_t index) { ref.array->ijk(ref.i, ref.j, ref.k, index); } - void increment() - { - if (++ref.i == ref.array->nx) { - ref.i = 0; - if (++ref.j == ref.array->ny) { - ref.j = 0; - ref.k++; - } - } - } - void decrement() - { - if (!ref.i--) { - ref.i = ref.array->nx - 1; - if (!ref.j--) { - ref.j = ref.array->ny - 1; - ref.k--; - } - } - } - reference ref; -}; diff --git a/ThirdParty/zfp/vtkzfp/include/zfp/reference1.h b/ThirdParty/zfp/vtkzfp/include/zfp/reference1.h deleted file mode 100644 index 99f2e6a67643d0fb47db27ccaccdd418c71cf301..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/zfp/reference1.h +++ /dev/null @@ -1,27 +0,0 @@ -// reference to a 1D array element; this class is nested within zfp::array1 -class reference { -public: - operator Scalar() const { return array->get(i); } - reference operator=(const reference& r) { array->set(i, r.operator Scalar()); return *this; } - reference operator=(Scalar val) { array->set(i, val); return *this; } - reference operator+=(Scalar val) { array->add(i, val); return *this; } - reference operator-=(Scalar val) { array->sub(i, val); return *this; } - reference operator*=(Scalar val) { array->mul(i, val); return *this; } - reference operator/=(Scalar val) { array->div(i, val); return *this; } - pointer operator&() const { return pointer(*this); } - // swap two array elements via proxy references - friend void swap(reference a, reference b) - { - Scalar x = a.operator Scalar(); - Scalar y = b.operator Scalar(); - b.operator=(x); - a.operator=(y); - } - -protected: - friend class array1; - friend class iterator; - explicit reference(array1* array, uint i) : array(array), i(i) {} - array1* array; - uint i; -}; diff --git a/ThirdParty/zfp/vtkzfp/include/zfp/reference2.h b/ThirdParty/zfp/vtkzfp/include/zfp/reference2.h deleted file mode 100644 index 76a0bd3b10158e015203e644a74070159703eed9..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/zfp/reference2.h +++ /dev/null @@ -1,27 +0,0 @@ -// reference to a 2D array element; this class is nested within zfp::array2 -class reference { -public: - operator Scalar() const { return array->get(i, j); } - reference operator=(const reference& r) { array->set(i, j, r.operator Scalar()); return *this; } - reference operator=(Scalar val) { array->set(i, j, val); return *this; } - reference operator+=(Scalar val) { array->add(i, j, val); return *this; } - reference operator-=(Scalar val) { array->sub(i, j, val); return *this; } - reference operator*=(Scalar val) { array->mul(i, j, val); return *this; } - reference operator/=(Scalar val) { array->div(i, j, val); return *this; } - pointer operator&() const { return pointer(*this); } - // swap two array elements via proxy references - friend void swap(reference a, reference b) - { - Scalar x = a.operator Scalar(); - Scalar y = b.operator Scalar(); - b.operator=(x); - a.operator=(y); - } - -protected: - friend class array2; - friend class iterator; - explicit reference(array2* array, uint i, uint j) : array(array), i(i), j(j) {} - array2* array; - uint i, j; -}; diff --git a/ThirdParty/zfp/vtkzfp/include/zfp/reference3.h b/ThirdParty/zfp/vtkzfp/include/zfp/reference3.h deleted file mode 100644 index 91175e18033c1c1a578346bc0c5a0342e646853b..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/zfp/reference3.h +++ /dev/null @@ -1,27 +0,0 @@ -// reference to a 3D array element; this class is nested within zfp::array3 -class reference { -public: - operator Scalar() const { return array->get(i, j, k); } - reference operator=(const reference& r) { array->set(i, j, k, r.operator Scalar()); return *this; } - reference operator=(Scalar val) { array->set(i, j, k, val); return *this; } - reference operator+=(Scalar val) { array->add(i, j, k, val); return *this; } - reference operator-=(Scalar val) { array->sub(i, j, k, val); return *this; } - reference operator*=(Scalar val) { array->mul(i, j, k, val); return *this; } - reference operator/=(Scalar val) { array->div(i, j, k, val); return *this; } - pointer operator&() const { return pointer(*this); } - // swap two array elements via proxy references - friend void swap(reference a, reference b) - { - Scalar x = a.operator Scalar(); - Scalar y = b.operator Scalar(); - b.operator=(x); - a.operator=(y); - } - -protected: - friend class array3; - friend class iterator; - explicit reference(array3* array, uint i, uint j, uint k) : array(array), i(i), j(j), k(k) {} - array3* array; - uint i, j, k; -}; diff --git a/ThirdParty/zfp/vtkzfp/include/zfp/system.h b/ThirdParty/zfp/vtkzfp/include/zfp/system.h deleted file mode 100644 index 5394196482551e342c9f673d2f398469a487cd59..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/zfp/system.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef ZFP_SYSTEM_H -#define ZFP_SYSTEM_H - -#if __STDC_VERSION__ >= 199901L - #define restrict_ restrict -#else - #define restrict_ -#endif - -/* macros for exporting and importing symbols */ -#ifdef _MSC_VER - #define export_ __declspec(dllexport) - /* export (import) symbols when ZFP_SOURCE is (is not) defined */ - #ifdef ZFP_SOURCE - #ifdef __cplusplus - #define extern_ extern "C" __declspec(dllexport) - #else - #define extern_ extern __declspec(dllexport) - #endif - #else - #ifdef __cplusplus - #define extern_ extern "C" __declspec(dllimport) - #else - #define extern_ extern __declspec(dllimport) - #endif - #endif -#else /* !_MSC_VER */ - #define export_ - #ifdef __cplusplus - #define extern_ extern "C" - #else - #define extern_ extern - #endif -#endif - -#ifdef __GNUC__ - /* L1 cache line size for alignment purposes */ - #ifndef ZFP_CACHE_LINE_SIZE - #define ZFP_CACHE_LINE_SIZE 0x100 - #endif - #define align_(n) __attribute__((aligned(n))) - #define cache_align_(x) x align_(ZFP_CACHE_LINE_SIZE) -#else - #define cache_align_(x) x -#endif - -#endif diff --git a/ThirdParty/zfp/vtkzfp/include/zfp/types.h b/ThirdParty/zfp/vtkzfp/include/zfp/types.h deleted file mode 100644 index f57e1f896617b1dad55addd42ca06a274423dbf6..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/zfp/types.h +++ /dev/null @@ -1,107 +0,0 @@ -#ifndef ZFP_TYPES_H -#define ZFP_TYPES_H - -typedef unsigned char uchar; -typedef unsigned short ushort; -typedef unsigned int uint; - -#if __STDC_VERSION__ >= 199901L - /* C99: use standard integer types */ - #include <stdint.h> - #include <inttypes.h> - #define INT64C(x) INT64_C(x) - #define UINT64C(x) UINT64_C(x) - #define INT64PRId PRId64 - #define INT64PRIi PRIi64 - #define UINT64PRIo PRIo64 - #define UINT64PRIu PRIu64 - #define UINT64PRIx PRIx64 - #define INT64SCNd SCNd64 - #define INT64SCNi SCNi64 - #define UINT64SCNo SCNo64 - #define UINT64SCNu SCNu64 - #define UINT64SCNx SCNx64 - typedef int8_t int8; - typedef uint8_t uint8; - typedef int16_t int16; - typedef uint16_t uint16; - typedef int32_t int32; - typedef uint32_t uint32; - typedef int64_t int64; - typedef uint64_t uint64; -#else - /* C89: assume common integer types */ - typedef signed char int8; - typedef unsigned char uint8; - typedef signed short int16; - typedef unsigned short uint16; - - /* assume 32-bit integers (LP64, LLP64) */ - typedef signed int int32; - typedef unsigned int uint32; - - /* determine 64-bit data model */ - #if defined(_WIN32) || defined(_WIN64) - /* assume ILP32 or LLP64 (MSVC, MinGW) */ - #define ZFP_LLP64 1 - #else - /* assume LP64 (Linux, macOS, ...) */ - #define ZFP_LP64 1 - #endif - - /* concatenation for literal suffixes */ - #define _zfp_cat_(x, y) x ## y - #define _zfp_cat(x, y) _zfp_cat_(x, y) - - /* signed 64-bit integers */ - #if defined(ZFP_INT64) && defined(ZFP_INT64_SUFFIX) - #define INT64C(x) _zfp_cat(x, ZFP_INT64_SUFFIX) - #define INT64PRId #ZFP_INT64_SUFFIX "d" - #define INT64PRIi #ZFP_INT64_SUFFIX "i" - typedef ZFP_INT64 int64; - #elif ZFP_LP64 - #define INT64C(x) x ## l - #define INT64PRId "ld" - #define INT64PRIi "li" - typedef signed long int64; - #elif ZFP_LLP64 - #define INT64C(x) x ## ll - #define INT64PRId "lld" - #define INT64PRIi "lli" - typedef signed long long int64; - #else - #error "unknown 64-bit signed integer type" - #endif - #define INT64SCNd INT64PRId - #define INT64SCNi INT64PRIi - - /* unsigned 64-bit integers */ - #if defined(ZFP_UINT64) && defined(ZFP_UINT64_SUFFIX) - #define UINT64C(x) _zfp_cat(x, ZFP_UINT64_SUFFIX) - #ifdef ZFP_INT64_SUFFIX - #define UINT64PRIo #ZFP_INT64_SUFFIX "o" - #define UINT64PRIu #ZFP_INT64_SUFFIX "u" - #define UINT64PRIx #ZFP_INT64_SUFFIX "x" - #endif - typedef ZFP_UINT64 uint64; - #elif ZFP_LP64 - #define UINT64C(x) x ## ul - #define UINT64PRIo "lo" - #define UINT64PRIu "lu" - #define UINT64PRIx "lx" - typedef unsigned long uint64; - #elif ZFP_LLP64 - #define UINT64C(x) x ## ull - #define UINT64PRIo "llo" - #define UINT64PRIu "llu" - #define UINT64PRIx "llx" - typedef unsigned long long uint64; - #else - #error "unknown 64-bit unsigned integer type" - #endif - #define UINT64SCNo UINT64PRIo - #define UINT64SCNu UINT64PRIu - #define UINT64SCNx UINT64PRIx -#endif - -#endif diff --git a/ThirdParty/zfp/vtkzfp/include/zfp/view1.h b/ThirdParty/zfp/vtkzfp/include/zfp/view1.h deleted file mode 100644 index 6129ae5ee06431720931c27bbd0d7d6726b5dee3..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/zfp/view1.h +++ /dev/null @@ -1,291 +0,0 @@ -// 1D array views; these classes are nested within zfp::array1 - -// abstract view of 1D array (base class) -class preview { -public: - // rate in bits per value - double rate() const { return array->rate(); } - - // dimensions of (sub)array - size_t size() const { return size_t(nx); } - - // local to global array index - uint global_x(uint i) const { return x + i; } - -protected: - // construction and assignment--perform shallow copy of (sub)array - explicit preview(array1* array) : array(array), x(0), nx(array->nx) {} - explicit preview(array1* array, uint x, uint nx) : array(array), x(x), nx(nx) {} - preview& operator=(array1* a) - { - array = a; - x = 0; - nx = a->nx; - return *this; - } - - array1* array; // underlying container - uint x; // offset into array - uint nx; // dimensions of subarray -}; - -// generic read-only view into a rectangular subset of a 1D array -class const_view : public preview { -protected: - using preview::array; - using preview::x; - using preview::nx; -public: - // construction--perform shallow copy of (sub)array - const_view(array1* array) : preview(array) {} - const_view(array1* array, uint x, uint nx) : preview(array, x, nx) {} - - // dimensions of (sub)array - uint size_x() const { return nx; } - - // [i] accessor - Scalar operator[](uint index) const { return array->get(x + index); } - - // (i) accessor - Scalar operator()(uint i) const { return array->get(x + i); } -}; - -// generic read-write view into a rectangular subset of a 1D array -class view : public const_view { -protected: - using preview::array; - using preview::x; - using preview::nx; -public: - // construction--perform shallow copy of (sub)array - view(array1* array) : const_view(array) {} - view(array1* array, uint x, uint nx) : const_view(array, x, nx) {} - - // [i] accessor from base class - using const_view::operator[]; - - // (i) accessor from base class - using const_view::operator(); - - // [i] mutator - reference operator[](uint index) { return reference(array, x + index); } - - // (i) mutator - reference operator()(uint i) { return reference(array, x + i); } -}; - -// thread-safe read-only view of 1D (sub)array with private cache -class private_const_view : public preview { -protected: - using preview::array; - using preview::x; - using preview::nx; -public: - // construction--perform shallow copy of (sub)array - private_const_view(array1* array) : - preview(array), - cache(array->cache.size()) - { - init(); - } - private_const_view(array1* array, uint x, uint nx) : - preview(array, x, nx), - cache(array->cache.size()) - { - init(); - } - - // destructor - ~private_const_view() - { - stream_close(zfp->stream); - zfp_stream_close(zfp); - } - - // dimensions of (sub)array - uint size_x() const { return nx; } - - // cache size in number of bytes - size_t cache_size() const { return cache.size() * sizeof(CacheLine); } - - // set minimum cache size in bytes (array dimensions must be known) - void set_cache_size(size_t csize) - { - cache.resize(array->lines(csize, nx)); - } - - // empty cache without compressing modified cached blocks - void clear_cache() const { cache.clear(); } - - // (i) accessor - Scalar operator()(uint i) const { return get(x + i); } - -protected: - // cache line representing one block of decompressed values - class CacheLine { - public: - const Scalar& operator()(uint i) const { return a[index(i)]; } - Scalar& operator()(uint i) { return a[index(i)]; } - const Scalar* data() const { return a; } - Scalar* data() { return a; } - protected: - static uint index(uint i) { return i & 3u; } - Scalar a[4]; - }; - - // copy private data - void init() - { - // copy compressed stream - zfp = zfp_stream_open(0); - *zfp = *array->zfp; - // copy bit stream - zfp->stream = stream_clone(array->zfp->stream); - } - - // inspector - const Scalar& get(uint i) const - { - const CacheLine* p = line(i); - return (*p)(i); - } - - // return cache line for i; may require write-back and fetch - CacheLine* line(uint i) const - { - CacheLine* p = 0; - uint b = array->block(i); - typename Cache<CacheLine>::Tag t = cache.access(p, b + 1, false); - uint c = t.index() - 1; - // fetch cache line; no writeback possible since view is read-only - if (c != b) - decode(b, p->data()); - return p; - } - - // decode block with given index - void decode(uint index, Scalar* block) const - { - stream_rseek(zfp->stream, index * array->blkbits); - Codec::decode_block_1(zfp, block, array->shape ? array->shape[index] : 0); - } - - zfp_stream* zfp; // stream of compressed blocks - mutable Cache<CacheLine> cache; // cache of decompressed blocks -}; - -// thread-safe read-write view of private 1D (sub)array -class private_view : public private_const_view { -protected: - using preview::array; - using preview::x; - using preview::nx; - using private_const_view::zfp; - using private_const_view::cache; - using private_const_view::init; - using private_const_view::decode; - class view_reference; - typedef typename private_const_view::CacheLine CacheLine; -public: - // construction--perform shallow copy of (sub)array - private_view(array1* array) : private_const_view(array) {} - private_view(array1* array, uint x, uint nx) : private_const_view(array, x, nx) {} - - // partition view into count block-aligned pieces, with 0 <= index < count - void partition(uint index, uint count) - { - partition(x, nx, index, count); - } - - // flush cache by compressing all modified cached blocks - void flush_cache() const - { - for (typename Cache<CacheLine>::const_iterator p = cache.first(); p; p++) { - if (p->tag.dirty()) { - uint b = p->tag.index() - 1; - encode(b, p->line->data()); - } - cache.flush(p->line); - } - } - - // (i) accessor from base class - using private_const_view::operator(); - - // (i) mutator - view_reference operator()(uint i) { return view_reference(this, x + i); } - -protected: - class view_reference { - public: - operator Scalar() const { return view->get(i); } - view_reference operator=(const view_reference& r) { view->set(i, r.operator Scalar()); return *this; } - view_reference operator=(Scalar val) { view->set(i, val); return *this; } - view_reference operator+=(Scalar val) { view->add(i, val); return *this; } - view_reference operator-=(Scalar val) { view->sub(i, val); return *this; } - view_reference operator*=(Scalar val) { view->mul(i, val); return *this; } - view_reference operator/=(Scalar val) { view->div(i, val); return *this; } - // swap two array elements via proxy references - friend void swap(view_reference a, view_reference b) - { - Scalar x = a.operator Scalar(); - Scalar y = b.operator Scalar(); - b.operator=(x); - a.operator=(y); - } - - protected: - friend class private_view; - explicit view_reference(private_view* view, uint i) : view(view), i(i) {} - private_view* view; - uint i; - }; - - // block-aligned partition of [offset, offset + size): index out of count - static void partition(uint& offset, uint& size, uint index, uint count) - { - uint bmin = offset / 4; - uint bmax = (offset + size + 3) / 4; - uint xmin = std::max(offset + 0, 4 * (bmin + (bmax - bmin) * (index + 0) / count)); - uint xmax = std::min(offset + size, 4 * (bmin + (bmax - bmin) * (index + 1) / count)); - offset = xmin; - size = xmax - xmin; - } - - // mutator - void set(uint i, Scalar val) - { - CacheLine* p = line(i, true); - (*p)(i) = val; - } - - // in-place updates - void add(uint i, Scalar val) { (*line(i, true))(i) += val; } - void sub(uint i, Scalar val) { (*line(i, true))(i) -= val; } - void mul(uint i, Scalar val) { (*line(i, true))(i) *= val; } - void div(uint i, Scalar val) { (*line(i, true))(i) /= val; } - - // return cache line for i; may require write-back and fetch - CacheLine* line(uint i, bool write) const - { - CacheLine* p = 0; - uint b = array->block(i); - typename Cache<CacheLine>::Tag t = cache.access(p, b + 1, write); - uint c = t.index() - 1; - if (c != b) { - // write back occupied cache line if it is dirty - if (t.dirty()) - encode(c, p->data()); - decode(b, p->data()); - } - return p; - } - - // encode block with given index - void encode(uint index, const Scalar* block) const - { - stream_wseek(zfp->stream, index * array->blkbits); - Codec::encode_block_1(zfp, block, array->shape ? array->shape[index] : 0); - stream_flush(zfp->stream); - } -}; diff --git a/ThirdParty/zfp/vtkzfp/include/zfp/view2.h b/ThirdParty/zfp/vtkzfp/include/zfp/view2.h deleted file mode 100644 index fcfdf8cad8f05594ca3963541590eec81f305888..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/zfp/view2.h +++ /dev/null @@ -1,393 +0,0 @@ -// 2D array views; these classes are nested within zfp::array2 - -// abstract view of 2D array (base class) -class preview { -public: - // rate in bits per value - double rate() const { return array->rate(); } - - // dimensions of (sub)array - size_t size() const { return size_t(nx) * size_t(ny); } - - // local to global array indices - uint global_x(uint i) const { return x + i; } - uint global_y(uint j) const { return y + j; } - -protected: - // construction and assignment--perform shallow copy of (sub)array - explicit preview(array2* array) : array(array), x(0), y(0), nx(array->nx), ny(array->ny) {} - explicit preview(array2* array, uint x, uint y, uint nx, uint ny) : array(array), x(x), y(y), nx(nx), ny(ny) {} - preview& operator=(array2* a) - { - array = a; - x = y = 0; - nx = a->nx; - ny = a->ny; - return *this; - } - - array2* array; // underlying container - uint x, y; // offset into array - uint nx, ny; // dimensions of subarray -}; - -// generic read-only view into a rectangular subset of a 2D array -class const_view : public preview { -protected: - using preview::array; - using preview::x; - using preview::y; - using preview::nx; - using preview::ny; -public: - // construction--perform shallow copy of (sub)array - const_view(array2* array) : preview(array) {} - const_view(array2* array, uint x, uint y, uint nx, uint ny) : preview(array, x, y, nx, ny) {} - - // dimensions of (sub)array - uint size_x() const { return nx; } - uint size_y() const { return ny; } - - // (i, j) accessor - Scalar operator()(uint i, uint j) const { return array->get(x + i, y + j); } -}; - -// generic read-write view into a rectangular subset of a 2D array -class view : public const_view { -protected: - using preview::array; - using preview::x; - using preview::y; - using preview::nx; - using preview::ny; -public: - // construction--perform shallow copy of (sub)array - view(array2* array) : const_view(array) {} - view(array2* array, uint x, uint y, uint nx, uint ny) : const_view(array, x, y, nx, ny) {} - - // (i, j) accessor from base class - using const_view::operator(); - - // (i, j) mutator - reference operator()(uint i, uint j) { return reference(array, x + i, y + j); } -}; - -// flat view of 2D array (operator[] returns scalar) -class flat_view : public view { -protected: - using preview::array; - using preview::x; - using preview::y; - using preview::nx; - using preview::ny; -public: - // construction--perform shallow copy of (sub)array - flat_view(array2* array) : view(array) {} - flat_view(array2* array, uint x, uint y, uint nx, uint ny) : view(array, x, y, nx, ny) {} - - // convert (i, j) index to flat index - uint index(uint i, uint j) const { return i + nx * j; } - - // convert flat index to (i, j) index - void ij(uint& i, uint& j, uint index) const - { - i = index % nx; index /= nx; - j = index; - } - - // flat index accessors - Scalar operator[](uint index) const - { - uint i, j; - ij(i, j, index); - return array->get(x + i, y + j); - } - reference operator[](uint index) - { - uint i, j; - ij(i, j, index); - return reference(array, x + i, y + j); - } -}; - -// forward declaration of friends -class nested_view1; -class nested_view2; - -// nested view into a 1D rectangular subset of a 2D array -class nested_view1 : public preview { -protected: - using preview::array; - using preview::x; - using preview::y; - using preview::nx; - using preview::ny; -public: - // dimensions of (sub)array - uint size_x() const { return nx; } - - // [i] accessor and mutator - Scalar operator[](uint index) const { return array->get(x + index, y); } - reference operator[](uint index) { return reference(array, x + index, y); } - - // (i) accessor and mutator - Scalar operator()(uint i) const { return array->get(x + i, y); } - reference operator()(uint i) { return reference(array, x + i, y); } - -protected: - // construction--perform shallow copy of (sub)array - friend class nested_view2; - explicit nested_view1(array2* array) : preview(array) {} - explicit nested_view1(array2* array, uint x, uint y, uint nx, uint ny) : preview(array, x, y, nx, ny) {} -}; - -// nested view into a 2D rectangular subset of a 2D array -class nested_view2 : public preview { -protected: - using preview::array; - using preview::x; - using preview::y; - using preview::nx; - using preview::ny; -public: - // construction--perform shallow copy of (sub)array - nested_view2(array2* array) : preview(array) {} - nested_view2(array2* array, uint x, uint y, uint nx, uint ny) : preview(array, x, y, nx, ny) {} - - // dimensions of (sub)array - uint size_x() const { return nx; } - uint size_y() const { return ny; } - - // 1D view - nested_view1 operator[](uint index) const { return nested_view1(array, x, y + index, nx, 1); } - - // (i, j) accessor and mutator - Scalar operator()(uint i, uint j) const { return array->get(x + i, y + j); } - reference operator()(uint i, uint j) { return reference(array, x + i, y + j); } -}; - -typedef nested_view2 nested_view; - -// thread-safe read-only view of 2D (sub)array with private cache -class private_const_view : public preview { -protected: - using preview::array; - using preview::x; - using preview::y; - using preview::nx; - using preview::ny; -public: - // construction--perform shallow copy of (sub)array - private_const_view(array2* array) : - preview(array), - cache(array->cache.size()) - { - init(); - } - private_const_view(array2* array, uint x, uint y, uint nx, uint ny) : - preview(array, x, y, nx, ny), - cache(array->cache.size()) - { - init(); - } - - // destructor - ~private_const_view() - { - stream_close(zfp->stream); - zfp_stream_close(zfp); - } - - // dimensions of (sub)array - uint size_x() const { return nx; } - uint size_y() const { return ny; } - - // cache size in number of bytes - size_t cache_size() const { return cache.size() * sizeof(CacheLine); } - - // set minimum cache size in bytes (array dimensions must be known) - void set_cache_size(size_t csize) - { - cache.resize(array->lines(csize, nx, ny)); - } - - // empty cache without compressing modified cached blocks - void clear_cache() const { cache.clear(); } - - // (i, j) accessor - Scalar operator()(uint i, uint j) const { return get(x + i, y + j); } - -protected: - // cache line representing one block of decompressed values - class CacheLine { - public: - const Scalar& operator()(uint i, uint j) const { return a[index(i, j)]; } - Scalar& operator()(uint i, uint j) { return a[index(i, j)]; } - const Scalar* data() const { return a; } - Scalar* data() { return a; } - protected: - static uint index(uint i, uint j) { return (i & 3u) + 4 * (j & 3u); } - Scalar a[16]; - }; - - // copy private data - void init() - { - // copy compressed stream - zfp = zfp_stream_open(0); - *zfp = *array->zfp; - // copy bit stream - zfp->stream = stream_clone(array->zfp->stream); - } - - // inspector - const Scalar& get(uint i, uint j) const - { - const CacheLine* p = line(i, j); - return (*p)(i, j); - } - - // return cache line for (i, j); may require write-back and fetch - CacheLine* line(uint i, uint j) const - { - CacheLine* p = 0; - uint b = array->block(i, j); - typename Cache<CacheLine>::Tag t = cache.access(p, b + 1, false); - uint c = t.index() - 1; - // fetch cache line; no writeback possible since view is read-only - if (c != b) - decode(b, p->data()); - return p; - } - - // decode block with given index - void decode(uint index, Scalar* block) const - { - stream_rseek(zfp->stream, index * array->blkbits); - Codec::decode_block_2(zfp, block, array->shape ? array->shape[index] : 0); - } - - zfp_stream* zfp; // stream of compressed blocks - mutable Cache<CacheLine> cache; // cache of decompressed blocks -}; - -// thread-safe read-write view of private 2D (sub)array -class private_view : public private_const_view { -protected: - using preview::array; - using preview::x; - using preview::y; - using preview::nx; - using preview::ny; - using private_const_view::zfp; - using private_const_view::cache; - using private_const_view::init; - using private_const_view::decode; - class view_reference; - typedef typename private_const_view::CacheLine CacheLine; -public: - // construction--perform shallow copy of (sub)array - private_view(array2* array) : private_const_view(array) {} - private_view(array2* array, uint x, uint y, uint nx, uint ny) : private_const_view(array, x, y, nx, ny) {} - - // partition view into count block-aligned pieces, with 0 <= index < count - void partition(uint index, uint count) - { - if (nx > ny) - partition(x, nx, index, count); - else - partition(y, ny, index, count); - } - - // flush cache by compressing all modified cached blocks - void flush_cache() const - { - for (typename Cache<CacheLine>::const_iterator p = cache.first(); p; p++) { - if (p->tag.dirty()) { - uint b = p->tag.index() - 1; - encode(b, p->line->data()); - } - cache.flush(p->line); - } - } - - // (i, j) accessor from base class - using private_const_view::operator(); - - // (i, j) mutator - view_reference operator()(uint i, uint j) { return view_reference(this, x + i, y + j); } - -protected: - class view_reference { - public: - operator Scalar() const { return view->get(i, j); } - view_reference operator=(const view_reference& r) { view->set(i, j, r.operator Scalar()); return *this; } - view_reference operator=(Scalar val) { view->set(i, j, val); return *this; } - view_reference operator+=(Scalar val) { view->add(i, j, val); return *this; } - view_reference operator-=(Scalar val) { view->sub(i, j, val); return *this; } - view_reference operator*=(Scalar val) { view->mul(i, j, val); return *this; } - view_reference operator/=(Scalar val) { view->div(i, j, val); return *this; } - // swap two array elements via proxy references - friend void swap(view_reference a, view_reference b) - { - Scalar x = a.operator Scalar(); - Scalar y = b.operator Scalar(); - b.operator=(x); - a.operator=(y); - } - - protected: - friend class private_view; - explicit view_reference(private_view* view, uint i, uint j) : view(view), i(i), j(j) {} - private_view* view; - uint i, j; - }; - - // block-aligned partition of [offset, offset + size): index out of count - static void partition(uint& offset, uint& size, uint index, uint count) - { - uint bmin = offset / 4; - uint bmax = (offset + size + 3) / 4; - uint xmin = std::max(offset + 0, 4 * (bmin + (bmax - bmin) * (index + 0) / count)); - uint xmax = std::min(offset + size, 4 * (bmin + (bmax - bmin) * (index + 1) / count)); - offset = xmin; - size = xmax - xmin; - } - - // mutator - void set(uint i, uint j, Scalar val) - { - CacheLine* p = line(i, j, true); - (*p)(i, j) = val; - } - - // in-place updates - void add(uint i, uint j, Scalar val) { (*line(i, j, true))(i, j) += val; } - void sub(uint i, uint j, Scalar val) { (*line(i, j, true))(i, j) -= val; } - void mul(uint i, uint j, Scalar val) { (*line(i, j, true))(i, j) *= val; } - void div(uint i, uint j, Scalar val) { (*line(i, j, true))(i, j) /= val; } - - // return cache line for (i, j); may require write-back and fetch - CacheLine* line(uint i, uint j, bool write) const - { - CacheLine* p = 0; - uint b = array->block(i, j); - typename Cache<CacheLine>::Tag t = cache.access(p, b + 1, write); - uint c = t.index() - 1; - if (c != b) { - // write back occupied cache line if it is dirty - if (t.dirty()) - encode(c, p->data()); - decode(b, p->data()); - } - return p; - } - - // encode block with given index - void encode(uint index, const Scalar* block) const - { - stream_wseek(zfp->stream, index * array->blkbits); - Codec::encode_block_2(zfp, block, array->shape ? array->shape[index] : 0); - stream_flush(zfp->stream); - } -}; diff --git a/ThirdParty/zfp/vtkzfp/include/zfp/view3.h b/ThirdParty/zfp/vtkzfp/include/zfp/view3.h deleted file mode 100644 index b1bf457fc8a1f144ab67e4fc9f0caf1221eb494a..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/zfp/view3.h +++ /dev/null @@ -1,445 +0,0 @@ -// 3D array views; these classes are nested within zfp::array3 - -// abstract view of 3D array (base class) -class preview { -public: - // rate in bits per value - double rate() const { return array->rate(); } - - // dimensions of (sub)array - size_t size() const { return size_t(nx) * size_t(ny) * size_t(nz); } - - // local to global array indices - uint global_x(uint i) const { return x + i; } - uint global_y(uint j) const { return y + j; } - uint global_z(uint k) const { return z + k; } - -protected: - // construction and assignment--perform shallow copy of (sub)array - explicit preview(array3* array) : array(array), x(0), y(0), z(0), nx(array->nx), ny(array->ny), nz(array->nz) {} - explicit preview(array3* array, uint x, uint y, uint z, uint nx, uint ny, uint nz) : array(array), x(x), y(y), z(z), nx(nx), ny(ny), nz(nz) {} - preview& operator=(array3* a) - { - array = a; - x = y = z = 0; - nx = a->nx; - ny = a->ny; - nz = a->nz; - return *this; - } - - array3* array; // underlying container - uint x, y, z; // offset into array - uint nx, ny, nz; // dimensions of subarray -}; - -// generic read-only view into a rectangular subset of a 3D array -class const_view : public preview { -protected: - using preview::array; - using preview::x; - using preview::y; - using preview::z; - using preview::nx; - using preview::ny; - using preview::nz; -public: - // construction--perform shallow copy of (sub)array - const_view(array3* array) : preview(array) {} - const_view(array3* array, uint x, uint y, uint z, uint nx, uint ny, uint nz) : preview(array, x, y, z, nx, ny, nz) {} - - // dimensions of (sub)array - uint size_x() const { return nx; } - uint size_y() const { return ny; } - uint size_z() const { return nz; } - - // (i, j, k) accessor - Scalar operator()(uint i, uint j, uint k) const { return array->get(x + i, y + j, z + k); } -}; - -// generic read-write view into a rectangular subset of a 3D array -class view : public const_view { -protected: - using preview::array; - using preview::x; - using preview::y; - using preview::z; - using preview::nx; - using preview::ny; - using preview::nz; -public: - // construction--perform shallow copy of (sub)array - view(array3* array) : const_view(array) {} - view(array3* array, uint x, uint y, uint z, uint nx, uint ny, uint nz) : const_view(array, x, y, z, nx, ny, nz) {} - - // (i, j, k) accessor from base class - using const_view::operator(); - - // (i, j, k) mutator - reference operator()(uint i, uint j, uint k) { return reference(array, x + i, y + j, z + k); } -}; - -// flat view of 3D array (operator[] returns scalar) -class flat_view : public view { -protected: - using preview::array; - using preview::x; - using preview::y; - using preview::z; - using preview::nx; - using preview::ny; - using preview::nz; -public: - // construction--perform shallow copy of (sub)array - flat_view(array3* array) : view(array) {} - flat_view(array3* array, uint x, uint y, uint z, uint nx, uint ny, uint nz) : view(array, x, y, z, nx, ny, nz) {} - - // convert (i, j, k) index to flat index - uint index(uint i, uint j, uint k) const { return i + nx * (j + ny * k); } - - // convert flat index to (i, j, k) index - void ijk(uint& i, uint& j, uint& k, uint index) const - { - i = index % nx; index /= nx; - j = index % ny; index /= ny; - k = index; - } - - // flat index accessors - Scalar operator[](uint index) const - { - uint i, j, k; - ijk(i, j, k, index); - return array->get(x + i, y + j, z + k); - } - reference operator[](uint index) - { - uint i, j, k; - ijk(i, j, k, index); - return reference(array, x + i, y + j, z + k); - } -}; - -// forward declaration of friends -class nested_view1; -class nested_view2; -class nested_view3; - -// nested view into a 1D rectangular subset of a 3D array -class nested_view1 : public preview { -protected: - using preview::array; - using preview::x; - using preview::y; - using preview::z; - using preview::nx; - using preview::ny; - using preview::nz; -public: - // dimensions of (sub)array - uint size_x() const { return nx; } - - // [i] accessor and mutator - Scalar operator[](uint index) const { return array->get(x + index, y, z); } - reference operator[](uint index) { return reference(array, x + index, y, z); } - - // (i) accessor and mutator - Scalar operator()(uint i) const { return array->get(x + i, y, z); } - reference operator()(uint i) { return reference(array, x + i, y, z); } - -protected: - // construction--perform shallow copy of (sub)array - friend class nested_view2; - explicit nested_view1(array3* array) : preview(array) {} - explicit nested_view1(array3* array, uint x, uint y, uint z, uint nx, uint ny, uint nz) : preview(array, x, y, z, nx, ny, nz) {} -}; - -// nested view into a 2D rectangular subset of a 3D array -class nested_view2 : public preview { -protected: - using preview::array; - using preview::x; - using preview::y; - using preview::z; - using preview::nx; - using preview::ny; - using preview::nz; -public: - // dimensions of (sub)array - uint size_x() const { return nx; } - uint size_y() const { return ny; } - - // 1D view - nested_view1 operator[](uint index) const { return nested_view1(array, x, y + index, z, nx, 1, 1); } - - // (i, j) accessor and mutator - Scalar operator()(uint i, uint j) const { return array->get(x + i, y + j, z); } - reference operator()(uint i, uint j) { return reference(array, x + i, y + j, z); } - -protected: - // construction--perform shallow copy of (sub)array - friend class nested_view3; - explicit nested_view2(array3* array) : preview(array) {} - explicit nested_view2(array3* array, uint x, uint y, uint z, uint nx, uint ny, uint nz) : preview(array, x, y, z, nx, ny, nz) {} -}; - -// nested view into a 3D rectangular subset of a 3D array -class nested_view3 : public preview { -protected: - using preview::array; - using preview::x; - using preview::y; - using preview::z; - using preview::nx; - using preview::ny; - using preview::nz; -public: - // construction--perform shallow copy of (sub)array - nested_view3(array3* array) : preview(array) {} - nested_view3(array3* array, uint x, uint y, uint z, uint nx, uint ny, uint nz) : preview(array, x, y, z, nx, ny, nz) {} - - // dimensions of (sub)array - uint size_x() const { return nx; } - uint size_y() const { return ny; } - uint size_z() const { return nz; } - - // 2D view - nested_view2 operator[](uint index) const { return nested_view2(array, x, y, z + index, nx, ny, 1); } - - // (i, j, k) accessor and mutator - Scalar operator()(uint i, uint j, uint k) const { return array->get(x + i, y + j, z + k); } - reference operator()(uint i, uint j, uint k) { return reference(array, x + i, y + j, z + k); } -}; - -typedef nested_view3 nested_view; - -// thread-safe read-only view of 3D (sub)array with private cache -class private_const_view : public preview { -protected: - using preview::array; - using preview::x; - using preview::y; - using preview::z; - using preview::nx; - using preview::ny; - using preview::nz; -public: - // construction--perform shallow copy of (sub)array - private_const_view(array3* array) : - preview(array), - cache(array->cache.size()) - { - init(); - } - private_const_view(array3* array, uint x, uint y, uint z, uint nx, uint ny, uint nz) : - preview(array, x, y, z, nx, ny, nz), - cache(array->cache.size()) - { - init(); - } - - // destructor - ~private_const_view() - { - stream_close(zfp->stream); - zfp_stream_close(zfp); - } - - // dimensions of (sub)array - uint size_x() const { return nx; } - uint size_y() const { return ny; } - uint size_z() const { return nz; } - - // cache size in number of bytes - size_t cache_size() const { return cache.size() * sizeof(CacheLine); } - - // set minimum cache size in bytes (array dimensions must be known) - void set_cache_size(size_t csize) - { - cache.resize(array->lines(csize, nx, ny, nz)); - } - - // empty cache without compressing modified cached blocks - void clear_cache() const { cache.clear(); } - - // (i, j, k) accessor - Scalar operator()(uint i, uint j, uint k) const { return get(x + i, y + j, z + k); } - -protected: - // cache line representing one block of decompressed values - class CacheLine { - public: - const Scalar& operator()(uint i, uint j, uint k) const { return a[index(i, j, k)]; } - Scalar& operator()(uint i, uint j, uint k) { return a[index(i, j, k)]; } - const Scalar* data() const { return a; } - Scalar* data() { return a; } - protected: - static uint index(uint i, uint j, uint k) { return (i & 3u) + 4 * ((j & 3u) + 4 * (k & 3u)); } - Scalar a[64]; - }; - - // copy private data - void init() - { - // copy compressed stream - zfp = zfp_stream_open(0); - *zfp = *array->zfp; - // copy bit stream - zfp->stream = stream_clone(array->zfp->stream); - } - - // inspector - const Scalar& get(uint i, uint j, uint k) const - { - const CacheLine* p = line(i, j, k); - return (*p)(i, j, k); - } - - // return cache line for (i, j, k); may require write-back and fetch - CacheLine* line(uint i, uint j, uint k) const - { - CacheLine* p = 0; - uint b = array->block(i, j, k); - typename Cache<CacheLine>::Tag t = cache.access(p, b + 1, false); - uint c = t.index() - 1; - // fetch cache line; no writeback possible since view is read-only - if (c != b) - decode(b, p->data()); - return p; - } - - // decode block with given index - void decode(uint index, Scalar* block) const - { - stream_rseek(zfp->stream, index * array->blkbits); - Codec::decode_block_3(zfp, block, array->shape ? array->shape[index] : 0); - } - - zfp_stream* zfp; // stream of compressed blocks - mutable Cache<CacheLine> cache; // cache of decompressed blocks -}; - -// thread-safe read-write view of private 3D (sub)array -class private_view : public private_const_view { -protected: - using preview::array; - using preview::x; - using preview::y; - using preview::z; - using preview::nx; - using preview::ny; - using preview::nz; - using private_const_view::zfp; - using private_const_view::cache; - using private_const_view::init; - using private_const_view::decode; - class view_reference; - typedef typename private_const_view::CacheLine CacheLine; -public: - // construction--perform shallow copy of (sub)array - private_view(array3* array) : private_const_view(array) {} - private_view(array3* array, uint x, uint y, uint z, uint nx, uint ny, uint nz) : private_const_view(array, x, y, z, nx, ny, nz) {} - - // partition view into count block-aligned pieces, with 0 <= index < count - void partition(uint index, uint count) - { - if (nx > std::max(ny, nz)) - partition(x, nx, index, count); - else if (ny > std::max(nx, nz)) - partition(y, ny, index, count); - else - partition(z, nz, index, count); - } - - // flush cache by compressing all modified cached blocks - void flush_cache() const - { - for (typename Cache<CacheLine>::const_iterator p = cache.first(); p; p++) { - if (p->tag.dirty()) { - uint b = p->tag.index() - 1; - encode(b, p->line->data()); - } - cache.flush(p->line); - } - } - - // (i, j, k) accessor from base class - using private_const_view::operator(); - - // (i, j, k) mutator - view_reference operator()(uint i, uint j, uint k) { return view_reference(this, x + i, y + j, z + k); } - -protected: - class view_reference { - public: - operator Scalar() const { return view->get(i, j, k); } - view_reference operator=(const view_reference& r) { view->set(i, j, k, r.operator Scalar()); return *this; } - view_reference operator=(Scalar val) { view->set(i, j, k, val); return *this; } - view_reference operator+=(Scalar val) { view->add(i, j, k, val); return *this; } - view_reference operator-=(Scalar val) { view->sub(i, j, k, val); return *this; } - view_reference operator*=(Scalar val) { view->mul(i, j, k, val); return *this; } - view_reference operator/=(Scalar val) { view->div(i, j, k, val); return *this; } - // swap two array elements via proxy references - friend void swap(view_reference a, view_reference b) - { - Scalar x = a.operator Scalar(); - Scalar y = b.operator Scalar(); - b.operator=(x); - a.operator=(y); - } - - protected: - friend class private_view; - explicit view_reference(private_view* view, uint i, uint j, uint k) : view(view), i(i), j(j), k(k) {} - private_view* view; - uint i, j, k; - }; - - // block-aligned partition of [offset, offset + size): index out of count - static void partition(uint& offset, uint& size, uint index, uint count) - { - uint bmin = offset / 4; - uint bmax = (offset + size + 3) / 4; - uint xmin = std::max(offset + 0, 4 * (bmin + (bmax - bmin) * (index + 0) / count)); - uint xmax = std::min(offset + size, 4 * (bmin + (bmax - bmin) * (index + 1) / count)); - offset = xmin; - size = xmax - xmin; - } - - // mutator - void set(uint i, uint j, uint k, Scalar val) - { - CacheLine* p = line(i, j, k, true); - (*p)(i, j, k) = val; - } - - // in-place updates - void add(uint i, uint j, uint k, Scalar val) { (*line(i, j, k, true))(i, j, k) += val; } - void sub(uint i, uint j, uint k, Scalar val) { (*line(i, j, k, true))(i, j, k) -= val; } - void mul(uint i, uint j, uint k, Scalar val) { (*line(i, j, k, true))(i, j, k) *= val; } - void div(uint i, uint j, uint k, Scalar val) { (*line(i, j, k, true))(i, j, k) /= val; } - - // return cache line for (i, j, k); may require write-back and fetch - CacheLine* line(uint i, uint j, uint k, bool write) const - { - CacheLine* p = 0; - uint b = array->block(i, j, k); - typename Cache<CacheLine>::Tag t = cache.access(p, b + 1, write); - uint c = t.index() - 1; - if (c != b) { - // write back occupied cache line if it is dirty - if (t.dirty()) - encode(c, p->data()); - decode(b, p->data()); - } - return p; - } - - // encode block with given index - void encode(uint index, const Scalar* block) const - { - stream_wseek(zfp->stream, index * array->blkbits); - Codec::encode_block_3(zfp, block, array->shape ? array->shape[index] : 0); - stream_flush(zfp->stream); - } -}; diff --git a/ThirdParty/zfp/vtkzfp/include/zfparray.h b/ThirdParty/zfp/vtkzfp/include/zfparray.h deleted file mode 100644 index 2ddbde426f08af5a857fcb8950aa51816b3c8f3b..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/zfparray.h +++ /dev/null @@ -1,286 +0,0 @@ -#ifndef ZFP_ARRAY_H -#define ZFP_ARRAY_H - -#include <algorithm> -#include <climits> -#include <cstring> -#include <stdexcept> -#include <string> - -#include "zfp.h" -#include "zfp/memory.h" - -// all undefined at end -#define DIV_ROUND_UP(x, y) (((x) + (y) - 1) / (y)) -#define BITS_TO_BYTES(x) DIV_ROUND_UP(x, CHAR_BIT) - -#define ZFP_HEADER_SIZE_BITS (ZFP_MAGIC_BITS + ZFP_META_BITS + ZFP_MODE_SHORT_BITS) - -namespace zfp { - -// abstract base class for compressed array of scalars -class array { -public: - #include "zfp/header.h" - - static zfp::array* construct(const zfp::array::header& header, const uchar* buffer = 0, size_t buffer_size_bytes = 0); - -protected: - // default constructor - array() : - dims(0), type(zfp_type_none), - nx(0), ny(0), nz(0), - bx(0), by(0), bz(0), - blocks(0), blkbits(0), - bytes(0), data(0), - zfp(0), - shape(0) - {} - - // generic array with 'dims' dimensions and scalar type 'type' - array(uint dims, zfp_type type) : - dims(dims), type(type), - nx(0), ny(0), nz(0), - bx(0), by(0), bz(0), - blocks(0), blkbits(0), - bytes(0), data(0), - zfp(zfp_stream_open(0)), - shape(0) - {} - - // constructor, from previously-serialized compressed array - array(uint dims, zfp_type type, const zfp::array::header& h, size_t expected_buffer_size_bytes) : - dims(dims), type(type), - nx(0), ny(0), nz(0), - bx(0), by(0), bz(0), - blocks(0), blkbits(0), - bytes(0), data(0), - zfp(zfp_stream_open(0)), - shape(0) - { - // read header to populate member variables associated with zfp_stream - try { - read_from_header(h); - } catch (zfp::array::header::exception const &) { - zfp_stream_close(zfp); - throw; - } - - if (expected_buffer_size_bytes && !is_valid_buffer_size(zfp, nx, ny, nz, expected_buffer_size_bytes)) { - zfp_stream_close(zfp); - throw zfp::array::header::exception("ZFP header expects a longer buffer than what was passed in."); - } - } - - // copy constructor--performs a deep copy - array(const array& a) : - data(0), - zfp(0), - shape(0) - { - deep_copy(a); - } - - // assignment operator--performs a deep copy - array& operator=(const array& a) - { - deep_copy(a); - return *this; - } - -public: - // public virtual destructor (can delete array through base class pointer) - virtual ~array() - { - free(); - zfp_stream_close(zfp); - } - - // rate in bits per value - double rate() const { return double(blkbits) / block_size(); } - - // set compression rate in bits per value - double set_rate(double rate) - { - rate = zfp_stream_set_rate(zfp, rate, type, dims, 1); - blkbits = zfp->maxbits; - alloc(); - return rate; - } - - // empty cache without compressing modified cached blocks - virtual void clear_cache() const = 0; - - // flush cache by compressing all modified cached blocks - virtual void flush_cache() const = 0; - - // number of bytes of compressed data - size_t compressed_size() const { return bytes; } - - // pointer to compressed data for read or write access - uchar* compressed_data() const - { - // first write back any modified cached data - flush_cache(); - return data; - } - - // dimensionality - uint dimensionality() const { return dims; } - - // underlying scalar type - zfp_type scalar_type() const { return type; } - - // write header with latest metadata - zfp::array::header get_header() const - { - // intermediate buffer needed (bitstream accesses multiples of wordsize) - AlignedBufferHandle abh; - DualBitstreamHandle dbh(zfp, abh); - - ZfpFieldHandle zfh(type, nx, ny, nz); - - // avoid long header (alignment issue) - if (zfp_stream_mode(zfp) > ZFP_MODE_SHORT_MAX) - throw zfp::array::header::exception("ZFP compressed arrays only support short headers at this time."); - - if (!zfp_write_header(zfp, zfh.field, ZFP_HEADER_FULL)) - throw zfp::array::header::exception("ZFP could not write a header to buffer."); - stream_flush(zfp->stream); - - zfp::array::header h; - abh.copy_to_header(&h); - - return h; - } - -private: - // private members used when reading/writing headers - #include "zfp/headerHelpers.h" - -protected: - // number of values per block - uint block_size() const { return 1u << (2 * dims); } - - // allocate memory for compressed data - void alloc(bool clear = true) - { - bytes = blocks * blkbits / CHAR_BIT; - zfp::reallocate_aligned(data, bytes, 0x100u); - if (clear) - std::fill(data, data + bytes, 0); - stream_close(zfp->stream); - zfp_stream_set_bit_stream(zfp, stream_open(data, bytes)); - clear_cache(); - } - - // free memory associated with compressed data - void free() - { - nx = ny = nz = 0; - bx = by = bz = 0; - blocks = 0; - stream_close(zfp->stream); - zfp_stream_set_bit_stream(zfp, 0); - bytes = 0; - zfp::deallocate_aligned(data); - data = 0; - zfp::deallocate(shape); - shape = 0; - } - - // perform a deep copy - void deep_copy(const array& a) - { - // copy metadata - dims = a.dims; - type = a.type; - nx = a.nx; - ny = a.ny; - nz = a.nz; - bx = a.bx; - by = a.by; - bz = a.bz; - blocks = a.blocks; - blkbits = a.blkbits; - bytes = a.bytes; - - // copy dynamically allocated data - zfp::clone_aligned(data, a.data, bytes, 0x100u); - if (zfp) { - if (zfp->stream) - stream_close(zfp->stream); - zfp_stream_close(zfp); - } - zfp = zfp_stream_open(0); - *zfp = *a.zfp; - zfp_stream_set_bit_stream(zfp, stream_open(data, bytes)); - zfp::clone(shape, a.shape, blocks); - } - - // attempt reading header from zfp::array::header - // and verify header contents (throws exceptions upon failure) - void read_from_header(const zfp::array::header& h) - { - // copy header into aligned buffer - AlignedBufferHandle abh(&h); - DualBitstreamHandle dbh(zfp, abh); - ZfpFieldHandle zfh; - - // read header to populate member variables associated with zfp_stream - size_t readbits = zfp_read_header(zfp, zfh.field, ZFP_HEADER_FULL); - if (!readbits) - throw zfp::array::header::exception("Invalid ZFP header."); - else if (readbits != ZFP_HEADER_SIZE_BITS) - throw zfp::array::header::exception("ZFP compressed arrays only support short headers at this time."); - - // verify metadata on zfp_field match that for this object - std::string err_msg = ""; - if (type != zfp_field_type(zfh.field)) - zfp::array::header::concat_sentence(err_msg, "ZFP header specified an underlying scalar type different than that for this object."); - - if (dims != zfp_field_dimensionality(zfh.field)) - zfp::array::header::concat_sentence(err_msg, "ZFP header specified a dimensionality different than that for this object."); - - verify_header_contents(zfp, zfh.field, err_msg); - - if (!err_msg.empty()) - throw zfp::array::header::exception(err_msg); - - // set class variables - nx = zfh.field->nx; - ny = zfh.field->ny; - nz = zfh.field->nz; - type = zfh.field->type; - blkbits = zfp->maxbits; - } - - // default number of cache lines for array with n blocks - static uint lines(size_t n) - { - // compute m = O(sqrt(n)) - size_t m; - for (m = 1; m * m < n; m *= 2); - return static_cast<uint>(m); - } - - uint dims; // array dimensionality (1, 2, or 3) - zfp_type type; // scalar type - uint nx, ny, nz; // array dimensions - uint bx, by, bz; // array dimensions in number of blocks - uint blocks; // number of blocks - size_t blkbits; // number of bits per compressed block - size_t bytes; // total bytes of compressed data - mutable uchar* data; // pointer to compressed data - zfp_stream* zfp; // compressed stream of blocks - uchar* shape; // precomputed block dimensions (or null if uniform) -}; - -#undef DIV_ROUND_UP -#undef BITS_TO_BYTES - -#undef ZFP_HEADER_SIZE_BITS - -} - -#endif diff --git a/ThirdParty/zfp/vtkzfp/include/zfparray1.h b/ThirdParty/zfp/vtkzfp/include/zfparray1.h deleted file mode 100644 index f95b430d139a0068c3eca0561a13cd32909d60c6..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/zfparray1.h +++ /dev/null @@ -1,297 +0,0 @@ -#ifndef ZFP_ARRAY1_H -#define ZFP_ARRAY1_H - -#include <cstddef> -#include <iterator> -#include <cstring> -#include "zfparray.h" -#include "zfpcodec.h" -#include "zfp/cache.h" - -namespace zfp { - -// compressed 1D array of scalars -template < typename Scalar, class Codec = zfp::codec<Scalar> > -class array1 : public array { -public: - // forward declarations - class reference; - class pointer; - class iterator; - class view; - #include "zfp/reference1.h" - #include "zfp/pointer1.h" - #include "zfp/iterator1.h" - #include "zfp/view1.h" - - // default constructor - array1() : array(1, Codec::type) {} - - // constructor of n-sample array using rate bits per value, at least - // csize bytes of cache, and optionally initialized from flat array p - array1(uint n, double rate, const Scalar* p = 0, size_t csize = 0) : - array(1, Codec::type), - cache(lines(csize, n)) - { - set_rate(rate); - resize(n, p == 0); - if (p) - set(p); - } - - // constructor, from previously-serialized compressed array - array1(const zfp::array::header& h, const uchar* buffer = 0, size_t buffer_size_bytes = 0) : - array(1, Codec::type, h, buffer_size_bytes) - { - resize(nx, false); - if (buffer) - memcpy(data, buffer, bytes); - } - - // copy constructor--performs a deep copy - array1(const array1& a) : - array() - { - deep_copy(a); - } - - // construction from view--perform deep copy of (sub)array - template <class View> - array1(const View& v) : - array(1, Codec::type), - cache(lines(0, v.size_x())) - { - set_rate(v.rate()); - resize(v.size_x(), true); - // initialize array in its preferred order - for (iterator it = begin(); it != end(); ++it) - *it = v(it.i()); - } - - // virtual destructor - virtual ~array1() {} - - // assignment operator--performs a deep copy - array1& operator=(const array1& a) - { - if (this != &a) - deep_copy(a); - return *this; - } - - // total number of elements in array - size_t size() const { return size_t(nx); } - - // array dimensions - uint size_x() const { return nx; } - - // resize the array (all previously stored data will be lost) - void resize(uint n, bool clear = true) - { - if (n == 0) - free(); - else { - nx = n; - bx = (nx + 3) / 4; - blocks = bx; - alloc(clear); - - // precompute block dimensions - zfp::deallocate(shape); - if (nx & 3u) { - shape = (uchar*)zfp::allocate(blocks); - uchar* p = shape; - for (uint i = 0; i < bx; i++) - *p++ = (i == bx - 1 ? -nx & 3u : 0); - } - else - shape = 0; - } - } - - // cache size in number of bytes - size_t cache_size() const { return cache.size() * sizeof(CacheLine); } - - // set minimum cache size in bytes (array dimensions must be known) - void set_cache_size(size_t csize) - { - flush_cache(); - cache.resize(lines(csize, nx)); - } - - // empty cache without compressing modified cached blocks - void clear_cache() const { cache.clear(); } - - // flush cache by compressing all modified cached blocks - void flush_cache() const - { - for (typename zfp::Cache<CacheLine>::const_iterator p = cache.first(); p; p++) { - if (p->tag.dirty()) { - uint b = p->tag.index() - 1; - encode(b, p->line->data()); - } - cache.flush(p->line); - } - } - - // decompress array and store at p - void get(Scalar* p) const - { - uint b = 0; - for (uint i = 0; i < bx; i++, p += 4, b++) { - const CacheLine* line = cache.lookup(b + 1); - if (line) - line->get(p, 1, shape ? shape[b] : 0); - else - decode(b, p, 1); - } - } - - // initialize array by copying and compressing data stored at p - void set(const Scalar* p) - { - uint b = 0; - for (uint i = 0; i < bx; i++, b++, p += 4) - encode(b, p, 1); - cache.clear(); - } - - // (i) accessors - Scalar operator()(uint i) const { return get(i); } - reference operator()(uint i) { return reference(this, i); } - - // flat index accessors - Scalar operator[](uint index) const { return get(index); } - reference operator[](uint index) { return reference(this, index); } - - // random access iterators - iterator begin() { return iterator(this, 0); } - iterator end() { return iterator(this, nx); } - -protected: - // cache line representing one block of decompressed values - class CacheLine { - public: - Scalar operator()(uint i) const { return a[index(i)]; } - Scalar& operator()(uint i) { return a[index(i)]; } - const Scalar* data() const { return a; } - Scalar* data() { return a; } - // copy cache line - void get(Scalar* p, int sx) const - { - const Scalar* q = a; - for (uint x = 0; x < 4; x++, p += sx, q++) - *p = *q; - } - void get(Scalar* p, int sx, uint shape) const - { - if (!shape) - get(p, sx); - else { - // determine block dimensions - uint nx = 4 - (shape & 3u); shape >>= 2; - const Scalar* q = a; - for (uint x = 0; x < nx; x++, p += sx, q++) - *p = *q; - } - } - protected: - static uint index(uint i) { return i & 3u; } - Scalar a[4]; - }; - - // perform a deep copy - void deep_copy(const array1& a) - { - // copy base class members - array::deep_copy(a); - // copy cache - cache = a.cache; - } - - // inspector - Scalar get(uint i) const - { - const CacheLine* p = line(i, false); - return (*p)(i); - } - - // mutator - void set(uint i, Scalar val) - { - CacheLine* p = line(i, true); - (*p)(i) = val; - } - - // in-place updates - void add(uint i, Scalar val) { (*line(i, true))(i) += val; } - void sub(uint i, Scalar val) { (*line(i, true))(i) -= val; } - void mul(uint i, Scalar val) { (*line(i, true))(i) *= val; } - void div(uint i, Scalar val) { (*line(i, true))(i) /= val; } - - // return cache line for i; may require write-back and fetch - CacheLine* line(uint i, bool write) const - { - CacheLine* p = 0; - uint b = block(i); - typename zfp::Cache<CacheLine>::Tag t = cache.access(p, b + 1, write); - uint c = t.index() - 1; - if (c != b) { - // write back occupied cache line if it is dirty - if (t.dirty()) - encode(c, p->data()); - // fetch cache line - decode(b, p->data()); - } - return p; - } - - // encode block with given index - void encode(uint index, const Scalar* block) const - { - stream_wseek(zfp->stream, index * blkbits); - Codec::encode_block_1(zfp, block, shape ? shape[index] : 0); - stream_flush(zfp->stream); - } - - // encode block with given index from strided array - void encode(uint index, const Scalar* p, int sx) const - { - stream_wseek(zfp->stream, index * blkbits); - Codec::encode_block_strided_1(zfp, p, shape ? shape[index] : 0, sx); - stream_flush(zfp->stream); - } - - // decode block with given index - void decode(uint index, Scalar* block) const - { - stream_rseek(zfp->stream, index * blkbits); - Codec::decode_block_1(zfp, block, shape ? shape[index] : 0); - } - - // decode block with given index to strided array - void decode(uint index, Scalar* p, int sx) const - { - stream_rseek(zfp->stream, index * blkbits); - Codec::decode_block_strided_1(zfp, p, shape ? shape[index] : 0, sx); - } - - // block index for i - static uint block(uint i) { return i / 4; } - - // number of cache lines corresponding to size (or suggested size if zero) - static uint lines(size_t size, uint n) - { - n = size ? (size + sizeof(CacheLine) - 1) / sizeof(CacheLine) : array::lines(size_t((n + 3) / 4)); - return std::max(n, 1u); - } - - mutable zfp::Cache<CacheLine> cache; // cache of decompressed blocks -}; - -typedef array1<float> array1f; -typedef array1<double> array1d; - -} - -#endif diff --git a/ThirdParty/zfp/vtkzfp/include/zfparray2.h b/ThirdParty/zfp/vtkzfp/include/zfparray2.h deleted file mode 100644 index 73dfaa8d7fdb0aa4e3953123ae110ad5158e7117..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/zfparray2.h +++ /dev/null @@ -1,324 +0,0 @@ -#ifndef ZFP_ARRAY2_H -#define ZFP_ARRAY2_H - -#include <cstddef> -#include <iterator> -#include <cstring> -#include "zfparray.h" -#include "zfpcodec.h" -#include "zfp/cache.h" - -namespace zfp { - -// compressed 2D array of scalars -template < typename Scalar, class Codec = zfp::codec<Scalar> > -class array2 : public array { -public: - // forward declarations - class reference; - class pointer; - class iterator; - class view; - #include "zfp/reference2.h" - #include "zfp/pointer2.h" - #include "zfp/iterator2.h" - #include "zfp/view2.h" - - // default constructor - array2() : array(2, Codec::type) {} - - // constructor of nx * ny array using rate bits per value, at least - // csize bytes of cache, and optionally initialized from flat array p - array2(uint nx, uint ny, double rate, const Scalar* p = 0, size_t csize = 0) : - array(2, Codec::type), - cache(lines(csize, nx, ny)) - { - set_rate(rate); - resize(nx, ny, p == 0); - if (p) - set(p); - } - - // constructor, from previously-serialized compressed array - array2(const zfp::array::header& h, const uchar* buffer = 0, size_t buffer_size_bytes = 0) : - array(2, Codec::type, h, buffer_size_bytes) - { - resize(nx, ny, false); - if (buffer) - memcpy(data, buffer, bytes); - } - - // copy constructor--performs a deep copy - array2(const array2& a) : - array() - { - deep_copy(a); - } - - // construction from view--perform deep copy of (sub)array - template <class View> - array2(const View& v) : - array(2, Codec::type), - cache(lines(0, v.size_x(), v.size_y())) - { - set_rate(v.rate()); - resize(v.size_x(), v.size_y(), true); - // initialize array in its preferred order - for (iterator it = begin(); it != end(); ++it) - *it = v(it.i(), it.j()); - } - - // virtual destructor - virtual ~array2() {} - - // assignment operator--performs a deep copy - array2& operator=(const array2& a) - { - if (this != &a) - deep_copy(a); - return *this; - } - - // total number of elements in array - size_t size() const { return size_t(nx) * size_t(ny); } - - // array dimensions - uint size_x() const { return nx; } - uint size_y() const { return ny; } - - // resize the array (all previously stored data will be lost) - void resize(uint nx, uint ny, bool clear = true) - { - if (nx == 0 || ny == 0) - free(); - else { - this->nx = nx; - this->ny = ny; - bx = (nx + 3) / 4; - by = (ny + 3) / 4; - blocks = bx * by; - alloc(clear); - - // precompute block dimensions - zfp::deallocate(shape); - if ((nx | ny) & 3u) { - shape = (uchar*)zfp::allocate(blocks); - uchar* p = shape; - for (uint j = 0; j < by; j++) - for (uint i = 0; i < bx; i++) - *p++ = (i == bx - 1 ? -nx & 3u : 0) + 4 * (j == by - 1 ? -ny & 3u : 0); - } - else - shape = 0; - } - } - - // cache size in number of bytes - size_t cache_size() const { return cache.size() * sizeof(CacheLine); } - - // set minimum cache size in bytes (array dimensions must be known) - void set_cache_size(size_t csize) - { - flush_cache(); - cache.resize(lines(csize, nx, ny)); - } - - // empty cache without compressing modified cached blocks - void clear_cache() const { cache.clear(); } - - // flush cache by compressing all modified cached blocks - void flush_cache() const - { - for (typename zfp::Cache<CacheLine>::const_iterator p = cache.first(); p; p++) { - if (p->tag.dirty()) { - uint b = p->tag.index() - 1; - encode(b, p->line->data()); - } - cache.flush(p->line); - } - } - - // decompress array and store at p - void get(Scalar* p) const - { - uint b = 0; - for (uint j = 0; j < by; j++, p += 4 * (nx - bx)) - for (uint i = 0; i < bx; i++, p += 4, b++) { - const CacheLine* line = cache.lookup(b + 1); - if (line) - line->get(p, 1, nx, shape ? shape[b] : 0); - else - decode(b, p, 1, nx); - } - } - - // initialize array by copying and compressing data stored at p - void set(const Scalar* p) - { - uint b = 0; - for (uint j = 0; j < by; j++, p += 4 * (nx - bx)) - for (uint i = 0; i < bx; i++, p += 4, b++) - encode(b, p, 1, nx); - cache.clear(); - } - - // (i, j) accessors - Scalar operator()(uint i, uint j) const { return get(i, j); } - reference operator()(uint i, uint j) { return reference(this, i, j); } - - // flat index accessors - Scalar operator[](uint index) const - { - uint i, j; - ij(i, j, index); - return get(i, j); - } - reference operator[](uint index) - { - uint i, j; - ij(i, j, index); - return reference(this, i, j); - } - - // sequential iterators - iterator begin() { return iterator(this, 0, 0); } - iterator end() { return iterator(this, 0, ny); } - -protected: - // cache line representing one block of decompressed values - class CacheLine { - public: - Scalar operator()(uint i, uint j) const { return a[index(i, j)]; } - Scalar& operator()(uint i, uint j) { return a[index(i, j)]; } - const Scalar* data() const { return a; } - Scalar* data() { return a; } - // copy cache line - void get(Scalar* p, int sx, int sy) const - { - const Scalar* q = a; - for (uint y = 0; y < 4; y++, p += sy - 4 * sx) - for (uint x = 0; x < 4; x++, p += sx, q++) - *p = *q; - } - void get(Scalar* p, int sx, int sy, uint shape) const - { - if (!shape) - get(p, sx, sy); - else { - // determine block dimensions - uint nx = 4 - (shape & 3u); shape >>= 2; - uint ny = 4 - (shape & 3u); shape >>= 2; - const Scalar* q = a; - for (uint y = 0; y < ny; y++, p += sy - (ptrdiff_t)nx * sx, q += 4 - nx) - for (uint x = 0; x < nx; x++, p += sx, q++) - *p = *q; - } - } - protected: - static uint index(uint i, uint j) { return (i & 3u) + 4 * (j & 3u); } - Scalar a[16]; - }; - - // perform a deep copy - void deep_copy(const array2& a) - { - // copy base class members - array::deep_copy(a); - // copy cache - cache = a.cache; - } - - // inspector - Scalar get(uint i, uint j) const - { - const CacheLine* p = line(i, j, false); - return (*p)(i, j); - } - - // mutator - void set(uint i, uint j, Scalar val) - { - CacheLine* p = line(i, j, true); - (*p)(i, j) = val; - } - - // in-place updates - void add(uint i, uint j, Scalar val) { (*line(i, j, true))(i, j) += val; } - void sub(uint i, uint j, Scalar val) { (*line(i, j, true))(i, j) -= val; } - void mul(uint i, uint j, Scalar val) { (*line(i, j, true))(i, j) *= val; } - void div(uint i, uint j, Scalar val) { (*line(i, j, true))(i, j) /= val; } - - // return cache line for (i, j); may require write-back and fetch - CacheLine* line(uint i, uint j, bool write) const - { - CacheLine* p = 0; - uint b = block(i, j); - typename zfp::Cache<CacheLine>::Tag t = cache.access(p, b + 1, write); - uint c = t.index() - 1; - if (c != b) { - // write back occupied cache line if it is dirty - if (t.dirty()) - encode(c, p->data()); - // fetch cache line - decode(b, p->data()); - } - return p; - } - - // encode block with given index - void encode(uint index, const Scalar* block) const - { - stream_wseek(zfp->stream, index * blkbits); - Codec::encode_block_2(zfp, block, shape ? shape[index] : 0); - stream_flush(zfp->stream); - } - - // encode block with given index from strided array - void encode(uint index, const Scalar* p, int sx, int sy) const - { - stream_wseek(zfp->stream, index * blkbits); - Codec::encode_block_strided_2(zfp, p, shape ? shape[index] : 0, sx, sy); - stream_flush(zfp->stream); - } - - // decode block with given index - void decode(uint index, Scalar* block) const - { - stream_rseek(zfp->stream, index * blkbits); - Codec::decode_block_2(zfp, block, shape ? shape[index] : 0); - } - - // decode block with given index to strided array - void decode(uint index, Scalar* p, int sx, int sy) const - { - stream_rseek(zfp->stream, index * blkbits); - Codec::decode_block_strided_2(zfp, p, shape ? shape[index] : 0, sx, sy); - } - - // block index for (i, j) - uint block(uint i, uint j) const { return (i / 4) + bx * (j / 4); } - - // convert flat index to (i, j) - void ij(uint& i, uint& j, uint index) const - { - i = index % nx; - index /= nx; - j = index; - } - - // number of cache lines corresponding to size (or suggested size if zero) - static uint lines(size_t size, uint nx, uint ny) - { - uint n = size ? uint((size + sizeof(CacheLine) - 1) / sizeof(CacheLine)) : array::lines(size_t((nx + 3) / 4) * size_t((ny + 3) / 4)); - return std::max(n, 1u); - } - - mutable zfp::Cache<CacheLine> cache; // cache of decompressed blocks -}; - -typedef array2<float> array2f; -typedef array2<double> array2d; - -} - -#endif diff --git a/ThirdParty/zfp/vtkzfp/include/zfparray3.h b/ThirdParty/zfp/vtkzfp/include/zfparray3.h deleted file mode 100644 index f0f42e88e53a4b0dc51a46883c60552ac546f1ba..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/zfparray3.h +++ /dev/null @@ -1,338 +0,0 @@ -#ifndef ZFP_ARRAY3_H -#define ZFP_ARRAY3_H - -#include <cstddef> -#include <iterator> -#include <cstring> -#include "zfparray.h" -#include "zfpcodec.h" -#include "zfp/cache.h" - -namespace zfp { - -// compressed 3D array of scalars -template < typename Scalar, class Codec = zfp::codec<Scalar> > -class array3 : public array { -public: - // forward declarations - class reference; - class pointer; - class iterator; - class view; - #include "zfp/reference3.h" - #include "zfp/pointer3.h" - #include "zfp/iterator3.h" - #include "zfp/view3.h" - - // default constructor - array3() : array(3, Codec::type) {} - - // constructor of nx * ny * nz array using rate bits per value, at least - // csize bytes of cache, and optionally initialized from flat array p - array3(uint nx, uint ny, uint nz, double rate, const Scalar* p = 0, size_t csize = 0) : - array(3, Codec::type), - cache(lines(csize, nx, ny, nz)) - { - set_rate(rate); - resize(nx, ny, nz, p == 0); - if (p) - set(p); - } - - // constructor, from previously-serialized compressed array - array3(const zfp::array::header& h, const uchar* buffer = 0, size_t buffer_size_bytes = 0) : - array(3, Codec::type, h, buffer_size_bytes) - { - resize(nx, ny, nz, false); - if (buffer) - memcpy(data, buffer, bytes); - } - - // copy constructor--performs a deep copy - array3(const array3& a) : - array() - { - deep_copy(a); - } - - // construction from view--perform deep copy of (sub)array - template <class View> - array3(const View& v) : - array(3, Codec::type), - cache(lines(0, v.size_x(), v.size_y(), v.size_z())) - { - set_rate(v.rate()); - resize(v.size_x(), v.size_y(), v.size_z(), true); - // initialize array in its preferred order - for (iterator it = begin(); it != end(); ++it) - *it = v(it.i(), it.j(), it.k()); - } - - // virtual destructor - virtual ~array3() {} - - // assignment operator--performs a deep copy - array3& operator=(const array3& a) - { - if (this != &a) - deep_copy(a); - return *this; - } - - // total number of elements in array - size_t size() const { return size_t(nx) * size_t(ny) * size_t(nz); } - - // array dimensions - uint size_x() const { return nx; } - uint size_y() const { return ny; } - uint size_z() const { return nz; } - - // resize the array (all previously stored data will be lost) - void resize(uint nx, uint ny, uint nz, bool clear = true) - { - if (nx == 0 || ny == 0 || nz == 0) - free(); - else { - this->nx = nx; - this->ny = ny; - this->nz = nz; - bx = (nx + 3) / 4; - by = (ny + 3) / 4; - bz = (nz + 3) / 4; - blocks = bx * by * bz; - alloc(clear); - - // precompute block dimensions - zfp::deallocate(shape); - if ((nx | ny | nz) & 3u) { - shape = (uchar*)zfp::allocate(blocks); - uchar* p = shape; - for (uint k = 0; k < bz; k++) - for (uint j = 0; j < by; j++) - for (uint i = 0; i < bx; i++) - *p++ = (i == bx - 1 ? -nx & 3u : 0) + 4 * ((j == by - 1 ? -ny & 3u : 0) + 4 * (k == bz - 1 ? -nz & 3u : 0)); - } - else - shape = 0; - } - } - - // cache size in number of bytes - size_t cache_size() const { return cache.size() * sizeof(CacheLine); } - - // set minimum cache size in bytes (array dimensions must be known) - void set_cache_size(size_t csize) - { - flush_cache(); - cache.resize(lines(csize, nx, ny, nz)); - } - - // empty cache without compressing modified cached blocks - void clear_cache() const { cache.clear(); } - - // flush cache by compressing all modified cached blocks - void flush_cache() const - { - for (typename zfp::Cache<CacheLine>::const_iterator p = cache.first(); p; p++) { - if (p->tag.dirty()) { - uint b = p->tag.index() - 1; - encode(b, p->line->data()); - } - cache.flush(p->line); - } - } - - // decompress array and store at p - void get(Scalar* p) const - { - uint b = 0; - for (uint k = 0; k < bz; k++, p += 4 * nx * (ny - by)) - for (uint j = 0; j < by; j++, p += 4 * (nx - bx)) - for (uint i = 0; i < bx; i++, p += 4, b++) { - const CacheLine* line = cache.lookup(b + 1); - if (line) - line->get(p, 1, nx, nx * ny, shape ? shape[b] : 0); - else - decode(b, p, 1, nx, nx * ny); - } - } - - // initialize array by copying and compressing data stored at p - void set(const Scalar* p) - { - uint b = 0; - for (uint k = 0; k < bz; k++, p += 4 * nx * (ny - by)) - for (uint j = 0; j < by; j++, p += 4 * (nx - bx)) - for (uint i = 0; i < bx; i++, p += 4, b++) - encode(b, p, 1, nx, nx * ny); - cache.clear(); - } - - // (i, j, k) accessors - Scalar operator()(uint i, uint j, uint k) const { return get(i, j, k); } - reference operator()(uint i, uint j, uint k) { return reference(this, i, j, k); } - - // flat index corresponding to (i, j, k) - uint index(uint i, uint j, uint k) const { return i + nx * (j + ny * k); } - - // flat index accessors - Scalar operator[](uint index) const - { - uint i, j, k; - ijk(i, j, k, index); - return get(i, j, k); - } - reference operator[](uint index) - { - uint i, j, k; - ijk(i, j, k, index); - return reference(this, i, j, k); - } - - // sequential iterators - iterator begin() { return iterator(this, 0, 0, 0); } - iterator end() { return iterator(this, 0, 0, nz); } - -protected: - // cache line representing one block of decompressed values - class CacheLine { - public: - Scalar operator()(uint i, uint j, uint k) const { return a[index(i, j, k)]; } - Scalar& operator()(uint i, uint j, uint k) { return a[index(i, j, k)]; } - const Scalar* data() const { return a; } - Scalar* data() { return a; } - // copy cache line - void get(Scalar* p, int sx, int sy, int sz) const - { - const Scalar* q = a; - for (uint z = 0; z < 4; z++, p += sz - 4 * sy) - for (uint y = 0; y < 4; y++, p += sy - 4 * sx) - for (uint x = 0; x < 4; x++, p += sx, q++) - *p = *q; - } - void get(Scalar* p, int sx, int sy, int sz, uint shape) const - { - if (!shape) - get(p, sx, sy, sz); - else { - // determine block dimensions - uint nx = 4 - (shape & 3u); shape >>= 2; - uint ny = 4 - (shape & 3u); shape >>= 2; - uint nz = 4 - (shape & 3u); shape >>= 2; - const Scalar* q = a; - for (uint z = 0; z < nz; z++, p += sz - (ptrdiff_t)ny * sy, q += 16 - 4 * ny) - for (uint y = 0; y < ny; y++, p += sy - (ptrdiff_t)nx * sx, q += 4 - nx) - for (uint x = 0; x < nx; x++, p += sx, q++) - *p = *q; - } - } - protected: - static uint index(uint i, uint j, uint k) { return (i & 3u) + 4 * ((j & 3u) + 4 * (k & 3u)); } - Scalar a[64]; - }; - - // perform a deep copy - void deep_copy(const array3& a) - { - // copy base class members - array::deep_copy(a); - // copy cache - cache = a.cache; - } - - // inspector - Scalar get(uint i, uint j, uint k) const - { - const CacheLine* p = line(i, j, k, false); - return (*p)(i, j, k); - } - - // mutator - void set(uint i, uint j, uint k, Scalar val) - { - CacheLine* p = line(i, j, k, true); - (*p)(i, j, k) = val; - } - - // in-place updates - void add(uint i, uint j, uint k, Scalar val) { (*line(i, j, k, true))(i, j, k) += val; } - void sub(uint i, uint j, uint k, Scalar val) { (*line(i, j, k, true))(i, j, k) -= val; } - void mul(uint i, uint j, uint k, Scalar val) { (*line(i, j, k, true))(i, j, k) *= val; } - void div(uint i, uint j, uint k, Scalar val) { (*line(i, j, k, true))(i, j, k) /= val; } - - // return cache line for (i, j, k); may require write-back and fetch - CacheLine* line(uint i, uint j, uint k, bool write) const - { - CacheLine* p = 0; - uint b = block(i, j, k); - typename zfp::Cache<CacheLine>::Tag t = cache.access(p, b + 1, write); - uint c = t.index() - 1; - if (c != b) { - // write back occupied cache line if it is dirty - if (t.dirty()) - encode(c, p->data()); - // fetch cache line - decode(b, p->data()); - } - return p; - } - - // encode block with given index - void encode(uint index, const Scalar* block) const - { - stream_wseek(zfp->stream, index * blkbits); - Codec::encode_block_3(zfp, block, shape ? shape[index] : 0); - stream_flush(zfp->stream); - } - - // encode block with given index from strided array - void encode(uint index, const Scalar* p, int sx, int sy, int sz) const - { - stream_wseek(zfp->stream, index * blkbits); - Codec::encode_block_strided_3(zfp, p, shape ? shape[index] : 0, sx, sy, sz); - stream_flush(zfp->stream); - } - - // decode block with given index - void decode(uint index, Scalar* block) const - { - stream_rseek(zfp->stream, index * blkbits); - Codec::decode_block_3(zfp, block, shape ? shape[index] : 0); - } - - // decode block with given index to strided array - void decode(uint index, Scalar* p, int sx, int sy, int sz) const - { - stream_rseek(zfp->stream, index * blkbits); - Codec::decode_block_strided_3(zfp, p, shape ? shape[index] : 0, sx, sy, sz); - } - - // block index for (i, j, k) - uint block(uint i, uint j, uint k) const { return (i / 4) + bx * ((j / 4) + by * (k / 4)); } - - // convert flat index to (i, j, k) - void ijk(uint& i, uint& j, uint& k, uint index) const - { - i = index % nx; - index /= nx; - j = index % ny; - index /= ny; - k = index; - } - - // number of cache lines corresponding to size (or suggested size if zero) - static uint lines(size_t size, uint nx, uint ny, uint nz) - { - uint n = size ? (size + sizeof(CacheLine) - 1) / sizeof(CacheLine) : array::lines(size_t((nx + 3) / 4) * size_t((ny + 3) / 4) * size_t((nz + 3) / 4)); - return std::max(n, 1u); - } - - mutable zfp::Cache<CacheLine> cache; // cache of decompressed blocks -}; - -typedef array3<float> array3f; -typedef array3<double> array3d; - -} - -#endif diff --git a/ThirdParty/zfp/vtkzfp/include/zfpcodec.h b/ThirdParty/zfp/vtkzfp/include/zfpcodec.h deleted file mode 100644 index 2d4674444e07f3262943df3c7e543ce14e3d66e0..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/zfpcodec.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef ZFP_CODEC_H -#define ZFP_CODEC_H - -#include "zfp.h" - -namespace zfp { - -// C++ wrappers around libzfp C functions -template <typename Scalar> -struct codec {}; - -#include "zfpcodecf.h" -#include "zfpcodecd.h" - -} - -#endif diff --git a/ThirdParty/zfp/vtkzfp/include/zfpcodecd.h b/ThirdParty/zfp/vtkzfp/include/zfpcodecd.h deleted file mode 100644 index 9e7d893234062afb0801573c01f2100c73848183..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/zfpcodecd.h +++ /dev/null @@ -1,149 +0,0 @@ -// double-precision codec -template <> -struct codec<double> { - // encode contiguous 1D block - static void encode_block_1(zfp_stream* zfp, const double* block, uint shape) - { - if (shape) { - uint nx = 4 - (shape & 3u); shape >>= 2; - zfp_encode_partial_block_strided_double_1(zfp, block, nx, 1); - } - else - zfp_encode_block_double_1(zfp, block); - } - - // encode 1D block from strided storage - static void encode_block_strided_1(zfp_stream* zfp, const double* p, uint shape, int sx) - { - if (shape) { - uint nx = 4 - (shape & 3u); shape >>= 2; - zfp_encode_partial_block_strided_double_1(zfp, p, nx, sx); - } - else - zfp_encode_block_strided_double_1(zfp, p, sx); - } - - // encode contiguous 2D block - static void encode_block_2(zfp_stream* zfp, const double* block, uint shape) - { - if (shape) { - uint nx = 4 - (shape & 3u); shape >>= 2; - uint ny = 4 - (shape & 3u); shape >>= 2; - zfp_encode_partial_block_strided_double_2(zfp, block, nx, ny, 1, 4); - } - else - zfp_encode_block_double_2(zfp, block); - } - - // encode 2D block from strided storage - static void encode_block_strided_2(zfp_stream* zfp, const double* p, uint shape, int sx, int sy) - { - if (shape) { - uint nx = 4 - (shape & 3u); shape >>= 2; - uint ny = 4 - (shape & 3u); shape >>= 2; - zfp_encode_partial_block_strided_double_2(zfp, p, nx, ny, sx, sy); - } - else - zfp_encode_block_strided_double_2(zfp, p, sx, sy); - } - - // encode contiguous 3D block - static void encode_block_3(zfp_stream* zfp, const double* block, uint shape) - { - if (shape) { - uint nx = 4 - (shape & 3u); shape >>= 2; - uint ny = 4 - (shape & 3u); shape >>= 2; - uint nz = 4 - (shape & 3u); shape >>= 2; - zfp_encode_partial_block_strided_double_3(zfp, block, nx, ny, nz, 1, 4, 16); - } - else - zfp_encode_block_double_3(zfp, block); - } - - // encode 3D block from strided storage - static void encode_block_strided_3(zfp_stream* zfp, const double* p, uint shape, int sx, int sy, int sz) - { - if (shape) { - uint nx = 4 - (shape & 3u); shape >>= 2; - uint ny = 4 - (shape & 3u); shape >>= 2; - uint nz = 4 - (shape & 3u); shape >>= 2; - zfp_encode_partial_block_strided_double_3(zfp, p, nx, ny, nz, sx, sy, sz); - } - else - zfp_encode_block_strided_double_3(zfp, p, sx, sy, sz); - } - - // decode contiguous 1D block - static void decode_block_1(zfp_stream* zfp, double* block, uint shape) - { - if (shape) { - uint nx = 4 - (shape & 3u); shape >>= 2; - zfp_decode_partial_block_strided_double_1(zfp, block, nx, 1); - } - else - zfp_decode_block_double_1(zfp, block); - } - - // decode 1D block to strided storage - static void decode_block_strided_1(zfp_stream* zfp, double* p, uint shape, int sx) - { - if (shape) { - uint nx = 4 - (shape & 3u); shape >>= 2; - zfp_decode_partial_block_strided_double_1(zfp, p, nx, sx); - } - else - zfp_decode_block_strided_double_1(zfp, p, sx); - } - - // decode contiguous 2D block - static void decode_block_2(zfp_stream* zfp, double* block, uint shape) - { - if (shape) { - uint nx = 4 - (shape & 3u); shape >>= 2; - uint ny = 4 - (shape & 3u); shape >>= 2; - zfp_decode_partial_block_strided_double_2(zfp, block, nx, ny, 1, 4); - } - else - zfp_decode_block_double_2(zfp, block); - } - - // decode 2D block to strided storage - static void decode_block_strided_2(zfp_stream* zfp, double* p, uint shape, int sx, int sy) - { - if (shape) { - uint nx = 4 - (shape & 3u); shape >>= 2; - uint ny = 4 - (shape & 3u); shape >>= 2; - zfp_decode_partial_block_strided_double_2(zfp, p, nx, ny, sx, sy); - } - else - zfp_decode_block_strided_double_2(zfp, p, sx, sy); - } - - // decode contiguous 3D block - static void decode_block_3(zfp_stream* zfp, double* block, uint shape) - { - if (shape) { - uint nx = 4 - (shape & 3u); shape >>= 2; - uint ny = 4 - (shape & 3u); shape >>= 2; - uint nz = 4 - (shape & 3u); shape >>= 2; - zfp_decode_partial_block_strided_double_3(zfp, block, nx, ny, nz, 1, 4, 16); - } - else - zfp_decode_block_double_3(zfp, block); - } - - // decode 3D block to strided storage - static void decode_block_strided_3(zfp_stream* zfp, double* p, uint shape, int sx, int sy, int sz) - { - if (shape) { - uint nx = 4 - (shape & 3u); shape >>= 2; - uint ny = 4 - (shape & 3u); shape >>= 2; - uint nz = 4 - (shape & 3u); shape >>= 2; - zfp_decode_partial_block_strided_double_3(zfp, p, nx, ny, nz, sx, sy, sz); - } - else - zfp_decode_block_strided_double_3(zfp, p, sx, sy, sz); - } - - static const zfp_type type = zfp_type_double; -}; diff --git a/ThirdParty/zfp/vtkzfp/include/zfpcodecf.h b/ThirdParty/zfp/vtkzfp/include/zfpcodecf.h deleted file mode 100644 index 1ec74a60990281d545886ad5f49a699d18c14a10..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/zfpcodecf.h +++ /dev/null @@ -1,149 +0,0 @@ -// single-precision codec -template <> -struct codec<float> { - // encode contiguous 1D block - static void encode_block_1(zfp_stream* zfp, const float* block, uint shape) - { - if (shape) { - uint nx = 4 - (shape & 3u); shape >>= 2; - zfp_encode_partial_block_strided_float_1(zfp, block, nx, 1); - } - else - zfp_encode_block_float_1(zfp, block); - } - - // encode 1D block from strided storage - static void encode_block_strided_1(zfp_stream* zfp, const float* p, uint shape, int sx) - { - if (shape) { - uint nx = 4 - (shape & 3u); shape >>= 2; - zfp_encode_partial_block_strided_float_1(zfp, p, nx, sx); - } - else - zfp_encode_block_strided_float_1(zfp, p, sx); - } - - // encode contiguous 2D block - static void encode_block_2(zfp_stream* zfp, const float* block, uint shape) - { - if (shape) { - uint nx = 4 - (shape & 3u); shape >>= 2; - uint ny = 4 - (shape & 3u); shape >>= 2; - zfp_encode_partial_block_strided_float_2(zfp, block, nx, ny, 1, 4); - } - else - zfp_encode_block_float_2(zfp, block); - } - - // encode 2D block from strided storage - static void encode_block_strided_2(zfp_stream* zfp, const float* p, uint shape, int sx, int sy) - { - if (shape) { - uint nx = 4 - (shape & 3u); shape >>= 2; - uint ny = 4 - (shape & 3u); shape >>= 2; - zfp_encode_partial_block_strided_float_2(zfp, p, nx, ny, sx, sy); - } - else - zfp_encode_block_strided_float_2(zfp, p, sx, sy); - } - - // encode contiguous 3D block - static void encode_block_3(zfp_stream* zfp, const float* block, uint shape) - { - if (shape) { - uint nx = 4 - (shape & 3u); shape >>= 2; - uint ny = 4 - (shape & 3u); shape >>= 2; - uint nz = 4 - (shape & 3u); shape >>= 2; - zfp_encode_partial_block_strided_float_3(zfp, block, nx, ny, nz, 1, 4, 16); - } - else - zfp_encode_block_float_3(zfp, block); - } - - // encode 3D block from strided storage - static void encode_block_strided_3(zfp_stream* zfp, const float* p, uint shape, int sx, int sy, int sz) - { - if (shape) { - uint nx = 4 - (shape & 3u); shape >>= 2; - uint ny = 4 - (shape & 3u); shape >>= 2; - uint nz = 4 - (shape & 3u); shape >>= 2; - zfp_encode_partial_block_strided_float_3(zfp, p, nx, ny, nz, sx, sy, sz); - } - else - zfp_encode_block_strided_float_3(zfp, p, sx, sy, sz); - } - - // decode contiguous 1D block - static void decode_block_1(zfp_stream* zfp, float* block, uint shape) - { - if (shape) { - uint nx = 4 - (shape & 3u); shape >>= 2; - zfp_decode_partial_block_strided_float_1(zfp, block, nx, 1); - } - else - zfp_decode_block_float_1(zfp, block); - } - - // decode 1D block to strided storage - static void decode_block_strided_1(zfp_stream* zfp, float* p, uint shape, int sx) - { - if (shape) { - uint nx = 4 - (shape & 3u); shape >>= 2; - zfp_decode_partial_block_strided_float_1(zfp, p, nx, sx); - } - else - zfp_decode_block_strided_float_1(zfp, p, sx); - } - - // decode contiguous 2D block - static void decode_block_2(zfp_stream* zfp, float* block, uint shape) - { - if (shape) { - uint nx = 4 - (shape & 3u); shape >>= 2; - uint ny = 4 - (shape & 3u); shape >>= 2; - zfp_decode_partial_block_strided_float_2(zfp, block, nx, ny, 1, 4); - } - else - zfp_decode_block_float_2(zfp, block); - } - - // decode 2D block to strided storage - static void decode_block_strided_2(zfp_stream* zfp, float* p, uint shape, int sx, int sy) - { - if (shape) { - uint nx = 4 - (shape & 3u); shape >>= 2; - uint ny = 4 - (shape & 3u); shape >>= 2; - zfp_decode_partial_block_strided_float_2(zfp, p, nx, ny, sx, sy); - } - else - zfp_decode_block_strided_float_2(zfp, p, sx, sy); - } - - // decode contiguous 3D block - static void decode_block_3(zfp_stream* zfp, float* block, uint shape) - { - if (shape) { - uint nx = 4 - (shape & 3u); shape >>= 2; - uint ny = 4 - (shape & 3u); shape >>= 2; - uint nz = 4 - (shape & 3u); shape >>= 2; - zfp_decode_partial_block_strided_float_3(zfp, block, nx, ny, nz, 1, 4, 16); - } - else - zfp_decode_block_float_3(zfp, block); - } - - // decode 3D block to strided storage - static void decode_block_strided_3(zfp_stream* zfp, float* p, uint shape, int sx, int sy, int sz) - { - if (shape) { - uint nx = 4 - (shape & 3u); shape >>= 2; - uint ny = 4 - (shape & 3u); shape >>= 2; - uint nz = 4 - (shape & 3u); shape >>= 2; - zfp_decode_partial_block_strided_float_3(zfp, p, nx, ny, nz, sx, sy, sz); - } - else - zfp_decode_block_strided_float_3(zfp, p, sx, sy, sz); - } - - static const zfp_type type = zfp_type_float; -}; diff --git a/ThirdParty/zfp/vtkzfp/include/zfpfactory.h b/ThirdParty/zfp/vtkzfp/include/zfpfactory.h deleted file mode 100644 index 44910bd258ab2468400ff0be3c270e18cb96bfa1..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/include/zfpfactory.h +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef ZFP_FACTORY_H -#define ZFP_FACTORY_H - -// (assumes zfparray.h already included) - -zfp::array* zfp::array::construct(const zfp::array::header& header, const uchar* buffer, size_t buffer_size_bytes) -{ - // gather array metadata via C API, then construct with metadata - uint dims = 0; - zfp_type type = zfp_type_none; - double rate = 0; - uint n[4] = {0}; - - // read once (will throw if reads a noncompatible header) - zfp::array::read_header_contents(header, buffer_size_bytes, dims, type, rate, n); - - // construct once (passing zfp::array::header will read it again) - zfp::array* arr = 0; - std::string err_msg = ""; - switch (dims) { - case 3: -#ifdef ZFP_ARRAY3_H - switch (type) { - case zfp_type_double: - arr = new zfp::array3d(n[0], n[1], n[2], rate); - break; - - case zfp_type_float: - arr = new zfp::array3f(n[0], n[1], n[2], rate); - break; - - default: - /* NOTREACHED */ - err_msg = "Unexpected ZFP type."; - break; - } -#else - err_msg = "Header files for 3 dimensional ZFP compressed arrays were not included."; -#endif - break; - - case 2: -#ifdef ZFP_ARRAY2_H - switch (type) { - case zfp_type_double: - arr = new zfp::array2d(n[0], n[1], rate); - break; - - case zfp_type_float: - arr = new zfp::array2f(n[0], n[1], rate); - break; - - default: - /* NOTREACHED */ - err_msg = "Unexpected ZFP type."; - break; - } -#else - err_msg = "Header files for 2 dimensional ZFP compressed arrays were not included."; -#endif - break; - - case 1: -#ifdef ZFP_ARRAY1_H - switch (type) { - case zfp_type_double: - arr = new zfp::array1d(n[0], rate); - break; - - case zfp_type_float: - arr = new zfp::array1f(n[0], rate); - break; - - default: - /* NOTREACHED */ - err_msg = "Unexpected ZFP type."; - break; - } -#else - err_msg = "Header files for 1 dimensional ZFP compressed arrays were not included."; -#endif - break; - - default: - err_msg = "ZFP compressed arrays do not yet support dimensionalities beyond 1, 2, and 3."; - break; - } - - if (!err_msg.empty()) - throw zfp::array::header::exception(err_msg); - - if (buffer) - memcpy(arr->compressed_data(), buffer, arr->compressed_size()); - - return arr; -} - -#endif diff --git a/ThirdParty/zfp/vtkzfp/src/bitstream.c b/ThirdParty/zfp/vtkzfp/src/bitstream.c deleted file mode 100644 index 05094c6d31befd5947e7b49164cc7eeb315fa95c..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/bitstream.c +++ /dev/null @@ -1,4 +0,0 @@ -#include "bitstream.h" -#include "inline/bitstream.c" - -export_ const size_t stream_word_bits = wsize; diff --git a/ThirdParty/zfp/vtkzfp/src/block1.h b/ThirdParty/zfp/vtkzfp/src/block1.h deleted file mode 100644 index 035d9c9523d63ff46b76dd648bf99b5503781016..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/block1.h +++ /dev/null @@ -1 +0,0 @@ -#define DIMS 1 diff --git a/ThirdParty/zfp/vtkzfp/src/block2.h b/ThirdParty/zfp/vtkzfp/src/block2.h deleted file mode 100644 index e87ab62995ad655de67ed64a1e466e7622a3a758..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/block2.h +++ /dev/null @@ -1 +0,0 @@ -#define DIMS 2 diff --git a/ThirdParty/zfp/vtkzfp/src/block3.h b/ThirdParty/zfp/vtkzfp/src/block3.h deleted file mode 100644 index a683568673a3f619d23ece9a3abd92b965a6aea6..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/block3.h +++ /dev/null @@ -1 +0,0 @@ -#define DIMS 3 diff --git a/ThirdParty/zfp/vtkzfp/src/block4.h b/ThirdParty/zfp/vtkzfp/src/block4.h deleted file mode 100644 index 6737fb25eaf4ed27653c2fc737d6d73ee058ffe7..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/block4.h +++ /dev/null @@ -1 +0,0 @@ -#define DIMS 4 diff --git a/ThirdParty/zfp/vtkzfp/src/decode1d.c b/ThirdParty/zfp/vtkzfp/src/decode1d.c deleted file mode 100644 index 436515a92ee42ad920a5f6f57891b8d38562428f..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/decode1d.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block1.h" -#include "traitsd.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codecf.c" -#include "template/codec1.c" -#include "template/decode.c" -#include "template/decodef.c" -#include "template/decode1.c" -#include "template/revcodecf.c" -#include "template/revdecode.c" -#include "template/revdecodef.c" -#include "template/revdecode1.c" diff --git a/ThirdParty/zfp/vtkzfp/src/decode1f.c b/ThirdParty/zfp/vtkzfp/src/decode1f.c deleted file mode 100644 index 443b8522fb2f216e4595803819532d76a36c76f9..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/decode1f.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block1.h" -#include "traitsf.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codecf.c" -#include "template/codec1.c" -#include "template/decode.c" -#include "template/decodef.c" -#include "template/decode1.c" -#include "template/revcodecf.c" -#include "template/revdecode.c" -#include "template/revdecodef.c" -#include "template/revdecode1.c" diff --git a/ThirdParty/zfp/vtkzfp/src/decode1i.c b/ThirdParty/zfp/vtkzfp/src/decode1i.c deleted file mode 100644 index 73f58e6c06c565f5f8c8545d2b372a8aa322c0bc..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/decode1i.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block1.h" -#include "traitsi.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codec1.c" -#include "template/decode.c" -#include "template/decodei.c" -#include "template/decode1.c" -#include "template/revdecode.c" -#include "template/revdecode1.c" diff --git a/ThirdParty/zfp/vtkzfp/src/decode1l.c b/ThirdParty/zfp/vtkzfp/src/decode1l.c deleted file mode 100644 index cedcc532efa6881694a1aa27a9333c6aa5a5cddb..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/decode1l.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block1.h" -#include "traitsl.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codec1.c" -#include "template/decode.c" -#include "template/decodei.c" -#include "template/decode1.c" -#include "template/revdecode.c" -#include "template/revdecode1.c" diff --git a/ThirdParty/zfp/vtkzfp/src/decode2d.c b/ThirdParty/zfp/vtkzfp/src/decode2d.c deleted file mode 100644 index 8c3a994d6b3750b18c3edf8ae0735a461aa4f612..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/decode2d.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block2.h" -#include "traitsd.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codecf.c" -#include "template/codec2.c" -#include "template/decode.c" -#include "template/decodef.c" -#include "template/decode2.c" -#include "template/revcodecf.c" -#include "template/revdecode.c" -#include "template/revdecodef.c" -#include "template/revdecode2.c" diff --git a/ThirdParty/zfp/vtkzfp/src/decode2f.c b/ThirdParty/zfp/vtkzfp/src/decode2f.c deleted file mode 100644 index 7b3c35cf20e6ae8c1ece3a99782c74de28a06c7c..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/decode2f.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block2.h" -#include "traitsf.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codecf.c" -#include "template/codec2.c" -#include "template/decode.c" -#include "template/decodef.c" -#include "template/decode2.c" -#include "template/revcodecf.c" -#include "template/revdecode.c" -#include "template/revdecodef.c" -#include "template/revdecode2.c" diff --git a/ThirdParty/zfp/vtkzfp/src/decode2i.c b/ThirdParty/zfp/vtkzfp/src/decode2i.c deleted file mode 100644 index 70a4a5a21ff5e35e4572f87396a6cd44354d0a0a..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/decode2i.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block2.h" -#include "traitsi.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codec2.c" -#include "template/decode.c" -#include "template/decodei.c" -#include "template/decode2.c" -#include "template/revdecode.c" -#include "template/revdecode2.c" diff --git a/ThirdParty/zfp/vtkzfp/src/decode2l.c b/ThirdParty/zfp/vtkzfp/src/decode2l.c deleted file mode 100644 index 93a2cf833539b4cd7932e9cf9eb2ba4d8adebb53..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/decode2l.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block2.h" -#include "traitsl.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codec2.c" -#include "template/decode.c" -#include "template/decodei.c" -#include "template/decode2.c" -#include "template/revdecode.c" -#include "template/revdecode2.c" diff --git a/ThirdParty/zfp/vtkzfp/src/decode3d.c b/ThirdParty/zfp/vtkzfp/src/decode3d.c deleted file mode 100644 index b8cb9d18a494d27c50ba4fe2175b29df046a5741..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/decode3d.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block3.h" -#include "traitsd.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codecf.c" -#include "template/codec3.c" -#include "template/decode.c" -#include "template/decodef.c" -#include "template/decode3.c" -#include "template/revcodecf.c" -#include "template/revdecode.c" -#include "template/revdecodef.c" -#include "template/revdecode3.c" diff --git a/ThirdParty/zfp/vtkzfp/src/decode3f.c b/ThirdParty/zfp/vtkzfp/src/decode3f.c deleted file mode 100644 index 914c49991663096ae4b7b3315ebb60158aee7953..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/decode3f.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block3.h" -#include "traitsf.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codecf.c" -#include "template/codec3.c" -#include "template/decode.c" -#include "template/decodef.c" -#include "template/decode3.c" -#include "template/revcodecf.c" -#include "template/revdecode.c" -#include "template/revdecodef.c" -#include "template/revdecode3.c" diff --git a/ThirdParty/zfp/vtkzfp/src/decode3i.c b/ThirdParty/zfp/vtkzfp/src/decode3i.c deleted file mode 100644 index 46af93e0636035a37be1a60e1a510c2c7cfa2e8d..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/decode3i.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block3.h" -#include "traitsi.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codec3.c" -#include "template/decode.c" -#include "template/decodei.c" -#include "template/decode3.c" -#include "template/revdecode.c" -#include "template/revdecode3.c" diff --git a/ThirdParty/zfp/vtkzfp/src/decode3l.c b/ThirdParty/zfp/vtkzfp/src/decode3l.c deleted file mode 100644 index 1e76d171a8f10af26c08426864bcc244c03e6d81..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/decode3l.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block3.h" -#include "traitsl.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codec3.c" -#include "template/decode.c" -#include "template/decodei.c" -#include "template/decode3.c" -#include "template/revdecode.c" -#include "template/revdecode3.c" diff --git a/ThirdParty/zfp/vtkzfp/src/decode4d.c b/ThirdParty/zfp/vtkzfp/src/decode4d.c deleted file mode 100644 index ee5b31fcc657111a192d0f1b4f73b160c474761b..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/decode4d.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block4.h" -#include "traitsd.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codecf.c" -#include "template/codec4.c" -#include "template/decode.c" -#include "template/decodef.c" -#include "template/decode4.c" -#include "template/revcodecf.c" -#include "template/revdecode.c" -#include "template/revdecodef.c" -#include "template/revdecode4.c" diff --git a/ThirdParty/zfp/vtkzfp/src/decode4f.c b/ThirdParty/zfp/vtkzfp/src/decode4f.c deleted file mode 100644 index 5eb3b900fd28e435d477081314c5cc56d10cfcd7..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/decode4f.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block4.h" -#include "traitsf.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codecf.c" -#include "template/codec4.c" -#include "template/decode.c" -#include "template/decodef.c" -#include "template/decode4.c" -#include "template/revcodecf.c" -#include "template/revdecode.c" -#include "template/revdecodef.c" -#include "template/revdecode4.c" diff --git a/ThirdParty/zfp/vtkzfp/src/decode4i.c b/ThirdParty/zfp/vtkzfp/src/decode4i.c deleted file mode 100644 index b871eba407eb5346cd6517d8ba2ef0143fc3d0cb..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/decode4i.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block4.h" -#include "traitsi.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codec4.c" -#include "template/decode.c" -#include "template/decodei.c" -#include "template/decode4.c" -#include "template/revdecode.c" -#include "template/revdecode4.c" diff --git a/ThirdParty/zfp/vtkzfp/src/decode4l.c b/ThirdParty/zfp/vtkzfp/src/decode4l.c deleted file mode 100644 index b37e47e116530ea577a298a1958c41bdff9e7035..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/decode4l.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block4.h" -#include "traitsl.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codec4.c" -#include "template/decode.c" -#include "template/decodei.c" -#include "template/decode4.c" -#include "template/revdecode.c" -#include "template/revdecode4.c" diff --git a/ThirdParty/zfp/vtkzfp/src/encode1d.c b/ThirdParty/zfp/vtkzfp/src/encode1d.c deleted file mode 100644 index 84b9ac8c041b7fc98d8301e730af402da7d7baf9..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/encode1d.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block1.h" -#include "traitsd.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codecf.c" -#include "template/codec1.c" -#include "template/encode.c" -#include "template/encodef.c" -#include "template/encode1.c" -#include "template/revcodecf.c" -#include "template/revencode.c" -#include "template/revencodef.c" -#include "template/revencode1.c" diff --git a/ThirdParty/zfp/vtkzfp/src/encode1f.c b/ThirdParty/zfp/vtkzfp/src/encode1f.c deleted file mode 100644 index a57a7cf703a5e53d720d5801f43bc688e742a7f8..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/encode1f.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block1.h" -#include "traitsf.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codecf.c" -#include "template/codec1.c" -#include "template/encode.c" -#include "template/encodef.c" -#include "template/encode1.c" -#include "template/revcodecf.c" -#include "template/revencode.c" -#include "template/revencodef.c" -#include "template/revencode1.c" diff --git a/ThirdParty/zfp/vtkzfp/src/encode1i.c b/ThirdParty/zfp/vtkzfp/src/encode1i.c deleted file mode 100644 index dcd9aa64b293406b4ef06e70e286f7889778dde0..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/encode1i.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block1.h" -#include "traitsi.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codec1.c" -#include "template/encode.c" -#include "template/encodei.c" -#include "template/encode1.c" -#include "template/revencode.c" -#include "template/revencode1.c" diff --git a/ThirdParty/zfp/vtkzfp/src/encode1l.c b/ThirdParty/zfp/vtkzfp/src/encode1l.c deleted file mode 100644 index 032c3de61ca6770b8330624abe421004200908ed..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/encode1l.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block1.h" -#include "traitsl.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codec1.c" -#include "template/encode.c" -#include "template/encodei.c" -#include "template/encode1.c" -#include "template/revencode.c" -#include "template/revencode1.c" diff --git a/ThirdParty/zfp/vtkzfp/src/encode2d.c b/ThirdParty/zfp/vtkzfp/src/encode2d.c deleted file mode 100644 index 50e8dd8354093f93f6ceb14f1ccb29421330cf7f..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/encode2d.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block2.h" -#include "traitsd.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codecf.c" -#include "template/codec2.c" -#include "template/encode.c" -#include "template/encodef.c" -#include "template/encode2.c" -#include "template/revcodecf.c" -#include "template/revencode.c" -#include "template/revencodef.c" -#include "template/revencode2.c" diff --git a/ThirdParty/zfp/vtkzfp/src/encode2f.c b/ThirdParty/zfp/vtkzfp/src/encode2f.c deleted file mode 100644 index 713a74e4d9d0e9a02e4c9df32d456e128e3aabc5..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/encode2f.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block2.h" -#include "traitsf.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codecf.c" -#include "template/codec2.c" -#include "template/encode.c" -#include "template/encodef.c" -#include "template/encode2.c" -#include "template/revcodecf.c" -#include "template/revencode.c" -#include "template/revencodef.c" -#include "template/revencode2.c" diff --git a/ThirdParty/zfp/vtkzfp/src/encode2i.c b/ThirdParty/zfp/vtkzfp/src/encode2i.c deleted file mode 100644 index d0b4b54c6b30028a0189dcb3548e87e51c34acf8..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/encode2i.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block2.h" -#include "traitsi.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codec2.c" -#include "template/encode.c" -#include "template/encodei.c" -#include "template/encode2.c" -#include "template/revencode.c" -#include "template/revencode2.c" diff --git a/ThirdParty/zfp/vtkzfp/src/encode2l.c b/ThirdParty/zfp/vtkzfp/src/encode2l.c deleted file mode 100644 index d834cfa1d62f40fad784eefde6ba188c0085d872..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/encode2l.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block2.h" -#include "traitsl.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codec2.c" -#include "template/encode.c" -#include "template/encodei.c" -#include "template/encode2.c" -#include "template/revencode.c" -#include "template/revencode2.c" diff --git a/ThirdParty/zfp/vtkzfp/src/encode3d.c b/ThirdParty/zfp/vtkzfp/src/encode3d.c deleted file mode 100644 index 16c385e283f630755559cf79ff49a30ff5a8606e..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/encode3d.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block3.h" -#include "traitsd.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codecf.c" -#include "template/codec3.c" -#include "template/encode.c" -#include "template/encodef.c" -#include "template/encode3.c" -#include "template/revcodecf.c" -#include "template/revencode.c" -#include "template/revencodef.c" -#include "template/revencode3.c" diff --git a/ThirdParty/zfp/vtkzfp/src/encode3f.c b/ThirdParty/zfp/vtkzfp/src/encode3f.c deleted file mode 100644 index 1668aff87bfd9dbb8c7c9b41be021ca99448f716..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/encode3f.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block3.h" -#include "traitsf.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codecf.c" -#include "template/codec3.c" -#include "template/encode.c" -#include "template/encodef.c" -#include "template/encode3.c" -#include "template/revcodecf.c" -#include "template/revencode.c" -#include "template/revencodef.c" -#include "template/revencode3.c" diff --git a/ThirdParty/zfp/vtkzfp/src/encode3i.c b/ThirdParty/zfp/vtkzfp/src/encode3i.c deleted file mode 100644 index c92a1a6986ee88b68c5313a1151c433be03a2465..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/encode3i.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block3.h" -#include "traitsi.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codec3.c" -#include "template/encode.c" -#include "template/encodei.c" -#include "template/encode3.c" -#include "template/revencode.c" -#include "template/revencode3.c" diff --git a/ThirdParty/zfp/vtkzfp/src/encode3l.c b/ThirdParty/zfp/vtkzfp/src/encode3l.c deleted file mode 100644 index 4d53304eda4c7c9c8d4d7f54f0bb1460315cc6b9..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/encode3l.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block3.h" -#include "traitsl.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codec3.c" -#include "template/encode.c" -#include "template/encodei.c" -#include "template/encode3.c" -#include "template/revencode.c" -#include "template/revencode3.c" diff --git a/ThirdParty/zfp/vtkzfp/src/encode4d.c b/ThirdParty/zfp/vtkzfp/src/encode4d.c deleted file mode 100644 index c82d19a1b317ec720c255515f8fb5693f9a1479c..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/encode4d.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block4.h" -#include "traitsd.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codecf.c" -#include "template/codec4.c" -#include "template/encode.c" -#include "template/encodef.c" -#include "template/encode4.c" -#include "template/revcodecf.c" -#include "template/revencode.c" -#include "template/revencodef.c" -#include "template/revencode4.c" diff --git a/ThirdParty/zfp/vtkzfp/src/encode4f.c b/ThirdParty/zfp/vtkzfp/src/encode4f.c deleted file mode 100644 index e0ce014691b7b49d21d1b69a7d21a823130af2e8..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/encode4f.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block4.h" -#include "traitsf.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codecf.c" -#include "template/codec4.c" -#include "template/encode.c" -#include "template/encodef.c" -#include "template/encode4.c" -#include "template/revcodecf.c" -#include "template/revencode.c" -#include "template/revencodef.c" -#include "template/revencode4.c" diff --git a/ThirdParty/zfp/vtkzfp/src/encode4i.c b/ThirdParty/zfp/vtkzfp/src/encode4i.c deleted file mode 100644 index ab82e0e2e5502e0ab598e9158fe720570a2c62a0..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/encode4i.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block4.h" -#include "traitsi.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codec4.c" -#include "template/encode.c" -#include "template/encodei.c" -#include "template/encode4.c" -#include "template/revencode.c" -#include "template/revencode4.c" diff --git a/ThirdParty/zfp/vtkzfp/src/encode4l.c b/ThirdParty/zfp/vtkzfp/src/encode4l.c deleted file mode 100644 index 805ee01a665108fde47458f5df20df715a99d9b9..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/encode4l.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "inline/inline.h" -#include "zfp.h" -#include "zfp/macros.h" -#include "block4.h" -#include "traitsl.h" -#include "template/template.h" -#include "template/codec.h" -#include "inline/bitstream.c" -#include "template/codec4.c" -#include "template/encode.c" -#include "template/encodei.c" -#include "template/encode4.c" -#include "template/revencode.c" -#include "template/revencode4.c" diff --git a/ThirdParty/zfp/vtkzfp/src/inline/bitstream.c b/ThirdParty/zfp/vtkzfp/src/inline/bitstream.c deleted file mode 100644 index aa58b73fdb890b5f926db7e5c1346d37ba3bf431..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/inline/bitstream.c +++ /dev/null @@ -1,457 +0,0 @@ -/* -High-speed in-memory bit stream I/O that supports reading and writing between -0 and 64 bits at a time. The implementation, which relies heavily on bit -shifts, has been carefully written to ensure that all shifts are between -zero and one less the width of the type being shifted to avoid undefined -behavior. This occasionally causes somewhat convoluted code. - -The following assumptions and restrictions apply: - -1. The user must allocate a memory buffer large enough to hold the bit stream, - whether for reading, writing, or both. This buffer is associated with the - bit stream via stream_open(buffer, bytes), which allocates and returns a - pointer to an opaque bit stream struct. Call stream_close(stream) to - deallocate this struct. - -2. The stream is either in a read or write state (or, initially, in both - states). When done writing, call stream_flush(stream) before entering - read mode to ensure any buffered bits are output. To enter read mode, - call stream_rewind(stream) or stream_rseek(stream, offset) to position - the stream at the beginning or at a particular bit offset. Conversely, - stream_rewind(stream) or stream_wseek(stream, offset) positions the - stream for writing. In read mode, the following functions may be called: - - size_t stream_size(stream); - size_t stream_rtell(stream); - void stream_rewind(stream); - void stream_rseek(stream, offset); - void stream_skip(stream, uint n); - size_t stream_align(stream); - uint stream_read_bit(stream); - uint64 stream_read_bits(stream, n); - - Each of the above read calls has a corresponding write call: - - size_t stream_size(stream); - size_t stream_wtell(stream); - void stream_rewind(stream); - void stream_wseek(stream, offset); - void stream_pad(stream, n); - size_t stream_flush(stream); - uint stream_write_bit(stream, bit); - uint64 stream_write_bits(stream, value, n); - -3. The stream buffer is an unsigned integer of a user-specified type given - by the BIT_STREAM_WORD_TYPE macro. Bits are read and written in units of - this integer word type. Supported types are 8, 16, 32, or 64 bits wide. - The bit width of the buffer is denoted by 'wsize' and can be accessed via - the global constant stream_word_bits. A small wsize allows for fine - granularity reads and writes, and may be preferable when working with many - small blocks of data that require non-sequential access. The default - maximum size of 64 bits ensures maximum speed. Note that even when - wsize < 64, it is still possible to read and write up to 64 bits at a time - using stream_read_bits() and stream_write_bits(). - -4. If BIT_STREAM_STRIDED is defined, words read from or written to the stream - may be accessed noncontiguously by setting a power-of-two block size (which - by default is one word) and a block stride (defaults to zero blocks). The - word pointer is always incremented by one word each time a word is accessed. - Once advanced past a block boundary, the word pointer is also advanced by - the stride to the next block. This feature may be used to store blocks of - data interleaved, e.g. for progressive coding or for noncontiguous parallel - access to the bit stream Note that the block size is measured in words, - while the stride is measured in multiples of the block size. Strided access - can have a significant performance penalty. - -5. Multiple bits are read and written in order of least to most significant - bit. Thus, the statement - - value = stream_write_bits(stream, value, n); - - is essentially equivalent to (but faster than) - - for (i = 0; i < n; i++, value >>= 1) - stream_write_bit(value & 1); - - when 0 <= n <= 64. The same holds for read calls, and thus - - value = stream_read_bits(stream, n); - - is essentially equivalent to - - for (i = 0, value = 0; i < n; i++) - value += (uint64)stream_read_bit() << i; - - Note that it is possible to write fewer bits than the argument 'value' - holds (possibly even no bits), in which case any unwritten bits are - returned. - -6. Although the stream_wseek(stream, offset) call allows positioning the - stream for writing at any bit offset without any data loss (i.e. all - previously written bits preceding the offset remain valid), for efficiency - the stream_flush(stream) operation will zero all bits up to the next - multiple of wsize bits, thus overwriting bits that were previously stored - at that location. Consequently, random write access is effectively - supported only at wsize granularity. For sequential access, the largest - possible wsize is preferred due to higher speed. - -7. It is up to the user to adhere to these rules. For performance reasons, - no error checking is done, and in particular buffer overruns are not - caught. -*/ - -#include <limits.h> -#include <stdlib.h> - -#ifndef inline_ - #define inline_ -#endif - -/* satisfy compiler when args unused */ -#define unused_(x) ((void)(x)) - -/* bit stream word/buffer type; granularity of stream I/O operations */ -#ifdef BIT_STREAM_WORD_TYPE - /* may be 8-, 16-, 32-, or 64-bit unsigned integer type */ - typedef BIT_STREAM_WORD_TYPE word; -#else - /* use maximum word size by default for highest speed */ - typedef uint64 word; -#endif - -/* number of bits in a buffered word */ -#define wsize ((uint)(CHAR_BIT * sizeof(word))) - -/* bit stream structure (opaque to caller) */ -struct bitstream { - uint bits; /* number of buffered bits (0 <= bits < wsize) */ - word buffer; /* buffer for incoming/outgoing bits (buffer < 2^bits) */ - word* ptr; /* pointer to next word to be read/written */ - word* begin; /* beginning of stream */ - word* end; /* end of stream (currently unused) */ -#ifdef BIT_STREAM_STRIDED - size_t mask; /* one less the block size in number of words */ - ptrdiff_t delta; /* number of words between consecutive blocks */ -#endif -}; - -/* private functions ------------------------------------------------------- */ - -/* read a single word from memory */ -static word -stream_read_word(bitstream* s) -{ - word w = *s->ptr++; -#ifdef BIT_STREAM_STRIDED - if (!((s->ptr - s->begin) & s->mask)) - s->ptr += s->delta; -#endif - return w; -} - -/* write a single word to memory */ -static void -stream_write_word(bitstream* s, word value) -{ - *s->ptr++ = value; -#ifdef BIT_STREAM_STRIDED - if (!((s->ptr - s->begin) & s->mask)) - s->ptr += s->delta; -#endif -} - -/* public functions -------------------------------------------------------- */ - -/* pointer to beginning of stream */ -inline_ void* -stream_data(const bitstream* s) -{ - return s->begin; -} - -/* current byte size of stream (if flushed) */ -inline_ size_t -stream_size(const bitstream* s) -{ - return sizeof(word) * (s->ptr - s->begin); -} - -/* byte capacity of stream */ -inline_ size_t -stream_capacity(const bitstream* s) -{ - return sizeof(word) * (s->end - s->begin); -} - -/* number of words per block */ -inline_ size_t -stream_stride_block(const bitstream* s) -{ -#ifdef BIT_STREAM_STRIDED - return s->mask + 1; -#else - unused_(s); - return 1; -#endif -} - -/* number of blocks between consecutive stream blocks */ -inline_ ptrdiff_t -stream_stride_delta(const bitstream* s) -{ -#ifdef BIT_STREAM_STRIDED - return s->delta / (s->mask + 1); -#else - unused_(s); - return 0; -#endif -} - -/* read single bit (0 or 1) */ -inline_ uint -stream_read_bit(bitstream* s) -{ - uint bit; - if (!s->bits) { - s->buffer = stream_read_word(s); - s->bits = wsize; - } - s->bits--; - bit = (uint)s->buffer & 1u; - s->buffer >>= 1; - return bit; -} - -/* write single bit (must be 0 or 1) */ -inline_ uint -stream_write_bit(bitstream* s, uint bit) -{ - s->buffer += (word)bit << s->bits; - if (++s->bits == wsize) { - stream_write_word(s, s->buffer); - s->buffer = 0; - s->bits = 0; - } - return bit; -} - -/* read 0 <= n <= 64 bits */ -inline_ uint64 -stream_read_bits(bitstream* s, uint n) -{ - uint64 value = s->buffer; - if (s->bits < n) { - /* keep fetching wsize bits until enough bits are buffered */ - do { - /* assert: 0 <= s->bits < n <= 64 */ - s->buffer = stream_read_word(s); - value += (uint64)s->buffer << s->bits; - s->bits += wsize; - } while (sizeof(s->buffer) < sizeof(value) && s->bits < n); - /* assert: 1 <= n <= s->bits < n + wsize */ - s->bits -= n; - if (!s->bits) { - /* value holds exactly n bits; no need for masking */ - s->buffer = 0; - } - else { - /* assert: 1 <= s->bits < wsize */ - s->buffer >>= wsize - s->bits; - /* assert: 1 <= n <= 64 */ - value &= ((uint64)2 << (n - 1)) - 1; - } - } - else { - /* assert: 0 <= n <= s->bits < wsize <= 64 */ - s->bits -= n; - s->buffer >>= n; - value &= ((uint64)1 << n) - 1; - } - return value; -} - -/* write 0 <= n <= 64 low bits of value and return remaining bits */ -inline_ uint64 -stream_write_bits(bitstream* s, uint64 value, uint n) -{ - /* append bit string to buffer */ - s->buffer += (word)(value << s->bits); - s->bits += n; - /* is buffer full? */ - if (s->bits >= wsize) { - /* 1 <= n <= 64; decrement n to ensure valid right shifts below */ - value >>= 1; - n--; - /* assert: 0 <= n < 64; wsize <= s->bits <= wsize + n */ - do { - /* output wsize bits while buffer is full */ - s->bits -= wsize; - /* assert: 0 <= s->bits <= n */ - stream_write_word(s, s->buffer); - /* assert: 0 <= n - s->bits < 64 */ - s->buffer = (word)(value >> (n - s->bits)); - } while (sizeof(s->buffer) < sizeof(value) && s->bits >= wsize); - } - /* assert: 0 <= s->bits < wsize */ - s->buffer &= ((word)1 << s->bits) - 1; - /* assert: 0 <= n < 64 */ - return value >> n; -} - -/* return bit offset to next bit to be read */ -inline_ size_t -stream_rtell(const bitstream* s) -{ - return wsize * (s->ptr - s->begin) - s->bits; -} - -/* return bit offset to next bit to be written */ -inline_ size_t -stream_wtell(const bitstream* s) -{ - return wsize * (s->ptr - s->begin) + s->bits; -} - -/* position stream for reading or writing at beginning */ -inline_ void -stream_rewind(bitstream* s) -{ - s->ptr = s->begin; - s->buffer = 0; - s->bits = 0; -} - -/* position stream for reading at given bit offset */ -inline_ void -stream_rseek(bitstream* s, size_t offset) -{ - uint n = offset % wsize; - s->ptr = s->begin + offset / wsize; - if (n) { - s->buffer = stream_read_word(s) >> n; - s->bits = wsize - n; - } - else { - s->buffer = 0; - s->bits = 0; - } -} - -/* position stream for writing at given bit offset */ -inline_ void -stream_wseek(bitstream* s, size_t offset) -{ - uint n = offset % wsize; - s->ptr = s->begin + offset / wsize; - if (n) { - word buffer = *s->ptr; - buffer &= ((word)1 << n) - 1; - s->buffer = buffer; - s->bits = n; - } - else { - s->buffer = 0; - s->bits = 0; - } -} - -/* skip over the next n bits (n >= 0) */ -inline_ void -stream_skip(bitstream* s, uint n) -{ - stream_rseek(s, stream_rtell(s) + n); -} - -/* append n zero-bits to stream (n >= 0) */ -inline_ void -stream_pad(bitstream* s, uint n) -{ - for (s->bits += n; s->bits >= wsize; s->bits -= wsize) { - stream_write_word(s, s->buffer); - s->buffer = 0; - } -} - -/* align stream on next word boundary */ -inline_ size_t -stream_align(bitstream* s) -{ - uint bits = s->bits; - if (bits) - stream_skip(s, bits); - return bits; -} - -/* write any remaining buffered bits and align stream on next word boundary */ -inline_ size_t -stream_flush(bitstream* s) -{ - uint bits = (wsize - s->bits) % wsize; - if (bits) - stream_pad(s, bits); - return bits; -} - -/* copy n bits from one bit stream to another */ -inline_ void -stream_copy(bitstream* dst, bitstream* src, size_t n) -{ - while (n > wsize) { - word w = (word)stream_read_bits(src, wsize); - stream_write_bits(dst, w, wsize); - n -= wsize; - } - if (n) { - word w = (word)stream_read_bits(src, (uint)n); - stream_write_bits(dst, w, (uint)n); - } -} - -#ifdef BIT_STREAM_STRIDED -/* set block size in number of words and spacing in number of blocks */ -inline_ int -stream_set_stride(bitstream* s, size_t block, ptrdiff_t delta) -{ - /* ensure block size is a power of two */ - if (block & (block - 1)) - return 0; - s->mask = block - 1; - s->delta = delta * block; - return 1; -} -#endif - -/* allocate and initialize bit stream to user-allocated buffer */ -inline_ bitstream* -stream_open(void* buffer, size_t bytes) -{ - bitstream* s = (bitstream*)malloc(sizeof(bitstream)); - if (s) { - s->begin = (word*)buffer; - s->end = s->begin + bytes / sizeof(word); -#ifdef BIT_STREAM_STRIDED - stream_set_stride(s, 0, 0); -#endif - stream_rewind(s); - } - return s; -} - -/* close and deallocate bit stream */ -inline_ void -stream_close(bitstream* s) -{ - free(s); -} - -/* make a copy of bit stream to shared memory buffer */ -inline_ bitstream* -stream_clone(const bitstream* s) -{ - bitstream* c = (bitstream*)malloc(sizeof(bitstream)); - if (c) - *c = *s; - return c; -} - -#undef unused_ diff --git a/ThirdParty/zfp/vtkzfp/src/inline/inline.h b/ThirdParty/zfp/vtkzfp/src/inline/inline.h deleted file mode 100644 index e9ade3f11d8f85b64711880cbee8198e737a6448..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/inline/inline.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef INLINE_H -#define INLINE_H - -#ifndef inline_ - #if __STDC_VERSION__ >= 199901L - #define inline_ static inline - #else - #define inline_ static - #endif -#endif - -#endif diff --git a/ThirdParty/zfp/vtkzfp/src/share/omp.c b/ThirdParty/zfp/vtkzfp/src/share/omp.c deleted file mode 100644 index 9ee26b9a68aae56f3fb6e75054fb4b4ddb60d786..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/share/omp.c +++ /dev/null @@ -1,25 +0,0 @@ -#ifdef _OPENMP -#include <omp.h> - -/* number of omp threads to use */ -static int -thread_count_omp(const zfp_stream* stream) -{ - int count = stream->exec.params.omp.threads; - /* if no thread count is specified, use default number of threads */ - if (!count) - count = omp_get_max_threads(); - return count; -} - -/* number of chunks to partition array into */ -static uint -chunk_count_omp(const zfp_stream* stream, uint blocks, uint threads) -{ - uint chunk_size = stream->exec.params.omp.chunk_size; - /* if no chunk size is specified, assign one chunk per thread */ - uint chunks = chunk_size ? (blocks + chunk_size - 1) / chunk_size : threads; - return MIN(chunks, blocks); -} - -#endif diff --git a/ThirdParty/zfp/vtkzfp/src/share/parallel.c b/ThirdParty/zfp/vtkzfp/src/share/parallel.c deleted file mode 100644 index e778ac7c23687b71bd1c6e437fb82b5c22dc37f2..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/share/parallel.c +++ /dev/null @@ -1,100 +0,0 @@ -#ifdef _OPENMP - -/* block index at which chunk begins */ -static uint -chunk_offset(uint blocks, uint chunks, uint chunk) -{ - return (uint)((blocks * (uint64)chunk) / chunks); -} - -/* initialize per-thread bit streams for parallel compression */ -static bitstream** -compress_init_par(zfp_stream* stream, const zfp_field* field, uint chunks, uint blocks) -{ - bitstream** bs; - size_t size; - int copy = 0; - uint i; - - /* determine maximum size buffer needed per thread */ - zfp_field f = *field; - switch (zfp_field_dimensionality(field)) { - case 1: - f.nx = 4 * (blocks + chunks - 1) / chunks; - break; - case 2: - f.nx = 4; - f.ny = 4 * (blocks + chunks - 1) / chunks; - break; - case 3: - f.nx = 4; - f.ny = 4; - f.nz = 4 * (blocks + chunks - 1) / chunks; - break; - case 4: - f.nx = 4; - f.ny = 4; - f.nz = 4; - f.nw = 4 * (blocks + chunks - 1) / chunks; - break; - default: - return NULL; - } - size = zfp_stream_maximum_size(stream, &f); - - /* avoid copies in fixed-rate mode when each bitstream is word aligned */ - copy |= stream->minbits != stream->maxbits; - copy |= (stream->maxbits % stream_word_bits) != 0; - copy |= (stream_wtell(stream->stream) % stream_word_bits) != 0; - - /* set up buffer for each thread to compress to */ - bs = (bitstream**)malloc(chunks * sizeof(bitstream*)); - if (!bs) - return NULL; - for (i = 0; i < chunks; i++) { - uint block = chunk_offset(blocks, chunks, i); - void* buffer = copy ? malloc(size) : (uchar*)stream_data(stream->stream) + stream_size(stream->stream) + block * stream->maxbits / CHAR_BIT; - if (!buffer) - break; - bs[i] = stream_open(buffer, size); - } - - /* handle memory allocation failure */ - if (copy && i < chunks) { - while (i--) { - free(stream_data(bs[i])); - stream_close(bs[i]); - } - free(bs); - bs = NULL; - } - - return bs; -} - -/* flush and concatenate bit streams if needed */ -static void -compress_finish_par(zfp_stream* stream, bitstream** src, uint chunks) -{ - bitstream* dst = zfp_stream_bit_stream(stream); - int copy = (stream_data(dst) != stream_data(*src)); - size_t offset = stream_wtell(dst); - uint i; - for (i = 0; i < chunks; i++) { - size_t bits = stream_wtell(src[i]); - offset += bits; - stream_flush(src[i]); - /* concatenate streams if they are not already contiguous */ - if (copy) { - stream_rewind(src[i]); - stream_copy(dst, src[i], bits); - free(stream_data(src[i])); - } - stream_close(src[i]); - } - free(src); - if (!copy) - stream_wseek(dst, offset); -} - -#endif diff --git a/ThirdParty/zfp/vtkzfp/src/template/codec.h b/ThirdParty/zfp/vtkzfp/src/template/codec.h deleted file mode 100644 index e4b4acf9543795c49f23894c8fd141149a8b6751..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/codec.h +++ /dev/null @@ -1,4 +0,0 @@ -#define PERM _t1(perm, DIMS) /* coefficient order */ -#define BLOCK_SIZE (1 << (2 * DIMS)) /* values per block */ -#define EBIAS ((1 << (EBITS - 1)) - 1) /* exponent bias */ -#define REVERSIBLE(zfp) ((zfp)->minexp < ZFP_MIN_EXP) /* reversible mode? */ diff --git a/ThirdParty/zfp/vtkzfp/src/template/codec1.c b/ThirdParty/zfp/vtkzfp/src/template/codec1.c deleted file mode 100644 index 5a4786471a940610d67472fd90858177b7d452d6..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/codec1.c +++ /dev/null @@ -1,4 +0,0 @@ -/* order coefficients by polynomial degree/frequency */ -cache_align_(static const uchar perm_1[4]) = { - 0, 1, 2, 3 -}; diff --git a/ThirdParty/zfp/vtkzfp/src/template/codec2.c b/ThirdParty/zfp/vtkzfp/src/template/codec2.c deleted file mode 100644 index a0f977024d6e73203ecbd14e6b605c949d799023..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/codec2.c +++ /dev/null @@ -1,32 +0,0 @@ -#define index(i, j) ((i) + 4 * (j)) - -/* order coefficients (i, j) by i + j, then i^2 + j^2 */ -cache_align_(static const uchar perm_2[16]) = { - index(0, 0), /* 0 : 0 */ - - index(1, 0), /* 1 : 1 */ - index(0, 1), /* 2 : 1 */ - - index(1, 1), /* 3 : 2 */ - - index(2, 0), /* 4 : 2 */ - index(0, 2), /* 5 : 2 */ - - index(2, 1), /* 6 : 3 */ - index(1, 2), /* 7 : 3 */ - - index(3, 0), /* 8 : 3 */ - index(0, 3), /* 9 : 3 */ - - index(2, 2), /* 10 : 4 */ - - index(3, 1), /* 11 : 4 */ - index(1, 3), /* 12 : 4 */ - - index(3, 2), /* 13 : 5 */ - index(2, 3), /* 14 : 5 */ - - index(3, 3), /* 15 : 6 */ -}; - -#undef index diff --git a/ThirdParty/zfp/vtkzfp/src/template/codec3.c b/ThirdParty/zfp/vtkzfp/src/template/codec3.c deleted file mode 100644 index b95f302720317b13bea8b53814646dccc42b6de2..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/codec3.c +++ /dev/null @@ -1,90 +0,0 @@ -#define index(i, j, k) ((i) + 4 * ((j) + 4 * (k))) - -/* order coefficients (i, j, k) by i + j + k, then i^2 + j^2 + k^2 */ -cache_align_(static const uchar perm_3[64]) = { - index(0, 0, 0), /* 0 : 0 */ - - index(1, 0, 0), /* 1 : 1 */ - index(0, 1, 0), /* 2 : 1 */ - index(0, 0, 1), /* 3 : 1 */ - - index(0, 1, 1), /* 4 : 2 */ - index(1, 0, 1), /* 5 : 2 */ - index(1, 1, 0), /* 6 : 2 */ - - index(2, 0, 0), /* 7 : 2 */ - index(0, 2, 0), /* 8 : 2 */ - index(0, 0, 2), /* 9 : 2 */ - - index(1, 1, 1), /* 10 : 3 */ - - index(2, 1, 0), /* 11 : 3 */ - index(2, 0, 1), /* 12 : 3 */ - index(0, 2, 1), /* 13 : 3 */ - index(1, 2, 0), /* 14 : 3 */ - index(1, 0, 2), /* 15 : 3 */ - index(0, 1, 2), /* 16 : 3 */ - - index(3, 0, 0), /* 17 : 3 */ - index(0, 3, 0), /* 18 : 3 */ - index(0, 0, 3), /* 19 : 3 */ - - index(2, 1, 1), /* 20 : 4 */ - index(1, 2, 1), /* 21 : 4 */ - index(1, 1, 2), /* 22 : 4 */ - - index(0, 2, 2), /* 23 : 4 */ - index(2, 0, 2), /* 24 : 4 */ - index(2, 2, 0), /* 25 : 4 */ - - index(3, 1, 0), /* 26 : 4 */ - index(3, 0, 1), /* 27 : 4 */ - index(0, 3, 1), /* 28 : 4 */ - index(1, 3, 0), /* 29 : 4 */ - index(1, 0, 3), /* 30 : 4 */ - index(0, 1, 3), /* 31 : 4 */ - - index(1, 2, 2), /* 32 : 5 */ - index(2, 1, 2), /* 33 : 5 */ - index(2, 2, 1), /* 34 : 5 */ - - index(3, 1, 1), /* 35 : 5 */ - index(1, 3, 1), /* 36 : 5 */ - index(1, 1, 3), /* 37 : 5 */ - - index(3, 2, 0), /* 38 : 5 */ - index(3, 0, 2), /* 39 : 5 */ - index(0, 3, 2), /* 40 : 5 */ - index(2, 3, 0), /* 41 : 5 */ - index(2, 0, 3), /* 42 : 5 */ - index(0, 2, 3), /* 43 : 5 */ - - index(2, 2, 2), /* 44 : 6 */ - - index(3, 2, 1), /* 45 : 6 */ - index(3, 1, 2), /* 46 : 6 */ - index(1, 3, 2), /* 47 : 6 */ - index(2, 3, 1), /* 48 : 6 */ - index(2, 1, 3), /* 49 : 6 */ - index(1, 2, 3), /* 50 : 6 */ - - index(0, 3, 3), /* 51 : 6 */ - index(3, 0, 3), /* 52 : 6 */ - index(3, 3, 0), /* 53 : 6 */ - - index(3, 2, 2), /* 54 : 7 */ - index(2, 3, 2), /* 55 : 7 */ - index(2, 2, 3), /* 56 : 7 */ - - index(1, 3, 3), /* 57 : 7 */ - index(3, 1, 3), /* 58 : 7 */ - index(3, 3, 1), /* 59 : 7 */ - - index(2, 3, 3), /* 60 : 8 */ - index(3, 2, 3), /* 61 : 8 */ - index(3, 3, 2), /* 62 : 8 */ - - index(3, 3, 3), /* 63 : 9 */ -}; - -#undef index diff --git a/ThirdParty/zfp/vtkzfp/src/template/codec4.c b/ThirdParty/zfp/vtkzfp/src/template/codec4.c deleted file mode 100644 index b8314525cd42802a3ad8463191cea96bddef9661..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/codec4.c +++ /dev/null @@ -1,297 +0,0 @@ -#define index(i, j, k, l) ((i) + 4 * ((j) + 4 * ((k) + 4 * (l)))) - -/* order coefficients (i, j, k, l) by i + j + k + l, then i^2 + j^2 + k^2 + l^2 */ -cache_align_(static const uchar perm_4[256]) = { - index(0, 0, 0, 0), /* 0 : 0 */ - - index(1, 0, 0, 0), /* 1 : 1 */ - index(0, 1, 0, 0), /* 2 : 1 */ - index(0, 0, 1, 0), /* 3 : 1 */ - index(0, 0, 0, 1), /* 4 : 1 */ - - index(1, 1, 0, 0), /* 5 : 2 */ - index(0, 0, 1, 1), /* 6 : 2 */ - index(1, 0, 1, 0), /* 7 : 2 */ - index(0, 1, 0, 1), /* 8 : 2 */ - index(1, 0, 0, 1), /* 9 : 2 */ - index(0, 1, 1, 0), /* 10 : 2 */ - - index(2, 0, 0, 0), /* 11 : 2 */ - index(0, 2, 0, 0), /* 12 : 2 */ - index(0, 0, 2, 0), /* 13 : 2 */ - index(0, 0, 0, 2), /* 14 : 2 */ - - index(0, 1, 1, 1), /* 15 : 3 */ - index(1, 0, 1, 1), /* 16 : 3 */ - index(1, 1, 0, 1), /* 17 : 3 */ - index(1, 1, 1, 0), /* 18 : 3 */ - - index(2, 1, 0, 0), /* 19 : 3 */ - index(2, 0, 1, 0), /* 20 : 3 */ - index(2, 0, 0, 1), /* 21 : 3 */ - index(0, 2, 1, 0), /* 22 : 3 */ - index(0, 2, 0, 1), /* 23 : 3 */ - index(1, 2, 0, 0), /* 24 : 3 */ - index(0, 0, 2, 1), /* 25 : 3 */ - index(1, 0, 2, 0), /* 26 : 3 */ - index(0, 1, 2, 0), /* 27 : 3 */ - index(1, 0, 0, 2), /* 28 : 3 */ - index(0, 1, 0, 2), /* 29 : 3 */ - index(0, 0, 1, 2), /* 30 : 3 */ - - index(3, 0, 0, 0), /* 31 : 3 */ - index(0, 3, 0, 0), /* 32 : 3 */ - index(0, 0, 3, 0), /* 33 : 3 */ - index(0, 0, 0, 3), /* 34 : 3 */ - - index(1, 1, 1, 1), /* 35 : 4 */ - - index(2, 0, 1, 1), /* 36 : 4 */ - index(2, 1, 0, 1), /* 37 : 4 */ - index(2, 1, 1, 0), /* 38 : 4 */ - index(1, 2, 0, 1), /* 39 : 4 */ - index(1, 2, 1, 0), /* 40 : 4 */ - index(0, 2, 1, 1), /* 41 : 4 */ - index(1, 1, 2, 0), /* 42 : 4 */ - index(0, 1, 2, 1), /* 43 : 4 */ - index(1, 0, 2, 1), /* 44 : 4 */ - index(0, 1, 1, 2), /* 45 : 4 */ - index(1, 0, 1, 2), /* 46 : 4 */ - index(1, 1, 0, 2), /* 47 : 4 */ - - index(2, 2, 0, 0), /* 48 : 4 */ - index(0, 0, 2, 2), /* 49 : 4 */ - index(2, 0, 2, 0), /* 50 : 4 */ - index(0, 2, 0, 2), /* 51 : 4 */ - index(2, 0, 0, 2), /* 52 : 4 */ - index(0, 2, 2, 0), /* 53 : 4 */ - - index(3, 1, 0, 0), /* 54 : 4 */ - index(3, 0, 1, 0), /* 55 : 4 */ - index(3, 0, 0, 1), /* 56 : 4 */ - index(0, 3, 1, 0), /* 57 : 4 */ - index(0, 3, 0, 1), /* 58 : 4 */ - index(1, 3, 0, 0), /* 59 : 4 */ - index(0, 0, 3, 1), /* 60 : 4 */ - index(1, 0, 3, 0), /* 61 : 4 */ - index(0, 1, 3, 0), /* 62 : 4 */ - index(1, 0, 0, 3), /* 63 : 4 */ - index(0, 1, 0, 3), /* 64 : 4 */ - index(0, 0, 1, 3), /* 65 : 4 */ - - index(2, 1, 1, 1), /* 66 : 5 */ - index(1, 2, 1, 1), /* 67 : 5 */ - index(1, 1, 2, 1), /* 68 : 5 */ - index(1, 1, 1, 2), /* 69 : 5 */ - - index(1, 0, 2, 2), /* 70 : 5 */ - index(1, 2, 0, 2), /* 71 : 5 */ - index(1, 2, 2, 0), /* 72 : 5 */ - index(2, 1, 0, 2), /* 73 : 5 */ - index(2, 1, 2, 0), /* 74 : 5 */ - index(0, 1, 2, 2), /* 75 : 5 */ - index(2, 2, 1, 0), /* 76 : 5 */ - index(0, 2, 1, 2), /* 77 : 5 */ - index(2, 0, 1, 2), /* 78 : 5 */ - index(0, 2, 2, 1), /* 79 : 5 */ - index(2, 0, 2, 1), /* 80 : 5 */ - index(2, 2, 0, 1), /* 81 : 5 */ - - index(3, 0, 1, 1), /* 82 : 5 */ - index(3, 1, 0, 1), /* 83 : 5 */ - index(3, 1, 1, 0), /* 84 : 5 */ - index(1, 3, 0, 1), /* 85 : 5 */ - index(1, 3, 1, 0), /* 86 : 5 */ - index(0, 3, 1, 1), /* 87 : 5 */ - index(1, 1, 3, 0), /* 88 : 5 */ - index(0, 1, 3, 1), /* 89 : 5 */ - index(1, 0, 3, 1), /* 90 : 5 */ - index(0, 1, 1, 3), /* 91 : 5 */ - index(1, 0, 1, 3), /* 92 : 5 */ - index(1, 1, 0, 3), /* 93 : 5 */ - - index(3, 2, 0, 0), /* 94 : 5 */ - index(3, 0, 2, 0), /* 95 : 5 */ - index(3, 0, 0, 2), /* 96 : 5 */ - index(0, 3, 2, 0), /* 97 : 5 */ - index(0, 3, 0, 2), /* 98 : 5 */ - index(2, 3, 0, 0), /* 99 : 5 */ - index(0, 0, 3, 2), /* 100 : 5 */ - index(2, 0, 3, 0), /* 101 : 5 */ - index(0, 2, 3, 0), /* 102 : 5 */ - index(2, 0, 0, 3), /* 103 : 5 */ - index(0, 2, 0, 3), /* 104 : 5 */ - index(0, 0, 2, 3), /* 105 : 5 */ - - index(2, 2, 1, 1), /* 106 : 6 */ - index(1, 1, 2, 2), /* 107 : 6 */ - index(2, 1, 2, 1), /* 108 : 6 */ - index(1, 2, 1, 2), /* 109 : 6 */ - index(2, 1, 1, 2), /* 110 : 6 */ - index(1, 2, 2, 1), /* 111 : 6 */ - - index(0, 2, 2, 2), /* 112 : 6 */ - index(2, 0, 2, 2), /* 113 : 6 */ - index(2, 2, 0, 2), /* 114 : 6 */ - index(2, 2, 2, 0), /* 115 : 6 */ - - index(3, 1, 1, 1), /* 116 : 6 */ - index(1, 3, 1, 1), /* 117 : 6 */ - index(1, 1, 3, 1), /* 118 : 6 */ - index(1, 1, 1, 3), /* 119 : 6 */ - - index(3, 2, 1, 0), /* 120 : 6 */ - index(3, 2, 0, 1), /* 121 : 6 */ - index(3, 0, 2, 1), /* 122 : 6 */ - index(3, 1, 2, 0), /* 123 : 6 */ - index(3, 1, 0, 2), /* 124 : 6 */ - index(3, 0, 1, 2), /* 125 : 6 */ - index(0, 3, 2, 1), /* 126 : 6 */ - index(1, 3, 2, 0), /* 127 : 6 */ - index(1, 3, 0, 2), /* 128 : 6 */ - index(0, 3, 1, 2), /* 129 : 6 */ - index(2, 3, 1, 0), /* 130 : 6 */ - index(2, 3, 0, 1), /* 131 : 6 */ - index(1, 0, 3, 2), /* 132 : 6 */ - index(0, 1, 3, 2), /* 133 : 6 */ - index(2, 1, 3, 0), /* 134 : 6 */ - index(2, 0, 3, 1), /* 135 : 6 */ - index(0, 2, 3, 1), /* 136 : 6 */ - index(1, 2, 3, 0), /* 137 : 6 */ - index(2, 1, 0, 3), /* 138 : 6 */ - index(2, 0, 1, 3), /* 139 : 6 */ - index(0, 2, 1, 3), /* 140 : 6 */ - index(1, 2, 0, 3), /* 141 : 6 */ - index(1, 0, 2, 3), /* 142 : 6 */ - index(0, 1, 2, 3), /* 143 : 6 */ - - index(3, 3, 0, 0), /* 144 : 6 */ - index(0, 0, 3, 3), /* 145 : 6 */ - index(3, 0, 3, 0), /* 146 : 6 */ - index(0, 3, 0, 3), /* 147 : 6 */ - index(3, 0, 0, 3), /* 148 : 6 */ - index(0, 3, 3, 0), /* 149 : 6 */ - - index(1, 2, 2, 2), /* 150 : 7 */ - index(2, 1, 2, 2), /* 151 : 7 */ - index(2, 2, 1, 2), /* 152 : 7 */ - index(2, 2, 2, 1), /* 153 : 7 */ - - index(3, 2, 1, 1), /* 154 : 7 */ - index(3, 1, 2, 1), /* 155 : 7 */ - index(3, 1, 1, 2), /* 156 : 7 */ - index(1, 3, 2, 1), /* 157 : 7 */ - index(1, 3, 1, 2), /* 158 : 7 */ - index(2, 3, 1, 1), /* 159 : 7 */ - index(1, 1, 3, 2), /* 160 : 7 */ - index(2, 1, 3, 1), /* 161 : 7 */ - index(1, 2, 3, 1), /* 162 : 7 */ - index(2, 1, 1, 3), /* 163 : 7 */ - index(1, 2, 1, 3), /* 164 : 7 */ - index(1, 1, 2, 3), /* 165 : 7 */ - - index(3, 0, 2, 2), /* 166 : 7 */ - index(3, 2, 0, 2), /* 167 : 7 */ - index(3, 2, 2, 0), /* 168 : 7 */ - index(2, 3, 0, 2), /* 169 : 7 */ - index(2, 3, 2, 0), /* 170 : 7 */ - index(0, 3, 2, 2), /* 171 : 7 */ - index(2, 2, 3, 0), /* 172 : 7 */ - index(0, 2, 3, 2), /* 173 : 7 */ - index(2, 0, 3, 2), /* 174 : 7 */ - index(0, 2, 2, 3), /* 175 : 7 */ - index(2, 0, 2, 3), /* 176 : 7 */ - index(2, 2, 0, 3), /* 177 : 7 */ - - index(1, 0, 3, 3), /* 178 : 7 */ - index(1, 3, 0, 3), /* 179 : 7 */ - index(1, 3, 3, 0), /* 180 : 7 */ - index(3, 1, 0, 3), /* 181 : 7 */ - index(3, 1, 3, 0), /* 182 : 7 */ - index(0, 1, 3, 3), /* 183 : 7 */ - index(3, 3, 1, 0), /* 184 : 7 */ - index(0, 3, 1, 3), /* 185 : 7 */ - index(3, 0, 1, 3), /* 186 : 7 */ - index(0, 3, 3, 1), /* 187 : 7 */ - index(3, 0, 3, 1), /* 188 : 7 */ - index(3, 3, 0, 1), /* 189 : 7 */ - - index(2, 2, 2, 2), /* 190 : 8 */ - - index(3, 1, 2, 2), /* 191 : 8 */ - index(3, 2, 1, 2), /* 192 : 8 */ - index(3, 2, 2, 1), /* 193 : 8 */ - index(2, 3, 1, 2), /* 194 : 8 */ - index(2, 3, 2, 1), /* 195 : 8 */ - index(1, 3, 2, 2), /* 196 : 8 */ - index(2, 2, 3, 1), /* 197 : 8 */ - index(1, 2, 3, 2), /* 198 : 8 */ - index(2, 1, 3, 2), /* 199 : 8 */ - index(1, 2, 2, 3), /* 200 : 8 */ - index(2, 1, 2, 3), /* 201 : 8 */ - index(2, 2, 1, 3), /* 202 : 8 */ - - index(3, 3, 1, 1), /* 203 : 8 */ - index(1, 1, 3, 3), /* 204 : 8 */ - index(3, 1, 3, 1), /* 205 : 8 */ - index(1, 3, 1, 3), /* 206 : 8 */ - index(3, 1, 1, 3), /* 207 : 8 */ - index(1, 3, 3, 1), /* 208 : 8 */ - - index(2, 0, 3, 3), /* 209 : 8 */ - index(2, 3, 0, 3), /* 210 : 8 */ - index(2, 3, 3, 0), /* 211 : 8 */ - index(3, 2, 0, 3), /* 212 : 8 */ - index(3, 2, 3, 0), /* 213 : 8 */ - index(0, 2, 3, 3), /* 214 : 8 */ - index(3, 3, 2, 0), /* 215 : 8 */ - index(0, 3, 2, 3), /* 216 : 8 */ - index(3, 0, 2, 3), /* 217 : 8 */ - index(0, 3, 3, 2), /* 218 : 8 */ - index(3, 0, 3, 2), /* 219 : 8 */ - index(3, 3, 0, 2), /* 220 : 8 */ - - index(3, 2, 2, 2), /* 221 : 9 */ - index(2, 3, 2, 2), /* 222 : 9 */ - index(2, 2, 3, 2), /* 223 : 9 */ - index(2, 2, 2, 3), /* 224 : 9 */ - - index(2, 1, 3, 3), /* 225 : 9 */ - index(2, 3, 1, 3), /* 226 : 9 */ - index(2, 3, 3, 1), /* 227 : 9 */ - index(3, 2, 1, 3), /* 228 : 9 */ - index(3, 2, 3, 1), /* 229 : 9 */ - index(1, 2, 3, 3), /* 230 : 9 */ - index(3, 3, 2, 1), /* 231 : 9 */ - index(1, 3, 2, 3), /* 232 : 9 */ - index(3, 1, 2, 3), /* 233 : 9 */ - index(1, 3, 3, 2), /* 234 : 9 */ - index(3, 1, 3, 2), /* 235 : 9 */ - index(3, 3, 1, 2), /* 236 : 9 */ - - index(0, 3, 3, 3), /* 237 : 9 */ - index(3, 0, 3, 3), /* 238 : 9 */ - index(3, 3, 0, 3), /* 239 : 9 */ - index(3, 3, 3, 0), /* 240 : 9 */ - - index(3, 3, 2, 2), /* 241 : 10 */ - index(2, 2, 3, 3), /* 242 : 10 */ - index(3, 2, 3, 2), /* 243 : 10 */ - index(2, 3, 2, 3), /* 244 : 10 */ - index(3, 2, 2, 3), /* 245 : 10 */ - index(2, 3, 3, 2), /* 246 : 10 */ - - index(1, 3, 3, 3), /* 247 : 10 */ - index(3, 1, 3, 3), /* 248 : 10 */ - index(3, 3, 1, 3), /* 249 : 10 */ - index(3, 3, 3, 1), /* 250 : 10 */ - - index(2, 3, 3, 3), /* 251 : 11 */ - index(3, 2, 3, 3), /* 252 : 11 */ - index(3, 3, 2, 3), /* 253 : 11 */ - index(3, 3, 3, 2), /* 254 : 11 */ - - index(3, 3, 3, 3), /* 255 : 12 */ -}; - -#undef index diff --git a/ThirdParty/zfp/vtkzfp/src/template/codecf.c b/ThirdParty/zfp/vtkzfp/src/template/codecf.c deleted file mode 100644 index bc2cc8082d252ee81c7a87891a77e76d8698ca35..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/codecf.c +++ /dev/null @@ -1,28 +0,0 @@ -#include <limits.h> -#include <math.h> - -/* maximum number of bit planes to encode */ -static uint -precision(int maxexp, uint maxprec, int minexp, int dims) -{ - return MIN(maxprec, (uint)MAX(0, maxexp - minexp + 2 * (dims + 1))); -} - -/* map integer x relative to exponent e to floating-point number */ -static Scalar -_t1(dequantize, Scalar)(Int x, int e) -{ - return LDEXP((Scalar)x, e - (CHAR_BIT * (int)sizeof(Scalar) - 2)); -} - -/* inverse block-floating-point transform from signed integers */ -static void -_t1(inv_cast, Scalar)(const Int* iblock, Scalar* fblock, uint n, int emax) -{ - /* compute power-of-two scale factor s */ - Scalar s = _t1(dequantize, Scalar)(1, emax); - /* compute p-bit float x = s*y where |y| <= 2^(p-2) - 1 */ - do - *fblock++ = (Scalar)(s * *iblock++); - while (--n); -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/compress.c b/ThirdParty/zfp/vtkzfp/src/template/compress.c deleted file mode 100644 index 3bef658df6d034b2c9966ee05753f84ff751531a..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/compress.c +++ /dev/null @@ -1,109 +0,0 @@ -/* compress 1d contiguous array */ -static void -_t2(compress, Scalar, 1)(zfp_stream* stream, const zfp_field* field) -{ - const Scalar* data = (const Scalar*)field->data; - uint nx = field->nx; - uint mx = nx & ~3u; - uint x; - - /* compress array one block of 4 values at a time */ - for (x = 0; x < mx; x += 4, data += 4) - _t2(zfp_encode_block, Scalar, 1)(stream, data); - if (x < nx) - _t2(zfp_encode_partial_block_strided, Scalar, 1)(stream, data, nx - x, 1); -} - -/* compress 1d strided array */ -static void -_t2(compress_strided, Scalar, 1)(zfp_stream* stream, const zfp_field* field) -{ - const Scalar* data = field->data; - uint nx = field->nx; - int sx = field->sx ? field->sx : 1; - uint x; - - /* compress array one block of 4 values at a time */ - for (x = 0; x < nx; x += 4) { - const Scalar* p = data + sx * (ptrdiff_t)x; - if (nx - x < 4) - _t2(zfp_encode_partial_block_strided, Scalar, 1)(stream, p, nx - x, sx); - else - _t2(zfp_encode_block_strided, Scalar, 1)(stream, p, sx); - } -} - -/* compress 2d strided array */ -static void -_t2(compress_strided, Scalar, 2)(zfp_stream* stream, const zfp_field* field) -{ - const Scalar* data = (const Scalar*)field->data; - uint nx = field->nx; - uint ny = field->ny; - int sx = field->sx ? field->sx : 1; - int sy = field->sy ? field->sy : (int)nx; - uint x, y; - - /* compress array one block of 4x4 values at a time */ - for (y = 0; y < ny; y += 4) - for (x = 0; x < nx; x += 4) { - const Scalar* p = data + sx * (ptrdiff_t)x + sy * (ptrdiff_t)y; - if (nx - x < 4 || ny - y < 4) - _t2(zfp_encode_partial_block_strided, Scalar, 2)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), sx, sy); - else - _t2(zfp_encode_block_strided, Scalar, 2)(stream, p, sx, sy); - } -} - -/* compress 3d strided array */ -static void -_t2(compress_strided, Scalar, 3)(zfp_stream* stream, const zfp_field* field) -{ - const Scalar* data = (const Scalar*)field->data; - uint nx = field->nx; - uint ny = field->ny; - uint nz = field->nz; - int sx = field->sx ? field->sx : 1; - int sy = field->sy ? field->sy : (int)nx; - int sz = field->sz ? field->sz : (int)(nx * ny); - uint x, y, z; - - /* compress array one block of 4x4x4 values at a time */ - for (z = 0; z < nz; z += 4) - for (y = 0; y < ny; y += 4) - for (x = 0; x < nx; x += 4) { - const Scalar* p = data + sx * (ptrdiff_t)x + sy * (ptrdiff_t)y + sz * (ptrdiff_t)z; - if (nx - x < 4 || ny - y < 4 || nz - z < 4) - _t2(zfp_encode_partial_block_strided, Scalar, 3)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), sx, sy, sz); - else - _t2(zfp_encode_block_strided, Scalar, 3)(stream, p, sx, sy, sz); - } -} - -/* compress 4d strided array */ -static void -_t2(compress_strided, Scalar, 4)(zfp_stream* stream, const zfp_field* field) -{ - const Scalar* data = field->data; - uint nx = field->nx; - uint ny = field->ny; - uint nz = field->nz; - uint nw = field->nw; - int sx = field->sx ? field->sx : 1; - int sy = field->sy ? field->sy : (int)nx; - int sz = field->sz ? field->sz : (int)(nx * ny); - int sw = field->sw ? field->sw : (int)(nx * ny * nz); - uint x, y, z, w; - - /* compress array one block of 4x4x4x4 values at a time */ - for (w = 0; w < nw; w += 4) - for (z = 0; z < nz; z += 4) - for (y = 0; y < ny; y += 4) - for (x = 0; x < nx; x += 4) { - const Scalar* p = data + sx * (ptrdiff_t)x + sy * (ptrdiff_t)y + sz * (ptrdiff_t)z + sw * (ptrdiff_t)w; - if (nx - x < 4 || ny - y < 4 || nz - z < 4 || nw - w < 4) - _t2(zfp_encode_partial_block_strided, Scalar, 4)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), MIN(nw - w, 4u), sx, sy, sz, sw); - else - _t2(zfp_encode_block_strided, Scalar, 4)(stream, p, sx, sy, sz, sw); - } -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/cudacompress.c b/ThirdParty/zfp/vtkzfp/src/template/cudacompress.c deleted file mode 100644 index 1d685c92f395f87742f1bd5fe4f5776b5b24a5d2..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/cudacompress.c +++ /dev/null @@ -1,44 +0,0 @@ -#ifdef ZFP_WITH_CUDA - -#include "../cuda_zfp/cuZFP.h" - -static void -_t2(compress_cuda, Scalar, 1)(zfp_stream* stream, const zfp_field* field) -{ - if(zfp_stream_compression_mode(stream) == zfp_mode_fixed_rate) - { - cuda_compress(stream, field); - } -} - -/* compress 1d strided array */ -static void -_t2(compress_strided_cuda, Scalar, 1)(zfp_stream* stream, const zfp_field* field) -{ - if(zfp_stream_compression_mode(stream) == zfp_mode_fixed_rate) - { - cuda_compress(stream, field); - } -} - -/* compress 2d strided array */ -static void -_t2(compress_strided_cuda, Scalar, 2)(zfp_stream* stream, const zfp_field* field) -{ - if(zfp_stream_compression_mode(stream) == zfp_mode_fixed_rate) - { - cuda_compress(stream, field); - } -} - -/* compress 3d strided array */ -static void -_t2(compress_strided_cuda, Scalar, 3)(zfp_stream* stream, const zfp_field* field) -{ - if(zfp_stream_compression_mode(stream) == zfp_mode_fixed_rate) - { - cuda_compress(stream, field); - } -} - -#endif diff --git a/ThirdParty/zfp/vtkzfp/src/template/cudadecompress.c b/ThirdParty/zfp/vtkzfp/src/template/cudadecompress.c deleted file mode 100644 index 4ea4e5bf04fe0d768f53fabc31ce883ca192dd47..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/cudadecompress.c +++ /dev/null @@ -1,44 +0,0 @@ -#ifdef ZFP_WITH_CUDA - -#include "../cuda_zfp/cuZFP.h" - -static void -_t2(decompress_cuda, Scalar, 1)(zfp_stream* stream, zfp_field* field) -{ - if(zfp_stream_compression_mode(stream) == zfp_mode_fixed_rate) - { - cuda_decompress(stream, field); - } -} - -/* compress 1d strided array */ -static void -_t2(decompress_strided_cuda, Scalar, 1)(zfp_stream* stream, zfp_field* field) -{ - if(zfp_stream_compression_mode(stream) == zfp_mode_fixed_rate) - { - cuda_decompress(stream, field); - } -} - -/* compress 2d strided array */ -static void -_t2(decompress_strided_cuda, Scalar, 2)(zfp_stream* stream, zfp_field* field) -{ - if(zfp_stream_compression_mode(stream) == zfp_mode_fixed_rate) - { - cuda_decompress(stream, field); - } -} - -/* compress 3d strided array */ -static void -_t2(decompress_strided_cuda, Scalar, 3)(zfp_stream* stream, zfp_field* field) -{ - if(zfp_stream_compression_mode(stream) == zfp_mode_fixed_rate) - { - cuda_decompress(stream, field); - } -} - -#endif diff --git a/ThirdParty/zfp/vtkzfp/src/template/decode.c b/ThirdParty/zfp/vtkzfp/src/template/decode.c deleted file mode 100644 index e2a2f276da0099f3435264621410d0089137bf94..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/decode.c +++ /dev/null @@ -1,141 +0,0 @@ -#include <limits.h> - -static void _t2(inv_xform, Int, DIMS)(Int* p); - -/* private functions ------------------------------------------------------- */ - -/* inverse lifting transform of 4-vector */ -static void -_t1(inv_lift, Int)(Int* p, uint s) -{ - Int x, y, z, w; - x = *p; p += s; - y = *p; p += s; - z = *p; p += s; - w = *p; p += s; - - /* - ** non-orthogonal transform - ** ( 4 6 -4 -1) (x) - ** 1/4 * ( 4 2 4 5) (y) - ** ( 4 -2 4 -5) (z) - ** ( 4 -6 -4 1) (w) - */ - y += w >> 1; w -= y >> 1; - y += w; w <<= 1; w -= y; - z += x; x <<= 1; x -= z; - y += z; z <<= 1; z -= y; - w += x; x <<= 1; x -= w; - - p -= s; *p = w; - p -= s; *p = z; - p -= s; *p = y; - p -= s; *p = x; -} - -/* map two's complement signed integer to negabinary unsigned integer */ -static Int -_t1(uint2int, UInt)(UInt x) -{ - return (Int)((x ^ NBMASK) - NBMASK); -} - -/* reorder unsigned coefficients and convert to signed integer */ -static void -_t1(inv_order, Int)(const UInt* ublock, Int* iblock, const uchar* perm, uint n) -{ - do - iblock[*perm++] = _t1(uint2int, UInt)(*ublock++); - while (--n); -} - -/* decompress sequence of size unsigned integers */ -static uint -_t1(decode_ints, UInt)(bitstream* restrict_ stream, uint maxbits, uint maxprec, UInt* restrict_ data, uint size) -{ - /* make a copy of bit stream to avoid aliasing */ - bitstream s = *stream; - uint intprec = CHAR_BIT * (uint)sizeof(UInt); - uint kmin = intprec > maxprec ? intprec - maxprec : 0; - uint bits = maxbits; - uint i, k, m, n; - uint64 x; - - /* initialize data array to all zeros */ - for (i = 0; i < size; i++) - data[i] = 0; - - /* decode one bit plane at a time from MSB to LSB */ - for (k = intprec, n = 0; bits && k-- > kmin;) { - /* decode first n bits of bit plane #k */ - m = MIN(n, bits); - bits -= m; - x = stream_read_bits(&s, m); - /* unary run-length decode remainder of bit plane */ - for (; n < size && bits && (bits--, stream_read_bit(&s)); x += (uint64)1 << n++) - for (; n < size - 1 && bits && (bits--, !stream_read_bit(&s)); n++) - ; - /* deposit bit plane from x */ - for (i = 0; x; i++, x >>= 1) - data[i] += (UInt)(x & 1u) << k; - } - - *stream = s; - return maxbits - bits; -} - -/* decompress sequence of size > 64 unsigned integers */ -static uint -_t1(decode_many_ints, UInt)(bitstream* restrict_ stream, uint maxbits, uint maxprec, UInt* restrict_ data, uint size) -{ - /* make a copy of bit stream to avoid aliasing */ - bitstream s = *stream; - uint intprec = CHAR_BIT * (uint)sizeof(UInt); - uint kmin = intprec > maxprec ? intprec - maxprec : 0; - uint bits = maxbits; - uint i, k, m, n; - - /* initialize data array to all zeros */ - for (i = 0; i < size; i++) - data[i] = 0; - - /* decode one bit plane at a time from MSB to LSB */ - for (k = intprec, n = 0; bits && k-- > kmin;) { - /* decode first n bits of bit plane #k */ - m = MIN(n, bits); - bits -= m; - for (i = 0; i < m; i++) - if (stream_read_bit(&s)) - data[i] += (UInt)1 << k; - /* unary run-length decode remainder of bit plane */ - for (; n < size && bits && (--bits, stream_read_bit(&s)); data[n] += (UInt)1 << k, n++) - for (; n < size - 1 && bits && (--bits, !stream_read_bit(&s)); n++) - ; - } - - *stream = s; - return maxbits - bits; -} - -/* decode block of integers */ -static uint -_t2(decode_block, Int, DIMS)(bitstream* stream, int minbits, int maxbits, int maxprec, Int* iblock) -{ - int bits; - cache_align_(UInt ublock[BLOCK_SIZE]); - /* decode integer coefficients */ - if (BLOCK_SIZE <= 64) - bits = _t1(decode_ints, UInt)(stream, maxbits, maxprec, ublock, BLOCK_SIZE); - else - bits = _t1(decode_many_ints, UInt)(stream, maxbits, maxprec, ublock, BLOCK_SIZE); - /* read at least minbits bits */ - if (bits < minbits) { - stream_skip(stream, minbits - bits); - bits = minbits; - } - /* reorder unsigned coefficients and convert to signed integer */ - _t1(inv_order, Int)(ublock, iblock, PERM, BLOCK_SIZE); - /* perform decorrelating transform */ - _t2(inv_xform, Int, DIMS)(iblock); - return bits; -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/decode1.c b/ThirdParty/zfp/vtkzfp/src/template/decode1.c deleted file mode 100644 index 68ee0793e82a64c4733d59c255255c7588e3b424..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/decode1.c +++ /dev/null @@ -1,53 +0,0 @@ -/* private functions ------------------------------------------------------- */ - -/* scatter 4-value block to strided array */ -static void -_t2(scatter, Scalar, 1)(const Scalar* q, Scalar* p, int sx) -{ - uint x; - for (x = 0; x < 4; x++, p += sx) - *p = *q++; -} - -/* scatter nx-value block to strided array */ -static void -_t2(scatter_partial, Scalar, 1)(const Scalar* q, Scalar* p, uint nx, int sx) -{ - uint x; - for (x = 0; x < nx; x++, p += sx) - *p = *q++; -} - -/* inverse decorrelating 1D transform */ -static void -_t2(inv_xform, Int, 1)(Int* p) -{ - /* transform along x */ - _t1(inv_lift, Int)(p, 1); -} - -/* public functions -------------------------------------------------------- */ - -/* decode 4-value floating-point block and store at p using stride sx */ -uint -_t2(zfp_decode_block_strided, Scalar, 1)(zfp_stream* stream, Scalar* p, int sx) -{ - /* decode contiguous block */ - cache_align_(Scalar fblock[4]); - uint bits = _t2(zfp_decode_block, Scalar, 1)(stream, fblock); - /* scatter block to strided array */ - _t2(scatter, Scalar, 1)(fblock, p, sx); - return bits; -} - -/* decode nx-value floating-point block and store at p using stride sx */ -uint -_t2(zfp_decode_partial_block_strided, Scalar, 1)(zfp_stream* stream, Scalar* p, uint nx, int sx) -{ - /* decode contiguous block */ - cache_align_(Scalar fblock[4]); - uint bits = _t2(zfp_decode_block, Scalar, 1)(stream, fblock); - /* scatter block to strided array */ - _t2(scatter_partial, Scalar, 1)(fblock, p, nx, sx); - return bits; -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/decode2.c b/ThirdParty/zfp/vtkzfp/src/template/decode2.c deleted file mode 100644 index 23e1892cb5726a1483eccd86e81206f62820ea28..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/decode2.c +++ /dev/null @@ -1,60 +0,0 @@ -/* private functions ------------------------------------------------------- */ - -/* scatter 4*4 block to strided array */ -static void -_t2(scatter, Scalar, 2)(const Scalar* q, Scalar* p, int sx, int sy) -{ - uint x, y; - for (y = 0; y < 4; y++, p += sy - 4 * sx) - for (x = 0; x < 4; x++, p += sx) - *p = *q++; -} - -/* scatter nx*ny block to strided array */ -static void -_t2(scatter_partial, Scalar, 2)(const Scalar* q, Scalar* p, uint nx, uint ny, int sx, int sy) -{ - uint x, y; - for (y = 0; y < ny; y++, p += sy - (ptrdiff_t)nx * sx, q += 4 - nx) - for (x = 0; x < nx; x++, p += sx, q++) - *p = *q; -} - -/* inverse decorrelating 2D transform */ -static void -_t2(inv_xform, Int, 2)(Int* p) -{ - uint x, y; - /* transform along y */ - for (x = 0; x < 4; x++) - _t1(inv_lift, Int)(p + 1 * x, 4); - /* transform along x */ - for (y = 0; y < 4; y++) - _t1(inv_lift, Int)(p + 4 * y, 1); -} - -/* public functions -------------------------------------------------------- */ - -/* decode 4*4 floating-point block and store at p using strides (sx, sy) */ -uint -_t2(zfp_decode_block_strided, Scalar, 2)(zfp_stream* stream, Scalar* p, int sx, int sy) -{ - /* decode contiguous block */ - cache_align_(Scalar fblock[16]); - uint bits = _t2(zfp_decode_block, Scalar, 2)(stream, fblock); - /* scatter block to strided array */ - _t2(scatter, Scalar, 2)(fblock, p, sx, sy); - return bits; -} - -/* decode nx*ny floating-point block and store at p using strides (sx, sy) */ -uint -_t2(zfp_decode_partial_block_strided, Scalar, 2)(zfp_stream* stream, Scalar* p, uint nx, uint ny, int sx, int sy) -{ - /* decode contiguous block */ - cache_align_(Scalar fblock[16]); - uint bits = _t2(zfp_decode_block, Scalar, 2)(stream, fblock); - /* scatter block to strided array */ - _t2(scatter_partial, Scalar, 2)(fblock, p, nx, ny, sx, sy); - return bits; -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/decode3.c b/ThirdParty/zfp/vtkzfp/src/template/decode3.c deleted file mode 100644 index b48411821f1cfeb8be349d15645e6a137ec20a42..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/decode3.c +++ /dev/null @@ -1,68 +0,0 @@ -/* private functions ------------------------------------------------------- */ - -/* scatter 4*4*4 block to strided array */ -static void -_t2(scatter, Scalar, 3)(const Scalar* q, Scalar* p, int sx, int sy, int sz) -{ - uint x, y, z; - for (z = 0; z < 4; z++, p += sz - 4 * sy) - for (y = 0; y < 4; y++, p += sy - 4 * sx) - for (x = 0; x < 4; x++, p += sx) - *p = *q++; -} - -/* scatter nx*ny*nz block to strided array */ -static void -_t2(scatter_partial, Scalar, 3)(const Scalar* q, Scalar* p, uint nx, uint ny, uint nz, int sx, int sy, int sz) -{ - uint x, y, z; - for (z = 0; z < nz; z++, p += sz - (ptrdiff_t)ny * sy, q += 4 * (4 - ny)) - for (y = 0; y < ny; y++, p += sy - (ptrdiff_t)nx * sx, q += 1 * (4 - nx)) - for (x = 0; x < nx; x++, p += sx, q++) - *p = *q; -} - -/* inverse decorrelating 3D transform */ -static void -_t2(inv_xform, Int, 3)(Int* p) -{ - uint x, y, z; - /* transform along z */ - for (y = 0; y < 4; y++) - for (x = 0; x < 4; x++) - _t1(inv_lift, Int)(p + 1 * x + 4 * y, 16); - /* transform along y */ - for (x = 0; x < 4; x++) - for (z = 0; z < 4; z++) - _t1(inv_lift, Int)(p + 16 * z + 1 * x, 4); - /* transform along x */ - for (z = 0; z < 4; z++) - for (y = 0; y < 4; y++) - _t1(inv_lift, Int)(p + 4 * y + 16 * z, 1); -} - -/* public functions -------------------------------------------------------- */ - -/* decode 4*4*4 floating-point block and store at p using strides (sx, sy, sz) */ -uint -_t2(zfp_decode_block_strided, Scalar, 3)(zfp_stream* stream, Scalar* p, int sx, int sy, int sz) -{ - /* decode contiguous block */ - cache_align_(Scalar fblock[64]); - uint bits = _t2(zfp_decode_block, Scalar, 3)(stream, fblock); - /* scatter block to strided array */ - _t2(scatter, Scalar, 3)(fblock, p, sx, sy, sz); - return bits; -} - -/* decode nx*ny*nz floating-point block and store at p using strides (sx, sy, sz) */ -uint -_t2(zfp_decode_partial_block_strided, Scalar, 3)(zfp_stream* stream, Scalar* p, uint nx, uint ny, uint nz, int sx, int sy, int sz) -{ - /* decode contiguous block */ - cache_align_(Scalar fblock[64]); - uint bits = _t2(zfp_decode_block, Scalar, 3)(stream, fblock); - /* scatter block to strided array */ - _t2(scatter_partial, Scalar, 3)(fblock, p, nx, ny, nz, sx, sy, sz); - return bits; -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/decode4.c b/ThirdParty/zfp/vtkzfp/src/template/decode4.c deleted file mode 100644 index 8d34abfce25c99ba326da7bfbb8ba68a59830f10..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/decode4.c +++ /dev/null @@ -1,78 +0,0 @@ -/* private functions ------------------------------------------------------- */ - -/* scatter 4*4*4*4 block to strided array */ -static void -_t2(scatter, Scalar, 4)(const Scalar* q, Scalar* p, int sx, int sy, int sz, int sw) -{ - uint x, y, z, w; - for (w = 0; w < 4; w++, p += sw - 4 * sz) - for (z = 0; z < 4; z++, p += sz - 4 * sy) - for (y = 0; y < 4; y++, p += sy - 4 * sx) - for (x = 0; x < 4; x++, p += sx) - *p = *q++; -} - -/* scatter nx*ny*nz*nw block to strided array */ -static void -_t2(scatter_partial, Scalar, 4)(const Scalar* q, Scalar* p, uint nx, uint ny, uint nz, uint nw, int sx, int sy, int sz, int sw) -{ - uint x, y, z, w; - for (w = 0; w < nw; w++, p += sw - (ptrdiff_t)nz * sz, q += 16 * (4 - nz)) - for (z = 0; z < nz; z++, p += sz - (ptrdiff_t)ny * sy, q += 4 * (4 - ny)) - for (y = 0; y < ny; y++, p += sy - (ptrdiff_t)nx * sx, q += 1 * (4 - nx)) - for (x = 0; x < nx; x++, p += sx, q++) - *p = *q; -} - -/* inverse decorrelating 4D transform */ -static void -_t2(inv_xform, Int, 4)(Int* p) -{ - uint x, y, z, w; - /* transform along w */ - for (z = 0; z < 4; z++) - for (y = 0; y < 4; y++) - for (x = 0; x < 4; x++) - _t1(inv_lift, Int)(p + 1 * x + 4 * y + 16 * z, 64); - /* transform along z */ - for (y = 0; y < 4; y++) - for (x = 0; x < 4; x++) - for (w = 0; w < 4; w++) - _t1(inv_lift, Int)(p + 64 * w + 1 * x + 4 * y, 16); - /* transform along y */ - for (x = 0; x < 4; x++) - for (w = 0; w < 4; w++) - for (z = 0; z < 4; z++) - _t1(inv_lift, Int)(p + 16 * z + 64 * w + 1 * x, 4); - /* transform along x */ - for (w = 0; w < 4; w++) - for (z = 0; z < 4; z++) - for (y = 0; y < 4; y++) - _t1(inv_lift, Int)(p + 4 * y + 16 * z + 64 * w, 1); -} - -/* public functions -------------------------------------------------------- */ - -/* decode 4*4*4*4 floating-point block and store at p using strides (sx, sy, sz, sw) */ -uint -_t2(zfp_decode_block_strided, Scalar, 4)(zfp_stream* stream, Scalar* p, int sx, int sy, int sz, int sw) -{ - /* decode contiguous block */ - cache_align_(Scalar fblock[256]); - uint bits = _t2(zfp_decode_block, Scalar, 4)(stream, fblock); - /* scatter block to strided array */ - _t2(scatter, Scalar, 4)(fblock, p, sx, sy, sz, sw); - return bits; -} - -/* decode nx*ny*nz*nw floating-point block and store at p using strides (sx, sy, sz, sw) */ -uint -_t2(zfp_decode_partial_block_strided, Scalar, 4)(zfp_stream* stream, Scalar* p, uint nx, uint ny, uint nz, uint nw, int sx, int sy, int sz, int sw) -{ - /* decode contiguous block */ - cache_align_(Scalar fblock[256]); - uint bits = _t2(zfp_decode_block, Scalar, 4)(stream, fblock); - /* scatter block to strided array */ - _t2(scatter_partial, Scalar, 4)(fblock, p, nx, ny, nz, nw, sx, sy, sz, sw); - return bits; -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/decodef.c b/ThirdParty/zfp/vtkzfp/src/template/decodef.c deleted file mode 100644 index 5df156381c1b35033f2c93aaebe3992e4247cb8f..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/decodef.c +++ /dev/null @@ -1,42 +0,0 @@ -static uint _t2(rev_decode_block, Scalar, DIMS)(zfp_stream* zfp, Scalar* fblock); - -/* private functions ------------------------------------------------------- */ - -/* decode contiguous floating-point block using lossy algorithm */ -static uint -_t2(decode_block, Scalar, DIMS)(zfp_stream* zfp, Scalar* fblock) -{ - uint bits = 1; - /* test if block has nonzero values */ - if (stream_read_bit(zfp->stream)) { - cache_align_(Int iblock[BLOCK_SIZE]); - /* decode common exponent */ - bits += EBITS; - int emax = (int)stream_read_bits(zfp->stream, EBITS) - EBIAS; - int maxprec = precision(emax, zfp->maxprec, zfp->minexp, DIMS); - /* decode integer block */ - bits += _t2(decode_block, Int, DIMS)(zfp->stream, zfp->minbits - bits, zfp->maxbits - bits, maxprec, iblock); - /* perform inverse block-floating-point transform */ - _t1(inv_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax); - } - else { - /* set all values to zero */ - uint i; - for (i = 0; i < BLOCK_SIZE; i++) - *fblock++ = 0; - if (zfp->minbits > bits) { - stream_skip(zfp->stream, zfp->minbits - bits); - bits = zfp->minbits; - } - } - return bits; -} - -/* public functions -------------------------------------------------------- */ - -/* decode contiguous floating-point block */ -uint -_t2(zfp_decode_block, Scalar, DIMS)(zfp_stream* zfp, Scalar* fblock) -{ - return REVERSIBLE(zfp) ? _t2(rev_decode_block, Scalar, DIMS)(zfp, fblock) : _t2(decode_block, Scalar, DIMS)(zfp, fblock); -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/decodei.c b/ThirdParty/zfp/vtkzfp/src/template/decodei.c deleted file mode 100644 index 12f62a980f5cd18b9a3a4bd9fa1389b18b87e97c..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/decodei.c +++ /dev/null @@ -1,10 +0,0 @@ -static uint _t2(rev_decode_block, Int, DIMS)(bitstream* stream, int minbits, int maxbits, Int* iblock); - -/* public functions -------------------------------------------------------- */ - -/* decode contiguous integer block */ -uint -_t2(zfp_decode_block, Int, DIMS)(zfp_stream* zfp, Int* iblock) -{ - 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); -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/decompress.c b/ThirdParty/zfp/vtkzfp/src/template/decompress.c deleted file mode 100644 index 22313f81da3436554f6488874e3624dddc5163ee..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/decompress.c +++ /dev/null @@ -1,109 +0,0 @@ -/* decompress 1d contiguous array */ -static void -_t2(decompress, Scalar, 1)(zfp_stream* stream, zfp_field* field) -{ - Scalar* data = (Scalar*)field->data; - uint nx = field->nx; - uint mx = nx & ~3u; - uint x; - - /* decompress array one block of 4 values at a time */ - for (x = 0; x < mx; x += 4, data += 4) - _t2(zfp_decode_block, Scalar, 1)(stream, data); - if (x < nx) - _t2(zfp_decode_partial_block_strided, Scalar, 1)(stream, data, nx - x, 1); -} - -/* decompress 1d strided array */ -static void -_t2(decompress_strided, Scalar, 1)(zfp_stream* stream, zfp_field* field) -{ - Scalar* data = field->data; - uint nx = field->nx; - int sx = field->sx ? field->sx : 1; - uint x; - - /* decompress array one block of 4 values at a time */ - for (x = 0; x < nx; x += 4) { - Scalar* p = data + sx * (ptrdiff_t)x; - if (nx - x < 4) - _t2(zfp_decode_partial_block_strided, Scalar, 1)(stream, p, nx - x, sx); - else - _t2(zfp_decode_block_strided, Scalar, 1)(stream, p, sx); - } -} - -/* decompress 2d strided array */ -static void -_t2(decompress_strided, Scalar, 2)(zfp_stream* stream, zfp_field* field) -{ - Scalar* data = (Scalar*)field->data; - uint nx = field->nx; - uint ny = field->ny; - int sx = field->sx ? field->sx : 1; - int sy = field->sy ? field->sy : (int)nx; - uint x, y; - - /* decompress array one block of 4x4 values at a time */ - for (y = 0; y < ny; y += 4) - for (x = 0; x < nx; x += 4) { - Scalar* p = data + sx * (ptrdiff_t)x + sy * (ptrdiff_t)y; - if (nx - x < 4 || ny - y < 4) - _t2(zfp_decode_partial_block_strided, Scalar, 2)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), sx, sy); - else - _t2(zfp_decode_block_strided, Scalar, 2)(stream, p, sx, sy); - } -} - -/* decompress 3d strided array */ -static void -_t2(decompress_strided, Scalar, 3)(zfp_stream* stream, zfp_field* field) -{ - Scalar* data = (Scalar*)field->data; - uint nx = field->nx; - uint ny = field->ny; - uint nz = field->nz; - int sx = field->sx ? field->sx : 1; - int sy = field->sy ? field->sy : (int)nx; - int sz = field->sz ? field->sz : (int)(nx * ny); - uint x, y, z; - - /* decompress array one block of 4x4x4 values at a time */ - for (z = 0; z < nz; z += 4) - for (y = 0; y < ny; y += 4) - for (x = 0; x < nx; x += 4) { - Scalar* p = data + sx * (ptrdiff_t)x + sy * (ptrdiff_t)y + sz * (ptrdiff_t)z; - if (nx - x < 4 || ny - y < 4 || nz - z < 4) - _t2(zfp_decode_partial_block_strided, Scalar, 3)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), sx, sy, sz); - else - _t2(zfp_decode_block_strided, Scalar, 3)(stream, p, sx, sy, sz); - } -} - -/* decompress 4d strided array */ -static void -_t2(decompress_strided, Scalar, 4)(zfp_stream* stream, zfp_field* field) -{ - Scalar* data = field->data; - uint nx = field->nx; - uint ny = field->ny; - uint nz = field->nz; - uint nw = field->nw; - int sx = field->sx ? field->sx : 1; - int sy = field->sy ? field->sy : (int)nx; - int sz = field->sz ? field->sz : (int)(nx * ny); - int sw = field->sw ? field->sw : (int)(nx * ny * nz); - uint x, y, z, w; - - /* decompress array one block of 4x4x4x4 values at a time */ - for (w = 0; w < nw; w += 4) - for (z = 0; z < nz; z += 4) - for (y = 0; y < ny; y += 4) - for (x = 0; x < nx; x += 4) { - Scalar* p = data + sx * (ptrdiff_t)x + sy * (ptrdiff_t)y + sz * (ptrdiff_t)z + sw * (ptrdiff_t)w; - if (nx - x < 4 || ny - y < 4 || nz - z < 4 || nw - w < 4) - _t2(zfp_decode_partial_block_strided, Scalar, 4)(stream, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), MIN(nw - w, 4u), sx, sy, sz, sw); - else - _t2(zfp_decode_block_strided, Scalar, 4)(stream, p, sx, sy, sz, sw); - } -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/encode.c b/ThirdParty/zfp/vtkzfp/src/template/encode.c deleted file mode 100644 index bba18f60dc6b644ae0f48f3a6ca229af0150e30e..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/encode.c +++ /dev/null @@ -1,159 +0,0 @@ -#include <limits.h> - -static void _t2(fwd_xform, Int, DIMS)(Int* p); - -/* private functions ------------------------------------------------------- */ - -/* pad partial block of width n <= 4 and stride s */ -static void -_t1(pad_block, Scalar)(Scalar* p, uint n, uint s) -{ - switch (n) { - case 0: - p[0 * s] = 0; - /* FALLTHROUGH */ - case 1: - p[1 * s] = p[0 * s]; - /* FALLTHROUGH */ - case 2: - p[2 * s] = p[1 * s]; - /* FALLTHROUGH */ - case 3: - p[3 * s] = p[0 * s]; - /* FALLTHROUGH */ - default: - break; - } -} - -/* forward lifting transform of 4-vector */ -static void -_t1(fwd_lift, Int)(Int* p, uint s) -{ - Int x, y, z, w; - x = *p; p += s; - y = *p; p += s; - z = *p; p += s; - w = *p; p += s; - - /* - ** non-orthogonal transform - ** ( 4 4 4 4) (x) - ** 1/16 * ( 5 1 -1 -5) (y) - ** (-4 4 4 -4) (z) - ** (-2 6 -6 2) (w) - */ - x += w; x >>= 1; w -= x; - z += y; z >>= 1; y -= z; - x += z; x >>= 1; z -= x; - w += y; w >>= 1; y -= w; - w += y >> 1; y -= w >> 1; - - p -= s; *p = w; - p -= s; *p = z; - p -= s; *p = y; - p -= s; *p = x; -} - -/* map two's complement signed integer to negabinary unsigned integer */ -static UInt -_t1(int2uint, Int)(Int x) -{ - return ((UInt)x + NBMASK) ^ NBMASK; -} - -/* reorder signed coefficients and convert to unsigned integer */ -static void -_t1(fwd_order, Int)(UInt* ublock, const Int* iblock, const uchar* perm, uint n) -{ - do - *ublock++ = _t1(int2uint, Int)(iblock[*perm++]); - while (--n); -} - -/* compress sequence of size unsigned integers */ -static uint -_t1(encode_ints, UInt)(bitstream* restrict_ stream, uint maxbits, uint maxprec, const UInt* restrict_ data, uint size) -{ - /* make a copy of bit stream to avoid aliasing */ - bitstream s = *stream; - uint intprec = CHAR_BIT * (uint)sizeof(UInt); - uint kmin = intprec > maxprec ? intprec - maxprec : 0; - uint bits = maxbits; - uint i, k, m, n; - uint64 x; - - /* encode one bit plane at a time from MSB to LSB */ - for (k = intprec, n = 0; bits && k-- > kmin;) { - /* step 1: extract bit plane #k to x */ - x = 0; - for (i = 0; i < size; i++) - x += (uint64)((data[i] >> k) & 1u) << i; - /* step 2: encode first n bits of bit plane */ - m = MIN(n, bits); - bits -= m; - x = stream_write_bits(&s, x, m); - /* step 3: unary run-length encode remainder of bit plane */ - for (; n < size && bits && (bits--, stream_write_bit(&s, !!x)); x >>= 1, n++) - for (; n < size - 1 && bits && (bits--, !stream_write_bit(&s, x & 1u)); x >>= 1, n++) - ; - } - - *stream = s; - return maxbits - bits; -} - -/* compress sequence of size > 64 unsigned integers */ -static uint -_t1(encode_many_ints, UInt)(bitstream* restrict_ stream, uint maxbits, uint maxprec, const UInt* restrict_ data, uint size) -{ - /* make a copy of bit stream to avoid aliasing */ - bitstream s = *stream; - uint intprec = CHAR_BIT * (uint)sizeof(UInt); - uint kmin = intprec > maxprec ? intprec - maxprec : 0; - uint bits = maxbits; - uint i, k, m, n, c; - - /* encode one bit plane at a time from MSB to LSB */ - for (k = intprec, n = 0; bits && k-- > kmin;) { - /* step 1: encode first n bits of bit plane #k */ - m = MIN(n, bits); - bits -= m; - for (i = 0; i < m; i++) - stream_write_bit(&s, (data[i] >> k) & 1u); - /* step 2: count remaining one-bits in bit plane */ - c = 0; - for (i = m; i < size; i++) - c += (data[i] >> k) & 1u; - /* step 3: unary run-length encode remainder of bit plane */ - for (; n < size && bits && (--bits, stream_write_bit(&s, !!c)); c--, n++) - for (; n < size - 1 && bits && (--bits, !stream_write_bit(&s, (data[n] >> k) & 1u)); n++) - ; - } - - *stream = s; - return maxbits - bits; -} - -/* encode block of integers */ -static uint -_t2(encode_block, Int, DIMS)(bitstream* stream, int minbits, int maxbits, int maxprec, Int* iblock) -{ - int bits; - cache_align_(UInt ublock[BLOCK_SIZE]); - /* perform decorrelating transform */ - _t2(fwd_xform, Int, DIMS)(iblock); - /* reorder signed coefficients and convert to unsigned integer */ - _t1(fwd_order, Int)(ublock, iblock, PERM, BLOCK_SIZE); - /* encode integer coefficients */ - if (BLOCK_SIZE <= 64) - bits = _t1(encode_ints, UInt)(stream, maxbits, maxprec, ublock, BLOCK_SIZE); - else - bits = _t1(encode_many_ints, UInt)(stream, maxbits, maxprec, ublock, BLOCK_SIZE); - /* write at least minbits bits by padding with zeros */ - if (bits < minbits) { - stream_pad(stream, minbits - bits); - bits = minbits; - } - return bits; -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/encode1.c b/ThirdParty/zfp/vtkzfp/src/template/encode1.c deleted file mode 100644 index c61849299a4ffbcde0c99ee7b5c90546cfcc3c9c..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/encode1.c +++ /dev/null @@ -1,52 +0,0 @@ -/* private functions ------------------------------------------------------- */ - -/* gather 4-value block from strided array */ -static void -_t2(gather, Scalar, 1)(Scalar* q, const Scalar* p, int sx) -{ - uint x; - for (x = 0; x < 4; x++, p += sx) - *q++ = *p; -} - -/* gather nx-value block from strided array */ -static void -_t2(gather_partial, Scalar, 1)(Scalar* q, const Scalar* p, uint nx, int sx) -{ - uint x; - for (x = 0; x < nx; x++, p += sx) - q[x] = *p; - _t1(pad_block, Scalar)(q, nx, 1); -} - -/* forward decorrelating 1D transform */ -static void -_t2(fwd_xform, Int, 1)(Int* p) -{ - /* transform along x */ - _t1(fwd_lift, Int)(p, 1); -} - -/* public functions -------------------------------------------------------- */ - -/* encode 4-value floating-point block stored at p using stride sx */ -uint -_t2(zfp_encode_block_strided, Scalar, 1)(zfp_stream* stream, const Scalar* p, int sx) -{ - /* gather block from strided array */ - cache_align_(Scalar fblock[4]); - _t2(gather, Scalar, 1)(fblock, p, sx); - /* encode floating-point block */ - return _t2(zfp_encode_block, Scalar, 1)(stream, fblock); -} - -/* encode nx-value floating-point block stored at p using stride sx */ -uint -_t2(zfp_encode_partial_block_strided, Scalar, 1)(zfp_stream* stream, const Scalar* p, uint nx, int sx) -{ - /* gather block from strided array */ - cache_align_(Scalar fblock[4]); - _t2(gather_partial, Scalar, 1)(fblock, p, nx, sx); - /* encode floating-point block */ - return _t2(zfp_encode_block, Scalar, 1)(stream, fblock); -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/encode2.c b/ThirdParty/zfp/vtkzfp/src/template/encode2.c deleted file mode 100644 index 4bec256a630c54e700c43e909bd6e479dbf5baf4..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/encode2.c +++ /dev/null @@ -1,62 +0,0 @@ -/* private functions ------------------------------------------------------- */ - -/* gather 4*4 block from strided array */ -static void -_t2(gather, Scalar, 2)(Scalar* q, const Scalar* p, int sx, int sy) -{ - uint x, y; - for (y = 0; y < 4; y++, p += sy - 4 * sx) - for (x = 0; x < 4; x++, p += sx) - *q++ = *p; -} - -/* gather nx*ny block from strided array */ -static void -_t2(gather_partial, Scalar, 2)(Scalar* q, const Scalar* p, uint nx, uint ny, int sx, int sy) -{ - uint x, y; - for (y = 0; y < ny; y++, p += sy - (ptrdiff_t)nx * sx) { - for (x = 0; x < nx; x++, p += sx) - q[4 * y + x] = *p; - _t1(pad_block, Scalar)(q + 4 * y, nx, 1); - } - for (x = 0; x < 4; x++) - _t1(pad_block, Scalar)(q + x, ny, 4); -} - -/* forward decorrelating 2D transform */ -static void -_t2(fwd_xform, Int, 2)(Int* p) -{ - uint x, y; - /* transform along x */ - for (y = 0; y < 4; y++) - _t1(fwd_lift, Int)(p + 4 * y, 1); - /* transform along y */ - for (x = 0; x < 4; x++) - _t1(fwd_lift, Int)(p + 1 * x, 4); -} - -/* public functions -------------------------------------------------------- */ - -/* encode 4*4 floating-point block stored at p using strides (sx, sy) */ -uint -_t2(zfp_encode_block_strided, Scalar, 2)(zfp_stream* stream, const Scalar* p, int sx, int sy) -{ - /* gather block from strided array */ - cache_align_(Scalar fblock[16]); - _t2(gather, Scalar, 2)(fblock, p, sx, sy); - /* encode floating-point block */ - return _t2(zfp_encode_block, Scalar, 2)(stream, fblock); -} - -/* encode nx*ny floating-point block stored at p using strides (sx, sy) */ -uint -_t2(zfp_encode_partial_block_strided, Scalar, 2)(zfp_stream* stream, const Scalar* p, uint nx, uint ny, int sx, int sy) -{ - /* gather block from strided array */ - cache_align_(Scalar fblock[16]); - _t2(gather_partial, Scalar, 2)(fblock, p, nx, ny, sx, sy); - /* encode floating-point block */ - return _t2(zfp_encode_block, Scalar, 2)(stream, fblock); -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/encode3.c b/ThirdParty/zfp/vtkzfp/src/template/encode3.c deleted file mode 100644 index a16a8add97dd5f3ecd3036982f384f68d9b4dfb3..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/encode3.c +++ /dev/null @@ -1,74 +0,0 @@ -/* private functions ------------------------------------------------------- */ - -/* gather 4*4*4 block from strided array */ -static void -_t2(gather, Scalar, 3)(Scalar* q, const Scalar* p, int sx, int sy, int sz) -{ - uint x, y, z; - for (z = 0; z < 4; z++, p += sz - 4 * sy) - for (y = 0; y < 4; y++, p += sy - 4 * sx) - for (x = 0; x < 4; x++, p += sx) - *q++ = *p; -} - -/* gather nx*ny*nz block from strided array */ -static void -_t2(gather_partial, Scalar, 3)(Scalar* q, const Scalar* p, uint nx, uint ny, uint nz, int sx, int sy, int sz) -{ - uint x, y, z; - for (z = 0; z < nz; z++, p += sz - (ptrdiff_t)ny * sy) { - for (y = 0; y < ny; y++, p += sy - (ptrdiff_t)nx * sx) { - for (x = 0; x < nx; x++, p += sx) - q[16 * z + 4 * y + x] = *p; - _t1(pad_block, Scalar)(q + 16 * z + 4 * y, nx, 1); - } - for (x = 0; x < 4; x++) - _t1(pad_block, Scalar)(q + 16 * z + x, ny, 4); - } - for (y = 0; y < 4; y++) - for (x = 0; x < 4; x++) - _t1(pad_block, Scalar)(q + 4 * y + x, nz, 16); -} - -/* forward decorrelating 3D transform */ -static void -_t2(fwd_xform, Int, 3)(Int* p) -{ - uint x, y, z; - /* transform along x */ - for (z = 0; z < 4; z++) - for (y = 0; y < 4; y++) - _t1(fwd_lift, Int)(p + 4 * y + 16 * z, 1); - /* transform along y */ - for (x = 0; x < 4; x++) - for (z = 0; z < 4; z++) - _t1(fwd_lift, Int)(p + 16 * z + 1 * x, 4); - /* transform along z */ - for (y = 0; y < 4; y++) - for (x = 0; x < 4; x++) - _t1(fwd_lift, Int)(p + 1 * x + 4 * y, 16); -} - -/* public functions -------------------------------------------------------- */ - -/* encode 4*4*4 floating-point block stored at p using strides (sx, sy, sz) */ -uint -_t2(zfp_encode_block_strided, Scalar, 3)(zfp_stream* stream, const Scalar* p, int sx, int sy, int sz) -{ - /* gather block from strided array */ - cache_align_(Scalar fblock[64]); - _t2(gather, Scalar, 3)(fblock, p, sx, sy, sz); - /* encode floating-point block */ - return _t2(zfp_encode_block, Scalar, 3)(stream, fblock); -} - -/* encode nx*ny*nz floating-point block stored at p using strides (sx, sy, sz) */ -uint -_t2(zfp_encode_partial_block_strided, Scalar, 3)(zfp_stream* stream, const Scalar* p, uint nx, uint ny, uint nz, int sx, int sy, int sz) -{ - /* gather block from strided array */ - cache_align_(Scalar fblock[64]); - _t2(gather_partial, Scalar, 3)(fblock, p, nx, ny, nz, sx, sy, sz); - /* encode floating-point block */ - return _t2(zfp_encode_block, Scalar, 3)(stream, fblock); -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/encode4.c b/ThirdParty/zfp/vtkzfp/src/template/encode4.c deleted file mode 100644 index c9ed5425a3b1a8b3cdfd13676904983bebb55427..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/encode4.c +++ /dev/null @@ -1,89 +0,0 @@ -/* private functions ------------------------------------------------------- */ - -/* gather 4*4*4*4 block from strided array */ -static void -_t2(gather, Scalar, 4)(Scalar* q, const Scalar* p, int sx, int sy, int sz, int sw) -{ - uint x, y, z, w; - for (w = 0; w < 4; w++, p += sw - 4 * sz) - for (z = 0; z < 4; z++, p += sz - 4 * sy) - for (y = 0; y < 4; y++, p += sy - 4 * sx) - for (x = 0; x < 4; x++, p += sx) - *q++ = *p; -} - -/* gather nx*ny*nz*nw block from strided array */ -static void -_t2(gather_partial, Scalar, 4)(Scalar* q, const Scalar* p, uint nx, uint ny, uint nz, uint nw, int sx, int sy, int sz, int sw) -{ - uint x, y, z, w; - for (w = 0; w < nw; w++, p += sw - (ptrdiff_t)nz * sz) { - for (z = 0; z < nz; z++, p += sz - (ptrdiff_t)ny * sy) { - for (y = 0; y < ny; y++, p += sy - (ptrdiff_t)nx * sx) { - for (x = 0; x < nx; x++, p += sx) - q[64 * w + 16 * z + 4 * y + x] = *p; - _t1(pad_block, Scalar)(q + 64 * w + 16 * z + 4 * y, nx, 1); - } - for (x = 0; x < 4; x++) - _t1(pad_block, Scalar)(q + 64 * w + 16 * z + x, ny, 4); - } - for (y = 0; y < 4; y++) - for (x = 0; x < 4; x++) - _t1(pad_block, Scalar)(q + 64 * w + 4 * y + x, nz, 16); - } - for (z = 0; z < 4; z++) - for (y = 0; y < 4; y++) - for (x = 0; x < 4; x++) - _t1(pad_block, Scalar)(q + 16 * z + 4 * y + x, nw, 64); -} - -/* forward decorrelating 4D transform */ -static void -_t2(fwd_xform, Int, 4)(Int* p) -{ - uint x, y, z, w; - /* transform along x */ - for (w = 0; w < 4; w++) - for (z = 0; z < 4; z++) - for (y = 0; y < 4; y++) - _t1(fwd_lift, Int)(p + 4 * y + 16 * z + 64 * w, 1); - /* transform along y */ - for (x = 0; x < 4; x++) - for (w = 0; w < 4; w++) - for (z = 0; z < 4; z++) - _t1(fwd_lift, Int)(p + 16 * z + 64 * w + 1 * x, 4); - /* transform along z */ - for (y = 0; y < 4; y++) - for (x = 0; x < 4; x++) - for (w = 0; w < 4; w++) - _t1(fwd_lift, Int)(p + 64 * w + 1 * x + 4 * y, 16); - /* transform along w */ - for (z = 0; z < 4; z++) - for (y = 0; y < 4; y++) - for (x = 0; x < 4; x++) - _t1(fwd_lift, Int)(p + 1 * x + 4 * y + 16 * z, 64); -} - -/* public functions -------------------------------------------------------- */ - -/* encode 4*4*4*4 floating-point block stored at p using strides (sx, sy, sz, sw) */ -uint -_t2(zfp_encode_block_strided, Scalar, 4)(zfp_stream* stream, const Scalar* p, int sx, int sy, int sz, int sw) -{ - /* gather block from strided array */ - cache_align_(Scalar fblock[256]); - _t2(gather, Scalar, 4)(fblock, p, sx, sy, sz, sw); - /* encode floating-point block */ - return _t2(zfp_encode_block, Scalar, 4)(stream, fblock); -} - -/* encode nx*ny*nz*nw floating-point block stored at p using strides (sx, sy, sz, sw) */ -uint -_t2(zfp_encode_partial_block_strided, Scalar, 4)(zfp_stream* stream, const Scalar* p, uint nx, uint ny, uint nz, uint nw, int sx, int sy, int sz, int sw) -{ - /* gather block from strided array */ - cache_align_(Scalar fblock[256]); - _t2(gather_partial, Scalar, 4)(fblock, p, nx, ny, nz, nw, sx, sy, sz, sw); - /* encode floating-point block */ - return _t2(zfp_encode_block, Scalar, 4)(stream, fblock); -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/encodef.c b/ThirdParty/zfp/vtkzfp/src/template/encodef.c deleted file mode 100644 index 5c6ec537d9ca3429f05a9fe2bd42ee2bf7916484..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/encodef.c +++ /dev/null @@ -1,91 +0,0 @@ -#include <limits.h> -#include <math.h> - -static uint _t2(rev_encode_block, Scalar, DIMS)(zfp_stream* zfp, const Scalar* fblock); - -/* private functions ------------------------------------------------------- */ - -/* return normalized floating-point exponent for x >= 0 */ -static int -_t1(exponent, Scalar)(Scalar x) -{ - if (x > 0) { - int e; - FREXP(x, &e); - /* clamp exponent in case x is denormal */ - return MAX(e, 1 - EBIAS); - } - return -EBIAS; -} - -/* compute maximum floating-point exponent in block of n values */ -static int -_t1(exponent_block, Scalar)(const Scalar* p, uint n) -{ - Scalar max = 0; - do { - Scalar f = FABS(*p++); - if (max < f) - max = f; - } while (--n); - return _t1(exponent, Scalar)(max); -} - -/* map floating-point number x to integer relative to exponent e */ -static Scalar -_t1(quantize, Scalar)(Scalar x, int e) -{ - return LDEXP(x, (CHAR_BIT * (int)sizeof(Scalar) - 2) - e); -} - -/* forward block-floating-point transform to signed integers */ -static void -_t1(fwd_cast, Scalar)(Int* iblock, const Scalar* fblock, uint n, int emax) -{ - /* compute power-of-two scale factor s */ - Scalar s = _t1(quantize, Scalar)(1, emax); - /* compute p-bit int y = s*x where x is floating and |y| <= 2^(p-2) - 1 */ - do - *iblock++ = (Int)(s * *fblock++); - while (--n); -} - -/* encode contiguous floating-point block using lossy algorithm */ -static uint -_t2(encode_block, Scalar, DIMS)(zfp_stream* zfp, const Scalar* fblock) -{ - uint bits = 1; - /* compute maximum exponent */ - int emax = _t1(exponent_block, Scalar)(fblock, BLOCK_SIZE); - int maxprec = precision(emax, zfp->maxprec, zfp->minexp, DIMS); - uint e = maxprec ? emax + EBIAS : 0; - /* encode block only if biased exponent is nonzero */ - if (e) { - cache_align_(Int iblock[BLOCK_SIZE]); - /* encode common exponent; LSB indicates that exponent is nonzero */ - bits += EBITS; - stream_write_bits(zfp->stream, 2 * e + 1, bits); - /* perform forward block-floating-point transform */ - _t1(fwd_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax); - /* encode integer block */ - bits += _t2(encode_block, Int, DIMS)(zfp->stream, zfp->minbits - bits, zfp->maxbits - bits, maxprec, iblock); - } - else { - /* write single zero-bit to indicate that all values are zero */ - stream_write_bit(zfp->stream, 0); - if (zfp->minbits > bits) { - stream_pad(zfp->stream, zfp->minbits - bits); - bits = zfp->minbits; - } - } - return bits; -} - -/* public functions -------------------------------------------------------- */ - -/* encode contiguous floating-point block */ -uint -_t2(zfp_encode_block, Scalar, DIMS)(zfp_stream* zfp, const Scalar* fblock) -{ - return REVERSIBLE(zfp) ? _t2(rev_encode_block, Scalar, DIMS)(zfp, fblock) : _t2(encode_block, Scalar, DIMS)(zfp, fblock); -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/encodei.c b/ThirdParty/zfp/vtkzfp/src/template/encodei.c deleted file mode 100644 index 41d5fbd654e503f83c05e2f6612eb04658ad5d56..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/encodei.c +++ /dev/null @@ -1,15 +0,0 @@ -static uint _t2(rev_encode_block, Int, DIMS)(bitstream* stream, int minbits, int maxbits, int maxprec, Int* iblock); - -/* public functions -------------------------------------------------------- */ - -/* encode contiguous integer block */ -uint -_t2(zfp_encode_block, Int, DIMS)(zfp_stream* zfp, const Int* iblock) -{ - cache_align_(Int block[BLOCK_SIZE]); - uint i; - /* copy block */ - for (i = 0; i < BLOCK_SIZE; i++) - block[i] = iblock[i]; - 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); -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/ompcompress.c b/ThirdParty/zfp/vtkzfp/src/template/ompcompress.c deleted file mode 100644 index b0f86d230458a3aed2415358617551808cb538e5..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/ompcompress.c +++ /dev/null @@ -1,275 +0,0 @@ -#ifdef _OPENMP - -/* compress 1d contiguous array in parallel */ -static void -_t2(compress_omp, Scalar, 1)(zfp_stream* stream, const zfp_field* field) -{ - /* array metadata */ - const Scalar* data = (const Scalar*)field->data; - uint nx = field->nx; - - /* number of omp threads, blocks, and chunks */ - uint threads = thread_count_omp(stream); - uint blocks = (nx + 3) / 4; - uint chunks = chunk_count_omp(stream, blocks, threads); - - /* allocate per-thread streams */ - bitstream** bs = compress_init_par(stream, field, chunks, blocks); - if (!bs) - return; - - /* compress chunks of blocks in parallel */ - int chunk; - #pragma omp parallel for num_threads(threads) - for (chunk = 0; chunk < (int)chunks; chunk++) { - /* determine range of block indices assigned to this thread */ - uint bmin = chunk_offset(blocks, chunks, chunk + 0); - uint bmax = chunk_offset(blocks, chunks, chunk + 1); - uint block; - /* set up thread-local bit stream */ - zfp_stream s = *stream; - zfp_stream_set_bit_stream(&s, bs[chunk]); - /* compress sequence of blocks */ - for (block = bmin; block < bmax; block++) { - /* determine block origin x within array */ - const Scalar* p = data; - uint x = 4 * block; - p += x; - /* compress partial or full block */ - if (nx - x < 4) - _t2(zfp_encode_partial_block_strided, Scalar, 1)(&s, p, MIN(nx - x, 4u), 1); - else - _t2(zfp_encode_block, Scalar, 1)(&s, p); - } - } - - /* concatenate per-thread streams */ - compress_finish_par(stream, bs, chunks); -} - -/* compress 1d strided array in parallel */ -static void -_t2(compress_strided_omp, Scalar, 1)(zfp_stream* stream, const zfp_field* field) -{ - /* array metadata */ - const Scalar* data = (const Scalar*)field->data; - uint nx = field->nx; - int sx = field->sx ? field->sx : 1; - - /* number of omp threads, blocks, and chunks */ - uint threads = thread_count_omp(stream); - uint blocks = (nx + 3) / 4; - uint chunks = chunk_count_omp(stream, blocks, threads); - - /* allocate per-thread streams */ - bitstream** bs = compress_init_par(stream, field, chunks, blocks); - if (!bs) - return; - - /* compress chunks of blocks in parallel */ - int chunk; - #pragma omp parallel for num_threads(threads) - for (chunk = 0; chunk < (int)chunks; chunk++) { - /* determine range of block indices assigned to this thread */ - uint bmin = chunk_offset(blocks, chunks, chunk + 0); - uint bmax = chunk_offset(blocks, chunks, chunk + 1); - uint block; - /* set up thread-local bit stream */ - zfp_stream s = *stream; - zfp_stream_set_bit_stream(&s, bs[chunk]); - /* compress sequence of blocks */ - for (block = bmin; block < bmax; block++) { - /* determine block origin x within array */ - const Scalar* p = data; - uint x = 4 * block; - p += sx * (ptrdiff_t)x; - /* compress partial or full block */ - if (nx - x < 4) - _t2(zfp_encode_partial_block_strided, Scalar, 1)(&s, p, MIN(nx - x, 4u), sx); - else - _t2(zfp_encode_block_strided, Scalar, 1)(&s, p, sx); - } - } - - /* concatenate per-thread streams */ - compress_finish_par(stream, bs, chunks); -} - -/* compress 2d strided array in parallel */ -static void -_t2(compress_strided_omp, Scalar, 2)(zfp_stream* stream, const zfp_field* field) -{ - /* array metadata */ - const Scalar* data = (const Scalar*)field->data; - uint nx = field->nx; - uint ny = field->ny; - int sx = field->sx ? field->sx : 1; - int sy = field->sy ? field->sy : (int)nx; - - /* number of omp threads, blocks, and chunks */ - uint threads = thread_count_omp(stream); - uint bx = (nx + 3) / 4; - uint by = (ny + 3) / 4; - uint blocks = bx * by; - uint chunks = chunk_count_omp(stream, blocks, threads); - - /* allocate per-thread streams */ - bitstream** bs = compress_init_par(stream, field, chunks, blocks); - if (!bs) - return; - - /* compress chunks of blocks in parallel */ - int chunk; - #pragma omp parallel for num_threads(threads) - for (chunk = 0; chunk < (int)chunks; chunk++) { - /* determine range of block indices assigned to this thread */ - uint bmin = chunk_offset(blocks, chunks, chunk + 0); - uint bmax = chunk_offset(blocks, chunks, chunk + 1); - uint block; - /* set up thread-local bit stream */ - zfp_stream s = *stream; - zfp_stream_set_bit_stream(&s, bs[chunk]); - /* compress sequence of blocks */ - for (block = bmin; block < bmax; block++) { - /* determine block origin (x, y) within array */ - const Scalar* p = data; - uint b = block; - uint x, y; - x = 4 * (b % bx); b /= bx; - y = 4 * b; - p += sx * (ptrdiff_t)x + sy * (ptrdiff_t)y; - /* compress partial or full block */ - if (nx - x < 4 || ny - y < 4) - _t2(zfp_encode_partial_block_strided, Scalar, 2)(&s, p, MIN(nx - x, 4u), MIN(ny - y, 4u), sx, sy); - else - _t2(zfp_encode_block_strided, Scalar, 2)(&s, p, sx, sy); - } - } - - /* concatenate per-thread streams */ - compress_finish_par(stream, bs, chunks); -} - -/* compress 3d strided array in parallel */ -static void -_t2(compress_strided_omp, Scalar, 3)(zfp_stream* stream, const zfp_field* field) -{ - /* array metadata */ - const Scalar* data = (const Scalar*)field->data; - uint nx = field->nx; - uint ny = field->ny; - uint nz = field->nz; - int sx = field->sx ? field->sx : 1; - int sy = field->sy ? field->sy : (int)nx; - int sz = field->sz ? field->sz : (int)(nx * ny); - - /* number of omp threads, blocks, and chunks */ - uint threads = thread_count_omp(stream); - uint bx = (nx + 3) / 4; - uint by = (ny + 3) / 4; - uint bz = (nz + 3) / 4; - uint blocks = bx * by * bz; - uint chunks = chunk_count_omp(stream, blocks, threads); - - /* allocate per-thread streams */ - bitstream** bs = compress_init_par(stream, field, chunks, blocks); - if (!bs) - return; - - /* compress chunks of blocks in parallel */ - int chunk; - #pragma omp parallel for num_threads(threads) - for (chunk = 0; chunk < (int)chunks; chunk++) { - /* determine range of block indices assigned to this thread */ - uint bmin = chunk_offset(blocks, chunks, chunk + 0); - uint bmax = chunk_offset(blocks, chunks, chunk + 1); - uint block; - /* set up thread-local bit stream */ - zfp_stream s = *stream; - zfp_stream_set_bit_stream(&s, bs[chunk]); - /* compress sequence of blocks */ - for (block = bmin; block < bmax; block++) { - /* determine block origin (x, y, z) within array */ - const Scalar* p = data; - uint b = block; - uint x, y, z; - x = 4 * (b % bx); b /= bx; - y = 4 * (b % by); b /= by; - z = 4 * b; - p += sx * (ptrdiff_t)x + sy * (ptrdiff_t)y + sz * (ptrdiff_t)z; - /* compress partial or full block */ - if (nx - x < 4 || ny - y < 4 || nz - z < 4) - _t2(zfp_encode_partial_block_strided, Scalar, 3)(&s, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), sx, sy, sz); - else - _t2(zfp_encode_block_strided, Scalar, 3)(&s, p, sx, sy, sz); - } - } - - /* concatenate per-thread streams */ - compress_finish_par(stream, bs, chunks); -} - -/* compress 4d strided array in parallel */ -static void -_t2(compress_strided_omp, Scalar, 4)(zfp_stream* stream, const zfp_field* field) -{ - /* array metadata */ - const Scalar* data = field->data; - uint nx = field->nx; - uint ny = field->ny; - uint nz = field->nz; - uint nw = field->nw; - int sx = field->sx ? field->sx : 1; - int sy = field->sy ? field->sy : (int)nx; - int sz = field->sz ? field->sz : (int)(nx * ny); - int sw = field->sw ? field->sw : (int)(nx * ny * nz); - - /* number of omp threads, blocks, and chunks */ - uint threads = thread_count_omp(stream); - uint bx = (nx + 3) / 4; - uint by = (ny + 3) / 4; - uint bz = (nz + 3) / 4; - uint bw = (nw + 3) / 4; - uint blocks = bx * by * bz * bw; - uint chunks = chunk_count_omp(stream, blocks, threads); - - /* allocate per-thread streams */ - bitstream** bs = compress_init_par(stream, field, chunks, blocks); - if (!bs) - return; - - /* compress chunks of blocks in parallel */ - int chunk; - #pragma omp parallel for num_threads(threads) - for (chunk = 0; chunk < (int)chunks; chunk++) { - /* determine range of block indices assigned to this thread */ - uint bmin = chunk_offset(blocks, chunks, chunk + 0); - uint bmax = chunk_offset(blocks, chunks, chunk + 1); - uint block; - /* set up thread-local bit stream */ - zfp_stream s = *stream; - zfp_stream_set_bit_stream(&s, bs[chunk]); - /* compress sequence of blocks */ - for (block = bmin; block < bmax; block++) { - /* determine block origin (x, y, z, w) within array */ - const Scalar* p = data; - uint b = block; - uint x, y, z, w; - x = 4 * (b % bx); b /= bx; - y = 4 * (b % by); b /= by; - z = 4 * (b % bz); b /= bz; - w = 4 * b; - p += sx * (ptrdiff_t)x + sy * (ptrdiff_t)y + sz * (ptrdiff_t)z + sw * (ptrdiff_t)w; - /* compress partial or full block */ - if (nx - x < 4 || ny - y < 4 || nz - z < 4 || nw - w < 4) - _t2(zfp_encode_partial_block_strided, Scalar, 4)(&s, p, MIN(nx - x, 4u), MIN(ny - y, 4u), MIN(nz - z, 4u), MIN(nw - w, 4u), sx, sy, sz, sw); - else - _t2(zfp_encode_block_strided, Scalar, 4)(&s, p, sx, sy, sz, sw); - } - } - - /* concatenate per-thread streams */ - compress_finish_par(stream, bs, chunks); -} - -#endif diff --git a/ThirdParty/zfp/vtkzfp/src/template/revcodecf.c b/ThirdParty/zfp/vtkzfp/src/template/revcodecf.c deleted file mode 100644 index ad5f788643ec0247955ddb0f7903908fd0eb0586..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/revcodecf.c +++ /dev/null @@ -1,11 +0,0 @@ -/* inverse block-floating-point transform from signed integers */ -static void -_t1(rev_inv_cast, Scalar)(const Int* iblock, Scalar* fblock, uint n, int emax) -{ - /* test for all-zero block, which needs special treatment */ - if (emax != -EBIAS) - _t1(inv_cast, Scalar)(iblock, fblock, n, emax); - else - while (n--) - *fblock++ = 0; -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/revdecode.c b/ThirdParty/zfp/vtkzfp/src/template/revdecode.c deleted file mode 100644 index cde9877f6473a7ac6a6dad263e09692f8979c3fc..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/revdecode.c +++ /dev/null @@ -1,55 +0,0 @@ -static void _t2(rev_inv_xform, Int, DIMS)(Int* p); - -/* private functions ------------------------------------------------------- */ - -/* reversible inverse lifting transform of 4-vector */ -static void -_t1(rev_inv_lift, Int)(Int* p, uint s) -{ - Int x, y, z, w; - x = *p; p += s; - y = *p; p += s; - z = *p; p += s; - w = *p; p += s; - - /* - ** high-order Lorenzo transform (P4 Pascal matrix) - ** ( 1 0 0 0) (x) - ** ( 1 1 0 0) (y) - ** ( 1 2 1 0) (z) - ** ( 1 3 3 1) (w) - */ - w += z; - z += y; w += z; - y += x; z += y; w += z; - - p -= s; *p = w; - p -= s; *p = z; - p -= s; *p = y; - p -= s; *p = x; -} - -/* decode block of integers using reversible algorithm */ -static uint -_t2(rev_decode_block, Int, DIMS)(bitstream* stream, int minbits, int maxbits, Int* iblock) -{ - /* decode number of significant bits */ - int bits = PBITS; - int prec = (int)stream_read_bits(stream, PBITS) + 1; - cache_align_(UInt ublock[BLOCK_SIZE]); - /* decode integer coefficients */ - if (BLOCK_SIZE <= 64) - bits += _t1(decode_ints, UInt)(stream, maxbits - bits, prec, ublock, BLOCK_SIZE); - else - bits += _t1(decode_many_ints, UInt)(stream, maxbits - bits, prec, ublock, BLOCK_SIZE); - /* read at least minbits bits */ - if (bits < minbits) { - stream_skip(stream, minbits - bits); - bits = minbits; - } - /* reorder unsigned coefficients and convert to signed integer */ - _t1(inv_order, Int)(ublock, iblock, PERM, BLOCK_SIZE); - /* perform decorrelating transform */ - _t2(rev_inv_xform, Int, DIMS)(iblock); - return bits; -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/revdecode1.c b/ThirdParty/zfp/vtkzfp/src/template/revdecode1.c deleted file mode 100644 index 018a10151ce78911f88c4b493cc871188d9da48d..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/revdecode1.c +++ /dev/null @@ -1,9 +0,0 @@ -/* private functions ------------------------------------------------------- */ - -/* reversible inverse decorrelating 1D transform */ -static void -_t2(rev_inv_xform, Int, 1)(Int* p) -{ - /* transform along x */ - _t1(rev_inv_lift, Int)(p, 1); -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/revdecode2.c b/ThirdParty/zfp/vtkzfp/src/template/revdecode2.c deleted file mode 100644 index 9cb8669c7d24ace72f04dcad96b6e9aefed81a3d..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/revdecode2.c +++ /dev/null @@ -1,14 +0,0 @@ -/* private functions ------------------------------------------------------- */ - -/* reversible inverse decorrelating 2D transform */ -static void -_t2(rev_inv_xform, Int, 2)(Int* p) -{ - uint x, y; - /* transform along y */ - for (x = 0; x < 4; x++) - _t1(rev_inv_lift, Int)(p + 1 * x, 4); - /* transform along x */ - for (y = 0; y < 4; y++) - _t1(rev_inv_lift, Int)(p + 4 * y, 1); -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/revdecode3.c b/ThirdParty/zfp/vtkzfp/src/template/revdecode3.c deleted file mode 100644 index 12194437142ce2cfcaa153374a53a072f5c958f7..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/revdecode3.c +++ /dev/null @@ -1,20 +0,0 @@ -/* private functions ------------------------------------------------------- */ - -/* reversible inverse decorrelating 3D transform */ -static void -_t2(rev_inv_xform, Int, 3)(Int* p) -{ - uint x, y, z; - /* transform along z */ - for (y = 0; y < 4; y++) - for (x = 0; x < 4; x++) - _t1(rev_inv_lift, Int)(p + 1 * x + 4 * y, 16); - /* transform along y */ - for (x = 0; x < 4; x++) - for (z = 0; z < 4; z++) - _t1(rev_inv_lift, Int)(p + 16 * z + 1 * x, 4); - /* transform along x */ - for (z = 0; z < 4; z++) - for (y = 0; y < 4; y++) - _t1(rev_inv_lift, Int)(p + 4 * y + 16 * z, 1); -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/revdecode4.c b/ThirdParty/zfp/vtkzfp/src/template/revdecode4.c deleted file mode 100644 index 98a98f80b7f5604c4812d1f7698cb2243de1867f..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/revdecode4.c +++ /dev/null @@ -1,28 +0,0 @@ -/* private functions ------------------------------------------------------- */ - -/* reversible inverse decorrelating 4D transform */ -static void -_t2(rev_inv_xform, Int, 4)(Int* p) -{ - uint x, y, z, w; - /* transform along w */ - for (z = 0; z < 4; z++) - for (y = 0; y < 4; y++) - for (x = 0; x < 4; x++) - _t1(rev_inv_lift, Int)(p + 1 * x + 4 * y + 16 * z, 64); - /* transform along z */ - for (y = 0; y < 4; y++) - for (x = 0; x < 4; x++) - for (w = 0; w < 4; w++) - _t1(rev_inv_lift, Int)(p + 64 * w + 1 * x + 4 * y, 16); - /* transform along y */ - for (x = 0; x < 4; x++) - for (w = 0; w < 4; w++) - for (z = 0; z < 4; z++) - _t1(rev_inv_lift, Int)(p + 16 * z + 64 * w + 1 * x, 4); - /* transform along x */ - for (w = 0; w < 4; w++) - for (z = 0; z < 4; z++) - for (y = 0; y < 4; y++) - _t1(rev_inv_lift, Int)(p + 4 * y + 16 * z + 64 * w, 1); -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/revdecodef.c b/ThirdParty/zfp/vtkzfp/src/template/revdecodef.c deleted file mode 100644 index 221a4b2e513830fffdcc27584b1c9cb6c4ce5fe5..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/revdecodef.c +++ /dev/null @@ -1,58 +0,0 @@ -#include <string.h> - -/* private functions ------------------------------------------------------- */ - -/* reinterpret two's complement integers as floating values */ -static void -_t1(rev_inv_reinterpret, Scalar)(Int* iblock, Scalar* fblock, uint n) -{ - /* convert two's complement integers to sign-magnitude integers */ - uint i; - for (i = 0; i < n; i++) { - Int x = iblock[i]; - if (x < 0) - iblock[i] = (Int)((UInt)x ^ TCMASK); - } - /* reinterpret sign-magnitude integers as floating values */ - memcpy(fblock, iblock, n * sizeof(*fblock)); -} - -/* decode contiguous floating-point block using reversible algorithm */ -static uint -_t2(rev_decode_block, Scalar, DIMS)(zfp_stream* zfp, Scalar* fblock) -{ - uint bits = 0; - cache_align_(Int iblock[BLOCK_SIZE]); - /* test whether block is all-zero */ - bits++; - if (stream_read_bit(zfp->stream)) { - /* non-zero block; test whether to use block-floating-point transform */ - bits++; - if (stream_read_bit(zfp->stream)) { - /* decode integer block */ - bits += _t2(rev_decode_block, Int, DIMS)(zfp->stream, zfp->minbits - bits, zfp->maxbits - bits, iblock); - /* reinterpret integers as floating values */ - _t1(rev_inv_reinterpret, Scalar)(iblock, fblock, BLOCK_SIZE); - } - else { - /* decode common exponent */ - bits += EBITS; - int emax = (int)stream_read_bits(zfp->stream, EBITS) - EBIAS; - /* decode integer block */ - bits += _t2(rev_decode_block, Int, DIMS)(zfp->stream, zfp->minbits - bits, zfp->maxbits - bits, iblock); - /* perform inverse block-floating-point transform */ - _t1(rev_inv_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax); - } - } - else { - /* all-zero block; set all values to zero */ - uint i; - for (i = 0; i < BLOCK_SIZE; i++) - *fblock++ = 0; - if (zfp->minbits > bits) { - stream_skip(zfp->stream, zfp->minbits - bits); - bits = zfp->minbits; - } - } - return bits; -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/revencode.c b/ThirdParty/zfp/vtkzfp/src/template/revencode.c deleted file mode 100644 index f76238e986dc4118db9e6f327c015406efe3a104..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/revencode.c +++ /dev/null @@ -1,79 +0,0 @@ -static void _t2(rev_fwd_xform, Int, DIMS)(Int* p); - -/* private functions ------------------------------------------------------- */ - -/* reversible forward lifting transform of 4-vector */ -static void -_t1(rev_fwd_lift, Int)(Int* p, uint s) -{ - Int x, y, z, w; - x = *p; p += s; - y = *p; p += s; - z = *p; p += s; - w = *p; p += s; - - /* - ** high-order Lorenzo transform - ** ( 1 0 0 0) (x) - ** (-1 1 0 0) (y) - ** ( 1 -2 1 0) (z) - ** (-1 3 -3 1) (w) - */ - w -= z; z -= y; y -= x; - w -= z; z -= y; - w -= z; - - p -= s; *p = w; - p -= s; *p = z; - p -= s; *p = y; - p -= s; *p = x; -} - -/* return precision required to encode block reversibly */ -static uint -_t1(rev_precision, UInt)(const UInt* block, uint n) -{ - uint p = 0; - uint s; - /* compute bitwise OR of all values */ - UInt m = 0; - while (n--) - m |= *block++; - /* count trailing zeros via binary search */ - for (s = CHAR_BIT * (uint)sizeof(UInt); m; s /= 2) - if ((UInt)(m << (s - 1))) { - m <<= s - 1; - m <<= 1; - p += s; - } - return p; -} - -/* encode block of integers using reversible algorithm */ -static uint -_t2(rev_encode_block, Int, DIMS)(bitstream* stream, int minbits, int maxbits, int maxprec, Int* iblock) -{ - int bits = PBITS; - int prec; - cache_align_(UInt ublock[BLOCK_SIZE]); - /* perform decorrelating transform */ - _t2(rev_fwd_xform, Int, DIMS)(iblock); - /* reorder signed coefficients and convert to unsigned integer */ - _t1(fwd_order, Int)(ublock, iblock, PERM, BLOCK_SIZE); - /* determine and encode number of significant bits */ - prec = _t1(rev_precision, UInt)(ublock, BLOCK_SIZE); - prec = MIN(prec, maxprec); - prec = MAX(prec, 1); - stream_write_bits(stream, prec - 1, PBITS); - /* encode integer coefficients */ - if (BLOCK_SIZE <= 64) - bits += _t1(encode_ints, UInt)(stream, maxbits - bits, prec, ublock, BLOCK_SIZE); - else - bits += _t1(encode_many_ints, UInt)(stream, maxbits - bits, prec, ublock, BLOCK_SIZE); - /* write at least minbits bits by padding with zeros */ - if (bits < minbits) { - stream_pad(stream, minbits - bits); - bits = minbits; - } - return bits; -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/revencode1.c b/ThirdParty/zfp/vtkzfp/src/template/revencode1.c deleted file mode 100644 index 1e7b29a41a8b0a8b630208656a2660dcd6f40639..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/revencode1.c +++ /dev/null @@ -1,9 +0,0 @@ -/* private functions ------------------------------------------------------- */ - -/* reversible forward decorrelating 1D transform */ -static void -_t2(rev_fwd_xform, Int, 1)(Int* p) -{ - /* transform along x */ - _t1(rev_fwd_lift, Int)(p, 1); -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/revencode2.c b/ThirdParty/zfp/vtkzfp/src/template/revencode2.c deleted file mode 100644 index 621fc0cc60ac8231081f01aeba861eb0ef47482a..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/revencode2.c +++ /dev/null @@ -1,14 +0,0 @@ -/* private functions ------------------------------------------------------- */ - -/* reversible forward decorrelating 2D transform */ -static void -_t2(rev_fwd_xform, Int, 2)(Int* p) -{ - uint x, y; - /* transform along x */ - for (y = 0; y < 4; y++) - _t1(rev_fwd_lift, Int)(p + 4 * y, 1); - /* transform along y */ - for (x = 0; x < 4; x++) - _t1(rev_fwd_lift, Int)(p + 1 * x, 4); -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/revencode3.c b/ThirdParty/zfp/vtkzfp/src/template/revencode3.c deleted file mode 100644 index 64d49f19d6873c568a58b7936105c01d20147cff..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/revencode3.c +++ /dev/null @@ -1,20 +0,0 @@ -/* private functions ------------------------------------------------------- */ - -/* reversible forward decorrelating 3D transform */ -static void -_t2(rev_fwd_xform, Int, 3)(Int* p) -{ - uint x, y, z; - /* transform along x */ - for (z = 0; z < 4; z++) - for (y = 0; y < 4; y++) - _t1(rev_fwd_lift, Int)(p + 4 * y + 16 * z, 1); - /* transform along y */ - for (x = 0; x < 4; x++) - for (z = 0; z < 4; z++) - _t1(rev_fwd_lift, Int)(p + 16 * z + 1 * x, 4); - /* transform along z */ - for (y = 0; y < 4; y++) - for (x = 0; x < 4; x++) - _t1(rev_fwd_lift, Int)(p + 1 * x + 4 * y, 16); -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/revencode4.c b/ThirdParty/zfp/vtkzfp/src/template/revencode4.c deleted file mode 100644 index 46e2a465c4f9990c2457b371ebda58d19e9c93dd..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/revencode4.c +++ /dev/null @@ -1,28 +0,0 @@ -/* private functions ------------------------------------------------------- */ - -/* reversible forward decorrelating 4D transform */ -static void -_t2(rev_fwd_xform, Int, 4)(Int* p) -{ - uint x, y, z, w; - /* transform along x */ - for (w = 0; w < 4; w++) - for (z = 0; z < 4; z++) - for (y = 0; y < 4; y++) - _t1(rev_fwd_lift, Int)(p + 4 * y + 16 * z + 64 * w, 1); - /* transform along y */ - for (x = 0; x < 4; x++) - for (w = 0; w < 4; w++) - for (z = 0; z < 4; z++) - _t1(rev_fwd_lift, Int)(p + 16 * z + 64 * w + 1 * x, 4); - /* transform along z */ - for (y = 0; y < 4; y++) - for (x = 0; x < 4; x++) - for (w = 0; w < 4; w++) - _t1(rev_fwd_lift, Int)(p + 64 * w + 1 * x + 4 * y, 16); - /* transform along w */ - for (z = 0; z < 4; z++) - for (y = 0; y < 4; y++) - for (x = 0; x < 4; x++) - _t1(rev_fwd_lift, Int)(p + 1 * x + 4 * y + 16 * z, 64); -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/revencodef.c b/ThirdParty/zfp/vtkzfp/src/template/revencodef.c deleted file mode 100644 index 44ef3749072197cf6aa503ef137f87f06db1d935..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/revencodef.c +++ /dev/null @@ -1,80 +0,0 @@ -#include <string.h> - -/* private functions ------------------------------------------------------- */ - -/* test if block-floating-point encoding is reversible */ -static int -_t1(rev_fwd_reversible, Scalar)(const Int* iblock, const Scalar* fblock, uint n, int emax) -{ - /* reconstruct block */ - cache_align_(Scalar gblock[BLOCK_SIZE]); - _t1(rev_inv_cast, Scalar)(iblock, gblock, n, emax); - /* perform bit-wise comparison */ - return !memcmp(fblock, gblock, n * sizeof(*fblock)); -} - -/* forward block-floating-point transform to signed integers */ -static void -_t1(rev_fwd_cast, Scalar)(Int* iblock, const Scalar* fblock, uint n, int emax) -{ - /* test for all-zero block, which needs special treatment */ - if (emax != -EBIAS) - _t1(fwd_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax); - else - while (n--) - *iblock++ = 0; -} - -/* reinterpret floating values as two's complement integers */ -static void -_t1(rev_fwd_reinterpret, Scalar)(Int* iblock, const Scalar* fblock, uint n) -{ - /* reinterpret floating values as sign-magnitude integers */ - memcpy(iblock, fblock, n * sizeof(*iblock)); - /* convert sign-magnitude integers to two's complement integers */ - while (n--) { - Int x = *iblock; - if (x < 0) - *iblock = (Int)((UInt)x ^ TCMASK); - iblock++; - } -} - -/* encode contiguous floating-point block using reversible algorithm */ -static uint -_t2(rev_encode_block, Scalar, DIMS)(zfp_stream* zfp, const Scalar* fblock) -{ - uint bits = 0; - cache_align_(Int iblock[BLOCK_SIZE]); - /* compute maximum exponent */ - int emax = _t1(exponent_block, Scalar)(fblock, BLOCK_SIZE); - /* perform forward block-floating-point transform */ - _t1(rev_fwd_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax); - /* test if block-floating-point transform is reversible */ - if (_t1(rev_fwd_reversible, Scalar)(iblock, fblock, BLOCK_SIZE, emax)) { - /* transform is reversible; test if block has any non-zeros */ - uint e = emax + EBIAS; - if (e) { - /* encode common exponent */ - bits += 2; - stream_write_bits(zfp->stream, 1, 2); - bits += EBITS; - stream_write_bits(zfp->stream, e, EBITS); - } - else { - /* emit single bit for all-zero block */ - bits++; - stream_write_bit(zfp->stream, 0); - return bits; - } - } - else { - /* transform is irreversible; reinterpret floating values as integers */ - _t1(rev_fwd_reinterpret, Scalar)(iblock, fblock, BLOCK_SIZE); - bits++; - stream_write_bits(zfp->stream, 3, 2); - } - /* losslessly encode integers */ - bits += _t2(rev_encode_block, Int, DIMS)(zfp->stream, zfp->minbits - bits, zfp->maxbits - bits, zfp->maxprec, iblock); - return bits; -} diff --git a/ThirdParty/zfp/vtkzfp/src/template/template.h b/ThirdParty/zfp/vtkzfp/src/template/template.h deleted file mode 100644 index fd5becf7e4c25c9bfb326deb68c490b57ddcef41..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/template/template.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef TEMPLATE_H -#define TEMPLATE_H - -/* concatenation */ -#define _cat2(x, y) x ## _ ## y -#define _cat3(x, y, z) x ## _ ## y ## _ ## z - -/* 1- and 2-argument function templates */ -#define _t1(function, arg) _cat2(function, arg) -#define _t2(function, type, dims) _cat3(function, type, dims) - -#endif diff --git a/ThirdParty/zfp/vtkzfp/src/traitsd.h b/ThirdParty/zfp/vtkzfp/src/traitsd.h deleted file mode 100644 index 4dfb271b83be5ba497f94b3b7e022d1b8aba9948..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/traitsd.h +++ /dev/null @@ -1,13 +0,0 @@ -/* double-precision floating-point traits */ - -#define Scalar double /* floating-point type */ -#define Int int64 /* corresponding signed integer type */ -#define UInt uint64 /* corresponding unsigned integer type */ -#define EBITS 11 /* number of exponent bits */ -#define PBITS 6 /* number of bits needed to encode precision */ -#define NBMASK UINT64C(0xaaaaaaaaaaaaaaaa) /* negabinary mask */ -#define TCMASK UINT64C(0x7fffffffffffffff) /* two's complement mask */ - -#define FABS(x) fabs(x) -#define FREXP(x, e) frexp(x, e) -#define LDEXP(x, e) ldexp(x, e) diff --git a/ThirdParty/zfp/vtkzfp/src/traitsf.h b/ThirdParty/zfp/vtkzfp/src/traitsf.h deleted file mode 100644 index 408337e1e1e5b1491e750c190cf9a6e3c5ba56e3..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/traitsf.h +++ /dev/null @@ -1,19 +0,0 @@ -/* single-precision floating-point traits */ - -#define Scalar float /* floating-point type */ -#define Int int32 /* corresponding signed integer type */ -#define UInt uint32 /* corresponding unsigned integer type */ -#define EBITS 8 /* number of exponent bits */ -#define PBITS 5 /* number of bits needed to encode precision */ -#define NBMASK 0xaaaaaaaau /* negabinary mask */ -#define TCMASK 0x7fffffffu /* two's complement mask */ - -#if __STDC_VERSION__ >= 199901L - #define FABS(x) fabsf(x) - #define FREXP(x, e) frexpf(x, e) - #define LDEXP(x, e) ldexpf(x, e) -#else - #define FABS(x) (float)fabs(x) - #define FREXP(x, e) (void)frexp(x, e) - #define LDEXP(x, e) (float)ldexp(x, e) -#endif diff --git a/ThirdParty/zfp/vtkzfp/src/traitsi.h b/ThirdParty/zfp/vtkzfp/src/traitsi.h deleted file mode 100644 index a540fb4017bb1d57bf24aa9d5dde6cf68f3b39d4..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/traitsi.h +++ /dev/null @@ -1,7 +0,0 @@ -/* 32-bit integer traits */ - -#define Scalar int32 /* integer type */ -#define Int int32 /* corresponding signed integer type */ -#define UInt uint32 /* corresponding unsigned integer type */ -#define PBITS 5 /* number of bits needed to encode precision */ -#define NBMASK 0xaaaaaaaau /* negabinary mask */ diff --git a/ThirdParty/zfp/vtkzfp/src/traitsl.h b/ThirdParty/zfp/vtkzfp/src/traitsl.h deleted file mode 100644 index ffa01e0b703fc4b17b18eaca1d64e21268e39efa..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/traitsl.h +++ /dev/null @@ -1,7 +0,0 @@ -/* 64-bit integer traits */ - -#define Scalar int64 /* integer type */ -#define Int int64 /* corresponding signed integer type */ -#define UInt uint64 /* corresponding unsigned integer type */ -#define PBITS 6 /* number of bits needed to encode precision */ -#define NBMASK UINT64C(0xaaaaaaaaaaaaaaaa) /* negabinary mask */ diff --git a/ThirdParty/zfp/vtkzfp/src/zfp.c b/ThirdParty/zfp/vtkzfp/src/zfp.c deleted file mode 100644 index 54a0e5f2ac0bc6c299ec25b32c0d0f803a70678f..0000000000000000000000000000000000000000 --- a/ThirdParty/zfp/vtkzfp/src/zfp.c +++ /dev/null @@ -1,1092 +0,0 @@ -#include <limits.h> -#include <math.h> -#include <stdio.h> -#include <stdlib.h> -#include "zfp.h" -#include "zfp/macros.h" -#include "template/template.h" - -/* public data ------------------------------------------------------------- */ - -export_ const uint zfp_codec_version = ZFP_CODEC; -export_ const uint zfp_library_version = ZFP_VERSION; -export_ const char* const zfp_version_string = "zfp version " ZFP_VERSION_STRING " (May 5, 2019)"; - -/* private functions ------------------------------------------------------- */ - -static uint -type_precision(zfp_type type) -{ - switch (type) { - case zfp_type_int32: - return CHAR_BIT * (uint)sizeof(int32); - case zfp_type_int64: - return CHAR_BIT * (uint)sizeof(int64); - case zfp_type_float: - return CHAR_BIT * (uint)sizeof(float); - case zfp_type_double: - return CHAR_BIT * (uint)sizeof(double); - default: - return 0; - } -} - -static int -is_reversible(const zfp_stream* zfp) -{ - return zfp->minexp < ZFP_MIN_EXP; -} - -/* shared code across template instances ------------------------------------*/ - -#include "share/parallel.c" -#include "share/omp.c" - -/* template instantiation of integer and float compressor -------------------*/ - -#define Scalar int32 -#include "template/compress.c" -#include "template/decompress.c" -#include "template/ompcompress.c" -#include "template/cudacompress.c" -#include "template/cudadecompress.c" -#undef Scalar - -#define Scalar int64 -#include "template/compress.c" -#include "template/decompress.c" -#include "template/ompcompress.c" -#include "template/cudacompress.c" -#include "template/cudadecompress.c" -#undef Scalar - -#define Scalar float -#include "template/compress.c" -#include "template/decompress.c" -#include "template/ompcompress.c" -#include "template/cudacompress.c" -#include "template/cudadecompress.c" -#undef Scalar - -#define Scalar double -#include "template/compress.c" -#include "template/decompress.c" -#include "template/ompcompress.c" -#include "template/cudacompress.c" -#include "template/cudadecompress.c" -#undef Scalar - -/* public functions: miscellaneous ----------------------------------------- */ - -size_t -zfp_type_size(zfp_type type) -{ - switch (type) { - case zfp_type_int32: - return sizeof(int32); - case zfp_type_int64: - return sizeof(int64); - case zfp_type_float: - return sizeof(float); - case zfp_type_double: - return sizeof(double); - default: - return 0; - } -} - -/* public functions: fields ------------------------------------------------ */ - -zfp_field* -zfp_field_alloc() -{ - zfp_field* field = (zfp_field*)malloc(sizeof(zfp_field)); - if (field) { - field->type = zfp_type_none; - field->nx = field->ny = field->nz = field->nw = 0; - field->sx = field->sy = field->sz = field->sw = 0; - field->data = 0; - } - return field; -} - -zfp_field* -zfp_field_1d(void* data, zfp_type type, uint nx) -{ - zfp_field* field = zfp_field_alloc(); - if (field) { - field->type = type; - field->nx = nx; - field->data = data; - } - return field; -} - -zfp_field* -zfp_field_2d(void* data, zfp_type type, uint nx, uint ny) -{ - zfp_field* field = zfp_field_alloc(); - if (field) { - field->type = type; - field->nx = nx; - field->ny = ny; - field->data = data; - } - return field; -} - -zfp_field* -zfp_field_3d(void* data, zfp_type type, uint nx, uint ny, uint nz) -{ - zfp_field* field = zfp_field_alloc(); - if (field) { - field->type = type; - field->nx = nx; - field->ny = ny; - field->nz = nz; - field->data = data; - } - return field; -} - -zfp_field* -zfp_field_4d(void* data, zfp_type type, uint nx, uint ny, uint nz, uint nw) -{ - zfp_field* field = zfp_field_alloc(); - if (field) { - field->type = type; - field->nx = nx; - field->ny = ny; - field->nz = nz; - field->nw = nw; - field->data = data; - } - return field; -} - -void -zfp_field_free(zfp_field* field) -{ - free(field); -} - -void* -zfp_field_pointer(const zfp_field* field) -{ - return field->data; -} - -zfp_type -zfp_field_type(const zfp_field* field) -{ - return field->type; -} - -uint -zfp_field_precision(const zfp_field* field) -{ - return type_precision(field->type); -} - -uint -zfp_field_dimensionality(const zfp_field* field) -{ - return field->nx ? field->ny ? field->nz ? field->nw ? 4 : 3 : 2 : 1 : 0; -} - -size_t -zfp_field_size(const zfp_field* field, uint* size) -{ - if (size) - switch (zfp_field_dimensionality(field)) { - case 4: - size[3] = field->nw; - /* FALLTHROUGH */ - case 3: - size[2] = field->nz; - /* FALLTHROUGH */ - case 2: - size[1] = field->ny; - /* FALLTHROUGH */ - case 1: - size[0] = field->nx; - break; - } - return (size_t)MAX(field->nx, 1u) * (size_t)MAX(field->ny, 1u) * (size_t)MAX(field->nz, 1u) * (size_t)MAX(field->nw, 1u); -} - -int -zfp_field_stride(const zfp_field* field, int* stride) -{ - if (stride) - switch (zfp_field_dimensionality(field)) { - case 4: - stride[3] = field->sw ? field->sw : (int)(field->nx * field->ny * field->nz); - /* FALLTHROUGH */ - case 3: - stride[2] = field->sz ? field->sz : (int)(field->nx * field->ny); - /* FALLTHROUGH */ - case 2: - stride[1] = field->sy ? field->sy : (int)field->nx; - /* FALLTHROUGH */ - case 1: - stride[0] = field->sx ? field->sx : 1; - break; - } - return field->sx || field->sy || field->sz || field->sw; -} - -uint64 -zfp_field_metadata(const zfp_field* field) -{ - uint64 meta = 0; - /* 48 bits for dimensions */ - switch (zfp_field_dimensionality(field)) { - case 1: - if ((uint64)(field->nx - 1) >> 48) - return ZFP_META_NULL; - meta <<= 48; meta += field->nx - 1; - break; - case 2: - if (((field->nx - 1) >> 24) || - ((field->ny - 1) >> 24)) - return ZFP_META_NULL; - meta <<= 24; meta += field->ny - 1; - meta <<= 24; meta += field->nx - 1; - break; - case 3: - if (((field->nx - 1) >> 16) || - ((field->ny - 1) >> 16) || - ((field->nz - 1) >> 16)) - return ZFP_META_NULL; - meta <<= 16; meta += field->nz - 1; - meta <<= 16; meta += field->ny - 1; - meta <<= 16; meta += field->nx - 1; - break; - case 4: - if (((field->nx - 1) >> 12) || - ((field->ny - 1) >> 12) || - ((field->nz - 1) >> 12) || - ((field->nw - 1) >> 12)) - return ZFP_META_NULL; - meta <<= 12; meta += field->nw - 1; - meta <<= 12; meta += field->nz - 1; - meta <<= 12; meta += field->ny - 1; - meta <<= 12; meta += field->nx - 1; - break; - } - /* 2 bits for dimensionality (1D, 2D, 3D, 4D) */ - meta <<= 2; meta += zfp_field_dimensionality(field) - 1; - /* 2 bits for scalar type */ - meta <<= 2; meta += field->type - 1; - return meta; -} - -void -zfp_field_set_pointer(zfp_field* field, void* data) -{ - field->data = data; -} - -zfp_type -zfp_field_set_type(zfp_field* field, zfp_type type) -{ - switch (type) { - case zfp_type_int32: - case zfp_type_int64: - case zfp_type_float: - case zfp_type_double: - field->type = type; - return type; - default: - return zfp_type_none; - } -} - -void -zfp_field_set_size_1d(zfp_field* field, uint n) -{ - field->nx = n; - field->ny = 0; - field->nz = 0; - field->nw = 0; -} - -void -zfp_field_set_size_2d(zfp_field* field, uint nx, uint ny) -{ - field->nx = nx; - field->ny = ny; - field->nz = 0; - field->nw = 0; -} - -void -zfp_field_set_size_3d(zfp_field* field, uint nx, uint ny, uint nz) -{ - field->nx = nx; - field->ny = ny; - field->nz = nz; - field->nw = 0; -} - -void -zfp_field_set_size_4d(zfp_field* field, uint nx, uint ny, uint nz, uint nw) -{ - field->nx = nx; - field->ny = ny; - field->nz = nz; - field->nw = nw; -} - -void -zfp_field_set_stride_1d(zfp_field* field, int sx) -{ - field->sx = sx; - field->sy = 0; - field->sz = 0; - field->sw = 0; -} - -void -zfp_field_set_stride_2d(zfp_field* field, int sx, int sy) -{ - field->sx = sx; - field->sy = sy; - field->sz = 0; - field->sw = 0; -} - -void -zfp_field_set_stride_3d(zfp_field* field, int sx, int sy, int sz) -{ - field->sx = sx; - field->sy = sy; - field->sz = sz; - field->sw = 0; -} - -void -zfp_field_set_stride_4d(zfp_field* field, int sx, int sy, int sz, int sw) -{ - field->sx = sx; - field->sy = sy; - field->sz = sz; - field->sw = sw; -} - -int -zfp_field_set_metadata(zfp_field* field, uint64 meta) -{ - uint64 dims; - /* ensure value is in range */ - if (meta >> ZFP_META_BITS) - return 0; - field->type = (zfp_type)((meta & 0x3u) + 1); meta >>= 2; - dims = (meta & 0x3u) + 1; meta >>= 2; - switch (dims) { - case 1: - /* currently dimensions are limited to 2^32 - 1 */ - field->nx = (meta & UINT64C(0x0000ffffffff)) + 1; meta >>= 48; - field->ny = 0; - field->nz = 0; - field->nw = 0; - break; - case 2: - field->nx = (meta & UINT64C(0xffffff)) + 1; meta >>= 24; - field->ny = (meta & UINT64C(0xffffff)) + 1; meta >>= 24; - field->nz = 0; - field->nw = 0; - break; - case 3: - field->nx = (meta & UINT64C(0xffff)) + 1; meta >>= 16; - field->ny = (meta & UINT64C(0xffff)) + 1; meta >>= 16; - field->nz = (meta & UINT64C(0xffff)) + 1; meta >>= 16; - field->nw = 0; - break; - case 4: - field->nx = (meta & UINT64C(0xfff)) + 1; meta >>= 12; - field->ny = (meta & UINT64C(0xfff)) + 1; meta >>= 12; - field->nz = (meta & UINT64C(0xfff)) + 1; meta >>= 12; - field->nw = (meta & UINT64C(0xfff)) + 1; meta >>= 12; - break; - } - field->sx = field->sy = field->sz = field->sw = 0; - return 1; -} - -/* public functions: zfp compressed stream --------------------------------- */ - -zfp_stream* -zfp_stream_open(bitstream* stream) -{ - zfp_stream* zfp = (zfp_stream*)malloc(sizeof(zfp_stream)); - if (zfp) { - zfp->stream = stream; - zfp->minbits = ZFP_MIN_BITS; - zfp->maxbits = ZFP_MAX_BITS; - zfp->maxprec = ZFP_MAX_PREC; - zfp->minexp = ZFP_MIN_EXP; - zfp->exec.policy = zfp_exec_serial; - } - return zfp; -} - -void -zfp_stream_close(zfp_stream* zfp) -{ - free(zfp); -} - -bitstream* -zfp_stream_bit_stream(const zfp_stream* zfp) -{ - return zfp->stream; -} - -zfp_mode -zfp_stream_compression_mode(const zfp_stream* zfp) -{ - if (zfp->minbits > zfp->maxbits || !(0 < zfp->maxprec && zfp->maxprec <= 64)) - return zfp_mode_null; - - /* default values are considered expert mode */ - if (zfp->minbits == ZFP_MIN_BITS && - zfp->maxbits == ZFP_MAX_BITS && - zfp->maxprec == ZFP_MAX_PREC && - zfp->minexp == ZFP_MIN_EXP) - return zfp_mode_expert; - - /* fixed rate? */ - if (zfp->minbits == zfp->maxbits && - 1 <= zfp->maxbits && zfp->maxbits <= ZFP_MAX_BITS && - zfp->maxprec >= ZFP_MAX_PREC && - zfp->minexp == ZFP_MIN_EXP) - return zfp_mode_fixed_rate; - - /* fixed precision? */ - if (zfp->minbits <= ZFP_MIN_BITS && - zfp->maxbits >= ZFP_MAX_BITS && - zfp->maxprec >= 1 && - zfp->minexp == ZFP_MIN_EXP) - return zfp_mode_fixed_precision; - - /* fixed accuracy? */ - if (zfp->minbits <= ZFP_MIN_BITS && - zfp->maxbits >= ZFP_MAX_BITS && - zfp->maxprec >= ZFP_MAX_PREC && - zfp->minexp >= ZFP_MIN_EXP) - return zfp_mode_fixed_accuracy; - - /* reversible? */ - if (zfp->minbits <= ZFP_MIN_BITS && - zfp->maxbits >= ZFP_MAX_BITS && - zfp->maxprec >= ZFP_MAX_PREC && - zfp->minexp < ZFP_MIN_EXP) - return zfp_mode_reversible; - - return zfp_mode_expert; -} - -uint64 -zfp_stream_mode(const zfp_stream* zfp) -{ - uint64 mode = 0; - uint minbits; - uint maxbits; - uint maxprec; - uint minexp; - - /* common configurations mapped to short representation */ - switch (zfp_stream_compression_mode(zfp)) { - case zfp_mode_fixed_rate: - if (zfp->maxbits <= 2048) - /* maxbits is [1, 2048] */ - /* returns [0, 2047] */ - return (zfp->maxbits - 1); - else - break; - - case zfp_mode_fixed_precision: - if (zfp->maxprec <= 128) - /* maxprec is [1, 128] */ - /* returns [2048, 2175] */ - return (zfp->maxprec - 1) + (2048); - else - break; - - case zfp_mode_fixed_accuracy: - if (zfp->minexp <= 843) - /* minexp is [ZFP_MIN_EXP=-1074, 843] */ - /* returns [2177, ZFP_MODE_SHORT_MAX=4094] */ - /* +1 because skipped 2176 */ - return (zfp->minexp - ZFP_MIN_EXP) + (2048 + 128 + 1); - else - break; - - case zfp_mode_reversible: - /* returns 2176 */ - return 2048 + 128; - - default: - break; - } - - /* encode each parameter separately */ - minbits = MAX(1, MIN(zfp->minbits, 0x8000u)) - 1; - maxbits = MAX(1, MIN(zfp->maxbits, 0x8000u)) - 1; - maxprec = MAX(1, MIN(zfp->maxprec, 0x0080u)) - 1; - minexp = MAX(0, MIN(zfp->minexp + 16495, 0x7fff)); - mode <<= 15; mode += minexp; - mode <<= 7; mode += maxprec; - mode <<= 15; mode += maxbits; - mode <<= 15; mode += minbits; - mode <<= 12; mode += 0xfffu; - - return mode; -} - -void -zfp_stream_params(const zfp_stream* zfp, uint* minbits, uint* maxbits, uint* maxprec, int* minexp) -{ - if (minbits) - *minbits = zfp->minbits; - if (maxbits) - *maxbits = zfp->maxbits; - if (maxprec) - *maxprec = zfp->maxprec; - if (minexp) - *minexp = zfp->minexp; -} - -size_t -zfp_stream_compressed_size(const zfp_stream* zfp) -{ - return stream_size(zfp->stream); -} - -size_t -zfp_stream_maximum_size(const zfp_stream* zfp, const zfp_field* field) -{ - uint dims = zfp_field_dimensionality(field); - uint mx = (MAX(field->nx, 1u) + 3) / 4; - uint my = (MAX(field->ny, 1u) + 3) / 4; - uint mz = (MAX(field->nz, 1u) + 3) / 4; - uint mw = (MAX(field->nw, 1u) + 3) / 4; - size_t blocks = (size_t)mx * (size_t)my * (size_t)mz * (size_t)mw; - uint values = 1u << (2 * dims); - uint maxbits = 1; - - if (!dims) - return 0; - switch (field->type) { - case zfp_type_none: - return 0; - case zfp_type_float: - maxbits += 8; - if (is_reversible(zfp)) - maxbits += 5; - break; - case zfp_type_double: - maxbits += 11; - if (is_reversible(zfp)) - maxbits += 6; - break; - default: - break; - } - maxbits += values - 1 + values * MIN(zfp->maxprec, type_precision(field->type)); - maxbits = MIN(maxbits, zfp->maxbits); - maxbits = MAX(maxbits, zfp->minbits); - return ((ZFP_HEADER_MAX_BITS + blocks * maxbits + stream_word_bits - 1) & ~(stream_word_bits - 1)) / CHAR_BIT; -} - -void -zfp_stream_set_bit_stream(zfp_stream* zfp, bitstream* stream) -{ - zfp->stream = stream; -} - -void -zfp_stream_set_reversible(zfp_stream* zfp) -{ - zfp->minbits = ZFP_MIN_BITS; - zfp->maxbits = ZFP_MAX_BITS; - zfp->maxprec = ZFP_MAX_PREC; - zfp->minexp = ZFP_MIN_EXP - 1; -} - -double -zfp_stream_set_rate(zfp_stream* zfp, double rate, zfp_type type, uint dims, int wra) -{ - uint n = 1u << (2 * dims); - uint bits = (uint)floor(n * rate + 0.5); - switch (type) { - case zfp_type_float: - bits = MAX(bits, 1 + 8u); - break; - case zfp_type_double: - bits = MAX(bits, 1 + 11u); - break; - default: - break; - } - if (wra) { - /* for write random access, round up to next multiple of stream word size */ - bits += (uint)stream_word_bits - 1; - bits &= ~(stream_word_bits - 1); - } - zfp->minbits = bits; - zfp->maxbits = bits; - zfp->maxprec = ZFP_MAX_PREC; - zfp->minexp = ZFP_MIN_EXP; - return (double)bits / n; -} - -uint -zfp_stream_set_precision(zfp_stream* zfp, uint precision) -{ - zfp->minbits = ZFP_MIN_BITS; - zfp->maxbits = ZFP_MAX_BITS; - zfp->maxprec = precision ? MIN(precision, ZFP_MAX_PREC) : ZFP_MAX_PREC; - zfp->minexp = ZFP_MIN_EXP; - return zfp->maxprec; -} - -double -zfp_stream_set_accuracy(zfp_stream* zfp, double tolerance) -{ - int emin = ZFP_MIN_EXP; - if (tolerance > 0) { - /* tolerance = x * 2^emin, with 0.5 <= x < 1 */ - frexp(tolerance, &emin); - emin--; - /* assert: 2^emin <= tolerance < 2^(emin+1) */ - } - zfp->minbits = ZFP_MIN_BITS; - zfp->maxbits = ZFP_MAX_BITS; - zfp->maxprec = ZFP_MAX_PREC; - zfp->minexp = emin; - return tolerance > 0 ? ldexp(1.0, emin) : 0; -} - -zfp_mode -zfp_stream_set_mode(zfp_stream* zfp, uint64 mode) -{ - uint minbits, maxbits, maxprec; - int minexp; - - if (mode <= ZFP_MODE_SHORT_MAX) { - /* 12-bit (short) encoding of one of four modes */ - if (mode < 2048) { - /* fixed rate */ - minbits = maxbits = (uint)mode + 1; - maxprec = ZFP_MAX_PREC; - minexp = ZFP_MIN_EXP; - } - else if (mode < (2048 + 128)) { - /* fixed precision */ - minbits = ZFP_MIN_BITS; - maxbits = ZFP_MAX_BITS; - maxprec = (uint)mode + 1 - (2048); - minexp = ZFP_MIN_EXP; - } - else if (mode == (2048 + 128)) { - /* reversible */ - minbits = ZFP_MIN_BITS; - maxbits = ZFP_MAX_BITS; - maxprec = ZFP_MAX_PREC; - minexp = ZFP_MIN_EXP - 1; - } - else { - /* fixed accuracy */ - minbits = ZFP_MIN_BITS; - maxbits = ZFP_MAX_BITS; - maxprec = ZFP_MAX_PREC; - minexp = (uint)mode + ZFP_MIN_EXP - (2048 + 128 + 1); - } - } - else { - /* 64-bit encoding */ - mode >>= 12; minbits = ((uint)mode & 0x7fffu) + 1; - mode >>= 15; maxbits = ((uint)mode & 0x7fffu) + 1; - mode >>= 15; maxprec = ((uint)mode & 0x007fu) + 1; - mode >>= 7; minexp = ((uint)mode & 0x7fffu) - 16495; - } - - if (!zfp_stream_set_params(zfp, minbits, maxbits, maxprec, minexp)) - return zfp_mode_null; - - return zfp_stream_compression_mode(zfp); -} - -int -zfp_stream_set_params(zfp_stream* zfp, uint minbits, uint maxbits, uint maxprec, int minexp) -{ - if (minbits > maxbits || !(0 < maxprec && maxprec <= 64)) - return 0; - zfp->minbits = minbits; - zfp->maxbits = maxbits; - zfp->maxprec = maxprec; - zfp->minexp = minexp; - return 1; -} - -size_t -zfp_stream_flush(zfp_stream* zfp) -{ - return stream_flush(zfp->stream); -} - -size_t -zfp_stream_align(zfp_stream* zfp) -{ - return stream_align(zfp->stream); -} - -void -zfp_stream_rewind(zfp_stream* zfp) -{ - stream_rewind(zfp->stream); -} - -/* public functions: execution policy -------------------------------------- */ - -zfp_exec_policy -zfp_stream_execution(const zfp_stream* zfp) -{ - return zfp->exec.policy; -} - -uint -zfp_stream_omp_threads(const zfp_stream* zfp) -{ - return zfp->exec.params.omp.threads; -} - -uint -zfp_stream_omp_chunk_size(const zfp_stream* zfp) -{ - return zfp->exec.params.omp.chunk_size; -} - -int -zfp_stream_set_execution(zfp_stream* zfp, zfp_exec_policy policy) -{ - switch (policy) { - case zfp_exec_serial: - break; -#ifdef ZFP_WITH_CUDA - case zfp_exec_cuda: - break; -#endif - case zfp_exec_omp: -#ifdef _OPENMP - if (zfp->exec.policy != policy) { - zfp->exec.params.omp.threads = 0; - zfp->exec.params.omp.chunk_size = 0; - } - break; -#else - return 0; -#endif - default: - return 0; - } - zfp->exec.policy = policy; - return 1; -} - -int -zfp_stream_set_omp_threads(zfp_stream* zfp, uint threads) -{ - if (!zfp_stream_set_execution(zfp, zfp_exec_omp)) - return 0; - zfp->exec.params.omp.threads = threads; - return 1; -} - -int -zfp_stream_set_omp_chunk_size(zfp_stream* zfp, uint chunk_size) -{ - if (!zfp_stream_set_execution(zfp, zfp_exec_omp)) - return 0; - zfp->exec.params.omp.chunk_size = chunk_size; - return 1; -} - -/* public functions: utility functions --------------------------------------*/ - -void -zfp_promote_int8_to_int32(int32* oblock, const int8* iblock, uint dims) -{ - uint count = 1u << (2 * dims); - while (count--) - *oblock++ = (int32)*iblock++ << 23; -} - -void -zfp_promote_uint8_to_int32(int32* oblock, const uint8* iblock, uint dims) -{ - uint count = 1u << (2 * dims); - while (count--) - *oblock++ = ((int32)*iblock++ - 0x80) << 23; -} - -void -zfp_promote_int16_to_int32(int32* oblock, const int16* iblock, uint dims) -{ - uint count = 1u << (2 * dims); - while (count--) - *oblock++ = (int32)*iblock++ << 15; -} - -void -zfp_promote_uint16_to_int32(int32* oblock, const uint16* iblock, uint dims) -{ - uint count = 1u << (2 * dims); - while (count--) - *oblock++ = ((int32)*iblock++ - 0x8000) << 15; -} - -void -zfp_demote_int32_to_int8(int8* oblock, const int32* iblock, uint dims) -{ - uint count = 1u << (2 * dims); - while (count--) { - int32 i = *iblock++ >> 23; - *oblock++ = (int8)MAX(-0x80, MIN(i, 0x7f)); - } -} - -void -zfp_demote_int32_to_uint8(uint8* oblock, const int32* iblock, uint dims) -{ - uint count = 1u << (2 * dims); - while (count--) { - int32 i = (*iblock++ >> 23) + 0x80; - *oblock++ = (uint8)MAX(0x00, MIN(i, 0xff)); - } -} - -void -zfp_demote_int32_to_int16(int16* oblock, const int32* iblock, uint dims) -{ - uint count = 1u << (2 * dims); - while (count--) { - int32 i = *iblock++ >> 15; - *oblock++ = (int16)MAX(-0x8000, MIN(i, 0x7fff)); - } -} - -void -zfp_demote_int32_to_uint16(uint16* oblock, const int32* iblock, uint dims) -{ - uint count = 1u << (2 * dims); - while (count--) { - int32 i = (*iblock++ >> 15) + 0x8000; - *oblock++ = (uint16)MAX(0x0000, MIN(i, 0xffff)); - } -} - -/* public functions: compression and decompression --------------------------*/ - -size_t -zfp_compress(zfp_stream* zfp, const zfp_field* field) -{ - /* function table [execution][strided][dimensionality][scalar type] */ - void (*ftable[3][2][4][4])(zfp_stream*, const zfp_field*) = { - /* serial */ - {{{ compress_int32_1, compress_int64_1, compress_float_1, compress_double_1 }, - { compress_strided_int32_2, compress_strided_int64_2, compress_strided_float_2, compress_strided_double_2 }, - { compress_strided_int32_3, compress_strided_int64_3, compress_strided_float_3, compress_strided_double_3 }, - { compress_strided_int32_4, compress_strided_int64_4, compress_strided_float_4, compress_strided_double_4 }}, - {{ compress_strided_int32_1, compress_strided_int64_1, compress_strided_float_1, compress_strided_double_1 }, - { compress_strided_int32_2, compress_strided_int64_2, compress_strided_float_2, compress_strided_double_2 }, - { compress_strided_int32_3, compress_strided_int64_3, compress_strided_float_3, compress_strided_double_3 }, - { compress_strided_int32_4, compress_strided_int64_4, compress_strided_float_4, compress_strided_double_4 }}}, - - /* OpenMP */ -#ifdef _OPENMP - {{{ compress_omp_int32_1, compress_omp_int64_1, compress_omp_float_1, compress_omp_double_1 }, - { compress_strided_omp_int32_2, compress_strided_omp_int64_2, compress_strided_omp_float_2, compress_strided_omp_double_2 }, - { compress_strided_omp_int32_3, compress_strided_omp_int64_3, compress_strided_omp_float_3, compress_strided_omp_double_3 }, - { compress_strided_omp_int32_4, compress_strided_omp_int64_4, compress_strided_omp_float_4, compress_strided_omp_double_4 }}, - {{ compress_strided_omp_int32_1, compress_strided_omp_int64_1, compress_strided_omp_float_1, compress_strided_omp_double_1 }, - { compress_strided_omp_int32_2, compress_strided_omp_int64_2, compress_strided_omp_float_2, compress_strided_omp_double_2 }, - { compress_strided_omp_int32_3, compress_strided_omp_int64_3, compress_strided_omp_float_3, compress_strided_omp_double_3 }, - { compress_strided_omp_int32_4, compress_strided_omp_int64_4, compress_strided_omp_float_4, compress_strided_omp_double_4 }}}, -#else - {{{ NULL }}}, -#endif - - /* CUDA */ -#ifdef ZFP_WITH_CUDA - {{{ compress_cuda_int32_1, compress_cuda_int64_1, compress_cuda_float_1, compress_cuda_double_1 }, - { compress_strided_cuda_int32_2, compress_strided_cuda_int64_2, compress_strided_cuda_float_2, compress_strided_cuda_double_2 }, - { compress_strided_cuda_int32_3, compress_strided_cuda_int64_3, compress_strided_cuda_float_3, compress_strided_cuda_double_3 }, - { NULL, NULL, NULL, NULL }}, - {{ compress_strided_cuda_int32_1, compress_strided_cuda_int64_1, compress_strided_cuda_float_1, compress_strided_cuda_double_1 }, - { compress_strided_cuda_int32_2, compress_strided_cuda_int64_2, compress_strided_cuda_float_2, compress_strided_cuda_double_2 }, - { compress_strided_cuda_int32_3, compress_strided_cuda_int64_3, compress_strided_cuda_float_3, compress_strided_cuda_double_3 }, - { NULL, NULL, NULL, NULL }}}, -#else - {{{ NULL }}}, -#endif - }; - uint exec = zfp->exec.policy; - uint strided = zfp_field_stride(field, NULL); - uint dims = zfp_field_dimensionality(field); - uint type = field->type; - void (*compress)(zfp_stream*, const zfp_field*); - - switch (type) { - case zfp_type_int32: - case zfp_type_int64: - case zfp_type_float: - case zfp_type_double: - break; - default: - return 0; - } - - /* return 0 if compression mode is not supported */ - compress = ftable[exec][strided][dims - 1][type - zfp_type_int32]; - if (!compress) - return 0; - - /* compress field and align bit stream on word boundary */ - compress(zfp, field); - stream_flush(zfp->stream); - - return stream_size(zfp->stream); -} - -size_t -zfp_decompress(zfp_stream* zfp, zfp_field* field) -{ - /* function table [execution][strided][dimensionality][scalar type] */ - void (*ftable[3][2][4][4])(zfp_stream*, zfp_field*) = { - /* serial */ - {{{ decompress_int32_1, decompress_int64_1, decompress_float_1, decompress_double_1 }, - { decompress_strided_int32_2, decompress_strided_int64_2, decompress_strided_float_2, decompress_strided_double_2 }, - { decompress_strided_int32_3, decompress_strided_int64_3, decompress_strided_float_3, decompress_strided_double_3 }, - { decompress_strided_int32_4, decompress_strided_int64_4, decompress_strided_float_4, decompress_strided_double_4 }}, - {{ decompress_strided_int32_1, decompress_strided_int64_1, decompress_strided_float_1, decompress_strided_double_1 }, - { decompress_strided_int32_2, decompress_strided_int64_2, decompress_strided_float_2, decompress_strided_double_2 }, - { decompress_strided_int32_3, decompress_strided_int64_3, decompress_strided_float_3, decompress_strided_double_3 }, - { decompress_strided_int32_4, decompress_strided_int64_4, decompress_strided_float_4, decompress_strided_double_4 }}}, - - /* OpenMP; not yet supported */ - {{{ NULL }}}, - - /* CUDA */ -#ifdef ZFP_WITH_CUDA - {{{ decompress_cuda_int32_1, decompress_cuda_int64_1, decompress_cuda_float_1, decompress_cuda_double_1 }, - { decompress_strided_cuda_int32_2, decompress_strided_cuda_int64_2, decompress_strided_cuda_float_2, decompress_strided_cuda_double_2 }, - { decompress_strided_cuda_int32_3, decompress_strided_cuda_int64_3, decompress_strided_cuda_float_3, decompress_strided_cuda_double_3 }, - { NULL, NULL, NULL, NULL }}, - {{ decompress_strided_cuda_int32_1, decompress_strided_cuda_int64_1, decompress_strided_cuda_float_1, decompress_strided_cuda_double_1 }, - { decompress_strided_cuda_int32_2, decompress_strided_cuda_int64_2, decompress_strided_cuda_float_2, decompress_strided_cuda_double_2 }, - { decompress_strided_cuda_int32_3, decompress_strided_cuda_int64_3, decompress_strided_cuda_float_3, decompress_strided_cuda_double_3 }, - { NULL, NULL, NULL, NULL }}}, -#else - {{{ NULL }}}, -#endif - }; - uint exec = zfp->exec.policy; - uint strided = zfp_field_stride(field, NULL); - uint dims = zfp_field_dimensionality(field); - uint type = field->type; - void (*decompress)(zfp_stream*, zfp_field*); - - switch (type) { - case zfp_type_int32: - case zfp_type_int64: - case zfp_type_float: - case zfp_type_double: - break; - default: - return 0; - } - - /* return 0 if decompression mode is not supported */ - decompress = ftable[exec][strided][dims - 1][type - zfp_type_int32]; - if (!decompress) - return 0; - - /* decompress field and align bit stream on word boundary */ - decompress(zfp, field); - stream_align(zfp->stream); - - return stream_size(zfp->stream); -} - -size_t -zfp_write_header(zfp_stream* zfp, const zfp_field* field, uint mask) -{ - size_t bits = 0; - uint64 meta = 0; - - /* first make sure field dimensions fit in header */ - if (mask & ZFP_HEADER_META) { - meta = zfp_field_metadata(field); - if (meta == ZFP_META_NULL) - return 0; - } - - /* 32-bit magic */ - if (mask & ZFP_HEADER_MAGIC) { - stream_write_bits(zfp->stream, 'z', 8); - stream_write_bits(zfp->stream, 'f', 8); - stream_write_bits(zfp->stream, 'p', 8); - stream_write_bits(zfp->stream, zfp_codec_version, 8); - bits += ZFP_MAGIC_BITS; - } - /* 52-bit field metadata */ - if (mask & ZFP_HEADER_META) { - stream_write_bits(zfp->stream, meta, ZFP_META_BITS); - bits += ZFP_META_BITS; - } - /* 12- or 64-bit compression parameters */ - if (mask & ZFP_HEADER_MODE) { - uint64 mode = zfp_stream_mode(zfp); - uint size = mode > ZFP_MODE_SHORT_MAX ? ZFP_MODE_LONG_BITS : ZFP_MODE_SHORT_BITS; - stream_write_bits(zfp->stream, mode, size); - bits += size; - } - - return bits; -} - -size_t -zfp_read_header(zfp_stream* zfp, zfp_field* field, uint mask) -{ - size_t bits = 0; - if (mask & ZFP_HEADER_MAGIC) { - if (stream_read_bits(zfp->stream, 8) != 'z' || - stream_read_bits(zfp->stream, 8) != 'f' || - stream_read_bits(zfp->stream, 8) != 'p' || - stream_read_bits(zfp->stream, 8) != zfp_codec_version) - return 0; - bits += ZFP_MAGIC_BITS; - } - if (mask & ZFP_HEADER_META) { - uint64 meta = stream_read_bits(zfp->stream, ZFP_META_BITS); - if (!zfp_field_set_metadata(field, meta)) - return 0; - bits += ZFP_META_BITS; - } - if (mask & ZFP_HEADER_MODE) { - uint64 mode = stream_read_bits(zfp->stream, ZFP_MODE_SHORT_BITS); - bits += ZFP_MODE_SHORT_BITS; - if (mode > ZFP_MODE_SHORT_MAX) { - uint size = ZFP_MODE_LONG_BITS - ZFP_MODE_SHORT_BITS; - mode += stream_read_bits(zfp->stream, size) << ZFP_MODE_SHORT_BITS; - bits += size; - } - if (zfp_stream_set_mode(zfp, mode) == zfp_mode_null) - return 0; - } - return bits; -}