Compare commits

..

2 commits

Author SHA1 Message Date
Patrick Vogler
c0a4b16261
README.md amended for use of .svg graphic 2023-06-21 16:53:11 +02:00
Patrick Vogler
1ca6d04411
Initial streaming commit 2023-06-20 13:53:59 +02:00
46 changed files with 23277 additions and 18337 deletions

13
.gitignore vendored
View file

@ -131,13 +131,9 @@ share/python-wheels/
MANIFEST
# Files and Archives
*.eas
*.npz
*.zip
*.bwc
# Profiling assets
valgrind-out.txt
.eas
.npz
.zip
# PyInstaller
# Usually these files are written by a python script from a template
@ -196,9 +192,6 @@ target/
profile_default/
ipython_config.py
# vscode
.vscode
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:

View file

@ -89,10 +89,8 @@ include(GNUInstallDirs)
# and utility binaries. #
#----------------------------------------------------------#
list(INSERT CMAKE_MODULE_PATH 0 "${BWC_SOURCE_DIR}/cmake")
if(${TOOL})
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${BWC_SOURCE_DIR}/${CMAKE_INSTALL_BINDIR})
endif()
if("${TOOL}" STREQUAL "True" AND NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${BWC_SOURCE_DIR}/${CMAKE_INSTALL_BINDIR})
endif()
if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${BWC_SOURCE_DIR}/${CMAKE_INSTALL_LIBDIR})
@ -101,13 +99,6 @@ if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${BWC_SOURCE_DIR}/${CMAKE_INSTALL_LIBDIR})
endif()
#----------------------------------------------------------#
# Set the target installation directory of the config-file #
# packaging configuration files. #
#----------------------------------------------------------#
set(CMAKE_INSTALL_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/bwc
CACHE PATH "Installation directory for config-file package cmake files")
#----------------------------------------------------------#
# Suggest the C standard (C99) used by the compiler. #
#----------------------------------------------------------#
@ -131,8 +122,7 @@ message(STATUS "Compiling with C++ standard: ${CMAKE_CXX_STANDARD}")
# Check if the OpenMP package is available for the current #
# setup and set the appropriate C/C++ flags. #
#----------------------------------------------------------#
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release" OR "${OMP}")
message(STATUS "Enable OpenMP parallelization")
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
@ -145,8 +135,8 @@ endif()
# Add all necessary compiler warnings for debugging. #
#----------------------------------------------------------#
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-comment -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-comment -Wextra")
endif()
#----------------------------------------------------------#
@ -180,25 +170,6 @@ add_subdirectory(src/library)
#----------------------------------------------------------#
# Add the utilities source code if requested. #
#----------------------------------------------------------#
if(${TOOL})
if("${TOOL}" STREQUAL "True")
add_subdirectory(src/tools)
else()
set(ignoreMe "${BUILD_EAS3}${BUILD_NETCDF}")
endif()
#----------------------------------------------------------#
# Config-file packaging #
#----------------------------------------------------------#
export(TARGETS bwclib NAMESPACE bwc:: FILE "bwc-targets.cmake")
configure_file(${PROJECT_SOURCE_DIR}/bwc-config.cmake.in
"${PROJECT_BINARY_DIR}/bwc-config.cmake" @ONLY)
configure_file(${PROJECT_SOURCE_DIR}/bwc-config-version.cmake.in
"${PROJECT_BINARY_DIR}/bwc-config-version.cmake" @ONLY)
install( FILES "${PROJECT_BINARY_DIR}/bwc-config.cmake"
"${PROJECT_BINARY_DIR}/bwc-config-version.cmake"
DESTINATION ${CMAKE_INSTALL_CMAKEDIR})
install( EXPORT bwc-targets
NAMESPACE bwc::
DESTINATION ${CMAKE_INSTALL_CMAKEDIR})
endif()

71
Makefile Executable file → Normal file
View file

@ -18,7 +18,7 @@
#| DESCRIPTION: |#
#| ------------ |#
#| Defines a wrapper for the Big Whoop cmake & make tools. This Makefile creates the |#
#| build dir if it does not exist, switches to it and executes cmake and make. |#
#| build dir if it does not exist, switches to it and executes cmake and make. |#
#| |#
#| ---------------------------------------------------------------------------------------------------------------- |#
#| |#
@ -53,20 +53,14 @@
.PHONY: single
.PHONY: tool
.PHONY: profiling
.PHONY: omp
.PHONY: eas3
.PHONY: netCDF
.PHONY: build_debug
.PHONY: --build_debug
.PHONY: default
.PHONY: debug
.PHONY: full
.PHONY: release
.PHONY: cmdl
.PHONY: cldebug
#*--------------------------------------------------------*#
# Initialize the compiler flags used to build the library. #
@ -79,21 +73,17 @@ BUILD_PREC="Double"
BUILD_TOOL="False"
BUILD_PROF="False"
BUILD_OMP="False"
BUILD_EAS3="False"
BUILD_NETCDF="False"
#*--------------------------------------------------------*#
# Define default target. #
# Define default target. #
#*--------------------------------------------------------*#
default: | build_bwc display
#*--------------------------------------------------------*#
# Define helper target. #
# Define helper target. #
#*--------------------------------------------------------*#
help:
@ -105,25 +95,12 @@ help:
@echo ""
@echo " [Type] [Description]"
@echo ""
@echo " debug Compiles BigWhoop with all relevant debug flags."
@echo " debug Compiles BigWhoop and the command line tool with "
@echo " full file support. All relevant debug flags are set."
@echo ""
@echo " full Removes all files and folders created during a pre-"
@echo " vious compile run. Compiles BigWhoop (with OpenMP "
@echo " enabled if applicable). Code optimization is set to"
@echo " the highest level."
@echo ""
@echo " release Compiles BigWhoop (with OpenMP enabled if applica-"
@echo " ble). Code optimization is set to the highest level."
@echo ""
@echo " cldebug Removes all files and folders created during a pre-"
@echo " vious compile run. Compiles BigWhoop (with OpenMP "
@echo " enabled if applicable). All relevant debug flags "
@echo " are set. "
@echo ""
@echo " cmdl Removes all files and folders created during a pre-"
@echo " vious compile run. Compiles BigWhoop (with OpenMP "
@echo " enabled if applicable). Code optimization is set to"
@echo " the highest level."
@echo " full Compiles BigWhoop (with OpenMP enabled if applica-"
@echo " ble) and the command line tool with full file sup-"
@echo " port. Code optimization is set to the highest level."
@echo ""
@echo " clean Removes all files and folders created during a pre-"
@echo " vious compile run."
@ -139,10 +116,6 @@ help:
@echo ""
@echo " tool Build the command line tool."
@echo ""
@echo " profiling Enable Profiling."
@echo ""
@echo " omp Enable OpenMP parallelization."
@echo ""
@echo " eas3 Adds support for the eas3 file format to the com-"
@echo " mand line tool."
@echo ""
@ -152,7 +125,7 @@ help:
#*--------------------------------------------------------*#
# Define private targets. #
#*--------------------------------------------------------*#
build_debug:
--build_debug:
$(eval BUILD_TYPE="Debug")
#*--------------------------------------------------------*#
@ -170,35 +143,22 @@ single:
tool:
$(eval BUILD_TOOL="True")
#*--------------------------------------------------------*#
# Define target used to activate profiling. #
#*--------------------------------------------------------*#
profiling:
$(eval BUILD_PROF="True")
#*--------------------------------------------------------*#
# Define target used to activate OpenMP parallelization. #
#*--------------------------------------------------------*#
omp:
$(eval BUILD_OMP="True")
#*--------------------------------------------------------*#
# Define targets used to activate file format support. #
#*--------------------------------------------------------*#
eas3:
$(eval BUILD_EAS3="True")
$(eval BUILD_EAS3="TRUE")
netCDF:
$(eval BUILD_NETCDF="True")
$(eval BUILD_NETCDF="TRUE")
#*--------------------------------------------------------*#
# Define the wrappers for the compile command targets. #
#*--------------------------------------------------------*#
debug: | clean build_debug build_bwc display
full: | clean build_bwc display
debug: | clean --build_debug tool eas3 build_bwc display
release: | build_bwc display
cmdl: | clean tool profiling eas3 build_bwc display
cldebug: | clean build_debug tool profiling eas3 build_bwc display
full: | clean tool eas3 build_bwc display
#*--------------------------------------------------------*#
# Define target used to output compile information. #
@ -222,7 +182,6 @@ display:
@echo " Link Type: $(LINK_TYPE)"
@echo " Precision: $(BUILD_PREC)"
@echo " Utilities: $(BUILD_TOOL)"
@echo " Profiling: $(BUILD_PROF)"
@echo ""
@echo " Build date: $(shell date)"
@echo " User: $(USER)"
@ -233,7 +192,7 @@ display:
# Define the main compile command targets. #
#*--------------------------------------------------------*#
build_bwc:
mkdir -p build && cd build && cmake .. "-DCMAKE_BUILD_TYPE=${BUILD_TYPE}" "-DLINK:STRING=${LINK_TYPE}" "-DPREC:STRING=${BUILD_PREC}" "-DTOOL=${BUILD_TOOL}" "-DPROF=${BUILD_PROF}" "-DOMP=${BUILD_OMP}" "-DBUILD_EAS3=${BUILD_EAS3}" "-DBUILD_NETCDF=${BUILD_NETCDF}" && $(MAKE) -j
mkdir -p build && cd build && cmake .. "-DCMAKE_BUILD_TYPE=${BUILD_TYPE}" "-DLINK:STRING=${LINK_TYPE}" "-DPREC:STRING=${BUILD_PREC}" "-DTOOL=${BUILD_TOOL}" "-DBUILD_EAS3=${BUILD_EAS3}" "-DBUILD_NETCDF=${BUILD_NETCDF}" && $(MAKE) -j
clean:
- /bin/rm -rf build/ bin/ lib/ lib64/ include/library/public

View file

@ -1,6 +1,6 @@
<p align="center">
<a href="https://code.hlrs.de/TOPIO/BigWhoop">
<img alt="BigWhoop" src="https://code.hlrs.de/TOPIO/BigWhoop/raw/branch/main/docs/img/Logo.svg"/>
<a href="https://code.hlrs.de/hpcpvogl/BigWhoop">
<img alt="BigWhoop" src="https://code.hlrs.de/hpcpvogl/BigWhoop/raw/branch/main/docs/img/Logo.svg"/>
</a>
</p>
<h1 align="center">Compression library for numerical datasets</h1>
@ -19,9 +19,9 @@ BigWhoop is a compression library for numerical datasets that has been developed
### Building
clone the sources from HLRS' gitea instance (note: default branch is `main`):
pull the sources from HLRS' gitea instance (note: default branch is `main`):
```
git clone https://code.hlrs.de/TOPIO/BigWhoop.git
git pull https://code.hlrs.de/hpcpvogl/BigWhoop.git
```
Now change into the source directory and run the following commands.
@ -40,11 +40,4 @@ make full
make clean
make debug
```
This builds the library and places the associated files in the `/lib` or `/lib64` folders. If a full build was attempted, the command line tool binaries are placed in the `/bin` folder.
### Credits
This project exists thanks to all the people who contribute.
- Patrick Vogler patrick.vogler@hlrs.de (principal author)
- Gregor Weiss gregor.weiss@hlrs.de
This builds the library and places the associated files in the `/lib` or `/lib64` folders. If a full build was attempted, the command line tool binaries are placed in the `/bin` folder.

View file

@ -1,59 +0,0 @@
#*================================================================================================*#
#| |#
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
#| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |#
#| /$$ \ $$ | $$ |#
#| | $$$$$$/ | $$ |#
#| \______/ |__/ |#
#| |#
#| DESCRIPTION: |#
#| ------------ |#
#| |#
#| Config that handles package versioning. |#
#| |#
#| -------------------------------------------------------------------------------------------- |#
#| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart |#
#| |#
#| 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 following disclaimer. |#
#| |#
#| (2) Redistributions in binary form must reproduce the above copyright notice, this list |#
#| of conditions and the following disclaimer in the documentation and/or other |#
#| materials provided with the distribution. |#
#| |#
#| 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 THE |#
#| COPYRIGHT HOLDER 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. |#
#| |#
#*================================================================================================*#
set(PACKAGE_VERSION_MAJOR @BWC_VERSION_MAJOR@)
set(PACKAGE_VERSION_MINOR @BWC_VERSION_MINOR@)
set(PACKAGE_VERSION_PATCH @BWC_VERSION_PATCH@)
set(PACKAGE_VERSION @BWC_VERSION@)
# Check whether the requested PACKAGE_FIND_VERSION is compatible
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION OR
PACKAGE_VERSION_MAJOR GREATER PACKAGE_FIND_VERSION_MAJOR)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if(PACKAGE_VERSION VERSION_EQUAL PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()

View file

@ -1,61 +0,0 @@
#*================================================================================================*#
#| |#
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
#| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |#
#| /$$ \ $$ | $$ |#
#| | $$$$$$/ | $$ |#
#| \______/ |__/ |#
#| |#
#| DESCRIPTION: |#
#| ------------ |#
#| |#
#| Config file for the bwc package defining the following variables: |#
#| |#
#| BWC_INCLUDE_DIRS - include directories for bwc, |#
#| BWC_LIBRARIES - libraries to link against, |#
#| |#
#| and the following imported targets: |#
#| |#
#| bwc::bwclib |#
#| |#
#| -------------------------------------------------------------------------------------------- |#
#| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart |#
#| |#
#| 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 following disclaimer. |#
#| |#
#| (2) Redistributions in binary form must reproduce the above copyright notice, this list |#
#| of conditions and the following disclaimer in the documentation and/or other |#
#| materials provided with the distribution. |#
#| |#
#| 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 THE |#
#| COPYRIGHT HOLDER 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. |#
#| |#
#*================================================================================================*#
include("${CMAKE_CURRENT_LIST_DIR}/bwc-config-version.cmake")
include(FindPackageHandleStandardArgs)
set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG "${CMAKE_CURRENT_LIST_FILE}")
find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME} CONFIG_MODE)
if(NOT TARGET bwc::bwclib)
include("${CMAKE_CURRENT_LIST_DIR}/bwc-targets.cmake")
set(BWC_LIBRARIES "bwc::bwclib")
get_target_property(BWC_INCLUDE_DIRS bwc::bwclib INTERFACE_INCLUDE_DIRECTORIES)
endif()

View file

@ -1,62 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" viewBox="0 0 2645 630" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<g transform="matrix(5.4,0,0,5.4,-1595.98,-659.601)">
<g>
<g id="g" transform="matrix(-0.233284,-1.39905e-16,-2.77556e-17,0.233284,887.632,-47.5765)">
<path d="M626.195,897.638C635.52,897.638 644.463,901.342 651.056,907.936C657.65,914.529 661.354,923.472 661.354,932.797C661.354,993.197 661.354,1174.93 661.354,1194.63C661.354,1196.12 660.761,1197.55 659.706,1198.61C658.651,1199.66 657.22,1200.26 655.728,1200.26C643.096,1200.26 612.853,1200.25 603.488,1200.25C601.935,1200.25 600.675,1198.99 600.675,1197.44C600.675,1184.01 600.675,1126.48 600.675,1113.05C600.675,1112.3 600.379,1111.59 599.852,1111.06C599.324,1110.53 598.609,1110.24 597.863,1110.24C585.601,1110.24 535.883,1110.24 501.123,1110.24C491.798,1110.24 482.855,1106.53 476.261,1099.94C469.668,1093.35 465.963,1084.4 465.963,1075.08L465.963,932.797C465.963,923.472 469.668,914.529 476.261,907.936C482.855,901.342 491.798,897.638 501.123,897.638C536.516,897.638 590.801,897.638 626.195,897.638ZM600.675,961.189C600.675,959.636 599.416,958.376 597.863,958.376C586.14,958.376 541.239,958.376 529.517,958.376C527.964,958.376 526.704,959.636 526.704,961.189C526.704,974.734 526.704,1033.14 526.704,1046.68C526.704,1048.24 527.964,1049.49 529.517,1049.49C541.239,1049.49 586.141,1049.49 597.863,1049.49C599.416,1049.49 600.675,1048.24 600.675,1046.68C600.675,1033.14 600.675,974.734 600.675,961.189Z" style="fill:rgb(255,140,0);stroke:rgb(35,43,63);stroke-width:3.75px;"/>
</g>
<g id="o" transform="matrix(0.233284,-1.39905e-16,2.77556e-17,0.233284,573.203,-47.5935)">
<path d="M626.195,897.638C635.52,897.638 644.462,901.342 651.056,907.936C657.65,914.529 661.354,923.472 661.354,932.797C661.354,972.192 661.354,1035.68 661.354,1075.08C661.354,1084.4 657.65,1093.35 651.056,1099.94C644.462,1106.53 635.52,1110.24 626.195,1110.24C586.814,1110.24 523.357,1110.24 483.976,1110.24C474.651,1110.24 465.709,1106.53 459.115,1099.94C452.521,1093.35 448.817,1084.4 448.817,1075.08C448.817,1035.68 448.817,972.192 448.817,932.797C448.817,923.472 452.521,914.529 459.115,907.936C465.709,901.342 474.651,897.638 483.976,897.638C523.357,897.638 586.814,897.638 626.195,897.638ZM600.675,961.189C600.675,959.636 599.416,958.376 597.863,958.376C584.318,958.376 525.915,958.376 512.37,958.376C510.817,958.376 509.558,959.636 509.558,961.189C509.558,974.734 509.558,1033.14 509.558,1046.68C509.558,1048.24 510.817,1049.49 512.371,1049.49C525.915,1049.49 584.318,1049.49 597.863,1049.49C599.416,1049.49 600.675,1048.24 600.675,1046.68C600.675,1033.14 600.675,974.734 600.675,961.189Z" style="fill:rgb(255,140,0);stroke:rgb(35,43,63);stroke-width:3.75px;"/>
</g>
<g id="o1" serif:id="o" transform="matrix(0.233284,-1.39905e-16,2.77556e-17,0.233284,517.76,-47.5935)">
<path d="M626.195,897.638C635.52,897.638 644.462,901.342 651.056,907.936C657.65,914.529 661.354,923.472 661.354,932.797C661.354,972.192 661.354,1035.68 661.354,1075.08C661.354,1084.4 657.65,1093.35 651.056,1099.94C644.462,1106.53 635.52,1110.24 626.195,1110.24C586.814,1110.24 523.357,1110.24 483.976,1110.24C474.651,1110.24 465.709,1106.53 459.115,1099.94C452.521,1093.35 448.817,1084.4 448.817,1075.08C448.817,1035.68 448.817,972.192 448.817,932.797C448.817,923.472 452.521,914.529 459.115,907.936C465.709,901.342 474.651,897.638 483.976,897.638C523.357,897.638 586.814,897.638 626.195,897.638ZM600.675,961.189C600.675,959.636 599.416,958.376 597.863,958.376C584.318,958.376 525.915,958.376 512.37,958.376C510.817,958.376 509.558,959.636 509.558,961.189C509.558,974.734 509.558,1033.14 509.558,1046.68C509.558,1048.24 510.817,1049.49 512.371,1049.49C525.915,1049.49 584.318,1049.49 597.863,1049.49C599.416,1049.49 600.675,1048.24 600.675,1046.68C600.675,1033.14 600.675,974.734 600.675,961.189Z" style="fill:rgb(255,140,0);stroke:rgb(35,43,63);stroke-width:3.75px;"/>
</g>
<g id="h" transform="matrix(0.233284,-1.39905e-16,2.77556e-17,0.233284,462.316,-47.5935)">
<path d="M626.195,897.638C645.613,897.638 661.354,913.379 661.354,932.797C661.354,985.291 661.354,1080.57 661.354,1104.61C661.354,1107.72 658.835,1110.24 655.729,1110.24C643.096,1110.24 612.852,1110.24 603.488,1110.24C601.934,1110.24 600.675,1108.98 600.675,1107.42C600.675,1088.52 600.675,980.098 600.675,961.189C600.675,960.443 600.379,959.728 599.851,959.2C599.324,958.673 598.608,958.376 597.862,958.376C584.318,958.377 525.914,958.378 512.37,958.378C510.816,958.378 509.557,959.638 509.557,961.191C509.557,980.1 509.557,1088.52 509.557,1107.42C509.557,1108.98 508.298,1110.24 506.744,1110.24C497.372,1110.24 467.085,1110.24 454.442,1110.24C452.95,1110.24 451.52,1109.64 450.465,1108.59C449.41,1107.53 448.817,1106.1 448.817,1104.61C448.817,1062.98 448.817,803.227 448.817,761.598C448.817,760.106 449.41,758.675 450.465,757.62C451.52,756.565 452.95,755.972 454.442,755.972C466.058,755.972 492.328,755.972 500.968,755.972C502.521,755.972 503.78,757.231 503.78,758.785C503.781,776.881 503.782,876.729 503.783,894.825C503.783,896.378 505.042,897.638 506.595,897.638C520.742,897.638 585.056,897.638 626.195,897.638Z" style="fill:rgb(255,140,0);stroke:rgb(35,43,63);stroke-width:3.75px;"/>
</g>
<g id="W" transform="matrix(0.23332,0,0,0.23332,313.135,-47.634)">
<path d="M708.676,761.532C708.676,760.04 709.269,758.61 710.324,757.555C711.379,756.5 712.809,755.907 714.301,755.907C728.634,755.907 766.14,755.907 776.715,755.907C777.461,755.907 778.176,756.204 778.704,756.731C779.231,757.259 779.528,757.974 779.528,758.72C779.528,786.354 779.528,1008.92 779.528,1036.56C779.528,1038.11 780.787,1039.37 782.34,1039.37C793.71,1039.37 836.211,1039.37 847.581,1039.37C848.327,1039.37 849.043,1039.07 849.57,1038.55C850.097,1038.02 850.394,1037.3 850.394,1036.56C850.394,1018.46 850.394,918.55 850.394,900.45C850.394,899.704 850.69,898.989 851.217,898.462C851.745,897.934 852.46,897.638 853.206,897.638C864.576,897.638 907.078,897.638 918.448,897.638C919.193,897.638 919.909,897.934 920.436,898.462C920.964,898.989 921.26,899.704 921.26,900.45C921.26,918.55 921.26,1018.46 921.26,1036.56C921.26,1037.3 921.556,1038.02 922.084,1038.55C922.611,1039.07 923.326,1039.37 924.072,1039.37C935.442,1039.37 977.944,1039.37 989.314,1039.37C990.06,1039.37 990.775,1039.07 991.302,1038.55C991.83,1038.02 992.126,1037.3 992.126,1036.56C992.126,1008.93 992.126,786.418 992.126,758.833C992.126,757.284 993.379,756.026 994.929,756.021C1005.49,755.984 1043.01,755.854 1057.36,755.804C1058.86,755.799 1060.29,756.389 1061.35,757.444C1062.41,758.5 1063.01,759.933 1063.01,761.429C1063.01,797.233 1063.01,993.835 1063.01,1075.08C1063.01,1084.41 1059.3,1093.35 1052.71,1099.94C1046.12,1106.54 1037.18,1110.24 1027.85,1110.24C959.997,1110.24 811.688,1110.24 743.832,1110.24C724.417,1110.24 708.679,1094.5 708.678,1075.08C708.678,993.842 708.677,797.275 708.676,761.532Z" style="fill:url(#_Radial1);stroke:rgb(35,43,63);stroke-width:3.75px;"/>
</g>
</g>
<g>
<g id="g1" serif:id="g" transform="matrix(0.233284,-1.39905e-16,2.77556e-17,0.233284,300.533,-47.5765)">
<path d="M626.195,897.638C635.52,897.638 644.462,901.342 651.056,907.936C657.65,914.529 661.354,923.472 661.354,932.797C661.354,993.197 661.354,1139.84 661.354,1165.1C661.354,1174.42 657.65,1183.36 651.056,1189.96C644.462,1196.55 635.52,1200.26 626.195,1200.26C586.814,1200.26 523.357,1200.26 483.976,1200.26C474.651,1200.26 465.708,1196.55 459.115,1189.96C452.521,1183.36 448.817,1174.42 448.817,1165.1C448.817,1152.31 448.817,1139.24 448.817,1132.04C448.817,1128.93 451.335,1126.41 454.442,1126.41C466.013,1126.41 492.361,1126.41 503.932,1126.41C505.424,1126.41 506.855,1127.01 507.91,1128.06C508.965,1129.12 509.558,1130.55 509.558,1132.04C509.558,1133.65 509.558,1135.34 509.558,1136.7C509.558,1138.25 510.817,1139.51 512.371,1139.51C525.915,1139.51 584.318,1139.51 597.863,1139.51C599.416,1139.51 600.675,1138.25 600.675,1136.7C600.675,1131.11 600.675,1118.64 600.675,1113.05C600.675,1111.5 599.416,1110.24 597.863,1110.24C584.173,1110.24 523.565,1110.24 483.976,1110.24C474.651,1110.24 465.708,1106.53 459.115,1099.94C452.521,1093.35 448.817,1084.4 448.817,1075.08C448.817,1035.68 448.817,972.192 448.817,932.797C448.817,923.472 452.521,914.529 459.115,907.936C465.709,901.342 474.651,897.638 483.976,897.638C523.357,897.638 586.814,897.638 626.195,897.638ZM600.675,961.189C600.675,959.636 599.416,958.376 597.863,958.376C584.318,958.376 525.915,958.376 512.37,958.376C510.817,958.376 509.558,959.636 509.558,961.189C509.558,974.734 509.558,1033.14 509.558,1046.68C509.558,1048.24 510.817,1049.49 512.371,1049.49C525.915,1049.49 584.318,1049.49 597.863,1049.49C599.416,1049.49 600.675,1048.24 600.675,1046.68C600.675,1033.14 600.675,974.734 600.675,961.189Z" style="fill:rgb(255,140,0);stroke:rgb(35,43,63);stroke-width:3.57px;"/>
</g>
<g id="i" transform="matrix(1,0,0,1,-10.822,0)">
<g id="Line" transform="matrix(0.23332,0,0,0.23332,196.471,-47.6165)">
<path d="M856.018,1110.24C852.912,1110.24 850.394,1107.72 850.394,1104.61C850.394,1073.49 850.394,922.937 850.394,900.45C850.394,898.897 851.653,897.638 853.206,897.638C864.576,897.638 907.078,897.638 918.448,897.638C920.001,897.638 921.26,898.897 921.26,900.45C921.26,922.937 921.259,1073.49 921.259,1104.61C921.259,1107.72 918.741,1110.24 915.634,1110.24C902.374,1110.24 869.278,1110.24 856.018,1110.24Z" style="fill:url(#_Radial2);stroke:rgb(35,43,63);stroke-width:3.57px;"/>
</g>
<g id="Dot" transform="matrix(0.0404145,0,0,0.0404145,369.105,97.5346)">
<g id="Right" transform="matrix(1,0,0,1,-491.281,4.90274e-13)">
<path d="M1534.3,1122.05L1534.3,1358.27L1329.72,1476.38L1329.72,1240.16L1534.3,1122.05Z" style="fill:rgb(255,140,0);stroke:rgb(35,43,63);stroke-width:22.91px;stroke-linecap:round;"/>
</g>
<g id="Left" transform="matrix(-1,0,0,1,2168.17,4.9738e-13)">
<path d="M1534.3,1122.05L1534.3,1358.27L1329.72,1476.38L1329.72,1240.16L1534.3,1122.05Z" style="fill:rgb(255,140,0);stroke:rgb(35,43,63);stroke-width:22.91px;stroke-linecap:round;"/>
</g>
<g id="Up" transform="matrix(1,0,0,1,-491.281,1.13687e-13)">
<path d="M1329.72,1003.94L1534.3,1122.05L1329.72,1240.16L1125.15,1122.05L1329.72,1003.94Z" style="fill:rgb(255,140,0);stroke:rgb(35,43,63);stroke-width:22.91px;stroke-linecap:round;"/>
</g>
</g>
<g id="Dot1" serif:id="Dot" transform="matrix(0.0404145,0,0,0.0404145,369.105,97.5346)">
<g id="Right1" serif:id="Right" transform="matrix(1,0,0,1,-491.281,4.90274e-13)">
<path d="M1534.3,1122.05L1534.3,1358.27L1329.72,1476.38L1329.72,1240.16L1534.3,1122.05Z" style="fill:rgb(255,140,0);stroke:rgb(35,43,63);stroke-width:10.31px;stroke-linecap:round;"/>
</g>
<g id="Left1" serif:id="Left" transform="matrix(-1,0,0,1,2168.17,4.9738e-13)">
<path d="M1534.3,1122.05L1534.3,1358.27L1329.72,1476.38L1329.72,1240.16L1534.3,1122.05Z" style="fill:rgb(255,140,0);stroke:rgb(35,43,63);stroke-width:10.31px;stroke-linecap:round;"/>
</g>
<g id="Up1" serif:id="Up" transform="matrix(1,0,0,1,-491.281,1.13687e-13)">
<path d="M1329.72,1003.94L1534.3,1122.05L1329.72,1240.16L1125.15,1122.05L1329.72,1003.94Z" style="fill:rgb(255,140,0);stroke:rgb(35,43,63);stroke-width:10.31px;stroke-linecap:round;"/>
</g>
</g>
</g>
<g id="B" transform="matrix(-0.233284,-1.39905e-16,-2.77556e-17,0.233284,483.966,-47.5898)">
<path d="M773.903,755.906C775.395,755.906 776.825,756.498 777.88,757.553C778.935,758.608 779.528,760.039 779.528,761.531C779.528,803.165 779.528,1062.98 779.528,1104.61C779.528,1106.1 778.935,1107.53 777.88,1108.59C776.825,1109.64 775.395,1110.24 773.903,1110.24C739.915,1110.24 560.886,1110.24 483.977,1110.24C474.652,1110.24 465.709,1106.53 459.115,1099.94C452.522,1093.34 448.817,1084.4 448.817,1075.08C448.818,1038.27 448.819,983.738 448.819,968.504C448.819,933.071 496.063,933.071 496.063,933.071C496.063,933.071 448.819,933.071 448.819,897.638C448.819,882.404 448.818,827.872 448.817,791.065C448.817,781.74 452.522,772.797 459.115,766.204C465.709,759.61 474.652,755.906 483.977,755.906C560.886,755.906 739.915,755.906 773.903,755.906ZM708.661,971.317C708.661,969.763 707.402,968.504 705.849,968.504C684.187,968.504 544.159,968.504 522.498,968.504C520.944,968.504 519.685,969.763 519.685,971.317C519.685,982.687 519.685,1025.19 519.685,1036.56C519.685,1038.11 520.944,1039.37 522.498,1039.37C544.159,1039.37 684.187,1039.37 705.849,1039.37C707.402,1039.37 708.661,1038.11 708.661,1036.56C708.661,1025.19 708.661,982.687 708.661,971.317ZM708.661,829.584C708.661,828.031 707.402,826.772 705.849,826.772C684.187,826.772 544.159,826.772 522.498,826.772C520.944,826.772 519.685,828.031 519.685,829.584C519.685,840.955 519.685,883.455 519.685,894.825C519.685,896.379 520.944,897.638 522.498,897.638C544.159,897.638 684.187,897.638 705.849,897.638C707.402,897.638 708.661,896.379 708.661,894.825C708.661,883.455 708.661,840.955 708.661,829.584Z" style="fill:rgb(255,140,0);stroke:rgb(35,43,63);stroke-width:3.57px;"/>
</g>
</g>
</g>
<defs>
<radialGradient id="_Radial1" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="matrix(621.143,268.963,1.08212e-12,438.396,517.933,451.478)"><stop offset="0" style="stop-color:rgb(251,174,81);stop-opacity:1"/><stop offset="1" style="stop-color:rgb(255,140,0);stop-opacity:1"/></radialGradient>
<radialGradient id="_Radial2" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="matrix(621.143,268.963,1.08212e-12,438.396,517.933,451.478)"><stop offset="0" style="stop-color:rgb(251,174,81);stop-opacity:1"/><stop offset="1" style="stop-color:rgb(255,140,0);stop-opacity:1"/></radialGradient>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 14 KiB

BIN
docs/img/Logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 126 KiB

9
docs/templates/Template.c vendored Normal file → Executable file
View file

@ -86,10 +86,15 @@
! DESCRIPTION NEEDED !
! | | !
! !
! ARGUMENTS: !
! ---------- !
! Name Description !
! ---- ----------- !
! - - !
! !
! RETURN: !
! ------- !
! !
! - !
! - !
! !
\*------------------------------------------------------------------------------------------------*/
/*-----------------------*\

View file

@ -0,0 +1,300 @@
!*================================================================================================*!
!| |!
!| /$$$$$$$ /$$ /$$ /$$ /$$ |!
!| | $$__ $$|__/ | $$ /$ | $$| $$ |!
!| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |!
!| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |!
!| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |!
!| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |!
!| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |!
!| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |!
!| /$$ \ $$ | $$ |!
!| | $$$$$$/ | $$ |!
!| \______/ |__/ |!
!| |!
!| DESCRIPTION: |!
!| ------------ |!
!| |!
!| This file defines a FORTRAN api for the Big Whoop compression library. |!
!| |!
!| -------------------------------------------------------------------------------------------- |!
!| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart |!
!| |!
!| 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 following disclaimer. |!
!| |!
!| (2) Redistributions in binary form must reproduce the above copyright notice, this list |!
!| of conditions and the following disclaimer in the documentation and/or other |!
!| materials provided with the distribution. |!
!| |!
!| 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 THE |!
!| COPYRIGHT HOLDER 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. |!
!| |!
!*================================================================================================*!
module bwc_module
!************************************************************************************************!
!| _ _ _ ____ _ _ _ ___ ____ |!
!| | |\ | | | | | | \ |___ |!
!| | | \| |___ |___ |__| |__/ |___ |!
!| |!
!************************************************************************************************!
use, intrinsic :: iso_c_binding, only: C_PTR, C_INT64_T, C_INT16_T, C_INT8_T, C_INT, C_DOUBLE
IMPLICIT NONE
PRIVATE
!************************************************************************************************!
!| ____ ____ _ _ ____ ___ ____ _ _ ___ ____ |!
!| | | | |\ | [__ | |__| |\ | | [__ |!
!| |___ |__| | \| ___] | | | | \| | ___] |!
!| |!
!************************************************************************************************!
ENUM, BIND(C)
enumerator :: bwc_dwt_9_7 = 0, & ! Cohen Daubechies Feauveau 9/7 Wavelet
bwc_dwt_5_3 = 1, & ! LeGall 5/3 Wavelet
bwc_dwt_haar = 2 ! Haar Wavelet
END ENUM
ENUM, BIND(C)
enumerator :: bwc_prog_LRCP = 0 ! Layer / Resolution / Parameter / Packet
END ENUM
ENUM, BIND(C)
enumerator :: bwc_qt_none = 0, & ! No quantization
bwc_qt_derived = 1 ! Derived quantization acc. to JPEG2000
END ENUM
ENUM, BIND(C)
enumerator :: bwc_tile_sizeof = 0, & ! Tiling def. through dimension of a tile
bwc_tile_numbof = 1 ! Tiling def. through number of tiles
END ENUM
!************************************************************************************************!
!| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ |!
!| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ |!
!| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] |!
!| |!
!************************************************************************************************!
interface
subroutine bwc_free_field(field) BIND(C, NAME="bwc_free_field")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
end subroutine bwc_free_field
!===============================================================================================
subroutine bwc_add_param(field, name, sample, dim, precision) BIND(C, NAME="bwc_add_param")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
TYPE(C_PTR), VALUE :: name
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(C_INT16_T) :: sample
INTEGER(C_INT8_T) :: dimprecision
INTEGER(C_INT8_T) :: precision
end subroutine bwc_add_param
!===============================================================================================
subroutine bwc_set_tiles(field, tilesX, tilesY, &
tilesZ, tilesTS, instr) BIND(C, NAME="bwc_set_tiles")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
TYPE(C_PTR), VALUE :: instr
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(C_INT64_T) :: tilesX, tilesY
INTEGER(C_INT64_T) :: tilesZ, tilesTS
end subroutine bwc_set_tiles
!===============================================================================================
subroutine bwc_set_kernels(field, KernelX, KernelY, &
KernelZ, KernelTS) BIND(C, NAME="bwc_set_kernels")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(C_INT) :: KernelX, KernelY
INTEGER(C_INT) :: KernelZ, KernelTS
end subroutine bwc_set_kernels
!===============================================================================================
subroutine bwc_set_decomp(field, numDecompX, numDecompY, &
numDecompZ, numDecompTS) BIND(C, NAME="bwc_set_decomp")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(C_INT8_T) :: numDecompX, numDecompY
INTEGER(C_INT8_T) :: numDecompZ, numDecompTS
end subroutine bwc_set_decomp
!===============================================================================================
subroutine bwc_set_precincts(field, pX, pY, pZ, pTS) BIND(C, NAME="bwc_set_precincts")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(C_INT8_T) :: pX, pY
INTEGER(C_INT8_T) :: pZ, pTS
end subroutine bwc_set_precincts
!===============================================================================================
subroutine bwc_set_codeblocks(field, cbX, cbY, cbZ, cbTS) BIND(C, NAME="bwc_set_codeblocks")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(C_INT8_T) :: cbX, cbY
INTEGER(C_INT8_T) :: cbZ, cbTS
end subroutine bwc_set_codeblocks
!===============================================================================================
subroutine bwc_set_progression(field, progression) BIND(C, NAME="bwc_set_progression")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(C_INT) :: progression
end subroutine bwc_set_progression
!===============================================================================================
subroutine bwc_set_error_resilience(field) BIND(C, NAME="bwc_set_error_resilience")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
end subroutine bwc_set_error_resilience
!===============================================================================================
subroutine bwc_set_quant_style(field, quantization_style) BIND(C, NAME="bwc_set_quant_style")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(C_INT) :: quantization_style
end subroutine bwc_set_quant_style
!===============================================================================================
subroutine bwc_set_qm(field, Qm) BIND(C, NAME="bwc_set_qm")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(C_INT8_T) :: Qm
end subroutine bwc_set_qm
!===============================================================================================
subroutine bwc_set_quant_step_size(field, delta) BIND(C, NAME="bwc_set_quant_step_size")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE REAL VARIABLES: !
!*-----------------------*!
REAL(C_DOUBLE) :: delta
end subroutine bwc_set_quant_step_size
!===============================================================================================
#ifdef _OPENMP
subroutine bwc_set_nThreads(field, nThreads) BIND(C, NAME="bwc_set_nThreads")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(C_INT8_T) :: nThreads
end subroutine bwc_set_nThreads
#endif
!===============================================================================================
subroutine bwc_set_memory_limit(field, limit) BIND(C, NAME="bwc_set_memory_limit")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
TYPE(C_PTR), VALUE :: limit
end subroutine bwc_set_memory_limit
!===============================================================================================
function bwc_compress(field, rate_control) result(flag) BIND(C, NAME="bwc_compress")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
TYPE(C_PTR), VALUE :: rate_control
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(C_INT8_T) :: flag
end function bwc_compress
!===============================================================================================
function bwc_decompress(field, layer) result(e_flag) BIND(C, NAME="bwc_decompress")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(C_INT8_T) :: layer
INTEGER(C_INT8_T) :: e_flag
end function bwc_decompress
end interface
end module bwc_module

488
include/interfaces/reader/eas3.h Normal file → Executable file
View file

@ -1,360 +1,170 @@
/*==================================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: header.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| This file defines simple read and write functions used to access conforming eas3 datasets. ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| - eas3_std_params ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| - read_eas3 ||
|| - write_eas3 ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| - Patrick Vogler B87D120 V 0.1.0 header file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| 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 following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|| distribution. ||
|| ||
|| 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 THE COPYRIGHT OWNER 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. ||
|| ||
\*==================================================================================================================================*/
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| ||
|| This file defines macros, structs and simple read and write functions used to ||
|| access conforming eas3 datasets. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| 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 following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other ||
|| materials provided with the distribution. ||
|| ||
|| 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 THE ||
|| COPYRIGHT HOLDER 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. ||
|| ||
\*================================================================================================*/
#ifndef EAS3_H
#define EAS3_H
/************************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
#include <bwc.h>
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************/
#include <stdio.h>
#include <stdint.h>
/************************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! !
! These macros are used to identify the spatial and temporal dimensions. !
! !
! MACROS: !
! ------- !
! Name Description !
! ---- ----------- !
! DIM_X, DIM_Y, DIM_Z - Spatial Dimensions !
! !
! DIM_TS - Temporal Dimension !
! !
! DIM_ALL - All Dimensions !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description !
! ---- ------ --------- ------- ----------- !
! 04.12.2017 Patrick Vogler B87D120 V 0.1.0 macros created !
! !
\*----------------------------------------------------------------------------------------------------------*/
#define DIM_X 1
#define DIM_Y 2
#define DIM_Z 4
#define DIM_TS 8
#define DIM_ALL 15
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! !
! These macros are used to instruct the read_eas3_header function. !
! !
! Macros: !
! ------- !
! Macro Description !
! ----- ----------- !
! EAS3_NO_ATTR 1 - Specifies that no attributes are present in the bit- !
! stream. !
! !
! EAS3_ALL_ATTR 2 - Specifies that all attributes are present in the bit- !
! bitstream. !
! !
! ATTRLEN 10 - Defines the number of bytes used to define an attrib- !
! ute. !
! !
! UDEFLEN 20 - Defines the number of bytes used to define a user de- !
! fined data. !
! !
! EAS3_NO_G 1 - Specifies that no geometry data is present in the bit- !
! stream. !
! !
! EAS3_X0DX_G 2 - Specifies that a start value and step size are present !
! in the bitstream. !
! !
! EAS3_UDEF_G 3 - Specifies that ng = number of coordinate data is pres- !
! ent in the bitstream. !
! !
! EAS3_ALL_G 4 - Specifies that an element for every appropriate di- !
! mension is present in the bitstream. !
! !
! EAS3_FULL_G 5 - Specifies that an element for every dimension is pres- !
! ent in the bitstream. !
! !
! EAS3_NO_UDEF 1 - Specifies that no user defined data is present in the !
! bitstream. !
! !
! EAS3_ALL_UDEF 2 - Specifies that all user defined fields are present in !
! the bitstream. !
! !
! EAS3_INT_UDEF 3 - Specifies that an user defined integer field is pres- !
! ent in the bitstream. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 20.06.2018 Patrick Vogler B87D120 V 0.1.0 Macros created !
\*----------------------------------------------------------------------------------------------------------*/
#define EAS3_NO_ATTR 0x100000000000000
#define EAS3_ALL_ATTR 0x200000000000000
#define EAS2_TYPE 0x100000000000000
#define EAS3_TYPE 0x200000000000000
#define ATTRLEN 10
#define UDEFLEN 20
#define EAS3_NO_G 0x100000000000000
#define EAS3_X0DX_G 0x200000000000000
#define EAS3_UDEF_G 0x300000000000000
#define EAS3_ALL_G 0x400000000000000
#define EAS3_FULL_G 0x500000000000000
#define EAS3_NO_UDEF 0x100000000000000
#define EAS3_ALL_UDEF 0x200000000000000
#define EAS3_INT_UDEF 0x300000000000000
#define AUX_SIZE 0x8000
/************************************************************************************************************\
|| ___ _ _ ___ ____ ____ ||
|| | \_/ |__] |___ [__ ||
|| | | | |___ ___] ||
|| ||
\************************************************************************************************************/
#include "types.h"
/************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! This structure is used to read/assemble a packed codestream during coding. The !
! byte buffer is flushed to the packed stream as soon as the a single byte has !
! been assembled. !
! These macros define EAS3 header markers. For more information see: !
! https://wiki.iag.uni-stuttgart.de/eas3wiki/index.php/Main_Page/de !
! !
\*----------------------------------------------------------------------------------------------*/
#define EAS3_NO_ATTR 0x100000000000000 // No attributes present in the bitstream
#define EAS3_ALL_ATTR 0x200000000000000 // All attributes present in the bitstream
#define EAS2_TYPE 0x100000000000000 // EAS2 Datatype
#define EAS3_TYPE 0x200000000000000 // EAS3 Datatype
#define ATTRLEN 10 // Number of bytes defining an attribute
#define UDEFLEN 20 // Number of bytes defining data
#define EAS3_NO_G 0x100000000000000 // No geometry data present in bitstream
#define EAS3_X0DX_G 0x200000000000000 // Start value & step size present
#define EAS3_UDEF_G 0x300000000000000 // Number of grid points present
#define EAS3_ALL_G 0x400000000000000 // Element for every appr. dim. present
#define EAS3_FULL_G 0x500000000000000 // Element for every dimension present
#define EAS3_NO_UDEF 0x100000000000000 // No user defined data present in bitstr
#define EAS3_ALL_UDEF 0x200000000000000 // All user defined fields present
#define EAS3_INT_UDEF 0x300000000000000 // User defined integer field present
#define AUX_SIZE 0x8000 // Size of auxiliary information stream
/************************************************************************************************\
|| ___ _ _ ___ ____ ____ ||
|| | \_/ |__] |___ [__ ||
|| | | | |___ ___] ||
|| ||
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! This structure is used to store the standard eas3 header parameters. For a more !
! thorough discussion of the eas3 datatype see: !
! !
! https://wiki.iag.uni-stuttgart.de/eas3wiki/index.php/EAS3_File_Format/de !
! !
\*----------------------------------------------------------------------------------------------*/
typedef struct
{
uchar error; // Error flag used during streaming.
uint64 file_type; // Identifier for EAS Type (EAS2/3)
uint64 accuracy; // Accuracy of the eas3 file
uint64 L; // Number of bytes written to/from stream.
uint64 Lmax; // Size of packed stream.
uint64 size_incr; // Size incrmnt used for stream assembly.
uint64 nzs; // Temporal dimension size
uint64 npar; // No. parameters present in data-set
uint64 ndim1; // 1st spatial dimension size
uint64 ndim2; // 2nd spatial dimension size
uint64 ndim3; // 3rd spatial dimension size
uint8 T; // Byte buffer.
int8 t; // Byte buffer counter.
uint64 attribute_mode; // Attribute of the eas3 file
uchar *memory; // Memory handle for packed stream chunck.
} bitstream;
uint64 gmode_time; // Geometry mode for the temp. dimension
uint64 gmode_param; // Geometry mode for the parameters
uint64 gmode_dim1; // 1st spatial dimension geometry mode
uint64 gmode_dim2; // 2nd spatial dimension geometry mode
uint64 gmode_dim3; // 3rd spatial dimension geometry mode
uint64 size_time; // Temporal dimension geometry array size
uint64 size_parameter; // Geometry array size of parameters
uint64 size_dim1; // 1st sptl. dimension geometry array size
uint64 size_dim2; // 2nd sptl. dimension geometry array size
uint64 size_dim3; // 3rd sptl. dimension geometry array size
/*----------------------------------------------------------------------------------------------------------*\
! STRUCT NAME: eas3_header !
! ----------- !
! !
! DESCRIPTION: !
! ------------ !
! This structure is used to store the eas3 header information. For a more thorough discussion !
! of the eas3 datatype see: !
! !
! https://wiki.iag.uni-stuttgart.de/eas3wiki/index.php/EAS3_File_Format/de !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! file_type unsigned int(64 bit) - Defines an identifier for the EAS type. !
! !
! accuracy unsigned int(64 bit) - Defines the accuracy of an eas3 file. !
! !
! nzs unsigned int(64 bit) - Variable defining the temporal size of !
! the uncompressed dataset. !
! !
! npar unsigned int(64 bit) - Defines the number of parameters in the !
! eas3 dataset. !
! !
! ndim1, -2, -3 unsigned int(64 bit) - Variables defining the spatial size of !
! the eas3 dataset. !
! !
! attribute_mode; unsigned int(64 bit) - Defines an identifier used to signal !
! the attribute mode of the eas3 file. !
! !
! gmode_time unsigned int(64 bit) - Defines the geometry mode for the temp- !
! oral dimension. !
! !
! gmode_param unsigned int(64 bit) - Defines the geometry mode for the para- !
! meters. !
! !
! gmode_dim1 unsigned int(64 bit) - Defines the geometry mode for the first !
! spatial dimension. !
! !
! gmode_dim2 unsigned int(64 bit) - Defines the geometry mode for the sec- !
! ond spatial dimension. !
! !
! gmode_dim3 unsigned int(64 bit) - Defines the geometry mode for the third !
! spatial dimension. !
! !
! size_time unsigned int(64 bit) - Defines the geometry array size for the !
! temporal dimension. !
! !
! size_parameter unsigned int(64 bit) - Defines the geometry array size for the !
! parameters. !
! !
! size_dim1 unsigned int(64 bit) - Defines the geometry array size for the !
! first spatial dimension. !
! !
! size_dim2 unsigned int(64 bit) - Defines the geometry array size for the !
! second spatial dimension. !
! !
! size_dim3 unsigned int(64 bit) - Defines the geometry array size for the !
! third spatial dimension. !
! !
! udef_param unsigned int(64 bit) - Defines a marker used to signal which !
! user defined parameters are present in !
! the eas3 file. !
! !
! udef_char_size unsigned int(64 bit) - Defines the size for the user defined !
! char array. !
! !
! udef_int_size unsigned int(64 bit) - Defines the size for the user defined !
! int array. !
! !
! udef_real_size unsigned int(64 bit) - Defines the size for the user defined !
! real array. !
! !
! DEPENDENCIES: !
! ------------- !
! Variable Type Description !
! -------- ---- ----------- !
! - - - !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 20.06.2018 Patrick Vogler B87D120 V 0.1.0 struct created !
! !
\*----------------------------------------------------------------------------------------------------------*/
uint64 udef_param; // Signals user def. parameters present
uint64 udef_char_size; // Size of user defined char. array
uint64 udef_int_size; // Size of user defined int. array
uint64 udef_real_size; // Size of user defined real array
} eas3_std_params;
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! This structure is used to store all the necessary parameters required to access !
! parameters stored in an eas3 file. !
! !
\*----------------------------------------------------------------------------------------------*/
typedef struct
{
uint64_t file_type;
uint64_t accuracy;
uint64_t nzs;
uint64_t npar;
uint64_t ndim1;
uint64_t ndim2;
uint64_t ndim3;
uint64_t attribute_mode;
uint64_t gmode_time;
uint64_t gmode_param;
uint64_t gmode_dim1;
uint64_t gmode_dim2;
uint64_t gmode_dim3;
uint64_t size_time;
uint64_t size_parameter;
uint64_t size_dim1;
uint64_t size_dim2;
uint64_t size_dim3;
uint64_t udef_param;
uint64_t udef_char_size;
uint64_t udef_int_size;
uint64_t udef_real_size;
} eas3_std_params;
/************************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: bwc_data* read_eas3(const char* const filename) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function opens an eas3 file and checks it for its validity. Once the specified file !
! has been verified, its header and flow field data is read and stored in the bwc_data !
! structure. !
! !
\*----------------------------------------------------------------------------------------------------------*/
bwc_data*
read_eas3(char *const filename);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: uchar write_eas3(bwc_data *const file, char *const filename) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function creates a valid eas3 file from the information stored in the bwc_data !
! structure. !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
write_eas3(bwc_data *const file, char *const filename);
uint64 *offset; // Offset of a parameter in a eas3 file
} eas3_file_util;
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************/
uchar open_eas3 (bwc_field *const field,
char const *const filename,
char const *mode);
//==========|==========================|======================|======|=======|====================
uchar load_eas3 (bwc_field *const field,
char const *const filename);
//==========|==========================|======================|======|=======|====================
uchar unload_eas3 (bwc_field *const field,
char const *const filename);
#endif

View file

@ -0,0 +1,70 @@
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| ||
|| This file defines simple read and write functions used to access conforming ||
|| netCDF datasets. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| 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 following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other ||
|| materials provided with the distribution. ||
|| ||
|| 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 THE ||
|| COPYRIGHT HOLDER 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. ||
|| ||
\*================================================================================================*/
#ifndef NETCDF_H
#define NETCDF_H
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************/
#include <bwc.h>
#include <stdio.h>
#include "utilities.h"
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************/
bwc_data* read_netCDF (char *const filename);
//==========|==========================|======================|======|=======|====================
uchar write_netCDF (bwc_data *const file,
char *const filename);
#endif

78
include/library/private/IO.h Executable file
View file

@ -0,0 +1,78 @@
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| ||
|| This file defines simple read and write functions used to access conforming bwc ||
|| datasets. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| 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 following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other ||
|| materials provided with the distribution. ||
|| ||
|| 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 THE ||
|| COPYRIGHT HOLDER 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. ||
|| ||
\*================================================================================================*/
#ifndef IO_H
#define IO_H
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************/
#include "types.h"
#ifdef BWC_EAS3
#include "eas3.h"
#endif
#ifdef BWC_NETCDF
#include "netcdf.h"
#endif
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************/
uchar open_bwc (bwc_field *const field,
char const *const filename,
char const *mode);
//==========|==========================|======================|======|=======|====================
uchar load_bwc (bwc_field *const field,
char const *const filename);
//==========|==========================|======================|======|=======|====================
uchar unload_bwc (bwc_field *const field,
char const *const filename);
#endif

View file

@ -54,71 +54,41 @@
\************************************************************************************************/
#include "types.h"
/************************************************************************************************\
|| ___ ____ ____ ____ _ _ _ ____ ___ ___ _ _ ___ ____ ____ ||
|| | \ |___ |__/ |__/ | | | |___ | \ | \_/ |__] |___ [__ ||
|| |__/ |___ | \ | \ | \/ |___ |__/ | | | |___ ___] ||
|| ||
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! This structure is used to read/assemble a packed codestream during coding. The !
! byte buffer is flushed to the packed stream as soon as the a single byte has !
! been assembled. !
! !
\*----------------------------------------------------------------------------------------------*/
typedef struct
{
uchar error; // Error flag used during streaming.
uint64 L; // Number of bytes written to/from stream.
uint64 Lmax; // Size of packed stream.
uint64 size_incr; // Size incrmnt used for stream assembly.
uint8 T; // Byte buffer.
int8 t; // Byte buffer counter.
uchar *memory; // Memory handle for packed stream chunck.
} bitstream;
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************/
uint64 bytes_used (bitstream const *const stream);
uint64 bytes_used (bwc_stream const *const stream);
//==========|==========================|======================|======|======|=====================
bitstream* init_stream (uchar *const memory,
bwc_stream* init_stream (uchar *const memory,
uint32 const size,
char const instr);
//==========|==========================|======================|======|======|=====================
void emit_chunck (bitstream *const stream,
void emit_chunck (bwc_stream *const stream,
uchar const *const chunck,
uint64 const size);
//==========|==========================|======================|======|======|=====================
void emit_symbol (bitstream *const stream,
void emit_symbol (bwc_stream *const stream,
uint64 const symbol,
uint8 const size);
//==========|==========================|======================|======|======|=====================
void emit_bit (bitstream *const stream,
void emit_bit (bwc_stream *const stream,
uint64 const bit);
//==========|==========================|======================|======|======|=====================
void flush_stream (bitstream *const stream);
void flush_stream (bwc_stream *const stream);
//==========|==========================|======================|======|======|=====================
uchar* get_chunck (bitstream *const stream,
uchar* get_chunck (bwc_stream *const stream,
uint64 const length);
//==========|==========================|======================|======|======|=====================
uint64 get_symbol (bitstream *const stream,
uint64 get_symbol (bwc_stream *const stream,
uint8 const length);
//==========|==========================|======================|======|======|=====================
uchar get_bit (bitstream *const stream);
uchar get_bit (bwc_stream *const stream);
//==========|==========================|======================|======|======|=====================
uchar terminate_stream (bitstream *stream,
bwc_stream *const packed_stream);
uchar terminate_stream (bwc_stream *stream,
bwc_packed_stream *const packed_stream);
//==========|==========================|======================|======|======|=====================
void release_packed_stream (bwc_stream *const stream);
#endif
void release_packed_stream (bwc_packed_stream *const stream);
#endif

View file

@ -46,7 +46,6 @@
\*================================================================================================*/
#ifndef CODESTREAM_H
#define CODESTREAM_H
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
@ -54,34 +53,6 @@
|| ||
\************************************************************************************************/
#include "types.h"
#include "bitstream.h"
/************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These macros define stream manipulation operations to rewind, forward, inquire !
! the availability and get access to the current memory position of a bitstrean. !
! !
\*----------------------------------------------------------------------------------------------*/
#define rewind_stream(stream, delta) \
{ \
stream->L -= delta; \
}
#define forward_stream(stream, delta) \
{ \
stream->L += delta; \
}
#define get_access(stream) (uchar*)stream->memory + stream->L
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
@ -89,16 +60,11 @@
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************/
uchar assemble_main_header (bwc_field *const field);
void free_bwc (bwc_field *const field);
//==========|==========================|======================|======|======|=====================
uchar codestream_write_aux (bwc_stream *const header,
bwc_stream *const aux);
uchar assemble_tile (bwc_field *const field);
//==========|==========================|======================|======|======|=====================
uchar codestream_write_com (bwc_stream *const header,
bwc_stream *const com);
uchar initialize_main_header (bwc_field *const field);
//==========|==========================|======================|======|======|=====================
bwc_stream* assemble_codestream (bwc_field *const field);
//==========|==========================|======================|======|======|=====================
bwc_field* parse_codestream (bwc_data *const data,
uint8 const layer);
uchar finalize_main_header (bwc_field *const field);
#endif

View file

@ -68,11 +68,7 @@
\*----------------------------------------------------------------------------------------------*/
typedef enum
{
bwc_prog_LRCP, // Layer / Resolution / Parameter / Packet
bwc_prog_RLCP, // Resolution / Layer / Parameter / Packet
bwc_prog_RPCL, // Resolution / Packet / Parameter / Layer
bwc_prog_PCRL, // Packet / Parameter / Resolution / Layer
bwc_prog_CPRL // Parameter / Packet / Resolution / Layer
bwc_prog_LRCP // Layer / Resolution / Parameter / Packet
} bwc_prog_ord;
/*----------------------------------------------------------------------------------------------*\
@ -103,19 +99,4 @@
bwc_tile_sizeof, // Tiling defined by size of one tile
bwc_tile_numbof, // Tiling defined by the number of tiles
} bwc_tile_instr;
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These constants are used to signal the dataset sample precision. !
! !
\*----------------------------------------------------------------------------------------------*/
typedef enum
{
bwc_type_half,
bwc_type_single,
bwc_type_double,
} bwc_type;
#endif

View file

@ -53,7 +53,6 @@
|| ||
\************************************************************************************************/
#include "types.h"
/************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
@ -148,7 +147,6 @@
\*----------------------------------------------------------------------------------------------*/
extern double DWT_ENERGY_GAIN_LUT[3][2 * MAX_DECOMP_LEVELS + 2];
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
@ -161,9 +159,9 @@
uchar const highband_flag,
uint16 const level);
//==========|==========================|======================|======|=======|====================
uchar forward_wavelet_transform (bwc_field *const field,
bwc_parameter *const parameter);
uchar forward_wavelet_transform (bwc_field *const field,
uint16 const parID);
//==========|==========================|======================|======|=======|====================
uchar inverse_wavelet_transform (bwc_field *const field,
bwc_parameter *const parameter);
uint16 const parID);
#endif

View file

@ -0,0 +1,128 @@
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| ||
|| Big Whoop is a compression codec for the lossy compression of IEEE 754 floating ||
|| point arrays defined on curvelinear compute grids. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| 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 following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other ||
|| materials provided with the distribution. ||
|| ||
|| 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 THE ||
|| COPYRIGHT HOLDER 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. ||
|| ||
\*================================================================================================*/
#ifndef BWC_H
#define BWC_H
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************/
#include "types.h"
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************/
uchar create_field (bwc_field *const field);
//==========|==========================|======================|======|=======|====================
uchar adapt_tile (bwc_field *const field,
uint64 const index);
//==========|==========================|======================|======|=======|====================
bwc_field* bwc_create_field ();
//==========|==========================|======================|======|=======|====================
void bwc_free_field (bwc_field *const field);
//==========|==========================|======================|======|=======|====================
void bwc_add_param (bwc_field *const field,
char const *const name,
uint16 const sample,
uchar const dim,
uint8 const precision);
//==========|==========================|======================|======|=======|====================
void bwc_set_tiles (bwc_field *const field,
uint64 const tilesX,
uint64 const tilesY,
uint64 const tilesZ,
uint64 const tilesTS,
bwc_tile_instr const instr);
//==========|==========================|======================|======|=======|====================
void bwc_set_kernels (bwc_field *const field,
bwc_dwt_filter const KernelX,
bwc_dwt_filter const KernelY,
bwc_dwt_filter const KernelZ,
bwc_dwt_filter const KernelTS);
//==========|==========================|======================|======|=======|====================
void bwc_set_decomp (bwc_field *const field,
uint8 const numDecompX,
uint8 const numDecompY,
uint8 const numDecompZ,
uint8 const numDecompTS);
//==========|==========================|======================|======|=======|====================
void bwc_set_precincts (bwc_field *const field,
uint8 const pX,
uint8 const pY,
uint8 const pZ,
uint8 const pTS);
//==========|==========================|======================|======|=======|====================
void bwc_set_codeblocks (bwc_field *const field,
uint8 const cbX,
uint8 const cbY,
uint8 const cbZ,
uint8 const cbTS);
//==========|==========================|======================|======|=======|====================
void bwc_set_progression (bwc_field *const field,
bwc_prog_ord const progression);
//==========|==========================|======================|======|=======|====================
void bwc_set_error_resilience (bwc_field *const field);
//==========|==========================|======================|======|=======|====================
void bwc_set_quant_style (bwc_field *const field,
bwc_quant_st const quantization_style);
//==========|==========================|======================|======|=======|====================
void bwc_set_qm (bwc_field *const field,
uint8 const Qm);
//==========|==========================|======================|======|=======|====================
void bwc_set_quant_step_size (bwc_field *const field,
double delta);
//==========|==========================|======================|======|=======|====================
#if defined(_OPENMP)
void bwc_set_nThreads (bwc_field *const field,
uint8 const nThreads);
#endif
//==========|==========================|======================|======|=======|====================
void bwc_set_memory_limit (bwc_field *const field,
char *const limit);
#endif

View file

@ -50,11 +50,6 @@
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************/
#include "bitstream.h"
#include "codestream.h"
#include "constants.h"
#include "macros.h"
#include "mq_types.h"
#include "types.h"
/************************************************************************************************\
@ -63,93 +58,16 @@
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************/
uchar bwc_open_file (bwc_field *const field,
char const *const filename,
char const *const mode);
//==========|==========================|======================|======|=======|====================
bwc_data* bwc_initialize_data (double *const field,
uint64 const nX,
uint64 const nY,
uint64 const nZ,
uint16 const nTS,
uint8 const nPar,
char *const file_extension);
//==========|==========================|======================|======|=======|====================
uchar bwc_set_com (bwc_data *const data,
char const *const com,
uint16 const size);
//==========|==========================|======================|======|=======|====================
uchar bwc_set_aux (bwc_data *const data,
char const *const aux,
uint32 const size);
//==========|==========================|======================|======|=======|====================
void bwc_add_param (bwc_data *const data,
char *const name,
uint8 const precision);
//==========|==========================|======================|======|=======|====================
void bwc_get_data (bwc_data *const data,
uchar *const buffer,
uint64 const size);
//==========|==========================|======================|======|=======|====================
void bwc_free_data (bwc_data *const data);
//==========|==========================|======================|======|=======|====================
uchar create_field (bwc_field *const field);
//==========|==========================|======================|======|=======|====================
void bwc_kill_compression (bwc_field *const field);
//==========|==========================|======================|======|=======|====================
bwc_field* bwc_initialize_field (bwc_data *const data);
//==========|==========================|======================|======|=======|====================
void bwc_set_error_resilience (bwc_field *const field);
//==========|==========================|======================|======|=======|====================
void set_quant_style (bwc_field *const field,
bwc_quant_st const quantization_style);
//==========|==========================|======================|======|=======|====================
void set_quant_step_size (bwc_field *const field,
double const delta);
//==========|==========================|======================|======|=======|====================
void set_progression (bwc_field *const field,
bwc_prog_ord const progression);
//==========|==========================|======================|======|=======|====================
void set_kernels (bwc_field *const field,
bwc_dwt_filter const KernelX,
bwc_dwt_filter const KernelY,
bwc_dwt_filter const KernelZ,
bwc_dwt_filter const KernelTS);
//==========|==========================|======================|======|=======|====================
void bwc_set_decomp (bwc_field *const field,
uint8 const decompX,
uint8 const decompY,
uint8 const decompZ,
uint8 const decompTS);
//==========|==========================|======================|======|=======|====================
void bwc_set_precincts (bwc_field *const field,
uint8 const pX,
uint8 const pY,
uint8 const pZ,
uint8 const pTS);
//==========|==========================|======================|======|=======|====================
void bwc_set_codeblocks (bwc_field *const field,
uint8 const cbX,
uint8 const cbY,
uint8 const cbZ,
uint8 const cbTS);
//==========|==========================|======================|======|=======|====================
void bwc_set_qm (bwc_field *const field,
uint8 const Qm);
//==========|==========================|======================|======|=======|====================
void bwc_set_tiles (bwc_field *const field,
uint64 const tilesX,
uint64 const tilesY,
uint64 const tilesZ,
uint64 const tilesTS,
bwc_tile_instr const instr);
//==========|==========================|======================|======|=======|====================
uchar bwc_create_compression (bwc_field *const field,
char *const rate_control);
uchar bwc_load_file (bwc_field *const field,
char const *const filename);
//==========|==========================|======================|======|=======|====================
uchar bwc_compress (bwc_field *const field,
bwc_data *const data);
char *const rate_control);
//==========|==========================|======================|======|=======|====================
bwc_field* bwc_create_decompression (bwc_data *const data,
uchar bwc_decompress (bwc_field *const field,
uint8 const layer);
//==========|==========================|======================|======|=======|====================
uchar bwc_decompress (bwc_field *const field,
bwc_data *const data);
#endif

View file

@ -48,7 +48,64 @@
! DESCRIPTION: !
! ------------ !
! !
! These constants are used to identify the spatial and temporal dimensions. !
! These macros define flags used to indicate if a dataset is to be red from/ !
! written to a file or cleared in the bwc_file structure. !
! !
\*----------------------------------------------------------------------------------------------*/
#define DATA_CLR 0x00 // Data cleared
#define DATA_INI 0x01 // Data file has been initialized
#define DATA_IN 0x10 // Data set as input
#define DATA_OUT 0x20 // Data set as output
#define DATA_STR 0x40 // Data set to be streamed to/from file
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These macros define flags used to indicate if a codestream is to be red from/ !
! written to a file or cleared in the bwc_file structure. !
! !
\*----------------------------------------------------------------------------------------------*/
#define CS_CLR 0x00 // Codestream cleared
#define CS_AUX 0x01 // Codestream contains aux. information
#define CS_COM 0x02 // Codestream contains com. information
#define CS_IN 0x10 // Codestream set as input
#define CS_OUT 0x20 // Codestream set as output
#define CS_STR 0x40 // Codestream to be streamed to/from file
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These macros define flags used to indicate the state of the setup structure in !
! the bwc_field structure. !
! !
\*----------------------------------------------------------------------------------------------*/
#define SETUP_CLR 0x00 // Setup cleared
#define SETUP_CMP 0x01 // Setup defined for compression
#define SETUP_DCP 0x02 // Setup defined for decompression
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These macros define flags used to indicate the state of the bwc_field structure. !
! !
\*----------------------------------------------------------------------------------------------*/
#define FIELD_CLR 0x00 // Field cleared and ready to be used
#define FIELD_USD 0x01 // Field setup up for (de)compression
#define FIELD_ERR 0x02 // Field encountered an error
#define FIELD_VRB 0x10 // Store miscallaneous information
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These macros are used to identify the spatial and temporal dimensions. !
! !
\*----------------------------------------------------------------------------------------------*/
#define DIM_X 1 // 1st. spacial direction
@ -68,12 +125,13 @@
#define SOC 0xFF50 // Start of codestream
#define SGI 0xFF51 // Global data-set information
#define SGC 0xFF52 // Global control parameters
#define SAX 0xFF53 // Auxiliary data-set information
#define TLM 0xFF54 // Packet lengths: main header
#define PLM 0xFF55 // Packet lengths: tile-part
#define PPM 0xFF56 // Quantization default
#define COM 0xFF57 // Comment
#define EOH 0xFF58 // End of header
#define SGR 0xFF53 // Global tile bitstream size information
#define SAX 0xFF54 // Auxiliary data-set information
#define TLM 0xFF55 // Packet lengths: main header
#define PLM 0xFF56 // Packet lengths: tile-part
#define PPM 0xFF57 // Quantization default
#define COM 0xFF58 // Comment
#define EOH 0xFF59 // End of header
#define PLT 0xFF60 // Packed packet headers: main header
#define PPT 0xFF61 // Packed packet headers: tile-part
#define SOT 0xFF90 // Start of tile
@ -82,7 +140,6 @@
#define SOD 0xFF93 // Start of data
#define EOC 0xFFFF // End of code-stream
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
@ -95,6 +152,7 @@
#define CODESTREAM_ERROR 0x80 // Error detexted in Codestream
#define CODESTREAM_SGI_READ 0x01 // Global data-set information read
#define CODESTREAM_SGC_READ 0x02 // Global control parameters read
#define CODESTREAM_SGR_READ 0x04 // Global register read
#define CODESTREAM_SAX_READ 0x08 // Auxiliary information block read
#define CODESTREAM_COM_READ 0x10 // Comment block read
@ -114,10 +172,26 @@
! DESCRIPTION: !
! ------------ !
! !
! This macro is used to evaluate the size of an array. !
! These macros define stream manipulation operations to rewind, forward, inquire !
! the availability and get access to the current memory position of a bwc_stream. !
! !
\*----------------------------------------------------------------------------------------------*/
#define GET_DIM(x) (sizeof(x)/sizeof(*(x)))
#define REWIND(stream, delta) \
{ \
stream->L -= delta; \
}
#define FORWARD(stream, delta) \
{ \
stream->L += delta; \
}
#define CAN_READ(stream, length) \
{ \
((stream->L + length > stream->Lmax) ? FAILURE : SUCCESS) \
}
#define GET_ACCESS(stream) (uchar*)stream->memory + stream->L
/*----------------------------------------------------------------------------------------------*\
! !
@ -127,11 +201,35 @@
! These Constants define common error messages used throughout the bwc library. !
! !
\*----------------------------------------------------------------------------------------------*/
#define MEMERROR "o##########################################################o\n"\
"| ERROR: Out of memory |\n"\
"o##########################################################o\n"
#define CSTERROR "o##########################################################o\n"\
"| ERROR: Invalid Codestream |\n"\
"o##########################################################o\n"
#define CSERROR "o##########################################################o\n"\
"| ERROR: Invalid Codestream |\n"\
"o##########################################################o\n"
#define FRMERROR "o##########################################################o\n"\
"| ERROR: Invalid file format. |\n"\
"o##########################################################o\n"
#define INPERROR "o##########################################################o\n"\
"| ERROR: No Input Specified. |\n"\
"o##########################################################o\n"
#define MEMERROR "o##########################################################o\n"\
"| ERROR: Out of Memory |\n"\
"o##########################################################o\n"
#define PARERROR "o##########################################################o\n"\
"| ERROR: Invalid Parameter |\n"\
"o##########################################################o\n"
#define PRCERROR "o##########################################################o\n"\
"| ERROR: Invalid Parameter Precision |\n"\
"o##########################################################o\n"
#define RDERROR "o##########################################################o\n"\
"| ERROR: Invalid Number of Bytes Read from File. |\n"\
"o##########################################################o\n"
#define WRTERROR "o##########################################################o\n"\
"| ERROR: Invalid Number of Bytes Written to File. |\n"\
"o##########################################################o\n"
#endif

View file

@ -50,8 +50,8 @@
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************/
#include "tier1.h"
#include "types.h"
#include "tier1.h"
#include "types.h"
/************************************************************************************************\
|| ____ ____ _ _ ____ ___ ____ _ _ ___ ____ ||
@ -82,13 +82,13 @@
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************/
uchar initialize_mq_encoder (bwc_coder *const coder,
uint8 const number_of_contexts);
uchar initialize_mq_encoder (bwc_coder *const coder,
uint8 const numContexts);
//==========|==========================|======================|======|=======|====================
uchar mq_next_run (bwc_bit_coder *const bitcoder);
//==========|==========================|======================|======|=======|====================
void mq_bit_encode (bwc_bit_coder *const bitcoder,
uint8 const s,
uint8 const s,
uint8 const k);
//==========|==========================|======================|======|=======|====================
void mq_truncation_length_min (bwc_coder_state *const state);
@ -98,7 +98,7 @@
void free_mq_encoder (bwc_coder *const coder);
//==========|==========================|======================|======|=======|====================
uchar initialize_mq_decoder (bwc_coder *const coder,
uint8 const number_of_contexts,
uint8 const numContexts,
int64 const Lmax);
//==========|==========================|======================|======|=======|====================
uint8 mq_bit_decode (bwc_bit_coder *const bitcoder,
@ -107,8 +107,8 @@
uint64 mq_get_no_bytes (bwc_bit_coder *const bitcoder);
//==========|==========================|======================|======|=======|====================
void mq_get_pass_lengths (bwc_bit_coder *const bitcoder,
bwc_encoded_cblk *const encoded_cblk);
bwc_encoded_blk *const encoded_cblk);
//==========|==========================|======================|======|=======|====================
void mq_reset_ptr (bwc_bit_coder *const bitcoder,
void mq_reset_ptr (bwc_bit_coder *const bitcoder,
uchar *const memory);
#endif

View file

@ -59,7 +59,6 @@
|| ||
\************************************************************************************************/
#include "types.h"
#include "bitstream.h"
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
@ -69,28 +68,27 @@
\************************************************************************************************/
void kill_tagtree (bwc_tagtree *const tagtree);
//==========|==========================|======================|======|=======|====================
void reset_tagtree (bwc_tagtree *const tagtree);
//==========|==========================|======================|======|=======|====================
bwc_tagtree* initialize_tagtree (uint64 const leafsX,
uint64 const leafsY,
uint64 const leafsZ,
uchar initialize_tagtree (bwc_tagtree *const tagtree,
uint64 const leafsX,
uint64 const leafsY,
uint64 const leafsZ,
uint64 const leafsTS);
//==========|==========================|======================|======|=======|====================
uint16 tagtree_get_value (bwc_tagtree const *const tagtree,
uint64 const leaf_index);
//==========|==========================|======================|======|=======|====================
void tagtree_set_value (bwc_tagtree *const tagtree,
uint64 const leaf_index,
uint64 const leaf_index,
uint16 const value);
//==========|==========================|======================|======|=======|====================
void encode_tagtree (bwc_tagtree *const tagtree,
bitstream *const stream,
void encode_tagtree (bwc_tagtree *const tagtree,
bwc_stream *const stream,
uint32 const threshold,
uint32 const leaf_index,
uchar const estimate);
//==========|==========================|======================|======|=======|====================
uchar decode_tagtree (bwc_tagtree *const tagtree,
bitstream *const stream,
uchar decode_tagtree (bwc_tagtree *const tagtree,
bwc_stream *const stream,
uint32 const threshold,
uint32 const leaf_index);
#endif

View file

@ -54,24 +54,6 @@
\************************************************************************************************/
#include "types.h"
/************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! The macros listed indicate how many bits, from the current coding position, !
! are used for error evaluation in the coding passes. !
! !
\*----------------------------------------------------------------------------------------------*/
#define DISTORTION_SIG 5 // Clean up/significance propagation pass.
#define DISTORTION_MAG 6 // Magnitude refinement pass.
/************************************************************************************************\
|| ___ ____ ____ ____ _ _ _ ____ ___ ___ _ _ ___ ____ ____ ||
|| | \ |___ |__/ |__/ | | | |___ | \ | \_/ |__] |___ [__ ||
@ -83,30 +65,38 @@
! DESCRIPTION: !
! ------------ !
! !
! This structure holds the sign (xi), bitfield (bit) and state (delta, sigma and !
! pi) information for four vertically adjacent samples for easy access during the !
! entropy encoding stage. Here, the delayed significance is set once the first bit !
! is encoded during the magnitude refinement pass, while the significance state !
! sigma is set once the first non-zero bit is encoded for a specific sample. !
! The stripe_* pointers are used to store the address of the left(l), upper(u), !
! right(r) and lower(d) neighbour of a specific stripe for easy access. To !
! facilitate distortion estimation the magnitude of the wavelet coefficients is !
! stored in an appropriate sample array. !
! DESCRIPTION NEEDED !
! | | !
! !
\*----------------------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! This structure holds the sign (xi), bitfield (bit) and state (delta, sigma and pi) !
! information for four vertically adjacent samples for easy access during the !
! entropy encoding stage. Here, the delayed significance is set once the first bit !
! is encoded during the magnitude refinement pass, while the significance state !
! sigma is set once the first non-zero bit is encoded for a specific sample. !
! The stripe_* pointers are used to store the address of the left(l), upper(u), !
! right(r) and lower(d) neighbour of a specific stripe for easy access. To !
! facilitate distortion estimation the magnitude of the wavelet coefficients is !
! stored in an appropriate sample array. !
! !
\*------------------------------------------------------------------------------------------------------------------*/
typedef struct stripe
{
uint64 *sample; // Wavelet coef. for two adjacent stripes.
uint64 *sample; // Wavelet coeff. for two adjacent stripes.
uint8 delta; // Delayed sig. for two adjacent stripes.
uint8 sigma; // Significance for two adjacent stripes.
uint8 pi; // Cdng pass membership for adj. stripes.
uint8 pi; // Coding pass membership for adj. stripes.
uint8 codingpass; // Last decoded coding pass.
uint8 bitplane; // Last decoded bitplane.
uint8 *bit; // Bitplanes for vertically adj. stripes.
uint8 xi; // Wvlt coef. sign bit for adj. stripes.
uint8 xi; // Wavelet coef. sign bit for adj. stripes.
struct stripe *stripe_u; // Upper stripe.
struct stripe *stripe_r; // Right stripe.
@ -119,26 +109,32 @@
! DESCRIPTION: !
! ------------ !
! !
! This structure accumulates all necessary structures used to (de-)compress a !
! codeblock of wavelet coefficients. The spatial and temporal dimension of the !
! codeblock is defined by its width, height and number of slices (depth * dt). The !
! codeblock itself is subdivided into so-called stripes that represent 4 vertical- !
! ly adjacent coefficients. The parameter no_full_stripes stores overnumber of !
! full stripes present in one slice. !
! The look-up table sig2context is used to determine the coding context of a cur- !
! ren bit according to its significance context within the codeblock bitplane. !
! The look-up table is specific to a certain highband and is set accordingly. !
! DESCRIPTION NEEDED !
! | | !
! !
\*----------------------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! This structure accumulates all necessary structures used to (de-)compress a !
! codeblock of wavelet coefficients. The spatial and temporal dimension of the !
! codeblock is defined by its width, height and number of slices (depth * dt). The !
! codeblock itself is subdivided into so-called stripes that represent 4 vertically !
! adjacent coefficients. The parameter no_full_stripes stores overnumber of full !
! stripes present in one slice. !
! The look-up table sig2context is used to determine the coding context of a current !
! bit according to its significance context within the codeblock bitplane. The !
! look-up table is specific to a certain highband and is set accordingly. !
! !
\*------------------------------------------------------------------------------------------------------------------*/
typedef struct
{
uchar highband_flag; // Flag indicating current wavelet subbnd.
uint8 K; // Idx of the first significant bitplane.
uchar erres; // Flag signaling error resilience.
uchar resilience; // Flag signaling error resilience.
uint64 no_full_stripe; // Number of full, vert. adjacent stripes.
uint64 width, height; // Codeblock width and height.
uint64 no_slice; // N.o. slices in the spec. codeblock.
uint64 no_slice; // Number of slices in the spec. codeblock.
uint8 const *sig2context; // Signifance-to-context loop-up table.
bwc_bit_coder *bitcoder; // BWC bitcoder.
@ -157,12 +153,8 @@
|| ||
\************************************************************************************************/
uchar t1_encode (bwc_field *const field,
bwc_tile *const tile,
bwc_parameter *const parameter);
uint16 const parID);
//==========|==========================|======================|======|=======|====================
uchar t1_decode (bwc_field *const field,
bwc_tile *const tile,
bwc_parameter *const parameter);
uint16 const parID);
#endif

View file

@ -76,11 +76,9 @@
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************/
uchar t2_encode (bwc_field *const field,
bwc_tile *const tile);
uchar t2_encode (bwc_field *const field);
//==========|==========================|======================|======|=======|====================
uchar parse_packet (bwc_field *const field,
bwc_tile *const tile,
bwc_packet *const packet,
bwc_packet *const packet,
uint64 const body_size);
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,350 +1,102 @@
/*====================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| This is a simple command line tool that uses the Big Whoop library to (de)com- ||
|| press a 2- to 4-dimensional IEEE 754 floating point array. For further infor- ||
|| mation use the --help (-h) argument in the command-line or consult the appro- ||
|| priate README file. ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| DESCRIPTION NEEDED. ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description ||
|| ---- ------ --------- ------- ----------- ||
|| 13.10.2017 Patrick Vogler B87D120 V 0.1.0 source file created ||
|| 26.11.2020 Patrick Vogler B87E7E4 V 0.1.0 Command line tool refac- ||
|| tored. ||
|| ||
|| ||
|| ------------------------------------------------------------------------------------------------------ ||
|| ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| 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 following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other materials ||
|| provided with the distribution. ||
|| ||
|| 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 THE COPYRIGHT OWNER 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. ||
|| ||
\*====================================================================================================================*/
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| ||
|| This is a simple command line tool that uses the Big Whoop library to (de) ||
|| compress a 2- to 4-dimensional IEEE 754 floating point array. For further ||
|| information use the --help (-h) argument in the command-line or consult the ||
|| appropriate README file. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| 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 following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other ||
|| materials provided with the distribution. ||
|| ||
|| 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 THE ||
|| COPYRIGHT HOLDER 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. ||
|| ||
\*================================================================================================*/
#ifndef BWC_CMDL_H
#define BWC_CMDL_H
/********************************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\********************************************************************************************************************/
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************/
#include <inttypes.h>
/********************************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\********************************************************************************************************************/
/*------------------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! !
! These macros define minimum and maximum operators as well as an operator used !
! to evaluate the size of an array. !
! !
! MACROS: !
! ------- !
! Name Description !
! ---- ----------- !
! MAX(x, y) - Returns the maximum value of !
! two values. !
! !
! MIN(x, y) - Returns the minimum value of !
! two values. !
! !
! GET_LEN(x) - Returns the size of an array. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description !
! ---- ------ --------- ------- ----------- !
! 21.03.2018 Patrick Vogler B87D120 V 0.1.0 macros created !
! 16.09.2019 Patrick Vogler B87E7E4 V 0.1.0 Added GET_LEN(X) macro. !
! !
\*------------------------------------------------------------------------------------------------------------------*/
#define MAX(x, y) (((x) < (y))?(y):(x))
#define MIN(x, y) (((x) > (y))?(y):(x))
/************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! This macro removes a user supplied deliminator from a string: !
! !
! 9/9/7/2 -> 9 9 7 2. !
! !
\*----------------------------------------------------------------------------------------------*/
#define remove_deliminator(arg, end, delim) \
{ \
for(end = arg; *end; end++) \
*end = (*end == delim ? ' ' : *end); \
}
/*------------------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! !
! These Constants define codestream markers used to create the embedded code- !
! stream. !
! !
! MACROS: !
! ------- !
! Name Description !
! ---- ----------- !
! SOC - Start of code-stream !
! SGI - Global data-set information !
! SGC - Global control parameters !
! SGR - Global register containing tile !
! bitstream size information !
! SAX - Auxiliary data-set information !
! TLM - Packet lengths: main header !
! PLM - Packet lengths: tile-part !
! PPM - Quantization default !
! COM - Comment !
! EOH - End of header !
! PLT - Packed packet headers: main header !
! PPT - Packed packet headers: tile-part !
! SOT - Start of tile !
! SOP - Start of packet !
! EPH - End of packet header !
! SOD - Start of data !
! EOC - End of code-stream !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description !
! ---- ------ --------- ------- ----------- !
! 01.12.2017 Patrick Vogler B87D120 V 0.1.0 macros created !
! !
\*------------------------------------------------------------------------------------------------------------------*/
#define SOC 0xFF50
#define SGI 0xFF51
#define SGC 0xFF52
#define SAX 0xFF53
#define TLM 0xFF54
#define PLM 0xFF55
#define PPM 0xFF56
#define COM 0xFF57
#define EOH 0xFF58
#define PLT 0xFF60
#define PPT 0xFF61
#define SOT 0xFF90
#define SOP 0xFF91
#define EPH 0xFF92
#define SOD 0xFF93
#define EOC 0xFFFF
/*------------------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! !
! These macros define flags used for codestream parsing. !
! !
! MACROS: !
! ------- !
! Name Description !
! ---- ----------- !
! CODESTREAM_OK - No errors detected in Codestream !
! !
! CODESTREAM_READ - Codestream has been fully read. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description !
! ---- ------ --------- ------- ----------- !
! 01.08.2019 Patrick Vogler B87D120 V 0.1.0 macros created !
! !
\*------------------------------------------------------------------------------------------------------------------*/
#define CODESTREAM_OK 0x00
#define CODESTREAM_READ 0x80
/*------------------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! !
! These Constants define common error messages used throughout the bwc library. !
! !
! MACROS: !
! ------- !
! Name Description !
! ---- ----------- !
! CSTERROR - Codestream parser has encoun- !
! tered invalid marker. !
! !
! MEMERROR - Allocation has returned a NULL !
! pointer due to limited memory. !
! !
! RDERROR - Invalid number of bytes read !
! from file. !
! !
! WRTERROR - Invalid number of bytes writ- !
! ten to file. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description !
! ---- ------ --------- ------- ----------- !
! 01.12.2017 Patrick Vogler B87D120 V 0.1.0 macros created !
! !
\*------------------------------------------------------------------------------------------------------------------*/
#define CSTERROR "o##########################################################o\n"\
"| ERROR: Invalid Codestream |\n"\
"o##########################################################o\n"
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These macros define minimum and maximum operators as well as an operator used !
! to evaluate the size of an array. !
! !
\*----------------------------------------------------------------------------------------------*/
#define MAX(x, y) (((x) < (y))?(y):(x)) // Returns maximum between two values
#define MIN(x, y) (((x) > (y))?(y):(x)) // Returns minimum between two values
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These Constants define common error messages used throughout the bwc library. !
! !
\*----------------------------------------------------------------------------------------------*/
#define MEMERROR "o##########################################################o\n"\
"| ERROR: Out of Memory |\n"\
"o##########################################################o\n"
#define RDERROR "o##########################################################o\n"\
"| ERROR: Invalid Number of Bytes Read from File. |\n"\
"o##########################################################o\n"
#define WRTERROR "o##########################################################o\n"\
"| ERROR: Invalid Number of Bytes Written to File. |\n"\
"o##########################################################o\n"
#define GET_DIM(x) (sizeof(x)/sizeof(*(x)))
/********************************************************************************************************************\
|| ___ ____ ____ ____ _ _ _ ____ ___ ___ _ _ ___ ____ ____ ||
|| | \ |___ |__/ |__/ | | | |___ | \ | \_/ |__] |___ [__ ||
|| |__/ |___ | \ | \ | \/ |___ |__/ | | | |___ ___] ||
|| ||
\********************************************************************************************************************/
/*------------------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! !
! This structure defines the attributes of a single argument supported by the bwc !
! command line tool. !
! !
! PARAMETERS: !
! ----------- !
! Name Type Description !
! ---- ---- ----------- !
! active char - Flag indicating if the argu- !
! ment is active. !
! !
! arg_long char - Long form of the argument name. !
! !
! arg_short char - Short form of the argument !
! name. !
! !
! arg_type char - Flag signaling if the argument !
! is optional. !
! !
! type char - Flag signaling the argument !
! type. !
! !
! usage char - A string of 24 characters de- !
! scribing the argument usage. !
! !
! definition char - A string of 1024 characters !
! containing the argument de- !
! scription. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description !
! ---- ------ --------- ------- ----------- !
! 14.02.2019 Patrick Vogler B87D120 V 0.1.0 struct created !
! 26.11.2020 Patrick Vogler B87E7E4 V 0.1.0 clean up !
! !
\*------------------------------------------------------------------------------------------------------------------*/
typedef struct
{
char active;
char arg_long[25];
char arg_short[3];
char arg_type[4];
char type[5];
char usage[25];
char definition[1024];
} bwc_cmdl_args;
/*------------------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! This structure describes a linked list which stores all the arguments and their !
! attributes supplied to the command line tool by the user. !
! !
! PARAMETERS: !
! ----------- !
! Name Type Description !
! ---- ---- ----------- !
! hash unsigned int(64 bit) - Uniquely identifiable hash that !
! corresponds to the arg/opt name. !
! !
! count unsigned int(8 bit) - Counter that signifies the num- !
! ber of modifier values stored !
! in the linked list node. !
! !
! dim unsigned int(8 bit) - Dimension(s) for which the mod- !
! ifiers have been defined !
! !
! active char - Flag indicating if the arg/opt !
! is active. !
! !
! num_opt double* - Array of numerical modifier !
! values. !
! !
! lit_opt char** - Character array of literal mod- !
! ifier values. !
! !
! DEPENDENCIES: !
! ------------- !
! Name TYPE !
! ---- ---- !
! next opt* !
! !
! root opt* !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description !
! ---- ------ --------- ------- ----------- !
! 26.04.2019 Patrick Vogler B87D120 V 0.1.0 struct created !
! 26.11.2020 Patrick Vogler B87E7E4 V 0.1.0 clean up !
! !
\*------------------------------------------------------------------------------------------------------------------*/
typedef struct arg
{
uint64_t hash;
uint8_t count;
uint8_t dim;
char active;
double *num_opt;
char **lit_opt;
struct arg *next;
struct arg *root;
} bwc_cmdl_arg_node;
#endif

View file

@ -91,16 +91,10 @@ destination = current_path.joinpath('include/library/public')
if os.path.isdir(destination) == False:
os.mkdir(destination)
include_files = ['macros.h', 'constants.h', 'dwt.h', 'tagtree.h', 'mq_types.h', 'mq.h',
'bitstream.h', 'codestream.h', 'tier1.h', 'tier2.h', 'types.h', 'libbwc.h']
exclude_files = ["prim_types_double.h", "prim_types_single.h"]
all_files = [f for f in os.listdir(source) if os.path.isfile(os.path.join(source, f))]
missing_files = [f for f in all_files if f not in include_files and f not in exclude_files]
if missing_files:
raise Warning("Consider updating public_header.py. Missing header file(s)"
f"\n{missing_files}\n"
"should be added to include_files or exclude_files lists.")
print(include_files)
header_files = [f for f in os.listdir(source) if os.path.isfile(os.path.join(source, f))]
header_files.remove('prim_types_double.h')
header_files.remove('prim_types_single.h')
print(header_files)
#----------------------------------------------------------#
# Create the I/O stream and write the bwc file header. #
@ -219,7 +213,7 @@ printFlg = False
buff = ""
brktCnt = 0
for file in include_files:
for file in header_files:
with open(source.joinpath(file)) as f:
for line in f:
if("BWC_" in line):
@ -256,7 +250,7 @@ public_header.write(ubox + tab + sbox + lspaces * " " + "____ ____ _ _ ____ ___
delimFlg = False
buff = ""
for file in include_files:
for file in header_files:
with open(source.joinpath(file)) as f:
for line in f:
if("typedef enum" in line):
@ -294,7 +288,7 @@ preProcFlg = False
buff = ""
brktCnt = 0
for file in include_files:
for file in header_files:
with open(source.joinpath(file)) as f:
for line in f:
if("typedef struct" in line or
@ -317,7 +311,6 @@ for file in include_files:
public_header.write(deliminator)
public_header.write(buff)
delimFlg = True
printFlg = False
buff = ""
f.close
@ -336,10 +329,6 @@ public_header.write("\n" + ubox + tab + sbox + lspaces * " " + "___ _ _ ___ _
tab + sbox + lspaces * " " + "| |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___]" + rspaces * " " + "||\n" +
tab + sbox + (text_width - 2*len(sbox) - len(tab)) * " " + "||\n" + lbox)
public_header.write(tab + "#ifdef __cplusplus\n" +
tab + tab + "extern \"C\" {\n" +
tab + "#endif\n\n")
files = os.listdir("include/library/private")
printFlg = False
ltab = 0
@ -374,10 +363,5 @@ for file in files:
public_header.write(buff)
buff = line
f.close
public_header.write("\n" + tab + "#ifdef __cplusplus\n" +
tab + tab + "}\n" +
tab + "#endif\n")
public_header.write("#endif")
public_header.close

View file

@ -1,421 +0,0 @@
!*================================================================================================*!
!| |!
!| /$$$$$$$ /$$ /$$ /$$ /$$ |!
!| | $$__ $$|__/ | $$ /$ | $$| $$ |!
!| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |!
!| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |!
!| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |!
!| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |!
!| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |!
!| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |!
!| /$$ \ $$ | $$ |!
!| | $$$$$$/ | $$ |!
!| \______/ |__/ |!
!| |!
!| DESCRIPTION: |!
!| ------------ |!
!| |!
!| This file defines a Fortran interface for the Big Whoop compression library. |!
!| |!
!| -------------------------------------------------------------------------------------------- |!
!| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart |!
!| |!
!| 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 following disclaimer. |!
!| |!
!| (2) Redistributions in binary form must reproduce the above copyright notice, this list |!
!| of conditions and the following disclaimer in the documentation and/or other |!
!| materials provided with the distribution. |!
!| |!
!| 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 THE |!
!| COPYRIGHT HOLDER 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. |!
!| |!
!*================================================================================================*!
module bwc
!************************************************************************************************!
!| _ _ _ ____ _ _ _ ___ ____ |!
!| | |\ | | | | | | \ |___ |!
!| | | \| |___ |___ |__| |__/ |___ |!
!| |!
!************************************************************************************************!
use, intrinsic :: iso_c_binding, only: C_PTR, C_INT64_T, C_INT32_T, C_INT16_T, C_INT8_T, &
C_INT, C_DOUBLE, C_CHAR, C_SIGNED_CHAR
IMPLICIT NONE
PRIVATE
!************************************************************************************************!
!| ____ ____ _ _ ____ ___ ____ _ _ ___ ____ |!
!| | | | |\ | [__ | |__| |\ | | [__ |!
!| |___ |__| | \| ___] | | | | \| | ___] |!
!| |!
!************************************************************************************************!
ENUM, BIND(C)
enumerator :: bwc_dwt_9_7 = 0, &
bwc_dwt_5_3 = 1, &
bwc_dwt_haar = 2
END ENUM
!*==============================================================================================*!
ENUM, BIND(C)
enumerator :: bwc_prog_LRCP = 0
END ENUM
!*==============================================================================================*!
ENUM, BIND(C)
enumerator :: bwc_qt_none = 0, &
bwc_qt_derived = 1
END ENUM
!*==============================================================================================*!
ENUM, BIND(C)
enumerator :: bwc_tile_sizeof = 0, &
bwc_tile_numbof = 1
END ENUM
!************************************************************************************************!
!| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ |!
!| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ |!
!| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] |!
!| |!
!************************************************************************************************!
interface
function initialize_data_f(field, nX, nY, nZ, nTS, nPar, file_extension) result(data) &
BIND(C, NAME="bwc_initialize_data")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
TYPE(C_PTR) :: data
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(KIND=C_INT16_T), VALUE :: nX, nY, nZ
INTEGER(KIND=C_INT8_T), VALUE :: nTS, nPar
!*-----------------------*!
! DEFINE CHAR VARIABLES: !
!*-----------------------*!
CHARACTER(KIND=C_CHAR) :: file_extension(*)
end function initialize_data_f
!*============================================================================================*!
subroutine add_param_f(data, name, sample, dim, precision) &
BIND(C, NAME="bwc_add_param")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: data
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(KIND=C_INT16_T), VALUE :: sample
INTEGER(KIND=C_INT8_T), VALUE :: precision
INTEGER(KIND=C_SIGNED_CHAR), VALUE :: dim
!*-----------------------*!
! DEFINE CHAR VARIABLES: !
!*-----------------------*!
CHARACTER(KIND=C_CHAR) :: name(*)
end subroutine add_param_f
!*============================================================================================*!
subroutine get_data_f(data, buffer, size) &
BIND(C, NAME="bwc_get_data")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: data
TYPE(C_PTR), VALUE :: buffer
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(KIND=C_INT64_T), Value :: size
end subroutine get_data_f
!*============================================================================================*!
subroutine free_data_f(data) &
BIND(C, NAME="bwc_free_data")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: data
end subroutine free_data_f
!*============================================================================================*!
subroutine kill_compression_f(field) &
BIND(C, NAME="bwc_kill_compression")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
end subroutine kill_compression_f
!*============================================================================================*!
function initialize_field_f(data) result(field) &
BIND(C, NAME="bwc_initialize_field")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: data
TYPE(C_PTR) :: field
end function initialize_field_f
!*============================================================================================*!
subroutine set_error_resilience_f(field) &
BIND(C, NAME="bwc_set_error_resilience")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
end subroutine set_error_resilience_f
!*============================================================================================*!
subroutine set_quantization_style_f(field, quantization_style) &
BIND(C, NAME="bwc_set_quantization_style")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(KIND=C_INT), VALUE :: quantization_style
end subroutine set_quantization_style_f
!*============================================================================================*!
subroutine set_quantization_step_size_f(field, delta) &
BIND(C, NAME="bwc_set_quantization_step_size")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE FLOAT VARIABLES: !
!*-----------------------*!
REAL(KIND=C_DOUBLE), VALUE :: delta
end subroutine set_quantization_step_size_f
!*============================================================================================*!
subroutine set_progression_f(field, progression) &
BIND(C, NAME="bwc_set_progression")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(KIND=C_INT), VALUE :: progression
end subroutine set_progression_f
!*============================================================================================*!
subroutine set_kernels_f(field, KernelX, KernelY, KernelZ, KernelTS) &
BIND(C, NAME="bwc_set_kernels")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(KIND=C_INT), VALUE :: KernelX, KernelY
INTEGER(KIND=C_INT), VALUE :: KernelZ, KernelTS
end subroutine set_kernels_f
!*============================================================================================*!
subroutine set_decomp_f(field, decompX, decompY, decompZ, decompTS) &
BIND(C, NAME="bwc_set_decomp")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(KIND=C_INT8_T), VALUE :: decompX, decompY
INTEGER(KIND=C_INT8_T), VALUE :: decompZ, decompTS
end subroutine set_decomp_f
!*============================================================================================*!
subroutine set_precincts_f(field, pX, pY, pZ, pTS) &
BIND(C, NAME="bwc_set_precincts")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(KIND=C_INT8_T), VALUE :: pX, pY
INTEGER(KIND=C_INT8_T), VALUE :: pZ, pTS
end subroutine set_precincts_f
!*============================================================================================*!
subroutine set_codeblocks_f(field, cbX, cbY, cbZ, cbTS) &
BIND(C, NAME="bwc_set_codeblocks")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(KIND=C_INT8_T), VALUE :: cbX, cbY
INTEGER(KIND=C_INT8_T), VALUE :: cbZ, cbTS
end subroutine set_codeblocks_f
!*============================================================================================*!
subroutine set_qm_f(field, Qm) &
BIND(C, NAME="bwc_set_qm")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(KIND=C_INT8_T), VALUE :: Qm
end subroutine set_qm_f
!*============================================================================================*!
subroutine set_tiles_f(field, tilesX, tilesY, tilesZ, tilesTS, instr) &
BIND(C, NAME="bwc_set_tiles")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(KIND=C_INT64_T), VALUE :: tilesX, tilesY, tilesZ
INTEGER(KIND=C_INT16_T), VALUE :: tilesTS
INTEGER(KIND=C_INT), VALUE :: instr
end subroutine set_tiles_f
!*============================================================================================*!
function create_compression_f(field, rate_control) result(error_flag) &
BIND(C, NAME="bwc_create_compression")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(KIND=C_INT8_T) :: error_flag
!*-----------------------*!
! DEFINE CHAR VARIABLES: !
!*-----------------------*!
CHARACTER(KIND=C_CHAR) :: rate_control(*)
end function create_compression_f
!*============================================================================================*!
function compress_f(field, data) result(error_flag) &
BIND(C, NAME="bwc_compress")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
TYPE(C_PTR), VALUE :: data
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(KIND=C_INT8_T) :: error_flag
end function compress_f
!*============================================================================================*!
function create_decompression_f(data, layer) result(field) &
BIND(C, NAME="bwc_create_decompression")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR) :: field
TYPE(C_PTR), VALUE :: data
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(KIND=C_INT8_T), VALUE :: layer
end function create_decompression_f
!*============================================================================================*!
function decompress_f(field, data) result(error_flag) &
BIND(C, NAME="bwc_decompress")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
TYPE(C_PTR), VALUE :: data
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(KIND=C_INT8_T) :: error_flag
end function decompress_f
end interface
!************************************************************************************************!
!| _ _ _ ___ ____ ____ ____ ____ ____ ____ |!
!| | |\ | | |___ |__/ |___ |__| | |___ |!
!| | | \| | |___ | \ | | | |___ |___ |!
!| |!
!************************************************************************************************!
public :: bwc_dwt_9_7, &
bwc_dwt_5_3, &
bwc_dwt_haar
public :: bwc_prog_LRCP
public :: bwc_qt_none, &
bwc_qt_derived
public :: bwc_tile_sizeof, &
bwc_tile_numbof
public :: bwc_initialize_data, &
bwc_get_data, &
bwc_free_data
public :: bwc_initialize_field, &
bwc_add_param, &
bwc_kill_compression
public :: bwc_set_error_resilience, &
bwc_set_quantization_style, &
bwc_set_quantization_step_size, &
bwc_set_progression, &
bwc_set_kernels, &
bwc_set_decomp, &
bwc_set_precincts, &
bwc_set_codeblocks, &
bwc_set_qm, &
bwc_set_tiles,
public :: bwc_create_compression, &
bwc_compress, &
bwc_create_decompression, &
bwc_decompress
end module bwc

View file

@ -52,7 +52,7 @@ import ctypes
from numpy.ctypeslib import ndpointer
from enum import Enum
libbwc = ctypes.cdll.LoadLibrary("../../../lib/libbwc.so")
libbwc = ctypes.cdll.LoadLibrary("../lib/libbwc.so")
#**************************************************************************************************#
#| ____ ____ _ _ ____ ___ ____ _ _ ___ ____ |#
@ -84,126 +84,134 @@ const = _const()
#| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] |#
#| |#
#**************************************************************************************************#
def free_data(data):
fun = libbwc.bwc_free_data
fun.restype = None
fun.argtypes = [ctypes.c_void_p]
fun(data)
#==================================================================================================#
def initialize_data(data, nX, nY, nZ, nTS, nPar, file_extension):
fun = libbwc.bwc_initialize_data
def create_field():
fun = libbwc.bwc_create_field
fun.restype = ctypes.c_void_p
fun.argtypes = [ndpointer(ctypes.c_double, flags="C_CONTIGUOUS"),
ctypes.c_uint64,
ctypes.c_uint64,
ctypes.c_uint64,
ctypes.c_uint16,
ctypes.c_uint8,
ctypes.c_char_p]
return ctypes.c_void_p(fun(data, nX, nY, nZ, nTS, nPar, file_extension.encode('utf-8')))
fun.argtypes = None
return ctypes.c_void_p(fun())
#==================================================================================================#
def get_data(data, buffer, size):
fun = libbwc.bwc_get_data
fun.restype = None
fun.argtypes = [ctypes.c_void_p,
ndpointer(ctypes.c_double, flags="C_CONTIGUOUS"),
ctypes.c_uint64]
fun(data, buffer, size)
#==================================================================================================#
def add_param(data, name, sample, dim, precision):
fun = libbwc.bwc_add_param
fun.restype = None
fun.argtypes = [ctypes.c_void_p,
ctypes.c_char_p,
ctypes.c_uint16,
ctypes.c_uint8,
ctypes.c_uint8]
fun(data, name.encode('utf-8'), sample, dim, precision)
#==================================================================================================#
def kill_compression(field):
fun = libbwc.bwc_kill_compression
def free_field(field):
fun = libbwc.bwc_free_field
fun.restype = None
fun.argtypes = [ctypes.c_void_p]
fun(field)
#==================================================================================================#
def initialize_field(data):
fun = libbwc.bwc_initialize_field
fun.restype = ctypes.c_void_p
fun.argtypes = [ctypes.c_void_p]
return ctypes.c_void_p(fun(data))
#==================================================================================================#
def set_codeblocks(field, cbX, cbY, cbZ, cbTS):
fun = libbwc.bwc_set_codeblocks
def add_param(field, name, sample, dim, precision):
fun = libbwc.bwc_add_param
fun.restype = None
fun.argtypes = [ctypes.c_void_p,
ctypes.c_uint8,
ctypes.c_uint8,
ctypes.c_uint8,
ctypes.c_uint8]
fun(field, cbX, cbY, cbZ, cbTS)
#==================================================================================================#
def set_decomp(field, decompX, decompY, decompZ, decompTS):
fun = libbwc.bwc_set_decomp
fun.restype = None
fun.argtypes = [ctypes.c_void_p,
ctypes.c_uint8,
ctypes.c_uint8,
ctypes.c_uint8,
ctypes.c_uint8]
fun(field, decompX, decompY, decompZ, decompTS)
#==================================================================================================#
def set_qm(field, Qm):
fun = libbwc.bwc_set_qm
fun.restype = None
fun.argtypes = [ctypes.c_void_p,
ctypes.c_int8]
fun(field, Qm)
fun.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_int16, ctypes.c_int8, ctypes.c_int8]
fun(field, name.encode('utf-8'), sample, dim, precision)
#==================================================================================================#
def set_tiles(field, tilesX, tilesY, tilesZ, tilesTS, instr):
fun = libbwc.bwc_set_tiles
fun.restype = None
fun.argtypes = [ctypes.c_void_p,
ctypes.c_uint64,
ctypes.c_uint64,
ctypes.c_uint64,
ctypes.c_uint64,
ctypes.c_char_p]
fun.argtypes = [ctypes.c_void_p, ctypes.c_uint64, ctypes.c_uint64,
ctypes.c_uint64, ctypes.c_uint64,
ctypes.c_char_p]
fun(field, tilesX, tilesY, tilesZ, tilesTS, instr.encode('utf-8'))
#==================================================================================================#
def set_kernels(field, KernelX, KernelY, KernelZ, KernelTS):
fun = libbwc.bwc_set_kernels
fun.restype = None
fun.argtypes = [ctypes.c_void_p, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
fun(field, KernelX, KernelY, KernelZ, KernelTS)
#==================================================================================================#
def set_decomp(field, KernelX, KernelY, KernelZ, KernelTS):
fun = libbwc.bwc_set_decomp
fun.restype = None
fun.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint8, ctypes.c_uint8, ctypes.c_uint8]
fun(field, numDecompX, numDecompY, numDecompZ, numDecompTS)
#==================================================================================================#
def set_precincts(field, pX, pY, pZ, pTS):
fun = libbwc.bwc_set_precincts
fun.restype = None
fun.argtypes = [ctypes.c_void_p,
ctypes.c_uint8,
ctypes.c_uint8,
ctypes.c_uint8,
ctypes.c_uint8]
fun.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint8, ctypes.c_uint8, ctypes.c_uint8]
fun(field, pX, pY, pZ, pTS)
#==================================================================================================#
def create_compression(field, rate_control):
fun = libbwc.bwc_create_compression
def set_codeblocks(field, cbX, cbY, cbZ, cbTS):
fun = libbwc.bwc_set_codeblocks
fun.restype = None
fun.argtypes = [ctypes.c_void_p,
ctypes.c_char_p]
fun(field, rate_control.encode('utf-8'))
fun.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint8, ctypes.c_uint8, ctypes.c_uint8]
fun(field, cbX, cbY, cbZ, cbTS)
#==================================================================================================#
def compress(field, data):
def set_progression(field, progression):
fun = libbwc.bwc_set_progression
fun.restype = None
fun.argtypes = [ctypes.c_void_p, ctypes.c_int]
fun(field, progression)
#==================================================================================================#
def set_error_resilience(field):
fun = libbwc.bwc_set_error_resilience
fun.restype = None
fun.argtypes = [ctypes.c_void_p]
fun(field)
#==================================================================================================#
def set_quantization_style(field, quantization_style):
fun = libbwc.bwc_set_quant_style
fun.restype = None
fun.argtypes = [ctypes.c_void_p, ctypes.c_int]
fun(field, quantization_style)
#==================================================================================================#
def set_qm(field, Qm):
fun = libbwc.bwc_set_qm
fun.restype = None
fun.argtypes = [ctypes.c_void_p, ctypes.c_int8]
fun(field, Qm)
#==================================================================================================#
def set_quantization_step_size(field, delta):
fun = libbwc.bwc_set_quant_step_size
fun.restype = None
fun.argtypes = [ctypes.c_void_p, ctypes.c_double]
fun(field, delta)
#==================================================================================================#
def set_nThreads(field, nThreads):
fun = libbwc.bwc_set_nThreads
fun.restype = None
fun.argtypes = [ctypes.c_void_p, ctypes.c_int8]
fun(field, nThreads)
#==================================================================================================#
def set_memory_limit(field, limit):
fun = libbwc.bwc_set_memory_limit
fun.restype = None
fun.argtypes = [ctypes.c_void_p, ctypes.c_char_p]
fun(field, limit.encode('utf-8'))
#==================================================================================================#
def open_file(field, filename, mode):
fun = libbwc.bwc_open_file
fun.restype = ctypes.c_int8
fun.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p]
res = fun(field, filename.encode('utf-8'), mode.encode('utf-8'))
if res == 1:
raise Exception()
#==================================================================================================#
def load_file(field, filename):
fun = libbwc.bwc_load_file
fun.restype = ctypes.c_int8
fun.argtypes = [ctypes.c_void_p, ctypes.c_char_p]
res = fun(field, filename.encode('utf-8'))
if res == 1:
raise Exception()
#==================================================================================================#
def compress(field, rate_control):
fun = libbwc.bwc_compress
fun.restype = None
fun.argtypes = [ctypes.c_void_p,
ctypes.c_void_p]
fun(field, data)
fun.restype = ctypes.c_int8
fun.argtypes = [ctypes.c_void_p, ctypes.c_char_p]
res = fun(field, rate_control.encode('utf-8'))
if res == 1:
raise Exception()
#==================================================================================================#
def create_decompression(field, data):
fun = libbwc.bwc_create_decompression
fun.restype = ctypes.c_void_p
fun.argtypes = [ctypes.c_void_p,
ctypes.c_uint8]
return ctypes.c_void_p(fun(field, data))
#==================================================================================================#
def decompress(field, data):
def decompress(field, layer):
fun = libbwc.bwc_decompress
fun.restype = None
fun.argtypes = [ctypes.c_void_p,
ctypes.c_void_p]
fun(field, data)
fun.restype = ctypes.c_int8
fun.argtypes = [ctypes.c_void_p, ctypes.c_int8]
res = fun(field, layer)
if res == 1:
raise Exception()

3400
src/interfaces/reader/eas3.c Normal file → Executable file

File diff suppressed because it is too large Load diff

1115
src/interfaces/reader/netCDF.c Executable file

File diff suppressed because it is too large Load diff

View file

@ -57,13 +57,7 @@ if("${PREC}" STREQUAL "Single")
endif()
execute_process(COMMAND python3 public_header.py ${PYTHON_ARGUMENT}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE result
ERROR_VARIABLE error_output)
if(result)
message(WARNING "Public header generation failed: ${error_output}")
endif()
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
#----------------------------------------------------------#
# Set the linking type according to user choice and add #
@ -75,32 +69,38 @@ else()
set(BWC_LINK "SHARED")
endif()
add_library(bwclib ${BWC_LINK} bitstream.c
libbwc.c
codestream.c
dwt.c
mq.c
tier1.c
tier2.c
tagtree.c)
add_library(bwclib ${BWC_LINK} bitstream.c
codestream.c
dwt.c
../interfaces/reader/eas3.c
field.c
mq.c
libbwc.c
#netCDF.c
tier1.c
tier2.c
tagtree.c)
#----------------------------------------------------------#
# Set the target compile definition for the encoder/decod- #
# er bit precision. #
#----------------------------------------------------------#
if("${PREC}" STREQUAL "Single")
target_compile_definitions(bwclib PRIVATE -DBWC_SINGLE_PRECISION)
target_compile_definitions(bwclib PRIVATE -DBWC_SINGLE_PRECISION)
else()
target_compile_definitions(bwclib PRIVATE -DBWC_DOUBLE_PRECISION)
target_compile_definitions(bwclib PRIVATE -DBWC_DOUBLE_PRECISION)
endif()
#----------------------------------------------------------#
# Set the target compile definition for the profiling #
# output. #
# Set the target compile definition for the requested file #
# format support. #
#----------------------------------------------------------#
if(${PROF})
target_compile_definitions(bwclib PRIVATE -DBWC_PROFILE)
MESSAGE(STATUS "Profiling: ${PROF}")
if("${BUILD_EAS3}" STREQUAL "True")
target_compile_definitions(bwclib PRIVATE -DBWC_EAS3)
endif()
if("${BUILD_NETCDF}" STREQUAL "True")
target_compile_definitions(bwclib PRIVATE -DBWC_NETCDF)
endif()
#----------------------------------------------------------#
@ -114,25 +114,15 @@ set_target_properties(bwclib PROPERTIES VERSION ${BWC_VERSION}
#----------------------------------------------------------#
# Setup up the include directory for the BigWhoop library. #
#----------------------------------------------------------#
target_include_directories(bwclib PRIVATE ${CMAKE_SOURCE_DIR}/include/library/private
PUBLIC $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include/library/public>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
target_include_directories(bwclib PRIVATE ${CMAKE_SOURCE_DIR}/include/library/private)
target_include_directories(bwclib PRIVATE ${CMAKE_SOURCE_DIR}/include/interfaces/reader)
#----------------------------------------------------------#
# Link the BigWhoop library to the math.h library. #
#----------------------------------------------------------#
target_link_libraries(bwclib PRIVATE m)
#----------------------------------------------------------#
# Setup the install directories and target exporting for #
# config-file packaging. #
#----------------------------------------------------------#
install( TARGETS bwclib
EXPORT bwc-targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
#----------------------------------------------------------#
# Define the output name for the BigWhoop library. #
#----------------------------------------------------------#
set_property(TARGET bwclib PROPERTY OUTPUT_NAME bwc)
set_property(TARGET bwclib PROPERTY OUTPUT_NAME bwc)

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

3680
src/library/field.c Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -45,39 +45,18 @@
# Add the bwc command line utility and get hash tool to #
# the current project using the utility source files. #
#----------------------------------------------------------#
add_executable(bwccmd bwccmdl.c
../interfaces/reader/eas3.c)
#----------------------------------------------------------#
# Set the target compile definition for the requested file #
# format support. #
#----------------------------------------------------------#
if(${BUILD_EAS3})
target_compile_definitions(bwccmd PRIVATE -DBWC_EAS3)
MESSAGE(STATUS "EAS3 file format support: ${BUILD_EAS3}")
endif()
if(${BUILD_NETCDF})
target_compile_definitions(bwccmd PRIVATE -DBWC_NETCDF)
MESSAGE(STATUS "NetCDF file format support: ${BUILD_NETCDF}")
endif()
add_executable(bwccmd bwccmdl.c)
#----------------------------------------------------------#
# Define the output name for the utility binaries. #
#----------------------------------------------------------#
set_property(TARGET bwccmd PROPERTY OUTPUT_NAME bwc)
set_property(TARGET bwccmd PROPERTY OUTPUT_NAME bwc)
#----------------------------------------------------------#
# Setup up the include directory for the bwc utilities. #
#----------------------------------------------------------#
target_include_directories(bwccmd PRIVATE ${CMAKE_SOURCE_DIR}/include/tools)
target_include_directories(bwccmd PRIVATE ${CMAKE_SOURCE_DIR}/include/library/public)
target_include_directories(bwccmd PRIVATE ${CMAKE_SOURCE_DIR}/include/interfaces/reader)
#----------------------------------------------------------#
# Setup the install directories. #
#----------------------------------------------------------#
install(TARGETS bwccmd DESTINATION ${CMAKE_INSTALL_BINDIR})
#----------------------------------------------------------#
# Link the bwc utility to the bwc library. #

332
src/tools/bwccmdl.c Normal file → Executable file
View file

@ -12,73 +12,33 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| This is a simple command line tool that uses the Big Whoop library to (de)com- ||
|| press a 2- to 4-dimensional IEEE 754 floating point array. For further infor- ||
|| mation use the --help (-h) argument in the command-line or consult the appro- ||
|| priate README file. ||
|| DESCRIPTION: ||
|| ------------ ||
|| This is a simple command line tool that uses the Big Whoop library to (de)compress a ||
|| 2- to 4-dimensional IEEE 754 floating point array. For further information use the ||
|| --help (-h) argument in the command-line or consult the appropriate README file. ||
|| ||
|| FILE REFERENCES: ||
|| ---------------- ||
|| ---------------------------------------------------------------------------------------------------------------- ||
|| ||
|| Name I/O Description ||
|| ---- --- ----------- ||
|| - input - input - Input file that corresponds to ||
|| an uncompressed dataset, for a ||
|| compression run, or a com- ||
|| pressed bitstream, for a decom- ||
|| pression run. ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| - output - Output - Output file that the com- ||
|| pressed bitstream, for a com- ||
|| pression run, or reconstructed ||
|| dataset, for a decompression ||
|| run, is written to. ||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|| following conditions are met: ||
|| ||
|| FUNCTIONS: ||
|| ---------- ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the ||
|| following disclaimer. ||
|| ||
|| PRIVATE: PUBLIC: ||
|| -------- ------- ||
|| - get_digit_sep - main ||
|| - get_size ||
|| - get_dimension ||
|| - get_prog_ord ||
|| - get_quant_style ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and ||
|| the following disclaimer in the documentation and/or other materials provided with the distribution. ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 13.10.2017 Patrick Vogler B87D120 V 0.1.0 source file created ||
|| 26.11.2020 Patrick Vogler B87E7E4 V 0.1.0 Command line tool refac- ||
|| tored. ||
|| ||
|| ||
|| ------------------------------------------------------------------------------------------------------ ||
|| ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| 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 following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other materials ||
|| provided with the distribution. ||
|| ||
|| 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 THE COPYRIGHT OWNER 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. ||
|| 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 THE COPYRIGHT HOLDER 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. ||
|| ||
\*====================================================================================================================*/
/**********************************************************************************************************************\
@ -1503,10 +1463,12 @@ output_info(bwc_cmdl_arg_node *const args,
bwc_gl_ctrl *control;
bwc_gl_inf *info;
bwc_param_ctrl *param_ctrl;
bwc_param_inf *param_info;
bwc_cmdl_arg_node *temp;
bwc_stream *stream;
struct stat buf;
/*-----------------------*\
@ -1670,7 +1632,7 @@ output_info(bwc_cmdl_arg_node *const args,
return;
}
data->codestream.data = calloc(1, sizeof(bwc_stream));
data->codestream.data = calloc(1, sizeof(bwc_packed_stream));
if(data->codestream.data == NULL)
{
// memory allocation error
@ -1711,16 +1673,33 @@ output_info(bwc_cmdl_arg_node *const args,
! Initialize the bitstream, parse the main header and set !
! up the field structure for the current dataset. !
\*--------------------------------------------------------*/
field = bwc_create_decompression(data, 0);
stream = calloc(1, sizeof(bwc_stream));
if(stream == NULL)
{
// memory allocation error
fprintf(stderr, MEMERROR);
return;
}
stream->memory = data->codestream.data->memory;
stream->t = 0;
stream->Lmax = data->codestream.data->size;
stream->size_incr = (uint64)(stream->Lmax / 2);
field = bwc_parse_main_header(data, stream);
if(field == NULL)
{
bwc_free_data(data);
free(stream);
fclose(fp);
return;
}
control = &field->control;
info = field->info;
free(stream);
/*--------------------------------------------------------*\
! Write the help message to the standard output. !
\*--------------------------------------------------------*/
@ -1736,15 +1715,16 @@ output_info(bwc_cmdl_arg_node *const args,
"| .+++=--------=+++---=+++---=+++------------: |\n"\
"| -=++++++++++++++++++++++++++++++++++++++++- |\n"\
"| |\n"\
"|------------------------------ General Information -----------------------------|\n"\
"|-------------------------------General Information------------------------------|\n"\
"| |\n");
/*--------------------------------------------------------*\
! Print the original file size and format. !
\*--------------------------------------------------------*/
data_points = (uint64)info->nX * info->nY * info->nZ *
info->nTS * info->nPar;
buff = get_size(data_points * 8);
fseek(fp, 0L, SEEK_END);
Ld = ftell(fp);
buff = get_size(Ld);
fclose(fp);
printf("| Original size: %42s |\n"\
"| Original file format: %42s |\n"\
@ -1755,10 +1735,9 @@ output_info(bwc_cmdl_arg_node *const args,
/*--------------------------------------------------------*\
! Print the file size and compression ratio. !
\*--------------------------------------------------------*/
fseek(fp, 0L, SEEK_END);
Ld = ftell(fp);
buff = get_size(Ld);
fclose(fp);
data_points = (uint64)info->nX * info->nY * info->nZ *
info->nTS * info->nPar;
buff = get_size(data_points * 8);
printf("| Size on Disk: %42s |\n"\
"| Comp. Ratio: %42.2f |\n"\
@ -1795,11 +1774,12 @@ output_info(bwc_cmdl_arg_node *const args,
/*--------------------------------------------------------*\
! Print the numerical Datapoints. !
\*--------------------------------------------------------*/
printf("|----------------------------- Numerical Parameters -----------------------------|\n"\
printf("|------------------------------Numerical Parameters------------------------------|\n"\
"| |\n");
for(p = 0; p < info->nPar; ++p)
{
param_ctrl = &field->tile[0].parameter[p].control;
param_info = &field->tile[0].parameter[p].info;
minVal = param_info->parameter_min;
@ -1815,23 +1795,26 @@ output_info(bwc_cmdl_arg_node *const args,
while(buff > param_info->name && isspace((unsigned char)*buff)) buff--;
buff[1] = '\0';
if(p != 0)
{
printf("| ........................................................................ |\n"
"|%80s|\n"," ");
}
printf("| Name: %55s |\n"\
"| Minimum value: %55.2e |\n"\
"| Maximum value: %55.2e |\n", param_info->name,
minVal,
maxVal);
"| Maximum value: %55.2e |\n"\
"| |\n"\
"| 1.D | 2.D | 3.D | TS |\n"\
"| Sampling factor: %2d | %2d | %2d | %2d |\n"\
"| ........................................................................ |\n"
"|%80s|\n", param_info->name,
minVal,
maxVal,
param_ctrl->sampX,
param_ctrl->sampY,
param_ctrl->sampZ,
param_ctrl->sampTS, " ");
}
printf("|%80s|\n"," ");
/*--------------------------------------------------------*\
! Print the quality layers. !
\*--------------------------------------------------------*/
printf("|-------------------------------- Quality Layers --------------------------------|\n"\
printf("|---------------------------------Quality Layers---------------------------------|\n"\
"| |\n");
for(l = 0; l < control->nLayers; ++l)
@ -1943,7 +1926,7 @@ read_bwc(char *const filename)
return NULL;
}
file->codestream.data = calloc(1, sizeof(bwc_stream));
file->codestream.data = calloc(1, sizeof(bwc_packed_stream));
if(file->codestream.data == NULL)
{
// memory allocation error
@ -2373,7 +2356,7 @@ write_file(bwc_cmdl_arg_node *const args,
\*--------------------------------------------------------*/
else
{
ext_hash = hash(strrchr(temp->lit_opt[0], '.') + 1);
ext_hash = hash(strrchr(temp->lit_opt[0], '.'));
if(ext_hash != hash(data->info.f_ext))
{
fprintf(stderr, "o##########################################################o\n"\
@ -2651,15 +2634,24 @@ main(int argc,
/*-----------------------*\
! DEFINE INT VARIABLES: !
\*-----------------------*/
uint64_t size=0;
uint64_t i;
uint8_t error_handle;
/*-----------------------*\
! DEFINE CHAR VARIABLES: !
\*-----------------------*/
char *csSize = NULL;
char *fdSize = NULL;
char buff[200];
char rate[10];
/*-----------------------*\
! DEFINE FLOAT VARIABLES: !
\*-----------------------*/
double comp_ratio;
double bpd;
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/
@ -2668,9 +2660,11 @@ main(int argc,
bwc_gl_ctrl *control;
//bwc_dwt_filter filter[4];
bwc_dwt_filter filter[4];
bwc_cmdl_arg_node *args, *temp;
bwc_cmd_opts_ll *param;
/*--------------------------------------------------------*\
! Initialize the field and args structures for proper er- !
! ror handling, as well as the error handle itself. !
@ -2738,38 +2732,38 @@ main(int argc,
/*--------------------------------------------------------*\
! !
\*--------------------------------------------------------*/
// temp = retrieve_arg(args, "wavelet_kernels");
// if((temp != NULL) && (temp->count == 4) && (temp->dim != 0x00))
// {
// for(i = 0; i < temp->count; ++i)
// {
// switch(hash(temp->lit_opt[i]))
// {
// case 0x000000000B87CF64:
// {
// filter[i] = bwc_dwt_9_7;
// break;
// }
// case 0x00000652AB15772A:
// {
// filter[i] = bwc_dwt_5_3;
// break;
// }
// case 0x000000017C858EFF:
// {
// filter[i] = bwc_dwt_5_3;
// break;
// }
// default:
// {
// filter[i] = bwc_dwt_9_7;
// break;
// }
// }
// }
// bwc_set_kernels(field, filter[0], filter[1],
// filter[2], filter[3]);
// }
temp = retrieve_arg(args, "wavelet_kernels");
if((temp != NULL) && (temp->count == 4) && (temp->dim != 0x00))
{
for(i = 0; i < temp->count; ++i)
{
switch(hash(temp->lit_opt[i]))
{
case 0x000000000B87CF64:
{
filter[i] = bwc_dwt_9_7;
break;
}
case 0x00000652AB15772A:
{
filter[i] = bwc_dwt_5_3;
break;
}
case 0x000000017C858EFF:
{
filter[i] = bwc_dwt_5_3;
break;
}
default:
{
filter[i] = bwc_dwt_9_7;
break;
}
}
}
bwc_set_kernels(field, filter[0], filter[1],
filter[2], filter[3]);
}
/*--------------------------------------------------------*\
! !
@ -2814,23 +2808,23 @@ main(int argc,
/*--------------------------------------------------------*\
! !
\*--------------------------------------------------------*/
// temp = retrieve_arg(args, "quantisation_style");
// if((temp != NULL) && (temp->count == 1))
// {
// if(strcmp(temp->lit_opt[0], "NONE"))
// bwc_set_quant_style(field, bwc_qt_none);
// else
// bwc_set_quant_style(field, bwc_qt_derived);
// }
temp = retrieve_arg(args, "quantisation_style");
if((temp != NULL) && (temp->count == 1))
{
if(strcmp(temp->lit_opt[0], "NONE"))
bwc_set_quant_style(field, bwc_qt_none);
else
bwc_set_quant_style(field, bwc_qt_derived);
}
/*--------------------------------------------------------*\
! !
\*--------------------------------------------------------*/
// temp = retrieve_arg(args, "quantisation_step_size");
// if((temp != NULL) && (temp->count == 1))
// {
// bwc_set_quant_step_size(field, temp->num_opt[0]);
// }
temp = retrieve_arg(args, "quantisation_step_size");
if((temp != NULL) && (temp->count == 1))
{
bwc_set_quant_step_size(field, temp->num_opt[0]);
}
/*--------------------------------------------------------*\
! !
@ -2866,7 +2860,7 @@ main(int argc,
temp = retrieve_arg(args, "number_of_threads");
if((temp != NULL) && (temp->count == 1))
{
omp_set_num_threads((uint8_t)temp->num_opt[0]);
bwc_set_nThreads(field, (uint8_t)temp->num_opt[0]);
}
#endif
@ -2938,11 +2932,11 @@ main(int argc,
printf("----------------- Compression Parameters -----------------\n\n");
if((control->CSsgc &0x200) != 0)
{
printf(" Number of Tiles: %27ld\n", control->nTiles);
printf(" Number of Tiles: %27d\n", control->nTiles);
printf(" - Samples in 1.D: %27ld\n", control->tileSizeX);
printf(" - Samples in 2.D: %27ld\n", control->tileSizeY);
printf(" - Samples in 3.D: %27ld\n", control->tileSizeZ);
printf(" - Timesteps: %27ld\n", control->tileSizeTS);
printf(" - Timesteps: %27d\n", control->tileSizeTS);
printf(" ..........................................................\n");
printf("\n");
}
@ -2999,6 +2993,57 @@ main(int argc,
{
printf("==============================================================\n");
}
/*--------------------------------------------------------*\
! Calculate the original field size, compression ratio and !
! bits per datapoint and print the miscellaneous compres- !
! sion information to the standard output. !
\*--------------------------------------------------------*/
if(file->info.parameter)
{
param = file->info.parameter->root;
while(param != NULL)
{
size += (param->size * param->precision);
param = param -> next;
}
}
comp_ratio = (double)size/(file->codestream.data->size);
bpd = (double)(file->codestream.data->size * 64)/size;
/*--------------------------------------------------------*\
! Calculate the original field size, compression ratio and !
! bits per datapoint and print the miscellaneous compres- !
! sion information to the standard output. !
\*--------------------------------------------------------*/
csSize = get_size(file->codestream.data->size);
fdSize = get_size(size);
/*--------------------------------------------------------*\
! Calculate the original field size, compression ratio and !
! bits per datapoint and print the miscellaneous compres- !
! sion information to the standard output. !
\*--------------------------------------------------------*/
printf(" Compression Time: %*.2f s\n", 25, field->meter.time.ttl);
printf(" - Wavelet transformation: %*.2f s\n", 25, field->meter.time.wav);
printf(" - Entropy encoding: %*.2f s\n", 25, field->meter.time.ent);
printf(" - Codestream assembly: %*.2f s\n", 25, field->meter.time.ass);
printf("\n");
printf(" Compression Ratio: %*.2f\n", 27, comp_ratio);
printf(" - Codestream size: %*s\n", 25, csSize);
printf(" - Field size: %*s\n", 25, fdSize);
printf(" - Average bpd: %*.2f\n", 27, bpd);
printf("==============================================================\n");
/*--------------------------------------------------------*\
! Calculate the original field size, compression ratio and !
! bits per datapoint and print the miscellaneous compres- !
! sion information to the standard output. !
\*--------------------------------------------------------*/
free(csSize);
free(fdSize);
}
}
/*--------------------------------------------------------*\
@ -3056,7 +3101,7 @@ main(int argc,
temp = retrieve_arg(args, "number_of_threads");
if((temp != NULL) && (temp->count == 1))
{
omp_set_num_threads((uint8_t)temp->num_opt[0]);
bwc_set_nThreads(field, (uint8_t)temp->num_opt[0]);
}
#endif
@ -3088,6 +3133,21 @@ main(int argc,
goto OUT;
}
}
/*--------------------------------------------------------*\
! If the verbose flag is set by the function caller, print !
! the miscellaneous decompression information to the stan- !
! dard output. !
\*--------------------------------------------------------*/
temp = retrieve_arg(args, "verbose");
if(temp != NULL)
{
printf("==============================================================\n");
printf("Decompression Time: %*.2f s\n", 24, field->meter.time.ttl);
printf(" - Wavelet transformation: %*.2f s\n", 24, field->meter.time.wav);
printf(" - Entropy encoding: %*.2f s\n", 24, field->meter.time.ent);
printf("==============================================================\n");
}
}
/*--------------------------------------------------------*\
! !

View file

@ -1,154 +0,0 @@
/*==================================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| FILE NAME: get_hash.c ||
|| ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| This is a simple command line tool that converts the command-line arguments to a uniquely identifiable ||
|| hash. ||
|| ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| - main ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 02.05.2019 Patrick Vogler B87D120 V 0.1.0 module created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| 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 following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|| distribution. ||
|| ||
|| 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 THE COPYRIGHT OWNER 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. ||
|| ||
\*==================================================================================================================================*/
/************************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
#include <assert.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: int main(int argc, char* argv[]) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! !
! This function uses a variant of the DJB hash function to turn the command-line argument !
! strings and converts them to a uniquely identifiable hash. The hashes are written to the !
! command-line in a hexadecimal format. !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! argc int - Number of strings pointed to by argv. !
! !
! argv char** - Array of arguments. !
! !
! RETURN VALUE: !
! ------------- !
! Type Description !
! ---- ----------- !
! int - Return value signaling a normal or abnormal process exit. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 02.05.2019 Patrick Vogler B87D120 V 0.1.0 function created !
! !
\*----------------------------------------------------------------------------------------------------------*/
int main(int argc, char* argv[])
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
\*-----------------------*/
uint64_t hash;
uint8_t c, i;
/*-----------------------*\
! DEFINE CHAR VARIABLES: !
\*-----------------------*/
char* str;
/*--------------------------------------------------------*\
! Loop through all additional command-line arguments. !
\*--------------------------------------------------------*/
for(i = 1, str = argv[1]; i < argc; ++i, str = argv[i])
{
/*--------------------------------------------------------*\
! Initialize the hash with a magic number. !
\*--------------------------------------------------------*/
hash = 0x1505;
/*--------------------------------------------------------*\
! Walk through all the characters in the string. !
\*--------------------------------------------------------*/
while ((c = *str++))
{
/*--------------------------------------------------------*\
! Convert the current characters to uppercase. !
\*--------------------------------------------------------*/
if((c >= 97) && (c <= 122))
{
c = c - 32;
}
/*--------------------------------------------------------*\
! Multiply the hash with 33 and add the current character !
! to the hash. !
\*--------------------------------------------------------*/
hash = (hash * 33) ^ c;
}
/*--------------------------------------------------------*\
! Write the hash to the command-line. !
\*--------------------------------------------------------*/
printf("%#020lX \n", hash);
}
return 0;
}

640
src/tools/test.c Normal file
View file

@ -0,0 +1,640 @@
#include <argp.h>
#include <assert.h>
#include <ctype.h>
#include <inttypes.h>
#include <math.h>
#include <omp.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
/************************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! MACROS: !
! ------- !
! Macro Description !
! ----- ----------- !
! !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 22.02.2019 Patrick Vogler B87D120 V 0.1.0 macros created !
\*----------------------------------------------------------------------------------------------------------*/
#define remove_deliminator(arg, end, delim) \
{ \
for(end = arg; *end; end++) \
*end = (*end == delim ? ' ' : *end); \
}
// need to mention a version string.
const char *argp_program_version = "bwc 0.1.0";
// documentation string that will be displayed in the help section.
static char doc[] = "\n"\
"bwc is a simple command line tool that leverages the Big Whoop library to (de)compress a 2- to 4-dimensional IEEE 754 "
"floating point array.\n"\
"\n"\
"Available use cases:\n"\
"\n"\
" Compression: bwc -c [INPUT] [OPTIONS]\n"\
" Decompression: bwc -d [INPUT] [OPTIONS]\n"\
" Analysis: bwc -a [INPUT] -r [REFERENCE]\n"\
" Information: bwc -h [INPUT]\n"\
"\n"\
"Valid Option Values:\n"\
"\n"
" <input> String that defines: input = path/to/an/input/file.\n"
" <output> String that defines: output = path/to/an/output/file.\n"
"\n"
" <num> Single numerical value: num = *.\n"
" <narr> One or more numerical values seperated by commas:\n"
" narr = *,*,...\n"
"\n"
" <ndir> Numerical values that can be specified globally or for\n"
" all spacial and temporal directions individually:\n"
" ndir = * or ndir = x/y/z/ts.\n";
/*"\n"
" <str> Single string.\n"
" <sarr> One or more strings seperated by commas: sarr = *,*,...\n"
" <sdir> Strings that can be specified globally or for all\n"
" spacial and temporal directions individually:\n"
" sdir = * or sdir = x/y/z/ts.\n"*/
// email address for bug reporting.
const char *argp_program_bug_address = "hpcpvogl@hlrs.de";
// cli argument availble options.
static struct argp_option options[] = {
//____________________________________________________________________________________________________________________________________________________|
//====================================================================================================================================================|
{0, 0, 0, 0, " [FILE OPTIONS]\n", 1},
//---------------------------|-----|---------------------------|--------------------------|-------------------------------------------------------|---|
{"analysis", 'a', "<input>", 0, "Analyze Peak Signal to Noise Ratio (PSNR) and Mean "
"Square Error (MSE) between input and reference file.\n",1},
//---------------------------|-----|---------------------------|--------------------------|-------------------------------------------------------|---|
{"comp", 'c', "<input>", 0, "Compress a numerical dataset.", 1},
//---------------------------|-----|---------------------------|--------------------------|-------------------------------------------------------|---|
{"decomp", 'd', "<input>", 0, "Decompress a BigWhoop file.", 1},
//---------------------------|-----|---------------------------|--------------------------|-------------------------------------------------------|---|
{"header", 'h', "<input>", 0, "Display the header information of a BigWhoop file.\n", 1},
//---------------------------|-----|---------------------------|--------------------------|-------------------------------------------------------|---|
{"output", 'o', "<output>", 0, "Defines output file.", 1},
//---------------------------|-----|---------------------------|--------------------------|-------------------------------------------------------|---|
{"reference", 'r', "<input>", 0, "Reference file used for PSNR and MSE calculation.", 1},
//====================================================================================================================================================|
//____________________________________________________________________________________________________________________________________________________|
//====================================================================================================================================================|
{0, 0, 0, 0, " [LITERAL OPTIONS]\n", 2},
//---------------------------|-----|---------------------------|--------------------------|-------------------------------------------------------|---|
{"erresilience", 'e', 0, OPTION_HIDDEN, "Instrument bitstream to allow for error resilient de"
"coding of compressed dataset.\n", 2},
//---------------------------|-----|---------------------------|--------------------------|-------------------------------------------------------|---|
{"stream", 's', 0, OPTION_HIDDEN, "Stream data to and from <input>/<output>.", 2},
//---------------------------|-----|---------------------------|--------------------------|-------------------------------------------------------|---|
{"verbose", 'v', 0, 0, "Display compression statistics and applied compression "
"parameters.", 2},
//====================================================================================================================================================|
//____________________________________________________________________________________________________________________________________________________|
//====================================================================================================================================================|
{0, 0, 0, 0, " [NUMERICAL OPTIONS]\n", 3},
//---------------------------|-----|---------------------------|--------------------------|-------------------------------------------------------|---|
{"bitrate", 'b', "<narr>", 0, "Quality layers present in the code stream as a func"
"tion of the average bits per data-point. Accepts real "
"numbers in the range of 0 < * < 64.\n", 3},
//---------------------------|-----|---------------------------|--------------------------|-------------------------------------------------------|---|
{"codeblock", 'B', "<ndir>", 0, "Codeblock size in log2 format. Accepts natural numbers "
"in the range of 1 <= * <= 10 with the sum having to "
"lie in the range of 4 < sum* < 20.\n", 3},
//---------------------------|-----|---------------------------|--------------------------|-------------------------------------------------------|---|
{"decomplvl", 'D', "<ndir>", 0, "Number of wavelet decompositions applied to the data "
"arrays. Accepts natural numbers in the range of 1 <= "
"* <= 63.\n", 3},
//---------------------------|-----|---------------------------|--------------------------|-------------------------------------------------------|---|
{"layer", 'l', "<num>", OPTION_HIDDEN, "Quality layer used to reconstruct the numerical data"
"set. Accepts natural numbers in the range of 0 < * <= "
"number_of_quality_layers.\n", 3},
//---------------------------|-----|---------------------------|--------------------------|-------------------------------------------------------|---|
{"nthreads", 'n', "<num>", 0, "Number of OpenMP threads used to (de)compress the "
"<input> file. Accepts natural numbers in the range of "
"1 <= * <= 255.\n", 3},
//---------------------------|-----|---------------------------|--------------------------|-------------------------------------------------------|---|
{"precinct", 'p', "<ndir>", OPTION_HIDDEN, "Precinct size in log2 format. Accepts natural numbers "
"in the range of 1 <= * <= 15.\n", 3},
//---------------------------|-----|---------------------------|--------------------------|-------------------------------------------------------|---|
{"qstep", 'q', "<num>", OPTION_HIDDEN, "Quantization step size applied to the wavelet coeff"
"icients. Accepts real numbers in the range of 0 < * "
"< 2.\n", 3},
//---------------------------|-----|---------------------------|--------------------------|-------------------------------------------------------|---|
{"qformat", 'Q', "<num>", 0, "Fractional bits of the Q number format used in the "
"floating-to-fixed point transfomration. Accepts "
"natural numbers in the range of 1 <= * <= 62.\n", 3},
//---------------------------|-----|---------------------------|--------------------------|-------------------------------------------------------|---|
{"compratio", 'R', "<num>", 0, "Target ratio between the uncompresssed and com- "
"pressed file size. Accepts positive real numbers.\n", 3},
//---------------------------|-----|---------------------------|--------------------------|-------------------------------------------------------|---|
{"tile", 't', "<ndir>", 0, "Size of tiles the dataset is subdivided into. Accepts "
"natural numbers in the range of 16 <= * <= domain "
"size.", 3},
//====================================================================================================================================================|
//____________________________________________________________________________________________________________________________________________________|
//====================================================================================================================================================|
//{0, 0, 0, 0, " [NUMERICAL OPTIONS]\n", 4},
//---------------------------|-----|---------------------------|--------------------------|-------------------------------------------------------|---|
{"wkernels", 'k', "<sdir>", OPTION_HIDDEN, "Wavelet kernels applied along spatial and temporal "
"aixs. Accepts the strings CDF, LeGall and Haar.", 4},
//---------------------------|-----|---------------------------|--------------------------|-------------------------------------------------------|---|
{0}
};
typedef struct
{
char *analysis;
char *comp;
char *decomp;
char *header;
char *output;
char *reference;
unsigned char erresilience;
unsigned char stream;
unsigned char verbose;
uint8_t nthreads;
uint8_t qformat;
uint8_t layer;
uint16_t compratio;
double qstep;
uint8_t codeblock[4];
uint8_t decomplvl[4];
uint8_t precinct[4];
uint64_t tile[4];
double bitrate[16];
char *wkernels[4];
}arguments;
/*--------------------------------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! This function will parse one option at a time and depending upon the option !
! flag, it will set the corresponding value in struct arguments. !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! | | !
! key int - Key representing a command !
! line option. !
! !
! arg char* - String associated with the !
! supplied key. !
! !
! state argp_state* - Argp structure used to store !
! the option value. !
! !
! RETURN VALUE: !
! ------------- !
! Type Description !
! ---- ----------- !
! error_t - Arguments/options linked list !
! for the bwc command-line tool. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description !
! ---- ------ --------- ------- ----------- !
! 16.02.2019 Patrick Vogler B87D120 V 0.1.0 function created !
! !
\*--------------------------------------------------------------------------------------------------------------------*/
static error_t
parse_opt(int key,
char *arg,
struct argp_state *state)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
\*-----------------------*/
uint64_t buff_LL;
uint64_t multiplier;
uint16_t buffI;
uint8_t i;
uint8_t length, shift;
/*-----------------------*\
! DEFINE REAL VARIABLES: !
\*-----------------------*/
double buff_D;
/*-----------------------*\
! DEFINE REAL VARIABLES: !
\*-----------------------*/
char *end;
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/
// bwc_field *field;
/*-----------------------*\
! DEFINE ASSERTIONS: !
\*-----------------------*/
//assert(arg);
//assert(state);
/*--------------------------------------------------------*\
! Save frequently used variables/structures to temporary !
! variables to make the code more readable. !
\*--------------------------------------------------------*/
//field = state->input;
switch(key)
{
case 'c':
{
field->flag = SETUP_CMP;
field->data.flag = DATA_IN;
field->codestream.flag = CS_OUT;
break;
}
case 'd':
{
field->flag = SETUP_DCP;
field->data.flag = DATA_OUT;
field->codestream.flag = CS_IN;
break;
}
case 'a':
{
arguments->analysis = arg;
break;
}
case 'h':
{
arguments->header = arg;
break;
}
case 'o':
{
arguments->output = arg;
break;
}
case 'r':
{
arguments->reference = arg;
break;
}
case 's':
{
arguments->stream = 1;
break;
}
case 'v':
{
arguments->stream = 1;
break;
}
case 'b':
{
remove_deliminator(arg, end, ',');
for(buff_D = strtod(arg, &end), i = 0; arg != end && i < 16;
buff_D = strtod(arg, &end), i++)
{
arg = end;
if (errno == ERANGE)
{
printf("range error, got ");
errno = 0;
}
if(buff_D > 0 && buff_D < 64)
{
arguments->bitrate[i] = (double) buff_D;
}
else
{
argp_error(state, "The specified bitrate (%f) is "
"out of the supported range.\n", buff_D);
}
}
}
case 'B':
{
remove_deliminator(arg, end, '/');
for(buff_LL = strtoll(arg, &end, 10), i = 0; arg != end && i < 4;
buff_LL = strtoll(arg, &end, 10), i++)
{
arg = end;
if (errno == ERANGE)
{
printf("range error, got ");
errno = 0;
}
if(buff_LL > 1 && buff_LL < 10)
{
arguments->codeblock[i] = (uint8_t) buff_LL;
}
else
{
argp_error(state, "The specified codeblock size (%ld) "
"is out of the supported range.\n", buff_LL);
}
}
if(i == 1)
{
arguments->codeblock[1] =
arguments->codeblock[2] =
arguments->codeblock[3] = arguments->codeblock[0];
}
else if(i != 4)
{
argp_error(state, "The codeblock argument expects either a "
"single global or 4 dirctional values\n");
}
if(((arguments->codeblock[0] + arguments->codeblock[1] +
arguments->codeblock[2] + arguments->codeblock[3]) < 4) ||
((arguments->codeblock[0] + arguments->codeblock[1] +
arguments->codeblock[2] + arguments->codeblock[3]) > 20))
{
argp_error(state, "The sum of the specified codeblock sizes "
"is outside of the supported range\n");
}
break;
}
case 'R':
{
arguments->compratio = (uint8_t)strtoll(arg, &end, 10);
printf("%d\n", arguments->compratio);
break;
}
case 'D':
{
remove_deliminator(arg, end, '/');
for(buff_LL = strtoll(arg, &end, 10), i = 0; arg != end && i < 4;
buff_LL = strtoll(arg, &end, 10), i++)
{
arg = end;
if (errno == ERANGE)
{
printf("range error, got ");
errno = 0;
}
if(buff_LL >= 1 && buff_LL <= 63)
{
arguments->codeblock[i] = (uint8_t) buff_LL;
}
else
{
argp_error(state, "The specified codeblock size (%ld) "
"is out of the supported range.\n", buff_LL);
}
}
if(i == 1)
{
arguments->codeblock[1] =
arguments->codeblock[2] =
arguments->codeblock[3] = arguments->codeblock[0];
}
else if(i != 4)
{
argp_error(state, "The codeblock argument expects either a "
"single global or 4 dirctional values\n");
}
break;
}
case 'n':
{
buff_LL = strtoll(arg, &end, 10);
if((buff_LL < 1) || (buff_LL > 255))
{
argp_error(state, "The number of OpenMP threads specified"
"is out of the supported range.\n");
}
else
{
arguments->nthreads = (uint8_t)buff_LL;
}
break;
}
case 'l':
{
printf("l\n");
break;
}
case 'k':
{
printf("k\n");
break;
}
case 'q':
{
printf("q\n");
break;
}
case 'Q':
{
printf("Q\n");
break;
}
case 'e':
{
printf("e\n");
break;
}
case 't':
{
printf("t\n");
break;
}
case 'p':
{
printf("p\n");
break;
}
case ARGP_KEY_ARG:
// Too many arguments.
if(state->arg_num > 1)
argp_usage(state);
break;
case ARGP_KEY_END:
if(!((arguments->analysis != NULL) && (arguments->comp == NULL)
&& (arguments->decomp == NULL)
&& (arguments->header == NULL)
&& (arguments->output == NULL)
&& (arguments->reference != NULL)) &&
!((arguments->comp != NULL) && (arguments->analysis == NULL)
&& (arguments->decomp == NULL)
&& (arguments->header == NULL)
&& (arguments->reference == NULL)) &&
!((arguments->decomp != NULL) && (arguments->analysis == NULL)
&& (arguments->comp == NULL)
&& (arguments->header == NULL)
&& (arguments->reference == NULL)) &&
!((arguments->header != NULL) && (arguments->analysis == NULL)
&& (arguments->comp == NULL)
&& (arguments->decomp == NULL)
&& (arguments->output == NULL)
&& (arguments->reference == NULL)))
{
argp_error(state, "The User supplied options do not fit the"
"supported use cases.\n");
}
break;
default:
return ARGP_ERR_UNKNOWN;
}
return EXIT_SUCCESS;
}
// initialize the argp struct. Which will be used to parse and use the args.
static struct argp argp = {options, parse_opt, 0, doc};
/*--------------------------------------------------------*\
if((temp->count == 1) && (temp->num_opt[0] > 1) && (control->CSsgc != 0))
{
printf("==============================================================\n");
printf(" \n"\
" .:-------------: .:-------------: \n"\
" .+++++++++++++++= :+++++++++++++++- \n"\
" :+++. -++= -++= \n"\
" :+++. -++= -++= \n"\
" -++++++++++++++= -++= -++= \n"\
" .=++---------=++= -++= -++= \n"\
" :+++ :++= -++= -++= \n"\
" .+++=--------=+++---=+++---=+++------------: \n"\
" -=++++++++++++++++++++++++++++++++++++++++- \n"\
" \n");
printf("----------------- Compression Parameters -----------------\n\n");
if((control->CSsgc &0x200) != 0)
{
printf(" Number of Tiles: %27d\n", control->nTiles);
printf(" - Samples in 1.D: %27ld\n", control->tileSizeX);
printf(" - Samples in 2.D: %27ld\n", control->tileSizeY);
printf(" - Samples in 3.D: %27ld\n", control->tileSizeZ);
printf(" - Timesteps: %27d\n", control->tileSizeTS);
printf(" ..........................................................\n");
printf("\n");
}
if((control->CSsgc &0xE0) != 0)
{
printf(" 1.D | 2.D | 3.D | TS\n");
if((control->CSsgc &0x20) != 0)
{
printf(" Decomposition Levels: %2d | %2d | %2d | %2d\n", control->decompX
, control->decompY
, control->decompZ
, control->decompTS);
}
if((control->CSsgc &0x40) != 0)
{
printf(" Precincts [log2]: %2d | %2d | %2d | %2d\n", control->precSizeX
, control->precSizeY
, control->precSizeZ
, control->precSizeTS);
}
if((control->CSsgc &0x80) != 0)
{
printf(" Codeblocks [log2]: %2d | %2d | %2d | %2d\n", control->cbX
, control->cbY
, control->cbZ
, control->cbTS);
}
printf(" ..........................................................\n");
printf("\n");
}
if((control->CSsgc &0x101) != 0)
{
if((control->CSsgc &0x100) != 0)
printf(" Q Number Format: %27d\n", control->Qm);
if((control->CSsgc &0x1) != 0)
printf(" Error Resilience: %27s\n", ((control->error_resilience > 0) ? "True" : "False"));
printf(" ..........................................................\n");
printf("\n");
}
for(i = 0; i < control->nLayers; ++i)
{
printf(" Quality Layer Nr. %2ld: %23.2f bpd\n", i + 1, control->bitrate[i]/8.0f);
}
printf("\n");
printf("---------------- Compression Performance -----------------\n\n");
}
else
{
printf("==============================================================\n");
}*/
int main(int argc, char *argv[])
{
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/
bwc_field field;
/*--------------------------------------------------------*\
! Allocate the field structure and set the appropriate !
! flags per the mode supplied by the function caller. !
\*--------------------------------------------------------*/
memset(field, 0, sizeof(bwc_field));
// parse the cli arguments.
argp_parse(&argp, argc, argv, 0, 0, &field);
//printf("ARG1: %s", arguments.args[0]);
//printf("\nVERBOSE: %s", arguments.verbose? "yes" : "no");
//printf("\nOption1: %s", arguments.option1);
printf("\n");
}