Compare commits

...

39 commits

Author SHA1 Message Date
e831bec061
Refactored template files to reflect the new coding style 2024-07-03 08:04:43 +02:00
6f3b03bcb5
Merge pull request 'Bug in CMakeLists.txt' (#37) from cmake/bug-fix into main 2024-07-02 10:07:58 +02:00
0622e79aab
add .vscode to .gitignore 2024-07-01 21:08:29 +02:00
1cebbd2d2c
Bug in CMakeLists.txt (signed commit)
Currently, cmake throws
```
CMake Error at CMakeLists.txt:134 (if):
  if given arguments:

    "Release" "STREQUAL" "Release" "OR"

  Unknown arguments specified
```
from here

41ec39574f/CMakeLists.txt (L134)

Fix on would be
```
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release" OR "${OMP}")
```
2024-07-01 20:32:31 +02:00
41ec39574f
Pulled the start and end variables used for time measurements in the profiling block to avoid warnings during compilation without profiling. 2024-06-28 13:05:22 +02:00
ed91f1d15c
Added the option to enable OpenMP parallelization during debug 2024-06-28 11:28:34 +02:00
b3f594771f
Previously the library accepted a max of 255 threads for compression. The limit has now been extended to 9 223 372 036 854 775 807, which should suffice for the next couple of years. 2024-06-28 11:27:58 +02:00
58596bb3e4
Fixed issue with handling OpenMP integration for debugging. 2024-06-26 14:20:55 +02:00
501a36d568
Combined the assemble_main_header and codestream_write_header function and added the codestreamSize value as a length identifier to the Start of Code-Stream (SOC) marker to allow for proper decompression without the user having to supply the codestreamSize through an API call. Functions to append com and aux header blocks have been removed and functionality is now provided by codestream_write_header function. 2024-06-25 20:54:44 +02:00
1330d5b262
Moved metering to a compile time option to streamline API 2024-06-24 16:31:02 +02:00
3920405c4c
API Clean Up to remove unsupported (de)compression instructions. 2024-04-30 17:04:30 +02:00
86979f8ffa
Merge branch 'fix-public-header-creation' 2024-04-15 16:48:20 +02:00
ecf6c6ffc1
Reset printFlg during derived types parsing. 2024-04-15 16:08:59 +02:00
f66091747a
Warn if new header files in include/library/private are not included in either include_files or exclude_files lists for bwc.h generation. 2024-04-15 13:59:39 +02:00
27cdf8d389
hardcode somewhat logical order of header files in public_header.py
append possibly missing header files
assumes that missing header files need no dedicated position in list
2024-04-12 12:13:47 +02:00
bf719d3a1d
bug fix: assert on unassigned variable dim 2024-04-12 10:34:13 +02:00
695d518f76
Ported python interface to new coding style 2024-03-28 07:31:42 +01:00
9aabc7b4f3
Corrected the cloning instructions in the README.md file. 2024-03-06 13:30:08 +01:00
a2543802f7
Added Credits section to README.md 2024-03-04 11:39:29 +01:00
e3dcc28902
Cleanup of constant and macro definitions. 2024-02-22 17:20:38 +01:00
eae976b9ba
Removed the streaming functions from the public header to clean up the API. 2024-02-22 16:25:52 +01:00
8850d525f2
Ported Header files to new coding standard. 2024-02-22 11:27:40 +01:00
d2b88391b9
Updated Repository Logo 2024-02-22 10:23:54 +01:00
6b58b19126
Corrected href link in README.md 2024-02-15 14:08:51 +01:00
946d9de81b
Correct link to BigWhoop Logo 2024-02-15 14:01:45 +01:00
e9617107aa
Removed the bwc_set_nThreads function in favor of the OMP_NUM_THREADS environment variable/set omp_set_num_threads function to clean up the API 2024-02-15 11:55:03 +01:00
e6abc9fd81
bug fix in initialize_tagtree; correctly incrementing to parent nodes in y direction. 2024-02-12 15:57:02 +01:00
e5eccfe858
bug fix setting number of threads 2024-02-09 10:31:30 +01:00
db5f6a4e5f
Merge remote-tracking branch 'origin/main' 2024-02-01 15:36:11 +01:00
31c03e45d2
Removed sampling operation to simplify API since it falls outside of the purview of the compression library. 2024-02-01 15:35:35 +01:00
a14539d5ec
Interfacing with C++ -- 'extern "C"' 2024-01-25 17:01:16 +01:00
2ca0cd8be1
Bug fixed where comparison between supported and actual output file format during compression would fail due to inclusion of period '.' in comparison. Additionally the decompression output formatting was adapted to the format used for compression output. 2024-01-22 16:51:30 +01:00
ecaa8be636
Initial fortran interface commit. 2024-01-22 15:48:08 +01:00
395fb176c5
config-file packaging for find_package() in linking CMake projects 2024-01-22 15:28:51 +01:00
9d85a8c8e2 specify PUBLIC_HEADER destination in bwclib target
avoids duplication of bwc.h in installation include/lib directories
2024-01-22 14:38:26 +01:00
Patrick Vogler
8174f30743
README.md amended for use of .svg graphic 2023-06-21 14:44:57 +02:00
Patrick Vogler
3bb5482465
Removal of .png files 2023-06-21 14:43:05 +02:00
Patrick Vogler
4b4f97c725
Replaced .png images with .svg files 2023-06-21 14:42:24 +02:00
Patrick Vogler
9ef48a9332
Added additional image for Coding Style Document 2023-06-20 16:09:02 +02:00
45 changed files with 7154 additions and 8618 deletions

13
.gitignore vendored
View file

@ -131,9 +131,13 @@ share/python-wheels/
MANIFEST
# Files and Archives
.eas
.npz
.zip
*.eas
*.npz
*.zip
*.bwc
# Profiling assets
valgrind-out.txt
# PyInstaller
# Usually these files are written by a python script from a template
@ -192,6 +196,9 @@ 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

@ -1,4 +1,4 @@
#*====================================================================================================================*#
#*================================================================================================*#
#| |#
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
@ -11,90 +11,83 @@
#| /$$ \ $$ | $$ |#
#| | $$$$$$/ | $$ |#
#| \______/ |__/ |#
#| |#
#| DESCRIPTION: |#
#| ------------ |#
#| |#
#| Defines the global cmake script for the Big Whoop compression algorithm. |#
#| |#
#| |#
#| DEVELOPMENT HISTORY: |#
#| -------------------- |#
#| |#
#| Date Author Change Id Release Description Of Change |#
#| ---- ------ --------- ------- --------------------- |#
#| 30.08.2018 Patrick Vogler B87D120 V 0.1.0 Cmake 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: |#
#| 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. |#
#| 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. |#
#| |#
#*====================================================================================================================*#
#*--------------------------------------------------------*#
#*================================================================================================*#
#----------------------------------------------------------#
# Check if the version requirement for cmake is met. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
cmake_minimum_required(VERSION 3.5.1)
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# Set the project name and description. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
project(BWC LANGUAGES C)
set(PROJECT_DESCRIPTION "Compression algorithm for IEEE 754 datasets")
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# Check that the current build is not a in-source build. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
message(FATAL_ERROR "In-source builds are prohibited. Please create a separate build directory")
endif()
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# Save the bwc.c file in a temporary variable and match #
# the current version number with a regular expression. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/src/library/libbwc.c _bwc_c_contents)
string(REGEX MATCH "Version[ \t]+([0-9]+).([0-9]+).([0-9]+)" _ ${ver} ${_bwc_c_contents})
string(REGEX MATCH "V[ \t]+([0-9]+).([0-9]+).([0-9]+)" _ ${ver} ${_bwc_c_contents})
set(BWC_VERSION_MAJOR ${CMAKE_MATCH_1})
set(BWC_VERSION_MINOR ${CMAKE_MATCH_2})
set(BWC_VERSION_PATCH ${CMAKE_MATCH_3})
set(BWC_VERSION "${BWC_VERSION_MAJOR}.${BWC_VERSION_MINOR}.${BWC_VERSION_PATCH}")
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# Setup a user-specified option used to control the sample #
# precision during compression. The standard option is #
# set to double precision. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
set(PREC "Double" CACHE STRING "User-specified option used to control\
the precision during compression")
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# Inlude the GNU standard installation directories module #
# to set up the output directories. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
include(GNUInstallDirs)
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# Set up the output directories for the Big Whoop library #
# and utility binaries. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
list(INSERT CMAKE_MODULE_PATH 0 "${BWC_SOURCE_DIR}/cmake")
if(${TOOL})
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
@ -108,18 +101,25 @@ 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. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 11)
endif()
message(STATUS "Compiling with C standard: ${CMAKE_C_STANDARD}")
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# Suggest the C++ standard (CXX98) used by the compiler. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# Suggest C++98
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11)
@ -127,11 +127,12 @@ endif()
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")
#----------------------------------------------------------#
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release" OR "${OMP}")
message(STATUS "Enable OpenMP parallelization")
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
@ -140,22 +141,22 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
endif()
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")
endif()
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# Include the CMake dependent option macro. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
include(CMakeDependentOption)
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# Set the -fPIC compile option for static libraries. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
get_property(SHARED_LIBS_SUPPORTED GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS)
cmake_dependent_option(BUILD_SHARED_LIBS
"Whether or not to build shared libraries" ON
@ -171,14 +172,33 @@ if(BWC_ENABLE_PIC)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# Add the project source code. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
add_subdirectory(src/library)
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# Add the utilities source code if requested. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
if(${TOOL})
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})

View file

@ -53,14 +53,20 @@
.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. #
@ -73,6 +79,10 @@ BUILD_PREC="Double"
BUILD_TOOL="False"
BUILD_PROF="False"
BUILD_OMP="False"
BUILD_EAS3="False"
BUILD_NETCDF="False"
@ -95,12 +105,25 @@ help:
@echo ""
@echo " [Type] [Description]"
@echo ""
@echo " debug Compiles BigWhoop and the command line tool with "
@echo " full file support. All relevant debug flags are set."
@echo " debug Compiles BigWhoop with all relevant debug flags."
@echo ""
@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 " 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 ""
@echo " clean Removes all files and folders created during a pre-"
@echo " vious compile run."
@ -116,6 +139,10 @@ 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 ""
@ -125,7 +152,7 @@ help:
#*--------------------------------------------------------*#
# Define private targets. #
#*--------------------------------------------------------*#
--build_debug:
build_debug:
$(eval BUILD_TYPE="Debug")
#*--------------------------------------------------------*#
@ -143,6 +170,17 @@ 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. #
@ -156,9 +194,11 @@ netCDF:
#*--------------------------------------------------------*#
# Define the wrappers for the compile command targets. #
#*--------------------------------------------------------*#
debug: | clean --build_debug tool eas3 build_bwc display
debug: | clean build_debug build_bwc display
full: | clean build_bwc display
release: | build_bwc display
full: | clean tool eas3 build_bwc display
cmdl: | clean tool profiling eas3 build_bwc display
cldebug: | clean build_debug tool profiling eas3 build_bwc display
#*--------------------------------------------------------*#
# Define target used to output compile information. #
@ -182,6 +222,7 @@ 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)"
@ -192,7 +233,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}" "-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}" "-DPROF=${BUILD_PROF}" "-DOMP=${BUILD_OMP}" "-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/hpcpvogl/BigWhoop">
<img alt="BigWhoop" src="https://code.hlrs.de/hpcpvogl/BigWhoop/raw/branch/main/docs/img/Logo.png"/>
<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>
</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
pull the sources from HLRS' gitea instance (note: default branch is `main`):
clone the sources from HLRS' gitea instance (note: default branch is `main`):
```
git pull https://code.hlrs.de/hpcpvogl/BigWhoop.git
git clone https://code.hlrs.de/TOPIO/BigWhoop.git
```
Now change into the source directory and run the following commands.
@ -41,3 +41,10 @@ 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

View file

@ -0,0 +1,59 @@
#*================================================================================================*#
#| |#
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
#| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |#
#| /$$ \ $$ | $$ |#
#| | $$$$$$/ | $$ |#
#| \______/ |__/ |#
#| |#
#| 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()

61
bwc-config.cmake.in Normal file
View file

@ -0,0 +1,61 @@
#*================================================================================================*#
#| |#
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
#| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |#
#| /$$ \ $$ | $$ |#
#| | $$$$$$/ | $$ |#
#| \______/ |__/ |#
#| |#
#| 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()

62
docs/img/Headline.svg Normal file
View file

@ -0,0 +1,62 @@
<?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>

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

94
docs/img/Logo.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 126 KiB

158
docs/templates/Template.F90 vendored Normal file
View file

@ -0,0 +1,158 @@
!*================================================================================================*!
!| |!
!| /$$$$$$$ /$$ /$$ /$$ /$$ |!
!| | $$__ $$|__/ | $$ /$ | $$| $$ |!
!| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |!
!| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |!
!| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |!
!| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |!
!| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |!
!| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |!
!| /$$ \ $$ | $$ |!
!| | $$$$$$/ | $$ |!
!| \______/ |__/ |!
!| |!
!| DESCRIPTION: |!
!| ------------ |!
!| |!
!| DESCRIPTION NEEDED. |!
!| | | |!
!| |!
!| -------------------------------------------------------------------------------------------- |!
!| 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 MODULE_FILE
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
!*-----------------------*!
! DEFINE FLOAT VARIABLES: !
!*-----------------------*!
!*-----------------------*!
! DEFINE CHAR VARIABLES: !
!*-----------------------*!
!*-----------------------*!
! DEFINE STRUCTS: !
!*-----------------------*!
!*--------------------------------------------------------*!
! COMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENT !
!*--------------------------------------------------------*!
!************************************************************************************************!
!| _ _ _ ____ _ _ _ ___ ____ |!
!| | |\ | | | | | | \ |___ |!
!| | | \| |___ |___ |__| |__/ |___ |!
!| |!
!************************************************************************************************!
!************************************************************************************************!
!| ___ ____ _ _ _ _ ___ _ _ _ ____ ___ _ _ ___ ____ ____ |!
!| |__] |__/ | |\/| | | | | | |___ | \_/ |__] |___ [__ |!
!| | | \ | | | | | | \/ |___ | | | |___ ___] |!
!| |!
!************************************************************************************************!
!************************************************************************************************!
!| _ _ ____ ____ ____ ____ ____ |!
!| |\/| |__| | |__/ | | [__ |!
!| | | | | |___ | \ |__| ___] |!
!| |!
!************************************************************************************************!
!************************************************************************************************!
!| ____ ____ _ _ ____ ___ ____ _ _ ___ ____ |!
!| | | | |\ | [__ | |__| |\ | | [__ |!
!| |___ |__| | \| ___] | | | | \| | ___] |!
!| |!
!************************************************************************************************!
!************************************************************************************************!
!| ____ _ _ ___ ____ ____ _ _ ____ _ _ _ ____ ____ _ ____ ___ _ ____ ____ |!
!| |___ \/ | |___ |__/ |\ | |__| | | | |__| |__/ | |__| |__] | |___ [__ |!
!| |___ _/\_ | |___ | \ | \| | | |___ \/ | | | \ | | | |__] |___ |___ ___] |!
!| |!
!************************************************************************************************!
!************************************************************************************************!
!| ____ _ _ ___ ____ ____ _ _ ____ _ ____ ____ _ _ ____ ___ ____ _ _ ___ ____ |!
!| |___ \/ | |___ |__/ |\ | |__| | | | | |\ | [__ | |__| |\ | | [__ |!
!| |___ _/\_ | |___ | \ | \| | | |___ |___ |__| | \| ___] | | | | \| | ___] |!
!| |!
!************************************************************************************************!
!************************************************************************************************!
!| ____ _ ____ ___ ____ _ ____ ____ _ _ ____ ___ ____ _ _ ___ ____ |!
!| | __ | | | |__] |__| | | | | |\ | [__ | |__| |\ | | [__ |!
!| |__] |___ |__| |__] | | |___ |___ |__| | \| ___] | | | | \| | ___] |!
!| |!
!************************************************************************************************!
!************************************************************************************************!
!| ___ _ _ ___ ____ ____ |!
!| | \_/ |__] |___ [__ |!
!| | | | |___ ___] |!
!| |!
!************************************************************************************************!
!************************************************************************************************!
!| ___ ____ ____ ____ _ _ _ ____ ___ ___ _ _ ___ ____ ____ |!
!| | \ |___ |__/ |__/ | | | |___ | \ | \_/ |__] |___ [__ |!
!| |__/ |___ | \ | \ | \/ |___ |__/ | | | |___ ___] |!
!| |!
!************************************************************************************************!
!------------------------------------------------------------------------------------------------!
! !
! DESCRIPTION: !
! ------------ !
! !
! DESCRIPTION NEEDED !
! | | !
! !
!------------------------------------------------------------------------------------------------!
!============================|=========================|==========================================
!************************************************************************************************!
!| ___ ____ _ _ _ ____ ___ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ |!
!| |__] |__/ | | | |__| | |___ |___ | | |\ | | | | | | |\ | [__ |!
!| | | \ | \/ | | | |___ | |__| | \| |___ | | |__| | \| ___] |!
!| |!
!************************************************************************************************!
!************************************************************************************************!
!| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ |!
!| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ |!
!| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] |!
!| |!
!************************************************************************************************!
!------------------------------------------------------------------------------------------------!
! !
! DESCRIPTION: !
! ------------ !
! !
! DESCRIPTION NEEDED !
! | | !
! !
! ARGUMENTS: !
! ---------- !
! Name Description !
! ---- ----------- !
! - - !
! !
! RETURN: !
! ------- !
! - !
! !
!------------------------------------------------------------------------------------------------!
!===========|==========================|======================|======|=======|====================
!=================================================================================================
end module MODULE_FILE

178
docs/templates/Template.c vendored Normal file
View file

@ -0,0 +1,178 @@
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| ||
|| DESCRIPTION NEEDED. ||
|| | | ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| 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. ||
|| ||
\*================================================================================================*/
/**************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\**************************************************************************************************/
/**************************************************************************************************\
|| ____ _ _ ___ ____ ____ _ _ ____ _ _ _ ____ ____ _ ____ ___ _ ____ ____ ||
|| |___ \/ | |___ |__/ |\ | |__| | | | |__| |__/ | |__| |__] | |___ [__ ||
|| |___ _/\_ | |___ | \ | \| | | |___ \/ | | | \ | | | |__] |___ |___ ___] ||
|| ||
\**************************************************************************************************/
/**************************************************************************************************\
|| ____ _ _ ___ ____ ____ _ _ ____ _ ____ ____ _ _ ____ ___ ____ _ _ ___ ____ ||
|| |___ \/ | |___ |__/ |\ | |__| | | | | |\ | [__ | |__| |\ | | [__ ||
|| |___ _/\_ | |___ | \ | \| | | |___ |___ |__| | \| ___] | | | | \| | ___] ||
|| ||
\**************************************************************************************************/
/**************************************************************************************************\
|| ____ _ ____ ___ ____ _ ____ ____ _ _ ____ ___ ____ _ _ ___ ____ ||
|| | __ | | | |__] |__| | | | | |\ | [__ | |__| |\ | | [__ ||
|| |__] |___ |__| |__] | | |___ |___ |__| | \| ___] | | | | \| | ___] ||
|| ||
\**************************************************************************************************/
/**************************************************************************************************\
|| ___ ____ _ _ _ ____ ___ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] |__/ | | | |__| | |___ |___ | | |\ | | | | | | |\ | [__ ||
|| | | \ | \/ | | | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\**************************************************************************************************/
/**************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\**************************************************************************************************/
/*------------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! DESCRIPTION NEEDED !
! | | !
! !
! RETURN: !
! ------- !
! !
! - !
! !
\*------------------------------------------------------------------------------------------------*/
/*-----------------------*\
! DEFINE INT VARIABLES: !
\*-----------------------*/
/*-----------------------*\
! DEFINE FLOAT VARIABLES: !
\*-----------------------*/
/*-----------------------*\
! DEFINE CHAR VARIABLES: !
\*-----------------------*/
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/
/*--------------------------------------------------------*\
! COMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENT !
\*--------------------------------------------------------*/
#ifndef HEADER_H
#define HEADER_H
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************/
/************************************************************************************************\
|| ___ ____ _ _ _ _ ___ _ _ _ ____ ___ _ _ ___ ____ ____ ||
|| |__] |__/ | |\/| | | | | | |___ | \_/ |__] |___ [__ ||
|| | | \ | | | | | | \/ |___ | | | |___ ___] ||
|| ||
\************************************************************************************************/
/************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************/
/************************************************************************************************\
|| ____ ____ _ _ ____ ___ ____ _ _ ___ ____ ||
|| | | | |\ | [__ | |__| |\ | | [__ ||
|| |___ |__| | \| ___] | | | | \| | ___] ||
|| ||
\************************************************************************************************/
/************************************************************************************************\
|| ____ _ _ ___ ____ ____ _ _ ____ _ _ _ ____ ____ _ ____ ___ _ ____ ____ ||
|| |___ \/ | |___ |__/ |\ | |__| | | | |__| |__/ | |__| |__] | |___ [__ ||
|| |___ _/\_ | |___ | \ | \| | | |___ \/ | | | \ | | | |__] |___ |___ ___] ||
|| ||
\************************************************************************************************/
/************************************************************************************************\
|| ____ _ _ ___ ____ ____ _ _ ____ _ ____ ____ _ _ ____ ___ ____ _ _ ___ ____ ||
|| |___ \/ | |___ |__/ |\ | |__| | | | | |\ | [__ | |__| |\ | | [__ ||
|| |___ _/\_ | |___ | \ | \| | | |___ |___ |__| | \| ___] | | | | \| | ___] ||
|| ||
\************************************************************************************************/
/************************************************************************************************\
|| ___ _ _ ___ ____ ____ ||
|| | \_/ |__] |___ [__ ||
|| | | | |___ ___] ||
|| ||
\************************************************************************************************/
/************************************************************************************************\
|| ___ ____ ____ ____ _ _ _ ____ ___ ___ _ _ ___ ____ ____ ||
|| | \ |___ |__/ |__/ | | | |___ | \ | \_/ |__] |___ [__ ||
|| |__/ |___ | \ | \ | \/ |___ |__/ | | | |___ ___] ||
|| ||
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! DESCRIPTION NEEDED !
! | | !
! !
\*----------------------------------------------------------------------------------------------*/
//===========================|=========================|==========================================
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************/
//==========|==========================|======================|======|=======|====================
//================================================================================================
#endif

121
docs/templates/Template.py vendored Normal file
View file

@ -0,0 +1,121 @@
#*================================================================================================*#
#| |#
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
#| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |#
#| /$$ \ $$ | $$ |#
#| | $$$$$$/ | $$ |#
#| \______/ |__/ |#
#| |#
#| DESCRIPTION: |#
#| ------------ |#
#| |#
#| DESCRIPTION NEEDED. |#
#| | | |#
#| |#
#| -------------------------------------------------------------------------------------------- |#
#| 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. |#
#| |#
#*================================================================================================*#
#**************************************************************************************************#
#| _ _ _ ___ ____ ____ ___ |#
#| | |\/| |__] | | |__/ | |#
#| | | | | |__| | \ | |#
#| |#
#**************************************************************************************************#
#**************************************************************************************************#
#| ____ ____ _ _ ____ ___ ____ _ _ ___ ____ |#
#| | | | |\ | [__ | |__| |\ | | [__ |#
#| |___ |__| | \| ___] | | | | \| | ___] |#
#| |#
#**************************************************************************************************#
#**************************************************************************************************#
#| ____ _ _ ___ ____ ____ _ _ ____ _ _ _ ____ ____ _ ____ ___ _ ____ ____ |#
#| |___ \/ | |___ |__/ |\ | |__| | | | |__| |__/ | |__| |__] | |___ [__ |#
#| |___ _/\_ | |___ | \ | \| | | |___ \/ | | | \ | | | |__] |___ |___ ___] |#
#| |#
#**************************************************************************************************#
#**************************************************************************************************#
#| ____ _ _ ___ ____ ____ _ _ ____ _ ____ ____ _ _ ____ ___ ____ _ _ ___ ____ |#
#| |___ \/ | |___ |__/ |\ | |__| | | | | |\ | [__ | |__| |\ | | [__ |#
#| |___ _/\_ | |___ | \ | \| | | |___ |___ |__| | \| ___] | | | | \| | ___] |#
#| |#
#**************************************************************************************************#
#**************************************************************************************************#
#| ____ _ ____ ___ ____ _ ____ ____ _ _ ____ ___ ____ _ _ ___ ____ |#
#| | __ | | | |__] |__| | | | | |\ | [__ | |__| |\ | | [__ |#
#| |__] |___ |__| |__] | | |___ |___ |__| | \| ___] | | | | \| | ___] |#
#| |#
#**************************************************************************************************#
#**************************************************************************************************#
#| ___ ____ _ _ _ ____ ___ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ |#
#| |__] |__/ | | | |__| | |___ |___ | | |\ | | | | | | |\ | [__ |#
#| | | \ | \/ | | | |___ | |__| | \| |___ | | |__| | \| ___] |#
#| |#
#**************************************************************************************************#
#**************************************************************************************************#
#| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ |#
#| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ |#
#| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] |#
#| |#
#**************************************************************************************************#
#==================================================================================================#
#--------------------------------------------------------------------------------------------------#
# #
# DESCRIPTION: #
# ------------ #
# #
# DESCRIPTION NEEDED #
# | | #
# #
# ARGUMENTS: #
# ---------- #
# Name Description #
# ---- ----------- #
# - - #
# #
# RETURN: #
# ------- #
# - #
# #
#--------------------------------------------------------------------------------------------------#
#-------------------------#
# DEFINE INT VARIABLES: #
#-------------------------#
#-------------------------#
# DEFINE FLOAT VARIABLES: #
#-------------------------#
#-------------------------#
# DEFINE CHAR VARIABLES: #
#-------------------------#
#-------------------------#
# DEFINE STRUCTS: #
#-------------------------#
#----------------------------------------------------------#
# COMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENT #
#----------------------------------------------------------#

47
docs/templates/Template.txt vendored Normal file
View file

@ -0,0 +1,47 @@
#*================================================================================================*#
#| |#
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
#| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |#
#| /$$ \ $$ | $$ |#
#| | $$$$$$/ | $$ |#
#| \______/ |__/ |#
#| |#
#| DESCRIPTION: |#
#| ------------ |#
#| |#
#| DESCRIPTION NEEDED. |#
#| | | |#
#| |#
#| -------------------------------------------------------------------------------------------- |#
#| 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. |#
#| |#
#*================================================================================================*#
#----------------------------------------------------------#
# COMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENT #
#----------------------------------------------------------#

View file

@ -1,299 +0,0 @@
/*==================================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: header.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| DESCRIPTION NEEDED. ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| - Patrick Vogler B87D120 V - header file created ||
|| - Patrick Vogler B880CA2 V - header file patched ||
|| - Patrick Vogler B87E7E4 V - header file updated ||
|| - Patrick Vogler B87F684 V - header file new version ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| ||
|| 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. ||
|| ||
\*==================================================================================================================================*/
#ifndef HEADER_H
#define HEADER_H
/************************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
/************************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! Macros: !
! ------- !
! Macro Description !
! ----- ----------- !
! !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V - Macros created !
! - Patrick Vogler B880CA2 V - Macros patched !
! - Patrick Vogler B87E7E4 V - Macros updated !
! - Patrick Vogler B87F684 V - Macros new version !
! !
\*----------------------------------------------------------------------------------------------------------*/
/************************************************************************************************************\
|| ____ ____ _ _ ____ ___ ____ _ _ ___ ____ ||
|| | | | |\ | [__ | |__| |\ | | [__ ||
|| |___ |__| | \| ___] | | | | \| | ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! CONSTANTS: !
! ----------- !
! Constant Description !
! -------- ----------- !
! !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V - Constants created !
! - Patrick Vogler B880CA2 V - Constants patched !
! - Patrick Vogler B87E7E4 V - Constants updated !
! - Patrick Vogler B87F684 V - Constants new version !
! !
\*----------------------------------------------------------------------------------------------------------*/
/************************************************************************************************************\
|| ____ _ _ ___ ____ ____ _ _ ____ _ _ _ ____ ____ _ ____ ___ _ ____ ____ ||
|| |___ \/ | |___ |__/ |\ | |__| | | | |__| |__/ | |__| |__] | |___ [__ ||
|| |___ _/\_ | |___ | \ | \| | | |___ \/ | | | \ | | | |__] |___ |___ ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! VARIABLES: !
! ----------- !
! VARIABLE Description !
! -------- ----------- !
! !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V - Variables created !
! - Patrick Vogler B880CA2 V - Variables patched !
! - Patrick Vogler B87E7E4 V - Variables updated !
! - Patrick Vogler B87F684 V - Variables new version !
! !
\*----------------------------------------------------------------------------------------------------------*/
/************************************************************************************************************\
|| ____ _ _ ___ ____ ____ _ _ ____ _ ____ ____ _ _ ____ ___ ____ _ _ ___ ____ ||
|| |___ \/ | |___ |__/ |\ | |__| | | | | |\ | [__ | |__| |\ | | [__ ||
|| |___ _/\_ | |___ | \ | \| | | |___ |___ |__| | \| ___] | | | | \| | ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! CONSTANTS: !
! ----------- !
! Constant Description !
! -------- ----------- !
! !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V - Constants created !
! - Patrick Vogler B880CA2 V - Constants patched !
! - Patrick Vogler B87E7E4 V - Constants updated !
! - Patrick Vogler B87F684 V - Constants new version !
! !
\*----------------------------------------------------------------------------------------------------------*/
/************************************************************************************************************\
|| ___ _ _ ___ ____ ____ ||
|| | \_/ |__] |___ [__ ||
|| | | | |___ ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! STRUCT NAME: Template !
! ----------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! - - - !
! !
! DEPENDENCIES: !
! ------------- !
! Variable Type Description !
! -------- ---- ----------- !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V - Struct created !
! - Patrick Vogler B880CA2 V - Struct patched !
! - Patrick Vogler B87E7E4 V - Struct updated !
! - Patrick Vogler B87F684 V - Struct new version !
! !
\*----------------------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------------------*\
! ENUM NAME: Template !
! ----------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! - - - !
! !
! DEPENDENCIES: !
! ------------- !
! Variable Type Description !
! -------- ---- ----------- !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V - Enum created !
! - Patrick Vogler B880CA2 V - Enum patched !
! - Patrick Vogler B87E7E4 V - Enum updated !
! - Patrick Vogler B87F684 V - Enum new version !
! !
\*----------------------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------------------*\
! UNION NAME: Template !
! ----------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! - - - !
! !
! DEPENDENCIES: !
! ------------- !
! Variable Type Description !
! -------- ---- ----------- !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V - Union created !
! - Patrick Vogler B880CA2 V - Union patched !
! - Patrick Vogler B87E7E4 V - Union updated !
! - Patrick Vogler B87F684 V - Union new version !
! !
\*----------------------------------------------------------------------------------------------------------*/
/************************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! TYPE NAME: Template !
! ----------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
#endif

View file

@ -1,179 +0,0 @@
/*==================================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| FILE NAME: source.c ||
|| ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| DESCRIPTION NEEDED. ||
|| ||
|| FILE REFERENCES: ||
|| ---------------- ||
|| ||
|| Name I/O Description ||
|| ---- --- ----------- ||
|| none - - ||
|| ||
|| ||
|| PRIVATE FUNCTIONS: ||
|| ------------------ ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| - Patrick Vogler B87D120 V - source file created ||
|| - Patrick Vogler B880CA2 V - source file patched ||
|| - Patrick Vogler B87E7E4 V - source file updated ||
|| - Patrick Vogler B87F684 V - source file new version ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| ||
|| 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. ||
|| ||
\*==================================================================================================================================*/
/************************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
/************************************************************************************************************\
|| ____ _ _ ___ ____ ____ _ _ ____ _ _ _ ____ ____ _ ____ ___ _ ____ ____ ||
|| |___ \/ | |___ |__/ |\ | |__| | | | |__| |__/ | |__| |__] | |___ [__ ||
|| |___ _/\_ | |___ | \ | \| | | |___ \/ | | | \ | | | |__] |___ |___ ___] ||
|| ||
\************************************************************************************************************/
/************************************************************************************************************\
|| ____ _ _ ___ ____ ____ _ _ ____ _ ____ ____ _ _ ____ ___ ____ _ _ ___ ____ ||
|| |___ \/ | |___ |__/ |\ | |__| | | | | |\ | [__ | |__| |\ | | [__ ||
|| |___ _/\_ | |___ | \ | \| | | |___ |___ |__| | \| ___] | | | | \| | ___] ||
|| ||
\************************************************************************************************************/
/************************************************************************************************************\
|| ___ ____ _ _ _ ____ ___ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] |__/ | | | |__| | |___ |___ | | |\ | | | | | | |\ | [__ ||
|| | | \ | \/ | | | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *template(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! - - - !
! !
! RETURN VALUE: !
! ------------- !
! Type Description !
! ---- ----------- !
! - - !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V - function created !
! - Patrick Vogler B880CA2 V - function patched !
! - Patrick Vogler B87E7E4 V - function updated !
! - Patrick Vogler B87F684 V - function new version !
! !
\*----------------------------------------------------------------------------------------------------------*/
/************************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! - - - !
! !
! RETURN VALUE: !
! ------------- !
! Type Description !
! ---- ----------- !
! - - !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V - function created !
! - Patrick Vogler B880CA2 V - function patched !
! - Patrick Vogler B87E7E4 V - function updated !
! - Patrick Vogler B87F684 V - function new version !
! !
\*----------------------------------------------------------------------------------------------------------*/
/*-----------------------*\
! DEFINE INT VARIABLES: !
\*-----------------------*/
/*-----------------------*\
! DEFINE FLOAT VARIABLES: !
\*-----------------------*/
/*-----------------------*\
! DEFINE CHAR VARIABLES: !
\*-----------------------*/
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/
/*--------------------------------------------------------*\
! COMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENT !
\*--------------------------------------------------------*/

View file

@ -187,6 +187,30 @@
|| | | | |___ ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! 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;
/*----------------------------------------------------------------------------------------------------------*\
! STRUCT NAME: eas3_header !
! ----------- !

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,213 +12,113 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: bwc_bitstream.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| This file describes a set of functions that can be used to create, manipulate and terminate ||
|| a bitstream. These functions facilitate the creation or reading of a compressed bwc code- ||
|| stream and can emit/extract information on a per bit, symbol (64-bit) or string basis. ||
|| ||
|| This file describes a set of functions that can be used to create, manipulate ||
|| and terminate a bitstream. These functions facilitate the creation or reading ||
|| of a compressed bwc codestream and can emit/extract information on a per bit, ||
|| symbol (64-bit) or string basis. ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| - ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| - bwc_init_stream ||
|| - bwc_emit_chunck ||
|| - bwc_emit_symbol ||
|| - bwc_emit_bit ||
|| - bwc_get_chunck ||
|| - bwc_get_symbol ||
|| - bwc_get_bit ||
|| - bwc_terminate_stream ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 28.05.2018 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: ||
|| 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. ||
|| (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. ||
|| (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. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
#ifndef BITSTREAM_H
#define BITSTREAM_H
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
\************************************************************************************************/
#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;
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: uint32 bytes_used(bwc_stream *const stream) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function is used to evaluate the number of bytes that have already been !
! written to the allocated bitstream memory block. !
! !
\*----------------------------------------------------------------------------------------------------------*/
uint64
bytes_used(bwc_stream *const stream);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: bwc_stream* bwc_init_stream(uchar* memory, uint32 size, char instr) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function is used to initialize a bwc bitstream. For encoding, a null pointer !
! is passed as a memory handle and the function will allocate a memory block with the !
! specified stream size. For decoding, a valid memory handle, passed by the function !
! caller, will be stored in the bwc_stream structure. The byte buffer counter t, !
! stream size Lmax and size increment are initialized with their appropriate values. !
! !
\*----------------------------------------------------------------------------------------------------------*/
bwc_stream*
bwc_init_stream(uchar* memory, uint32 size, char instr);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bwc_emit_chunck(bwc_stream *const stream, const uchar* chunck, const uint64 size);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bwc_emit_symbol(bwc_stream *const stream, const uint64 symbol, const uint8 size);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bwc_emit_bit(bwc_stream *const stream, const uint64 bit);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
flush_stream(bwc_stream *const stream);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar*
bwc_get_chunck(bwc_stream *const stream, const uint64 length);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
uint64
bwc_get_symbol(bwc_stream *const stream, const uint8 length);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
bwc_get_bit(bwc_stream *const stream);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
bwc_terminate_stream(bwc_stream *stream, bwc_packed_stream *const packed_stream);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void release_packed_stream(bwc_packed_stream *stream) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function is used to release all the information stored in a packed bitstream !
! and reset the parameters for another (de)compression run. !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
release_packed_stream(bwc_packed_stream *stream);
\************************************************************************************************/
uint64 bytes_used (bitstream const *const stream);
//==========|==========================|======================|======|======|=====================
bitstream* init_stream (uchar *const memory,
uint32 const size,
char const instr);
//==========|==========================|======================|======|======|=====================
void emit_chunck (bitstream *const stream,
uchar const *const chunck,
uint64 const size);
//==========|==========================|======================|======|======|=====================
void emit_symbol (bitstream *const stream,
uint64 const symbol,
uint8 const size);
//==========|==========================|======================|======|======|=====================
void emit_bit (bitstream *const stream,
uint64 const bit);
//==========|==========================|======================|======|======|=====================
void flush_stream (bitstream *const stream);
//==========|==========================|======================|======|======|=====================
uchar* get_chunck (bitstream *const stream,
uint64 const length);
//==========|==========================|======================|======|======|=====================
uint64 get_symbol (bitstream *const stream,
uint8 const length);
//==========|==========================|======================|======|======|=====================
uchar get_bit (bitstream *const stream);
//==========|==========================|======================|======|======|=====================
uchar terminate_stream (bitstream *stream,
bwc_stream *const packed_stream);
//==========|==========================|======================|======|======|=====================
void release_packed_stream (bwc_stream *const stream);
#endif

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,92 +12,65 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: codestream.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| DESCRIPTION NEEDED. ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 28.05.2018 Patrick Vogler B87D120 V 0.1.0 header file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| This file describes a set of function that can be used to create and manipulate ||
|| a BigWhoop Codestream. They facilitate the assembly and parsing of the main ||
|| header and tile bitsreams as well as 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: ||
|| 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. ||
|| (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. ||
|| (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. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
#ifndef CODESTREAM_H
#define CODESTREAM_H
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
\************************************************************************************************/
#include "types.h"
#include "bitstream.h"
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! These macros define stream manipulation operations to rewind, foward and get access !
! to the current memory position of a bwc_stream. !
! !
! Macros: !
! ------- !
! Macro Description !
! ----- ----------- !
! rewind_stream - Rewinds a stream by a user specified amount (delta) !
! of bits. !
! These macros define stream manipulation operations to rewind, forward, inquire !
! the availability and get access to the current memory position of a bitstrean. !
! !
! foward_stream - Fowards a stream by a user specified amount (delta) !
! of bits. !
! !
! get_access - Get an access pointer to the current memory position !
! of a bwc_stream. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 07.08.2019 Patrick Vogler B87D120 V 0.1.0 Macros created !
\*----------------------------------------------------------------------------------------------------------*/
\*----------------------------------------------------------------------------------------------*/
#define rewind_stream(stream, delta) \
{ \
stream->L -= delta; \
@ -110,82 +83,22 @@
#define get_access(stream) (uchar*)stream->memory + stream->L
/************************************************************************************************************\
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
assemble_main_header(bwc_field *const field);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
bwc_field*
bwc_parse_main_header(bwc_data *const data,bwc_stream *const stream);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
codestream_write_aux(bwc_packed_stream *const header, bwc_packed_stream *const aux);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
codestream_write_com(bwc_packed_stream *const header, bwc_packed_stream *const com);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: bwc_packed_stream* assemble_codestream(bwc_field *const field) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
bwc_packed_stream*
assemble_codestream(bwc_field *const field);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: bwc_field* parse_codestream(bwc_data *const data) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
bwc_field*
parse_codestream(bwc_data *const data, uint8 const layer);
\************************************************************************************************/
uchar assemble_main_header (bwc_field *const field);
//==========|==========================|======================|======|======|=====================
uchar codestream_write_aux (bwc_stream *const header,
bwc_stream *const aux);
//==========|==========================|======================|======|======|=====================
uchar codestream_write_com (bwc_stream *const header,
bwc_stream *const com);
//==========|==========================|======================|======|======|=====================
bwc_stream* assemble_codestream (bwc_field *const field);
//==========|==========================|======================|======|======|=====================
bwc_field* parse_codestream (bwc_data *const data,
uint8 const layer);
#endif

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,317 +12,110 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: constants.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| DESCRIPTION NEEDED. ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 16.10.2017 Patrick Vogler B87D120 V 0.1.0 header file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| This file defines simple constants that are used to make the code more readable. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| 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: ||
|| 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. ||
|| (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. ||
|| (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. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
#ifndef CONSTANTS_H
#define CONSTANTS_H
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! !
! These constants are used to identify the spatial and temporal dimensions. !
! !
! Constants: !
! ----------- !
! Constant Description !
! -------- ----------- !
! DIM_X 1st Spatial Dimension !
! DIM_Y 2nd Spatial Dimension !
! DIM_Z 3rd Spatial Dimension !
! DIM_TS Temporal Dimension !
! DIM_ALL All Dimensions !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 04.12.2017 Patrick Vogler B87D120 V 0.1.0 Constants created !
\*----------------------------------------------------------------------------------------------------------*/
#define DIM_X 1
#define DIM_Y 2
#define DIM_Z 4
#define DIM_TS 8
#define DIM_ALL 15
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! !
! These constants describe the maximum allowable wavelet decompositions for the spatial and !
! temporal dimensions and the maximum allowable subbands. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 01.12.2017 Patrick Vogler B87D120 V 0.1.0 Constants created !
\*----------------------------------------------------------------------------------------------------------*/
#define MAXIMUM_NUMBER_OF_SPATIAL_DECOMP 64
#define MAXIMUM_NUMBER_OF_TEMPORAL_DECOMP 32
#define MAXIMUM_NUMBER_OF_SUBBANDS (1+(15*(64-32))) + (1+(7*32))
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! !
! These Constants describe the codestream markers used to create the embedded codestream. !
! !
! CONSTANTS: !
! ----------- !
! Constant Description !
! -------- ----------- !
! SOC - Start of code-stream !
! SGI - Global data-set information !
! SGC - Global control parameters !
! 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 Of Change !
! ---- ------ --------- ------- --------------------- !
! 01.12.2017 Patrick Vogler B87D120 V 0.1.0 Constants 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 Constants are used for codestream parsing. !
! !
! CONSTANTS: !
! ----------- !
! Constant Description !
! -------- ----------- !
! CODESTREAM_OK No errors detectet in Codestream !
! CODESTREAM_ERROR Error detectet in Codestream !
! CODESTREAM_SGI_READ Global data-set information read !
! CODESTREAM_SGC_READ Global control parameters read !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 01.08.2019 Patrick Vogler B87D120 V 0.1.0 Constants created !
\*----------------------------------------------------------------------------------------------------------*/
#define CODESTREAM_OK 0x00
#define CODESTREAM_ERROR 0x80
#define CODESTREAM_SGI_READ 0x01
#define CODESTREAM_SGC_READ 0x02
#define CODESTREAM_SAX_READ 0x04
#define CODESTREAM_COM_READ 0x08
/*----------------------------------------------------------------------------------------------------------*\
! ENUM NAME: bwc_dwt_filter !
! ----------- !
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These constants describe the wavelet filter used during the transform stage. !
! These constants are used to signal spatial or temporal the wavelet filter. !
! !
! PARAMETERS: !
! ----------- !
! Constant Description !
! -------- ----------- !
! bwc_dwt_9_7 - Cohen Daubechies Feauveau 9/7 Wavelet !
! bwc_dwt_5_3 - LeGall 5/3 Wavelet !
! bwc_dwt_haar - Haar Wavelet !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 07.12.2017 Patrick Vogler B87D120 V 0.1.0 Enum created !
! !
\*----------------------------------------------------------------------------------------------------------*/
typedef enum{
bwc_dwt_9_7,
bwc_dwt_5_3,
bwc_dwt_haar
\*----------------------------------------------------------------------------------------------*/
typedef enum
{
bwc_dwt_9_7, // Cohen Daubechies Feauveau 9/7 Wavelet
bwc_dwt_5_3, // LeGall 5/3 Wavelet
bwc_dwt_haar // Haar Wavelet
} bwc_dwt_filter;
/*----------------------------------------------------------------------------------------------------------*\
! ENUM NAME: bwc_prog_ord !
! ----------- !
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These constants describe the progression order used to pack the codestream. !
! The organisation of the codesstream is carried out according to the following 5 cases. !
! These constants are used to signal the packing order of the codestream. !
! !
! LRCP: RLCP: !
! ----- for each Quality Layer: ----- for each Resolution: !
! for each Resolution: for each Quality Layer: !
! for each Parameter: for each Parameter: !
! for each Precinct: for each Precinct: !
! include Packet include Packet !
! !
! RPCL: PCRL: !
! ----- for each Resolution: ----- for each Precinct: !
! for each Precinct: for each Parameter: !
! for each Parameter: for each Resolution: !
! for each Quality Layer: for each Quality Layer: !
! include Packet include Packet !
! !
! CPRL: !
! ----- for each Quality Layer: !
! for each Resolution: !
! for each Parameter: !
! for each Precinct: !
! include Packet !
! !
! PARAMETERS: !
! ----------- !
! Constant Description !
! -------- ----------- !
! bwc_prog_LRCP - LRCP progression order !
! bwc_prog_RLCP - RLCP progression order !
! bwc_prog_RPCL - RPCL progression order !
! bwc_prog_PCRL - PCRL progression order !
! bwc_prog_CPRL - CPRL progression order !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 07.12.2017 Patrick Vogler B87D120 V 0.1.0 Enum created !
! !
\*----------------------------------------------------------------------------------------------------------*/
typedef enum{
bwc_prog_LRCP,
bwc_prog_RLCP,
bwc_prog_RPCL,
bwc_prog_PCRL,
bwc_prog_CPRL
\*----------------------------------------------------------------------------------------------*/
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_ord;
/*----------------------------------------------------------------------------------------------------------*\
! ENUM NAME: bwc_quant_st !
! ----------- !
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! PARAMETERS: !
! ----------- !
! Constant Description !
! -------- ----------- !
! - - !
! These constants are used to signal the quantisation style during !
! (de)coompression. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 07.12.2017 Patrick Vogler B87D120 V 0.1.0 Enum created !
! !
\*----------------------------------------------------------------------------------------------------------*/
typedef enum{
bwc_qt_none,
bwc_qt_derived,
\*----------------------------------------------------------------------------------------------*/
typedef enum
{
bwc_qt_none, // No quantization
bwc_qt_derived, // Derrived according to Taubman/Marcellin
} bwc_quant_st;
/*----------------------------------------------------------------------------------------------------------*\
! ENUM NAME: bwc_tile_instr !
! ----------- !
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! PARAMETERS: !
! ----------- !
! Constant Description !
! -------- ----------- !
! - - !
! These constants are used to signal dataset tiling by the function caller. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 17.04.2019 Patrick Vogler B87D120 V 0.1.0 Enum created !
! !
\*----------------------------------------------------------------------------------------------------------*/
typedef enum{
bwc_tile_sizeof,
bwc_tile_numbof,
\*----------------------------------------------------------------------------------------------*/
typedef enum
{
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

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,317 +12,158 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: dwt.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| DESCRIPTION NEEDED. ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 21.03.2018 Patrick Vogler B87D120 V 0.1.0 header file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| This file describes a set of functions that can be used to performe the forward/ ||
|| inverse discrete wavelet transform on 1- to 4-dimensional IEEE 754 data-sets. ||
|| For more information please refere to JPEG2000 by D. S. Taubman and M. W. ||
|| Marcellin. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| 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: ||
|| 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. ||
|| (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. ||
|| (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. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
#ifndef DWT_H
#define DWT_H
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
\************************************************************************************************/
#include "types.h"
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! This macro defines the maximum decomposition level up to which the wavelet filer energy gain !
! is calculated. Beyond the maximum decomposition level the energy gain will only be !
! approximated. !
! Maximum number of wavelet layers for which the energy gain is calculated. !
! !
! Macros: !
! ------- !
! Macro Description !
! ----- ----------- !
! MAX_DECOMPOSITION_LEVELS - Maximum number of wavelet layers for which the energy !
! gain is calculated. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 20.03.2018 Patrick Vogler B87D120 V 0.1.0 Macros created !
\*----------------------------------------------------------------------------------------------------------*/
#define MAX_DECOMPOSITION_LEVELS 4
\*----------------------------------------------------------------------------------------------*/
#define MAX_DECOMP_LEVELS 4
/*----------------------------------------------------------------------------------------------------------*\
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These macros define the irrational coefficients for the high and low pass synthesis filters !
! associated with the (9-7) Cohen-Daubechies-Feauveau-Wavelet as well as the coefficients for !
! its coressponding lifting scheme. !
! These macros define the irrational coefficients for the high and low pass !
! synthesis filters associated with the (9-7) Cohen-Daubechies-Feauveau-Wavelet !
! as well as the coefficients for its coressponding lifting scheme. !
! !
! Macros: !
! ------- !
! Macro Description !
! ----- ----------- !
! DWT_9X7_H0 !
! DWT_9X7_H1 !
! DWT_9X7_H2 - Coefficients for the (9-7) !
! DWT_9X7_H3 low pass synthesis filter. !
! !
! DWT_9X7_G0 !
! DWT_9X7_G1 !
! DWT_9X7_G2 !
! DWT_9X7_G3 - Coefficients for the (9-7) !
! DWT_9X7_G4 high pass synthesis filter. !
! !
! ALPHA !
! BETA !
! GAMMA !
! DELTA !
! KAPPA_H - Coefficients for the (9-7) !
! KAPPA_L lifting scheme. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 20.03.2018 Patrick Vogler B87D120 V 0.1.0 Macros created !
\*----------------------------------------------------------------------------------------------------------*/
#define DWT_9X7_H0 1.115087052457000f
#define DWT_9X7_H1 0.591271763114250f
\*----------------------------------------------------------------------------------------------*/
#define DWT_9X7_H0 1.115087052457000f // Low pass synthesis filter ...
#define DWT_9X7_H1 0.591271763114250f // ... coefficients
#define DWT_9X7_H2 -0.057543526228500f
#define DWT_9X7_H3 -0.091271763114250f
#define DWT_9X7_G0 1.205898036472721f
#define DWT_9X7_G1 -0.533728236885750f
#define DWT_9X7_G0 1.205898036472721f // High pass synthesis filter ...
#define DWT_9X7_G1 -0.533728236885750f // ... coefficients
#define DWT_9X7_G2 -0.156446533057980f
#define DWT_9X7_G3 0.033728236885750f
#define DWT_9X7_G4 0.053497514821620f
#define ALPHA -1.586134342059924f
#define ALPHA -1.586134342059924f // Lifting coefficients.
#define BETA -0.052980118572961f
#define GAMMA 0.882911075530934f
#define DELTA 0.360523644801462f
#define KAPPA_H 1.230174104914001f
#define KAPPA_L 0.812893066115961f
/*----------------------------------------------------------------------------------------------------------*\
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These macros define the irrational coefficients for the high and low pass synthesis filters !
! associated with the (5-3) LeGall-Wavelet. !
! These macros define the irrational coefficients for the high and low pass !
! synthesis filters associated with the (5-3) LeGall-Wavelet. !
! !
! Macros: !
! ------- !
! Macro Description !
! ----- ----------- !
! DWT_5X3_H0 - Coefficients for the (9-7) !
! DWT_5X3_H1 low pass synthesis filter. !
! !
! DWT_5X3_G0 !
! DWT_5X3_G1 - Coefficients for the (9-7) !
! DWT_5X3_G2 high pass synthesis filter. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 20.03.2018 Patrick Vogler B87D120 V 0.1.0 Macros created !
\*----------------------------------------------------------------------------------------------------------*/
#define DWT_5X3_H0 1.0f
#define DWT_5X3_H1 0.5f
\*----------------------------------------------------------------------------------------------*/
#define DWT_5X3_H0 1.0f // Low pass synthesis filter ...
#define DWT_5X3_H1 0.5f // ... coefficients
#define DWT_5X3_G0 0.75f
#define DWT_5X3_G1 -0.25f
#define DWT_5X3_G0 0.75f // High pass synthesis filter
#define DWT_5X3_G1 -0.25f // ... coefficients
#define DWT_5X3_G2 -0.125f
/*----------------------------------------------------------------------------------------------------------*\
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These macros define the irrational coefficients for the high and low pass synthesis filters !
! associated with the Haar-Wavelet. !
! These macros define the irrational coefficients for the high and low pass !
! synthesis filters associated with the Haar-Wavelet. !
! !
! Macros: !
! ------- !
! Macro Description !
! ----- ----------- !
! DWT_HAAR_G0 - Coefficients for the Haar !
! DWT_HAAR_G1 low pass synthesis filter. !
! !
! DWT_HAAR_H1 - Coefficients for the Haar !
! DWT_HAAR_H2 high pass synthesis filter. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 20.03.2018 Patrick Vogler B87D120 V 0.1.0 Macros created !
\*----------------------------------------------------------------------------------------------------------*/
#define DWT_HAAR_H0 1
#define DWT_HAAR_H1 1
\*----------------------------------------------------------------------------------------------*/
#define DWT_HAAR_H0 1 // Low pass synthesis filter ...
#define DWT_HAAR_H1 1 // ... coefficients
#define DWT_HAAR_G0 0.5
#define DWT_HAAR_G1 -0.5
#define DWT_HAAR_G0 0.5 // High pass synthesis filter ...
#define DWT_HAAR_G1 -0.5 // ... coefficients
/************************************************************************************************************\
/************************************************************************************************\
|| ____ _ _ ___ ____ ____ _ _ ____ _ _ _ ____ ____ _ ____ ___ _ ____ ____ ||
|| |___ \/ | |___ |__/ |\ | |__| | | | |__| |__/ | |__| |__] | |___ [__ ||
|| |___ _/\_ | |___ | \ | \| | | |___ \/ | | | \ | | | |__] |___ |___ ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! This array defines a lookup table used to store the energy gain factors for the one dimen- !
! sional, dyadic tree structured CDF-(9/7), LeGall-(5/3) and Haar wavelet transform. Each LUT !
! contains energy gain factors for the 6 low-pass and 6 high-pass decomposition including level !
! zero. !
! This array defines a lookup table used to store the energy gain factors for the !
! one dimensional CDF(9/7), LeGall-(5/3) and Haar wavelet transform. Each LUT !
! contains energy gain factors for the 6 low-pass and 6 high-pass decomposition !
! including level zero. !
! !
! VARIABLES: !
! ----------- !
! Variable Description !
! -------- ----------- !
! DWT_ENERGY_GAIN_LUT - Lookup-table for the CDF-(9/7), LG-(5/3) and Haar !
! dwt energy gain factor. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 21.03.2018 Patrick Vogler B87D120 V 0.1.0 Variables created !
\*----------------------------------------------------------------------------------------------------------*/
extern double DWT_ENERGY_GAIN_LUT[3][2 * MAX_DECOMPOSITION_LEVELS + 2];
\*----------------------------------------------------------------------------------------------*/
extern double DWT_ENERGY_GAIN_LUT[3][2 * MAX_DECOMP_LEVELS + 2];
/************************************************************************************************************\
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: uchar initialize_gain_lut() !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function calculates the energy gain factor Gb for the one dimensional, dyadic tree !
! structured CDF-(9/7), LeGall-(5/3) and Haar wavelet transform with 5 levels. The energy !
! gain factors are calculated according to equation (4.39) from JPEG2000 by David S. Taubman !
! and Michael W. Marcellin (p. 193): !
! !
! s_L1[n] = g0[n], s_H1[n] = h0[n], !
! s_Ld[n] = (s_Ld-1[k]*g0[n-2k], k), s_Hd[n] = (s_Hd-1[k]*g0[n-2k], k). !
! !
! The energy gain factors are stored in their corresponding lookup tables and used to calcu- !
! late the energy gain for the multi dimensional wavelet transforms according to equation !
! (4.40) from JPEG2000 by David S. Taubman and Michael W. Marcellin (p.193): !
! !
! s_LLD[n1,n2] = s_LD[n1] * s_LD[n2] => G_LLD = G_LD * G_LD !
! s_HLD[n1,n2] = s_LD[n1] * s_HD[n2] => G_HLD = G_LD * G_HD !
! s_LHD[n1,n2] = s_HD[n1] * s_LD[n2] => G_LHD = G_HD * G_LD !
! s_HHD[n1,n2] = s_HD[n1] * s_HD[n2] => G_HHD = G_HD * G_HD !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
initialize_gain_lut();
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: bwc_float get_dwt_energy_gain(bwc_field *field, uchar highband_flag, uint level) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function evaluates the energy gain factor according to the the specified decomposition !
! level. For decomposition levels larger than MAX_DECOMPOSITION_LEVELS the filter gain for !
! the extra levels is approximated by multiplying the energy gain factor by 2. !
! !
\*----------------------------------------------------------------------------------------------------------*/
bwc_float
get_dwt_energy_gain(bwc_field *field, uchar highband_flag, uint16 level);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: uchar forward_discrete_wavelet_transform(bwc_field *const field, !
! -------------- bwc_parameter *const parameter) !
! !
! DESCRIPTION: !
! ------------ !
! This function performs the forward discrete wavelet transform on the current tile param- !
! eter. After loading the flow field samples for a row, column or spatial/temporal slice !
! into a working buffer, a boundary extension operation is performed to ensure an approp. !
! sample base. The working buffer is then transform using the wavelet kernel selected for !
! the spatial or temporal dimension, sorted into high- and low-frequency samples and flushed !
! back into the tile parameter memory block. This operation is performed for every row, !
! column and spatial/temporal slice for ndecomp number of decomposition levels. !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
forward_discrete_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: uchar inverse_discrete_wavelet_transform(bwc_field *const field, !
! -------------- bwc_parameter *const parameter) !
! !
! DESCRIPTION: !
! ------------ !
! This function performs the inverse discrete wavelet transform on the current tile param- !
! eter. After loading the interweaved wavelet coefficients for a row, column or spatial/ !
! temporal slice into a working buffer, a boundary extension operation is performed to !
! ensure an appropriate sample base. The working buffer is then transform using the wave- !
! let kernel selected for the spatial or temporal dimension and flushed back into the tile !
! parameter memory block. This operation is performed for every row, column and spatial/ !
! temporal slice for ndecomp number of decomposition levels. !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
inverse_discrete_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter);
\************************************************************************************************/
uchar initialize_gain_lut ();
//==========|==========================|======================|======|=======|====================
bwc_float get_dwt_energy_gain (bwc_field *const field,
uchar const highband_flag,
uint16 const level);
//==========|==========================|======================|======|=======|====================
uchar forward_wavelet_transform (bwc_field *const field,
bwc_parameter *const parameter);
//==========|==========================|======================|======|=======|====================
uchar inverse_wavelet_transform (bwc_field *const field,
bwc_parameter *const parameter);
#endif

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,70 +12,44 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| Version 0.1.1 ||
|| ||
|| File: bwc.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| This header defines DESCRIPTION NEEDED. ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| - bwc_kill_compression ||
|| - bwc_add_param ||
|| - bwc_set_quantization_style ||
|| - bwc_set_progression ||
|| - bwc_set_kernels ||
|| - bwc_set_levels ||
|| - bwc_set_codeblocks ||
|| - bwc_set_qm ||
|| - bwc_set_tiles ||
|| - bwc_initialize_compression ||
|| - bwc_create_compression ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| - Patrick Vogler B87D120 V 0.1.0 header file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| 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: ||
|| 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. ||
|| (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. ||
|| (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. ||
|| ||
\*==================================================================================================================================*/
#ifndef BWC_H
#define BWC_H
/************************************************************************************************************\
\*================================================================================================*/
#ifndef LIBBWC_H
#define LIBBWC_H
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
\************************************************************************************************/
#include "bitstream.h"
#include "codestream.h"
#include "constants.h"
@ -83,312 +57,99 @@
#include "mq_types.h"
#include "types.h"
/************************************************************************************************************\
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: bwc_field *bwc_initialize_data(...) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function initializes the bwc_data structure with all necessary parameters. !
! !
\*----------------------------------------------------------------------------------------------------------*/
bwc_data*
bwc_initialize_data(double* field, uint64 const nX, uint64 const nY, uint64 const nZ, uint16 const nTS, uint8 const nPar, char *file_extension);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void bwc_add_param(bwc_data* data, char *name, uint16 sample, uchar dim, uint8 precision) !
! -------------- !
! !
! !
! DESCRIPTION: !
! ------------ !
! This function initializes and adds new parameters to the parameter linked list. The linked !
! list stores the parameter name, its precision, sampling factor and the dimension for which !
! the sampling is active. !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bwc_add_param(bwc_data* data, char *name, uint16 sample, uchar dim, uint8 precision);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: bwc_field *bwc_initialize_data(...) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function is used to copy the numerical dataset stored in the bwc_data !
! structure to a user supplied memory block. A size argument is necessary !
! to verify that the memory block has the correct size. !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bwc_get_data(bwc_data* data, uchar* buffer, uint64 size);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void bwc_free_data(bwc_data* file) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function deallocates the data structure used to store an numerical dataset/compressed !
! and can be called if an error occurs or once the data is no longer needed is to be closed. !
! The deallocation will be carried out down to the structure levels that have been allocated. !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bwc_free_data(bwc_data* data);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: uchar create_field(bwc_field *const field) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function creates the field structure used to (de)compress a floating point array de- !
! fined by the bwc_initialize function. !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
create_field(bwc_field *const field);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void kill_compression(bwc_field *const field) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function deallocates the compression field structure used to define and control the !
! bwc codec and can be called if an error occurs during the (de-)compression stage or once !
! the codec has finished. The deallocation will be carried out down to the structure levels !
! that have been allocated. !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bwc_kill_compression(bwc_field *const field);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: bwc_field *bwc_initialize_field(bwc_data *const data) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function initializes the bwc_field structure with all necessary standard parameters !
! to (de)compress a floating point array with nX * nY * nZ grid points, nTS timesteps and !
! nPar parameters. !
! !
\*----------------------------------------------------------------------------------------------------------*/
bwc_field*
bwc_initialize_field(bwc_data *const data);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void bwc_set_error_resilience(bwc_field *const field) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function sets the error resilience marker in the bwc_field structure if an error !
! resilient compression approach is to be employed. !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bwc_set_error_resilience(bwc_field *const field);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void bwc_set_quantization_style(bwc_field *const field, bwc_quant_st quantization_style) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function amends the quantization style in the bwc_field structure according to the !
! specified value. !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bwc_set_quantization_style(bwc_field *const field, bwc_quant_st quantization_style);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void bwc_set_quantization_step_size(bwc_field *const field, double delta) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function amends the quantization step size in the bwc_field structure according to !
! the specified value. !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bwc_set_quantization_step_size(bwc_field *const field, double delta);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void bwc_set_progression(bwc_field *const field, bwc_prog_ord progression) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function amends the progression order in the bwc_field structure according to the !
! specified value. !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bwc_set_progression(bwc_field *const field, bwc_prog_ord progression);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void bwc_set_kernels(bwc_field *const field, bwc_dwt_filter KernelX, !
! -------------- bwc_dwt_filter KernelY, !
! bwc_dwt_filter KernelZ, !
! bwc_dwt_filter KernelTS) !
! !
! DESCRIPTION: !
! ------------ !
! This function amends the wavelet kernels in the bwc_field structure according to the !
! specified values. !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bwc_set_kernels(bwc_field *const field, bwc_dwt_filter KernelX, bwc_dwt_filter KernelY,
bwc_dwt_filter KernelZ, bwc_dwt_filter KernelTS);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void bwc_set_decomp(bwc_field *const field, uint8 decompX, uint8 decompY, !
! -------------- uint8 decompZ, uint8 decompTS) !
! !
! DESCRIPTION: !
! ------------ !
! This function amends the decomposition levels in the bwc_field structure according to the !
! specified values. !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bwc_set_decomp(bwc_field *const field, uint8 decompX, uint8 decompY, uint8 decompZ, uint8 decompTS);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void bwc_set_precincts(bwc_field *const field, uint8 pX, uint8 pY, uint8 pZ, uint8 pTS) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function amends the precinct size in the bwc_field structure according to the !
! specified values. !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bwc_set_precincts(bwc_field *const field, uint8 pX, uint8 pY, uint8 pZ, uint8 pTS);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void bwc_set_codeblocks(bwc_field *const field, uint8 cbX, uint8 cbY, !
! -------------- uint8 cbZ, uint8 cbTS) !
! !
! DESCRIPTION: !
! ------------ !
! This function amends the codeblock size in the bwc_field structure according to the !
! specified values. !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bwc_set_codeblocks(bwc_field *const field, uint8 cbX, uint8 cbY, uint8 cbZ, uint8 cbTS);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void bwc_set_qm(bwc_field *const field, uint8 Qm) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function amends the Q number formate range in the bwc_field structure according to the !
! specified value. !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bwc_set_qm(bwc_field *const field, uint8 Qm);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void bwc_set_tiles(bwc_field *const field, uint32 tilesX, uint32 tilesY, uint32 tilesZ, !
! -------------- uint32 tilesTS, uchar instr) !
! !
! DESCRIPTION: !
! ------------ !
! This function amends the tileSize and num_Tiles values in the bwc_field structure according !
! to the specified values. The NUMBEROF and SIZEOF constants can be used to either specify !
! the tile sizes or the number of tiles in each spatial and temporal directions. !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bwc_set_tiles(bwc_field *const field, uint64 tilesX, uint64 tilesY, uint64 tilesZ, uint16 tilesTS, bwc_tile_instr instr);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void bwc_set_nThreads(bwc_field *const field, uint16 nThreads) !
! !
! DESCRIPTION: !
! ------------ !
! This function is used to indicate the maximum number of threads used during !
! (de)compression. !
! !
\*----------------------------------------------------------------------------------------------------------*/
#if defined(_OPENMP)
void
bwc_set_nThreads(bwc_field *const field, uint8 nThreads);
#endif
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void bwc_create_compression(bwc_field *field, char *rate_control) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function creates the field structure used to compress a floating point array defined !
! by the bwc_initialize function. For a compression run, the rate_control and instr arguments !
! need to be passed to the function to properly set up the lossy compression stage. Here, the !
! instr parameter defines whether rate control is defined by a BITRATE - a floating point val-!
! ue defining the average number of bits per datapoint - and ACCURACY - an integer value de- !
! fining the exponent of the maximum allowable error (i.e. 15 for err = 1e-15). !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
bwc_create_compression(bwc_field *field, char *rate_control);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: uchar bwc_compress(bwc_field *const field, bwc_float *const data) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! Description needed. !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
bwc_compress(bwc_field *const field, bwc_data *const data);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void bwc_create_compression(bwc_field **field_ptr, char *rate_control, uchar instr) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function parses the supplied bwc codestream and sets up the field structure used to !
! decompress the numerical dataset. !
! !
\*----------------------------------------------------------------------------------------------------------*/
bwc_field *
bwc_create_decompression(bwc_data *const data, uint8 layer);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void bwc_create_compression(bwc_field **field, float rate_control, uchar instr) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function creates the field structure used to compress a floating point array defined !
! by the bwc_initialize function at a prescribed bitrate or accuracy. In this context, the !
! bitrate is a floating point value defining the average number of bits per datapoint and !
! the accuracy is an integer value defining the exponent of the maximum allowable error !
! (i.e. 15 for err = 1e-15). !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
bwc_decompress(bwc_field *const field, bwc_data *const data);
\************************************************************************************************/
//==========|==========================|======================|======|=======|====================
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_compress (bwc_field *const field,
bwc_data *const data);
//==========|==========================|======================|======|=======|====================
bwc_field* bwc_create_decompression (bwc_data *const data,
uint8 const layer);
//==========|==========================|======================|======|=======|====================
uchar bwc_decompress (bwc_field *const field,
bwc_data *const data);
#endif

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,128 +12,125 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: macros.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| DESCRIPTION NEEDED. ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 29.05.2017 Patrick Vogler B87D120 V 0.1.0 header file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| This file defines simple macros that are used to make the code more readable. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| 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: ||
|| 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. ||
|| (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. ||
|| (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. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
#ifndef BWC_MACROSS_H
#define BWC_MACROSS_H
/*----------------------------------------------------------------------------------------------------------*\
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! These Macros are used to calculate the maximum and minimum between two values. !
! !
! Macros: !
! ------- !
! Macro Description !
! ----- ----------- !
! MAX(x, y) - Returns the maximum value of two values. !
! These constants are used to identify the spatial and temporal dimensions. !
! !
! MIN(x, y) - Returns the minimum value of two values. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 21.03.2018 Patrick Vogler B87D120 V 0.1.0 Macros created !
\*----------------------------------------------------------------------------------------------------------*/
#define MAX(x, y) (((x) < (y))?(y):(x))
#define MIN(x, y) (((x) > (y))?(y):(x))
\*----------------------------------------------------------------------------------------------*/
#define DIM_X 1 // 1st. spacial direction
#define DIM_Y 2 // 2nd. spacial direction
#define DIM_Z 4 // 3rd. spacial direction
#define DIM_TS 8 // temporal direction
#define DIM_ALL 15 // all dimensions
/*----------------------------------------------------------------------------------------------------------*\
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These Constants define codestream markers used to create the embedded codestream. !
! !
\*----------------------------------------------------------------------------------------------*/
#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 PLT 0xFF60 // Packed packet headers: main header
#define PPT 0xFF61 // Packed packet headers: tile-part
#define SOT 0xFF90 // Start of tile
#define SOP 0xFF91 // Start of packet
#define EPH 0xFF92 // End of packet header
#define SOD 0xFF93 // Start of data
#define EOC 0xFFFF // End of code-stream
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These macros define flags used for codestream parsing. !
! !
\*----------------------------------------------------------------------------------------------*/
#define CODESTREAM_OK 0x00 // No errors detected in Codestream
#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_SAX_READ 0x08 // Auxiliary information block read
#define CODESTREAM_COM_READ 0x10 // Comment block read
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These macros define simple mathematicall oprators. !
! !
\*----------------------------------------------------------------------------------------------*/
#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: !
! ------------ !
! !
! This macro is used to evaluate the size of an array. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 16.09.2019 Patrick Vogler B87D120 V 0.1.0 Macros created !
\*----------------------------------------------------------------------------------------------------------*/
\*----------------------------------------------------------------------------------------------*/
#define GET_DIM(x) (sizeof(x)/sizeof(*(x)))
/*----------------------------------------------------------------------------------------------------------*\
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These Constants describe the codestream markers used to create the embedded codestream. !
! These Constants define common error messages used throughout the bwc library. !
! !
! CONSTANTS: !
! ----------- !
! Constant Description !
! -------- ----------- !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 01.12.2017 Patrick Vogler B87D120 V 0.1.0 Constants created !
\*----------------------------------------------------------------------------------------------------------*/
\*----------------------------------------------------------------------------------------------*/
#define MEMERROR "o##########################################################o\n"\
"| ERROR: Out of memory |\n"\
"o##########################################################o\n"
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! !
! These Constants describe the codestream markers used to create the embedded codestream. !
! !
! CONSTANTS: !
! ----------- !
! Constant Description !
! -------- ----------- !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 01.12.2017 Patrick Vogler B87D120 V 0.1.0 Constants created !
\*----------------------------------------------------------------------------------------------------------*/
#define CSERROR "o##########################################################o\n"\
"| ERROR: Invalid Codestream |\n"\
"o##########################################################o\n"

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,144 +12,103 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: mq.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| ||
|| DESCRIPTION NEEDED. ||
|| | | ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 13.02.2019 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: ||
|| 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. ||
|| (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. ||
|| (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. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
#ifndef MQ_H
#define MQ_H
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
\************************************************************************************************/
#include "tier1.h"
#include "types.h"
/************************************************************************************************************\
/************************************************************************************************\
|| ____ ____ _ _ ____ ___ ____ _ _ ___ ____ ||
|| | | | |\ | [__ | |__| |\ | | [__ ||
|| |___ |__| | \| ___] | | | | \| | ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These macros define the context state indices used by the mq coder for probability estima- !
! tion. For a more thorough treatment of the context assignments see page 487 JPEG2000 by !
! David S. Taubman and Michael W. Marcellin. !
! These macros define the context state indices used by the mq coder for !
! probability estimation. For a more thorough treatment of the context assignments !
! see page 487 JPEG2000 by David S. Taubman and Michael W. Marcellin. !
! !
! Macros: !
! ------- !
! Macro Description !
! ----- ----------- !
! CONTEXT_SIG - Starting indices for the significance context labels. !
! CONTEXT_RUN - Indices for the run context label. !
! CONTEXT_SIGN - Starting indices for the sign context labels. !
! CONTEXT_MAG - Starting indices for the magnitude context labels. !
! CONTEXT_UNI - Indices for the uni context label. !
! CONTEXT_TOTAL - Total number of context labels. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 21.02.2019 Patrick Vogler B87D120 V 0.1.0 Macros created !
\*----------------------------------------------------------------------------------------------------------*/
#define CONTEXT_SIG 0
#define CONTEXT_RUN 9
#define CONTEXT_SIGN 10
#define CONTEXT_MAG 15
#define CONTEXT_UNI 18
#define CONTEXT_TOTAL 19
\*----------------------------------------------------------------------------------------------*/
#define CONTEXT_SIG 0 // Sig. context labels starting indices
#define CONTEXT_RUN 9 // Indices for the run context label
#define CONTEXT_SIGN 10 // Sign context labels starting indices
#define CONTEXT_MAG 15 // Mag. context labels starting indices
#define CONTEXT_UNI 18 // Indices for the uni context label
#define CONTEXT_TOTAL 19 // Total number of context labels
/************************************************************************************************************\
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! TYPE NAME: Template !
! ----------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
initialize_bit_encoder(bwc_coder *const coder, const uint8 number_of_contexts);
uchar
bit_encoder_next_run(bwc_bit_coder *const bitcoder);
void
bit_encode(bwc_bit_coder *const bitcoder, const uint8 s, const uint8 k);
void
bit_encoder_truncation_length_min(bwc_coder_state *const state);
void
bit_encoder_termination(bwc_bit_coder *const bitcoder);
void
free_bit_encoder(bwc_coder *const coder);
uchar
initialize_bit_decoder(bwc_coder *const coder, const uint8 number_of_contexts, const int64 Lmax);
uint8
bit_decode(bwc_bit_coder *const bitcoder, const uint8 k);
uint64
bit_coder_get_no_bytes(bwc_bit_coder *const bitcoder);
void
bit_coder_get_pass_lengths(bwc_bit_coder *const bitcoder, bwc_encoded_cblk *const encoded_cblk);
void
bit_coder_reset_ptr(bwc_bit_coder *const bitcoder, uchar *const memory);
\************************************************************************************************/
uchar initialize_mq_encoder (bwc_coder *const coder,
uint8 const number_of_contexts);
//==========|==========================|======================|======|=======|====================
uchar mq_next_run (bwc_bit_coder *const bitcoder);
//==========|==========================|======================|======|=======|====================
void mq_bit_encode (bwc_bit_coder *const bitcoder,
uint8 const s,
uint8 const k);
//==========|==========================|======================|======|=======|====================
void mq_truncation_length_min (bwc_coder_state *const state);
//==========|==========================|======================|======|=======|====================
void mq_termination (bwc_bit_coder *const bitcoder);
//==========|==========================|======================|======|=======|====================
void free_mq_encoder (bwc_coder *const coder);
//==========|==========================|======================|======|=======|====================
uchar initialize_mq_decoder (bwc_coder *const coder,
uint8 const number_of_contexts,
int64 const Lmax);
//==========|==========================|======================|======|=======|====================
uint8 mq_bit_decode (bwc_bit_coder *const bitcoder,
uint8 const k);
//==========|==========================|======================|======|=======|====================
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);
//==========|==========================|======================|======|=======|====================
void mq_reset_ptr (bwc_bit_coder *const bitcoder,
uchar *const memory);
#endif

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,211 +12,110 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: prim_types_double.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| This header defines a set of derrived types used for the mq encoder during the entropy encoding stage of the big whoop ||
|| compression algorithm. ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| - bwc_context_state ||
|| - bwc_coder_state ||
|| - bwc_bit_coder ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 20.02.2019 Patrick Vogler B87D120 V 0.1.0 header file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| This header defines a the bit coder and its context states used during the ||
|| entropy encoding stage of the BigWhoop 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: ||
|| 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. ||
|| (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. ||
|| (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. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
#ifndef MQ_TYPES_H
#define MQ_TYPES_H
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
\************************************************************************************************/
#include <stdint.h>
/************************************************************************************************************\
/************************************************************************************************\
|| ___ ____ ____ ____ _ _ _ ____ ___ ___ _ _ ___ ____ ____ ||
|| | \ |___ |__/ |__/ | | | |___ | \ | \_/ |__] |___ [__ ||
|| |__/ |___ | \ | \ | \/ |___ |__/ | | | |___ ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! STRUCT NAME: bwc_context_state !
! ----------- !
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! - !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! p unsigned int(16 bit) - LPS Probability estimate. !
! This structure is used to directly access the parameter codeblocks during !
! entropy (de-)encoding to facilitate shared memory parallelization. !
! !
! sk unsigned int(8 bit) - Most Probable Symbol. !
! !
! DEPENDENCIES: !
! ------------- !
! Variable Type Description !
! -------- ---- ----------- !
! MPS context* - New context if the coded symbol is a !
! Most Probable Symbol (MPS). !
! !
! LPS context* - New context if the coded symbol is a !
! Least Probable Symbol (LPS). !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 14.02.2019 Patrick Vogler B87D120 V 0.1.0 struct created !
! !
\*----------------------------------------------------------------------------------------------------------*/
\*----------------------------------------------------------------------------------------------*/
typedef struct context
{
uint16_t p;
uint8_t sk;
const struct context *const MPS;
const struct context *const LPS;
uint16_t p; // LPS probability estimate
uint8_t sk; // Most probable symbol
const struct context *const MPS; // New context for Most Probable Symbol
const struct context *const LPS; // New context for Least Probable Symbol
} bwc_context_state;
/*----------------------------------------------------------------------------------------------------------*\
! STRUCT NAME: bwc_coder_state !
! ----------- !
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! - !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! L int(64 bit) - Number of code bytes which have been !
! generated so far. !
! DESCRIPTION NEEDED !
! | | !
! !
! C unsigned int(32 bit) - Lower bound register used to define !
! the lower bound of the coding interval. !
! !
! A unsigned int(16 bit) - Length register used to define the up- !
! bound of the coding interval. !
! !
! t int(8 bit) - Down counter which is used to evaluate !
! when partially generated code bits !
! should be moved out of the C register !
! in to the temporary byte buffer b. !
! !
! b unsigned char* - Byte buffer. !
! !
! T unsigned char - Temporary byte buffer. !
! !
! DEPENDENCIES: !
! ------------- !
! Variable Type Description !
! -------- ---- ----------- !
! next state* - Coder state of the next coding pass. !
! !
! prev state* - Coder state of the previous coding !
! pass. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 14.02.2019 Patrick Vogler B87D120 V 0.1.0 struct created !
! !
\*----------------------------------------------------------------------------------------------------------*/
\*----------------------------------------------------------------------------------------------*/
typedef struct state
{
int64_t L;
uint32_t C;
uint16_t A;
int8_t t;
unsigned char *b;
unsigned char T;
struct state *next;
struct state *prev;
int64_t L; // Number of bytes generated so far
uint32_t C; // Register def. lower bound of coding int
uint16_t A; // Register def. upper bound of coding int
int8_t t; // Counter evaluating when moving C into b
unsigned char *b; // Byte buffer
unsigned char T; // Temporary byte buffer
struct state *next; // State of the next coding phase
struct state *prev; // State of the previous coding phase
} bwc_coder_state;
/*----------------------------------------------------------------------------------------------------------*\
! STRUCT NAME: bwc_bit_coder !
! ----------- !
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! - !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! Lmax unsigned int(64 bit) - Number of code bytes (used by decoder). !
! DESCRIPTION NEEDED !
! | | !
! !
! nContext unsigned int(8 bit) - Number of context states that need to !
! be tracked during (de)compression. !
! !
! b unsigned char* - Temporary byte buffer. !
! !
! DEPENDENCIES: !
! ------------- !
! Variable Type Description !
! -------- ---- ----------- !
! state bwc_coder_state* - Coder state for the current coding !
! pass. !
! !
! context bwc_coder_state* - Context states for the current coding !
! pass. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 14.02.2019 Patrick Vogler B87D120 V 0.1.0 struct created !
! !
\*----------------------------------------------------------------------------------------------------------*/
\*----------------------------------------------------------------------------------------------*/
typedef struct
{
int64_t Lmax;
uint8_t nContext;
unsigned char *b;
bwc_coder_state *state;
bwc_context_state const **context;
int64_t Lmax; // Number of code bytes (used by decoder)
uint8_t nContext; // No. tracked context states
unsigned char *b; // Temporary byte buffer
bwc_coder_state *state; // State for the current coding pass
bwc_context_state const **context; // States for the current coding pass
} bwc_bit_coder;
#endif

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,62 +12,52 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: prim_types_double.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| This header defines a set of basic arithmetic types with specified widths to be used in ||
|| the big whoop compression algorithm. The width of an arithmetic type is defined as the ||
|| number of bits used to store its value. ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 07.12.2017 Patrick Vogler B87D120 V 0.1.0 header file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| This header defines a set of basic arithmetic types with specified widths to be ||
|| used in the big whoop compression algorithm. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| 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: ||
|| 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. ||
|| (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. ||
|| (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. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
#ifndef BWC_PRIM_TYPES_DOUBLE_H
#define BWC_PRIM_TYPES_DOUBLE_H
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
\************************************************************************************************/
#include <stdint.h>
/************************************************************************************************************\
/************************************************************************************************\
|| ___ ____ _ _ _ _ ___ _ _ _ ____ ___ _ _ ___ ____ ____ ||
|| |__] |__/ | |\/| | | | | | |___ | \_/ |__] |___ [__ ||
|| | | \ | | | | | | \/ |___ | | | |___ ___] ||
|| ||
\************************************************************************************************************/
\************************************************************************************************/
typedef unsigned char uchar;
typedef unsigned short ushort;
typedef unsigned int uint;
@ -84,80 +74,60 @@
typedef double bwc_float;
typedef uint64 bwc_raw;
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These constants describe the minimum and maximum values for a double precision IEEE 754 !
! floating point variable. !
! These macros describe the minimum and maximum values for a double precision IEEE !
! 754 floating point variable. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 07.12.2018 Patrick Vogler B87D120 V 0.1.0 Constants created !
\*----------------------------------------------------------------------------------------------------------*/
#define FLT_MAX 1.7976931348623157e+308
#define FLT_MIN 2.2250738585072014e-308
\*----------------------------------------------------------------------------------------------*/
#define FLT_MAX 1.7976931348623157e+308 // Maximum finite value of a double
#define FLT_MIN 2.2250738585072014e-308 // Minimum finite value of a double
/*----------------------------------------------------------------------------------------------------------*\
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These constants describe the precision (in bits and bytes) of the primitive floating point !
! type used during (de)compression as well as the number of bits used to represent the !
! mantissa and exponent fields. !
! These macros describe the precision (in bits and bytes) of the derrived floating !
! point type as well as the number of bits used to represent its mantissa and !
! exponent fields. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 07.12.2018 Patrick Vogler B87D120 V 0.1.0 Constants created !
\*----------------------------------------------------------------------------------------------------------*/
#define PREC_BIT 63
#define PREC_MANTISSA 52
#define PREC_EXPONENT 11
#define PREC_BYTE 8
\*----------------------------------------------------------------------------------------------*/
#define PREC_BIT 63 // Double type precision in bits
#define PREC_MANTISSA 52 // Mantissa field precision in bits
#define PREC_EXPONENT 11 // Exponent field precision in bits
#define PREC_BYTE 8 // Double type precision in bytes
/*----------------------------------------------------------------------------------------------------------*\
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These constants describe the bit masks used to access the sign, mantissa and exponent of !
! the primitive floating point type used during (de)compression. !
! These macros describe the bit masks used to access the sign, mantissa and !
! exponent of the derrived floating point type. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 07.12.2018 Patrick Vogler B87D120 V 0.1.0 Constants created !
\*----------------------------------------------------------------------------------------------------------*/
#define SIGN 0x8000000000000000
#define MANTISSA 0x000FFFFFFFFFFFFF
#define EXPONENT 0x7FF0000000000000
\*----------------------------------------------------------------------------------------------*/
#define SIGN 0x8000000000000000 // Sign bit mask
#define MANTISSA 0x000FFFFFFFFFFFFF // Mantissa bit mask
#define EXPONENT 0x7FF0000000000000 // Exponent bit mask
/*----------------------------------------------------------------------------------------------------------*\
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! This constants describe the maximum number of encoding passes during the entropy encoding !
! stage. !
! This macro describe the maximum number of possible encoding passes during the !
! entropy encoding stage. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 03.07.2018 Patrick Vogler B87D120 V 0.1.0 Constants created !
\*----------------------------------------------------------------------------------------------------------*/
\*----------------------------------------------------------------------------------------------*/
#define MAXIMUM_NO_PASSES (64 * 3) - 2
#endif

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,62 +12,52 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: prim_types_single.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| This header defines a set of basic arithmetic types with specified widths to be used in ||
|| the big whoop compression algorithm. The width of an arithmetic type is defined as the ||
|| number of bits used to store its value. ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 07.12.2017 Patrick Vogler B87D120 V 0.1.0 header file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| This header defines a set of basic arithmetic types with specified widths to be ||
|| used in the big whoop compression algorithm. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| 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: ||
|| 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. ||
|| (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. ||
|| (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. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
#ifndef BWC_PRIM_TYPES_SINGLE_H
#define BWC_PRIM_TYPES_SINGLE_H
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
\************************************************************************************************/
#include <stdint.h>
/************************************************************************************************************\
/************************************************************************************************\
|| ___ ____ _ _ _ _ ___ _ _ _ ____ ___ _ _ ___ ____ ____ ||
|| |__] |__/ | |\/| | | | | | |___ | \_/ |__] |___ [__ ||
|| | | \ | | | | | | \/ |___ | | | |___ ___] ||
|| ||
\************************************************************************************************************/
\************************************************************************************************/
typedef unsigned char uchar;
typedef unsigned short ushort;
typedef unsigned int uint;
@ -84,80 +74,60 @@
typedef float bwc_float;
typedef uint32 bwc_raw;
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These constants describe the minimum and maximum values for a double precision IEEE 754 !
! floating point variable. !
! These macros describe the minimum and maximum values for a single precision IEEE !
! 754 floating point variable. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 07.12.2018 Patrick Vogler B87D120 V 0.1.0 Constants created !
\*----------------------------------------------------------------------------------------------------------*/
#define FLT_MAX 1.70141183e+38
#define FLT_MIN 1.17549435e-38
\*----------------------------------------------------------------------------------------------*/
#define FLT_MAX 1.70141183e+38 // Maximum finite value of a float
#define FLT_MIN 1.17549435e-38 // Minimum finite value of a float
/*----------------------------------------------------------------------------------------------------------*\
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These constants describe the precision (in bits and bytes) of the primitive floating point !
! type used during (de)compression as well as the number of bits used to represent the !
! mantissa and exponent fields. !
! These macros describe the precision (in bits and bytes) of the derrived floating !
! point type as well as the number of bits used to represent its mantissa and !
! exponent fields. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 07.12.2018 Patrick Vogler B87D120 V 0.1.0 Constants created !
\*----------------------------------------------------------------------------------------------------------*/
#define PREC_BIT 31
#define PREC_MANTISSA 23
#define PREC_EXPONENT 8
#define PREC_BYTE 4
\*----------------------------------------------------------------------------------------------*/
#define PREC_BIT 31 // Float type precision in bits
#define PREC_MANTISSA 23 // Mantissa field precision in bits
#define PREC_EXPONENT 8 // Exponent field precision in bits
#define PREC_BYTE 4 // Float type precision in bytes
/*----------------------------------------------------------------------------------------------------------*\
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These constants describe the bit masks used to access the sign, mantissa and exponent of !
! the primitive floating point type used during (de)compression. !
! These macros describe the bit masks used to access the sign, mantissa and !
! exponent of the derrived floating point type. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 07.12.2018 Patrick Vogler B87D120 V 0.1.0 Constants created !
\*----------------------------------------------------------------------------------------------------------*/
#define SIGN 0x80000000
#define MANTISSA 0x007FFFFF
#define EXPONENT 0x7F800000
\*----------------------------------------------------------------------------------------------*/
#define SIGN 0x80000000 // Sign bit mask
#define MANTISSA 0x007FFFFF // Mantissa bit mask
#define EXPONENT 0x7F800000 // Exponent bit mask
/*----------------------------------------------------------------------------------------------------------*\
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! This constants describe the maximum number of encoding passes during the entropy encoding !
! stage. !
! This macro describe the maximum number of possible encoding passes during the !
! entropy encoding stage. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 03.07.2018 Patrick Vogler B87D120 V 0.1.0 Constants created !
\*----------------------------------------------------------------------------------------------------------*/
\*----------------------------------------------------------------------------------------------*/
#define MAXIMUM_NO_PASSES (32 * 3) - 2
#endif

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,150 +12,85 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: tagtree.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| DESCRIPTION NEEDED. ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| This file defines a tagtree procedure used to encode/decode two types of ||
|| information found defining in a codeblock in specific quality layer: ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| - The inclusion tag records if a codeblock has any contribution ||
|| to a quality layer. ||
|| - The number of leading bitplanes that are not significant/only ||
|| populated by zero bits. ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 18.05.2018 Patrick Vogler B87D120 V 0.1.0 header file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| For more information on the encoding/decoding process please refere to JPEG2000 ||
|| by D. S. Taubman and M. W. Marcellin (p. 384). ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| 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: ||
|| 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. ||
|| (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. ||
|| (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. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
#ifndef TAGTREE_H
#define TAGTREE_H
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
\************************************************************************************************/
#include "types.h"
#include "bitstream.h"
/************************************************************************************************************\
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void kill_tagtree(bwc_tagtree* tagtree) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function deallocates a tagtree instance used to encode codeblock contributions to a !
! specific quality layer as well as the number of magnitude bit planes used to represent the !
! samples of a specific codeblock. !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
kill_tagtree(bwc_tagtree* tagtree);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
reset_tagtree(bwc_tagtree* const tagtree);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
uint16
tagtree_get_value(const bwc_tagtree* const tagtree, const uint64 leaf_index);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
tagtree_set_value(bwc_tagtree* const tagtree, const uint64 leaf_index, const uint16 value);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
bwc_tagtree*
initialize_tagtree(const uint64 leafsX, const uint64 leafsY, const uint64 leafsZ, const uint64 leafsTS);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
encode_tagtree(bwc_tagtree *const tagtree, bwc_stream *const stream, const uint32 threshold, const uint32 leaf_index, const uchar estimate);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
decode_tagtree(bwc_tagtree *const tagtree, bwc_stream *const stream, const uint32 threshold, const uint32 leaf_index);
\************************************************************************************************/
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,
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,
uint16 const value);
//==========|==========================|======================|======|=======|====================
void encode_tagtree (bwc_tagtree *const tagtree,
bitstream *const stream,
uint32 const threshold,
uint32 const leaf_index,
uchar const estimate);
//==========|==========================|======================|======|=======|====================
uchar decode_tagtree (bwc_tagtree *const tagtree,
bitstream *const stream,
uint32 const threshold,
uint32 const leaf_index);
#endif

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,142 +12,157 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: tier1.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| DESCRIPTION NEEDED. ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| - Patrick Vogler B87D120 V 0.1.0 header file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| This file describes a set of functions that can be used to de-/encode bwc ||
|| codeblocks described by the bwc_field structure according to the embedded block ||
|| coding paradigm described by the JPEG 2000 standard. For more information please ||
|| refere to JPEG2000 by D. S. Taubman and M. W. Marcellin. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| 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: ||
|| 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. ||
|| (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. ||
|| (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. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
#ifndef TIER1_H
#define TIER1_H
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
\************************************************************************************************/
#include "types.h"
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! This macro defines the maximum decomposition level up to which the wavelet filer energy gain !
! is calculated. Beyond the maximum decomposition level the energy gain will only be !
! approximated. !
! The macros listed indicate how many bits, from the current coding position, !
! are used for error evaluation in the coding passes. !
! !
! Macros: !
! ------- !
! Macro Description !
! ----- ----------- !
! MAX_DECOMPOSITION_LEVELS - Maximum number of wavelet layers for which the energy !
! gain is calculated. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 20.03.2018 Patrick Vogler B87D120 V 0.1.0 Macros created !
\*----------------------------------------------------------------------------------------------------------*/
#define DISTORTION_DELTA 0.5f
#define DISTORTION_MANTISSA 5
#define DISTORTION_PRECISION 6
\*----------------------------------------------------------------------------------------------*/
#define DISTORTION_SIG 5 // Clean up/significance propagation pass.
#define DISTORTION_MAG 6 // Magnitude refinement pass.
/*----------------------------------------------------------------------------------------------------------*\
/************************************************************************************************\
|| ___ ____ ____ ____ _ _ _ ____ ___ ___ _ _ ___ ____ ____ ||
|| | \ |___ |__/ |__/ | | | |___ | \ | \_/ |__] |___ [__ ||
|| |__/ |___ | \ | \ | \/ |___ |__/ | | | |___ ___] ||
|| ||
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These macros define the irrational coefficients for the high and low pass synthesis filters !
! associated with the (5-3) LeGall-Wavelet. !
! 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. !
! !
! Macros: !
! ------- !
! Macro Description !
! ----- ----------- !
! DWT_5X3_H0 - Coefficients for the (9-7) !
! DWT_5X3_H1 low pass synthesis filter. !
! !
! DWT_5X3_G0 !
! DWT_5X3_G1 - Coefficients for the (9-7) !
! DWT_5X3_G2 high pass synthesis filter. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 20.03.2018 Patrick Vogler B87D120 V 0.1.0 Macros created !
\*----------------------------------------------------------------------------------------------------------*/
#define DWT_5X3_H0 1.0f
#define DWT_5X3_H1 0.5f
\*----------------------------------------------------------------------------------------------*/
typedef struct stripe
{
uint64 *sample; // Wavelet coef. for two adjacent stripes.
#define DWT_5X3_G0 0.75f
#define DWT_5X3_G1 -0.25f
#define DWT_5X3_G2 -0.125f
uint8 delta; // Delayed sig. for two adjacent stripes.
uint8 sigma; // Significance for two adjacent stripes.
uint8 pi; // Cdng 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.
struct stripe *stripe_u; // Upper stripe.
struct stripe *stripe_r; // Right stripe.
struct stripe *stripe_d; // Lower stripe.
struct stripe *stripe_l; // Left stripe.
} bwc_coder_stripe;
/*----------------------------------------------------------------------------------------------*\
! !
! 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. !
! !
\*----------------------------------------------------------------------------------------------*/
typedef struct
{
uchar highband_flag; // Flag indicating current wavelet subbnd.
uint8 K; // Idx of the first significant bitplane.
uchar erres; // 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.
uint8 const *sig2context; // Signifance-to-context loop-up table.
bwc_bit_coder *bitcoder; // BWC bitcoder.
bwc_coder_stripe *data; // BWC coder stripe.
uint64 buff_size; // Size of packed stream.
uint64 buff_incr; // Increment for packed stream assembly.
uchar *compressed; // Compressed data chunck.
} bwc_coder;
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! TYPE NAME: Template !
! ----------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
t1_encode(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const parameter);
\************************************************************************************************/
uchar t1_encode (bwc_field *const field,
bwc_tile *const tile,
bwc_parameter *const parameter);
//==========|==========================|======================|======|=======|====================
uchar t1_decode (bwc_field *const field,
bwc_tile *const tile,
bwc_parameter *const parameter);
uchar
t1_decode(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const parameter);
#endif

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,122 +12,75 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: tier2.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| DESCRIPTION NEEDED. ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| - t2_encode ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| - Patrick Vogler B87D120 V 0.1.0 header file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| This file describes a set of functions that can be used to de-/encode bwc ||
|| codeblocks described by the bwc_field structure according to the embedded block ||
|| coding paradigm described by the JPEG 2000 standard. For more information please ||
|| refere to JPEG2000 by D. S. Taubman and M. W. Marcellin. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| 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: ||
|| 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. ||
|| (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. ||
|| (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. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
#ifndef TIER2_H
#define TIER2_H
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
\************************************************************************************************/
#include "types.h"
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! This macro defines the initial packet header size. !
! Definition of the initial codestream packet header size. !
! !
! Macros: !
! ------- !
! Macro Description !
! ----- ----------- !
! PACKET_HEADER_SIZE - Initial packet header size. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 10.05.2019 Patrick Vogler B87D120 V 0.1.0 Macros created !
\*----------------------------------------------------------------------------------------------------------*/
\*----------------------------------------------------------------------------------------------*/
#define PACKET_HEADER_SIZE 512
/************************************************************************************************************\
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: uchar t2_encode(bwc_field *const field, bwc_tile *const tile) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function defines the rate control portion of the entropy encoding stage. In !
! the first step, the quality layers are evaluated according to the bitrates de- !
! fined by the user. The quality layers are then used to create the data packets !
! that comprise the bwc codestream. !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
t2_encode(bwc_field *const field, bwc_tile *const tile);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: uchar parse_packet(bwc_field *const field, bwc_tile *const tile, !
! -------------- bwc_packet *const packet, !
! uint64 const body_size) !
! !
! DESCRIPTION: !
! ------------ !
! This function is used to parse a codestream packet for a given precinct (prec_idx) !
! and quality layer (q_layer). !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
parse_packet(bwc_field *const field, bwc_tile *const tile,
\************************************************************************************************/
uchar t2_encode (bwc_field *const field,
bwc_tile *const tile);
//==========|==========================|======================|======|=======|====================
uchar parse_packet (bwc_field *const field,
bwc_tile *const tile,
bwc_packet *const packet,
uint64 const body_size);
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
#*====================================================================================================================*#
#*================================================================================================*#
#| |#
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
@ -14,41 +14,40 @@
#| |#
#| DESCRIPTION: |#
#| ------------ |#
#| This file describes python script used to assemble the public header file for the |#
#| BigWhoop compression library. |#
#| |#
#| DEVELOPMENT HISTORY: |#
#| -------------------- |#
#| |#
#| Date Author Change Id Release Description Of Change |#
#| ---- ------ --------- ------- --------------------- |#
#| 02.02.2020 Patrick Vogler B87D120 V 0.1.0 script created |#
#| |#
#| |#
#| ------------------------------------------------------------------------------------------------------ |#
#| This file describes python script used to assemble the public header file for |#
#| the BigWhoop 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: |#
#| 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. |#
#| 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. |#
#| |#
#\====================================================================================================================/#
#*================================================================================================*#
#**************************************************************************************************#
#| _ _ _ ___ ____ ____ ___ |#
#| | |\/| |__] | | |__/ | |#
#| | | | | |__| | \ | |#
#| |#
#**************************************************************************************************#
from argparse import ArgumentParser
from math import ceil, floor
from pathlib import Path
@ -57,6 +56,20 @@ import os
import re
import sys
#-------------------------#
# DEFINE CONSTANTS: #
#-------------------------#
tab = " "
text_width = 100
deliminator = tab + "/*" + (text_width - 4 - len(tab)) * "=" + "*/\n"
ubox = tab + "/" + (text_width - 2 - len(tab)) * "*" + "\\\n"
lbox = tab + "\\" + (text_width - 2 - len(tab)) * "*" + "/\n"
sbox = "||"
#----------------------------------------------------------#
# Setup the argument parser for the public header script #
# and parse for the user defined OpenMP and Precision arg. #
#----------------------------------------------------------#
parser = ArgumentParser(description='Public Header Assembly Script')
parser.add_argument('-OMP', dest='OpenMP', action='store_const',
const=True, default=False,
@ -67,40 +80,33 @@ parser.add_argument('-Single', dest='SinglePrecision', action='store_const',
args = parser.parse_args()
#----------------------------------------------------------#
# Setup the paths to the source and destination. #
#----------------------------------------------------------#
current_path = Path().absolute()
source = current_path.joinpath('include/library/private')
if os.path.isdir('include/library/public') == False:
os.mkdir('include/library/public')
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)
with open(source.joinpath('libbwc.h')) as f:
regex = re.compile("(?<=Version )(?:(\d+\.(?:\d+\.)*\d+))")
Version = ""
tab = ""
for line in f:
if not Version:
Version = regex.findall(line)
if("#include" in line):
tab = line[0:len(line) - len(line.lstrip(' '))]
if tab:
if not Version:
sys.exit("No Version was specified")
else:
break
f.close
deliminator = tab + "/*" + (116 - len(tab)) * "=" + "*/\n"
ubox = tab + "/" + (118 - len(tab)) * "*" + "\\\n"
lbox = tab + "\\" + (118 - len(tab)) * "*" + "/\n"
#----------------------------------------------------------#
# Create the I/O stream and write the bwc file header. #
#----------------------------------------------------------#
public_header = open(destination.joinpath('bwc.h'), 'w+')
public_header.write("/*====================================================================================================================*\\\n"
public_header.write("/*================================================================================================*\\\n"
"|| ||\n"
"|| /$$$$$$$ /$$ /$$ /$$ /$$ ||\n"
"|| | $$__ $$|__/ | $$ /$ | $$| $$ ||\n"
@ -114,173 +120,225 @@ public_header.write("/*=========================================================
"|| | $$$$$$/ | $$ ||\n"
"|| \______/ |__/ ||\n"
"|| ||\n"
"|| ||\n"
"|| Version " +
Version[-1] + " ||\n"
"|| ||\n"
"|| ------------------------------------------------------------------------------------------------------ ||\n"
"|| ||\n"
"|| -------------------------------------------------------------------------------------------- ||\n"
"|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||\n"
"|| ||\n"
"|| Redistribution and use in source and binary forms, with or without modification, are permitted provided ||\n"
"|| that the following conditions are met: ||\n"
"|| Redistribution and use in source and binary forms, with or without modification, are ||\n"
"|| permitted provided that the following conditions are met: ||\n"
"|| ||\n"
"|| (1) Redistributions of source code must retain the above copyright notice, this list of ||\n"
"|| conditions and the following disclaimer. ||\n"
"|| ||\n"
"|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||\n"
"|| of conditions and the following disclaimer in the documentation and/or other materials ||\n"
"|| provided with the distribution. ||\n"
"|| of conditions and the following disclaimer in the documentation and/or other ||\n"
"|| materials provided with the distribution. ||\n"
"|| ||\n"
"|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED ||\n"
"|| WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A ||\n"
"|| PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ||\n"
"|| ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ||\n"
"|| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ||\n"
"|| INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR ||\n"
"|| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ||\n"
"|| ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||\n"
"|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS ||\n"
"|| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ||\n"
"|| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ||\n"
"|| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ||\n"
"|| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ||\n"
"|| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ||\n"
"|| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR ||\n"
"|| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ||\n"
"|| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||\n"
"|| ||\n"
"\*====================================================================================================================*/\n"
"\*================================================================================================*/\n"
"#ifndef BWC_H\n"
"#define BWC_H\n")
lspaces = ceil((116 - 31 - len(tab))/2)
rspaces = floor((116 - 31 - len(tab))/2)
#----------------------------------------------------------#
# Generate the necessary includes for the bwc.h file. #
#----------------------------------------------------------#
title_length = 31
public_header.write(ubox + tab + "||" + lspaces * " " + "_ _ _ ____ _ _ _ ___ ____" + rspaces * " " + "||\n" +
tab + "||" + lspaces * " " + "| |\ | | | | | | \ |___" + rspaces * " " + "||\n" +
tab + "||" + lspaces * " " + "| | \| |___ |___ |__| |__/ |___" + rspaces * " " + "||\n" +
tab + "||" + (116 - len(tab)) * " " + "||\n" + lbox)
lspaces = ceil((text_width - 2*len(sbox) - title_length - len(tab))/2)
rspaces = floor((text_width - 2*len(sbox) - title_length - len(tab))/2)
public_header.write(ubox + tab + sbox + lspaces * " " + "_ _ _ ____ _ _ _ ___ ____" + rspaces * " " + sbox + "\n" +
tab + sbox + lspaces * " " + "| |\ | | | | | | \ |___" + rspaces * " " + sbox + "\n" +
tab + sbox + lspaces * " " + "| | \| |___ |___ |__| |__/ |___" + rspaces * " " + sbox + "\n" +
tab + sbox + (text_width - 2*len(sbox) - len(tab)) * " " + "||\n" + lbox)
public_header.write(tab + "#include <stdio.h>\n" + tab + "#include <stdint.h>\n\n")
lspaces = ceil((116 - 62 - len(tab))/2)
rspaces = floor((116 - 62 - len(tab))/2)
#----------------------------------------------------------#
# Ingest primitive type definitions from the corresponding #
# header files according to the user specified precision. #
#----------------------------------------------------------#
title_length = 62
public_header.write(ubox + tab + "||" + lspaces * " " + "___ ____ _ _ _ _ ___ _ _ _ ____ ___ _ _ ___ ____ ____" + rspaces * " " + "||\n" +
tab + "||" + lspaces * " " + "|__] |__/ | |\/| | | | | | |___ | \_/ |__] |___ [__ " + rspaces * " " + "||\n" +
tab + "||" + lspaces * " " + "| | \ | | | | | | \/ |___ | | | |___ ___]" + rspaces * " " + "||\n" +
tab + "||" + (116 - len(tab)) * " " + "||\n" + lbox)
lspaces = ceil((text_width - 2*len(sbox) - title_length - len(tab))/2)
rspaces = floor((text_width - 2*len(sbox) - title_length - len(tab))/2)
public_header.write(ubox + tab + sbox + lspaces * " " + "___ ____ _ _ _ _ ___ _ _ _ ____ ___ _ _ ___ ____ ____" + rspaces * " " + "||\n" +
tab + sbox + lspaces * " " + "|__] |__/ | |\/| | | | | | |___ | \_/ |__] |___ [__ " + rspaces * " " + "||\n" +
tab + sbox + lspaces * " " + "| | \ | | | | | | \/ |___ | | | |___ ___]" + rspaces * " " + "||\n" +
tab + sbox + (text_width - 2*len(sbox) - len(tab)) * " " + "||\n" + lbox)
if(args.SinglePrecision == True):
file = "prim_types_single.h"
else:
file = "prim_types_double.h"
print_flag = 0
print_flag = False
with open(source.joinpath(file)) as f:
for line in f:
if("/*" in line and print_flag == 1):
break
if("typedef" in line or print_flag == 1):
print_flag = 1
print_flag = True
public_header.write(line)
f.close
lspaces = ceil((116 - 29 - len(tab))/2)
rspaces = floor((116 - 29 - len(tab))/2)
#----------------------------------------------------------#
# Ingest Macros with 'BWC_' prefix from all header files. #
#----------------------------------------------------------#
title_length = 29
public_header.write(ubox + tab + "||" + lspaces * " " + "_ _ ____ ____ ____ ____ ____" + rspaces * " " + "||\n" +
tab + "||" + lspaces * " " + "|\/| |__| | |__/ | | [__ " + rspaces * " " + "||\n" +
tab + "||" + lspaces * " " + "| | | | |___ | \ |__| ___]" + rspaces * " " + "||\n" +
tab + "||" + (116 - len(tab)) * " " + "||\n" + lbox)
lspaces = ceil((text_width - 2*len(sbox) - title_length - len(tab))/2)
rspaces = floor((text_width - 2*len(sbox) - title_length - len(tab))/2)
with open(source.joinpath('prim_types_double.h')) as f:
public_header.write(ubox + tab + sbox + lspaces * " " + "_ _ ____ ____ ____ ____ ____" + rspaces * " " + "||\n" +
tab + sbox + lspaces * " " + "|\/| |__| | |__/ | | [__ " + rspaces * " " + "||\n" +
tab + sbox + lspaces * " " + "| | | | |___ | \ |__| ___]" + rspaces * " " + "||\n" +
tab + sbox + (text_width - 2*len(sbox) - len(tab)) * " " + "||\n" + lbox)
with open(source.joinpath(file)) as f:
for line in f:
if("#define" in line):
if("PREC_BIT" in line):
if("MAXIMUM_NO_PASSES" in line or
"PREC_BIT" in line):
if("//" in line):
public_header.write((line.split('/', 1)[0]).rstrip() + '\n')
else:
public_header.write(line)
elif("#define MAXIMUM_NO_PASSES" in line):
public_header.write(line + "\n")
break
f.close
lspaces = ceil((116 - 42 - len(tab))/2)
rspaces = floor((116 - 42 - len(tab))/2)
printFlg = False
buff = ""
brktCnt = 0
public_header.write(ubox + tab + "||" + lspaces * " " + "____ ____ _ _ ____ ___ ____ _ _ ___ ____" + rspaces * " " + "||\n" +
tab + "||" + lspaces * " " + "| | | |\ | [__ | |__| |\ | | [__ " + rspaces * " " + "||\n" +
tab + "||" + lspaces * " " + "|___ |__| | \| ___] | | | | \| | ___]" + rspaces * " " + "||\n" +
tab + "||" + (116 - len(tab)) * " " + "||\n" + lbox)
print_flag = -1
with open(source.joinpath('constants.h')) as f:
for file in include_files:
with open(source.joinpath(file)) as f:
for line in f:
if(";" in line and print_flag == 1):
print_flag = 0
public_header.write(line)
if("typedef" in line or print_flag == 1):
if(print_flag == 0):
public_header.write(deliminator)
print_flag = 1
public_header.write(line)
f.close
if("BWC_" in line):
if("ifndef" in line):
next(f)
elif("#define" in line and line[len(line) - len(line.lstrip())] != "/"):
while True:
if("//" in line):
buff = buff + (line.split('/', 1)[0]).rstrip() + '\n'
else:
buff = buff + line
if("\\" not in line):
public_header.write(buff+"\n")
buff = ""
break
line = next(f)
f.close
public_header.write("\n")
lspaces = ceil((116 - 64 - len(tab))/2)
rspaces = floor((116 - 64 - len(tab))/2)
#----------------------------------------------------------#
# Ingest enums with 'bwc_' prefix from all header files #
# excluding prim_types_****.h. #
#----------------------------------------------------------#
title_length = 42
lspaces = ceil((text_width - 2*len(sbox) - title_length - len(tab))/2)
rspaces = floor((text_width - 2*len(sbox) - title_length - len(tab))/2)
public_header.write(ubox + tab + sbox + lspaces * " " + "____ ____ _ _ ____ ___ ____ _ _ ___ ____" + rspaces * " " + "||\n" +
tab + sbox + lspaces * " " + "| | | |\ | [__ | |__| |\ | | [__ " + rspaces * " " + "||\n" +
tab + sbox + lspaces * " " + "|___ |__| | \| ___] | | | | \| | ___]" + rspaces * " " + "||\n" +
tab + sbox + (text_width - 2*len(sbox) - len(tab)) * " " + "||\n" + lbox)
delimFlg = False
buff = ""
for file in include_files:
with open(source.joinpath(file)) as f:
for line in f:
if("typedef enum" in line):
while True:
buff = buff + (line.split('/', 1)[0]).rstrip() + '\n'
if("}" in line and ";" in line):
if("bwc_" in line):
if(delimFlg == True):
public_header.write(deliminator)
public_header.write(buff)
delimFlg = True
buff = ""
break
line = next(f)
f.close
#----------------------------------------------------------#
# Ingest derived types with 'bwc_' prefix from all header #
# files excluding prim_types_****.h. #
#----------------------------------------------------------#
title_length = 64
lspaces = ceil((text_width - 2*len(sbox) - title_length - len(tab))/2)
rspaces = floor((text_width - 2*len(sbox) - title_length - len(tab))/2)
public_header.write("\n")
public_header.write(ubox + tab + "||" + lspaces * " " + "___ ____ ____ ____ _ _ _ ____ ___ ___ _ _ ___ ____ ____" + rspaces * " " + "||\n" +
tab + "||" + lspaces * " " + "| \ |___ |__/ |__/ | | | |___ | \ | \_/ |__] |___ [__ " + rspaces * " " + "||\n" +
tab + "||" + lspaces * " " + "|__/ |___ | \ | \ | \/ |___ |__/ | | | |___ ___]" + rspaces * " " + "||\n" +
tab + "||" + (116 - len(tab)) * " " + "||\n" + lbox)
public_header.write(ubox + tab + sbox + lspaces * " " + "___ ____ ____ ____ _ _ _ ____ ___ ___ _ _ ___ ____ ____" + rspaces * " " + "||\n" +
tab + sbox + lspaces * " " + "| \ |___ |__/ |__/ | | | |___ | \ | \_/ |__] |___ [__ " + rspaces * " " + "||\n" +
tab + sbox + lspaces * " " + "|__/ |___ | \ | \ | \/ |___ |__/ | | | |___ ___]" + rspaces * " " + "||\n" +
tab + sbox + (text_width - 2*len(sbox) - len(tab)) * " " + "||\n" + lbox)
printFlg = False
delimFlg = False
preProcFlg = False
preProc = ""
buff = ""
brktCnt = 0
for file in ["mq_types.h", "types.h"]:
for file in include_files:
with open(source.joinpath(file)) as f:
for line in f:
if("typedef" in line):
if("typedef struct" in line or
"typedef union" in line):
if("bwc_" in line):
printFlg = True
while True:
if("#if" in line):
if("_OPENMP" in line):
preProcFlg = True
while True:
line = next(f)
if("endif" in line):
break
preProc = preProc + line[len(tab):len(line)]
if(preProcFlg and args.OpenMP == True):
buff = buff + preProc
preProcFlg = False
preProc = ""
else:
buff = buff + line
buff = buff + (line.split('/', 1)[0]).rstrip() + '\n'
if("{" in line):
brktCnt = brktCnt + 1
if("}" in line):
brktCnt = brktCnt - 1
if(brktCnt == 0):
if("bwc_" in line):
printFlg = True
break
line = next(f)
if("bwc_" in line):
if(printFlg == True):
buff = deliminator + buff
else:
printFlg = True
if (printFlg == True):
if(delimFlg == True):
public_header.write(deliminator)
public_header.write(buff)
delimFlg = True
printFlg = False
buff = ""
f.close
lspaces = ceil((116 - 70 - len(tab))/2)
rspaces = floor((116 - 70 - len(tab))/2)
#----------------------------------------------------------#
# Ingest public functions with 'bwc_' prefix from all #
# header files excluding prim_types_****.h. #
#----------------------------------------------------------#
title_length = 70
public_header.write("\n" + ubox + tab + "||" + lspaces * " " + "___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____" + rspaces * " " + "||\n" +
tab + "||" + lspaces * " " + "|__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ " + rspaces * " " + "||\n" +
tab + "||" + lspaces * " " + "| |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___]" + rspaces * " " + "||\n" +
tab + "||" + (116 - len(tab)) * " " + "||\n" + lbox)
lspaces = ceil((text_width - 2*len(sbox) - title_length - len(tab))/2)
rspaces = floor((text_width - 2*len(sbox) - title_length - len(tab))/2)
public_header.write("\n" + ubox + tab + sbox + lspaces * " " + "___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____" + rspaces * " " + "||\n" +
tab + sbox + lspaces * " " + "|__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ " + rspaces * " " + "||\n" +
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
@ -291,27 +349,16 @@ buff = ""
for file in files:
with open(source.joinpath(file)) as f:
for line in f:
if("#ifdef" in line or "#if defined" in line):
if("_OPENMP" in line and args.OpenMP == True):
ltab = len(tab)
if("#if defined" in line):
line = next(f)
else:
while ("#endif" not in line):
line = next(f)
if("#endif" in line):
ltab = 0
if("(" in line):
tmp = line[0:line.index('(')]
tmp = line[0:line.index('(')].strip()
tmp = tmp[tmp.rfind(' '):-1]
else:
tmp = ""
if("bwc_" in tmp and "!" not in line):
if("/*" in buff or "*/" in buff):
if("bwc_" in tmp and "!" not in line and "#if" not in line):
if("/*" in buff or "*/" in buff or "//" in buff):
buff = ""
else:
buff = buff[ltab:len(buff)]
if(print_flag == True):
buff = deliminator + buff
@ -327,5 +374,10 @@ 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

@ -0,0 +1,421 @@
!*================================================================================================*!
!| |!
!| /$$$$$$$ /$$ /$$ /$$ /$$ |!
!| | $$__ $$|__/ | $$ /$ | $$| $$ |!
!| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |!
!| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |!
!| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |!
!| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |!
!| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |!
!| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |!
!| /$$ \ $$ | $$ |!
!| | $$$$$$/ | $$ |!
!| \______/ |__/ |!
!| |!
!| 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

@ -1,9 +1,9 @@
#/=====================================================================================================================\#
#*================================================================================================*#
#| |#
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
#! | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
@ -15,66 +15,38 @@
#| DESCRIPTION: |#
#| ------------ |#
#| |#
#| This file defines a Python interface for the Big Whoop compression library |#
#| |#
#| FUNCTIONS: |#
#| ---------- |#
#| - bwc_free_field |#
#| - bwc_add_param |#
#| - bwc_set_tiles |#
#| - bwc_set_kernels |#
#| - bwc_set_decomp |#
#| - bwc_set_precincts |#
#| - bwc_set_codeblocks |#
#| - bwc_set_progression |#
#| - bwc_set_error_resilience |#
#| - bwc_set_quantization_style |#
#| - bwc_set_qm |#
#| - bwc_set_quantization_step_size |#
#| - bwc_set_nThreads |#
#| - bwc_set_memory_limit |#
#| - bwc_compress |#
#| - bwc_decompress |#
#| |#
#| |#
#| DEVELOPMENT HISTORY: |#
#| -------------------- |#
#| |#
#| Date Author Change Id Release Description |#
#| ---- ------ --------- ------- ----------- |#
#| 17.03.2021 Patrick Vogler B87D120 V 0.1.0 Python Module created |#
#| |#
#| |#
#| ------------------------------------------------------------------------------------------------------ |#
#| This file defines a Python 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: |#
#| 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. |#
#| 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. |#
#| |#
#\=====================================================================================================================/#
#/=====================================================================================================================\#
#*================================================================================================*#
#**************************************************************************************************#
#| _ _ _ ____ _ _ _ ___ ____ |#
#| | |\ | | | | | | \ |___ |#
#| | | \| |___ |___ |__| |__/ |___ |#
#| |#
#\=====================================================================================================================/#
#**************************************************************************************************#
import ctypes
from numpy.ctypeslib import ndpointer
@ -82,12 +54,12 @@ from enum import Enum
libbwc = ctypes.cdll.LoadLibrary("../../../lib/libbwc.so")
#/=====================================================================================================================\#
#**************************************************************************************************#
#| ____ ____ _ _ ____ ___ ____ _ _ ___ ____ |#
#| | | | |\ | [__ | |__| |\ | | [__ |#
#| |___ |__| | \| ___] | | | | \| | ___] |#
#| |#
#\=====================================================================================================================/#
#**************************************************************************************************#
class _const():
class DWT(Enum):
CDF_9_7 = 0
@ -106,18 +78,18 @@ class _const():
NUMBOF = 1
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
fun.restype = ctypes.c_void_p
@ -129,7 +101,7 @@ def initialize_data(data, nX, nY, nZ, nTS, nPar, file_extension):
ctypes.c_uint8,
ctypes.c_char_p]
return ctypes.c_void_p(fun(data, nX, nY, nZ, nTS, nPar, file_extension.encode('utf-8')))
#=======================================================================================================================#
#==================================================================================================#
def get_data(data, buffer, size):
fun = libbwc.bwc_get_data
fun.restype = None
@ -137,7 +109,7 @@ def get_data(data, buffer, size):
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
@ -147,75 +119,91 @@ def add_param(data, name, sample, dim, precision):
ctypes.c_uint8,
ctypes.c_uint8]
fun(data, name.encode('utf-8'), sample, dim, precision)
#=======================================================================================================================#
#==================================================================================================#
def kill_compression(field):
fun = libbwc.bwc_kill_compression
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_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_codeblocks(field, cbX, cbY, cbZ, cbTS):
fun = libbwc.bwc_set_codeblocks
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, 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.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.argtypes = [ctypes.c_void_p,
ctypes.c_int8]
fun(field, Qm)
#=======================================================================================================================#
#==================================================================================================#
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_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
fun.restype = None
fun.argtypes = [ctypes.c_void_p, ctypes.c_char_p]
fun.argtypes = [ctypes.c_void_p,
ctypes.c_char_p]
fun(field, rate_control.encode('utf-8'))
#=======================================================================================================================#
#==================================================================================================#
def compress(field, data):
fun = libbwc.bwc_compress
fun.restype = None
fun.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
fun.argtypes = [ctypes.c_void_p,
ctypes.c_void_p]
fun(field, data)
#=======================================================================================================================#
#==================================================================================================#
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]
fun.argtypes = [ctypes.c_void_p,
ctypes.c_uint8]
return ctypes.c_void_p(fun(field, data))
#=======================================================================================================================#
#==================================================================================================#
def decompress(field, data):
fun = libbwc.bwc_decompress
fun.restype = None
fun.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
fun.argtypes = [ctypes.c_void_p,
ctypes.c_void_p]
fun(field, data)

View file

@ -84,6 +84,423 @@
|| | | \ | \/ | | | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: uint32 bytes_used(bitstream *const stream) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function is used to evaluate the number of bytes that have already been !
! written to the allocated bitstream memory block. !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! stream bitstream* - Structure that !
! !
! RETURN VALUE: !
! ------------- !
! Type Description !
! ---- ----------- !
! unsigned int(32 bit) - Number of bites that have been written to the !
! bitstream. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 13.05.2019 Patrick Vogler B87D120 V 0.1.0 function created !
! !
\*----------------------------------------------------------------------------------------------------------*/
uint64
bytes_used(bitstream const *const stream)
{
if(stream->T == 0xFF)
{
return stream->L + 1;
}
else
{
return stream->L;
}
}
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: bitstream* bwc_init_stream(uchar* memory, uint32 size, char instr) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function is used to initialize a bwc bitstream. For encoding, a null pointer !
! is passed as a memory handle and the function will allocate a memory block with the !
! specified stream size. For decoding, a valid memory handle, passed by the function !
! caller, will be stored in the bitstream structure. The byte buffer counter t, !
! stream size Lmax and size increment are initialized with their appropriate values. !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! size unsigned int(32 bit) - Initial size of the bwc stream. !
! !
! memory unsigned char - Memory handle for the bwc stream memory !
! block. !
! !
! instr char - Constant used to instruct the field !
! initialization. !
! !
! RETURN VALUE: !
! ------------- !
! Type Description !
! ---- ----------- !
! bitstream* - Memory handle for the initialized bwc stream. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 19.06.2019 Patrick Vogler B87D120 V 0.1.0 function created !
! !
\*----------------------------------------------------------------------------------------------------------*/
bitstream*
init_stream(uchar* memory, uint32 size, char instr)
{
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/
bitstream *stream;
/*-----------------------*\
! DEFINE ASSERTIONS: !
\*-----------------------*/
assert(instr == 'c' || instr == 'd');
/*--------------------------------------------------------*\
! Allocate the bwc stream structure. !
\*--------------------------------------------------------*/
stream = calloc(1, sizeof(bitstream));
if(!stream)
{
// memory allocation error
fprintf(stderr, MEMERROR);
return NULL;
}
/*--------------------------------------------------------*\
! Evaluate if a valid memory handle has been passed by the !
! function caller. !
\*--------------------------------------------------------*/
if(!memory)
{
/*--------------------------------------------------------*\
! If no valid memory handle has been passed, allocate a !
! memory block with the specifiec stream size. !
\*--------------------------------------------------------*/
stream->memory = calloc(size, sizeof(uchar));
if(!stream->memory)
{
// memory allocation error
fprintf(stderr, MEMERROR);
return NULL;
}
}
else
{
/*--------------------------------------------------------*\
! If a valid memory handle has been passed for decoding, !
! save the memory handle in the bwc stream structure. !
\*--------------------------------------------------------*/
stream->memory = memory;
}
/*--------------------------------------------------------*\
! Initialize the byte buffer counter, stream size and size !
! increment for the current stream. !
\*--------------------------------------------------------*/
stream->t = (instr == 'c') ? 8 : 0;
stream->Lmax = size;
stream->size_incr = (uint64)(size / 2);
/*--------------------------------------------------------*\
! Return the stream memory handle. !
\*--------------------------------------------------------*/
return stream;
}
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void bwc_emit_chunck(bitstream *const stream, const uchar* string, const uint64 length) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function is used to write an additional chunck of size length to a bwc bitstream. !
! !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! stream bitstream* - Structure used to assemble a bwc bit- !
! bitstream. !
! !
! chunck unsigned char* - Memory handle for a data block that is !
! to be written to the bwc bitstream. !
! !
! size unsigned int(64 bit) - Size of the data block. !
! !
! RETURN VALUE: !
! ------------- !
! Type Description !
! ---- ----------- !
! - - !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 22.06.2019 Patrick Vogler B87D120 V 0.1.0 function created !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
emit_chunck(bitstream *const stream, const uchar* chunck, const uint64 size)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
\*-----------------------*/
uint64 Lreq;
/*-----------------------*\
! DEFINE ASSERTIONS: !
\*-----------------------*/
assert(stream);
assert(chunck);
/*--------------------------------------------------------*\
! Evaluate the memory block size if the current chunck of !
! data is written to the stream. !
\*--------------------------------------------------------*/
Lreq = (bytes_used(stream) + size);
/*--------------------------------------------------------*\
! Check if the enough memory has been allocated for the !
! stream to store the additional data chunck. !
\*--------------------------------------------------------*/
if(Lreq > stream->Lmax)
{
/*--------------------------------------------------------*\
! If the stream is not large enough, check if this is due !
! to an error encountered in a previous writing operation !
\*--------------------------------------------------------*/
if(!stream->error)
{
/*--------------------------------------------------------*\
! If the error flag is not set, increase the stream size !
! until it is large enough to store the additional data !
! chunck. !
\*--------------------------------------------------------*/
while(Lreq > stream->Lmax)
{
stream->Lmax += stream->size_incr + size;
stream->size_incr = (uint64)(stream->Lmax / 2);
}
/*--------------------------------------------------------*\
! Reallocate the stream data block. !
\*--------------------------------------------------------*/
stream->memory = realloc(stream->memory, stream->Lmax);
if(!stream->memory)
{
// memory allocation error
stream->error |= 1;
stream->Lmax = 0;
return;
}
}
else
{
/*--------------------------------------------------------*\
! Exit to function caller if error flag has been set. !
\*--------------------------------------------------------*/
return;
}
}
/*--------------------------------------------------------*\
! Copy the additional data to the stream memory block. !
\*--------------------------------------------------------*/
memcpy(stream->memory + stream->L, chunck, size);
/*--------------------------------------------------------*\
! Increment the number of bytes written to the stream with !
! the size of the newly added data chunck. !
\*--------------------------------------------------------*/
stream->L += size;
}
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! stream bitstream* - Structure used to assemble a bwc bit- !
! bitstream. !
! !
! size unsigned int(64 bit) - Size of the data block. !
! !
! RETURN VALUE: !
! ------------- !
! Type Description !
! ---- ----------- !
! uchar* - Data chunck requested by the function caller. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 22.06.2019 Patrick Vogler B87D120 V 0.1.0 function created !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar*
get_chunck(bitstream *const stream, const uint64 size)
{
/*-----------------------*\
! DEFINE CHAR VARIABLES: !
\*-----------------------*/
uchar *tmp;
/*-----------------------*\
! DEFINE ASSERTIONS: !
\*-----------------------*/
assert(stream);
/*--------------------------------------------------------*\
! Check if the number of bytes to be read from the stream !
! does not exceed the number of bytes still present in its !
! memory block. !
\*--------------------------------------------------------*/
if(bytes_used(stream) + size <= stream->Lmax)
{
/*--------------------------------------------------------*\
! Allocate a temporary array used to store the bytes that !
! are extracted from the stream. !
\*--------------------------------------------------------*/
tmp = calloc(size, sizeof(uchar));
if(!tmp)
{
// memory allocation error
fprintf(stderr, MEMERROR);
return NULL;
}
/*--------------------------------------------------------*\
! Copy the bytes requested from the function caller from !
! the stream to the temporary data block. !
\*--------------------------------------------------------*/
memcpy(tmp, stream->memory + stream->L, size);
/*--------------------------------------------------------*\
! Increment the number of bytes read from the bitstream. !
\*--------------------------------------------------------*/
stream->L += size;
/*--------------------------------------------------------*\
! Return the temporary data block to the function caller. !
\*--------------------------------------------------------*/
return tmp;
}
else
{
/*--------------------------------------------------------*\
! If the requested block size exceeds the information left !
! in the bitstream, set the bitstream error flag and !
! return a NULL pointer. !
\*--------------------------------------------------------*/
stream->error |= 1;
return NULL;
}
}
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! - - - !
! !
! RETURN VALUE: !
! ------------- !
! Type Description !
! ---- ----------- !
! - - !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V 0.1.0 function created !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
terminate_stream(bitstream *stream, bwc_stream *const packed_stream)
{
/*-----------------------*\
! DEFINE ASSERTIONS: !
\*-----------------------*/
assert(stream);
if(packed_stream)
{
if(stream->error)
{
return 1;
}
else if(stream->L != stream->Lmax)
{
stream->Lmax = stream->L;
stream->memory = realloc(stream->memory, stream->Lmax);
if(!stream->memory)
{
// memory allocation error
fprintf(stderr, MEMERROR);
stream->Lmax = 0;
return 1;
}
}
packed_stream->memory = stream->memory;
packed_stream->access = stream->memory;
packed_stream->size = stream->L;
packed_stream->position = 0;
}
else
{
free(stream->memory);
}
free(stream);
return 0;
}
/*----------------------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
@ -222,7 +639,7 @@ read_eas3_header(bwc_data *const data)
! DEFINE STRUCTS: !
\*-----------------------*/
bwc_gl_inf *info;
bwc_stream *aux;
bitstream *aux;
eas3_std_params params;
/*-----------------------*\
@ -239,7 +656,7 @@ read_eas3_header(bwc_data *const data)
! Save the file pointer and data info structure in tempo- !
! rary variables to make the code more readable. !
\*--------------------------------------------------------*/
fp = data->file.fp;
fp = data->fp;
info = &data->info;
/*--------------------------------------------------------*\
@ -284,7 +701,7 @@ read_eas3_header(bwc_data *const data)
/*--------------------------------------------------------*\
! Allocate the auxiliary information packed stream. !
\*--------------------------------------------------------*/
data->codestream.aux = calloc(1, sizeof(bwc_packed_stream));
data->codestream.aux = calloc(1, sizeof(bwc_stream));
if(!data->codestream.aux)
{
// memory allocation error
@ -299,7 +716,7 @@ read_eas3_header(bwc_data *const data)
! block has been chosen arbitrarily and should be large !
! enough to prevent excessive reallocation. !
\*--------------------------------------------------------*/
aux = bwc_init_stream(NULL, AUX_SIZE, 'c');
aux = init_stream(NULL, AUX_SIZE, 'c');
if(!aux)
{
// memory allocation error
@ -346,7 +763,7 @@ read_eas3_header(bwc_data *const data)
! Emit the standard parameters to the auxiliary informa- !
! tion information memory block. !
\*--------------------------------------------------------*/
bwc_emit_chunck(aux, (uchar*)&params, 176);
emit_chunck(aux, (uchar*)&params, 176);
/*--------------------------------------------------------*\
! Convert the parameters required for the bwc compression !
@ -423,7 +840,7 @@ read_eas3_header(bwc_data *const data)
! Emit the time step array to the auxiliary information !
! memory block. !
\*--------------------------------------------------------*/
bwc_emit_chunck(aux, buffer_char, info->nTS * sizeof(uint64));
emit_chunck(aux, buffer_char, info->nTS * sizeof(uint64));
/*--------------------------------------------------------*\
! Check if any attributes have been specified in the eas3 !
@ -456,7 +873,7 @@ read_eas3_header(bwc_data *const data)
! Emit the timestep attribute array to the auxiliary infor-!
! mation memory block. !
\*--------------------------------------------------------*/
bwc_emit_chunck(aux, buffer_char, info->nTS * ATTRLEN * sizeof(char));
emit_chunck(aux, buffer_char, info->nTS * ATTRLEN * sizeof(char));
for(i = 0; i < info->nPar; ++i)
{
@ -473,7 +890,7 @@ read_eas3_header(bwc_data *const data)
return 1;
}
bwc_add_param(data, param_name, 0, (DIM_X | DIM_Y | DIM_Z), precision);
bwc_add_param(data, param_name, precision);
/*--------------------------------------------------------*\
! Read the parameter name from the file stream and add all !
@ -527,7 +944,7 @@ read_eas3_header(bwc_data *const data)
! Emit the remaining header information the the auxiliary !
! information stream. !
\*--------------------------------------------------------*/
bwc_emit_chunck(aux, buffer_char, Lread);
emit_chunck(aux, buffer_char, Lread);
/*--------------------------------------------------------*\
! Free the buffer character array. !
@ -539,7 +956,7 @@ read_eas3_header(bwc_data *const data)
! ful, the address to the aux memory block stored is !
! stored in the file structure alongside its size. !
\*--------------------------------------------------------*/
if(bwc_terminate_stream(aux, data->codestream.aux))
if(terminate_stream(aux, data->codestream.aux))
{
// memory allocation error
fprintf(stderr, MEMERROR);
@ -600,7 +1017,7 @@ write_eas3_header(bwc_data *const data)
! DEFINE STRUCTS: !
\*-----------------------*/
bwc_gl_inf *info;
bwc_stream *aux;
bitstream *aux;
eas3_std_params *params;
bwc_cmd_opts_ll *param;
@ -618,7 +1035,7 @@ write_eas3_header(bwc_data *const data)
! Save the file pointer and data info structure in tempo- !
! rary variables to make the code more readable. !
\*--------------------------------------------------------*/
fp = data->file.fp;
fp = data->fp;
info = &data->info;
/*--------------------------------------------------------*\
@ -634,14 +1051,14 @@ write_eas3_header(bwc_data *const data)
/*--------------------------------------------------------*\
! Initialize the auxiliary information stream. !
\*--------------------------------------------------------*/
aux = bwc_init_stream(data->codestream.aux->memory,
aux = init_stream(data->codestream.aux->memory,
data->codestream.aux->size, 'd');
/*--------------------------------------------------------*\
! Get the standard parameters from the auxiliary informa- !
! memory block and write them to the file stream. !
\*--------------------------------------------------------*/
params = (eas3_std_params*)bwc_get_chunck(aux, 176);
params = (eas3_std_params*)get_chunck(aux, 176);
if(fwrite(params, sizeof(uint64), 22, fp) != 22)
{
@ -669,7 +1086,7 @@ write_eas3_header(bwc_data *const data)
! the timestep array from the auxiliary information block !
! and write it to the file stream. !
\*--------------------------------------------------------*/
buffer_char = bwc_get_chunck(aux, info->nTS * sizeof(uint64));
buffer_char = get_chunck(aux, info->nTS * sizeof(uint64));
if(!buffer_char)
{
// memory allocation error
@ -698,7 +1115,7 @@ write_eas3_header(bwc_data *const data)
! the timestep attribute array from the auxiliary informa- !
! tion block and write it to the file stream. !
\*--------------------------------------------------------*/
buffer_char = bwc_get_chunck(aux, info->nTS * ATTRLEN);
buffer_char = get_chunck(aux, info->nTS * ATTRLEN);
if(!buffer_char)
{
// memory allocation error
@ -762,7 +1179,7 @@ write_eas3_header(bwc_data *const data)
! the remaining eas header bytes from the auxiliary infor- !
! mation block and write it to the file stream. !
\*--------------------------------------------------------*/
buffer_char = bwc_get_chunck(aux, Lwrite);
buffer_char = get_chunck(aux, Lwrite);
if(!buffer_char)
{
// memory allocation error
@ -866,7 +1283,7 @@ read_eas3(char *const filename)
! Open the specified file for reading. If the file doesn't !
! exist, exit the bwc command-line tool. !
\*--------------------------------------------------------*/
if((data->file.fp = fopen(filename, "rb")) == NULL)
if((data->fp = fopen(filename, "rb")) == NULL)
{
// error opening file
fprintf(stderr, "o##########################################################o\n"\
@ -891,10 +1308,10 @@ read_eas3(char *const filename)
! file and store the information in the bwc_gl_data struc- !
! ture. !
\*--------------------------------------------------------*/
root = ftell(data->file.fp);
fseek(data->file.fp, 0L, SEEK_END);
Lfield = (ftell(data->file.fp) - root) / sizeof(double);
fseek(data->file.fp, root, SEEK_SET);
root = ftell(data->fp);
fseek(data->fp, 0L, SEEK_END);
Lfield = (ftell(data->fp) - root) / sizeof(double);
fseek(data->fp, root, SEEK_SET);
/*--------------------------------------------------------*\
! Check if the file_size coincide with the specified dimen-!
@ -935,7 +1352,7 @@ read_eas3(char *const filename)
/*--------------------------------------------------------*\
! Read the flow field data from the specified eas3 file. !
\*--------------------------------------------------------*/
if(fread(data->field.f, sizeof(float), Lfield, data->file.fp) != Lfield)
if(fread(data->field.f, sizeof(float), Lfield, data->fp) != Lfield)
{
// invalid read
fprintf(stderr, RDERROR);
@ -971,7 +1388,7 @@ read_eas3(char *const filename)
/*--------------------------------------------------------*\
! Read the flow field data from the specified eas3 file. !
\*--------------------------------------------------------*/
if(fread(data->field.d, sizeof(double), Lfield, data->file.fp) != Lfield)
if(fread(data->field.d, sizeof(double), Lfield, data->fp) != Lfield)
{
// invalid read
fprintf(stderr, RDERROR);
@ -993,8 +1410,8 @@ read_eas3(char *const filename)
! Close the file pointer and return the bwc_data structure !
! to the function caller. !
\*--------------------------------------------------------*/
fclose(data->file.fp);
data->file.fp = NULL;
fclose(data->fp);
data->fp = NULL;
return data;
}
@ -1051,7 +1468,7 @@ write_eas3(bwc_data *const data, char *const filename)
! exist, discard its content. If the file cannot be creat- !
! ed, exit the bwc command-line tool. !
\*--------------------------------------------------------*/
if((data->file.fp = fopen(filename, "wb")) == NULL)
if((data->fp = fopen(filename, "wb")) == NULL)
{
// error opening file
fprintf(stderr, "o##########################################################o\n"\
@ -1069,7 +1486,6 @@ write_eas3(bwc_data *const data, char *const filename)
return 1;
}
/*--------------------------------------------------------*\
! Calculate the size of the data field used for the endian !
! conversion and write operations. !
@ -1090,7 +1506,7 @@ write_eas3(bwc_data *const data, char *const filename)
/*--------------------------------------------------------*\
! Write the flow field data to the specified eas3 file. !
\*--------------------------------------------------------*/
if(fwrite(data->field.f, sizeof(float), Lfield, data->file.fp) != Lfield)
if(fwrite(data->field.f, sizeof(float), Lfield, data->fp) != Lfield)
{
// invalid read
fprintf(stderr, WRTERROR);
@ -1110,7 +1526,7 @@ write_eas3(bwc_data *const data, char *const filename)
/*--------------------------------------------------------*\
! Write the flow field data to the specified eas3 file. !
\*--------------------------------------------------------*/
if(fwrite(data->field.d, sizeof(double), Lfield, data->file.fp) != Lfield)
if(fwrite(data->field.d, sizeof(double), Lfield, data->fp) != Lfield)
{
// invalid read
fprintf(stderr, WRTERROR);
@ -1121,7 +1537,7 @@ write_eas3(bwc_data *const data, char *const filename)
/*--------------------------------------------------------*\
! Close the file pointer and return to the function caller.!
\*--------------------------------------------------------*/
fclose(data->file.fp);
data->file.fp = NULL;
fclose(data->fp);
data->fp = NULL;
return 0;
}

View file

@ -1,4 +1,4 @@
#*====================================================================================================================*#
#*================================================================================================*#
#| |#
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
@ -11,47 +11,39 @@
#| /$$ \ $$ | $$ |#
#| | $$$$$$/ | $$ |#
#| \______/ |__/ |#
#| |#
#| DESCRIPTION: |#
#| ------------ |#
#| |#
#| Defines the cmake script for the libbwc library. |#
#| |#
#| |#
#| DEVELOPMENT HISTORY: |#
#| -------------------- |#
#| |#
#| Date Author Change Id Release Description Of Change |#
#| ---- ------ --------- ------- --------------------- |#
#| 30.08.2018 Patrick Vogler B87D120 V 0.1.0 cmake file created |#
#| 15.10.2021 Patrick Vogler B880CA2 V 0.1.1 Added install rules |#
#| |#
#| |#
#| ------------------------------------------------------------------------------------------------------ |#
#| |#
#| -------------------------------------------------------------------------------------------- |#
#| 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: |#
#| 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. |#
#| 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. |#
#| |#
#*====================================================================================================================*#
#*--------------------------------------------------------*#
#*================================================================================================*#
#----------------------------------------------------------#
# Assemble the public header for the BigWhoop library #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
set(PYTHON_ARGUMENT "")
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
@ -65,12 +57,18 @@ if("${PREC}" STREQUAL "Single")
endif()
execute_process(COMMAND python3 public_header.py ${PYTHON_ARGUMENT}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE result
ERROR_VARIABLE error_output)
#*--------------------------------------------------------*#
if(result)
message(WARNING "Public header generation failed: ${error_output}")
endif()
#----------------------------------------------------------#
# Set the linking type according to user choice and add #
# the library to the current project #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
if("${LINK}" STREQUAL "Static")
set(BWC_LINK "STATIC")
else()
@ -86,41 +84,55 @@ add_library(bwclib ${BWC_LINK} bitstream.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)
else()
target_compile_definitions(bwclib PRIVATE -DBWC_DOUBLE_PRECISION)
endif()
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# Set the target compile definition for the profiling #
# output. #
#----------------------------------------------------------#
if(${PROF})
target_compile_definitions(bwclib PRIVATE -DBWC_PROFILE)
MESSAGE(STATUS "Profiling: ${PROF}")
endif()
#----------------------------------------------------------#
# Set the Version and SOVersion and define the public API #
# for the BigWhoop library. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
set_target_properties(bwclib PROPERTIES VERSION ${BWC_VERSION}
SOVERSION ${BWC_VERSION_MAJOR}
PUBLIC_HEADER ${CMAKE_SOURCE_DIR}/include/library/public/bwc.h)
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# Setup up the include directory for the BigWhoop library. #
#*--------------------------------------------------------*#
target_include_directories(bwclib PRIVATE ${CMAKE_SOURCE_DIR}/include/library/private)
#----------------------------------------------------------#
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}>)
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# Link the BigWhoop library to the math.h library. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
target_link_libraries(bwclib PRIVATE m)
#*--------------------------------------------------------*#
# Setup the install directories. #
#*--------------------------------------------------------*#
install(FILES ${CMAKE_SOURCE_DIR}/include/library/public/bwc.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(TARGETS bwclib DESTINATION ${CMAKE_INSTALL_LIBDIR})
#----------------------------------------------------------#
# 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)

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,71 +12,38 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| FILE NAME: bitstream.c ||
|| ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| This file describes a set of functions that can be used to create, manipulate and terminate ||
|| a bitstream. These functions facilitate the creation or reading of a compressed bwc code- ||
|| stream and can emit/extract information on a per bit, symbol (64-bit) or string basis. ||
|| ||
|| This file describes a set of functions that can be used to create, manipulate ||
|| and terminate a bitstream. These functions facilitate the creation or reading ||
|| of a compressed bwc codestream and can emit/extract information on a per bit, ||
|| symbol (64-bit) or string basis. ||
|| ||
|| FILE REFERENCES: ||
|| ---------------- ||
|| ||
|| Name I/O Description ||
|| ---- --- ----------- ||
|| none - - ||
|| ||
|| ||
|| PRIVATE FUNCTIONS: ||
|| ------------------ ||
|| - ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| - bytes_used ||
|| - bwc_init_stream ||
|| - bwc_emit_chunck ||
|| - bwc_emit_symbol ||
|| - bwc_emit_bit ||
|| - bwc_get_chunck ||
|| - bwc_get_symbol ||
|| - bwc_get_bit ||
|| - bwc_terminate_stream ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 28.05.2018 Patrick Vogler B87D120 V 0.1.0 source 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: ||
|| 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. ||
|| (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. ||
|| (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. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
/************************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
@ -97,7 +64,7 @@
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: uint32 bytes_used(bwc_stream *const stream) !
! FUNCTION NAME: uint32 bytes_used(bitstream *const stream) !
! -------------- !
! !
! DESCRIPTION: !
@ -109,7 +76,7 @@
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! stream bwc_stream* - Structure that !
! stream bitstream* - Structure that !
! !
! RETURN VALUE: !
! ------------- !
@ -127,7 +94,7 @@
! !
\*----------------------------------------------------------------------------------------------------------*/
uint64
bytes_used(bwc_stream *const stream)
bytes_used(bitstream const *const stream)
{
if(stream->T == 0xFF)
{
@ -140,7 +107,7 @@ bytes_used(bwc_stream *const stream)
}
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: bwc_stream* bwc_init_stream(uchar* memory, uint32 size, char instr) !
! FUNCTION NAME: bitstream* bwc_init_stream(uchar* memory, uint32 size, char instr) !
! -------------- !
! !
! DESCRIPTION: !
@ -148,7 +115,7 @@ bytes_used(bwc_stream *const stream)
! This function is used to initialize a bwc bitstream. For encoding, a null pointer !
! is passed as a memory handle and the function will allocate a memory block with the !
! specified stream size. For decoding, a valid memory handle, passed by the function !
! caller, will be stored in the bwc_stream structure. The byte buffer counter t, !
! caller, will be stored in the bitstream structure. The byte buffer counter t, !
! stream size Lmax and size increment are initialized with their appropriate values. !
! !
! PARAMETERS: !
@ -167,7 +134,7 @@ bytes_used(bwc_stream *const stream)
! ------------- !
! Type Description !
! ---- ----------- !
! bwc_stream* - Memory handle for the initialized bwc stream. !
! bitstream* - Memory handle for the initialized bwc stream. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
@ -177,13 +144,13 @@ bytes_used(bwc_stream *const stream)
! 19.06.2019 Patrick Vogler B87D120 V 0.1.0 function created !
! !
\*----------------------------------------------------------------------------------------------------------*/
bwc_stream*
bwc_init_stream(uchar* memory, uint32 size, char instr)
bitstream*
init_stream(uchar* memory, uint32 size, char instr)
{
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/
bwc_stream *stream;
bitstream *stream;
/*-----------------------*\
! DEFINE ASSERTIONS: !
@ -193,7 +160,7 @@ bwc_init_stream(uchar* memory, uint32 size, char instr)
/*--------------------------------------------------------*\
! Allocate the bwc stream structure. !
\*--------------------------------------------------------*/
stream = calloc(1, sizeof(bwc_stream));
stream = calloc(1, sizeof(bitstream));
if(!stream)
{
// memory allocation error
@ -243,7 +210,7 @@ bwc_init_stream(uchar* memory, uint32 size, char instr)
}
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void bwc_emit_chunck(bwc_stream *const stream, const uchar* string, const uint64 length) !
! FUNCTION NAME: void bwc_emit_chunck(bitstream *const stream, const uchar* string, const uint64 length) !
! -------------- !
! !
! DESCRIPTION: !
@ -255,7 +222,7 @@ bwc_init_stream(uchar* memory, uint32 size, char instr)
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! stream bwc_stream* - Structure used to assemble a bwc bit- !
! stream bitstream* - Structure used to assemble a bwc bit- !
! bitstream. !
! !
! chunck unsigned char* - Memory handle for a data block that is !
@ -278,7 +245,7 @@ bwc_init_stream(uchar* memory, uint32 size, char instr)
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bwc_emit_chunck(bwc_stream *const stream, const uchar* chunck, const uint64 size)
emit_chunck(bitstream *const stream, const uchar* chunck, const uint64 size)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
@ -365,7 +332,7 @@ bwc_emit_chunck(bwc_stream *const stream, const uchar* chunck, const uint64 size
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! stream bwc_stream* - Structure used to assemble a bwc bit- !
! stream bitstream* - Structure used to assemble a bwc bit- !
! bitstream. !
! !
! symbol unsigned int(64 bit) - Symbol that is to be written to the bwc !
@ -389,7 +356,7 @@ bwc_emit_chunck(bwc_stream *const stream, const uchar* chunck, const uint64 size
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bwc_emit_symbol(bwc_stream *const stream, const uint64 symbol, const uint8 size)
emit_symbol(bitstream *const stream, const uint64 symbol, const uint8 size)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
@ -455,7 +422,7 @@ bwc_emit_symbol(bwc_stream *const stream, const uint64 symbol, const uint8 size)
}
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void bwc_emit_bit(bwc_stream *const stream, const uint64 bit) !
! FUNCTION NAME: void bwc_emit_bit(bitstream *const stream, const uint64 bit) !
! -------------- !
! !
! DESCRIPTION: !
@ -466,7 +433,7 @@ bwc_emit_symbol(bwc_stream *const stream, const uint64 symbol, const uint8 size)
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! stream bwc_stream* - Structure used to assemble a bwc bit- !
! stream bitstream* - Structure used to assemble a bwc bit- !
! bitstream. !
! !
! bit unsigned int(64 bit) - Bit that is to be written to the bwc !
@ -487,7 +454,7 @@ bwc_emit_symbol(bwc_stream *const stream, const uint64 symbol, const uint8 size)
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bwc_emit_bit(bwc_stream *const stream, const uint64 bit)
emit_bit(bitstream *const stream, const uint64 bit)
{
/*-----------------------*\
! DEFINE ASSERTIONS: !
@ -594,7 +561,7 @@ bwc_emit_bit(bwc_stream *const stream, const uint64 bit)
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! stream bwc_stream* - Structure used to assemble a bwc bit- !
! stream bitstream* - Structure used to assemble a bwc bit- !
! bitstream. !
! !
! size unsigned int(64 bit) - Size of the data block. !
@ -614,7 +581,7 @@ bwc_emit_bit(bwc_stream *const stream, const uint64 bit)
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar*
bwc_get_chunck(bwc_stream *const stream, const uint64 size)
get_chunck(bitstream *const stream, const uint64 size)
{
/*-----------------------*\
! DEFINE CHAR VARIABLES: !
@ -685,7 +652,7 @@ bwc_get_chunck(bwc_stream *const stream, const uint64 size)
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! stream bwc_stream* - Structure used to assemble a bwc bit- !
! stream bitstream* - Structure used to assemble a bwc bit- !
! bitstream. !
! !
! size unsigned int(8 bit) - Number of significant bytes in the !
@ -706,7 +673,7 @@ bwc_get_chunck(bwc_stream *const stream, const uint64 size)
! !
\*----------------------------------------------------------------------------------------------------------*/
uint64
bwc_get_symbol(bwc_stream *const stream, const uint8 size)
get_symbol(bitstream *const stream, const uint8 size)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
@ -784,7 +751,7 @@ bwc_get_symbol(bwc_stream *const stream, const uint8 size)
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
bwc_get_bit(bwc_stream *const stream)
get_bit(bitstream *const stream)
{
/*-----------------------*\
! DEFINE ASSERTIONS: !
@ -840,7 +807,7 @@ bwc_get_bit(bwc_stream *const stream)
! !
\*----------------------------------------------------------------------------------------------------------*/
void
flush_stream(bwc_stream *const stream)
flush_stream(bitstream *const stream)
{
/*-----------------------*\
! DEFINE ASSERTIONS: !
@ -929,7 +896,7 @@ flush_stream(bwc_stream *const stream)
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
bwc_terminate_stream(bwc_stream *stream, bwc_packed_stream *const packed_stream)
terminate_stream(bitstream *stream, bwc_stream *const packed_stream)
{
/*-----------------------*\
! DEFINE ASSERTIONS: !
@ -970,7 +937,7 @@ bwc_terminate_stream(bwc_stream *stream, bwc_packed_stream *const packed_stream)
}
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void release_packed_stream(bwc_packed_stream *stream) !
! FUNCTION NAME: void release_packed_stream(bwc_stream *stream) !
! -------------- !
! !
! DESCRIPTION: !
@ -982,7 +949,7 @@ bwc_terminate_stream(bwc_stream *stream, bwc_packed_stream *const packed_stream)
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! stream bwc_packed_stream - Packed bitstream used to store parts of !
! stream bwc_stream - Packed bitstream used to store parts of !
! the bwc codestream. !
! !
! RETURN VALUE: !
@ -1000,7 +967,7 @@ bwc_terminate_stream(bwc_stream *stream, bwc_packed_stream *const packed_stream)
! !
\*----------------------------------------------------------------------------------------------------------*/
void
release_packed_stream(bwc_packed_stream *stream)
release_packed_stream(bwc_stream *stream)
{
/*-----------------------*\
! DEFINE ASSERTIONS: !

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,71 +12,38 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| FILE NAME: dwt.c ||
|| ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| DESCRIPTION NEEDED. ||
|| ||
|| FILE REFERENCES: ||
|| ---------------- ||
|| ||
|| Name I/O Description ||
|| ---- --- ----------- ||
|| none - - ||
|| ||
|| ||
|| PRIVATE FUNCTIONS: ||
|| ------------------ ||
|| - get_filter_taps ||
|| - fill_forward_buffer ||
|| - fill_inverse_buffer ||
|| - whole_point_symmetric_extend ||
|| - forward_9x7_CDF_wavelet_transform ||
|| - inverse_9x7_CDF_wavelet_transform ||
|| - forward_5x3_LeGall_wavelet_transform ||
|| - inverse_5x3_LeGall_wavelet_transform ||
|| - forward_Haar_wavelet_transform ||
|| - inverse_Haar_wavelet_transform ||
|| - buffer_flush_forward ||
|| - buffer_flush_inverse ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| - initialize_gain_lut ||
|| - get_dwt_energy_gain ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 19.03.2018 Patrick Vogler B87D120 V 0.1.0 source file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| This file describes a set of functions that can be used to performe the forward/ ||
|| inverse discrete wavelet transform on 1- to 4-dimensional IEEE 754 data-sets. ||
|| For more information please refere to JPEG2000 by D. S. Taubman and M. W. ||
|| Marcellin. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| 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: ||
|| 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. ||
|| (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. ||
|| (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. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
/************************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
@ -88,7 +55,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <omp.h>
#if defined (_OPENMP)
#include <omp.h>
#endif
#include "constants.h"
#include "macros.h"
@ -101,7 +70,7 @@
|| |___ _/\_ | |___ | \ | \| | | |___ \/ | | | \ | | | |__] |___ |___ ___] ||
|| ||
\************************************************************************************************************/
double DWT_ENERGY_GAIN_LUT[3][2 * MAX_DECOMPOSITION_LEVELS + 2];
double DWT_ENERGY_GAIN_LUT[3][2 * MAX_DECOMP_LEVELS + 2];
/************************************************************************************************************\
|| ___ ____ _ _ _ ____ ___ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
@ -1250,9 +1219,9 @@ initialize_gain_lut()
! (5/3) and Haar wavelet transform by setting the energy !
! gain factor for level zero to one. !
\*--------------------------------------------------------*/
DWT_ENERGY_GAIN_LUT[bwc_dwt_9_7][0] = DWT_ENERGY_GAIN_LUT[bwc_dwt_9_7][MAX_DECOMPOSITION_LEVELS + 1] = 1.0f;
DWT_ENERGY_GAIN_LUT[bwc_dwt_5_3][0] = DWT_ENERGY_GAIN_LUT[bwc_dwt_5_3][MAX_DECOMPOSITION_LEVELS + 1] = 1.0f;
DWT_ENERGY_GAIN_LUT[bwc_dwt_haar][0] = DWT_ENERGY_GAIN_LUT[bwc_dwt_haar][MAX_DECOMPOSITION_LEVELS + 1] = 1.0f;
DWT_ENERGY_GAIN_LUT[bwc_dwt_9_7][0] = DWT_ENERGY_GAIN_LUT[bwc_dwt_9_7][MAX_DECOMP_LEVELS + 1] = 1.0f;
DWT_ENERGY_GAIN_LUT[bwc_dwt_5_3][0] = DWT_ENERGY_GAIN_LUT[bwc_dwt_5_3][MAX_DECOMP_LEVELS + 1] = 1.0f;
DWT_ENERGY_GAIN_LUT[bwc_dwt_haar][0] = DWT_ENERGY_GAIN_LUT[bwc_dwt_haar][MAX_DECOMP_LEVELS + 1] = 1.0f;
/*--------------------------------------------------------*\
! Loop through the symmetric wavelet filter banks and as- !
@ -1307,7 +1276,7 @@ initialize_gain_lut()
/*--------------------------------------------------------*\
! Loop through the remaining decomposition levels. !
\*--------------------------------------------------------*/
for(k = 1; k < MAX_DECOMPOSITION_LEVELS; ++k)
for(k = 1; k < MAX_DECOMP_LEVELS; ++k)
{
/*--------------------------------------------------------*\
! Assemble the low- or high-pass synthesis sequence for !
@ -1346,7 +1315,7 @@ initialize_gain_lut()
! high-pass energy gain factor and set the length of work !
! buffer 1 to the corresponding high-pass filter length. !
\*--------------------------------------------------------*/
LUT += MAX_DECOMPOSITION_LEVELS + 1;
LUT += MAX_DECOMP_LEVELS + 1;
Length_Gb = Length[1];
}
/*--------------------------------------------------------*\
@ -1399,7 +1368,7 @@ initialize_gain_lut()
/*--------------------------------------------------------*\
! Loop through the remaining decomposition levels. !
\*--------------------------------------------------------*/
for(k = 1; k < MAX_DECOMPOSITION_LEVELS; ++k)
for(k = 1; k < MAX_DECOMP_LEVELS; ++k)
{
/*--------------------------------------------------------*\
! Assemble the low- or high-pass synthesis sequence for !
@ -1435,7 +1404,7 @@ initialize_gain_lut()
! Calculate the energy gain factor for decomposition level !
! i by evaluating the square norm of work buffer 1. !
\*--------------------------------------------------------*/
LUT += MAX_DECOMPOSITION_LEVELS + 1;
LUT += MAX_DECOMP_LEVELS + 1;
Length_Gb = Length[1];
}
/*--------------------------------------------------------*\
@ -1457,9 +1426,9 @@ initialize_gain_lut()
! !
! DESCRIPTION: !
! ------------ !
! This function evaluates the energy gain factor according to the the specified decomposition !
! level. For decomposition levels larger than MAX_DECOMPOSITION_LEVELS the filter gain for !
! the extra levels is approximated by multiplying the energy gain factor by 2. !
! This function evaluates the energy gain factor according to the the specified decom- !
! position level. For decomposition levels larger than MAX_DECOMP_LEVELS the filter gain !
! for the extra levels is approximated by multiplying the energy gain factor by 2. !
! !
! PARAMETERS: !
! ----------- !
@ -1535,73 +1504,73 @@ get_dwt_energy_gain(bwc_field *const field, uchar highband_flag, uint16 level)
/*--------------------------------------------------------*\
! Multiply the energy gain factor with the filter gain of !
! the wavelet kernel applied along the X-axis. For decom- !
! position levels larger than MAX_DECOMPOSITION_LEVELS the !
! energy gain for the extra levels is approximated by mul- !
! tiplying it by 2. !
! position levels larger than MAX_DECOMP_LEVELS the energy !
! gain for the extra levels is approximated by multiplying !
! it by 2. !
\*--------------------------------------------------------*/
if(level_X != 0)
{
while(level_X > MAX_DECOMPOSITION_LEVELS)
while(level_X > MAX_DECOMP_LEVELS)
{
Gb *= 2.0f;
level_X--;
}
Gb *= DWT_ENERGY_GAIN_LUT[control->KernelX][level_X + ((highband_flag & DIM_X) * (MAX_DECOMPOSITION_LEVELS + 1))];
Gb *= DWT_ENERGY_GAIN_LUT[control->KernelX][level_X + ((highband_flag & DIM_X) * (MAX_DECOMP_LEVELS + 1))];
}
/*--------------------------------------------------------*\
! Multiply the energy gain factor with the filter gain of !
! the wavelet kernel applied along the Y-axis. For decom- !
! position levels larger than MAX_DECOMPOSITION_LEVELS the !
! energy gain for the extra levels is approximated by mul- !
! tiplying it by 2. !
! position levels larger than MAX_DECOMP_LEVELS the energy !
! gain for the extra levels is approximated by multiplying !
! it by 2. !
\*--------------------------------------------------------*/
if(level_Y != 0)
{
while(level_Y > MAX_DECOMPOSITION_LEVELS)
while(level_Y > MAX_DECOMP_LEVELS)
{
Gb *= 2.0f;
level_Y--;
}
Gb *= DWT_ENERGY_GAIN_LUT[control->KernelY][level_Y + (((highband_flag & DIM_Y) >> 1) * (MAX_DECOMPOSITION_LEVELS + 1))];
Gb *= DWT_ENERGY_GAIN_LUT[control->KernelY][level_Y + (((highband_flag & DIM_Y) >> 1) * (MAX_DECOMP_LEVELS + 1))];
}
/*--------------------------------------------------------*\
! Multiply the energy gain factor with the filter gain of !
! the wavelet kernel applied along the Z-axis. For decom- !
! position levels larger than MAX_DECOMPOSITION_LEVELS the !
! energy gain for the extra levels is approximated by mul- !
! tiplying it by 2. !
! position levels larger than MAX_DECOMP_LEVELS the energy !
! gain for the extra levels is approximated by multiplying !
! it by 2. !
\*--------------------------------------------------------*/
if(level_Z != 0)
{
while(level_Z > MAX_DECOMPOSITION_LEVELS)
while(level_Z > MAX_DECOMP_LEVELS)
{
Gb *= 2.0f;
level_Z--;
}
Gb *= DWT_ENERGY_GAIN_LUT[control->KernelZ][level_Z + (((highband_flag & DIM_Z) >> 2) * (MAX_DECOMPOSITION_LEVELS + 1))];
Gb *= DWT_ENERGY_GAIN_LUT[control->KernelZ][level_Z + (((highband_flag & DIM_Z) >> 2) * (MAX_DECOMP_LEVELS + 1))];
}
/*--------------------------------------------------------*\
! Multiply the energy gain factor with the filter gain of !
! the wavelet kernel applied along the TS-axis. For decom- !
! position levels larger than MAX_DECOMPOSITION_LEVELS the !
! energy gain for the extra levels is approximated by mul- !
! tiplying it by 2. !
! position levels larger than MAX_DECOMP_LEVELS the energy !
! gain for the extra levels is approximated by multiplying !
! it by 2. !
\*--------------------------------------------------------*/
if(level_TS != 0)
{
while(level_TS > MAX_DECOMPOSITION_LEVELS)
while(level_TS > MAX_DECOMP_LEVELS)
{
Gb *= 2.0f;
level_TS--;
}
Gb *= DWT_ENERGY_GAIN_LUT[control->KernelTS][level_TS + (((highband_flag & DIM_TS) >> 3) * (MAX_DECOMPOSITION_LEVELS + 1))];
Gb *= DWT_ENERGY_GAIN_LUT[control->KernelTS][level_TS + (((highband_flag & DIM_TS) >> 3) * (MAX_DECOMP_LEVELS + 1))];
}
return (bwc_float)Gb;
}
@ -1645,7 +1614,7 @@ get_dwt_energy_gain(bwc_field *const field, uchar highband_flag, uint16 level)
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
forward_discrete_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter)
forward_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
@ -1655,18 +1624,22 @@ forward_discrete_wavelet_transform(bwc_field *const field, bwc_parameter *const
uint64 rX1, rY1, rZ1;
uint64 width, height, depth;
uint64 x, y, z;
uint32 buff_size;
int64 nThreads;
int16 i;
uint32 buff_size;
uint16 incr_TS;
uint16 rTS0;
uint16 rTS1;
uint16 dt;
uint16 t;
uint8 id;
uint8 filter_tapsX, filter_tapsY, filter_tapsZ;
uint8 filter_tapsTS;
uint8 level;
uint8 nThreads;
/*-----------------------*\
! DEFINE STRUCTS: !
@ -1735,7 +1708,7 @@ forward_discrete_wavelet_transform(bwc_field *const field, bwc_parameter *const
! eter. !
\*--------------------------------------------------------*/
#if defined (_OPENMP)
nThreads = control->nThreads;
nThreads = omp_get_max_threads();
#else
nThreads = 1;
#endif
@ -1778,7 +1751,7 @@ forward_discrete_wavelet_transform(bwc_field *const field, bwc_parameter *const
! wavelet transform along the spatial and temporal dimen- !
! sions specified in the control structure. !
\*--------------------------------------------------------*/
#if defined(_OPENMP)
#if defined (_OPENMP)
#pragma omp parallel private(data, id, level, working_buffer, rX0, rX1, rY0, rY1, rZ0, rZ1, rTS0, rTS1)
#endif
{
@ -1831,7 +1804,7 @@ forward_discrete_wavelet_transform(bwc_field *const field, bwc_parameter *const
! Walk trough all the temporal and spatial slices as well !
! as rows. !
\*--------------------------------------------------------*/
#if defined(_OPENMP)
#if defined (_OPENMP)
#pragma omp for collapse(3)
#endif
for(t = 0; t < (rTS1 - rTS0); ++t)
@ -1912,7 +1885,7 @@ forward_discrete_wavelet_transform(bwc_field *const field, bwc_parameter *const
! Walk trough all the temporal and spatial slices as well !
! as columns. !
\*--------------------------------------------------------*/
#if defined(_OPENMP)
#if defined (_OPENMP)
#pragma omp for collapse(3)
#endif
for(t = 0; t < (rTS1 - rTS0); ++t)
@ -1992,7 +1965,7 @@ forward_discrete_wavelet_transform(bwc_field *const field, bwc_parameter *const
/*--------------------------------------------------------*\
! Walk trough all the temporal slices, rows and columns. !
\*--------------------------------------------------------*/
#if defined(_OPENMP)
#if defined (_OPENMP)
#pragma omp for collapse(3)
#endif
for(t = 0; t < (rTS1 - rTS0); ++t)
@ -2072,7 +2045,7 @@ forward_discrete_wavelet_transform(bwc_field *const field, bwc_parameter *const
/*--------------------------------------------------------*\
! Walk trough all the spatial slices, rows and columns. !
\*--------------------------------------------------------*/
#if defined(_OPENMP)
#if defined (_OPENMP)
#pragma omp for collapse(3)
#endif
for(z = 0; z < (rZ1 - rZ0); ++z)
@ -2182,7 +2155,7 @@ forward_discrete_wavelet_transform(bwc_field *const field, bwc_parameter *const
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
inverse_discrete_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter)
inverse_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
@ -2192,18 +2165,22 @@ inverse_discrete_wavelet_transform(bwc_field *const field, bwc_parameter *const
uint64 rX1, rY1, rZ1;
uint64 width, height, depth;
uint64 x, y, z;
int64 nThreads;
int64 i;
uint32 buff_size;
int16 i;
uint16 incr_TS;
uint16 rTS0;
uint16 rTS1;
uint16 dt;
uint16 t;
uint8 id;
uint8 filter_tapsX, filter_tapsY, filter_tapsZ;
uint8 filter_tapsTS;
uint8 level;
uint8 nThreads;
/*-----------------------*\
! DEFINE STRUCTS: !
@ -2272,7 +2249,7 @@ inverse_discrete_wavelet_transform(bwc_field *const field, bwc_parameter *const
! eter. !
\*--------------------------------------------------------*/
#if defined (_OPENMP)
nThreads = control->nThreads;
nThreads = omp_get_max_threads();
#else
nThreads = 1;
#endif
@ -2315,7 +2292,7 @@ inverse_discrete_wavelet_transform(bwc_field *const field, bwc_parameter *const
! wavelet transform along the spatial and temporal dimen- !
! sions specified in the control structure. !
\*--------------------------------------------------------*/
#if defined(_OPENMP)
#if defined (_OPENMP)
#pragma omp parallel private(data, id, level, working_buffer, rX0, rX1, rY0, rY1, rZ0, rZ1, rTS0, rTS1)
#endif
{
@ -2367,7 +2344,7 @@ inverse_discrete_wavelet_transform(bwc_field *const field, bwc_parameter *const
/*--------------------------------------------------------*\
! Walk trough all the spatial slices, rows and columns. !
\*--------------------------------------------------------*/
#if defined(_OPENMP)
#if defined (_OPENMP)
#pragma omp for collapse(3)
#endif
for(z = 0; z < (rZ1 - rZ0); ++z)
@ -2447,7 +2424,7 @@ inverse_discrete_wavelet_transform(bwc_field *const field, bwc_parameter *const
/*--------------------------------------------------------*\
! Walk trough all the temporal slices, rows and columns. !
\*--------------------------------------------------------*/
#if defined(_OPENMP)
#if defined (_OPENMP)
#pragma omp for collapse(3)
#endif
for(t = 0; t < (rTS1 - rTS0); ++t)
@ -2528,7 +2505,7 @@ inverse_discrete_wavelet_transform(bwc_field *const field, bwc_parameter *const
! Walk trough all the temporal and spatial slices as well !
! as columns. !
\*--------------------------------------------------------*/
#if defined(_OPENMP)
#if defined (_OPENMP)
#pragma omp for collapse(3)
#endif
for(t = 0; t < (rTS1 - rTS0); ++t)
@ -2609,7 +2586,7 @@ inverse_discrete_wavelet_transform(bwc_field *const field, bwc_parameter *const
! Walk trough all the temporal and spatial slices as well !
! as rows. !
\*--------------------------------------------------------*/
#if defined(_OPENMP)
#if defined (_OPENMP)
#pragma omp for collapse(3)
#endif
for(t = 0; t < (rTS1 - rTS0); ++t)

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,58 +12,36 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| FILE NAME: mq.c ||
|| ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| ||
|| DESCRIPTION NEEDED. ||
|| | | ||
|| ||
|| FILE REFERENCES: ||
|| ---------------- ||
|| ||
|| Name I/O Description ||
|| ---- --- ----------- ||
|| none - - ||
|| ||
|| ||
|| PRIVATE FUNCTIONS: ||
|| ------------------ ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 13.02.2019 Patrick Vogler B87D120 V 0.1.0 source 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: ||
|| 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. ||
|| (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. ||
|| (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. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
/************************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
@ -77,6 +55,7 @@
#include "macros.h"
#include "mq.h"
#include "tier1.h"
#include "types.h"
/************************************************************************************************************\
@ -346,7 +325,7 @@ static const bwc_context_state context_state[94] =
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
initialize_bit_encoder(bwc_coder *const coder, const uint8 number_of_contexts)
initialize_mq_encoder(bwc_coder *const coder, const uint8 number_of_contexts)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
@ -427,7 +406,7 @@ initialize_bit_encoder(bwc_coder *const coder, const uint8 number_of_contexts)
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
bit_encoder_next_run(bwc_bit_coder *const bitcoder)
mq_next_run(bwc_bit_coder *const bitcoder)
{
/*-----------------------*\
! DEFINE STRUCTS: !
@ -496,7 +475,7 @@ bit_encoder_next_run(bwc_bit_coder *const bitcoder)
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bit_encode(bwc_bit_coder *const bitcoder, const uint8 s, const uint8 k)
mq_bit_encode(bwc_bit_coder *const bitcoder, const uint8 s, const uint8 k)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
@ -605,7 +584,7 @@ bit_encode(bwc_bit_coder *const bitcoder, const uint8 s, const uint8 k)
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bit_encoder_truncation_length_min(bwc_coder_state *const state)
mq_truncation_length_min(bwc_coder_state *const state)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
@ -724,7 +703,7 @@ bit_encoder_truncation_length_min(bwc_coder_state *const state)
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bit_encoder_termination(bwc_bit_coder *const bitcoder)
mq_termination(bwc_bit_coder *const bitcoder)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
@ -774,7 +753,7 @@ bit_encoder_termination(bwc_bit_coder *const bitcoder)
while(state)
{
bit_encoder_truncation_length_min(state);
mq_truncation_length_min(state);
state = state->next;
}
}
@ -808,7 +787,7 @@ bit_encoder_termination(bwc_bit_coder *const bitcoder)
! !
\*----------------------------------------------------------------------------------------------------------*/
void
free_bit_encoder(bwc_coder *const coder)
free_mq_encoder(bwc_coder *const coder)
{
/*-----------------------*\
! DEFINE ASSERTIONS: !
@ -864,7 +843,7 @@ free_bit_encoder(bwc_coder *const coder)
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
initialize_bit_decoder(bwc_coder *const coder, const uint8 number_of_contexts, const int64 Lmax)
initialize_mq_decoder(bwc_coder *const coder, const uint8 number_of_contexts, const int64 Lmax)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
@ -968,7 +947,7 @@ initialize_bit_decoder(bwc_coder *const coder, const uint8 number_of_contexts, c
! !
\*----------------------------------------------------------------------------------------------------------*/
uint8
bit_decode(bwc_bit_coder *const bitcoder, const uint8 k)
mq_bit_decode(bwc_bit_coder *const bitcoder, const uint8 k)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
@ -1078,7 +1057,7 @@ bit_decode(bwc_bit_coder *const bitcoder, const uint8 k)
! !
\*----------------------------------------------------------------------------------------------------------*/
uint64
bit_coder_get_no_bytes(bwc_bit_coder *const bitcoder)
mq_get_no_bytes(bwc_bit_coder *const bitcoder)
{
/*-----------------------*\
! DEFINE ASSERTIONS: !
@ -1117,7 +1096,7 @@ bit_coder_get_no_bytes(bwc_bit_coder *const bitcoder)
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bit_coder_reset_ptr(bwc_bit_coder *const bitcoder, uchar *const memory)
mq_reset_ptr(bwc_bit_coder *const bitcoder, uchar *const memory)
{
/*-----------------------*\
! DEFINE STRUCTS: !
@ -1169,7 +1148,7 @@ bit_coder_reset_ptr(bwc_bit_coder *const bitcoder, uchar *const memory)
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bit_coder_get_pass_lengths(bwc_bit_coder *const bitcoder, bwc_encoded_cblk *const encoded_cblk)
mq_get_pass_lengths(bwc_bit_coder *const bitcoder, bwc_encoded_cblk *const encoded_cblk)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,65 +12,44 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| FILE NAME: tagtree.c ||
|| ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| DESCRIPTION NEEDED. ||
|| ||
|| FILE REFERENCES: ||
|| ---------------- ||
|| This file defines a tagtree procedure used to encode/decode two types of ||
|| information found defining in a codeblock in specific quality layer: ||
|| ||
|| Name I/O Description ||
|| ---- --- ----------- ||
|| none - - ||
|| - The inclusion tag records if a codeblock has any contribution ||
|| to a quality layer. ||
|| - The number of leading bitplanes that are not significant/only ||
|| populated by zero bits. ||
|| ||
|| For more information on the encoding/decoding process please refere to JPEG2000 ||
|| by D. S. Taubman and M. W. Marcellin (p. 384). ||
|| ||
|| PRIVATE FUNCTIONS: ||
|| ------------------ ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| - kill_tagtree ||
|| - reset_tagtree ||
|| - tagtree_get_value ||
|| - tagtree_set_value ||
|| - initialize_tagtree ||
|| - encode_tagtree ||
|| - decode_tagtree ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 18.05.2018 Patrick Vogler B87D120 V 0.1.0 source 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: ||
|| 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. ||
|| (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. ||
|| (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. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
/************************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
@ -389,7 +368,7 @@ initialize_tagtree(const uint64 leafsX, const uint64 leafsY, const uint64 leafsZ
{
if(b >> 1)
{
parent_y += nlY[n + 1];
parent_y += nlX[n+1];
b = 0;
}
for(i = 0, a = 0, parent_x = parent_y; i < nlX[n]; ++i, ++a)
@ -440,7 +419,7 @@ initialize_tagtree(const uint64 leafsX, const uint64 leafsY, const uint64 leafsZ
! !
\*----------------------------------------------------------------------------------------------------------*/
void
encode_tagtree(bwc_tagtree *const tagtree, bwc_stream *const stream, const uint32 threshold, const uint32 leaf_index, const uchar estimate)
encode_tagtree(bwc_tagtree *const tagtree, bitstream *const stream, const uint32 threshold, const uint32 leaf_index, const uchar estimate)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
@ -482,11 +461,11 @@ encode_tagtree(bwc_tagtree *const tagtree, bwc_stream *const stream, const uint3
threshold_tmp++;
if(node->value >= threshold_tmp)
{
bwc_emit_bit(stream, 0);
emit_bit(stream, 0);
}
else
{
bwc_emit_bit(stream, 1);
emit_bit(stream, 1);
}
}
@ -533,7 +512,7 @@ encode_tagtree(bwc_tagtree *const tagtree, bwc_stream *const stream, const uint3
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
decode_tagtree(bwc_tagtree *const tagtree, bwc_stream *const stream, const uint32 threshold, const uint32 leaf_index)
decode_tagtree(bwc_tagtree *const tagtree, bitstream *const stream, const uint32 threshold, const uint32 leaf_index)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
@ -577,7 +556,7 @@ decode_tagtree(bwc_tagtree *const tagtree, bwc_stream *const stream, const uint3
while((node->value == node->threshold) && (node->threshold < threshold))
{
node->threshold++;
if(!bwc_get_bit(stream))
if(!get_bit(stream))
{
node->value++;
}

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,58 +12,38 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| FILE NAME: tier1.c ||
|| ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| DESCRIPTION NEEDED. ||
|| ||
|| FILE REFERENCES: ||
|| ---------------- ||
|| ||
|| Name I/O Description ||
|| ---- --- ----------- ||
|| none - - ||
|| ||
|| ||
|| PRIVATE FUNCTIONS: ||
|| ------------------ ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| - Patrick Vogler B87D120 V 0.1.0 source file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| This file describes a set of functions that can be used to de-/encode bwc ||
|| codeblocks described by the bwc_field structure according to the embedded block ||
|| coding paradigm described by the JPEG 2000 standard. For more information please ||
|| refere to JPEG2000 by D. S. Taubman and M. W. Marcellin. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| 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: ||
|| 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. ||
|| (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. ||
|| (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. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
/************************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
@ -75,7 +55,9 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <omp.h>
#if defined (_OPENMP)
#include <omp.h>
#endif
#include <time.h>
#include "constants.h"
@ -111,10 +93,10 @@
\*----------------------------------------------------------------------------------------------------------*/
#define encode_segmark(bitcoder) \
{ \
bit_encode(bitcoder, 1, CONTEXT_UNI); \
bit_encode(bitcoder, 0, CONTEXT_UNI); \
bit_encode(bitcoder, 1, CONTEXT_UNI); \
bit_encode(bitcoder, 0, CONTEXT_UNI); \
mq_bit_encode(bitcoder, 1, CONTEXT_UNI); \
mq_bit_encode(bitcoder, 0, CONTEXT_UNI); \
mq_bit_encode(bitcoder, 1, CONTEXT_UNI); \
mq_bit_encode(bitcoder, 0, CONTEXT_UNI); \
}
/************************************************************************************************************\
@ -1014,8 +996,8 @@ significance_propagation_enc_pass(bwc_coder *const coder, const int8 b)
stripe = coder->data;
rest = 4 - (coder->height & 0x03);
stripe_mask = ~((0x0F >> ((coder->height & 0x03))) | 0xF0);
dist_shift = (b < DISTORTION_MANTISSA) ? 0 : (b - DISTORTION_MANTISSA);
dist_corr = (b < DISTORTION_MANTISSA) ? (DISTORTION_MANTISSA - b) : 0;
dist_shift = (b < DISTORTION_SIG) ? 0 : (b - DISTORTION_SIG);
dist_corr = (b < DISTORTION_SIG) ? (DISTORTION_SIG - b) : 0;
for(i = 0, k = 0; i < coder->no_slice; ++i)
{
@ -1053,7 +1035,7 @@ significance_propagation_enc_pass(bwc_coder *const coder, const int8 b)
if(k_sig)
{
bit_encode(coder->bitcoder, (uchar)((bit >> l) & 0x01), coder->sig2context[k_sig]);
mq_bit_encode(coder->bitcoder, (uchar)((bit >> l) & 0x01), coder->sig2context[k_sig]);
if(bit & bit_mask)
{
@ -1075,7 +1057,7 @@ significance_propagation_enc_pass(bwc_coder *const coder, const int8 b)
xi_h = SIG2XI[xi_h];
xi_v = SIG2XI[xi_v];
bit_encode(coder->bitcoder, (uchar)(((bit_mask & stripe[k].xi) >> l)^XI2CONT[(xi_h << 2) | xi_v][1]),
mq_bit_encode(coder->bitcoder, (uchar)(((bit_mask & stripe[k].xi) >> l)^XI2CONT[(xi_h << 2) | xi_v][1]),
XI2CONT[(xi_h << 2) | xi_v][0]);
mse += DISTORTION_TS_LUT[((stripe[k].sample[l] >> dist_shift) << dist_corr) & 0x1F];
@ -1126,7 +1108,7 @@ significance_propagation_enc_pass(bwc_coder *const coder, const int8 b)
if(k_sig && (stripe[k].sigma^bit_mask))
{
bit_encode(coder->bitcoder, (uchar)((bit >> l) & 0x01), coder->sig2context[k_sig]);
mq_bit_encode(coder->bitcoder, (uchar)((bit >> l) & 0x01), coder->sig2context[k_sig]);
if(bit & bit_mask)
{
@ -1144,7 +1126,7 @@ significance_propagation_enc_pass(bwc_coder *const coder, const int8 b)
xi_h = SIG2XI[xi_h];
xi_v = SIG2XI[xi_v];
bit_encode(coder->bitcoder, (uchar)(((bit_mask & stripe[k].xi) >> l)^XI2CONT[(xi_h << 2) | xi_v][1]),
mq_bit_encode(coder->bitcoder, (uchar)(((bit_mask & stripe[k].xi) >> l)^XI2CONT[(xi_h << 2) | xi_v][1]),
XI2CONT[(xi_h << 2) | xi_v][0]);
mse += DISTORTION_TS_LUT[((stripe[k].sample[l] >> dist_shift) << dist_corr) & 0x1F];
@ -1227,8 +1209,8 @@ magnitude_refinement_enc_pass(bwc_coder *const coder, const int8 b)
stripe = coder->data;
rest = 4 - (coder->height & 0x03);
stripe_mask = ~((0x0F >> ((coder->height & 0x03))) | 0xF0);
dist_shift = (b < DISTORTION_MANTISSA) ? 0 : (b - DISTORTION_MANTISSA);
dist_corr = (b < DISTORTION_MANTISSA) ? (DISTORTION_MANTISSA - b) : 0;
dist_shift = (b < DISTORTION_MAG) ? 0 : (b - DISTORTION_MAG);
dist_corr = (b < DISTORTION_MAG) ? (DISTORTION_MAG - b) : 0;
for(i = 0, k = 0; i < coder->no_slice; ++i)
{
@ -1271,7 +1253,7 @@ magnitude_refinement_enc_pass(bwc_coder *const coder, const int8 b)
}
}
bit_encode(coder->bitcoder, (uchar)((bit >> l) & 0x01), k_mag);
mq_bit_encode(coder->bitcoder, (uchar)((bit >> l) & 0x01), k_mag);
mse += DISTORTION_TM_LUT[((stripe[k].sample[l] >> dist_shift) << dist_corr) & 0x3F];
stripe[k].delta |= bit_mask;
@ -1313,7 +1295,7 @@ magnitude_refinement_enc_pass(bwc_coder *const coder, const int8 b)
}
}
bit_encode(coder->bitcoder, (uchar)((bit >> l) & 0x01), k_mag);
mq_bit_encode(coder->bitcoder, (uchar)((bit >> l) & 0x01), k_mag);
mse += DISTORTION_TM_LUT[((stripe[k].sample[l] >> dist_shift) << dist_corr) & 0x3F];
stripe[k].delta |= bit_mask;
@ -1383,8 +1365,8 @@ cleanup_enc_pass(bwc_coder *const coder, const int8 b)
mse = 0;
stripe = coder->data;
rest = 4 - (coder->height & 0x03);
dist_shift = (b < DISTORTION_MANTISSA) ? 0 : (b - DISTORTION_MANTISSA);
dist_corr = (b < DISTORTION_MANTISSA) ? (DISTORTION_MANTISSA - b) : 0;
dist_shift = (b < DISTORTION_SIG) ? 0 : (b - DISTORTION_SIG);
dist_corr = (b < DISTORTION_SIG) ? (DISTORTION_SIG - b) : 0;
for(i = 0, k = 0; i < coder->no_slice; ++i)
{
@ -1407,14 +1389,14 @@ cleanup_enc_pass(bwc_coder *const coder, const int8 b)
r |= r >> 2;
r = DISTORTION_LZ_LUT[r];
bit_encode(coder->bitcoder, (uchar)1, CONTEXT_RUN);
bit_encode(coder->bitcoder, (uchar)r >> 1, CONTEXT_UNI);
bit_encode(coder->bitcoder, (uchar)r&0x01, CONTEXT_UNI);
mq_bit_encode(coder->bitcoder, (uchar)1, CONTEXT_RUN);
mq_bit_encode(coder->bitcoder, (uchar)r >> 1, CONTEXT_UNI);
mq_bit_encode(coder->bitcoder, (uchar)r&0x01, CONTEXT_UNI);
}
else
{
r = 4;
bit_encode(coder->bitcoder, (uchar)0, CONTEXT_RUN);
mq_bit_encode(coder->bitcoder, (uchar)0, CONTEXT_RUN);
}
}
@ -1448,7 +1430,7 @@ cleanup_enc_pass(bwc_coder *const coder, const int8 b)
(0x08 & stripe[k].stripe_d->stripe_r->sigma)) >> 3;
}
bit_encode(coder->bitcoder, (uchar)((bit >> l) & 0x01), coder->sig2context[(15 * k_h + 5 * k_v + k_d) >> l]);
mq_bit_encode(coder->bitcoder, (uchar)((bit >> l) & 0x01), coder->sig2context[(15 * k_h + 5 * k_v + k_d) >> l]);
}
if(bit & bit_mask)
{
@ -1470,7 +1452,7 @@ cleanup_enc_pass(bwc_coder *const coder, const int8 b)
xi_h = SIG2XI[xi_h];
xi_v = SIG2XI[xi_v];
bit_encode(coder->bitcoder, (uchar)(((bit_mask & stripe[k].xi) >> l)^XI2CONT[(xi_h << 2) | xi_v][1]),
mq_bit_encode(coder->bitcoder, (uchar)(((bit_mask & stripe[k].xi) >> l)^XI2CONT[(xi_h << 2) | xi_v][1]),
XI2CONT[(xi_h << 2) | xi_v][0]);
mse += DISTORTION_TS_LUT[((stripe[k].sample[l] >> dist_shift) << dist_corr) & 0x1F];
@ -1503,7 +1485,7 @@ cleanup_enc_pass(bwc_coder *const coder, const int8 b)
(0x01 & stripe[k].stripe_u->stripe_r->sigma)) << 3;
}
bit_encode(coder->bitcoder, (uchar)((bit >> l) & 0x01), coder->sig2context[(15 * k_h + 5 * k_v + k_d) >> l]);
mq_bit_encode(coder->bitcoder, (uchar)((bit >> l) & 0x01), coder->sig2context[(15 * k_h + 5 * k_v + k_d) >> l]);
if(bit & bit_mask)
{
@ -1521,7 +1503,7 @@ cleanup_enc_pass(bwc_coder *const coder, const int8 b)
xi_h = SIG2XI[xi_h];
xi_v = SIG2XI[xi_v];
bit_encode(coder->bitcoder, (uchar)(((bit_mask & stripe[k].xi) >> l)^XI2CONT[(xi_h << 2) | xi_v][1]),
mq_bit_encode(coder->bitcoder, (uchar)(((bit_mask & stripe[k].xi) >> l)^XI2CONT[(xi_h << 2) | xi_v][1]),
XI2CONT[(xi_h << 2) | xi_v][0]);
mse += DISTORTION_TS_LUT[((stripe[k].sample[l] >> dist_shift) << dist_corr) & 0x1F];
@ -1630,7 +1612,7 @@ significance_propagation_dec_pass(bwc_coder *const coder, const int8 b)
if(k_sig)
{
bit = bit_decode(coder->bitcoder, coder->sig2context[k_sig]);
bit = mq_bit_decode(coder->bitcoder, coder->sig2context[k_sig]);
if(bit)
{
@ -1654,7 +1636,7 @@ significance_propagation_dec_pass(bwc_coder *const coder, const int8 b)
xi_h = SIG2XI[xi_h];
xi_v = SIG2XI[xi_v];
stripe[k].xi |= ((XI2CONT[(xi_h << 2) | xi_v][1] ^ bit_decode(coder->bitcoder, XI2CONT[(xi_h << 2) | xi_v][0])) << l);
stripe[k].xi |= ((XI2CONT[(xi_h << 2) | xi_v][1] ^ mq_bit_decode(coder->bitcoder, XI2CONT[(xi_h << 2) | xi_v][0])) << l);
stripe[k].sigma |= bit_mask;
}
@ -1703,7 +1685,7 @@ significance_propagation_dec_pass(bwc_coder *const coder, const int8 b)
if(k_sig && (stripe[k].sigma^bit_mask))
{
bit = bit_decode(coder->bitcoder, coder->sig2context[k_sig]);
bit = mq_bit_decode(coder->bitcoder, coder->sig2context[k_sig]);
if(bit)
{
@ -1723,7 +1705,7 @@ significance_propagation_dec_pass(bwc_coder *const coder, const int8 b)
xi_h = SIG2XI[xi_h];
xi_v = SIG2XI[xi_v];
stripe[k].xi |= ((XI2CONT[(xi_h << 2) | xi_v][1] ^ bit_decode(coder->bitcoder, XI2CONT[(xi_h << 2) | xi_v][0])) << l);
stripe[k].xi |= ((XI2CONT[(xi_h << 2) | xi_v][1] ^ mq_bit_decode(coder->bitcoder, XI2CONT[(xi_h << 2) | xi_v][0])) << l);
stripe[k].sigma |= bit_mask;
}
@ -1843,7 +1825,7 @@ magnitude_refinement_dec_pass(bwc_coder *const coder, const int8 b)
}
}
stripe[k].bit[b] |= (bit_decode(coder->bitcoder, k_mag) << l);
stripe[k].bit[b] |= (mq_bit_decode(coder->bitcoder, k_mag) << l);
stripe[k].delta |= bit_mask;
}
@ -1884,7 +1866,7 @@ magnitude_refinement_dec_pass(bwc_coder *const coder, const int8 b)
}
}
stripe[k].bit[b] |= (bit_decode(coder->bitcoder, k_mag) << l);
stripe[k].bit[b] |= (mq_bit_decode(coder->bitcoder, k_mag) << l);
stripe[k].delta |= bit_mask;
}
@ -1965,10 +1947,10 @@ cleanup_dec_pass(bwc_coder *const coder, const int8 b)
!(0x01 & stripe[k].stripe_u->stripe_r->sigma) && !stripe[k].stripe_r->sigma &&
!stripe[k].sigma)
{
if(bit_decode(coder->bitcoder, CONTEXT_RUN))
if(mq_bit_decode(coder->bitcoder, CONTEXT_RUN))
{
r = bit_decode(coder->bitcoder, CONTEXT_UNI);
r = (r << 1) + bit_decode(coder->bitcoder, CONTEXT_UNI);
r = mq_bit_decode(coder->bitcoder, CONTEXT_UNI);
r = (r << 1) + mq_bit_decode(coder->bitcoder, CONTEXT_UNI);
bit |= (0x08 >> r);
}
else
@ -2007,7 +1989,7 @@ cleanup_dec_pass(bwc_coder *const coder, const int8 b)
(0x08 & stripe[k].stripe_d->stripe_r->sigma)) >> 3;
}
bit |= (bit_decode(coder->bitcoder, coder->sig2context[(15 * k_h + 5 * k_v + k_d) >> l]) << l);
bit |= (mq_bit_decode(coder->bitcoder, coder->sig2context[(15 * k_h + 5 * k_v + k_d) >> l]) << l);
}
if(bit & bit_mask)
{
@ -2029,7 +2011,7 @@ cleanup_dec_pass(bwc_coder *const coder, const int8 b)
xi_h = SIG2XI[xi_h];
xi_v = SIG2XI[xi_v];
stripe[k].xi |= ((XI2CONT[(xi_h << 2) | xi_v][1] ^ bit_decode(coder->bitcoder, XI2CONT[(xi_h << 2) | xi_v][0])) << l);
stripe[k].xi |= ((XI2CONT[(xi_h << 2) | xi_v][1] ^ mq_bit_decode(coder->bitcoder, XI2CONT[(xi_h << 2) | xi_v][0])) << l);
stripe[k].sigma |= bit_mask;
}
@ -2063,7 +2045,7 @@ cleanup_dec_pass(bwc_coder *const coder, const int8 b)
(0x01 & stripe[k].stripe_u->stripe_r->sigma)) << 3;
}
bit |= (bit_decode(coder->bitcoder, coder->sig2context[(15 * k_h + 5 * k_v + k_d) >> l]) << l);
bit |= (mq_bit_decode(coder->bitcoder, coder->sig2context[(15 * k_h + 5 * k_v + k_d) >> l]) << l);
if(bit & bit_mask)
{
@ -2081,7 +2063,7 @@ cleanup_dec_pass(bwc_coder *const coder, const int8 b)
xi_h = SIG2XI[xi_h];
xi_v = SIG2XI[xi_v];
stripe[k].xi |= ((XI2CONT[(xi_h << 2) | xi_v][1] ^ bit_decode(coder->bitcoder, XI2CONT[(xi_h << 2) | xi_v][0])) << l);
stripe[k].xi |= ((XI2CONT[(xi_h << 2) | xi_v][1] ^ mq_bit_decode(coder->bitcoder, XI2CONT[(xi_h << 2) | xi_v][0])) << l);
stripe[k].sigma |= bit_mask;
}
@ -2488,7 +2470,7 @@ encode_codeblock(bwc_field *const field, bwc_cblk_access *const access,
! Initialize the entropy encoder used for the current com- !
! pression run. !
\*--------------------------------------------------------*/
if(initialize_bit_encoder(&coder, CONTEXT_TOTAL))
if(initialize_mq_encoder(&coder, CONTEXT_TOTAL))
{
return;
}
@ -2516,7 +2498,7 @@ encode_codeblock(bwc_field *const field, bwc_cblk_access *const access,
/*--------------------------------------------------------*\
! Reset the bit encoder for the next coding pass. !
\*--------------------------------------------------------*/
if(bit_encoder_next_run(coder.bitcoder))
if(mq_next_run(coder.bitcoder))
{
return;
}
@ -2528,7 +2510,7 @@ encode_codeblock(bwc_field *const field, bwc_cblk_access *const access,
! Evaluate the number of bytes generated so far by the bit !
! encoder and increase the buffer size if necessary. !
\*--------------------------------------------------------*/
if(coder.buff_size <= (bit_coder_get_no_bytes(coder.bitcoder) + coder.buff_incr))
if(coder.buff_size <= (mq_get_no_bytes(coder.bitcoder) + coder.buff_incr))
{
coder.buff_size += ((uint64)k >> 1) * coder.buff_incr;
coder.compressed = realloc(coder.compressed, coder.buff_size * sizeof(uchar));
@ -2539,7 +2521,7 @@ encode_codeblock(bwc_field *const field, bwc_cblk_access *const access,
return;
}
bit_coder_reset_ptr(coder.bitcoder, coder.compressed);
mq_reset_ptr(coder.bitcoder, coder.compressed);
}
/*--------------------------------------------------------*\
! If the error resilience flag is set, encode a segmark !
@ -2559,7 +2541,7 @@ encode_codeblock(bwc_field *const field, bwc_cblk_access *const access,
! Evalute the number of bytes generated by the bit encoder !
! and increase the buffer size if necessary. !
\*--------------------------------------------------------*/
if(coder.buff_size <= (bit_coder_get_no_bytes(coder.bitcoder) + 16))
if(coder.buff_size <= (mq_get_no_bytes(coder.bitcoder) + 16))
{
coder.buff_size += 16;
coder.compressed = realloc(coder.compressed, coder.buff_size * sizeof(uchar));
@ -2570,13 +2552,13 @@ encode_codeblock(bwc_field *const field, bwc_cblk_access *const access,
return;
}
bit_coder_reset_ptr(coder.bitcoder, coder.compressed);
mq_reset_ptr(coder.bitcoder, coder.compressed);
}
/*--------------------------------------------------------*\
! Flush the remaining bits in the byte buffer to the coder !
! output and calculate the minimum truncation lengths. !
\*--------------------------------------------------------*/
bit_encoder_termination(coder.bitcoder);
mq_termination(coder.bitcoder);
/*--------------------------------------------------------*\
! Save the number of significant bitplanes, insignificant !
@ -2598,12 +2580,12 @@ encode_codeblock(bwc_field *const field, bwc_cblk_access *const access,
! Save the lengths of the coding passes in the encoded !
! codeblock structure. !
\*--------------------------------------------------------*/
bit_coder_get_pass_lengths(coder.bitcoder, encoded_cblk);
mq_get_pass_lengths(coder.bitcoder, encoded_cblk);
/*--------------------------------------------------------*\
! Free the entropy encoder structure. !
\*--------------------------------------------------------*/
free_bit_encoder(&coder);
free_mq_encoder(&coder);
/*--------------------------------------------------------*\
! Calculate the slope values of the distortion/rate convex !
@ -2771,7 +2753,7 @@ decode_codeblock(bwc_field *const field, bwc_cblk_access *const access,
! Initialize the entropy encoder used for the current com- !
! pression run. !
\*--------------------------------------------------------*/
if(initialize_bit_decoder(&coder, CONTEXT_TOTAL, encoded_cblk->L[encoded_cblk->Z - 1]))
if(initialize_mq_decoder(&coder, CONTEXT_TOTAL, encoded_cblk->L[encoded_cblk->Z - 1]))
{
return;
}
@ -2787,10 +2769,10 @@ decode_codeblock(bwc_field *const field, bwc_cblk_access *const access,
decoding_pass[i](&coder, k);
}
if((coder.erres) && (((bit_decode(coder.bitcoder, CONTEXT_UNI) << 3) |
(bit_decode(coder.bitcoder, CONTEXT_UNI) << 2) |
(bit_decode(coder.bitcoder, CONTEXT_UNI) << 1) |
bit_decode(coder.bitcoder, CONTEXT_UNI)) != 0x0A))
if((coder.erres) && (((mq_bit_decode(coder.bitcoder, CONTEXT_UNI) << 3) |
(mq_bit_decode(coder.bitcoder, CONTEXT_UNI) << 2) |
(mq_bit_decode(coder.bitcoder, CONTEXT_UNI) << 1) |
mq_bit_decode(coder.bitcoder, CONTEXT_UNI)) != 0x0A))
{
goto break_out;
}
@ -2808,7 +2790,7 @@ decode_codeblock(bwc_field *const field, bwc_cblk_access *const access,
/*--------------------------------------------------------*\
! Free the entropy encoder structure. !
\*--------------------------------------------------------*/
free_bit_encoder(&coder);
free_mq_encoder(&coder);
}
/************************************************************************************************************\
@ -2854,12 +2836,14 @@ t1_encode(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const par
uint64 c;
uint64 cbSizeX, cbSizeY, cbSizeZ;
uint64 width, height, depth;
int64 buff_size;
int64 j;
int64 i, j;
int64 nThreads;
uint16 cbSizeTS;
uint16 slope_max, slope_min;
int16 i, z;
uint8 nThreads;
int16 z;
/*-----------------------*\
! DEFINE STRUCTS: !
@ -2904,7 +2888,7 @@ t1_encode(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const par
! pression run. !
\*--------------------------------------------------------*/
#if defined (_OPENMP)
nThreads = control->nThreads;
nThreads = omp_get_max_threads();
#else
nThreads = 1;
#endif
@ -2939,7 +2923,7 @@ t1_encode(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const par
! threads during a parallel run. For a serial run only one !
! working buffer is allocated. !
\*--------------------------------------------------------*/
for(i = 0; i < nThreads; ++i)
for(i = 0; i < (int64)nThreads; ++i)
{
memory[i] = calloc(buff_size, sizeof(bwc_coder_stripe));
if(!memory[i])
@ -2997,7 +2981,7 @@ t1_encode(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const par
}
}
#if defined(_OPENMP)
#if defined (_OPENMP)
#pragma omp parallel private(working_buffer, codeblock, cblk_info, cbSizeX, cbSizeY, cbSizeZ, cbSizeTS) reduction(max:slope_max) reduction(min:slope_min)
#endif
{
@ -3015,7 +2999,7 @@ t1_encode(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const par
! Loop through and encode all codeblocks for the current !
! parameter. !
\*--------------------------------------------------------*/
#if defined(_OPENMP)
#if defined (_OPENMP)
#pragma omp for
#endif
for(c = 0; c < parameter->control.number_of_codeblocks; ++c)
@ -3155,11 +3139,12 @@ t1_decode(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const par
uint64 c;
uint64 cbSizeX, cbSizeY, cbSizeZ;
uint64 width, height, depth;
int64 buff_size;
int64 j;
int64 i, j;
int64 nThreads;
uint16 cbSizeTS;
int16 i;
uint8 nThreads;
/*-----------------------*\
! DEFINE STRUCTS: !
@ -3197,7 +3182,7 @@ t1_decode(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const par
! compression run. !
\*--------------------------------------------------------*/
#if defined (_OPENMP)
nThreads = control->nThreads;
nThreads = omp_get_max_threads();
#else
nThreads = 1;
#endif
@ -3232,7 +3217,7 @@ t1_decode(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const par
! threads during a parallel run. For a serial run only one !
! working buffer is allocated. !
\*--------------------------------------------------------*/
for(i = 0; i < nThreads; ++i)
for(i = 0; i < (int64)nThreads; ++i)
{
memory[i] = calloc(buff_size, sizeof(bwc_coder_stripe));
if(!memory[i])
@ -3290,7 +3275,7 @@ t1_decode(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const par
}
}
#if defined(_OPENMP)
#if defined (_OPENMP)
#pragma omp parallel private(working_buffer, codeblock, cblk_info, subb_ctrl,\
cbSizeX, cbSizeY, cbSizeZ, cbSizeTS)
#endif
@ -3309,7 +3294,7 @@ t1_decode(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const par
! Loop through and encode all codeblocks for the current !
! parameter. !
\*--------------------------------------------------------*/
#if defined(_OPENMP)
#if defined (_OPENMP)
#pragma omp for
#endif
for(c = 0; c < parameter->control.number_of_codeblocks; ++c)

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,65 +12,38 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| FILE NAME: t2.c ||
|| ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| DESCRIPTION NEEDED. ||
|| ||
|| FILE REFERENCES: ||
|| ---------------- ||
|| ||
|| Name I/O Description ||
|| ---- --- ----------- ||
|| none - - ||
|| ||
|| ||
|| PRIVATE FUNCTIONS: ||
|| ------------------ ||
|| - encode_length ||
|| - decode_length ||
|| - create_packet ||
|| - create_packets ||
|| - create_quality_layer ||
|| - create_quality_layers ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| - t2_encode ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| - Patrick Vogler B87D120 V 0.1.0 source file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| This file describes a set of functions that can be used to de-/encode bwc ||
|| codeblocks described by the bwc_field structure according to the embedded block ||
|| coding paradigm described by the JPEG 2000 standard. For more information please ||
|| refere to JPEG2000 by D. S. Taubman and M. W. Marcellin. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| 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: ||
|| 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. ||
|| (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. ||
|| (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. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
/************************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
@ -82,7 +55,9 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <omp.h>
#if defined (_OPENMP)
#include <omp.h>
#endif
#include <time.h>
#include "codestream.h"
@ -126,71 +101,71 @@
{ \
if(delta_z == 1) \
{ \
bwc_emit_bit(stream, 0); \
emit_bit(stream, 0); \
} \
else if(delta_z == 2) \
{ \
bwc_emit_bit(stream, 1); \
bwc_emit_bit(stream, 0); \
emit_bit(stream, 1); \
emit_bit(stream, 0); \
} \
else if(delta_z < 6) \
{ \
delta_z -= 3; \
bwc_emit_bit(stream, 1); \
bwc_emit_bit(stream, 1); \
bwc_emit_bit(stream, 0x02 & delta_z); \
bwc_emit_bit(stream, 0x01 & delta_z); \
emit_bit(stream, 1); \
emit_bit(stream, 1); \
emit_bit(stream, 0x02 & delta_z); \
emit_bit(stream, 0x01 & delta_z); \
} \
else if(delta_z < 37) \
{ \
delta_z -= 6; \
bwc_emit_bit(stream, 1); \
bwc_emit_bit(stream, 1); \
bwc_emit_bit(stream, 1); \
bwc_emit_bit(stream, 1); \
bwc_emit_bit(stream, 0x10 & delta_z); \
bwc_emit_bit(stream, 0x08 & delta_z); \
bwc_emit_bit(stream, 0x04 & delta_z); \
bwc_emit_bit(stream, 0x02 & delta_z); \
bwc_emit_bit(stream, 0x01 & delta_z); \
emit_bit(stream, 1); \
emit_bit(stream, 1); \
emit_bit(stream, 1); \
emit_bit(stream, 1); \
emit_bit(stream, 0x10 & delta_z); \
emit_bit(stream, 0x08 & delta_z); \
emit_bit(stream, 0x04 & delta_z); \
emit_bit(stream, 0x02 & delta_z); \
emit_bit(stream, 0x01 & delta_z); \
} \
else if(delta_z < 293) \
{ \
delta_z -= 37; \
bwc_emit_bit(stream, 1); \
bwc_emit_bit(stream, 1); \
bwc_emit_bit(stream, 1); \
bwc_emit_bit(stream, 1); \
bwc_emit_bit(stream, 1); \
bwc_emit_bit(stream, 1); \
bwc_emit_bit(stream, 1); \
bwc_emit_bit(stream, 1); \
bwc_emit_bit(stream, 1); \
bwc_emit_bit(stream, 0x080 & delta_z); \
bwc_emit_bit(stream, 0x040 & delta_z); \
bwc_emit_bit(stream, 0x020 & delta_z); \
bwc_emit_bit(stream, 0x010 & delta_z); \
bwc_emit_bit(stream, 0x008 & delta_z); \
bwc_emit_bit(stream, 0x004 & delta_z); \
bwc_emit_bit(stream, 0x002 & delta_z); \
bwc_emit_bit(stream, 0x001 & delta_z); \
emit_bit(stream, 1); \
emit_bit(stream, 1); \
emit_bit(stream, 1); \
emit_bit(stream, 1); \
emit_bit(stream, 1); \
emit_bit(stream, 1); \
emit_bit(stream, 1); \
emit_bit(stream, 1); \
emit_bit(stream, 1); \
emit_bit(stream, 0x080 & delta_z); \
emit_bit(stream, 0x040 & delta_z); \
emit_bit(stream, 0x020 & delta_z); \
emit_bit(stream, 0x010 & delta_z); \
emit_bit(stream, 0x008 & delta_z); \
emit_bit(stream, 0x004 & delta_z); \
emit_bit(stream, 0x002 & delta_z); \
emit_bit(stream, 0x001 & delta_z); \
} \
}
#define decode_delta_z(stream, delta_z) \
{ \
if(!bwc_get_bit(stream)) \
if(!get_bit(stream)) \
{ \
delta_z = 1; \
} \
else if(!bwc_get_bit(stream)) \
else if(!get_bit(stream)) \
{ \
delta_z = 2; \
} \
else \
{ \
delta_z = (bwc_get_bit(stream) << 1) | \
bwc_get_bit(stream); \
delta_z = (get_bit(stream) << 1) | \
get_bit(stream); \
\
if(delta_z < 3) \
{ \
@ -198,11 +173,11 @@
} \
else \
{ \
delta_z = (bwc_get_bit(stream) << 4) | \
(bwc_get_bit(stream) << 3) | \
(bwc_get_bit(stream) << 2) | \
(bwc_get_bit(stream) << 1) | \
bwc_get_bit(stream); \
delta_z = (get_bit(stream) << 4) | \
(get_bit(stream) << 3) | \
(get_bit(stream) << 2) | \
(get_bit(stream) << 1) | \
get_bit(stream); \
\
if(delta_z < 31) \
{ \
@ -210,14 +185,14 @@
} \
else \
{ \
delta_z = (bwc_get_bit(stream) << 7) | \
(bwc_get_bit(stream) << 6) | \
(bwc_get_bit(stream) << 5) | \
(bwc_get_bit(stream) << 4) | \
(bwc_get_bit(stream) << 3) | \
(bwc_get_bit(stream) << 2) | \
(bwc_get_bit(stream) << 1) | \
bwc_get_bit(stream); \
delta_z = (get_bit(stream) << 7) | \
(get_bit(stream) << 6) | \
(get_bit(stream) << 5) | \
(get_bit(stream) << 4) | \
(get_bit(stream) << 3) | \
(get_bit(stream) << 2) | \
(get_bit(stream) << 1) | \
get_bit(stream); \
\
delta_z += 37; \
} \
@ -232,7 +207,7 @@
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void encode_length(bwc_stream *const header, bwc_codeblock *const codeblock, !
! FUNCTION NAME: void encode_length(bitstream *const header, bwc_codeblock *const codeblock, !
! -------------- int8 const quality_layer, !
! uchar const estimate) !
! !
@ -263,7 +238,7 @@
! !
\*----------------------------------------------------------------------------------------------------------*/
static void
encode_length(bwc_stream *const header, bwc_codeblock *const codeblock,
encode_length(bitstream *const header, bwc_codeblock *const codeblock,
int8 const quality_layer,
uchar const estimate)
{
@ -311,17 +286,17 @@ encode_length(bwc_stream *const header, bwc_codeblock *const codeblock,
while(beta < max_beta)
{
bwc_emit_bit(header, 1);
emit_bit(header, 1);
beta++;
}
bwc_emit_bit(header, 0);
emit_bit(header, 0);
L_bits = 1 << (beta + cp_bits - 1);
while(L_bits > 0)
{
bwc_emit_bit(header, L & L_bits);
emit_bit(header, L & L_bits);
L_bits >>= 1;
}
@ -366,7 +341,7 @@ encode_length(bwc_stream *const header, bwc_codeblock *const codeblock,
! !
\*----------------------------------------------------------------------------------------------------------*/
static void
decode_length(bwc_stream *const header, bwc_codeblock *const codeblock, int8 const quality_layer)
decode_length(bitstream *const header, bwc_codeblock *const codeblock, int8 const quality_layer)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
@ -390,7 +365,7 @@ decode_length(bwc_stream *const header, bwc_codeblock *const codeblock, int8 con
cblk_ctrl = &codeblock->control;
cp_contr = cblk_ctrl->cp_contr;
while(bwc_get_bit(header))
while(get_bit(header))
{
cblk_ctrl->beta++;
}
@ -403,7 +378,7 @@ decode_length(bwc_stream *const header, bwc_codeblock *const codeblock, int8 con
for(i = 0; L_bits > 0; --L_bits)
{
i <<= 1;
i |= bwc_get_bit(header);
i |= get_bit(header);
}
codeblock->encoded_block->L[z_curr] = ((z_prev >= 0) ? codeblock->encoded_block->L[z_prev] : 0) + i;
@ -482,7 +457,7 @@ create_packet(bwc_field *const field, bwc_tile *const tile,
bwc_packet *packet;
bwc_precinct *precinct;
bwc_codeblock *codeblock;
bwc_stream *header;
bitstream *header;
/*-----------------------*\
! DEFINE ASSERTIONS: !
@ -507,7 +482,7 @@ create_packet(bwc_field *const field, bwc_tile *const tile,
! Initialize the stream that is used to assemble the pack- !
! et header. !
\*--------------------------------------------------------*/
header = bwc_init_stream(NULL, PACKET_HEADER_SIZE, 'c');
header = init_stream(NULL, PACKET_HEADER_SIZE, 'c');
if(!header)
{
// memory allocation error
@ -523,7 +498,7 @@ create_packet(bwc_field *const field, bwc_tile *const tile,
if(!est)
{
packet->body.access =
packet->body.memory = calloc(packet->body.size, sizeof(bwc_packed_stream));
packet->body.memory = calloc(packet->body.size, sizeof(bwc_stream));
if(!packet->body.memory)
{
// memory allocation error
@ -536,7 +511,7 @@ create_packet(bwc_field *const field, bwc_tile *const tile,
! Emit the contribution bit to the packet header that sig- !
! nals a non-empty packet body. !
\*--------------------------------------------------------*/
bwc_emit_bit(header, 1);
emit_bit(header, 1);
/*--------------------------------------------------------*\
! Iterate over all codeblocks in all subbands to assemble !
@ -598,7 +573,7 @@ create_packet(bwc_field *const field, bwc_tile *const tile,
! If a contribution has already been made, transmit a flag !
! to signal if new coding passes are to be contributed. !
\*--------------------------------------------------------*/
bwc_emit_bit(header, delta_z);
emit_bit(header, delta_z);
}
/*--------------------------------------------------------*\
@ -669,7 +644,7 @@ create_packet(bwc_field *const field, bwc_tile *const tile,
}
k = header->L;
bwc_terminate_stream(header, NULL);
terminate_stream(header, NULL);
return k;
}
/*--------------------------------------------------------*\
@ -680,7 +655,7 @@ create_packet(bwc_field *const field, bwc_tile *const tile,
\*--------------------------------------------------------*/
else
{
if(bwc_terminate_stream(header, &packet->header))
if(terminate_stream(header, &packet->header))
{
// memory allocation error
return -1;
@ -1181,7 +1156,7 @@ create_quality_layers(bwc_field *const field, bwc_tile *const tile)
! Calculate the size of the main header, including the end !
! of header marker segment. !
\*--------------------------------------------------------*/
main_header_size = control->header.size + 4 + (control->nTiles * info->nPar * 2 * PREC_BYTE);
main_header_size = control->headerSize;
/*--------------------------------------------------------*\
! Calculate the size of the present tile and the overall !
@ -1402,7 +1377,7 @@ parse_packet(bwc_field *const field, bwc_tile *const tile,
bwc_precinct *precinct;
bwc_codeblock *codeblock;
bwc_encoded_cblk *encoded_block;
bwc_stream *header;
bitstream *header;
/*-----------------------*\
! DEFINE ASSERTIONS: !
@ -1417,7 +1392,7 @@ parse_packet(bwc_field *const field, bwc_tile *const tile,
! Initialize the stream that is used to parse the packet !
! codestream. !
\*--------------------------------------------------------*/
header = bwc_init_stream(packet->header.memory, body_size, 'd');
header = init_stream(packet->header.memory, body_size, 'd');
if(!header)
{
// memory allocation error
@ -1428,7 +1403,7 @@ parse_packet(bwc_field *const field, bwc_tile *const tile,
! Extract the codeblock contribution marker from the code- !
! stream. !
\*--------------------------------------------------------*/
packet->e = bwc_get_bit(header);
packet->e = get_bit(header);
/*--------------------------------------------------------*\
! Check if the current packet has any codeblock contribu- !
@ -1498,7 +1473,7 @@ parse_packet(bwc_field *const field, bwc_tile *const tile,
! flag from the codestream that signals if new coding pas- !
! ses are available. !
\*--------------------------------------------------------*/
delta_z = bwc_get_bit(header);
delta_z = get_bit(header);
}

View file

@ -1,4 +1,4 @@
#*====================================================================================================================*#
#*================================================================================================*#
#| |#
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
@ -11,83 +11,75 @@
#| /$$ \ $$ | $$ |#
#| | $$$$$$/ | $$ |#
#| \______/ |__/ |#
#| |#
#| DESCRIPTION: |#
#| ------------ |#
#| |#
#| Defines the cmake script for the BigWhoop command line tool. |#
#| |#
#| |#
#| DEVELOPMENT HISTORY: |#
#| -------------------- |#
#| |#
#| Date Author Change Id Release Description Of Change |#
#| ---- ------ --------- ------- --------------------- |#
#| 30.08.2018 Patrick Vogler B87D120 V 0.1.0 cmake file created |#
#| 15.10.2021 Patrick Vogler B880CA2 V 0.1.1 Added install rules |#
#| |#
#| |#
#| ------------------------------------------------------------------------------------------------------ |#
#| |#
#| -------------------------------------------------------------------------------------------- |#
#| 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: |#
#| 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. |#
#| 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. |#
#| |#
#*====================================================================================================================*#
#*--------------------------------------------------------*#
#*================================================================================================*#
#----------------------------------------------------------#
# 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. #
#*--------------------------------------------------------*#
MESSAGE(STATUS "EAS3 file format support: ${BUILD_EAS3}")
#----------------------------------------------------------#
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()
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# Define the output name for the utility binaries. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
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. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
target_link_libraries(bwccmd PRIVATE bwclib m)

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

@ -1503,12 +1503,10 @@ 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;
/*-----------------------*\
@ -1672,7 +1670,7 @@ output_info(bwc_cmdl_arg_node *const args,
return;
}
data->codestream.data = calloc(1, sizeof(bwc_packed_stream));
data->codestream.data = calloc(1, sizeof(bwc_stream));
if(data->codestream.data == NULL)
{
// memory allocation error
@ -1713,33 +1711,16 @@ 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. !
\*--------------------------------------------------------*/
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);
field = bwc_create_decompression(data, 0);
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. !
\*--------------------------------------------------------*/
@ -1755,16 +1736,15 @@ 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. !
\*--------------------------------------------------------*/
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("| Original size: %42s |\n"\
"| Original file format: %42s |\n"\
@ -1775,9 +1755,10 @@ output_info(bwc_cmdl_arg_node *const args,
/*--------------------------------------------------------*\
! Print the file size and compression ratio. !
\*--------------------------------------------------------*/
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("| Size on Disk: %42s |\n"\
"| Comp. Ratio: %42.2f |\n"\
@ -1814,12 +1795,11 @@ 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;
@ -1835,26 +1815,23 @@ output_info(bwc_cmdl_arg_node *const args,
while(buff > param_info->name && isspace((unsigned char)*buff)) buff--;
buff[1] = '\0';
printf("| Name: %55s |\n"\
"| Minimum value: %55.2e |\n"\
"| 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, " ");
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);
}
printf("|%80s|\n"," ");
/*--------------------------------------------------------*\
! Print the quality layers. !
\*--------------------------------------------------------*/
printf("|---------------------------------Quality Layers---------------------------------|\n"\
printf("|-------------------------------- Quality Layers --------------------------------|\n"\
"| |\n");
for(l = 0; l < control->nLayers; ++l)
@ -1966,7 +1943,7 @@ read_bwc(char *const filename)
return NULL;
}
file->codestream.data = calloc(1, sizeof(bwc_packed_stream));
file->codestream.data = calloc(1, sizeof(bwc_stream));
if(file->codestream.data == NULL)
{
// memory allocation error
@ -2396,7 +2373,7 @@ write_file(bwc_cmdl_arg_node *const args,
\*--------------------------------------------------------*/
else
{
ext_hash = hash(strrchr(temp->lit_opt[0], '.'));
ext_hash = hash(strrchr(temp->lit_opt[0], '.') + 1);
if(ext_hash != hash(data->info.f_ext))
{
fprintf(stderr, "o##########################################################o\n"\
@ -2674,24 +2651,15 @@ 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: !
\*-----------------------*/
@ -2700,11 +2668,9 @@ 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. !
@ -2772,38 +2738,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]);
// }
/*--------------------------------------------------------*\
! !
@ -2848,23 +2814,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_quantization_style(field, bwc_qt_none);
else
bwc_set_quantization_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_quantization_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]);
// }
/*--------------------------------------------------------*\
! !
@ -2900,7 +2866,7 @@ main(int argc,
temp = retrieve_arg(args, "number_of_threads");
if((temp != NULL) && (temp->count == 1))
{
bwc_set_nThreads(field, (uint8_t)temp->num_opt[0]);
omp_set_num_threads((uint8_t)temp->num_opt[0]);
}
#endif
@ -2972,11 +2938,11 @@ main(int argc,
printf("----------------- Compression Parameters -----------------\n\n");
if((control->CSsgc &0x200) != 0)
{
printf(" Number of Tiles: %27d\n", control->nTiles);
printf(" Number of Tiles: %27ld\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(" - Timesteps: %27ld\n", control->tileSizeTS);
printf(" ..........................................................\n");
printf("\n");
}
@ -3033,57 +2999,6 @@ 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);
}
}
/*--------------------------------------------------------*\
@ -3141,7 +3056,7 @@ main(int argc,
temp = retrieve_arg(args, "number_of_threads");
if((temp != NULL) && (temp->count == 1))
{
bwc_set_nThreads(field, (uint8_t)temp->num_opt[0]);
omp_set_num_threads((uint8_t)temp->num_opt[0]);
}
#endif
@ -3173,21 +3088,6 @@ 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");
}
}
/*--------------------------------------------------------*\
! !