Initial commit

This commit is contained in:
Patrick Vogler 2023-06-20 13:43:33 +02:00
commit bfa813fcb1
No known key found for this signature in database
GPG Key ID: 45D788DF8ADCBA97
39 changed files with 28725 additions and 0 deletions

271
.gitignore vendored Normal file
View File

@ -0,0 +1,271 @@
# ---> C
# Prerequisites
*.d
# Object files
*.o
*.ko
*.obj
*.elf
# Linker output
*.ilk
*.map
*.exp
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
*.su
*.idb
*.pdb
# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf
# ---> CMake
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
# ---> Fortran
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
# ---> Python
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
bin/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
include/library/public
lib/
lib64/
out/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# Files and Archives
.eas
.npz
.zip
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
.ipynb
# IPython
profile_default/
ipython_config.py
# 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:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

184
CMakeLists.txt Executable file
View File

@ -0,0 +1,184 @@
#*====================================================================================================================*#
#| |#
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
#| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |#
#| /$$ \ $$ | $$ |#
#| | $$$$$$/ | $$ |#
#| \______/ |__/ |#
#| 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: |#
#| |#
#| (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. |#
#| |#
#*====================================================================================================================*#
#*--------------------------------------------------------*#
# 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})
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)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${BWC_SOURCE_DIR}/${CMAKE_INSTALL_BINDIR})
endif()
endif()
if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${BWC_SOURCE_DIR}/${CMAKE_INSTALL_LIBDIR})
endif()
if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${BWC_SOURCE_DIR}/${CMAKE_INSTALL_LIBDIR})
endif()
#*--------------------------------------------------------*#
# 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)
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")
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
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
"SHARED_LIBS_SUPPORTED" OFF)
if(SHARED_LIBS_SUPPORTED)
cmake_dependent_option(BWC_ENABLE_PIC
"Build with Position Independent Code" ON
"NOT BUILD_SHARED_LIBS" ON)
endif()
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)
endif()

9
LICENSE Normal file
View File

@ -0,0 +1,9 @@
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.

198
Makefile Executable file
View File

@ -0,0 +1,198 @@
#*====================================================================================================================*#
#| |#
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
#| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |#
#| /$$ \ $$ | $$ |#
#| | $$$$$$/ | $$ |#
#| \______/ |__/ |#
#| |#
#| |#
#| Version 0.1.0 |#
#| |#
#| DESCRIPTION: |#
#| ------------ |#
#| Defines a wrapper for the Big Whoop cmake & make tools. This Makefile creates the |#
#| build dir if it does not exist, switches to it and executes cmake and make. |#
#| |#
#| ---------------------------------------------------------------------------------------------------------------- |#
#| |#
#| Copyright (c) 2021, 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. |#
#| |#
#*====================================================================================================================*#
#*--------------------------------------------------------*#
# Define special targets for the required build commands. #
#*--------------------------------------------------------*#
.PHONY: clean
.PHONY: help
.PHONY: static
.PHONY: single
.PHONY: tool
.PHONY: eas3
.PHONY: netCDF
.PHONY: --build_debug
.PHONY: default
.PHONY: debug
.PHONY: full
#*--------------------------------------------------------*#
# Initialize the compiler flags used to build the library. #
#*--------------------------------------------------------*#
BUILD_TYPE="Release"
LINK_TYPE="Dynamic"
BUILD_PREC="Double"
BUILD_TOOL="False"
BUILD_EAS3="False"
BUILD_NETCDF="False"
#*--------------------------------------------------------*#
# Define default target. #
#*--------------------------------------------------------*#
default: | build_bwc display
#*--------------------------------------------------------*#
# Define helper target. #
#*--------------------------------------------------------*#
help:
@echo "Usage: make [options] [argument] Compile the BigWhoop library using the specified"
@echo " [options] and [argument]. Only one argument is "
@echo " accepted per compile run."
@echo ""
@echo "Arguments:"
@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 ""
@echo " full Compiles BigWhoop (with OpenMP enabled if applica-"
@echo " ble) and the command line tool with full file sup-"
@echo " port. Code optimization is set to the highest level."
@echo ""
@echo " clean Removes all files and folders created during a pre-"
@echo " vious compile run."
@echo ""
@echo "Options:"
@echo ""
@echo " [Type] [Description]"
@echo ""
@echo " static Builds BigWhoop as a static library."
@echo ""
@echo " single Compiles the BigWhoop library in single precision"
@echo " mode."
@echo ""
@echo " tool Build the command line tool."
@echo ""
@echo " eas3 Adds support for the eas3 file format to the com-"
@echo " mand line tool."
@echo ""
@echo " netCDF Adds support for the eas3 file format to the com-"
@echo " mand line tool."
#*--------------------------------------------------------*#
# Define private targets. #
#*--------------------------------------------------------*#
--build_debug:
$(eval BUILD_TYPE="Debug")
#*--------------------------------------------------------*#
# Define targets used to instrument library properites. #
#*--------------------------------------------------------*#
static:
$(eval LINK_TYPE="Static")
single:
$(eval BUILD_PREC="Single")
#*--------------------------------------------------------*#
# Define target used to activate command line tool build. #
#*--------------------------------------------------------*#
tool:
$(eval BUILD_TOOL="True")
#*--------------------------------------------------------*#
# Define targets used to activate file format support. #
#*--------------------------------------------------------*#
eas3:
$(eval BUILD_EAS3="True")
netCDF:
$(eval BUILD_NETCDF="True")
#*--------------------------------------------------------*#
# Define the wrappers for the compile command targets. #
#*--------------------------------------------------------*#
debug: | clean --build_debug tool eas3 build_bwc display
release: | build_bwc display
full: | clean tool eas3 build_bwc display
#*--------------------------------------------------------*#
# Define target used to output compile information. #
#*--------------------------------------------------------*#
display:
@echo "=============================================================="
@echo ""
@echo " .:-------------: .:-------------: "
@echo " .+++++++++++++++= :+++++++++++++++- "
@echo " :+++. -++= -++= "
@echo " :+++. -++= -++= "
@echo " -++++++++++++++= -++= -++= "
@echo " .=++---------=++= -++= -++= "
@echo " :+++ :++= -++= -++= "
@echo " .+++=--------=+++---=+++---=+++------------: "
@echo " -=++++++++++++++++++++++++++++++++++++++++- "
@echo ""
@echo "----------------- Successfully Compiled -----------------"
@echo ""
@echo " Build Type: $(BUILD_TYPE)"
@echo " Link Type: $(LINK_TYPE)"
@echo " Precision: $(BUILD_PREC)"
@echo " Utilities: $(BUILD_TOOL)"
@echo ""
@echo " Build date: $(shell date)"
@echo " User: $(USER)"
@echo ""
@echo "=============================================================="
#*--------------------------------------------------------*#
# 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
clean:
- /bin/rm -rf build/ bin/ lib/ lib64/ include/library/public

43
README.md Normal file
View File

@ -0,0 +1,43 @@
<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>
</p>
<h1 align="center">Compression library for numerical datasets</h1>
BigWhoop is a compression library for numerical datasets that has been developed as part of the EU Projects ExaFLOW and EXCELLERAT. It aims to give scientists and egineers a tool to drastically reduce the size of their simulation data while minimizing the distortion introduced by a lossy compression scheme.
<h1 align="center">Building BigWhoop</h1>
### Dependencies
* make
* cmake (>= 3.5.1)
* gcc (>= 8.5.0)
### Building
pull the sources from HLRS' gitea instance (note: default branch is `main`):
```
git pull https://code.hlrs.de/hpcpvogl/BigWhoop.git
```
Now change into the source directory and run the following commands.
**for a simple build**
```
make clean
make
```
**for a full build (including command line tool)**
```
make full
```
**for debugging**
```
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.

BIN
docs/img/Logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

299
docs/templates/header.h vendored Executable file
View File

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

179
docs/templates/source.c vendored Executable file
View File

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

@ -0,0 +1,336 @@
/*==================================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: header.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| This file defines simple read and write functions used to access conforming eas3 datasets. ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| - eas3_std_params ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| - read_eas3 ||
|| - write_eas3 ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| - Patrick Vogler B87D120 V 0.1.0 header file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|| following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|| the following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|| distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| ||
\*==================================================================================================================================*/
#ifndef EAS3_H
#define EAS3_H
/************************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
#include <bwc.h>
#include <stdio.h>
#include <stdint.h>
/************************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! !
! These macros are used to identify the spatial and temporal dimensions. !
! !
! MACROS: !
! ------- !
! Name Description !
! ---- ----------- !
! DIM_X, DIM_Y, DIM_Z - Spatial Dimensions !
! !
! DIM_TS - Temporal Dimension !
! !
! DIM_ALL - All Dimensions !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description !
! ---- ------ --------- ------- ----------- !
! 04.12.2017 Patrick Vogler B87D120 V 0.1.0 macros created !
! !
\*----------------------------------------------------------------------------------------------------------*/
#define DIM_X 1
#define DIM_Y 2
#define DIM_Z 4
#define DIM_TS 8
#define DIM_ALL 15
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! !
! These macros are used to instruct the read_eas3_header function. !
! !
! Macros: !
! ------- !
! Macro Description !
! ----- ----------- !
! EAS3_NO_ATTR 1 - Specifies that no attributes are present in the bit- !
! stream. !
! !
! EAS3_ALL_ATTR 2 - Specifies that all attributes are present in the bit- !
! bitstream. !
! !
! ATTRLEN 10 - Defines the number of bytes used to define an attrib- !
! ute. !
! !
! UDEFLEN 20 - Defines the number of bytes used to define a user de- !
! fined data. !
! !
! EAS3_NO_G 1 - Specifies that no geometry data is present in the bit- !
! stream. !
! !
! EAS3_X0DX_G 2 - Specifies that a start value and step size are present !
! in the bitstream. !
! !
! EAS3_UDEF_G 3 - Specifies that ng = number of coordinate data is pres- !
! ent in the bitstream. !
! !
! EAS3_ALL_G 4 - Specifies that an element for every appropriate di- !
! mension is present in the bitstream. !
! !
! EAS3_FULL_G 5 - Specifies that an element for every dimension is pres- !
! ent in the bitstream. !
! !
! EAS3_NO_UDEF 1 - Specifies that no user defined data is present in the !
! bitstream. !
! !
! EAS3_ALL_UDEF 2 - Specifies that all user defined fields are present in !
! the bitstream. !
! !
! EAS3_INT_UDEF 3 - Specifies that an user defined integer field is pres- !
! ent in the bitstream. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 20.06.2018 Patrick Vogler B87D120 V 0.1.0 Macros created !
\*----------------------------------------------------------------------------------------------------------*/
#define EAS3_NO_ATTR 0x100000000000000
#define EAS3_ALL_ATTR 0x200000000000000
#define EAS2_TYPE 0x100000000000000
#define EAS3_TYPE 0x200000000000000
#define ATTRLEN 10
#define UDEFLEN 20
#define EAS3_NO_G 0x100000000000000
#define EAS3_X0DX_G 0x200000000000000
#define EAS3_UDEF_G 0x300000000000000
#define EAS3_ALL_G 0x400000000000000
#define EAS3_FULL_G 0x500000000000000
#define EAS3_NO_UDEF 0x100000000000000
#define EAS3_ALL_UDEF 0x200000000000000
#define EAS3_INT_UDEF 0x300000000000000
#define AUX_SIZE 0x8000
/************************************************************************************************************\
|| ___ _ _ ___ ____ ____ ||
|| | \_/ |__] |___ [__ ||
|| | | | |___ ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! STRUCT NAME: eas3_header !
! ----------- !
! !
! DESCRIPTION: !
! ------------ !
! This structure is used to store the eas3 header information. For a more thorough discussion !
! of the eas3 datatype see: !
! !
! https://wiki.iag.uni-stuttgart.de/eas3wiki/index.php/EAS3_File_Format/de !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! file_type unsigned int(64 bit) - Defines an identifier for the EAS type. !
! !
! accuracy unsigned int(64 bit) - Defines the accuracy of an eas3 file. !
! !
! nzs unsigned int(64 bit) - Variable defining the temporal size of !
! the uncompressed dataset. !
! !
! npar unsigned int(64 bit) - Defines the number of parameters in the !
! eas3 dataset. !
! !
! ndim1, -2, -3 unsigned int(64 bit) - Variables defining the spatial size of !
! the eas3 dataset. !
! !
! attribute_mode; unsigned int(64 bit) - Defines an identifier used to signal !
! the attribute mode of the eas3 file. !
! !
! gmode_time unsigned int(64 bit) - Defines the geometry mode for the temp- !
! oral dimension. !
! !
! gmode_param unsigned int(64 bit) - Defines the geometry mode for the para- !
! meters. !
! !
! gmode_dim1 unsigned int(64 bit) - Defines the geometry mode for the first !
! spatial dimension. !
! !
! gmode_dim2 unsigned int(64 bit) - Defines the geometry mode for the sec- !
! ond spatial dimension. !
! !
! gmode_dim3 unsigned int(64 bit) - Defines the geometry mode for the third !
! spatial dimension. !
! !
! size_time unsigned int(64 bit) - Defines the geometry array size for the !
! temporal dimension. !
! !
! size_parameter unsigned int(64 bit) - Defines the geometry array size for the !
! parameters. !
! !
! size_dim1 unsigned int(64 bit) - Defines the geometry array size for the !
! first spatial dimension. !
! !
! size_dim2 unsigned int(64 bit) - Defines the geometry array size for the !
! second spatial dimension. !
! !
! size_dim3 unsigned int(64 bit) - Defines the geometry array size for the !
! third spatial dimension. !
! !
! udef_param unsigned int(64 bit) - Defines a marker used to signal which !
! user defined parameters are present in !
! the eas3 file. !
! !
! udef_char_size unsigned int(64 bit) - Defines the size for the user defined !
! char array. !
! !
! udef_int_size unsigned int(64 bit) - Defines the size for the user defined !
! int array. !
! !
! udef_real_size unsigned int(64 bit) - Defines the size for the user defined !
! real array. !
! !
! DEPENDENCIES: !
! ------------- !
! Variable Type Description !
! -------- ---- ----------- !
! - - - !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 20.06.2018 Patrick Vogler B87D120 V 0.1.0 struct created !
! !
\*----------------------------------------------------------------------------------------------------------*/
typedef struct
{
uint64_t file_type;
uint64_t accuracy;
uint64_t nzs;
uint64_t npar;
uint64_t ndim1;
uint64_t ndim2;
uint64_t ndim3;
uint64_t attribute_mode;
uint64_t gmode_time;
uint64_t gmode_param;
uint64_t gmode_dim1;
uint64_t gmode_dim2;
uint64_t gmode_dim3;
uint64_t size_time;
uint64_t size_parameter;
uint64_t size_dim1;
uint64_t size_dim2;
uint64_t size_dim3;
uint64_t udef_param;
uint64_t udef_char_size;
uint64_t udef_int_size;
uint64_t udef_real_size;
} eas3_std_params;
/************************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: bwc_data* read_eas3(const char* const filename) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function opens an eas3 file and checks it for its validity. Once the specified file !
! has been verified, its header and flow field data is read and stored in the bwc_data !
! structure. !
! !
\*----------------------------------------------------------------------------------------------------------*/
bwc_data*
read_eas3(char *const filename);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: uchar write_eas3(bwc_data *const file, char *const filename) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function creates a valid eas3 file from the information stored in the bwc_data !
! structure. !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
write_eas3(bwc_data *const file, char *const filename);
#endif

View File

@ -0,0 +1,224 @@
/*==================================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| 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. ||
|| ||
|| ||
|| 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: ||
|| ||
|| (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 BITSTREAM_H
#define BITSTREAM_H
/************************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
#include "types.h"
/************************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! 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);
#endif

View File

@ -0,0 +1,191 @@
/*==================================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| 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 ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| ||
|| 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 CODESTREAM_H
#define CODESTREAM_H
/************************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
#include "types.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. !
! !
! 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; \
}
#define forward_stream(stream, delta) \
{ \
stream->L += delta; \
}
#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);
#endif

View File

@ -0,0 +1,328 @@
/*==================================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| 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 ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| ||
|| 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 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. !
! !
! 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
} 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. !
! !
! 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
} bwc_prog_ord;
/*----------------------------------------------------------------------------------------------------------*\
! ENUM NAME: bwc_quant_st !
! ----------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! PARAMETERS: !
! ----------- !
! Constant Description !
! -------- ----------- !
! - - !
! !
! 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,
} bwc_quant_st;
/*----------------------------------------------------------------------------------------------------------*\
! ENUM NAME: bwc_tile_instr !
! ----------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! PARAMETERS: !
! ----------- !
! Constant Description !
! -------- ----------- !
! - - !
! !
! 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,
} bwc_tile_instr;
#endif

328
include/library/private/dwt.h Executable file
View File

@ -0,0 +1,328 @@
/*==================================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| 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 ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| ||
|| 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 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. !
! !
! 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
/*----------------------------------------------------------------------------------------------------------*\
! 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. !
! !
! 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_H2 -0.057543526228500f
#define DWT_9X7_H3 -0.091271763114250f
#define DWT_9X7_G0 1.205898036472721f
#define DWT_9X7_G1 -0.533728236885750f
#define DWT_9X7_G2 -0.156446533057980f
#define DWT_9X7_G3 0.033728236885750f
#define DWT_9X7_G4 0.053497514821620f
#define ALPHA -1.586134342059924f
#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. !
! !
! 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_G0 0.75f
#define DWT_5X3_G1 -0.25f
#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. !
! !
! 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_G0 0.5
#define DWT_HAAR_G1 -0.5
/************************************************************************************************************\
|| ____ _ _ ___ ____ ____ _ _ ____ _ _ _ ____ ____ _ ____ ___ _ ____ ____ ||
|| |___ \/ | |___ |__/ |\ | |__| | | | |__| |__/ | |__| |__] | |___ [__ ||
|| |___ _/\_ | |___ | \ | \| | | |___ \/ | | | \ | | | |__] |___ |___ ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! 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. !
! !
! 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];
/************************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! 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);
#endif

394
include/library/private/libbwc.h Executable file
View File

@ -0,0 +1,394 @@
/*==================================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| 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 ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| ||
|| 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 BWC_H
#define BWC_H
/************************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
#include "bitstream.h"
#include "codestream.h"
#include "constants.h"
#include "macros.h"
#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);
#endif

140
include/library/private/macros.h Executable file
View File

@ -0,0 +1,140 @@
/*==================================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| 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 ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| ||
|| 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 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. !
! !
! 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))
/*----------------------------------------------------------------------------------------------------------*\
! 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. !
! !
! 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"
#endif

155
include/library/private/mq.h Executable file
View File

@ -0,0 +1,155 @@
/*==================================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| 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: ||
|| ||
|| (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 MQ_H
#define MQ_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. !
! !
! 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
/************************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! 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);
#endif

View File

@ -0,0 +1,222 @@
/*==================================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| 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 ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| ||
|| 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 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. !
! !
! 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;
} 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. !
! !
! 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;
} 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). !
! !
! 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;
} bwc_bit_coder;
#endif

View File

@ -0,0 +1,163 @@
/*==================================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| 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 ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| ||
|| 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 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;
typedef int8_t int8;
typedef uint8_t uint8;
typedef int16_t int16;
typedef uint16_t uint16;
typedef int32_t int32;
typedef uint32_t uint32;
typedef int64_t int64;
typedef uint64_t uint64;
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. !
! !
! 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
/*----------------------------------------------------------------------------------------------------------*\
! 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. !
! !
! 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
/*----------------------------------------------------------------------------------------------------------*\
! 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. !
! !
! 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
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! !
! This constants describe the maximum number of 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

@ -0,0 +1,163 @@
/*==================================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| 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 ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| ||
|| 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 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;
typedef int8_t int8;
typedef uint8_t uint8;
typedef int16_t int16;
typedef uint16_t uint16;
typedef int32_t int32;
typedef uint32_t uint32;
typedef int64_t int64;
typedef uint64_t uint64;
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. !
! !
! 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
/*----------------------------------------------------------------------------------------------------------*\
! 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. !
! !
! 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
/*----------------------------------------------------------------------------------------------------------*\
! 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. !
! !
! 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
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! !
! This constants describe the maximum number of 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

161
include/library/private/tagtree.h Executable file
View File

@ -0,0 +1,161 @@
/*==================================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: tagtree.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| DESCRIPTION NEEDED. ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 18.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: ||
|| ||
|| (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 TAGTREE_H
#define TAGTREE_H
/************************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
#include "types.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);
#endif

153
include/library/private/tier1.h Executable file
View File

@ -0,0 +1,153 @@
/*==================================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| 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 ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| ||
|| 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 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. !
! !
! 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
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! !
! 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_G0 0.75f
#define DWT_5X3_G1 -0.25f
#define DWT_5X3_G2 -0.125f
/************************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! TYPE NAME: Template !
! ----------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
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);
#endif

133
include/library/private/tier2.h Executable file
View File

@ -0,0 +1,133 @@
/*==================================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| 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 ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| ||
|| 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 TIER2_H
#define TIER2_H
/************************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
#include "types.h"
/************************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! !
! This macro defines the initial 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,
bwc_packet *const packet,
uint64 const body_size);
#endif

1805
include/library/private/types.h Executable file

File diff suppressed because it is too large Load Diff

350
include/tools/bwccmdl.h Normal file
View File

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

331
public_header.py Normal file
View File

@ -0,0 +1,331 @@
#*====================================================================================================================*#
#| |#
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
#| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |#
#| /$$ \ $$ | $$ |#
#| | $$$$$$/ | $$ |#
#| \______/ |__/ |#
#| |#
#| 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 |#
#| |#
#| |#
#| ------------------------------------------------------------------------------------------------------ |#
#| |#
#| 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. |#
#| |#
#\====================================================================================================================/#
from argparse import ArgumentParser
from math import ceil, floor
from pathlib import Path
import os
import re
import sys
parser = ArgumentParser(description='Public Header Assembly Script')
parser.add_argument('-OMP', dest='OpenMP', action='store_const',
const=True, default=False,
help='OpenMP Parallelization')
parser.add_argument('-Single', dest='SinglePrecision', action='store_const',
const=True, default=False,
help='Compilation using Single Precision Encoder')
args = parser.parse_args()
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')
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"
public_header = open(destination.joinpath('bwc.h'), 'w+')
public_header.write("/*====================================================================================================================*\\\n"
"|| ||\n"
"|| /$$$$$$$ /$$ /$$ /$$ /$$ ||\n"
"|| | $$__ $$|__/ | $$ /$ | $$| $$ ||\n"
"|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||\n"
"|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||\n"
"|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||\n"
"|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||\n"
"|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||\n"
"|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||\n"
"|| /$$ \ $$ | $$ ||\n"
"|| | $$$$$$/ | $$ ||\n"
"|| \______/ |__/ ||\n"
"|| ||\n"
"|| ||\n"
"|| Version " +
Version[-1] + " ||\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"
"|| ||\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"
"|| ||\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"
"|| ||\n"
"\*====================================================================================================================*/\n"
"#ifndef BWC_H\n"
"#define BWC_H\n")
lspaces = ceil((116 - 31 - len(tab))/2)
rspaces = floor((116 - 31 - len(tab))/2)
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(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)
public_header.write(ubox + tab + "||" + lspaces * " " + "___ ____ _ _ _ _ ___ _ _ _ ____ ___ _ _ ___ ____ ____" + rspaces * " " + "||\n" +
tab + "||" + lspaces * " " + "|__] |__/ | |\/| | | | | | |___ | \_/ |__] |___ [__ " + rspaces * " " + "||\n" +
tab + "||" + lspaces * " " + "| | \ | | | | | | \/ |___ | | | |___ ___]" + rspaces * " " + "||\n" +
tab + "||" + (116 - len(tab)) * " " + "||\n" + lbox)
if(args.SinglePrecision == True):
file = "prim_types_single.h"
else:
file = "prim_types_double.h"
print_flag = 0
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
public_header.write(line)
f.close
lspaces = ceil((116 - 29 - len(tab))/2)
rspaces = floor((116 - 29 - len(tab))/2)
public_header.write(ubox + tab + "||" + lspaces * " " + "_ _ ____ ____ ____ ____ ____" + rspaces * " " + "||\n" +
tab + "||" + lspaces * " " + "|\/| |__| | |__/ | | [__ " + rspaces * " " + "||\n" +
tab + "||" + lspaces * " " + "| | | | |___ | \ |__| ___]" + rspaces * " " + "||\n" +
tab + "||" + (116 - len(tab)) * " " + "||\n" + lbox)
with open(source.joinpath('prim_types_double.h')) as f:
for line in f:
if("#define" in line):
if("PREC_BIT" in line):
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)
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 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
lspaces = ceil((116 - 64 - len(tab))/2)
rspaces = floor((116 - 64 - 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)
printFlg = False
delimFlg = False
preProcFlg = False
preProc = ""
buff = ""
brktCnt = 0
for file in ["mq_types.h", "types.h"]:
with open(source.joinpath(file)) as f:
for line in f:
if("typedef" in line):
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
if("{" in line):
brktCnt = brktCnt + 1
if("}" in line):
brktCnt = brktCnt - 1
if(brktCnt == 0):
break
line = next(f)
if("bwc_" in line):
if(printFlg == True):
buff = deliminator + buff
else:
printFlg = True
public_header.write(buff)
buff = ""
f.close
lspaces = ceil((116 - 70 - len(tab))/2)
rspaces = floor((116 - 70 - len(tab))/2)
public_header.write("\n" + ubox + tab + "||" + lspaces * " " + "___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____" + rspaces * " " + "||\n" +
tab + "||" + lspaces * " " + "|__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ " + rspaces * " " + "||\n" +
tab + "||" + lspaces * " " + "| |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___]" + rspaces * " " + "||\n" +
tab + "||" + (116 - len(tab)) * " " + "||\n" + lbox)
files = os.listdir("include/library/private")
printFlg = False
ltab = 0
tmp = ""
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)
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 = tmp[tmp.rfind(' '):-1]
else:
tmp = ""
if("bwc_" in tmp and "!" not in line):
if("/*" in buff or "*/" in buff):
buff = ""
else:
buff = buff[ltab:len(buff)]
if(print_flag == True):
buff = deliminator + buff
else:
print_flag = True
while True:
buff = buff + line[ltab:len(line)]
if(");" in line):
break
line = next(f)
public_header.write(buff)
buff = line
f.close
public_header.write("#endif")
public_header.close

View File

@ -0,0 +1,221 @@
#/=====================================================================================================================\#
#| |#
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
#! | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
#| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |#
#| /$$ \ $$ | $$ |#
#| | $$$$$$/ | $$ |#
#| \______/ |__/ |#
#| |#
#| 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 |#
#| |#
#| |#
#| ------------------------------------------------------------------------------------------------------ |#
#| |#
#| 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. |#
#| |#
#\=====================================================================================================================/#
#/=====================================================================================================================\#
#| _ _ _ ____ _ _ _ ___ ____ |#
#| | |\ | | | | | | \ |___ |#
#| | | \| |___ |___ |__| |__/ |___ |#
#| |#
#\=====================================================================================================================/#
import ctypes
from numpy.ctypeslib import ndpointer
from enum import Enum
libbwc = ctypes.cdll.LoadLibrary("../../../lib/libbwc.so")
#/=====================================================================================================================\#
#| ____ ____ _ _ ____ ___ ____ _ _ ___ ____ |#
#| | | | |\ | [__ | |__| |\ | | [__ |#
#| |___ |__| | \| ___] | | | | \| | ___] |#
#| |#
#\=====================================================================================================================/#
class _const():
class DWT(Enum):
CDF_9_7 = 0
LEGALL_5_3 = 1
HAAR = 2
class PROG(Enum):
LRCP = 0
class QT(object):
NONE = 0
DERIVED = 1
class TILE(Enum):
SIZEOF = 0
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
fun.argtypes = [ndpointer(ctypes.c_double, flags="C_CONTIGUOUS"),
ctypes.c_uint64,
ctypes.c_uint64,
ctypes.c_uint64,
ctypes.c_uint16,
ctypes.c_uint8,
ctypes.c_char_p]
return ctypes.c_void_p(fun(data, nX, nY, nZ, nTS, nPar, file_extension.encode('utf-8')))
#=======================================================================================================================#
def get_data(data, buffer, size):
fun = libbwc.bwc_get_data
fun.restype = None
fun.argtypes = [ctypes.c_void_p,
ndpointer(ctypes.c_double, flags="C_CONTIGUOUS"),
ctypes.c_uint64]
fun(data, buffer, size)
#=======================================================================================================================#
def add_param(data, name, sample, dim, precision):
fun = libbwc.bwc_add_param
fun.restype = None
fun.argtypes = [ctypes.c_void_p,
ctypes.c_char_p,
ctypes.c_uint16,
ctypes.c_uint8,
ctypes.c_uint8]
fun(data, name.encode('utf-8'), sample, dim, precision)
#=======================================================================================================================#
def kill_compression(field):
fun = libbwc.bwc_kill_compression
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(field, cbX, cbY, cbZ, cbTS)
#=======================================================================================================================#
def set_decomp(field, decompX, decompY, decompZ, decompTS):
fun = libbwc.bwc_set_decomp
fun.restype = None
fun.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint8, ctypes.c_uint8, ctypes.c_uint8]
fun(field, decompX, decompY, decompZ, decompTS)
#=======================================================================================================================#
def set_qm(field, Qm):
fun = libbwc.bwc_set_qm
fun.restype = None
fun.argtypes = [ctypes.c_void_p, ctypes.c_int8]
fun(field, Qm)
#=======================================================================================================================#
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(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(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(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(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]
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(field, data)

1127
src/interfaces/reader/eas3.c Normal file

File diff suppressed because it is too large Load Diff

126
src/library/CMakeLists.txt Executable file
View File

@ -0,0 +1,126 @@
#*====================================================================================================================*#
#| |#
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
#| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |#
#| /$$ \ $$ | $$ |#
#| | $$$$$$/ | $$ |#
#| \______/ |__/ |#
#| 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: |#
#| |#
#| (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. |#
#| |#
#*====================================================================================================================*#
#*--------------------------------------------------------*#
# Assemble the public header for the BigWhoop library #
#*--------------------------------------------------------*#
set(PYTHON_ARGUMENT "")
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
if(OPENMP_FOUND)
set(PYTHON_ARGUMENT ${PYTHON_ARGUMENT} -OMP)
endif()
endif()
if("${PREC}" STREQUAL "Single")
set(PYTHON_ARGUMENT ${PYTHON_ARGUMENT} -Single)
endif()
execute_process(COMMAND python3 public_header.py ${PYTHON_ARGUMENT}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
#*--------------------------------------------------------*#
# 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()
set(BWC_LINK "SHARED")
endif()
add_library(bwclib ${BWC_LINK} bitstream.c
libbwc.c
codestream.c
dwt.c
mq.c
tier1.c
tier2.c
tagtree.c)
#*--------------------------------------------------------*#
# 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 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)
#*--------------------------------------------------------*#
# 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})
#*--------------------------------------------------------*#
# Define the output name for the BigWhoop library. #
#*--------------------------------------------------------*#
set_property(TARGET bwclib PROPERTY OUTPUT_NAME bwc)

1021
src/library/bitstream.c Executable file

File diff suppressed because it is too large Load Diff

1824
src/library/codestream.c Executable file

File diff suppressed because it is too large Load Diff

2681
src/library/dwt.c Executable file

File diff suppressed because it is too large Load Diff

4600
src/library/libbwc.c Executable file

File diff suppressed because it is too large Load Diff

1196
src/library/mq.c Executable file

File diff suppressed because it is too large Load Diff

594
src/library/tagtree.c Executable file
View File

@ -0,0 +1,594 @@
/*==================================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| FILE NAME: tagtree.c ||
|| ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| DESCRIPTION NEEDED. ||
|| ||
|| FILE REFERENCES: ||
|| ---------------- ||
|| ||
|| Name I/O Description ||
|| ---- --- ----------- ||
|| none - - ||
|| ||
|| ||
|| 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: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|| the following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|| distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| ||
\*==================================================================================================================================*/
/************************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include "bitstream.h"
#include "macros.h"
#include "types.h"
#include "tagtree.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. !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! tagtree bwc_tagtree* - Structure defining a tagtree instance. !
! !
! RETURN VALUE: !
! ------------- !
! Type Description !
! ---- ----------- !
! - - !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 14.06.2018 Patrick Vogler B87D120 V 0.1.0 function created !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
kill_tagtree(bwc_tagtree* tagtree)
{
/*-----------------------*\
! DEFINE ASSERTIONS: !
\*-----------------------*/
assert(tagtree);
free(tagtree->nodes);
free(tagtree);
return;
}
/*----------------------------------------------------------------------------------------------------------*\
! 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 !
! ---- ------ --------- ------- --------------------- !
! 14.06.2018 Patrick Vogler B87D120 V 0.1.0 function created !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
reset_tagtree(bwc_tagtree* const tagtree)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
\*-----------------------*/
uint64 i = 0;
/*-----------------------*\
! DEFINE ASSERTIONS: !
\*-----------------------*/
assert(tagtree);
do
{
tagtree->nodes[i].value = 0xFFFF;
tagtree->nodes[i].threshold = 0;
}while(tagtree->nodes[i++].parent);
}
/*----------------------------------------------------------------------------------------------------------*\
! 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 !
! ---- ------ --------- ------- --------------------- !
! 14.06.2018 Patrick Vogler B87D120 V 0.1.0 function created !
! !
\*----------------------------------------------------------------------------------------------------------*/
uint16
tagtree_get_value(const bwc_tagtree* const tagtree, const uint64 leaf_index)
{
/*-----------------------*\
! DEFINE ASSERTIONS: !
\*-----------------------*/
assert(tagtree);
assert(leaf_index < tagtree->leavesX * tagtree->leavesY * tagtree->leavesZ * tagtree->leavesTS);
assert(tagtree->nodes[leaf_index].value != 0xFFFF);
return tagtree->nodes[leaf_index].value;
}
/*----------------------------------------------------------------------------------------------------------*\
! 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 !
! ---- ------ --------- ------- --------------------- !
! 14.06.2018 Patrick Vogler B87D120 V 0.1.0 function created !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
tagtree_set_value(bwc_tagtree* const tagtree, const uint64 leaf_index, const uint16 value)
{
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/
bwc_tagtree_node *node;
/*-----------------------*\
! DEFINE ASSERTIONS: !
\*-----------------------*/
assert(tagtree);
assert(leaf_index < tagtree->leavesX * tagtree->leavesY * tagtree->leavesZ * tagtree->leavesTS);
assert(tagtree->nodes[leaf_index].value == 0xFFFF);
assert(value < 0xFFFF);
node = &tagtree->nodes[leaf_index];
do
{
node->value = value;
node = node->parent;
}while(node && (node->value > value));
}
/*----------------------------------------------------------------------------------------------------------*\
! 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 !
! ---- ------ --------- ------- --------------------- !
! 14.06.2018 Patrick Vogler B87D120 V 0.1.0 function created !
! !
\*----------------------------------------------------------------------------------------------------------*/
bwc_tagtree*
initialize_tagtree(const uint64 leafsX, const uint64 leafsY, const uint64 leafsZ, const uint64 leafsTS)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
\*-----------------------*/
uint64 levels, number_of_nodes;
uint32 nlX[32] = {0}, nlY[32] = {0}, nlZ[32] = {0}, nlTS[32] = {0};
uint32 i, j, k, l, n;
uint16 a,b,c,d;
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/
bwc_tagtree_node *node, *parent_x, *parent_y, *parent_z, *parent_ts;
bwc_tagtree *tagtree;
for(nlX[0] = leafsX, nlY[0] = leafsY,
nlZ[0] = leafsZ, nlTS[0] = leafsTS,
levels = 0, number_of_nodes = 1;
nlX[levels] * nlY[levels] *
nlZ[levels] * nlTS[levels] > 1;
++levels)
{
number_of_nodes += nlX[levels] * nlY[levels] * nlZ[levels] * nlTS[levels];
nlX[levels + 1] = (nlX[levels] + 1) >> 1;
nlY[levels + 1] = (nlY[levels] + 1) >> 1;
nlZ[levels + 1] = (nlZ[levels] + 1) >> 1;
nlTS[levels + 1] = (nlTS[levels] + 1) >> 1;
}
tagtree = calloc(1, sizeof(bwc_tagtree));
if (!tagtree)
{
// memory allocation error
fprintf(stderr, MEMERROR);
return 0;
}
tagtree->nodes = calloc(number_of_nodes, sizeof(bwc_tagtree_node));
if (!tagtree->nodes)
{
// memory allocation error
fprintf(stderr, MEMERROR);
free(tagtree);
return 0;
}
node = tagtree->nodes;
for(i = 0; i < number_of_nodes; ++i)
{
node->index = i;
++node;
}
tagtree->leavesX = leafsX;
tagtree->leavesY = leafsY;
tagtree->leavesZ = leafsZ;
tagtree->leavesTS = leafsTS;
parent_ts = tagtree->nodes;
node = tagtree->nodes;
for(n = 0; n < levels; ++n)
{
parent_ts += (uint32)(nlX[n] * nlY[n] * nlZ[n] * nlTS[n]);
for(l = 0, d = 0; l < nlTS[n]; ++l, ++d)
{
if(d >> 1)
{
parent_ts += nlX[n+1] * nlY[n+1] * nlZ[n+1];
d = 0;
}
for(k = 0, c = 0, parent_z = parent_ts; k < nlZ[n]; ++k, ++c)
{
if(c >> 1)
{
parent_z += nlX[n+1] * nlY[n+1];
c = 0;
}
for(j = 0, b = 0, parent_y = parent_z; j < nlY[n]; ++j, ++b)
{
if(b >> 1)
{
parent_y += nlY[n + 1];
b = 0;
}
for(i = 0, a = 0, parent_x = parent_y; i < nlX[n]; ++i, ++a)
{
if(a >> 1)
{
parent_x++;
a = 0;
}
node->parent = parent_x;
node++;
}
}
}
}
}
reset_tagtree(tagtree);
return tagtree;
}
/*----------------------------------------------------------------------------------------------------------*\
! 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 !
! ---- ------ --------- ------- --------------------- !
! 14.06.2018 Patrick Vogler B87D120 V 0.1.0 function created !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
encode_tagtree(bwc_tagtree *const tagtree, bwc_stream *const stream, const uint32 threshold, const uint32 leaf_index, const uchar estimate)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
\*-----------------------*/
uint32 threshold_tmp, threshold_min;
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/
bwc_tagtree_node *node;
bwc_tagtree_node **branch_ptr, *branch[32];
/*-----------------------*\
! DEFINE ASSERTIONS: !
\*-----------------------*/
assert(tagtree);
assert(stream);
assert(leaf_index < (tagtree->leavesX * tagtree->leavesY * tagtree->leavesZ * tagtree->leavesTS));
node = &tagtree->nodes[leaf_index];
branch_ptr = branch;
while(node->parent)
{
*branch_ptr++ = node;
node = node->parent;
}
for(threshold_min = 0; ; node = *--branch_ptr)
{
threshold_tmp = node->threshold;
if(threshold_tmp < threshold_min)
{
threshold_tmp = threshold_min;
}
while((node->value >= threshold_tmp) && (threshold_tmp < threshold)) //this conditional jump needs to be checked
{
threshold_tmp++;
if(node->value >= threshold_tmp)
{
bwc_emit_bit(stream, 0);
}
else
{
bwc_emit_bit(stream, 1);
}
}
threshold_min = MIN(node->value, threshold_tmp);
if(!estimate)
{
node->threshold = threshold_tmp;
}
if(node == &tagtree->nodes[leaf_index])
{
break;
}
}
}
/*----------------------------------------------------------------------------------------------------------*\
! 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 !
! ---- ------ --------- ------- --------------------- !
! 14.06.2018 Patrick Vogler B87D120 V 0.1.0 function created !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
decode_tagtree(bwc_tagtree *const tagtree, bwc_stream *const stream, const uint32 threshold, const uint32 leaf_index)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
\*-----------------------*/
uint32 threshold_min;
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/
bwc_tagtree_node *node;
bwc_tagtree_node **branch_ptr, *branch[32];
/*-----------------------*\
! DEFINE ASSERTIONS: !
\*-----------------------*/
assert(tagtree);
assert(stream);
assert(leaf_index < (tagtree->leavesX * tagtree->leavesY * tagtree->leavesZ * tagtree->leavesTS));
node = &tagtree->nodes[leaf_index];
branch_ptr = branch;
while(node)
{
if(node->value == 0xFFFF)
{
node->value = 0;
}
*branch_ptr++ = node;
node = node->parent;
}
for(*branch_ptr--, node = *branch_ptr--, threshold_min = 0; ; node = *branch_ptr--)
{
if(node->threshold < threshold_min)
{
node->value = threshold_min;
node->threshold = threshold_min;
}
while((node->value == node->threshold) && (node->threshold < threshold))
{
node->threshold++;
if(!bwc_get_bit(stream))
{
node->value++;
}
}
threshold_min = MIN(node->value, node->threshold);
if(node == &tagtree->nodes[leaf_index])
{
break;
}
}
return (node->value < threshold) ? 0 : 1;
}

3381
src/library/tier1.c Executable file

File diff suppressed because it is too large Load Diff

1704
src/library/tier2.c Executable file

File diff suppressed because it is too large Load Diff

93
src/tools/CMakeLists.txt Executable file
View File

@ -0,0 +1,93 @@
#*====================================================================================================================*#
#| |#
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
#| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |#
#| /$$ \ $$ | $$ |#
#| | $$$$$$/ | $$ |#
#| \______/ |__/ |#
#| 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: |#
#| |#
#| (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. |#
#| |#
#*====================================================================================================================*#
#*--------------------------------------------------------*#
# 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)
endif()
if(${BUILD_NETCDF})
target_compile_definitions(bwccmd PRIVATE -DBWC_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)

3243
src/tools/bwccmdl.c Executable file

File diff suppressed because it is too large Load Diff

154
src/tools/get_hash.c Executable file
View File

@ -0,0 +1,154 @@
/*==================================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| FILE NAME: get_hash.c ||
|| ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| This is a simple command line tool that converts the command-line arguments to a uniquely identifiable ||
|| hash. ||
|| ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| - main ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 02.05.2019 Patrick Vogler B87D120 V 0.1.0 module created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|| following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|| the following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|| distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| ||
\*==================================================================================================================================*/
/************************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
#include <assert.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: int main(int argc, char* argv[]) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! !
! This function uses a variant of the DJB hash function to turn the command-line argument !
! strings and converts them to a uniquely identifiable hash. The hashes are written to the !
! command-line in a hexadecimal format. !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! argc int - Number of strings pointed to by argv. !
! !
! argv char** - Array of arguments. !
! !
! RETURN VALUE: !
! ------------- !
! Type Description !
! ---- ----------- !
! int - Return value signaling a normal or abnormal process exit. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 02.05.2019 Patrick Vogler B87D120 V 0.1.0 function created !
! !
\*----------------------------------------------------------------------------------------------------------*/
int main(int argc, char* argv[])
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
\*-----------------------*/
uint64_t hash;
uint8_t c, i;
/*-----------------------*\
! DEFINE CHAR VARIABLES: !
\*-----------------------*/
char* str;
/*--------------------------------------------------------*\
! Loop through all additional command-line arguments. !
\*--------------------------------------------------------*/
for(i = 1, str = argv[1]; i < argc; ++i, str = argv[i])
{
/*--------------------------------------------------------*\
! Initialize the hash with a magic number. !
\*--------------------------------------------------------*/
hash = 0x1505;
/*--------------------------------------------------------*\
! Walk through all the characters in the string. !
\*--------------------------------------------------------*/
while ((c = *str++))
{
/*--------------------------------------------------------*\
! Convert the current characters to uppercase. !
\*--------------------------------------------------------*/
if((c >= 97) && (c <= 122))
{
c = c - 32;
}
/*--------------------------------------------------------*\
! Multiply the hash with 33 and add the current character !
! to the hash. !
\*--------------------------------------------------------*/
hash = (hash * 33) ^ c;
}
/*--------------------------------------------------------*\
! Write the hash to the command-line. !
\*--------------------------------------------------------*/
printf("%#020lX \n", hash);
}
return 0;
}