Compare commits

...

2 commits

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

View file

@ -1,4 +1,4 @@
#*====================================================================================================================*#
#*================================================================================================*#
#| |#
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
@ -11,96 +11,87 @@
#| /$$ \ $$ | $$ |#
#| | $$$$$$/ | $$ |#
#| \______/ |__/ |#
#| |#
#| DESCRIPTION: |#
#| ------------ |#
#| |#
#| Defines the global cmake script for the Big Whoop compression algorithm. |#
#| |#
#| |#
#| DEVELOPMENT HISTORY: |#
#| -------------------- |#
#| |#
#| Date Author Change Id Release Description Of Change |#
#| ---- ------ --------- ------- --------------------- |#
#| 30.08.2018 Patrick Vogler B87D120 V 0.1.0 Cmake file created |#
#| |#
#| |#
#| ------------------------------------------------------------------------------------------------------ |#
#| |#
#| -------------------------------------------------------------------------------------------- |#
#| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart |#
#| |#
#| Redistribution and use in source and binary forms, with or without modification, are permitted |#
#| provided that the following conditions are met: |#
#| Redistribution and use in source and binary forms, with or without modification, are |#
#| permitted provided that the following conditions are met: |#
#| |#
#| (1) Redistributions of source code must retain the above copyright notice, this list of |#
#| conditions and the following disclaimer. |#
#| |#
#| (2) Redistributions in binary form must reproduce the above copyright notice, this list |#
#| of conditions and the following disclaimer in the documentation and/or other materials |#
#| provided with the distribution. |#
#| of conditions and the following disclaimer in the documentation and/or other |#
#| materials provided with the distribution. |#
#| |#
#| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED |#
#| WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |#
#| PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR |#
#| ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |#
#| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |#
#| INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |#
#| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |#
#| ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |#
#| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS |#
#| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |#
#| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |#
#| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |#
#| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |#
#| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |#
#| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |#
#| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |#
#| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |#
#| |#
#*====================================================================================================================*#
#*--------------------------------------------------------*#
#*================================================================================================*#
#----------------------------------------------------------#
# Check if the version requirement for cmake is met. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
cmake_minimum_required(VERSION 3.5.1)
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# Set the project name and description. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
project(BWC LANGUAGES C)
set(PROJECT_DESCRIPTION "Compression algorithm for IEEE 754 datasets")
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# Check that the current build is not a in-source build. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
message(FATAL_ERROR "In-source builds are prohibited. Please create a separate build directory")
endif()
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# Save the bwc.c file in a temporary variable and match #
# the current version number with a regular expression. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/src/library/libbwc.c _bwc_c_contents)
string(REGEX MATCH "Version[ \t]+([0-9]+).([0-9]+).([0-9]+)" _ ${ver} ${_bwc_c_contents})
string(REGEX MATCH "V[ \t]+([0-9]+).([0-9]+).([0-9]+)" _ ${ver} ${_bwc_c_contents})
set(BWC_VERSION_MAJOR ${CMAKE_MATCH_1})
set(BWC_VERSION_MINOR ${CMAKE_MATCH_2})
set(BWC_VERSION_PATCH ${CMAKE_MATCH_3})
set(BWC_VERSION "${BWC_VERSION_MAJOR}.${BWC_VERSION_MINOR}.${BWC_VERSION_PATCH}")
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# Setup a user-specified option used to control the sample #
# precision during compression. The standard option is #
# set to double precision. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
set(PREC "Double" CACHE STRING "User-specified option used to control\
the precision during compression")
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# Inlude the GNU standard installation directories module #
# to set up the output directories. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
include(GNUInstallDirs)
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# Set up the output directories for the Big Whoop library #
# and utility binaries. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
list(INSERT CMAKE_MODULE_PATH 0 "${BWC_SOURCE_DIR}/cmake")
if(${TOOL})
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
if("${TOOL}" STREQUAL "True" AND 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()
@ -108,18 +99,18 @@ 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)
@ -127,10 +118,10 @@ 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)
@ -140,22 +131,22 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
endif()
endif()
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# Add all necessary compiler warnings for debugging. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-comment -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-comment -Wextra")
endif()
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# Include the CMake dependent option macro. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
include(CMakeDependentOption)
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# Set the -fPIC compile option for static libraries. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
get_property(SHARED_LIBS_SUPPORTED GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS)
cmake_dependent_option(BUILD_SHARED_LIBS
"Whether or not to build shared libraries" ON
@ -171,14 +162,14 @@ 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})
#----------------------------------------------------------#
if("${TOOL}" STREQUAL "True")
add_subdirectory(src/tools)
endif()

4
Makefile Executable file → Normal file
View file

@ -148,10 +148,10 @@ tool:
# Define targets used to activate file format support. #
#*--------------------------------------------------------*#
eas3:
$(eval BUILD_EAS3="True")
$(eval BUILD_EAS3="TRUE")
netCDF:
$(eval BUILD_NETCDF="True")
$(eval BUILD_NETCDF="TRUE")
#*--------------------------------------------------------*#
# Define the wrappers for the compile command targets. #

View file

@ -1,6 +1,6 @@
<p align="center">
<a href="https://code.hlrs.de/hpcpvogl/BigWhoop">
<img alt="BigWhoop" src="https://code.hlrs.de/hpcpvogl/BigWhoop/raw/branch/main/docs/img/Logo.png"/>
<img alt="BigWhoop" src="https://code.hlrs.de/hpcpvogl/BigWhoop/raw/branch/main/docs/img/Logo.svg"/>
</a>
</p>
<h1 align="center">Compression library for numerical datasets</h1>

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

@ -0,0 +1,158 @@
!*================================================================================================*!
!| |!
!| /$$$$$$$ /$$ /$$ /$$ /$$ |!
!| | $$__ $$|__/ | $$ /$ | $$| $$ |!
!| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |!
!| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |!
!| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |!
!| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |!
!| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |!
!| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |!
!| /$$ \ $$ | $$ |!
!| | $$$$$$/ | $$ |!
!| \______/ |__/ |!
!| |!
!| DESCRIPTION: |!
!| ------------ |!
!| |!
!| DESCRIPTION NEEDED. |!
!| | | |!
!| |!
!| -------------------------------------------------------------------------------------------- |!
!| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart |!
!| |!
!| Redistribution and use in source and binary forms, with or without modification, are |!
!| permitted provided that the following conditions are met: |!
!| |!
!| (1) Redistributions of source code must retain the above copyright notice, this list of |!
!| conditions and the following disclaimer. |!
!| |!
!| (2) Redistributions in binary form must reproduce the above copyright notice, this list |!
!| of conditions and the following disclaimer in the documentation and/or other |!
!| materials provided with the distribution. |!
!| |!
!| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS |!
!| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |!
!| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |!
!| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |!
!| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |!
!| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |!
!| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |!
!| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |!
!| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |!
!| |!
!*================================================================================================*!
module MODULE_FILE
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
!*-----------------------*!
! DEFINE FLOAT VARIABLES: !
!*-----------------------*!
!*-----------------------*!
! DEFINE CHAR VARIABLES: !
!*-----------------------*!
!*-----------------------*!
! DEFINE STRUCTS: !
!*-----------------------*!
!*--------------------------------------------------------*!
! COMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENT !
!*--------------------------------------------------------*!
!************************************************************************************************!
!| _ _ _ ____ _ _ _ ___ ____ |!
!| | |\ | | | | | | \ |___ |!
!| | | \| |___ |___ |__| |__/ |___ |!
!| |!
!************************************************************************************************!
!************************************************************************************************!
!| ___ ____ _ _ _ _ ___ _ _ _ ____ ___ _ _ ___ ____ ____ |!
!| |__] |__/ | |\/| | | | | | |___ | \_/ |__] |___ [__ |!
!| | | \ | | | | | | \/ |___ | | | |___ ___] |!
!| |!
!************************************************************************************************!
!************************************************************************************************!
!| _ _ ____ ____ ____ ____ ____ |!
!| |\/| |__| | |__/ | | [__ |!
!| | | | | |___ | \ |__| ___] |!
!| |!
!************************************************************************************************!
!************************************************************************************************!
!| ____ ____ _ _ ____ ___ ____ _ _ ___ ____ |!
!| | | | |\ | [__ | |__| |\ | | [__ |!
!| |___ |__| | \| ___] | | | | \| | ___] |!
!| |!
!************************************************************************************************!
!************************************************************************************************!
!| ____ _ _ ___ ____ ____ _ _ ____ _ _ _ ____ ____ _ ____ ___ _ ____ ____ |!
!| |___ \/ | |___ |__/ |\ | |__| | | | |__| |__/ | |__| |__] | |___ [__ |!
!| |___ _/\_ | |___ | \ | \| | | |___ \/ | | | \ | | | |__] |___ |___ ___] |!
!| |!
!************************************************************************************************!
!************************************************************************************************!
!| ____ _ _ ___ ____ ____ _ _ ____ _ ____ ____ _ _ ____ ___ ____ _ _ ___ ____ |!
!| |___ \/ | |___ |__/ |\ | |__| | | | | |\ | [__ | |__| |\ | | [__ |!
!| |___ _/\_ | |___ | \ | \| | | |___ |___ |__| | \| ___] | | | | \| | ___] |!
!| |!
!************************************************************************************************!
!************************************************************************************************!
!| ____ _ ____ ___ ____ _ ____ ____ _ _ ____ ___ ____ _ _ ___ ____ |!
!| | __ | | | |__] |__| | | | | |\ | [__ | |__| |\ | | [__ |!
!| |__] |___ |__| |__] | | |___ |___ |__| | \| ___] | | | | \| | ___] |!
!| |!
!************************************************************************************************!
!************************************************************************************************!
!| ___ _ _ ___ ____ ____ |!
!| | \_/ |__] |___ [__ |!
!| | | | |___ ___] |!
!| |!
!************************************************************************************************!
!************************************************************************************************!
!| ___ ____ ____ ____ _ _ _ ____ ___ ___ _ _ ___ ____ ____ |!
!| | \ |___ |__/ |__/ | | | |___ | \ | \_/ |__] |___ [__ |!
!| |__/ |___ | \ | \ | \/ |___ |__/ | | | |___ ___] |!
!| |!
!************************************************************************************************!
!------------------------------------------------------------------------------------------------!
! !
! DESCRIPTION: !
! ------------ !
! !
! DESCRIPTION NEEDED !
! | | !
! !
!------------------------------------------------------------------------------------------------!
!============================|=========================|==========================================
!************************************************************************************************!
!| ___ ____ _ _ _ ____ ___ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ |!
!| |__] |__/ | | | |__| | |___ |___ | | |\ | | | | | | |\ | [__ |!
!| | | \ | \/ | | | |___ | |__| | \| |___ | | |__| | \| ___] |!
!| |!
!************************************************************************************************!
!************************************************************************************************!
!| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ |!
!| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ |!
!| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] |!
!| |!
!************************************************************************************************!
!------------------------------------------------------------------------------------------------!
! !
! DESCRIPTION: !
! ------------ !
! !
! DESCRIPTION NEEDED !
! | | !
! !
! ARGUMENTS: !
! ---------- !
! Name Description !
! ---- ----------- !
! - - !
! !
! RETURN: !
! ------- !
! - !
! !
!------------------------------------------------------------------------------------------------!
!===========|==========================|======================|======|=======|====================
!=================================================================================================
end module MODULE_FILE

183
docs/templates/Template.c vendored Executable file
View file

@ -0,0 +1,183 @@
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| ||
|| DESCRIPTION NEEDED. ||
|| | | ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are ||
|| permitted provided that the following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of ||
|| conditions and the following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other ||
|| materials provided with the distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS ||
|| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ||
|| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ||
|| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ||
|| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ||
|| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ||
|| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR ||
|| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ||
|| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| ||
\*================================================================================================*/
/**************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\**************************************************************************************************/
/**************************************************************************************************\
|| ____ _ _ ___ ____ ____ _ _ ____ _ _ _ ____ ____ _ ____ ___ _ ____ ____ ||
|| |___ \/ | |___ |__/ |\ | |__| | | | |__| |__/ | |__| |__] | |___ [__ ||
|| |___ _/\_ | |___ | \ | \| | | |___ \/ | | | \ | | | |__] |___ |___ ___] ||
|| ||
\**************************************************************************************************/
/**************************************************************************************************\
|| ____ _ _ ___ ____ ____ _ _ ____ _ ____ ____ _ _ ____ ___ ____ _ _ ___ ____ ||
|| |___ \/ | |___ |__/ |\ | |__| | | | | |\ | [__ | |__| |\ | | [__ ||
|| |___ _/\_ | |___ | \ | \| | | |___ |___ |__| | \| ___] | | | | \| | ___] ||
|| ||
\**************************************************************************************************/
/**************************************************************************************************\
|| ____ _ ____ ___ ____ _ ____ ____ _ _ ____ ___ ____ _ _ ___ ____ ||
|| | __ | | | |__] |__| | | | | |\ | [__ | |__| |\ | | [__ ||
|| |__] |___ |__| |__] | | |___ |___ |__| | \| ___] | | | | \| | ___] ||
|| ||
\**************************************************************************************************/
/**************************************************************************************************\
|| ___ ____ _ _ _ ____ ___ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] |__/ | | | |__| | |___ |___ | | |\ | | | | | | |\ | [__ ||
|| | | \ | \/ | | | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\**************************************************************************************************/
/**************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\**************************************************************************************************/
/*------------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! DESCRIPTION NEEDED !
! | | !
! !
! ARGUMENTS: !
! ---------- !
! Name Description !
! ---- ----------- !
! - - !
! !
! RETURN: !
! ------- !
! - !
! !
\*------------------------------------------------------------------------------------------------*/
/*-----------------------*\
! DEFINE INT VARIABLES: !
\*-----------------------*/
/*-----------------------*\
! DEFINE FLOAT VARIABLES: !
\*-----------------------*/
/*-----------------------*\
! DEFINE CHAR VARIABLES: !
\*-----------------------*/
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/
/*--------------------------------------------------------*\
! COMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENT !
\*--------------------------------------------------------*/
#ifndef HEADER_H
#define HEADER_H
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************/
/************************************************************************************************\
|| ___ ____ _ _ _ _ ___ _ _ _ ____ ___ _ _ ___ ____ ____ ||
|| |__] |__/ | |\/| | | | | | |___ | \_/ |__] |___ [__ ||
|| | | \ | | | | | | \/ |___ | | | |___ ___] ||
|| ||
\************************************************************************************************/
/************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************/
/************************************************************************************************\
|| ____ ____ _ _ ____ ___ ____ _ _ ___ ____ ||
|| | | | |\ | [__ | |__| |\ | | [__ ||
|| |___ |__| | \| ___] | | | | \| | ___] ||
|| ||
\************************************************************************************************/
/************************************************************************************************\
|| ____ _ _ ___ ____ ____ _ _ ____ _ _ _ ____ ____ _ ____ ___ _ ____ ____ ||
|| |___ \/ | |___ |__/ |\ | |__| | | | |__| |__/ | |__| |__] | |___ [__ ||
|| |___ _/\_ | |___ | \ | \| | | |___ \/ | | | \ | | | |__] |___ |___ ___] ||
|| ||
\************************************************************************************************/
/************************************************************************************************\
|| ____ _ _ ___ ____ ____ _ _ ____ _ ____ ____ _ _ ____ ___ ____ _ _ ___ ____ ||
|| |___ \/ | |___ |__/ |\ | |__| | | | | |\ | [__ | |__| |\ | | [__ ||
|| |___ _/\_ | |___ | \ | \| | | |___ |___ |__| | \| ___] | | | | \| | ___] ||
|| ||
\************************************************************************************************/
/************************************************************************************************\
|| ___ _ _ ___ ____ ____ ||
|| | \_/ |__] |___ [__ ||
|| | | | |___ ___] ||
|| ||
\************************************************************************************************/
/************************************************************************************************\
|| ___ ____ ____ ____ _ _ _ ____ ___ ___ _ _ ___ ____ ____ ||
|| | \ |___ |__/ |__/ | | | |___ | \ | \_/ |__] |___ [__ ||
|| |__/ |___ | \ | \ | \/ |___ |__/ | | | |___ ___] ||
|| ||
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! DESCRIPTION NEEDED !
! | | !
! !
\*----------------------------------------------------------------------------------------------*/
//===========================|=========================|==========================================
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************/
//==========|==========================|======================|======|=======|====================
//================================================================================================
#endif

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

@ -0,0 +1,121 @@
#*================================================================================================*#
#| |#
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
#| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |#
#| /$$ \ $$ | $$ |#
#| | $$$$$$/ | $$ |#
#| \______/ |__/ |#
#| |#
#| DESCRIPTION: |#
#| ------------ |#
#| |#
#| DESCRIPTION NEEDED. |#
#| | | |#
#| |#
#| -------------------------------------------------------------------------------------------- |#
#| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart |#
#| |#
#| Redistribution and use in source and binary forms, with or without modification, are |#
#| permitted provided that the following conditions are met: |#
#| |#
#| (1) Redistributions of source code must retain the above copyright notice, this list of |#
#| conditions and the following disclaimer. |#
#| |#
#| (2) Redistributions in binary form must reproduce the above copyright notice, this list |#
#| of conditions and the following disclaimer in the documentation and/or other |#
#| materials provided with the distribution. |#
#| |#
#| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS |#
#| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |#
#| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |#
#| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |#
#| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |#
#| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |#
#| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |#
#| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |#
#| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |#
#| |#
#*================================================================================================*#
#**************************************************************************************************#
#| _ _ _ ___ ____ ____ ___ |#
#| | |\/| |__] | | |__/ | |#
#| | | | | |__| | \ | |#
#| |#
#**************************************************************************************************#
#**************************************************************************************************#
#| ____ ____ _ _ ____ ___ ____ _ _ ___ ____ |#
#| | | | |\ | [__ | |__| |\ | | [__ |#
#| |___ |__| | \| ___] | | | | \| | ___] |#
#| |#
#**************************************************************************************************#
#**************************************************************************************************#
#| ____ _ _ ___ ____ ____ _ _ ____ _ _ _ ____ ____ _ ____ ___ _ ____ ____ |#
#| |___ \/ | |___ |__/ |\ | |__| | | | |__| |__/ | |__| |__] | |___ [__ |#
#| |___ _/\_ | |___ | \ | \| | | |___ \/ | | | \ | | | |__] |___ |___ ___] |#
#| |#
#**************************************************************************************************#
#**************************************************************************************************#
#| ____ _ _ ___ ____ ____ _ _ ____ _ ____ ____ _ _ ____ ___ ____ _ _ ___ ____ |#
#| |___ \/ | |___ |__/ |\ | |__| | | | | |\ | [__ | |__| |\ | | [__ |#
#| |___ _/\_ | |___ | \ | \| | | |___ |___ |__| | \| ___] | | | | \| | ___] |#
#| |#
#**************************************************************************************************#
#**************************************************************************************************#
#| ____ _ ____ ___ ____ _ ____ ____ _ _ ____ ___ ____ _ _ ___ ____ |#
#| | __ | | | |__] |__| | | | | |\ | [__ | |__| |\ | | [__ |#
#| |__] |___ |__| |__] | | |___ |___ |__| | \| ___] | | | | \| | ___] |#
#| |#
#**************************************************************************************************#
#**************************************************************************************************#
#| ___ ____ _ _ _ ____ ___ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ |#
#| |__] |__/ | | | |__| | |___ |___ | | |\ | | | | | | |\ | [__ |#
#| | | \ | \/ | | | |___ | |__| | \| |___ | | |__| | \| ___] |#
#| |#
#**************************************************************************************************#
#**************************************************************************************************#
#| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ |#
#| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ |#
#| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] |#
#| |#
#**************************************************************************************************#
#==================================================================================================#
#--------------------------------------------------------------------------------------------------#
# #
# DESCRIPTION: #
# ------------ #
# #
# DESCRIPTION NEEDED #
# | | #
# #
# ARGUMENTS: #
# ---------- #
# Name Description #
# ---- ----------- #
# - - #
# #
# RETURN: #
# ------- #
# - #
# #
#--------------------------------------------------------------------------------------------------#
#-------------------------#
# DEFINE INT VARIABLES: #
#-------------------------#
#-------------------------#
# DEFINE FLOAT VARIABLES: #
#-------------------------#
#-------------------------#
# DEFINE CHAR VARIABLES: #
#-------------------------#
#-------------------------#
# DEFINE STRUCTS: #
#-------------------------#
#----------------------------------------------------------#
# COMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENT #
#----------------------------------------------------------#

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

@ -0,0 +1,47 @@
#*================================================================================================*#
#| |#
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
#| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |#
#| /$$ \ $$ | $$ |#
#| | $$$$$$/ | $$ |#
#| \______/ |__/ |#
#| |#
#| DESCRIPTION: |#
#| ------------ |#
#| |#
#| DESCRIPTION NEEDED. |#
#| | | |#
#| |#
#| -------------------------------------------------------------------------------------------- |#
#| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart |#
#| |#
#| Redistribution and use in source and binary forms, with or without modification, are |#
#| permitted provided that the following conditions are met: |#
#| |#
#| (1) Redistributions of source code must retain the above copyright notice, this list of |#
#| conditions and the following disclaimer. |#
#| |#
#| (2) Redistributions in binary form must reproduce the above copyright notice, this list |#
#| of conditions and the following disclaimer in the documentation and/or other |#
#| materials provided with the distribution. |#
#| |#
#| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS |#
#| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |#
#| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |#
#| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |#
#| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |#
#| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |#
#| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |#
#| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |#
#| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |#
#| |#
#*================================================================================================*#
#----------------------------------------------------------#
# COMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENT #
#----------------------------------------------------------#

View file

@ -1,299 +0,0 @@
/*==================================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: header.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| DESCRIPTION NEEDED. ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| - Patrick Vogler B87D120 V - header file created ||
|| - Patrick Vogler B880CA2 V - header file patched ||
|| - Patrick Vogler B87E7E4 V - header file updated ||
|| - Patrick Vogler B87F684 V - header file new version ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|| following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|| the following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|| distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| ||
\*==================================================================================================================================*/
#ifndef HEADER_H
#define HEADER_H
/************************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
/************************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! Macros: !
! ------- !
! Macro Description !
! ----- ----------- !
! !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V - Macros created !
! - Patrick Vogler B880CA2 V - Macros patched !
! - Patrick Vogler B87E7E4 V - Macros updated !
! - Patrick Vogler B87F684 V - Macros new version !
! !
\*----------------------------------------------------------------------------------------------------------*/
/************************************************************************************************************\
|| ____ ____ _ _ ____ ___ ____ _ _ ___ ____ ||
|| | | | |\ | [__ | |__| |\ | | [__ ||
|| |___ |__| | \| ___] | | | | \| | ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! CONSTANTS: !
! ----------- !
! Constant Description !
! -------- ----------- !
! !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V - Constants created !
! - Patrick Vogler B880CA2 V - Constants patched !
! - Patrick Vogler B87E7E4 V - Constants updated !
! - Patrick Vogler B87F684 V - Constants new version !
! !
\*----------------------------------------------------------------------------------------------------------*/
/************************************************************************************************************\
|| ____ _ _ ___ ____ ____ _ _ ____ _ _ _ ____ ____ _ ____ ___ _ ____ ____ ||
|| |___ \/ | |___ |__/ |\ | |__| | | | |__| |__/ | |__| |__] | |___ [__ ||
|| |___ _/\_ | |___ | \ | \| | | |___ \/ | | | \ | | | |__] |___ |___ ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! VARIABLES: !
! ----------- !
! VARIABLE Description !
! -------- ----------- !
! !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V - Variables created !
! - Patrick Vogler B880CA2 V - Variables patched !
! - Patrick Vogler B87E7E4 V - Variables updated !
! - Patrick Vogler B87F684 V - Variables new version !
! !
\*----------------------------------------------------------------------------------------------------------*/
/************************************************************************************************************\
|| ____ _ _ ___ ____ ____ _ _ ____ _ ____ ____ _ _ ____ ___ ____ _ _ ___ ____ ||
|| |___ \/ | |___ |__/ |\ | |__| | | | | |\ | [__ | |__| |\ | | [__ ||
|| |___ _/\_ | |___ | \ | \| | | |___ |___ |__| | \| ___] | | | | \| | ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! CONSTANTS: !
! ----------- !
! Constant Description !
! -------- ----------- !
! !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V - Constants created !
! - Patrick Vogler B880CA2 V - Constants patched !
! - Patrick Vogler B87E7E4 V - Constants updated !
! - Patrick Vogler B87F684 V - Constants new version !
! !
\*----------------------------------------------------------------------------------------------------------*/
/************************************************************************************************************\
|| ___ _ _ ___ ____ ____ ||
|| | \_/ |__] |___ [__ ||
|| | | | |___ ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! STRUCT NAME: Template !
! ----------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! - - - !
! !
! DEPENDENCIES: !
! ------------- !
! Variable Type Description !
! -------- ---- ----------- !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V - Struct created !
! - Patrick Vogler B880CA2 V - Struct patched !
! - Patrick Vogler B87E7E4 V - Struct updated !
! - Patrick Vogler B87F684 V - Struct new version !
! !
\*----------------------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------------------*\
! ENUM NAME: Template !
! ----------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! - - - !
! !
! DEPENDENCIES: !
! ------------- !
! Variable Type Description !
! -------- ---- ----------- !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V - Enum created !
! - Patrick Vogler B880CA2 V - Enum patched !
! - Patrick Vogler B87E7E4 V - Enum updated !
! - Patrick Vogler B87F684 V - Enum new version !
! !
\*----------------------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------------------*\
! UNION NAME: Template !
! ----------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! - - - !
! !
! DEPENDENCIES: !
! ------------- !
! Variable Type Description !
! -------- ---- ----------- !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V - Union created !
! - Patrick Vogler B880CA2 V - Union patched !
! - Patrick Vogler B87E7E4 V - Union updated !
! - Patrick Vogler B87F684 V - Union new version !
! !
\*----------------------------------------------------------------------------------------------------------*/
/************************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! TYPE NAME: Template !
! ----------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
#endif

View file

@ -1,179 +0,0 @@
/*==================================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| FILE NAME: source.c ||
|| ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| DESCRIPTION NEEDED. ||
|| ||
|| FILE REFERENCES: ||
|| ---------------- ||
|| ||
|| Name I/O Description ||
|| ---- --- ----------- ||
|| none - - ||
|| ||
|| ||
|| PRIVATE FUNCTIONS: ||
|| ------------------ ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| - Patrick Vogler B87D120 V - source file created ||
|| - Patrick Vogler B880CA2 V - source file patched ||
|| - Patrick Vogler B87E7E4 V - source file updated ||
|| - Patrick Vogler B87F684 V - source file new version ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|| following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|| the following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|| distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| ||
\*==================================================================================================================================*/
/************************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
/************************************************************************************************************\
|| ____ _ _ ___ ____ ____ _ _ ____ _ _ _ ____ ____ _ ____ ___ _ ____ ____ ||
|| |___ \/ | |___ |__/ |\ | |__| | | | |__| |__/ | |__| |__] | |___ [__ ||
|| |___ _/\_ | |___ | \ | \| | | |___ \/ | | | \ | | | |__] |___ |___ ___] ||
|| ||
\************************************************************************************************************/
/************************************************************************************************************\
|| ____ _ _ ___ ____ ____ _ _ ____ _ ____ ____ _ _ ____ ___ ____ _ _ ___ ____ ||
|| |___ \/ | |___ |__/ |\ | |__| | | | | |\ | [__ | |__| |\ | | [__ ||
|| |___ _/\_ | |___ | \ | \| | | |___ |___ |__| | \| ___] | | | | \| | ___] ||
|| ||
\************************************************************************************************************/
/************************************************************************************************************\
|| ___ ____ _ _ _ ____ ___ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] |__/ | | | |__| | |___ |___ | | |\ | | | | | | |\ | [__ ||
|| | | \ | \/ | | | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *template(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! - - - !
! !
! RETURN VALUE: !
! ------------- !
! Type Description !
! ---- ----------- !
! - - !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V - function created !
! - Patrick Vogler B880CA2 V - function patched !
! - Patrick Vogler B87E7E4 V - function updated !
! - Patrick Vogler B87F684 V - function new version !
! !
\*----------------------------------------------------------------------------------------------------------*/
/************************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! - - - !
! !
! RETURN VALUE: !
! ------------- !
! Type Description !
! ---- ----------- !
! - - !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! - Patrick Vogler B87D120 V - function created !
! - Patrick Vogler B880CA2 V - function patched !
! - Patrick Vogler B87E7E4 V - function updated !
! - Patrick Vogler B87F684 V - function new version !
! !
\*----------------------------------------------------------------------------------------------------------*/
/*-----------------------*\
! DEFINE INT VARIABLES: !
\*-----------------------*/
/*-----------------------*\
! DEFINE FLOAT VARIABLES: !
\*-----------------------*/
/*-----------------------*\
! DEFINE CHAR VARIABLES: !
\*-----------------------*/
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/
/*--------------------------------------------------------*\
! COMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENTCOMMENT !
\*--------------------------------------------------------*/

View file

@ -0,0 +1,300 @@
!*================================================================================================*!
!| |!
!| /$$$$$$$ /$$ /$$ /$$ /$$ |!
!| | $$__ $$|__/ | $$ /$ | $$| $$ |!
!| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |!
!| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |!
!| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |!
!| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |!
!| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |!
!| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |!
!| /$$ \ $$ | $$ |!
!| | $$$$$$/ | $$ |!
!| \______/ |__/ |!
!| |!
!| DESCRIPTION: |!
!| ------------ |!
!| |!
!| This file defines a FORTRAN api for the Big Whoop compression library. |!
!| |!
!| -------------------------------------------------------------------------------------------- |!
!| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart |!
!| |!
!| Redistribution and use in source and binary forms, with or without modification, are |!
!| permitted provided that the following conditions are met: |!
!| |!
!| (1) Redistributions of source code must retain the above copyright notice, this list of |!
!| conditions and the following disclaimer. |!
!| |!
!| (2) Redistributions in binary form must reproduce the above copyright notice, this list |!
!| of conditions and the following disclaimer in the documentation and/or other |!
!| materials provided with the distribution. |!
!| |!
!| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS |!
!| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |!
!| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |!
!| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |!
!| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |!
!| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |!
!| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |!
!| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |!
!| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |!
!| |!
!*================================================================================================*!
module bwc_module
!************************************************************************************************!
!| _ _ _ ____ _ _ _ ___ ____ |!
!| | |\ | | | | | | \ |___ |!
!| | | \| |___ |___ |__| |__/ |___ |!
!| |!
!************************************************************************************************!
use, intrinsic :: iso_c_binding, only: C_PTR, C_INT64_T, C_INT16_T, C_INT8_T, C_INT, C_DOUBLE
IMPLICIT NONE
PRIVATE
!************************************************************************************************!
!| ____ ____ _ _ ____ ___ ____ _ _ ___ ____ |!
!| | | | |\ | [__ | |__| |\ | | [__ |!
!| |___ |__| | \| ___] | | | | \| | ___] |!
!| |!
!************************************************************************************************!
ENUM, BIND(C)
enumerator :: bwc_dwt_9_7 = 0, & ! Cohen Daubechies Feauveau 9/7 Wavelet
bwc_dwt_5_3 = 1, & ! LeGall 5/3 Wavelet
bwc_dwt_haar = 2 ! Haar Wavelet
END ENUM
ENUM, BIND(C)
enumerator :: bwc_prog_LRCP = 0 ! Layer / Resolution / Parameter / Packet
END ENUM
ENUM, BIND(C)
enumerator :: bwc_qt_none = 0, & ! No quantization
bwc_qt_derived = 1 ! Derived quantization acc. to JPEG2000
END ENUM
ENUM, BIND(C)
enumerator :: bwc_tile_sizeof = 0, & ! Tiling def. through dimension of a tile
bwc_tile_numbof = 1 ! Tiling def. through number of tiles
END ENUM
!************************************************************************************************!
!| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ |!
!| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ |!
!| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] |!
!| |!
!************************************************************************************************!
interface
subroutine bwc_free_field(field) BIND(C, NAME="bwc_free_field")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
end subroutine bwc_free_field
!===============================================================================================
subroutine bwc_add_param(field, name, sample, dim, precision) BIND(C, NAME="bwc_add_param")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
TYPE(C_PTR), VALUE :: name
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(C_INT16_T) :: sample
INTEGER(C_INT8_T) :: dimprecision
INTEGER(C_INT8_T) :: precision
end subroutine bwc_add_param
!===============================================================================================
subroutine bwc_set_tiles(field, tilesX, tilesY, &
tilesZ, tilesTS, instr) BIND(C, NAME="bwc_set_tiles")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
TYPE(C_PTR), VALUE :: instr
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(C_INT64_T) :: tilesX, tilesY
INTEGER(C_INT64_T) :: tilesZ, tilesTS
end subroutine bwc_set_tiles
!===============================================================================================
subroutine bwc_set_kernels(field, KernelX, KernelY, &
KernelZ, KernelTS) BIND(C, NAME="bwc_set_kernels")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(C_INT) :: KernelX, KernelY
INTEGER(C_INT) :: KernelZ, KernelTS
end subroutine bwc_set_kernels
!===============================================================================================
subroutine bwc_set_decomp(field, numDecompX, numDecompY, &
numDecompZ, numDecompTS) BIND(C, NAME="bwc_set_decomp")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(C_INT8_T) :: numDecompX, numDecompY
INTEGER(C_INT8_T) :: numDecompZ, numDecompTS
end subroutine bwc_set_decomp
!===============================================================================================
subroutine bwc_set_precincts(field, pX, pY, pZ, pTS) BIND(C, NAME="bwc_set_precincts")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(C_INT8_T) :: pX, pY
INTEGER(C_INT8_T) :: pZ, pTS
end subroutine bwc_set_precincts
!===============================================================================================
subroutine bwc_set_codeblocks(field, cbX, cbY, cbZ, cbTS) BIND(C, NAME="bwc_set_codeblocks")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(C_INT8_T) :: cbX, cbY
INTEGER(C_INT8_T) :: cbZ, cbTS
end subroutine bwc_set_codeblocks
!===============================================================================================
subroutine bwc_set_progression(field, progression) BIND(C, NAME="bwc_set_progression")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(C_INT) :: progression
end subroutine bwc_set_progression
!===============================================================================================
subroutine bwc_set_error_resilience(field) BIND(C, NAME="bwc_set_error_resilience")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
end subroutine bwc_set_error_resilience
!===============================================================================================
subroutine bwc_set_quant_style(field, quantization_style) BIND(C, NAME="bwc_set_quant_style")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(C_INT) :: quantization_style
end subroutine bwc_set_quant_style
!===============================================================================================
subroutine bwc_set_qm(field, Qm) BIND(C, NAME="bwc_set_qm")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(C_INT8_T) :: Qm
end subroutine bwc_set_qm
!===============================================================================================
subroutine bwc_set_quant_step_size(field, delta) BIND(C, NAME="bwc_set_quant_step_size")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE REAL VARIABLES: !
!*-----------------------*!
REAL(C_DOUBLE) :: delta
end subroutine bwc_set_quant_step_size
!===============================================================================================
#ifdef _OPENMP
subroutine bwc_set_nThreads(field, nThreads) BIND(C, NAME="bwc_set_nThreads")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(C_INT8_T) :: nThreads
end subroutine bwc_set_nThreads
#endif
!===============================================================================================
subroutine bwc_set_memory_limit(field, limit) BIND(C, NAME="bwc_set_memory_limit")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
TYPE(C_PTR), VALUE :: limit
end subroutine bwc_set_memory_limit
!===============================================================================================
function bwc_compress(field, rate_control) result(flag) BIND(C, NAME="bwc_compress")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
TYPE(C_PTR), VALUE :: rate_control
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(C_INT8_T) :: flag
end function bwc_compress
!===============================================================================================
function bwc_decompress(field, layer) result(e_flag) BIND(C, NAME="bwc_decompress")
IMPORT
!*-----------------------*!
! DEFINE POINTERS: !
!*-----------------------*!
TYPE(C_PTR), VALUE :: field
!*-----------------------*!
! DEFINE INT VARIABLES: !
!*-----------------------*!
INTEGER(C_INT8_T) :: layer
INTEGER(C_INT8_T) :: e_flag
end function bwc_decompress
end interface
end module bwc_module

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

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,325 +12,159 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| 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 ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| This file defines macros, structs and simple read and write functions used to ||
|| access conforming eas3 datasets. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|| following conditions are met: ||
|| Redistribution and use in source and binary forms, with or without modification, are ||
|| permitted provided that the following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|| the following disclaimer. ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of ||
|| conditions and the following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|| distribution. ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other ||
|| materials provided with the distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS ||
|| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ||
|| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ||
|| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ||
|| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ||
|| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ||
|| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR ||
|| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ||
|| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
#ifndef EAS3_H
#define EAS3_H
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
#include <bwc.h>
\************************************************************************************************/
#include <stdio.h>
#include <stdint.h>
/************************************************************************************************************\
#include "types.h"
/************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These macros are used to identify the spatial and temporal dimensions. !
! These macros define EAS3 header markers. For more information see: !
! https://wiki.iag.uni-stuttgart.de/eas3wiki/index.php/Main_Page/de !
! !
! 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
\*----------------------------------------------------------------------------------------------*/
#define EAS3_NO_ATTR 0x100000000000000 // No attributes present in the bitstream
#define EAS3_ALL_ATTR 0x200000000000000 // All attributes present in the bitstream
/*----------------------------------------------------------------------------------------------------------*\
! 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 // EAS2 Datatype
#define EAS3_TYPE 0x200000000000000 // EAS3 Datatype
#define EAS2_TYPE 0x100000000000000
#define EAS3_TYPE 0x200000000000000
#define ATTRLEN 10 // Number of bytes defining an attribute
#define UDEFLEN 20 // Number of bytes defining data
#define ATTRLEN 10
#define UDEFLEN 20
#define EAS3_NO_G 0x100000000000000 // No geometry data present in bitstream
#define EAS3_X0DX_G 0x200000000000000 // Start value & step size present
#define EAS3_UDEF_G 0x300000000000000 // Number of grid points present
#define EAS3_ALL_G 0x400000000000000 // Element for every appr. dim. present
#define EAS3_FULL_G 0x500000000000000 // Element for every dimension present
#define EAS3_NO_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 // No user defined data present in bitstr
#define EAS3_ALL_UDEF 0x200000000000000 // All user defined fields present
#define EAS3_INT_UDEF 0x300000000000000 // User defined integer field present
#define EAS3_NO_UDEF 0x100000000000000
#define EAS3_ALL_UDEF 0x200000000000000
#define EAS3_INT_UDEF 0x300000000000000
#define AUX_SIZE 0x8000 // Size of auxiliary information stream
#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: !
! !
! This structure is used to store the standard eas3 header parameters. For a more !
! thorough discussion of the eas3 datatype see: !
! !
! https://wiki.iag.uni-stuttgart.de/eas3wiki/index.php/EAS3_File_Format/de !
! !
! 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;
uint64 file_type; // Identifier for EAS Type (EAS2/3)
uint64 accuracy; // Accuracy of the eas3 file
uint64 nzs; // Temporal dimension size
uint64 npar; // No. parameters present in data-set
uint64 ndim1; // 1st spatial dimension size
uint64 ndim2; // 2nd spatial dimension size
uint64 ndim3; // 3rd spatial dimension size
uint64 attribute_mode; // Attribute of the eas3 file
uint64 gmode_time; // Geometry mode for the temp. dimension
uint64 gmode_param; // Geometry mode for the parameters
uint64 gmode_dim1; // 1st spatial dimension geometry mode
uint64 gmode_dim2; // 2nd spatial dimension geometry mode
uint64 gmode_dim3; // 3rd spatial dimension geometry mode
uint64 size_time; // Temporal dimension geometry array size
uint64 size_parameter; // Geometry array size of parameters
uint64 size_dim1; // 1st sptl. dimension geometry array size
uint64 size_dim2; // 2nd sptl. dimension geometry array size
uint64 size_dim3; // 3rd sptl. dimension geometry array size
uint64 udef_param; // Signals user def. parameters present
uint64 udef_char_size; // Size of user defined char. array
uint64 udef_int_size; // Size of user defined int. array
uint64 udef_real_size; // Size of user defined real array
} eas3_std_params;
/************************************************************************************************************\
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! This structure is used to store all the necessary parameters required to access !
! parameters stored in an eas3 file. !
! !
\*----------------------------------------------------------------------------------------------*/
typedef struct
{
uint64 *offset; // Offset of a parameter in a eas3 file
} eas3_file_util;
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! 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);
\************************************************************************************************/
uchar open_eas3 (bwc_field *const field,
char const *const filename,
char const *mode);
//==========|==========================|======================|======|=======|====================
uchar load_eas3 (bwc_field *const field,
char const *const filename);
//==========|==========================|======================|======|=======|====================
uchar unload_eas3 (bwc_field *const field,
char const *const filename);
#endif

View file

@ -0,0 +1,70 @@
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| ||
|| This file defines simple read and write functions used to access conforming ||
|| netCDF datasets. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are ||
|| permitted provided that the following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of ||
|| conditions and the following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other ||
|| materials provided with the distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS ||
|| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ||
|| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ||
|| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ||
|| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ||
|| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ||
|| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR ||
|| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ||
|| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| ||
\*================================================================================================*/
#ifndef NETCDF_H
#define NETCDF_H
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************/
#include <bwc.h>
#include <stdio.h>
#include "utilities.h"
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************/
bwc_data* read_netCDF (char *const filename);
//==========|==========================|======================|======|=======|====================
uchar write_netCDF (bwc_data *const file,
char *const filename);
#endif

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

@ -0,0 +1,78 @@
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| ||
|| This file defines simple read and write functions used to access conforming bwc ||
|| datasets. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are ||
|| permitted provided that the following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of ||
|| conditions and the following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other ||
|| materials provided with the distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS ||
|| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ||
|| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ||
|| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ||
|| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ||
|| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ||
|| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR ||
|| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ||
|| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| ||
\*================================================================================================*/
#ifndef IO_H
#define IO_H
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************/
#include "types.h"
#ifdef BWC_EAS3
#include "eas3.h"
#endif
#ifdef BWC_NETCDF
#include "netcdf.h"
#endif
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************/
uchar open_bwc (bwc_field *const field,
char const *const filename,
char const *mode);
//==========|==========================|======================|======|=======|====================
uchar load_bwc (bwc_field *const field,
char const *const filename);
//==========|==========================|======================|======|=======|====================
uchar unload_bwc (bwc_field *const field,
char const *const filename);
#endif

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,213 +12,83 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: bwc_bitstream.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| This file describes a set of functions that can be used to create, manipulate and terminate ||
|| a bitstream. These functions facilitate the creation or reading of a compressed bwc code- ||
|| stream and can emit/extract information on a per bit, symbol (64-bit) or string basis. ||
|| ||
|| This file describes a set of functions that can be used to create, manipulate ||
|| and terminate a bitstream. These functions facilitate the creation or reading ||
|| of a compressed bwc codestream and can emit/extract information on a per bit, ||
|| symbol (64-bit) or string basis. ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| - ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| - bwc_init_stream ||
|| - bwc_emit_chunck ||
|| - bwc_emit_symbol ||
|| - bwc_emit_bit ||
|| - bwc_get_chunck ||
|| - bwc_get_symbol ||
|| - bwc_get_bit ||
|| - bwc_terminate_stream ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 28.05.2018 Patrick Vogler B87D120 V 0.1.0 header file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|| following conditions are met: ||
|| Redistribution and use in source and binary forms, with or without modification, are ||
|| permitted provided that the following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|| the following disclaimer. ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of ||
|| conditions and the following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|| distribution. ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other ||
|| materials provided with the distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS ||
|| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ||
|| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ||
|| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ||
|| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ||
|| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ||
|| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR ||
|| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ||
|| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
#ifndef BITSTREAM_H
#define BITSTREAM_H
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
\************************************************************************************************/
#include "types.h"
/************************************************************************************************************\
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: uint32 bytes_used(bwc_stream *const stream) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function is used to evaluate the number of bytes that have already been !
! written to the allocated bitstream memory block. !
! !
\*----------------------------------------------------------------------------------------------------------*/
uint64
bytes_used(bwc_stream *const stream);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: bwc_stream* bwc_init_stream(uchar* memory, uint32 size, char instr) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function is used to initialize a bwc bitstream. For encoding, a null pointer !
! is passed as a memory handle and the function will allocate a memory block with the !
! specified stream size. For decoding, a valid memory handle, passed by the function !
! caller, will be stored in the bwc_stream structure. The byte buffer counter t, !
! stream size Lmax and size increment are initialized with their appropriate values. !
! !
\*----------------------------------------------------------------------------------------------------------*/
bwc_stream*
bwc_init_stream(uchar* memory, uint32 size, char instr);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bwc_emit_chunck(bwc_stream *const stream, const uchar* chunck, const uint64 size);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bwc_emit_symbol(bwc_stream *const stream, const uint64 symbol, const uint8 size);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bwc_emit_bit(bwc_stream *const stream, const uint64 bit);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
flush_stream(bwc_stream *const stream);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar*
bwc_get_chunck(bwc_stream *const stream, const uint64 length);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
uint64
bwc_get_symbol(bwc_stream *const stream, const uint8 length);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
bwc_get_bit(bwc_stream *const stream);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
bwc_terminate_stream(bwc_stream *stream, bwc_packed_stream *const packed_stream);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void release_packed_stream(bwc_packed_stream *stream) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function is used to release all the information stored in a packed bitstream !
! and reset the parameters for another (de)compression run. !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
release_packed_stream(bwc_packed_stream *stream);
\************************************************************************************************/
uint64 bytes_used (bwc_stream const *const stream);
//==========|==========================|======================|======|======|=====================
bwc_stream* init_stream (uchar *const memory,
uint32 const size,
char const instr);
//==========|==========================|======================|======|======|=====================
void emit_chunck (bwc_stream *const stream,
uchar const *const chunck,
uint64 const size);
//==========|==========================|======================|======|======|=====================
void emit_symbol (bwc_stream *const stream,
uint64 const symbol,
uint8 const size);
//==========|==========================|======================|======|======|=====================
void emit_bit (bwc_stream *const stream,
uint64 const bit);
//==========|==========================|======================|======|======|=====================
void flush_stream (bwc_stream *const stream);
//==========|==========================|======================|======|======|=====================
uchar* get_chunck (bwc_stream *const stream,
uint64 const length);
//==========|==========================|======================|======|======|=====================
uint64 get_symbol (bwc_stream *const stream,
uint8 const length);
//==========|==========================|======================|======|======|=====================
uchar get_bit (bwc_stream *const stream);
//==========|==========================|======================|======|======|=====================
uchar terminate_stream (bwc_stream *stream,
bwc_packed_stream *const packed_stream);
//==========|==========================|======================|======|======|=====================
void release_packed_stream (bwc_packed_stream *const stream);
#endif

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,180 +12,59 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: codestream.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| DESCRIPTION NEEDED. ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 28.05.2018 Patrick Vogler B87D120 V 0.1.0 header file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| This file describes a set of function that can be used to create and manipulate ||
|| a BigWhoop Codestream. They facilitate the assembly and parsing of the main ||
|| header and tile bitsreams as well as read and write functions used to access ||
|| conforming bwc datasets. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|| following conditions are met: ||
|| Redistribution and use in source and binary forms, with or without modification, are ||
|| permitted provided that the following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|| the following disclaimer. ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of ||
|| conditions and the following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|| distribution. ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other ||
|| materials provided with the distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS ||
|| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ||
|| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ||
|| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ||
|| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ||
|| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ||
|| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR ||
|| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ||
|| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
#ifndef CODESTREAM_H
#define CODESTREAM_H
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
\************************************************************************************************/
#include "types.h"
/************************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! 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);
\************************************************************************************************/
void free_bwc (bwc_field *const field);
//==========|==========================|======================|======|======|=====================
uchar assemble_tile (bwc_field *const field);
//==========|==========================|======================|======|======|=====================
uchar initialize_main_header (bwc_field *const field);
//==========|==========================|======================|======|======|=====================
uchar finalize_main_header (bwc_field *const field);
#endif

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,317 +12,91 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: constants.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| DESCRIPTION NEEDED. ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 16.10.2017 Patrick Vogler B87D120 V 0.1.0 header file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| This file defines simple constants that are used to make the code more readable. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|| following conditions are met: ||
|| Redistribution and use in source and binary forms, with or without modification, are ||
|| permitted provided that the following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|| the following disclaimer. ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of ||
|| conditions and the following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|| distribution. ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other ||
|| materials provided with the distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS ||
|| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ||
|| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ||
|| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ||
|| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ||
|| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ||
|| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR ||
|| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ||
|| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
#ifndef CONSTANTS_H
#define CONSTANTS_H
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! !
! These constants are used to identify the spatial and temporal dimensions. !
! !
! Constants: !
! ----------- !
! Constant Description !
! -------- ----------- !
! DIM_X 1st Spatial Dimension !
! DIM_Y 2nd Spatial Dimension !
! DIM_Z 3rd Spatial Dimension !
! DIM_TS Temporal Dimension !
! DIM_ALL All Dimensions !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 04.12.2017 Patrick Vogler B87D120 V 0.1.0 Constants created !
\*----------------------------------------------------------------------------------------------------------*/
#define DIM_X 1
#define DIM_Y 2
#define DIM_Z 4
#define DIM_TS 8
#define DIM_ALL 15
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! !
! These constants describe the maximum allowable wavelet decompositions for the spatial and !
! temporal dimensions and the maximum allowable subbands. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 01.12.2017 Patrick Vogler B87D120 V 0.1.0 Constants created !
\*----------------------------------------------------------------------------------------------------------*/
#define MAXIMUM_NUMBER_OF_SPATIAL_DECOMP 64
#define MAXIMUM_NUMBER_OF_TEMPORAL_DECOMP 32
#define MAXIMUM_NUMBER_OF_SUBBANDS (1+(15*(64-32))) + (1+(7*32))
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! !
! These Constants describe the codestream markers used to create the embedded codestream. !
! !
! CONSTANTS: !
! ----------- !
! Constant Description !
! -------- ----------- !
! SOC - Start of code-stream !
! SGI - Global data-set information !
! SGC - Global control parameters !
! SAX - Auxiliary data-set information !
! TLM - Packet lengths: main header !
! PLM - Packet lengths: tile-part !
! PPM - Quantization default !
! COM - Comment !
! EOH - End of header !
! PLT - Packed packet headers: main header !
! PPT - Packed packet headers: tile-part !
! SOT - Start of tile !
! SOP - Start of packet !
! EPH - End of packet header !
! SOD - Start of data !
! EOC - End of code-stream !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 01.12.2017 Patrick Vogler B87D120 V 0.1.0 Constants created !
\*----------------------------------------------------------------------------------------------------------*/
#define SOC 0xFF50
#define SGI 0xFF51
#define SGC 0xFF52
#define SAX 0xFF53
#define TLM 0xFF54
#define PLM 0xFF55
#define PPM 0xFF56
#define COM 0xFF57
#define EOH 0xFF58
#define PLT 0xFF60
#define PPT 0xFF61
#define SOT 0xFF90
#define SOP 0xFF91
#define EPH 0xFF92
#define SOD 0xFF93
#define EOC 0xFFFF
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! !
! These Constants are used for codestream parsing. !
! !
! CONSTANTS: !
! ----------- !
! Constant Description !
! -------- ----------- !
! CODESTREAM_OK No errors detectet in Codestream !
! CODESTREAM_ERROR Error detectet in Codestream !
! CODESTREAM_SGI_READ Global data-set information read !
! CODESTREAM_SGC_READ Global control parameters read !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 01.08.2019 Patrick Vogler B87D120 V 0.1.0 Constants created !
\*----------------------------------------------------------------------------------------------------------*/
#define CODESTREAM_OK 0x00
#define CODESTREAM_ERROR 0x80
#define CODESTREAM_SGI_READ 0x01
#define CODESTREAM_SGC_READ 0x02
#define CODESTREAM_SAX_READ 0x04
#define CODESTREAM_COM_READ 0x08
/*----------------------------------------------------------------------------------------------------------*\
! ENUM NAME: bwc_dwt_filter !
! ----------- !
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These constants describe the wavelet filter used during the transform stage. !
! These constants are used to signal spatial or temporal the wavelet filter. !
! !
! PARAMETERS: !
! ----------- !
! Constant Description !
! -------- ----------- !
! bwc_dwt_9_7 - Cohen Daubechies Feauveau 9/7 Wavelet !
! bwc_dwt_5_3 - LeGall 5/3 Wavelet !
! bwc_dwt_haar - Haar Wavelet !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 07.12.2017 Patrick Vogler B87D120 V 0.1.0 Enum created !
! !
\*----------------------------------------------------------------------------------------------------------*/
typedef enum{
bwc_dwt_9_7,
bwc_dwt_5_3,
bwc_dwt_haar
\*----------------------------------------------------------------------------------------------*/
typedef enum
{
bwc_dwt_9_7, // Cohen Daubechies Feauveau 9/7 Wavelet
bwc_dwt_5_3, // LeGall 5/3 Wavelet
bwc_dwt_haar // Haar Wavelet
} bwc_dwt_filter;
/*----------------------------------------------------------------------------------------------------------*\
! ENUM NAME: bwc_prog_ord !
! ----------- !
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These constants describe the progression order used to pack the codestream. !
! The organisation of the codesstream is carried out according to the following 5 cases. !
! These constants are used to signal the packing order of the codestream. !
! !
! LRCP: RLCP: !
! ----- for each Quality Layer: ----- for each Resolution: !
! for each Resolution: for each Quality Layer: !
! for each Parameter: for each Parameter: !
! for each Precinct: for each Precinct: !
! include Packet include Packet !
! !
! RPCL: PCRL: !
! ----- for each Resolution: ----- for each Precinct: !
! for each Precinct: for each Parameter: !
! for each Parameter: for each Resolution: !
! for each Quality Layer: for each Quality Layer: !
! include Packet include Packet !
! !
! CPRL: !
! ----- for each Quality Layer: !
! for each Resolution: !
! for each Parameter: !
! for each Precinct: !
! include Packet !
! !
! PARAMETERS: !
! ----------- !
! Constant Description !
! -------- ----------- !
! bwc_prog_LRCP - LRCP progression order !
! bwc_prog_RLCP - RLCP progression order !
! bwc_prog_RPCL - RPCL progression order !
! bwc_prog_PCRL - PCRL progression order !
! bwc_prog_CPRL - CPRL progression order !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 07.12.2017 Patrick Vogler B87D120 V 0.1.0 Enum created !
! !
\*----------------------------------------------------------------------------------------------------------*/
typedef enum{
bwc_prog_LRCP,
bwc_prog_RLCP,
bwc_prog_RPCL,
bwc_prog_PCRL,
bwc_prog_CPRL
\*----------------------------------------------------------------------------------------------*/
typedef enum
{
bwc_prog_LRCP // Layer / Resolution / Parameter / Packet
} bwc_prog_ord;
/*----------------------------------------------------------------------------------------------------------*\
! ENUM NAME: bwc_quant_st !
! ----------- !
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! PARAMETERS: !
! ----------- !
! Constant Description !
! -------- ----------- !
! - - !
! These constants are used to signal the quantisation style during !
! (de)coompression. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 07.12.2017 Patrick Vogler B87D120 V 0.1.0 Enum created !
! !
\*----------------------------------------------------------------------------------------------------------*/
typedef enum{
bwc_qt_none,
bwc_qt_derived,
\*----------------------------------------------------------------------------------------------*/
typedef enum
{
bwc_qt_none, // No quantization
bwc_qt_derived, // Derrived according to Taubman/Marcellin
} bwc_quant_st;
/*----------------------------------------------------------------------------------------------------------*\
! ENUM NAME: bwc_tile_instr !
! ----------- !
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! PARAMETERS: !
! ----------- !
! Constant Description !
! -------- ----------- !
! - - !
! These constants are used to signal dataset tiling by the function caller. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 17.04.2019 Patrick Vogler B87D120 V 0.1.0 Enum created !
! !
\*----------------------------------------------------------------------------------------------------------*/
typedef enum{
bwc_tile_sizeof,
bwc_tile_numbof,
\*----------------------------------------------------------------------------------------------*/
typedef enum
{
bwc_tile_sizeof, // Tiling defined by size of one tile
bwc_tile_numbof, // Tiling defined by the number of tiles
} bwc_tile_instr;
#endif

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,317 +12,156 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: dwt.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| DESCRIPTION NEEDED. ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 21.03.2018 Patrick Vogler B87D120 V 0.1.0 header file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| This file describes a set of functions that can be used to performe the forward/ ||
|| inverse discrete wavelet transform on 1- to 4-dimensional IEEE 754 data-sets. ||
|| For more information please refere to JPEG2000 by D. S. Taubman and M. W. ||
|| Marcellin. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|| following conditions are met: ||
|| Redistribution and use in source and binary forms, with or without modification, are ||
|| permitted provided that the following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|| the following disclaimer. ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of ||
|| conditions and the following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|| distribution. ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other ||
|| materials provided with the distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS ||
|| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ||
|| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ||
|| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ||
|| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ||
|| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ||
|| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR ||
|| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ||
|| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
#ifndef DWT_H
#define DWT_H
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
\************************************************************************************************/
#include "types.h"
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! This macro defines the maximum decomposition level up to which the wavelet filer energy gain !
! is calculated. Beyond the maximum decomposition level the energy gain will only be !
! approximated. !
! Maximum number of wavelet layers for which the energy gain is calculated. !
! !
! Macros: !
! ------- !
! Macro Description !
! ----- ----------- !
! MAX_DECOMPOSITION_LEVELS - Maximum number of wavelet layers for which the energy !
! gain is calculated. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 20.03.2018 Patrick Vogler B87D120 V 0.1.0 Macros created !
\*----------------------------------------------------------------------------------------------------------*/
#define MAX_DECOMPOSITION_LEVELS 4
\*----------------------------------------------------------------------------------------------*/
#define MAX_DECOMP_LEVELS 4
/*----------------------------------------------------------------------------------------------------------*\
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These macros define the irrational coefficients for the high and low pass synthesis filters !
! associated with the (9-7) Cohen-Daubechies-Feauveau-Wavelet as well as the coefficients for !
! its coressponding lifting scheme. !
! These macros define the irrational coefficients for the high and low pass !
! synthesis filters associated with the (9-7) Cohen-Daubechies-Feauveau-Wavelet !
! as well as the coefficients for its coressponding lifting scheme. !
! !
! Macros: !
! ------- !
! Macro Description !
! ----- ----------- !
! DWT_9X7_H0 !
! DWT_9X7_H1 !
! DWT_9X7_H2 - Coefficients for the (9-7) !
! DWT_9X7_H3 low pass synthesis filter. !
! !
! DWT_9X7_G0 !
! DWT_9X7_G1 !
! DWT_9X7_G2 !
! DWT_9X7_G3 - Coefficients for the (9-7) !
! DWT_9X7_G4 high pass synthesis filter. !
! !
! ALPHA !
! BETA !
! GAMMA !
! DELTA !
! KAPPA_H - Coefficients for the (9-7) !
! KAPPA_L lifting scheme. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 20.03.2018 Patrick Vogler B87D120 V 0.1.0 Macros created !
\*----------------------------------------------------------------------------------------------------------*/
#define DWT_9X7_H0 1.115087052457000f
#define DWT_9X7_H1 0.591271763114250f
\*----------------------------------------------------------------------------------------------*/
#define DWT_9X7_H0 1.115087052457000f // Low pass synthesis filter ...
#define DWT_9X7_H1 0.591271763114250f // ... coefficients
#define DWT_9X7_H2 -0.057543526228500f
#define DWT_9X7_H3 -0.091271763114250f
#define DWT_9X7_G0 1.205898036472721f
#define DWT_9X7_G1 -0.533728236885750f
#define DWT_9X7_G0 1.205898036472721f // High pass synthesis filter ...
#define DWT_9X7_G1 -0.533728236885750f // ... coefficients
#define DWT_9X7_G2 -0.156446533057980f
#define DWT_9X7_G3 0.033728236885750f
#define DWT_9X7_G4 0.053497514821620f
#define ALPHA -1.586134342059924f
#define ALPHA -1.586134342059924f // Lifting coefficients.
#define BETA -0.052980118572961f
#define GAMMA 0.882911075530934f
#define DELTA 0.360523644801462f
#define KAPPA_H 1.230174104914001f
#define KAPPA_L 0.812893066115961f
/*----------------------------------------------------------------------------------------------------------*\
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These macros define the irrational coefficients for the high and low pass synthesis filters !
! associated with the (5-3) LeGall-Wavelet. !
! These macros define the irrational coefficients for the high and low pass !
! synthesis filters associated with the (5-3) LeGall-Wavelet. !
! !
! Macros: !
! ------- !
! Macro Description !
! ----- ----------- !
! DWT_5X3_H0 - Coefficients for the (9-7) !
! DWT_5X3_H1 low pass synthesis filter. !
! !
! DWT_5X3_G0 !
! DWT_5X3_G1 - Coefficients for the (9-7) !
! DWT_5X3_G2 high pass synthesis filter. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 20.03.2018 Patrick Vogler B87D120 V 0.1.0 Macros created !
\*----------------------------------------------------------------------------------------------------------*/
#define DWT_5X3_H0 1.0f
#define DWT_5X3_H1 0.5f
\*----------------------------------------------------------------------------------------------*/
#define DWT_5X3_H0 1.0f // Low pass synthesis filter ...
#define DWT_5X3_H1 0.5f // ... coefficients
#define DWT_5X3_G0 0.75f
#define DWT_5X3_G1 -0.25f
#define DWT_5X3_G0 0.75f // High pass synthesis filter
#define DWT_5X3_G1 -0.25f // ... coefficients
#define DWT_5X3_G2 -0.125f
/*----------------------------------------------------------------------------------------------------------*\
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These macros define the irrational coefficients for the high and low pass synthesis filters !
! associated with the Haar-Wavelet. !
! These macros define the irrational coefficients for the high and low pass !
! synthesis filters associated with the Haar-Wavelet. !
! !
! Macros: !
! ------- !
! Macro Description !
! ----- ----------- !
! DWT_HAAR_G0 - Coefficients for the Haar !
! DWT_HAAR_G1 low pass synthesis filter. !
! !
! DWT_HAAR_H1 - Coefficients for the Haar !
! DWT_HAAR_H2 high pass synthesis filter. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 20.03.2018 Patrick Vogler B87D120 V 0.1.0 Macros created !
\*----------------------------------------------------------------------------------------------------------*/
#define DWT_HAAR_H0 1
#define DWT_HAAR_H1 1
\*----------------------------------------------------------------------------------------------*/
#define DWT_HAAR_H0 1 // Low pass synthesis filter ...
#define DWT_HAAR_H1 1 // ... coefficients
#define DWT_HAAR_G0 0.5
#define DWT_HAAR_G1 -0.5
#define DWT_HAAR_G0 0.5 // High pass synthesis filter ...
#define DWT_HAAR_G1 -0.5 // ... coefficients
/************************************************************************************************************\
/************************************************************************************************\
|| ____ _ _ ___ ____ ____ _ _ ____ _ _ _ ____ ____ _ ____ ___ _ ____ ____ ||
|| |___ \/ | |___ |__/ |\ | |__| | | | |__| |__/ | |__| |__] | |___ [__ ||
|| |___ _/\_ | |___ | \ | \| | | |___ \/ | | | \ | | | |__] |___ |___ ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! This array defines a lookup table used to store the energy gain factors for the one dimen- !
! sional, dyadic tree structured CDF-(9/7), LeGall-(5/3) and Haar wavelet transform. Each LUT !
! contains energy gain factors for the 6 low-pass and 6 high-pass decomposition including level !
! zero. !
! This array defines a lookup table used to store the energy gain factors for the !
! one dimensional CDF(9/7), LeGall-(5/3) and Haar wavelet transform. Each LUT !
! contains energy gain factors for the 6 low-pass and 6 high-pass decomposition !
! including level zero. !
! !
! VARIABLES: !
! ----------- !
! Variable Description !
! -------- ----------- !
! DWT_ENERGY_GAIN_LUT - Lookup-table for the CDF-(9/7), LG-(5/3) and Haar !
! dwt energy gain factor. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 21.03.2018 Patrick Vogler B87D120 V 0.1.0 Variables created !
\*----------------------------------------------------------------------------------------------------------*/
extern double DWT_ENERGY_GAIN_LUT[3][2 * MAX_DECOMPOSITION_LEVELS + 2];
\*----------------------------------------------------------------------------------------------*/
extern double DWT_ENERGY_GAIN_LUT[3][2 * MAX_DECOMP_LEVELS + 2];
/************************************************************************************************************\
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: uchar initialize_gain_lut() !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function calculates the energy gain factor Gb for the one dimensional, dyadic tree !
! structured CDF-(9/7), LeGall-(5/3) and Haar wavelet transform with 5 levels. The energy !
! gain factors are calculated according to equation (4.39) from JPEG2000 by David S. Taubman !
! and Michael W. Marcellin (p. 193): !
! !
! s_L1[n] = g0[n], s_H1[n] = h0[n], !
! s_Ld[n] = (s_Ld-1[k]*g0[n-2k], k), s_Hd[n] = (s_Hd-1[k]*g0[n-2k], k). !
! !
! The energy gain factors are stored in their corresponding lookup tables and used to calcu- !
! late the energy gain for the multi dimensional wavelet transforms according to equation !
! (4.40) from JPEG2000 by David S. Taubman and Michael W. Marcellin (p.193): !
! !
! s_LLD[n1,n2] = s_LD[n1] * s_LD[n2] => G_LLD = G_LD * G_LD !
! s_HLD[n1,n2] = s_LD[n1] * s_HD[n2] => G_HLD = G_LD * G_HD !
! s_LHD[n1,n2] = s_HD[n1] * s_LD[n2] => G_LHD = G_HD * G_LD !
! s_HHD[n1,n2] = s_HD[n1] * s_HD[n2] => G_HHD = G_HD * G_HD !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
initialize_gain_lut();
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: bwc_float get_dwt_energy_gain(bwc_field *field, uchar highband_flag, uint level) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function evaluates the energy gain factor according to the the specified decomposition !
! level. For decomposition levels larger than MAX_DECOMPOSITION_LEVELS the filter gain for !
! the extra levels is approximated by multiplying the energy gain factor by 2. !
! !
\*----------------------------------------------------------------------------------------------------------*/
bwc_float
get_dwt_energy_gain(bwc_field *field, uchar highband_flag, uint16 level);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: uchar forward_discrete_wavelet_transform(bwc_field *const field, !
! -------------- bwc_parameter *const parameter) !
! !
! DESCRIPTION: !
! ------------ !
! This function performs the forward discrete wavelet transform on the current tile param- !
! eter. After loading the flow field samples for a row, column or spatial/temporal slice !
! into a working buffer, a boundary extension operation is performed to ensure an approp. !
! sample base. The working buffer is then transform using the wavelet kernel selected for !
! the spatial or temporal dimension, sorted into high- and low-frequency samples and flushed !
! back into the tile parameter memory block. This operation is performed for every row, !
! column and spatial/temporal slice for ndecomp number of decomposition levels. !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
forward_discrete_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: uchar inverse_discrete_wavelet_transform(bwc_field *const field, !
! -------------- bwc_parameter *const parameter) !
! !
! DESCRIPTION: !
! ------------ !
! This function performs the inverse discrete wavelet transform on the current tile param- !
! eter. After loading the interweaved wavelet coefficients for a row, column or spatial/ !
! temporal slice into a working buffer, a boundary extension operation is performed to !
! ensure an appropriate sample base. The working buffer is then transform using the wave- !
! let kernel selected for the spatial or temporal dimension and flushed back into the tile !
! parameter memory block. This operation is performed for every row, column and spatial/ !
! temporal slice for ndecomp number of decomposition levels. !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
inverse_discrete_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter);
\************************************************************************************************/
uchar initialize_gain_lut ();
//==========|==========================|======================|======|=======|====================
bwc_float get_dwt_energy_gain (bwc_field *const field,
uchar const highband_flag,
uint16 const level);
//==========|==========================|======================|======|=======|====================
uchar forward_wavelet_transform (bwc_field *const field,
uint16 const parID);
//==========|==========================|======================|======|=======|====================
uchar inverse_wavelet_transform (bwc_field *const field,
uint16 const parID);
#endif

View file

@ -0,0 +1,128 @@
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| ||
|| Big Whoop is a compression codec for the lossy compression of IEEE 754 floating ||
|| point arrays defined on curvelinear compute grids. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are ||
|| permitted provided that the following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of ||
|| conditions and the following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other ||
|| materials provided with the distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS ||
|| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ||
|| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ||
|| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ||
|| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ||
|| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ||
|| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR ||
|| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ||
|| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| ||
\*================================================================================================*/
#ifndef BWC_H
#define BWC_H
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************/
#include "types.h"
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************/
uchar create_field (bwc_field *const field);
//==========|==========================|======================|======|=======|====================
uchar adapt_tile (bwc_field *const field,
uint64 const index);
//==========|==========================|======================|======|=======|====================
bwc_field* bwc_create_field ();
//==========|==========================|======================|======|=======|====================
void bwc_free_field (bwc_field *const field);
//==========|==========================|======================|======|=======|====================
void bwc_add_param (bwc_field *const field,
char const *const name,
uint16 const sample,
uchar const dim,
uint8 const precision);
//==========|==========================|======================|======|=======|====================
void bwc_set_tiles (bwc_field *const field,
uint64 const tilesX,
uint64 const tilesY,
uint64 const tilesZ,
uint64 const tilesTS,
bwc_tile_instr const instr);
//==========|==========================|======================|======|=======|====================
void bwc_set_kernels (bwc_field *const field,
bwc_dwt_filter const KernelX,
bwc_dwt_filter const KernelY,
bwc_dwt_filter const KernelZ,
bwc_dwt_filter const KernelTS);
//==========|==========================|======================|======|=======|====================
void bwc_set_decomp (bwc_field *const field,
uint8 const numDecompX,
uint8 const numDecompY,
uint8 const numDecompZ,
uint8 const numDecompTS);
//==========|==========================|======================|======|=======|====================
void bwc_set_precincts (bwc_field *const field,
uint8 const pX,
uint8 const pY,
uint8 const pZ,
uint8 const pTS);
//==========|==========================|======================|======|=======|====================
void bwc_set_codeblocks (bwc_field *const field,
uint8 const cbX,
uint8 const cbY,
uint8 const cbZ,
uint8 const cbTS);
//==========|==========================|======================|======|=======|====================
void bwc_set_progression (bwc_field *const field,
bwc_prog_ord const progression);
//==========|==========================|======================|======|=======|====================
void bwc_set_error_resilience (bwc_field *const field);
//==========|==========================|======================|======|=======|====================
void bwc_set_quant_style (bwc_field *const field,
bwc_quant_st const quantization_style);
//==========|==========================|======================|======|=======|====================
void bwc_set_qm (bwc_field *const field,
uint8 const Qm);
//==========|==========================|======================|======|=======|====================
void bwc_set_quant_step_size (bwc_field *const field,
double delta);
//==========|==========================|======================|======|=======|====================
#if defined(_OPENMP)
void bwc_set_nThreads (bwc_field *const field,
uint8 const nThreads);
#endif
//==========|==========================|======================|======|=======|====================
void bwc_set_memory_limit (bwc_field *const field,
char *const limit);
#endif

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,383 +12,62 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| Version 0.1.1 ||
|| ||
|| File: bwc.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| This header defines DESCRIPTION NEEDED. ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| - bwc_kill_compression ||
|| - bwc_add_param ||
|| - bwc_set_quantization_style ||
|| - bwc_set_progression ||
|| - bwc_set_kernels ||
|| - bwc_set_levels ||
|| - bwc_set_codeblocks ||
|| - bwc_set_qm ||
|| - bwc_set_tiles ||
|| - bwc_initialize_compression ||
|| - bwc_create_compression ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| - Patrick Vogler B87D120 V 0.1.0 header file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| Big Whoop is a compression codec for the lossy compression of IEEE 754 floating ||
|| point arrays defined on curvelinear compute grids. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|| following conditions are met: ||
|| Redistribution and use in source and binary forms, with or without modification, are ||
|| permitted provided that the following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|| the following disclaimer. ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of ||
|| conditions and the following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|| distribution. ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other ||
|| materials provided with the distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS ||
|| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ||
|| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ||
|| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ||
|| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ||
|| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ||
|| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR ||
|| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ||
|| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| ||
\*==================================================================================================================================*/
#ifndef BWC_H
#define BWC_H
/************************************************************************************************************\
\*================================================================================================*/
#ifndef LIBBWC_H
#define LIBBWC_H
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
#include "bitstream.h"
#include "codestream.h"
#include "constants.h"
#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);
\************************************************************************************************/
uchar bwc_open_file (bwc_field *const field,
char const *const filename,
char const *const mode);
//==========|==========================|======================|======|=======|====================
uchar bwc_load_file (bwc_field *const field,
char const *const filename);
//==========|==========================|======================|======|=======|====================
uchar bwc_compress (bwc_field *const field,
char *const rate_control);
//==========|==========================|======================|======|=======|====================
uchar bwc_decompress (bwc_field *const field,
uint8 const layer);
#endif

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,129 +12,224 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: macros.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| DESCRIPTION NEEDED. ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 29.05.2017 Patrick Vogler B87D120 V 0.1.0 header file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| This file defines simple macros that are used to make the code more readable. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|| following conditions are met: ||
|| Redistribution and use in source and binary forms, with or without modification, are ||
|| permitted provided that the following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|| the following disclaimer. ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of ||
|| conditions and the following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|| distribution. ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other ||
|| materials provided with the distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS ||
|| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ||
|| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ||
|| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ||
|| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ||
|| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ||
|| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR ||
|| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ||
|| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
#ifndef BWC_MACROSS_H
#define BWC_MACROSS_H
/*----------------------------------------------------------------------------------------------------------*\
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! These Macros are used to calculate the maximum and minimum between two values. !
! !
! Macros: !
! ------- !
! Macro Description !
! ----- ----------- !
! MAX(x, y) - Returns the maximum value of two values. !
! These macros define flags used to indicate if a dataset is to be red from/ !
! written to a file or cleared in the bwc_file structure. !
! !
! MIN(x, y) - Returns the minimum value of two values. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 21.03.2018 Patrick Vogler B87D120 V 0.1.0 Macros created !
\*----------------------------------------------------------------------------------------------------------*/
#define MAX(x, y) (((x) < (y))?(y):(x))
#define MIN(x, y) (((x) > (y))?(y):(x))
\*----------------------------------------------------------------------------------------------*/
#define DATA_CLR 0x00 // Data cleared
#define DATA_INI 0x01 // Data file has been initialized
#define DATA_IN 0x10 // Data set as input
#define DATA_OUT 0x20 // Data set as output
#define DATA_STR 0x40 // Data set to be streamed to/from file
/*----------------------------------------------------------------------------------------------------------*\
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! This macro is used to evaluate the size of an array. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! These macros define flags used to indicate if a codestream is to be red from/ !
! written to a file or cleared in the bwc_file structure. !
! !
! 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)))
\*----------------------------------------------------------------------------------------------*/
#define CS_CLR 0x00 // Codestream cleared
#define CS_AUX 0x01 // Codestream contains aux. information
#define CS_COM 0x02 // Codestream contains com. information
#define CS_IN 0x10 // Codestream set as input
#define CS_OUT 0x20 // Codestream set as output
#define CS_STR 0x40 // Codestream to be streamed to/from file
/*----------------------------------------------------------------------------------------------------------*\
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These Constants describe the codestream markers used to create the embedded codestream. !
! These macros define flags used to indicate the state of the setup structure in !
! the bwc_field structure. !
! !
! 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"
\*----------------------------------------------------------------------------------------------*/
#define SETUP_CLR 0x00 // Setup cleared
#define SETUP_CMP 0x01 // Setup defined for compression
#define SETUP_DCP 0x02 // Setup defined for decompression
/*----------------------------------------------------------------------------------------------------------*\
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These Constants describe the codestream markers used to create the embedded codestream. !
! These macros define flags used to indicate the state of the bwc_field structure. !
! !
! CONSTANTS: !
! ----------- !
! Constant Description !
! -------- ----------- !
\*----------------------------------------------------------------------------------------------*/
#define FIELD_CLR 0x00 // Field cleared and ready to be used
#define FIELD_USD 0x01 // Field setup up for (de)compression
#define FIELD_ERR 0x02 // Field encountered an error
#define FIELD_VRB 0x10 // Store miscallaneous information
/*----------------------------------------------------------------------------------------------*\
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! DESCRIPTION: !
! ------------ !
! !
! 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"\
! These macros are used to identify the spatial and temporal dimensions. !
! !
\*----------------------------------------------------------------------------------------------*/
#define DIM_X 1 // 1st. spacial direction
#define DIM_Y 2 // 2nd. spacial direction
#define DIM_Z 4 // 3rd. spacial direction
#define DIM_TS 8 // temporal direction
#define DIM_ALL 15 // all dimensions
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These Constants define codestream markers used to create the embedded codestream. !
! !
\*----------------------------------------------------------------------------------------------*/
#define SOC 0xFF50 // Start of codestream
#define SGI 0xFF51 // Global data-set information
#define SGC 0xFF52 // Global control parameters
#define SGR 0xFF53 // Global tile bitstream size information
#define SAX 0xFF54 // Auxiliary data-set information
#define TLM 0xFF55 // Packet lengths: main header
#define PLM 0xFF56 // Packet lengths: tile-part
#define PPM 0xFF57 // Quantization default
#define COM 0xFF58 // Comment
#define EOH 0xFF59 // End of header
#define PLT 0xFF60 // Packed packet headers: main header
#define PPT 0xFF61 // Packed packet headers: tile-part
#define SOT 0xFF90 // Start of tile
#define SOP 0xFF91 // Start of packet
#define EPH 0xFF92 // End of packet header
#define SOD 0xFF93 // Start of data
#define EOC 0xFFFF // End of code-stream
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These macros define flags used for codestream parsing. !
! !
\*----------------------------------------------------------------------------------------------*/
#define CODESTREAM_OK 0x00 // No errors detected in Codestream
#define CODESTREAM_ERROR 0x80 // Error detexted in Codestream
#define CODESTREAM_SGI_READ 0x01 // Global data-set information read
#define CODESTREAM_SGC_READ 0x02 // Global control parameters read
#define CODESTREAM_SGR_READ 0x04 // Global register read
#define CODESTREAM_SAX_READ 0x08 // Auxiliary information block read
#define CODESTREAM_COM_READ 0x10 // Comment block read
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These macros define simple mathematicall oprators. !
! !
\*----------------------------------------------------------------------------------------------*/
#define MAX(x, y) (((x) < (y))?(y):(x)) // Returns maximum between two values
#define MIN(x, y) (((x) > (y))?(y):(x)) // Returns minimum between two values
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These macros define stream manipulation operations to rewind, forward, inquire !
! the availability and get access to the current memory position of a bwc_stream. !
! !
\*----------------------------------------------------------------------------------------------*/
#define REWIND(stream, delta) \
{ \
stream->L -= delta; \
}
#define FORWARD(stream, delta) \
{ \
stream->L += delta; \
}
#define CAN_READ(stream, length) \
{ \
((stream->L + length > stream->Lmax) ? FAILURE : SUCCESS) \
}
#define GET_ACCESS(stream) (uchar*)stream->memory + stream->L
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These Constants define common error messages used throughout the bwc library. !
! !
\*----------------------------------------------------------------------------------------------*/
#define CSTERROR "o##########################################################o\n"\
"| ERROR: Invalid Codestream |\n"\
"o##########################################################o\n"
#define FRMERROR "o##########################################################o\n"\
"| ERROR: Invalid file format. |\n"\
"o##########################################################o\n"
#define INPERROR "o##########################################################o\n"\
"| ERROR: No Input Specified. |\n"\
"o##########################################################o\n"
#define MEMERROR "o##########################################################o\n"\
"| ERROR: Out of Memory |\n"\
"o##########################################################o\n"
#define PARERROR "o##########################################################o\n"\
"| ERROR: Invalid Parameter |\n"\
"o##########################################################o\n"
#define PRCERROR "o##########################################################o\n"\
"| ERROR: Invalid Parameter Precision |\n"\
"o##########################################################o\n"
#define RDERROR "o##########################################################o\n"\
"| ERROR: Invalid Number of Bytes Read from File. |\n"\
"o##########################################################o\n"
#define WRTERROR "o##########################################################o\n"\
"| ERROR: Invalid Number of Bytes Written to File. |\n"\
"o##########################################################o\n"
#endif

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,144 +12,103 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: mq.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| ||
|| DESCRIPTION NEEDED. ||
|| | | ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 13.02.2019 Patrick Vogler B87D120 V 0.1.0 header file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|| following conditions are met: ||
|| Redistribution and use in source and binary forms, with or without modification, are ||
|| permitted provided that the following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|| the following disclaimer. ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of ||
|| conditions and the following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|| distribution. ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other ||
|| materials provided with the distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS ||
|| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ||
|| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ||
|| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ||
|| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ||
|| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ||
|| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR ||
|| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ||
|| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
#ifndef MQ_H
#define MQ_H
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
\************************************************************************************************/
#include "tier1.h"
#include "types.h"
/************************************************************************************************************\
/************************************************************************************************\
|| ____ ____ _ _ ____ ___ ____ _ _ ___ ____ ||
|| | | | |\ | [__ | |__| |\ | | [__ ||
|| |___ |__| | \| ___] | | | | \| | ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These macros define the context state indices used by the mq coder for probability estima- !
! tion. For a more thorough treatment of the context assignments see page 487 JPEG2000 by !
! David S. Taubman and Michael W. Marcellin. !
! These macros define the context state indices used by the mq coder for !
! probability estimation. For a more thorough treatment of the context assignments !
! see page 487 JPEG2000 by David S. Taubman and Michael W. Marcellin. !
! !
! Macros: !
! ------- !
! Macro Description !
! ----- ----------- !
! CONTEXT_SIG - Starting indices for the significance context labels. !
! CONTEXT_RUN - Indices for the run context label. !
! CONTEXT_SIGN - Starting indices for the sign context labels. !
! CONTEXT_MAG - Starting indices for the magnitude context labels. !
! CONTEXT_UNI - Indices for the uni context label. !
! CONTEXT_TOTAL - Total number of context labels. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 21.02.2019 Patrick Vogler B87D120 V 0.1.0 Macros created !
\*----------------------------------------------------------------------------------------------------------*/
#define CONTEXT_SIG 0
#define CONTEXT_RUN 9
#define CONTEXT_SIGN 10
#define CONTEXT_MAG 15
#define CONTEXT_UNI 18
#define CONTEXT_TOTAL 19
\*----------------------------------------------------------------------------------------------*/
#define CONTEXT_SIG 0 // Sig. context labels starting indices
#define CONTEXT_RUN 9 // Indices for the run context label
#define CONTEXT_SIGN 10 // Sign context labels starting indices
#define CONTEXT_MAG 15 // Mag. context labels starting indices
#define CONTEXT_UNI 18 // Indices for the uni context label
#define CONTEXT_TOTAL 19 // Total number of context labels
/************************************************************************************************************\
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! TYPE NAME: Template !
! ----------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
initialize_bit_encoder(bwc_coder *const coder, const uint8 number_of_contexts);
uchar
bit_encoder_next_run(bwc_bit_coder *const bitcoder);
void
bit_encode(bwc_bit_coder *const bitcoder, const uint8 s, const uint8 k);
void
bit_encoder_truncation_length_min(bwc_coder_state *const state);
void
bit_encoder_termination(bwc_bit_coder *const bitcoder);
void
free_bit_encoder(bwc_coder *const coder);
uchar
initialize_bit_decoder(bwc_coder *const coder, const uint8 number_of_contexts, const int64 Lmax);
uint8
bit_decode(bwc_bit_coder *const bitcoder, const uint8 k);
uint64
bit_coder_get_no_bytes(bwc_bit_coder *const bitcoder);
void
bit_coder_get_pass_lengths(bwc_bit_coder *const bitcoder, bwc_encoded_cblk *const encoded_cblk);
void
bit_coder_reset_ptr(bwc_bit_coder *const bitcoder, uchar *const memory);
\************************************************************************************************/
uchar initialize_mq_encoder (bwc_coder *const coder,
uint8 const numContexts);
//==========|==========================|======================|======|=======|====================
uchar mq_next_run (bwc_bit_coder *const bitcoder);
//==========|==========================|======================|======|=======|====================
void mq_bit_encode (bwc_bit_coder *const bitcoder,
uint8 const s,
uint8 const k);
//==========|==========================|======================|======|=======|====================
void mq_truncation_length_min (bwc_coder_state *const state);
//==========|==========================|======================|======|=======|====================
void mq_termination (bwc_bit_coder *const bitcoder);
//==========|==========================|======================|======|=======|====================
void free_mq_encoder (bwc_coder *const coder);
//==========|==========================|======================|======|=======|====================
uchar initialize_mq_decoder (bwc_coder *const coder,
uint8 const numContexts,
int64 const Lmax);
//==========|==========================|======================|======|=======|====================
uint8 mq_bit_decode (bwc_bit_coder *const bitcoder,
uint8 const k);
//==========|==========================|======================|======|=======|====================
uint64 mq_get_no_bytes (bwc_bit_coder *const bitcoder);
//==========|==========================|======================|======|=======|====================
void mq_get_pass_lengths (bwc_bit_coder *const bitcoder,
bwc_encoded_blk *const encoded_cblk);
//==========|==========================|======================|======|=======|====================
void mq_reset_ptr (bwc_bit_coder *const bitcoder,
uchar *const memory);
#endif

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,211 +12,110 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: prim_types_double.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| This header defines a set of derrived types used for the mq encoder during the entropy encoding stage of the big whoop ||
|| compression algorithm. ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| - bwc_context_state ||
|| - bwc_coder_state ||
|| - bwc_bit_coder ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 20.02.2019 Patrick Vogler B87D120 V 0.1.0 header file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| This header defines a the bit coder and its context states used during the ||
|| entropy encoding stage of the BigWhoop compression library. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|| following conditions are met: ||
|| Redistribution and use in source and binary forms, with or without modification, are ||
|| permitted provided that the following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|| the following disclaimer. ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of ||
|| conditions and the following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|| distribution. ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other ||
|| materials provided with the distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS ||
|| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ||
|| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ||
|| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ||
|| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ||
|| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ||
|| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR ||
|| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ||
|| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
#ifndef MQ_TYPES_H
#define MQ_TYPES_H
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
\************************************************************************************************/
#include <stdint.h>
/************************************************************************************************************\
/************************************************************************************************\
|| ___ ____ ____ ____ _ _ _ ____ ___ ___ _ _ ___ ____ ____ ||
|| | \ |___ |__/ |__/ | | | |___ | \ | \_/ |__] |___ [__ ||
|| |__/ |___ | \ | \ | \/ |___ |__/ | | | |___ ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! STRUCT NAME: bwc_context_state !
! ----------- !
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! - !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! p unsigned int(16 bit) - LPS Probability estimate. !
! This structure is used to directly access the parameter codeblocks during !
! entropy (de-)encoding to facilitate shared memory parallelization. !
! !
! sk unsigned int(8 bit) - Most Probable Symbol. !
! !
! DEPENDENCIES: !
! ------------- !
! Variable Type Description !
! -------- ---- ----------- !
! MPS context* - New context if the coded symbol is a !
! Most Probable Symbol (MPS). !
! !
! LPS context* - New context if the coded symbol is a !
! Least Probable Symbol (LPS). !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 14.02.2019 Patrick Vogler B87D120 V 0.1.0 struct created !
! !
\*----------------------------------------------------------------------------------------------------------*/
\*----------------------------------------------------------------------------------------------*/
typedef struct context
{
uint16_t p;
uint8_t sk;
const struct context *const MPS;
const struct context *const LPS;
uint16_t p; // LPS probability estimate
uint8_t sk; // Most probable symbol
const struct context *const MPS; // New context for Most Probable Symbol
const struct context *const LPS; // New context for Least Probable Symbol
} bwc_context_state;
/*----------------------------------------------------------------------------------------------------------*\
! STRUCT NAME: bwc_coder_state !
! ----------- !
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! - !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! L int(64 bit) - Number of code bytes which have been !
! generated so far. !
! DESCRIPTION NEEDED !
! | | !
! !
! C unsigned int(32 bit) - Lower bound register used to define !
! the lower bound of the coding interval. !
! !
! A unsigned int(16 bit) - Length register used to define the up- !
! bound of the coding interval. !
! !
! t int(8 bit) - Down counter which is used to evaluate !
! when partially generated code bits !
! should be moved out of the C register !
! in to the temporary byte buffer b. !
! !
! b unsigned char* - Byte buffer. !
! !
! T unsigned char - Temporary byte buffer. !
! !
! DEPENDENCIES: !
! ------------- !
! Variable Type Description !
! -------- ---- ----------- !
! next state* - Coder state of the next coding pass. !
! !
! prev state* - Coder state of the previous coding !
! pass. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 14.02.2019 Patrick Vogler B87D120 V 0.1.0 struct created !
! !
\*----------------------------------------------------------------------------------------------------------*/
\*----------------------------------------------------------------------------------------------*/
typedef struct state
{
int64_t L;
uint32_t C;
uint16_t A;
int8_t t;
unsigned char *b;
unsigned char T;
struct state *next;
struct state *prev;
int64_t L; // Number of bytes generated so far
uint32_t C; // Register def. lower bound of coding int
uint16_t A; // Register def. upper bound of coding int
int8_t t; // Counter evaluating when moving C into b
unsigned char *b; // Byte buffer
unsigned char T; // Temporary byte buffer
struct state *next; // State of the next coding phase
struct state *prev; // State of the previous coding phase
} bwc_coder_state;
/*----------------------------------------------------------------------------------------------------------*\
! STRUCT NAME: bwc_bit_coder !
! ----------- !
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! - !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! Lmax unsigned int(64 bit) - Number of code bytes (used by decoder). !
! DESCRIPTION NEEDED !
! | | !
! !
! nContext unsigned int(8 bit) - Number of context states that need to !
! be tracked during (de)compression. !
! !
! b unsigned char* - Temporary byte buffer. !
! !
! DEPENDENCIES: !
! ------------- !
! Variable Type Description !
! -------- ---- ----------- !
! state bwc_coder_state* - Coder state for the current coding !
! pass. !
! !
! context bwc_coder_state* - Context states for the current coding !
! pass. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 14.02.2019 Patrick Vogler B87D120 V 0.1.0 struct created !
! !
\*----------------------------------------------------------------------------------------------------------*/
\*----------------------------------------------------------------------------------------------*/
typedef struct
{
int64_t Lmax;
uint8_t nContext;
unsigned char *b;
bwc_coder_state *state;
bwc_context_state const **context;
int64_t Lmax; // Number of code bytes (used by decoder)
uint8_t nContext; // No. tracked context states
unsigned char *b; // Temporary byte buffer
bwc_coder_state *state; // State for the current coding pass
bwc_context_state const **context; // States for the current coding pass
} bwc_bit_coder;
#endif

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,62 +12,52 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: prim_types_double.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| This header defines a set of basic arithmetic types with specified widths to be used in ||
|| the big whoop compression algorithm. The width of an arithmetic type is defined as the ||
|| number of bits used to store its value. ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 07.12.2017 Patrick Vogler B87D120 V 0.1.0 header file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| This header defines a set of basic arithmetic types with specified widths to be ||
|| used in the big whoop compression algorithm. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|| following conditions are met: ||
|| Redistribution and use in source and binary forms, with or without modification, are ||
|| permitted provided that the following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|| the following disclaimer. ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of ||
|| conditions and the following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|| distribution. ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other ||
|| materials provided with the distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS ||
|| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ||
|| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ||
|| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ||
|| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ||
|| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ||
|| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR ||
|| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ||
|| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
#ifndef BWC_PRIM_TYPES_DOUBLE_H
#define BWC_PRIM_TYPES_DOUBLE_H
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
\************************************************************************************************/
#include <stdint.h>
/************************************************************************************************************\
/************************************************************************************************\
|| ___ ____ _ _ _ _ ___ _ _ _ ____ ___ _ _ ___ ____ ____ ||
|| |__] |__/ | |\/| | | | | | |___ | \_/ |__] |___ [__ ||
|| | | \ | | | | | | \/ |___ | | | |___ ___] ||
|| ||
\************************************************************************************************************/
\************************************************************************************************/
typedef unsigned char uchar;
typedef unsigned short ushort;
typedef unsigned int uint;
@ -84,80 +74,60 @@
typedef double bwc_float;
typedef uint64 bwc_raw;
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These constants describe the minimum and maximum values for a double precision IEEE 754 !
! floating point variable. !
! These macros describe the minimum and maximum values for a double precision IEEE !
! 754 floating point variable. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 07.12.2018 Patrick Vogler B87D120 V 0.1.0 Constants created !
\*----------------------------------------------------------------------------------------------------------*/
#define FLT_MAX 1.7976931348623157e+308
#define FLT_MIN 2.2250738585072014e-308
\*----------------------------------------------------------------------------------------------*/
#define FLT_MAX 1.7976931348623157e+308 // Maximum finite value of a double
#define FLT_MIN 2.2250738585072014e-308 // Minimum finite value of a double
/*----------------------------------------------------------------------------------------------------------*\
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These constants describe the precision (in bits and bytes) of the primitive floating point !
! type used during (de)compression as well as the number of bits used to represent the !
! mantissa and exponent fields. !
! These macros describe the precision (in bits and bytes) of the derrived floating !
! point type as well as the number of bits used to represent its mantissa and !
! exponent fields. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 07.12.2018 Patrick Vogler B87D120 V 0.1.0 Constants created !
\*----------------------------------------------------------------------------------------------------------*/
#define PREC_BIT 63
#define PREC_MANTISSA 52
#define PREC_EXPONENT 11
#define PREC_BYTE 8
\*----------------------------------------------------------------------------------------------*/
#define PREC_BIT 63 // Double type precision in bits
#define PREC_MANTISSA 52 // Mantissa field precision in bits
#define PREC_EXPONENT 11 // Exponent field precision in bits
#define PREC_BYTE 8 // Double type precision in bytes
/*----------------------------------------------------------------------------------------------------------*\
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These constants describe the bit masks used to access the sign, mantissa and exponent of !
! the primitive floating point type used during (de)compression. !
! These macros describe the bit masks used to access the sign, mantissa and !
! exponent of the derrived floating point type. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 07.12.2018 Patrick Vogler B87D120 V 0.1.0 Constants created !
\*----------------------------------------------------------------------------------------------------------*/
#define SIGN 0x8000000000000000
#define MANTISSA 0x000FFFFFFFFFFFFF
#define EXPONENT 0x7FF0000000000000
\*----------------------------------------------------------------------------------------------*/
#define SIGN 0x8000000000000000 // Sign bit mask
#define MANTISSA 0x000FFFFFFFFFFFFF // Mantissa bit mask
#define EXPONENT 0x7FF0000000000000 // Exponent bit mask
/*----------------------------------------------------------------------------------------------------------*\
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! This constants describe the maximum number of encoding passes during the entropy encoding !
! stage. !
! This macro describe the maximum number of possible encoding passes during the !
! entropy encoding stage. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 03.07.2018 Patrick Vogler B87D120 V 0.1.0 Constants created !
\*----------------------------------------------------------------------------------------------------------*/
\*----------------------------------------------------------------------------------------------*/
#define MAXIMUM_NO_PASSES (64 * 3) - 2
#endif

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,62 +12,52 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: prim_types_single.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| This header defines a set of basic arithmetic types with specified widths to be used in ||
|| the big whoop compression algorithm. The width of an arithmetic type is defined as the ||
|| number of bits used to store its value. ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 07.12.2017 Patrick Vogler B87D120 V 0.1.0 header file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| This header defines a set of basic arithmetic types with specified widths to be ||
|| used in the big whoop compression algorithm. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|| following conditions are met: ||
|| Redistribution and use in source and binary forms, with or without modification, are ||
|| permitted provided that the following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|| the following disclaimer. ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of ||
|| conditions and the following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|| distribution. ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other ||
|| materials provided with the distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS ||
|| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ||
|| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ||
|| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ||
|| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ||
|| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ||
|| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR ||
|| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ||
|| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
#ifndef BWC_PRIM_TYPES_SINGLE_H
#define BWC_PRIM_TYPES_SINGLE_H
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
\************************************************************************************************/
#include <stdint.h>
/************************************************************************************************************\
/************************************************************************************************\
|| ___ ____ _ _ _ _ ___ _ _ _ ____ ___ _ _ ___ ____ ____ ||
|| |__] |__/ | |\/| | | | | | |___ | \_/ |__] |___ [__ ||
|| | | \ | | | | | | \/ |___ | | | |___ ___] ||
|| ||
\************************************************************************************************************/
\************************************************************************************************/
typedef unsigned char uchar;
typedef unsigned short ushort;
typedef unsigned int uint;
@ -84,80 +74,60 @@
typedef float bwc_float;
typedef uint32 bwc_raw;
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These constants describe the minimum and maximum values for a double precision IEEE 754 !
! floating point variable. !
! These macros describe the minimum and maximum values for a single precision IEEE !
! 754 floating point variable. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 07.12.2018 Patrick Vogler B87D120 V 0.1.0 Constants created !
\*----------------------------------------------------------------------------------------------------------*/
#define FLT_MAX 1.70141183e+38
#define FLT_MIN 1.17549435e-38
\*----------------------------------------------------------------------------------------------*/
#define FLT_MAX 1.70141183e+38 // Maximum finite value of a float
#define FLT_MIN 1.17549435e-38 // Minimum finite value of a float
/*----------------------------------------------------------------------------------------------------------*\
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These constants describe the precision (in bits and bytes) of the primitive floating point !
! type used during (de)compression as well as the number of bits used to represent the !
! mantissa and exponent fields. !
! These macros describe the precision (in bits and bytes) of the derrived floating !
! point type as well as the number of bits used to represent its mantissa and !
! exponent fields. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 07.12.2018 Patrick Vogler B87D120 V 0.1.0 Constants created !
\*----------------------------------------------------------------------------------------------------------*/
#define PREC_BIT 31
#define PREC_MANTISSA 23
#define PREC_EXPONENT 8
#define PREC_BYTE 4
\*----------------------------------------------------------------------------------------------*/
#define PREC_BIT 31 // Float type precision in bits
#define PREC_MANTISSA 23 // Mantissa field precision in bits
#define PREC_EXPONENT 8 // Exponent field precision in bits
#define PREC_BYTE 4 // Float type precision in bytes
/*----------------------------------------------------------------------------------------------------------*\
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These constants describe the bit masks used to access the sign, mantissa and exponent of !
! the primitive floating point type used during (de)compression. !
! These macros describe the bit masks used to access the sign, mantissa and !
! exponent of the derrived floating point type. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 07.12.2018 Patrick Vogler B87D120 V 0.1.0 Constants created !
\*----------------------------------------------------------------------------------------------------------*/
#define SIGN 0x80000000
#define MANTISSA 0x007FFFFF
#define EXPONENT 0x7F800000
\*----------------------------------------------------------------------------------------------*/
#define SIGN 0x80000000 // Sign bit mask
#define MANTISSA 0x007FFFFF // Mantissa bit mask
#define EXPONENT 0x7F800000 // Exponent bit mask
/*----------------------------------------------------------------------------------------------------------*\
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! This constants describe the maximum number of encoding passes during the entropy encoding !
! stage. !
! This macro describe the maximum number of possible encoding passes during the !
! entropy encoding stage. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 03.07.2018 Patrick Vogler B87D120 V 0.1.0 Constants created !
\*----------------------------------------------------------------------------------------------------------*/
\*----------------------------------------------------------------------------------------------*/
#define MAXIMUM_NO_PASSES (32 * 3) - 2
#endif

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,150 +12,83 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: tagtree.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| DESCRIPTION NEEDED. ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| This file defines a tagtree procedure used to encode/decode two types of ||
|| information found defining in a codeblock in specific quality layer: ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| - The inclusion tag records if a codeblock has any contribution ||
|| to a quality layer. ||
|| - The number of leading bitplanes that are not significant/only ||
|| populated by zero bits. ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 18.05.2018 Patrick Vogler B87D120 V 0.1.0 header file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| For more information on the encoding/decoding process please refere to JPEG2000 ||
|| by D. S. Taubman and M. W. Marcellin (p. 384). ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|| following conditions are met: ||
|| Redistribution and use in source and binary forms, with or without modification, are ||
|| permitted provided that the following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|| the following disclaimer. ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of ||
|| conditions and the following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|| distribution. ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other ||
|| materials provided with the distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS ||
|| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ||
|| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ||
|| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ||
|| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ||
|| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ||
|| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR ||
|| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ||
|| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
#ifndef TAGTREE_H
#define TAGTREE_H
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
\************************************************************************************************/
#include "types.h"
/************************************************************************************************************\
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void kill_tagtree(bwc_tagtree* tagtree) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function deallocates a tagtree instance used to encode codeblock contributions to a !
! specific quality layer as well as the number of magnitude bit planes used to represent the !
! samples of a specific codeblock. !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
kill_tagtree(bwc_tagtree* tagtree);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
reset_tagtree(bwc_tagtree* const tagtree);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
uint16
tagtree_get_value(const bwc_tagtree* const tagtree, const uint64 leaf_index);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
tagtree_set_value(bwc_tagtree* const tagtree, const uint64 leaf_index, const uint16 value);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
bwc_tagtree*
initialize_tagtree(const uint64 leafsX, const uint64 leafsY, const uint64 leafsZ, const uint64 leafsTS);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
encode_tagtree(bwc_tagtree *const tagtree, bwc_stream *const stream, const uint32 threshold, const uint32 leaf_index, const uchar estimate);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
decode_tagtree(bwc_tagtree *const tagtree, bwc_stream *const stream, const uint32 threshold, const uint32 leaf_index);
\************************************************************************************************/
void kill_tagtree (bwc_tagtree *const tagtree);
//==========|==========================|======================|======|=======|====================
uchar initialize_tagtree (bwc_tagtree *const tagtree,
uint64 const leafsX,
uint64 const leafsY,
uint64 const leafsZ,
uint64 const leafsTS);
//==========|==========================|======================|======|=======|====================
uint16 tagtree_get_value (bwc_tagtree const *const tagtree,
uint64 const leaf_index);
//==========|==========================|======================|======|=======|====================
void tagtree_set_value (bwc_tagtree *const tagtree,
uint64 const leaf_index,
uint16 const value);
//==========|==========================|======================|======|=======|====================
void encode_tagtree (bwc_tagtree *const tagtree,
bwc_stream *const stream,
uint32 const threshold,
uint32 const leaf_index,
uchar const estimate);
//==========|==========================|======================|======|=======|====================
uchar decode_tagtree (bwc_tagtree *const tagtree,
bwc_stream *const stream,
uint32 const threshold,
uint32 const leaf_index);
#endif

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,142 +12,149 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: tier1.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| DESCRIPTION NEEDED. ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| - Patrick Vogler B87D120 V 0.1.0 header file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| This file describes a set of functions that can be used to de-/encode bwc ||
|| codeblocks described by the bwc_field structure according to the embedded block ||
|| coding paradigm described by the JPEG 2000 standard. For more information please ||
|| refere to JPEG2000 by D. S. Taubman and M. W. Marcellin. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|| following conditions are met: ||
|| Redistribution and use in source and binary forms, with or without modification, are ||
|| permitted provided that the following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|| the following disclaimer. ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of ||
|| conditions and the following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|| distribution. ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other ||
|| materials provided with the distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS ||
|| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ||
|| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ||
|| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ||
|| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ||
|| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ||
|| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR ||
|| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ||
|| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
#ifndef TIER1_H
#define TIER1_H
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
\************************************************************************************************/
#include "types.h"
/************************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
/************************************************************************************************\
|| ___ ____ ____ ____ _ _ _ ____ ___ ___ _ _ ___ ____ ____ ||
|| | \ |___ |__/ |__/ | | | |___ | \ | \_/ |__] |___ [__ ||
|| |__/ |___ | \ | \ | \/ |___ |__/ | | | |___ ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! This macro defines the maximum decomposition level up to which the wavelet filer energy gain !
! is calculated. Beyond the maximum decomposition level the energy gain will only be !
! approximated. !
! DESCRIPTION NEEDED !
! | | !
! !
! Macros: !
! ------- !
! Macro Description !
! ----- ----------- !
! MAX_DECOMPOSITION_LEVELS - Maximum number of wavelet layers for which the energy !
! gain is calculated. !
\*----------------------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------------------------------------------*\
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! DESCRIPTION: !
! ------------ !
! This structure holds the sign (xi), bitfield (bit) and state (delta, sigma and pi) !
! information for four vertically adjacent samples for easy access during the !
! entropy encoding stage. Here, the delayed significance is set once the first bit !
! is encoded during the magnitude refinement pass, while the significance state !
! sigma is set once the first non-zero bit is encoded for a specific sample. !
! The stripe_* pointers are used to store the address of the left(l), upper(u), !
! right(r) and lower(d) neighbour of a specific stripe for easy access. To !
! facilitate distortion estimation the magnitude of the wavelet coefficients is !
! stored in an appropriate sample array. !
! !
! 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
\*------------------------------------------------------------------------------------------------------------------*/
typedef struct stripe
{
uint64 *sample; // Wavelet coeff. for two adjacent stripes.
/*----------------------------------------------------------------------------------------------------------*\
uint8 delta; // Delayed sig. for two adjacent stripes.
uint8 sigma; // Significance for two adjacent stripes.
uint8 pi; // Coding pass membership for adj. stripes.
uint8 codingpass; // Last decoded coding pass.
uint8 bitplane; // Last decoded bitplane.
uint8 *bit; // Bitplanes for vertically adj. stripes.
uint8 xi; // Wavelet coef. sign bit for adj. stripes.
struct stripe *stripe_u; // Upper stripe.
struct stripe *stripe_r; // Right stripe.
struct stripe *stripe_d; // Lower stripe.
struct stripe *stripe_l; // Left stripe.
} bwc_coder_stripe;
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These macros define the irrational coefficients for the high and low pass synthesis filters !
! associated with the (5-3) LeGall-Wavelet. !
! DESCRIPTION NEEDED !
! | | !
! !
! 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. !
! DESCRIPTION: !
! ------------ !
! This structure accumulates all necessary structures used to (de-)compress a !
! codeblock of wavelet coefficients. The spatial and temporal dimension of the !
! codeblock is defined by its width, height and number of slices (depth * dt). The !
! codeblock itself is subdivided into so-called stripes that represent 4 vertically !
! adjacent coefficients. The parameter no_full_stripes stores overnumber of full !
! stripes present in one slice. !
! The look-up table sig2context is used to determine the coding context of a current !
! bit according to its significance context within the codeblock bitplane. The !
! look-up table is specific to a certain highband and is set accordingly. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 20.03.2018 Patrick Vogler B87D120 V 0.1.0 Macros created !
\*----------------------------------------------------------------------------------------------------------*/
#define DWT_5X3_H0 1.0f
#define DWT_5X3_H1 0.5f
\*------------------------------------------------------------------------------------------------------------------*/
typedef struct
{
uchar resilience; // Flag signaling error resilience.
#define DWT_5X3_G0 0.75f
#define DWT_5X3_G1 -0.25f
#define DWT_5X3_G2 -0.125f
uint64 no_full_stripe; // Number of full, vert. adjacent stripes.
uint64 width, height; // Codeblock width and height.
uint64 no_slice; // Number of slices in the spec. codeblock.
/************************************************************************************************************\
uint8 const *sig2context; // Signifance-to-context loop-up table.
bwc_bit_coder *bitcoder; // BWC bitcoder.
bwc_coder_stripe *data; // BWC coder stripe.
uint64 buff_size; // Size of packed stream.
uint64 buff_incr; // Increment for packed stream assembly.
uchar *compressed; // Compressed data chunck.
} bwc_coder;
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! TYPE NAME: Template !
! ----------- !
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
t1_encode(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const parameter);
uchar
t1_decode(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const parameter);
\************************************************************************************************/
uchar t1_encode (bwc_field *const field,
uint16 const parID);
//==========|==========================|======================|======|=======|====================
uchar t1_decode (bwc_field *const field,
uint16 const parID);
#endif

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,122 +12,73 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| File: tier2.h ||
|| ----- ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| DESCRIPTION NEEDED. ||
|| ||
|| STRUCTS: ||
|| -------- ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| - t2_encode ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| - Patrick Vogler B87D120 V 0.1.0 header file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| This file describes a set of functions that can be used to de-/encode bwc ||
|| codeblocks described by the bwc_field structure according to the embedded block ||
|| coding paradigm described by the JPEG 2000 standard. For more information please ||
|| refere to JPEG2000 by D. S. Taubman and M. W. Marcellin. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|| following conditions are met: ||
|| Redistribution and use in source and binary forms, with or without modification, are ||
|| permitted provided that the following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|| the following disclaimer. ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of ||
|| conditions and the following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|| distribution. ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other ||
|| materials provided with the distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS ||
|| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ||
|| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ||
|| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ||
|| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ||
|| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ||
|| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR ||
|| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ||
|| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| ||
\*==================================================================================================================================*/
\*================================================================================================*/
#ifndef TIER2_H
#define TIER2_H
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
\************************************************************************************************/
#include "types.h"
/************************************************************************************************************\
/************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! This macro defines the initial packet header size. !
! Definition of the initial codestream packet header size. !
! !
! Macros: !
! ------- !
! Macro Description !
! ----- ----------- !
! PACKET_HEADER_SIZE - Initial packet header size. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 10.05.2019 Patrick Vogler B87D120 V 0.1.0 Macros created !
\*----------------------------------------------------------------------------------------------------------*/
\*----------------------------------------------------------------------------------------------*/
#define PACKET_HEADER_SIZE 512
/************************************************************************************************************\
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: uchar t2_encode(bwc_field *const field, bwc_tile *const tile) !
! -------------- !
! !
! DESCRIPTION: !
! ------------ !
! This function defines the rate control portion of the entropy encoding stage. In !
! the first step, the quality layers are evaluated according to the bitrates de- !
! fined by the user. The quality layers are then used to create the data packets !
! that comprise the bwc codestream. !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
t2_encode(bwc_field *const field, bwc_tile *const tile);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: uchar parse_packet(bwc_field *const field, bwc_tile *const tile, !
! -------------- bwc_packet *const packet, !
! uint64 const body_size) !
! !
! DESCRIPTION: !
! ------------ !
! This function is used to parse a codestream packet for a given precinct (prec_idx) !
! and quality layer (q_layer). !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
parse_packet(bwc_field *const field, bwc_tile *const tile,
\************************************************************************************************/
uchar t2_encode (bwc_field *const field);
//==========|==========================|======================|======|=======|====================
uchar parse_packet (bwc_field *const field,
bwc_packet *const packet,
uint64 const body_size);
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
/*====================================================================================================================*\
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -14,337 +14,89 @@
|| ||
|| 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. ||
|| ||
|| ||
|| ------------------------------------------------------------------------------------------------------ ||
|| This is a simple command line tool that uses the Big Whoop library to (de) ||
|| compress a 2- to 4-dimensional IEEE 754 floating point array. For further ||
|| information use the --help (-h) argument in the command-line or consult the ||
|| appropriate README file. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are permitted ||
|| provided that the following conditions are met: ||
|| Redistribution and use in source and binary forms, with or without modification, are ||
|| permitted provided that the following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of ||
|| conditions and the following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other materials ||
|| provided with the distribution. ||
|| of conditions and the following disclaimer in the documentation and/or other ||
|| materials provided with the distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED ||
|| WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A ||
|| PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ||
|| ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ||
|| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ||
|| INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR ||
|| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ||
|| ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS ||
|| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ||
|| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ||
|| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ||
|| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ||
|| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ||
|| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR ||
|| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ||
|| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| ||
\*====================================================================================================================*/
\*================================================================================================*/
#ifndef BWC_CMDL_H
#define BWC_CMDL_H
/********************************************************************************************************************\
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\********************************************************************************************************************/
\************************************************************************************************/
#include <inttypes.h>
/********************************************************************************************************************\
/************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\********************************************************************************************************************/
/*------------------------------------------------------------------------------------------------------------------*\
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! This macro removes a user supplied deliminator from a string: !
! !
! 9/9/7/2 -> 9 9 7 2. !
! !
\*----------------------------------------------------------------------------------------------*/
#define remove_deliminator(arg, end, delim) \
{ \
for(end = arg; *end; end++) \
*end = (*end == delim ? ' ' : *end); \
}
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These 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))
\*----------------------------------------------------------------------------------------------*/
#define MAX(x, y) (((x) < (y))?(y):(x)) // Returns maximum between two values
#define MIN(x, y) (((x) > (y))?(y):(x)) // Returns minimum between two values
/*------------------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
/*----------------------------------------------------------------------------------------------*\
! !
! These Constants define 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

View file

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

View file

@ -1,9 +1,9 @@
#/=====================================================================================================================\#
#*================================================================================================*#
#| |#
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
#! | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
@ -15,79 +15,51 @@
#| DESCRIPTION: |#
#| ------------ |#
#| |#
#| This file defines a Python interface for the Big Whoop compression library |#
#| |#
#| FUNCTIONS: |#
#| ---------- |#
#| - bwc_free_field |#
#| - bwc_add_param |#
#| - bwc_set_tiles |#
#| - bwc_set_kernels |#
#| - bwc_set_decomp |#
#| - bwc_set_precincts |#
#| - bwc_set_codeblocks |#
#| - bwc_set_progression |#
#| - bwc_set_error_resilience |#
#| - bwc_set_quantization_style |#
#| - bwc_set_qm |#
#| - bwc_set_quantization_step_size |#
#| - bwc_set_nThreads |#
#| - bwc_set_memory_limit |#
#| - bwc_compress |#
#| - bwc_decompress |#
#| |#
#| |#
#| DEVELOPMENT HISTORY: |#
#| -------------------- |#
#| |#
#| Date Author Change Id Release Description |#
#| ---- ------ --------- ------- ----------- |#
#| 17.03.2021 Patrick Vogler B87D120 V 0.1.0 Python Module created |#
#| |#
#| |#
#| ------------------------------------------------------------------------------------------------------ |#
#| This file defines a Python interface for the Big Whoop compression library. |#
#| |#
#| -------------------------------------------------------------------------------------------- |#
#| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart |#
#| |#
#| Redistribution and use in source and binary forms, with or without modification, are permitted |#
#| provided that the following conditions are met: |#
#| Redistribution and use in source and binary forms, with or without modification, are |#
#| permitted provided that the following conditions are met: |#
#| |#
#| (1) Redistributions of source code must retain the above copyright notice, this list of |#
#| conditions and the following disclaimer. |#
#| |#
#| (2) Redistributions in binary form must reproduce the above copyright notice, this list |#
#| of conditions and the following disclaimer in the documentation and/or other materials |#
#| provided with the distribution. |#
#| of conditions and the following disclaimer in the documentation and/or other |#
#| materials provided with the distribution. |#
#| |#
#| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED |#
#| WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |#
#| PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR |#
#| ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |#
#| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |#
#| INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |#
#| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |#
#| ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |#
#| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS |#
#| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |#
#| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |#
#| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |#
#| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |#
#| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |#
#| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |#
#| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |#
#| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |#
#| |#
#\=====================================================================================================================/#
#/=====================================================================================================================\#
#*================================================================================================*#
#**************************************************************************************************#
#| _ _ _ ____ _ _ _ ___ ____ |#
#| | |\ | | | | | | \ |___ |#
#| | | \| |___ |___ |__| |__/ |___ |#
#| |#
#\=====================================================================================================================/#
#**************************************************************************************************#
import ctypes
from numpy.ctypeslib import ndpointer
from enum import Enum
libbwc = ctypes.cdll.LoadLibrary("../../../lib/libbwc.so")
libbwc = ctypes.cdll.LoadLibrary("../lib/libbwc.so")
#/=====================================================================================================================\#
#**************************************************************************************************#
#| ____ ____ _ _ ____ ___ ____ _ _ ___ ____ |#
#| | | | |\ | [__ | |__| |\ | | [__ |#
#| |___ |__| | \| ___] | | | | \| | ___] |#
#| |#
#\=====================================================================================================================/#
#**************************************************************************************************#
class _const():
class DWT(Enum):
CDF_9_7 = 0
@ -106,116 +78,140 @@ class _const():
NUMBOF = 1
const = _const()
#/=====================================================================================================================\#
#**************************************************************************************************#
#| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ |#
#| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ |#
#| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] |#
#| |#
#\=====================================================================================================================/#
def free_data(data):
fun = libbwc.bwc_free_data
fun.restype = None
fun.argtypes = [ctypes.c_void_p]
fun(data)
#=======================================================================================================================#
def initialize_data(data, nX, nY, nZ, nTS, nPar, file_extension):
fun = libbwc.bwc_initialize_data
#**************************************************************************************************#
def create_field():
fun = libbwc.bwc_create_field
fun.restype = ctypes.c_void_p
fun.argtypes = [ndpointer(ctypes.c_double, flags="C_CONTIGUOUS"),
ctypes.c_uint64,
ctypes.c_uint64,
ctypes.c_uint64,
ctypes.c_uint16,
ctypes.c_uint8,
ctypes.c_char_p]
return ctypes.c_void_p(fun(data, nX, nY, nZ, nTS, nPar, file_extension.encode('utf-8')))
#=======================================================================================================================#
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.argtypes = None
return ctypes.c_void_p(fun())
#==================================================================================================#
def free_field(field):
fun = libbwc.bwc_free_field
fun.restype = None
fun.argtypes = [ctypes.c_void_p]
fun(field)
#=======================================================================================================================#
def initialize_field(data):
fun = libbwc.bwc_initialize_field
fun.restype = ctypes.c_void_p
fun.argtypes = [ctypes.c_void_p]
return ctypes.c_void_p(fun(data))
#=======================================================================================================================#
def set_nThreads(field, nThreads):
fun = libbwc.bwc_set_nThreads
#==================================================================================================#
def add_param(field, name, sample, dim, precision):
fun = libbwc.bwc_add_param
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)
#=======================================================================================================================#
fun.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_int16, ctypes.c_int8, ctypes.c_int8]
fun(field, name.encode('utf-8'), sample, dim, precision)
#==================================================================================================#
def set_tiles(field, tilesX, tilesY, tilesZ, tilesTS, instr):
fun = libbwc.bwc_set_tiles
fun.restype = None
fun.argtypes = [ctypes.c_void_p, ctypes.c_uint64, ctypes.c_uint64, ctypes.c_uint64, ctypes.c_uint64, ctypes.c_char_p]
fun.argtypes = [ctypes.c_void_p, ctypes.c_uint64, ctypes.c_uint64,
ctypes.c_uint64, ctypes.c_uint64,
ctypes.c_char_p]
fun(field, tilesX, tilesY, tilesZ, tilesTS, instr.encode('utf-8'))
#=======================================================================================================================#
#==================================================================================================#
def set_kernels(field, KernelX, KernelY, KernelZ, KernelTS):
fun = libbwc.bwc_set_kernels
fun.restype = None
fun.argtypes = [ctypes.c_void_p, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
fun(field, KernelX, KernelY, KernelZ, KernelTS)
#==================================================================================================#
def set_decomp(field, KernelX, KernelY, KernelZ, KernelTS):
fun = libbwc.bwc_set_decomp
fun.restype = None
fun.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint8, ctypes.c_uint8, ctypes.c_uint8]
fun(field, numDecompX, numDecompY, numDecompZ, numDecompTS)
#==================================================================================================#
def set_precincts(field, pX, pY, pZ, pTS):
fun = libbwc.bwc_set_precincts
fun.restype = None
fun.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint8, ctypes.c_uint8, ctypes.c_uint8]
fun(field, pX, pY, pZ, pTS)
#=======================================================================================================================#
def create_compression(field, rate_control):
fun = libbwc.bwc_create_compression
#==================================================================================================#
def set_codeblocks(field, cbX, cbY, cbZ, cbTS):
fun = libbwc.bwc_set_codeblocks
fun.restype = None
fun.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint8, ctypes.c_uint8, ctypes.c_uint8]
fun(field, cbX, cbY, cbZ, cbTS)
#==================================================================================================#
def set_progression(field, progression):
fun = libbwc.bwc_set_progression
fun.restype = None
fun.argtypes = [ctypes.c_void_p, ctypes.c_int]
fun(field, progression)
#==================================================================================================#
def set_error_resilience(field):
fun = libbwc.bwc_set_error_resilience
fun.restype = None
fun.argtypes = [ctypes.c_void_p]
fun(field)
#==================================================================================================#
def set_quantization_style(field, quantization_style):
fun = libbwc.bwc_set_quant_style
fun.restype = None
fun.argtypes = [ctypes.c_void_p, ctypes.c_int]
fun(field, quantization_style)
#==================================================================================================#
def set_qm(field, Qm):
fun = libbwc.bwc_set_qm
fun.restype = None
fun.argtypes = [ctypes.c_void_p, ctypes.c_int8]
fun(field, Qm)
#==================================================================================================#
def set_quantization_step_size(field, delta):
fun = libbwc.bwc_set_quant_step_size
fun.restype = None
fun.argtypes = [ctypes.c_void_p, ctypes.c_double]
fun(field, delta)
#==================================================================================================#
def set_nThreads(field, nThreads):
fun = libbwc.bwc_set_nThreads
fun.restype = None
fun.argtypes = [ctypes.c_void_p, ctypes.c_int8]
fun(field, nThreads)
#==================================================================================================#
def set_memory_limit(field, limit):
fun = libbwc.bwc_set_memory_limit
fun.restype = None
fun.argtypes = [ctypes.c_void_p, ctypes.c_char_p]
fun(field, rate_control.encode('utf-8'))
#=======================================================================================================================#
def compress(field, data):
fun(field, limit.encode('utf-8'))
#==================================================================================================#
def open_file(field, filename, mode):
fun = libbwc.bwc_open_file
fun.restype = ctypes.c_int8
fun.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p]
res = fun(field, filename.encode('utf-8'), mode.encode('utf-8'))
if res == 1:
raise Exception()
#==================================================================================================#
def load_file(field, filename):
fun = libbwc.bwc_load_file
fun.restype = ctypes.c_int8
fun.argtypes = [ctypes.c_void_p, ctypes.c_char_p]
res = fun(field, filename.encode('utf-8'))
if res == 1:
raise Exception()
#==================================================================================================#
def compress(field, rate_control):
fun = libbwc.bwc_compress
fun.restype = None
fun.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
fun(field, data)
#=======================================================================================================================#
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.restype = ctypes.c_int8
fun.argtypes = [ctypes.c_void_p, ctypes.c_char_p]
res = fun(field, rate_control.encode('utf-8'))
if res == 1:
raise Exception()
#==================================================================================================#
def decompress(field, layer):
fun = libbwc.bwc_decompress
fun.restype = None
fun.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
fun(field, data)
fun.restype = ctypes.c_int8
fun.argtypes = [ctypes.c_void_p, ctypes.c_int8]
res = fun(field, layer)
if res == 1:
raise Exception()

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

File diff suppressed because it is too large Load diff

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

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
#*====================================================================================================================*#
#*================================================================================================*#
#| |#
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
@ -11,47 +11,39 @@
#| /$$ \ $$ | $$ |#
#| | $$$$$$/ | $$ |#
#| \______/ |__/ |#
#| |#
#| DESCRIPTION: |#
#| ------------ |#
#| |#
#| Defines the cmake script for the libbwc library. |#
#| |#
#| |#
#| DEVELOPMENT HISTORY: |#
#| -------------------- |#
#| |#
#| Date Author Change Id Release Description Of Change |#
#| ---- ------ --------- ------- --------------------- |#
#| 30.08.2018 Patrick Vogler B87D120 V 0.1.0 cmake file created |#
#| 15.10.2021 Patrick Vogler B880CA2 V 0.1.1 Added install rules |#
#| |#
#| |#
#| ------------------------------------------------------------------------------------------------------ |#
#| |#
#| -------------------------------------------------------------------------------------------- |#
#| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart |#
#| |#
#| Redistribution and use in source and binary forms, with or without modification, are permitted |#
#| provided that the following conditions are met: |#
#| Redistribution and use in source and binary forms, with or without modification, are |#
#| permitted provided that the following conditions are met: |#
#| |#
#| (1) Redistributions of source code must retain the above copyright notice, this list of |#
#| conditions and the following disclaimer. |#
#| |#
#| (2) Redistributions in binary form must reproduce the above copyright notice, this list |#
#| of conditions and the following disclaimer in the documentation and/or other materials |#
#| provided with the distribution. |#
#| of conditions and the following disclaimer in the documentation and/or other |#
#| materials provided with the distribution. |#
#| |#
#| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED |#
#| WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |#
#| PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR |#
#| ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |#
#| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |#
#| INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |#
#| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |#
#| ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |#
#| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS |#
#| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |#
#| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |#
#| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |#
#| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |#
#| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |#
#| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |#
#| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |#
#| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |#
#| |#
#*====================================================================================================================*#
#*--------------------------------------------------------*#
#*================================================================================================*#
#----------------------------------------------------------#
# Assemble the public header for the BigWhoop library #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
set(PYTHON_ARGUMENT "")
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
@ -67,10 +59,10 @@ 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()
@ -78,49 +70,59 @@ else()
endif()
add_library(bwclib ${BWC_LINK} bitstream.c
libbwc.c
codestream.c
dwt.c
../interfaces/reader/eas3.c
field.c
mq.c
libbwc.c
#netCDF.c
tier1.c
tier2.c
tagtree.c)
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# Set the target compile definition for the encoder/decod- #
# er bit precision. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
if("${PREC}" STREQUAL "Single")
target_compile_definitions(bwclib PRIVATE -DBWC_SINGLE_PRECISION)
else()
target_compile_definitions(bwclib PRIVATE -DBWC_DOUBLE_PRECISION)
endif()
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# Set the target compile definition for the requested file #
# format support. #
#----------------------------------------------------------#
if("${BUILD_EAS3}" STREQUAL "True")
target_compile_definitions(bwclib PRIVATE -DBWC_EAS3)
endif()
if("${BUILD_NETCDF}" STREQUAL "True")
target_compile_definitions(bwclib PRIVATE -DBWC_NETCDF)
endif()
#----------------------------------------------------------#
# Set the Version and SOVersion and define the public API #
# for the BigWhoop library. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
set_target_properties(bwclib PROPERTIES VERSION ${BWC_VERSION}
SOVERSION ${BWC_VERSION_MAJOR}
PUBLIC_HEADER ${CMAKE_SOURCE_DIR}/include/library/public/bwc.h)
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# Setup up the include directory for the BigWhoop library. #
#*--------------------------------------------------------*#
#----------------------------------------------------------#
target_include_directories(bwclib PRIVATE ${CMAKE_SOURCE_DIR}/include/library/private)
target_include_directories(bwclib PRIVATE ${CMAKE_SOURCE_DIR}/include/interfaces/reader)
#*--------------------------------------------------------*#
#----------------------------------------------------------#
# 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)

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

3680
src/library/field.c Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*====================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,64 +12,39 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| FILE NAME: mq.c ||
|| ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| DESCRIPTION NEEDED. ||
|| ||
|| FILE REFERENCES: ||
|| ---------------- ||
|| ||
|| Name I/O Description ||
|| ---- --- ----------- ||
|| none - - ||
|| ||
|| ||
|| PRIVATE FUNCTIONS: ||
|| ------------------ ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 13.02.2019 Patrick Vogler B87D120 V 0.1.0 source file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| ---------------------------------------------------------------------------------------------------------------- ||
|| ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|| following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|| the following disclaimer. ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the ||
|| following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|| distribution. ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and ||
|| the following disclaimer in the documentation and/or other materials provided with the distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED ||
|| WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A ||
|| PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ||
|| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ||
|| PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ||
|| CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR ||
|| OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH ||
|| DAMAGE. ||
|| ||
\*==================================================================================================================================*/
/************************************************************************************************************\
\*====================================================================================================================*/
/**********************************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
\**********************************************************************************************************************/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
@ -77,20 +52,21 @@
#include "macros.h"
#include "mq.h"
#include "tier1.h"
#include "types.h"
/************************************************************************************************************\
/**********************************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************************/
\**********************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! !
! Macros: !
! MACROS: !
! ------- !
! Macro Description !
! ----- ----------- !
@ -101,7 +77,7 @@
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 22.02.2019 Patrick Vogler B87D120 V 0.1.0 Macros created !
! 22.02.2019 Patrick Vogler B87D120 V 0.1.0 Macros created. !
\*----------------------------------------------------------------------------------------------------------*/
#define transfer_byte(state) \
{ \
@ -152,7 +128,7 @@
! ------------ !
! DESCRIPTION NEEDED !
! !
! Macros: !
! MACROS: !
! ------- !
! Macro Description !
! ----- ----------- !
@ -163,7 +139,7 @@
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 22.02.2019 Patrick Vogler B87D120 V 0.1.0 Macros created !
! 22.02.2019 Patrick Vogler B87D120 V 0.1.0 Macros created. !
\*----------------------------------------------------------------------------------------------------------*/
#define fill_lsb(state, bitcoder) \
{ \
@ -212,7 +188,7 @@
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 19.02.2019 Patrick Vogler B87D120 V 0.1.0 function created !
! 19.02.2019 Patrick Vogler B87D120 V 0.1.0 Function created. !
! !
\*----------------------------------------------------------------------------------------------------------*/
static const bwc_context_state context_state[94] =
@ -318,7 +294,7 @@ static const bwc_context_state context_state[94] =
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void initialize_bit_encoder(void) !
! FUNCTION NAME: void initialize_mq_encoder(void) !
! -------------- !
! !
! DESCRIPTION: !
@ -342,11 +318,12 @@ static const bwc_context_state context_state[94] =
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 19.02.2019 Patrick Vogler B87D120 V 0.1.0 function created !
! 19.02.2019 Patrick Vogler B87D120 V 0.1.0 Function created. !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
initialize_bit_encoder(bwc_coder *const coder, const uint8 number_of_contexts)
initialize_mq_encoder(bwc_coder *const coder,
uint8 const numContexts)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
@ -365,28 +342,29 @@ initialize_bit_encoder(bwc_coder *const coder, const uint8 number_of_contexts)
assert(coder->compressed);
coder->bitcoder = calloc(1, sizeof(bwc_bit_coder));
if(!coder->bitcoder)
if(coder->bitcoder == NULL)
{
// memory allocation error
fprintf(stderr, MEMERROR);
return 1;
return EXIT_FAILURE;
}
bitcoder = coder->bitcoder;
bitcoder->nContext = number_of_contexts;
bitcoder->nContext = numContexts;
bitcoder->b = coder->compressed;
bitcoder->context = calloc(bitcoder->nContext, sizeof(bwc_context_state*));
if(!bitcoder->context)
if(bitcoder->context == NULL)
{
// memory allocation error
fprintf(stderr, MEMERROR);
return 1;
free(coder->bitcoder);
return EXIT_FAILURE;
}
for(i = 0; i < number_of_contexts; ++i)
for(i = 0; i < numContexts; ++i)
{
bitcoder->context[i] = &context_state[0];
}
@ -395,11 +373,11 @@ initialize_bit_encoder(bwc_coder *const coder, const uint8 number_of_contexts)
bitcoder->context[CONTEXT_RUN] = &context_state[ 3];
bitcoder->context[CONTEXT_UNI] = &context_state[46];
return 0;
return EXIT_SUCCESS;
}
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void initialize_bit_encoder(void) !
! FUNCTION NAME: void initialize_mq_encoder(void) !
! -------------- !
! !
! DESCRIPTION: !
@ -423,11 +401,11 @@ initialize_bit_encoder(bwc_coder *const coder, const uint8 number_of_contexts)
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 19.02.2019 Patrick Vogler B87D120 V 0.1.0 function created !
! 19.02.2019 Patrick Vogler B87D120 V 0.1.0 Function created. !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
bit_encoder_next_run(bwc_bit_coder *const bitcoder)
mq_next_run(bwc_bit_coder *const bitcoder)
{
/*-----------------------*\
! DEFINE STRUCTS: !
@ -440,14 +418,14 @@ bit_encoder_next_run(bwc_bit_coder *const bitcoder)
assert(bitcoder);
state = calloc(1, sizeof(bwc_coder_state));
if(!state)
if(state == NULL)
{
// memory allocation error
fprintf(stderr, MEMERROR);
return 1;
return EXIT_FAILURE;
}
if(bitcoder->state)
if(bitcoder->state != NULL)
{
memcpy(state, bitcoder->state, sizeof(bwc_coder_state));
state->prev = bitcoder->state;
@ -464,11 +442,11 @@ bit_encoder_next_run(bwc_bit_coder *const bitcoder)
state->L = -0x0001;
}
return 0;
return EXIT_SUCCESS;
}
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void initialize_bit_encoder(void) !
! FUNCTION NAME: void initialize_mq_encoder(void) !
! -------------- !
! !
! DESCRIPTION: !
@ -492,11 +470,13 @@ bit_encoder_next_run(bwc_bit_coder *const bitcoder)
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 19.02.2019 Patrick Vogler B87D120 V 0.1.0 function created !
! 19.02.2019 Patrick Vogler B87D120 V 0.1.0 Function created. !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bit_encode(bwc_bit_coder *const bitcoder, const uint8 s, const uint8 k)
mq_bit_encode(bwc_bit_coder *const bitcoder,
uint8 const s,
uint8 const k)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
@ -577,7 +557,7 @@ bit_encode(bwc_bit_coder *const bitcoder, const uint8 s, const uint8 k)
}
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void initialize_bit_encoder(void) !
! FUNCTION NAME: void initialize_mq_encoder(void) !
! -------------- !
! !
! DESCRIPTION: !
@ -601,11 +581,11 @@ bit_encode(bwc_bit_coder *const bitcoder, const uint8 s, const uint8 k)
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 19.02.2019 Patrick Vogler B87D120 V 0.1.0 function created !
! 19.02.2019 Patrick Vogler B87D120 V 0.1.0 Function created. !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bit_encoder_truncation_length_min(bwc_coder_state *const state)
mq_truncation_length_min(bwc_coder_state *const state)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
@ -696,7 +676,7 @@ bit_encoder_truncation_length_min(bwc_coder_state *const state)
}
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void initialize_bit_encoder(void) !
! FUNCTION NAME: void initialize_mq_encoder(void) !
! -------------- !
! !
! DESCRIPTION: !
@ -720,11 +700,11 @@ bit_encoder_truncation_length_min(bwc_coder_state *const state)
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 19.02.2019 Patrick Vogler B87D120 V 0.1.0 function created !
! 19.02.2019 Patrick Vogler B87D120 V 0.1.0 Function created. !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bit_encoder_termination(bwc_bit_coder *const bitcoder)
mq_termination(bwc_bit_coder *const bitcoder)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
@ -767,20 +747,20 @@ bit_encoder_termination(bwc_bit_coder *const bitcoder)
state->T = buff.T;
state->t = buff.t;
while(state->prev)
while(state->prev != NULL)
{
state = state->prev;
}
while(state)
while(state != NULL)
{
bit_encoder_truncation_length_min(state);
mq_truncation_length_min(state);
state = state->next;
}
}
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void initialize_bit_encoder(void) !
! FUNCTION NAME: void initialize_mq_encoder(void) !
! -------------- !
! !
! DESCRIPTION: !
@ -804,39 +784,43 @@ bit_encoder_termination(bwc_bit_coder *const bitcoder)
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 19.02.2019 Patrick Vogler B87D120 V 0.1.0 function created !
! 19.02.2019 Patrick Vogler B87D120 V 0.1.0 Function created. !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
free_bit_encoder(bwc_coder *const coder)
free_mq_encoder(bwc_coder *const coder)
{
/*-----------------------*\
! DEFINE ASSERTIONS: !
\*-----------------------*/
assert(coder);
if(coder->bitcoder)
if(coder->compressed != NULL)
{
while(coder->bitcoder->state->next)
free(coder->compressed);
}
if(coder->bitcoder != NULL)
{
while(coder->bitcoder->state->next != NULL)
{
coder->bitcoder->state = coder->bitcoder->state->next;
}
while(coder->bitcoder->state->prev)
while(coder->bitcoder->state->prev != NULL)
{
coder->bitcoder->state = coder->bitcoder->state->prev;
free(coder->bitcoder->state->next);
}
free(coder->bitcoder->state);
free(coder->bitcoder->context);
}
free(coder->bitcoder->state);
free(coder->bitcoder);
}
}
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void initialize_bit_encoder(void) !
! FUNCTION NAME: void initialize_mq_encoder(void) !
! -------------- !
! !
! DESCRIPTION: !
@ -860,11 +844,13 @@ free_bit_encoder(bwc_coder *const coder)
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 19.02.2019 Patrick Vogler B87D120 V 0.1.0 function created !
! 19.02.2019 Patrick Vogler B87D120 V 0.1.0 Function created. !
! !
\*----------------------------------------------------------------------------------------------------------*/
uchar
initialize_bit_decoder(bwc_coder *const coder, const uint8 number_of_contexts, const int64 Lmax)
initialize_mq_decoder(bwc_coder *const coder,
uint8 const numContexts,
int64 const Lmax)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
@ -884,29 +870,30 @@ initialize_bit_decoder(bwc_coder *const coder, const uint8 number_of_contexts, c
assert(coder->compressed);
coder->bitcoder = calloc(1, sizeof(bwc_bit_coder));
if(!coder->bitcoder)
if(coder->bitcoder == NULL)
{
// memory allocation error
fprintf(stderr, MEMERROR);
return 1;
return EXIT_FAILURE;
}
bitcoder = coder->bitcoder;
bitcoder->Lmax = Lmax;
bitcoder->nContext = number_of_contexts;
bitcoder->nContext = numContexts;
bitcoder->b = coder->compressed;
bitcoder->context = calloc(bitcoder->nContext, sizeof(bwc_context_state*));
if(!bitcoder->context)
if(bitcoder->context == NULL)
{
// memory allocation error
fprintf(stderr, MEMERROR);
return 1;
free(coder->bitcoder);
return EXIT_FAILURE;
}
for(i = 0; i < number_of_contexts; ++i)
for(i = 0; i < numContexts; ++i)
{
bitcoder->context[i] = &context_state[0];
}
@ -916,11 +903,13 @@ initialize_bit_decoder(bwc_coder *const coder, const uint8 number_of_contexts, c
bitcoder->context[CONTEXT_UNI] = &context_state[46];
bitcoder->state = calloc(1, sizeof(bwc_coder_state));
if(!bitcoder->state)
if(bitcoder->state == NULL)
{
// memory allocation error
fprintf(stderr, MEMERROR);
return 1;
free(bitcoder->context);
free(coder->bitcoder);
return EXIT_FAILURE;
}
state = bitcoder->state;
@ -936,11 +925,11 @@ initialize_bit_decoder(bwc_coder *const coder, const uint8 number_of_contexts, c
state->t -= 0x07;
state->A = 0x8000;
return 0;
return EXIT_SUCCESS;
}
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void initialize_bit_encoder(void) !
! FUNCTION NAME: void initialize_mq_encoder(void) !
! -------------- !
! !
! DESCRIPTION: !
@ -964,11 +953,12 @@ initialize_bit_decoder(bwc_coder *const coder, const uint8 number_of_contexts, c
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 19.02.2019 Patrick Vogler B87D120 V 0.1.0 function created !
! 19.02.2019 Patrick Vogler B87D120 V 0.1.0 Function created. !
! !
\*----------------------------------------------------------------------------------------------------------*/
uint8
bit_decode(bwc_bit_coder *const bitcoder, const uint8 k)
mq_bit_decode(bwc_bit_coder *const bitcoder,
uint8 const k)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
@ -976,17 +966,17 @@ bit_decode(bwc_bit_coder *const bitcoder, const uint8 k)
uint16 p;
uint8 x;
/*-----------------------*\
! DEFINE ASSERTIONS: !
\*-----------------------*/
assert(bitcoder);
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/
bwc_context_state const* *context;
bwc_coder_state *state;
/*-----------------------*\
! DEFINE ASSERTIONS: !
\*-----------------------*/
assert(bitcoder);
context = bitcoder->context;
state = bitcoder->state;
@ -1050,7 +1040,7 @@ bit_decode(bwc_bit_coder *const bitcoder, const uint8 k)
}
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void initialize_bit_encoder(void) !
! FUNCTION NAME: void initialize_mq_encoder(void) !
! -------------- !
! !
! DESCRIPTION: !
@ -1074,11 +1064,11 @@ bit_decode(bwc_bit_coder *const bitcoder, const uint8 k)
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 19.02.2019 Patrick Vogler B87D120 V 0.1.0 function created !
! 19.02.2019 Patrick Vogler B87D120 V 0.1.0 Function created. !
! !
\*----------------------------------------------------------------------------------------------------------*/
uint64
bit_coder_get_no_bytes(bwc_bit_coder *const bitcoder)
mq_get_no_bytes(bwc_bit_coder *const bitcoder)
{
/*-----------------------*\
! DEFINE ASSERTIONS: !
@ -1089,7 +1079,7 @@ bit_coder_get_no_bytes(bwc_bit_coder *const bitcoder)
}
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void initialize_bit_encoder(void) !
! FUNCTION NAME: void initialize_mq_encoder(void) !
! -------------- !
! !
! DESCRIPTION: !
@ -1113,11 +1103,12 @@ bit_coder_get_no_bytes(bwc_bit_coder *const bitcoder)
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 19.02.2019 Patrick Vogler B87D120 V 0.1.0 function created !
! 19.02.2019 Patrick Vogler B87D120 V 0.1.0 Function created. !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bit_coder_reset_ptr(bwc_bit_coder *const bitcoder, uchar *const memory)
mq_reset_ptr(bwc_bit_coder *const bitcoder,
uchar *const memory)
{
/*-----------------------*\
! DEFINE STRUCTS: !
@ -1133,7 +1124,7 @@ bit_coder_reset_ptr(bwc_bit_coder *const bitcoder, uchar *const memory)
bitcoder->b = memory;
while(state)
while(state != NULL)
{
state->b = memory;
state = state->prev;
@ -1141,7 +1132,7 @@ bit_coder_reset_ptr(bwc_bit_coder *const bitcoder, uchar *const memory)
}
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void initialize_bit_encoder(void) !
! FUNCTION NAME: void initialize_mq_encoder(void) !
! -------------- !
! !
! DESCRIPTION: !
@ -1165,11 +1156,12 @@ bit_coder_reset_ptr(bwc_bit_coder *const bitcoder, uchar *const memory)
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 19.02.2019 Patrick Vogler B87D120 V 0.1.0 function created !
! 19.02.2019 Patrick Vogler B87D120 V 0.1.0 Function created. !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
bit_coder_get_pass_lengths(bwc_bit_coder *const bitcoder, bwc_encoded_cblk *const encoded_cblk)
mq_get_pass_lengths(bwc_bit_coder *const bitcoder,
bwc_encoded_blk *const encoded_cblk)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !

View file

@ -1,4 +1,4 @@
/*==================================================================================================================================*\
/*====================================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
@ -12,71 +12,48 @@
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| FILE NAME: tagtree.c ||
|| ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| DESCRIPTION NEEDED. ||
|| This file defines a tagtree procedure used to encode/decode two types of information found ||
|| defining in a codeblock in specific quality layer: ||
|| ||
|| FILE REFERENCES: ||
|| ---------------- ||
|| - The inclusion tag records if a codeblock has any contribution ||
|| to a quality layer. ||
|| - The number of leading bitplanes that are not significant/only ||
|| populated by zero bits. ||
|| ||
|| Name I/O Description ||
|| ---- --- ----------- ||
|| none - - ||
|| For more information on the encoding/decoding process please refere to JPEG2000 by ||
|| D. S. Taubman and M. W. Marcellin (p. 384). ||
|| ||
|| ||
|| PRIVATE FUNCTIONS: ||
|| ------------------ ||
|| ||
|| PUBLIC FUNCTIONS: ||
|| ----------------- ||
|| - kill_tagtree ||
|| - reset_tagtree ||
|| - tagtree_get_value ||
|| - tagtree_set_value ||
|| - initialize_tagtree ||
|| - encode_tagtree ||
|| - decode_tagtree ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 18.05.2018 Patrick Vogler B87D120 V 0.1.0 source file created ||
|| ||
|| -------------------------------------------------------------------------------------------------------------------- ||
|| ---------------------------------------------------------------------------------------------------------------- ||
|| ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|| following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|| the following disclaimer. ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the ||
|| following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|| distribution. ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and ||
|| the following disclaimer in the documentation and/or other materials provided with the distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED ||
|| WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A ||
|| PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ||
|| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ||
|| PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ||
|| CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR ||
|| OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH ||
|| DAMAGE. ||
|| ||
\*==================================================================================================================================*/
/************************************************************************************************************\
\*====================================================================================================================*/
/**********************************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************************/
\**********************************************************************************************************************/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
@ -86,27 +63,24 @@
#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. !
! This function is used to properly deallocate a tagtree instance. !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! tagtree bwc_tagtree* - Structure defining a tagtree instance. !
! tagtree bwc_tagtree* - Structure defining a tagtree !
! instance. !
! !
! RETURN VALUE: !
! ------------- !
@ -117,245 +91,134 @@
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 14.06.2018 Patrick Vogler B87D120 V 0.1.0 function created !
! Date Author Change Id Release Description !
! ---- ------ --------- ------- ----------- !
! 14.06.2018 Patrick Vogler B87D120 V 0.1.0 Function created. !
! 12.05.2020 Patrick Vogler B87E7E4 V 0.1.0 Clean up. !
! !
\*----------------------------------------------------------------------------------------------------------*/
\*--------------------------------------------------------------------------------------------------------------------*/
void
kill_tagtree(bwc_tagtree* tagtree)
kill_tagtree(bwc_tagtree *const tagtree)
{
/*-----------------------*\
! DEFINE ASSERTIONS: !
\*-----------------------*/
assert(tagtree);
/*--------------------------------------------------------*\
! Deallocate the tagtree and its nodes and return to the !
! function caller. !
\*--------------------------------------------------------*/
free(tagtree->nodes);
free(tagtree);
tagtree->nodes = NULL;
return;
}
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
/*--------------------------------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! This function is used to setup a tagtree for the number of spatial and tempo- !
! ral leaves supplied by the function caller. The tagtree will be set up as a bi- !
! nary tree for a 1-D, a quadtree for a 2-D, a octree for a 3-D and a hextree !
! for a 4-D problem. If the tagtree already contains a valid tree structure, the !
! function will reallocate the tagtree to fit the supplied number of leaves and !
! reinitialize the tree. The leaves and branches will be initialized with the ap- !
! propriate node and threshold value as well as a pointer to the parent node. !
! In case the allocation process fails, the function will return to the caller !
! with an error flag. !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! - - - !
! bwc_tagtree* - Structure defining a tagtree !
! instance. !
! !
! leafX, -Y, -Z, -TS unsigned int(64 bit) - Number of spatial and temporal !
! tagtree leafs. !
! !
! RETURN VALUE: !
! ------------- !
! Type Description !
! ---- ----------- !
! - - !
! unsigned char - Returns an unsigned char for !
! error handling. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 14.06.2018 Patrick Vogler B87D120 V 0.1.0 function created !
! Date Author Change Id Release Description !
! ---- ------ --------- ------- ----------- !
! 14.06.2018 Patrick Vogler B87D120 V 0.1.0 Function created. !
! 12.05.2020 Patrick Vogler B87E7E4 V 0.1.0 Clean up. !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
reset_tagtree(bwc_tagtree* const tagtree)
\*--------------------------------------------------------------------------------------------------------------------*/
uchar
initialize_tagtree(bwc_tagtree *tagtree,
uint64 const leafsX,
uint64 const leafsY,
uint64 const leafsZ,
uint64 const leafsTS)
{
/*-----------------------*\
! 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;
uint64 i;
uint64 levels, numNodes;
uint32 nlX[32] = {0}, nlY[32] = {0};
uint32 nlZ[32] = {0}, nlTS[32] = {0};
uint32 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;
bwc_tagtree_node *node;
bwc_tagtree_node *parent_x, *parent_y;
bwc_tagtree_node *parent_z, *parent_ts;
bwc_tagtree_node *tmp;
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)
/*--------------------------------------------------------*\
! Calculate the number of nodes and levels for the tagtree !
! instance and evaluate the number of spatial and temporal !
! leaves and branches for each tagtree level. !
\*--------------------------------------------------------*/
for(numNodes = 1,
levels = 0,
nlX[0] = leafsX,
nlY[0] = leafsY,
nlZ[0] = leafsZ,
nlTS[0] = leafsTS; nlX[levels] * nlY[levels] * nlZ[levels] * nlTS[levels] > 1; ++levels)
{
number_of_nodes += nlX[levels] * nlY[levels] * nlZ[levels] * nlTS[levels];
numNodes += 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)
/*--------------------------------------------------------*\
! Reallocate the nodes, loop over them and assign the in- !
! dices of the leaves and branches. Save the number of !
! spatial and temporal leaves in the tagtree structure. !
\*--------------------------------------------------------*/
tmp = realloc(tagtree->nodes, numNodes * sizeof(bwc_tagtree_node));
if(tmp == NULL)
{
// memory allocation error
fprintf(stderr, MEMERROR);
return 0;
return EXIT_FAILURE;
}
tagtree->nodes = calloc(number_of_nodes, sizeof(bwc_tagtree_node));
if (!tagtree->nodes)
else
{
// memory allocation error
fprintf(stderr, MEMERROR);
free(tagtree);
return 0;
tagtree->nodes = tmp;
node = tmp;
}
node = tagtree->nodes;
for(i = 0; i < number_of_nodes; ++i)
for(i = 0; i < numNodes; ++i)
{
node->index = i;
++node;
@ -366,6 +229,11 @@ initialize_tagtree(const uint64 leafsX, const uint64 leafsY, const uint64 leafsZ
tagtree->leavesZ = leafsZ;
tagtree->leavesTS = leafsTS;
/*--------------------------------------------------------*\
! Walk through the tagtree and set up all leaf and branch !
! nodes. Every parental node is initialized to have a max- !
! imum of 2 children in each spatial and temporal dir. !
\*--------------------------------------------------------*/
parent_ts = tagtree->nodes;
node = tagtree->nodes;
for(n = 0; n < levels; ++n)
@ -399,31 +267,43 @@ initialize_tagtree(const uint64 leafsX, const uint64 leafsY, const uint64 leafsZ
parent_x++;
a = 0;
}
/*--------------------------------------------------------*\
! Initialize the current node with a pointer to its parent !
! node index and initial value and treshold values. !
\*--------------------------------------------------------*/
node->parent = parent_x;
node->value = 0xFFFF;
node->threshold = 0;
node++;
}
}
}
}
}
reset_tagtree(tagtree);
return tagtree;
return EXIT_SUCCESS;
}
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: void *test(void) !
! -------------- !
/*--------------------------------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! DESCRIPTION NEEDED !
! This function is used to store a value in a tagtree leaf identified by its leaf !
! index. Additionally, the function will loop through and store the value in all !
! associated tagtree branches that have a smaller node value. !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! - - - !
! tagtree bwc_tagtree* - Structure defining a tagtree !
! instance. !
! !
! index unsigned int(64 bit) - Tagtree leaf index for which !
! the value is to be retrieved. !
! !
! value unsigned int(16 bit) - Value stored in a tagree leave !
! which is identified by its !
! leave index. !
! !
! RETURN VALUE: !
! ------------- !
@ -434,13 +314,136 @@ initialize_tagtree(const uint64 leafsX, const uint64 leafsY, const uint64 leafsZ
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 14.06.2018 Patrick Vogler B87D120 V 0.1.0 function created !
! Date Author Change Id Release Description !
! ---- ------ --------- ------- ----------- !
! 14.06.2018 Patrick Vogler B87D120 V 0.1.0 Function created. !
! 12.05.2020 Patrick Vogler B87E7E4 V 0.1.0 Clean up. !
! !
\*----------------------------------------------------------------------------------------------------------*/
\*--------------------------------------------------------------------------------------------------------------------*/
void
encode_tagtree(bwc_tagtree *const tagtree, bwc_stream *const stream, const uint32 threshold, const uint32 leaf_index, const uchar estimate)
tagtree_set_value(bwc_tagtree *const tagtree,
uint64 const index,
uint16 const value)
{
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/
bwc_tagtree_node *node;
/*-----------------------*\
! DEFINE ASSERTIONS: !
\*-----------------------*/
assert(tagtree);
assert(index < tagtree->leavesX * tagtree->leavesY *
tagtree->leavesZ * tagtree->leavesTS);
assert(tagtree->nodes[index].value == 0xFFFF);
assert(value < 0xFFFF);
/*--------------------------------------------------------*\
! Walk through the tree, from leaf to root, and store the !
! specified value in every node with a smaller node value. !
\*--------------------------------------------------------*/
node = &tagtree->nodes[index];
do
{
node->value = value;
node = node->parent;
} while(node && (node->value > value));
}
/*--------------------------------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! This function is used to extract a leaf value from a tagtree according to the !
! leaf index supplied by the function caller. !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! tagtree bwc_tagtree* - Structure defining a tagtree !
! instance. !
! !
! index unsigned int(64 bit) - Tagtree leaf index for which !
! the value is to be retrieved. !
! !
! RETURN VALUE: !
! ------------- !
! Type Description !
! ---- ----------- !
! unsigned int(16 bit) - Value stored in a tagree leave !
! which is identified by its !
! leave index. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description !
! ---- ------ --------- ------- ----------- !
! 14.06.2018 Patrick Vogler B87D120 V 0.1.0 Function created. !
! 12.05.2020 Patrick Vogler B87E7E4 V 0.1.0 Clean up. !
! !
\*--------------------------------------------------------------------------------------------------------------------*/
uint16
tagtree_get_value(bwc_tagtree const *const tagtree,
uint64 const index)
{
/*-----------------------*\
! DEFINE ASSERTIONS: !
\*-----------------------*/
assert(tagtree);
assert(index < tagtree->leavesX * tagtree->leavesY *
tagtree->leavesZ * tagtree->leavesTS);
assert(tagtree->nodes[index].value != 0xFFFF);
/*--------------------------------------------------------*\
! Return the leaf value to the function caller. !
\*--------------------------------------------------------*/
return tagtree->nodes[index].value;
}
/*--------------------------------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! This function is used to extract a leaf value from a tagtree according to the !
! leaf index supplied by the function caller. !
! !
! PARAMETERS: !
! ----------- !
! Variable Type Description !
! -------- ---- ----------- !
! tagtree bwc_tagtree* - Structure defining a tagtree !
! instance. !
! !
! index unsigned int(64 bit) - Tagtree leaf index for which !
! the value is to be retrieved. !
! !
! RETURN VALUE: !
! ------------- !
! Type Description !
! ---- ----------- !
! unsigned int(16 bit) - Value stored in a tagree leave !
! which is identified by its !
! leave index. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description !
! ---- ------ --------- ------- ----------- !
! 14.06.2018 Patrick Vogler B87D120 V 0.1.0 Function created. !
! 12.05.2020 Patrick Vogler B87E7E4 V 0.1.0 Clean up. !
! !
\*--------------------------------------------------------------------------------------------------------------------*/
void
encode_tagtree(bwc_tagtree *const tagtree,
bwc_stream *const stream,
uint32 const threshold,
uint32 const index,
uchar const estimate)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
@ -451,16 +454,21 @@ encode_tagtree(bwc_tagtree *const tagtree, bwc_stream *const stream, const uint3
! DEFINE STRUCTS: !
\*-----------------------*/
bwc_tagtree_node *node;
bwc_tagtree_node **branch_ptr, *branch[32];
bwc_tagtree_node **branch_ptr, *branch[64];
/*-----------------------*\
! DEFINE ASSERTIONS: !
\*-----------------------*/
assert(tagtree);
assert(stream);
assert(leaf_index < (tagtree->leavesX * tagtree->leavesY * tagtree->leavesZ * tagtree->leavesTS));
assert(index < (tagtree->leavesX * tagtree->leavesY *
tagtree->leavesZ * tagtree->leavesTS));
node = &tagtree->nodes[leaf_index];
/*--------------------------------------------------------*\
! Set up a pointer array that stores all tagtree nodes, !
! from leaf to root, for the specified leaf index. !
\*--------------------------------------------------------*/
node = &tagtree->nodes[index];
branch_ptr = branch;
while(node->parent)
@ -469,35 +477,52 @@ encode_tagtree(bwc_tagtree *const tagtree, bwc_stream *const stream, const uint3
node = node->parent;
}
/*--------------------------------------------------------*\
! Walk through the pointer array from root to leaf node. !
\*--------------------------------------------------------*/
for(threshold_min = 0; ; node = *--branch_ptr)
{
/*--------------------------------------------------------*\
! Evaluate the temporary threshold used to encode the node !
! value. !
\*--------------------------------------------------------*/
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
/*--------------------------------------------------------*\
! Iteratively increase the threshold and emit a 0 to the !
! stream until the loop conditions are meet. Once the node !
! value becomes smaller than the threshold emit a 1. !
\*--------------------------------------------------------*/
while((node->value >= threshold_tmp) &&
(threshold > threshold_tmp))
{
threshold_tmp++;
if(node->value >= threshold_tmp)
{
bwc_emit_bit(stream, 0);
emit_bit(stream, 0);
}
else
{
bwc_emit_bit(stream, 1);
emit_bit(stream, 1);
}
}
/*--------------------------------------------------------*\
! Increase the minimum threshold value and update the node !
! threshold for a live encoding procedure. !
\*--------------------------------------------------------*/
threshold_min = MIN(node->value, threshold_tmp);
if(!estimate)
if(estimate == 0)
{
node->threshold = threshold_tmp;
}
if(node == &tagtree->nodes[leaf_index])
if(node == &tagtree->nodes[index])
{
break;
}
@ -529,11 +554,14 @@ encode_tagtree(bwc_tagtree *const tagtree, bwc_stream *const stream, const uint3
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 14.06.2018 Patrick Vogler B87D120 V 0.1.0 function created !
! 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)
decode_tagtree(bwc_tagtree *const tagtree,
bwc_stream *const stream,
uint32 const threshold,
uint32 const index)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
@ -551,12 +579,13 @@ decode_tagtree(bwc_tagtree *const tagtree, bwc_stream *const stream, const uint3
\*-----------------------*/
assert(tagtree);
assert(stream);
assert(leaf_index < (tagtree->leavesX * tagtree->leavesY * tagtree->leavesZ * tagtree->leavesTS));
assert(index < (tagtree->leavesX * tagtree->leavesY *
tagtree->leavesZ * tagtree->leavesTS));
node = &tagtree->nodes[leaf_index];
node = &tagtree->nodes[index];
branch_ptr = branch;
while(node)
while(node != NULL)
{
if(node->value == 0xFFFF)
{
@ -567,8 +596,13 @@ decode_tagtree(bwc_tagtree *const tagtree, bwc_stream *const stream, const uint3
node = node->parent;
}
for(*branch_ptr--, node = *branch_ptr--, threshold_min = 0; ; node = *branch_ptr--)
(void)*branch_ptr--;
threshold_min = 0;
do
{
node = *branch_ptr--;
if(node->threshold < threshold_min)
{
node->value = threshold_min;
@ -577,18 +611,14 @@ decode_tagtree(bwc_tagtree *const tagtree, bwc_stream *const stream, const uint3
while((node->value == node->threshold) && (node->threshold < threshold))
{
node->threshold++;
if(!bwc_get_bit(stream))
if(!get_bit(stream))
{
node->value++;
}
}
threshold_min = MIN(node->value, node->threshold);
} while (node != &tagtree->nodes[index]);
if(node == &tagtree->nodes[leaf_index])
{
break;
}
}
return (node->value < threshold) ? 0 : 1;
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
#*====================================================================================================================*#
#*================================================================================================*#
#| |#
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
@ -11,83 +11,54 @@
#| /$$ \ $$ | $$ |#
#| | $$$$$$/ | $$ |#
#| \______/ |__/ |#
#| |#
#| DESCRIPTION: |#
#| ------------ |#
#| |#
#| Defines the cmake script for the BigWhoop command line tool. |#
#| |#
#| |#
#| DEVELOPMENT HISTORY: |#
#| -------------------- |#
#| |#
#| Date Author Change Id Release Description Of Change |#
#| ---- ------ --------- ------- --------------------- |#
#| 30.08.2018 Patrick Vogler B87D120 V 0.1.0 cmake file created |#
#| 15.10.2021 Patrick Vogler B880CA2 V 0.1.1 Added install rules |#
#| |#
#| |#
#| ------------------------------------------------------------------------------------------------------ |#
#| |#
#| -------------------------------------------------------------------------------------------- |#
#| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart |#
#| |#
#| Redistribution and use in source and binary forms, with or without modification, are permitted |#
#| provided that the following conditions are met: |#
#| Redistribution and use in source and binary forms, with or without modification, are |#
#| permitted provided that the following conditions are met: |#
#| |#
#| (1) Redistributions of source code must retain the above copyright notice, this list of |#
#| conditions and the following disclaimer. |#
#| |#
#| (2) Redistributions in binary form must reproduce the above copyright notice, this list |#
#| of conditions and the following disclaimer in the documentation and/or other materials |#
#| provided with the distribution. |#
#| of conditions and the following disclaimer in the documentation and/or other |#
#| materials provided with the distribution. |#
#| |#
#| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED |#
#| WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |#
#| PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR |#
#| ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |#
#| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |#
#| INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |#
#| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |#
#| ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |#
#| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS |#
#| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |#
#| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |#
#| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |#
#| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |#
#| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |#
#| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |#
#| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |#
#| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |#
#| |#
#*====================================================================================================================*#
#*--------------------------------------------------------*#
#*================================================================================================*#
#----------------------------------------------------------#
# Add the bwc command line utility and get hash tool to #
# the current project using the utility source files. #
#*--------------------------------------------------------*#
add_executable(bwccmd bwccmdl.c
../interfaces/reader/eas3.c)
#----------------------------------------------------------#
add_executable(bwccmd bwccmdl.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)

View file

@ -14,71 +14,31 @@
|| ||
|| 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. ||
|| This is a simple command line tool that uses the Big Whoop library to (de)compress a ||
|| 2- to 4-dimensional IEEE 754 floating point array. For further information use the ||
|| --help (-h) argument in the command-line or consult the appropriate README file. ||
|| ||
|| FILE REFERENCES: ||
|| ---------------- ||
|| ||
|| Name I/O Description ||
|| ---- --- ----------- ||
|| - input - input - Input file that corresponds to ||
|| an uncompressed dataset, for a ||
|| compression run, or a com- ||
|| pressed bitstream, for a decom- ||
|| pression run. ||
|| ||
|| - output - Output - Output file that the com- ||
|| pressed bitstream, for a com- ||
|| pression run, or reconstructed ||
|| dataset, for a decompression ||
|| run, is written to. ||
|| ||
|| FUNCTIONS: ||
|| ---------- ||
|| ||
|| PRIVATE: PUBLIC: ||
|| -------- ------- ||
|| - get_digit_sep - main ||
|| - get_size ||
|| - get_dimension ||
|| - get_prog_ord ||
|| - get_quant_style ||
|| ||
|| DEVELOPMENT HISTORY: ||
|| -------------------- ||
|| ||
|| Date Author Change Id Release Description Of Change ||
|| ---- ------ --------- ------- --------------------- ||
|| 13.10.2017 Patrick Vogler B87D120 V 0.1.0 source file created ||
|| 26.11.2020 Patrick Vogler B87E7E4 V 0.1.0 Command line tool refac- ||
|| tored. ||
|| ||
|| ||
|| ------------------------------------------------------------------------------------------------------ ||
|| ---------------------------------------------------------------------------------------------------------------- ||
|| ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are permitted ||
|| provided that the following conditions are met: ||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|| following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of ||
|| conditions and the following disclaimer. ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the ||
|| following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other materials ||
|| provided with the distribution. ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and ||
|| the following disclaimer in the documentation and/or other materials provided with the distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED ||
|| 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. ||
|| 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. ||
|| ||
\*====================================================================================================================*/
/**********************************************************************************************************************\
@ -2852,9 +2812,9 @@ main(int argc,
if((temp != NULL) && (temp->count == 1))
{
if(strcmp(temp->lit_opt[0], "NONE"))
bwc_set_quantization_style(field, bwc_qt_none);
bwc_set_quant_style(field, bwc_qt_none);
else
bwc_set_quantization_style(field, bwc_qt_derived);
bwc_set_quant_style(field, bwc_qt_derived);
}
/*--------------------------------------------------------*\
@ -2863,7 +2823,7 @@ main(int argc,
temp = retrieve_arg(args, "quantisation_step_size");
if((temp != NULL) && (temp->count == 1))
{
bwc_set_quantization_step_size(field, temp->num_opt[0]);
bwc_set_quant_step_size(field, temp->num_opt[0]);
}
/*--------------------------------------------------------*\

View file

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

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

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