Ported Header files to new coding standard.
This commit is contained in:
parent
d2b88391b9
commit
8850d525f2
30 changed files with 3442 additions and 5574 deletions
163
CMakeLists.txt
163
CMakeLists.txt
|
@ -1,100 +1,93 @@
|
|||
#*====================================================================================================================*#
|
||||
#| |#
|
||||
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
|
||||
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
|
||||
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
|
||||
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
|
||||
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
|
||||
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
|
||||
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
|
||||
#| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |#
|
||||
#| /$$ \ $$ | $$ |#
|
||||
#| | $$$$$$/ | $$ |#
|
||||
#| \______/ |__/ |#
|
||||
#| DESCRIPTION: |#
|
||||
#| ------------ |#
|
||||
#| Defines the global cmake script for the Big Whoop compression algorithm. |#
|
||||
#| |#
|
||||
#| |#
|
||||
#| DEVELOPMENT HISTORY: |#
|
||||
#| -------------------- |#
|
||||
#| |#
|
||||
#| Date Author Change Id Release Description Of Change |#
|
||||
#| ---- ------ --------- ------- --------------------- |#
|
||||
#| 30.08.2018 Patrick Vogler B87D120 V 0.1.0 Cmake file created |#
|
||||
#| |#
|
||||
#| |#
|
||||
#| ------------------------------------------------------------------------------------------------------ |#
|
||||
#| |#
|
||||
#| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart |#
|
||||
#| |#
|
||||
#| Redistribution and use in source and binary forms, with or without modification, are permitted |#
|
||||
#| provided that the following conditions are met: |#
|
||||
#| |#
|
||||
#| (1) Redistributions of source code must retain the above copyright notice, this list of |#
|
||||
#| conditions and the following disclaimer. |#
|
||||
#| |#
|
||||
#| (2) Redistributions in binary form must reproduce the above copyright notice, this list |#
|
||||
#| of conditions and the following disclaimer in the documentation and/or other materials |#
|
||||
#| provided with the distribution. |#
|
||||
#| |#
|
||||
#| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED |#
|
||||
#| WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |#
|
||||
#| PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR |#
|
||||
#| ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |#
|
||||
#| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |#
|
||||
#| INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |#
|
||||
#| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |#
|
||||
#| ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |#
|
||||
#| |#
|
||||
#*====================================================================================================================*#
|
||||
#*--------------------------------------------------------*#
|
||||
#*================================================================================================*#
|
||||
#| |#
|
||||
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
|
||||
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
|
||||
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
|
||||
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
|
||||
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
|
||||
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
|
||||
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
|
||||
#| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |#
|
||||
#| /$$ \ $$ | $$ |#
|
||||
#| | $$$$$$/ | $$ |#
|
||||
#| \______/ |__/ |#
|
||||
#| |#
|
||||
#| DESCRIPTION: |#
|
||||
#| ------------ |#
|
||||
#| |#
|
||||
#| Defines the global cmake script for 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: |#
|
||||
#| |#
|
||||
#| (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. |#
|
||||
#| |#
|
||||
#*================================================================================================*#
|
||||
#----------------------------------------------------------#
|
||||
# Check if the version requirement for cmake is met. #
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
cmake_minimum_required(VERSION 3.5.1)
|
||||
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
# Set the project name and description. #
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
project(BWC LANGUAGES C)
|
||||
set(PROJECT_DESCRIPTION "Compression algorithm for IEEE 754 datasets")
|
||||
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
# Check that the current build is not a in-source build. #
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
|
||||
message(FATAL_ERROR "In-source builds are prohibited. Please create a separate build directory")
|
||||
endif()
|
||||
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
# Save the bwc.c file in a temporary variable and match #
|
||||
# the current version number with a regular expression. #
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/src/library/libbwc.c _bwc_c_contents)
|
||||
string(REGEX MATCH "Version[ \t]+([0-9]+).([0-9]+).([0-9]+)" _ ${ver} ${_bwc_c_contents})
|
||||
string(REGEX MATCH "V[ \t]+([0-9]+).([0-9]+).([0-9]+)" _ ${ver} ${_bwc_c_contents})
|
||||
set(BWC_VERSION_MAJOR ${CMAKE_MATCH_1})
|
||||
set(BWC_VERSION_MINOR ${CMAKE_MATCH_2})
|
||||
set(BWC_VERSION_PATCH ${CMAKE_MATCH_3})
|
||||
set(BWC_VERSION "${BWC_VERSION_MAJOR}.${BWC_VERSION_MINOR}.${BWC_VERSION_PATCH}")
|
||||
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
# Setup a user-specified option used to control the sample #
|
||||
# precision during compression. The standard option is #
|
||||
# set to double precision. #
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
set(PREC "Double" CACHE STRING "User-specified option used to control\
|
||||
the precision during compression")
|
||||
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
# Inlude the GNU standard installation directories module #
|
||||
# to set up the output directories. #
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
include(GNUInstallDirs)
|
||||
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
# Set up the output directories for the Big Whoop library #
|
||||
# and utility binaries. #
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
list(INSERT CMAKE_MODULE_PATH 0 "${BWC_SOURCE_DIR}/cmake")
|
||||
if(${TOOL})
|
||||
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
|
||||
|
@ -108,25 +101,25 @@ if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
|
|||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${BWC_SOURCE_DIR}/${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
# Set the target installation directory of the config-file #
|
||||
# packaging configuration files. #
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
set(CMAKE_INSTALL_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/bwc
|
||||
CACHE PATH "Installation directory for config-file package cmake files")
|
||||
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
# Suggest the C standard (C99) used by the compiler. #
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
if(NOT CMAKE_C_STANDARD)
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
endif()
|
||||
|
||||
message(STATUS "Compiling with C standard: ${CMAKE_C_STANDARD}")
|
||||
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
# Suggest the C++ standard (CXX98) used by the compiler. #
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
# Suggest C++98
|
||||
if(NOT CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
@ -134,10 +127,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)
|
||||
|
@ -147,22 +140,22 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
|||
endif()
|
||||
endif()
|
||||
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
# Add all necessary compiler warnings for debugging. #
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
|
||||
endif()
|
||||
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
# Include the CMake dependent option macro. #
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
include(CMakeDependentOption)
|
||||
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
# Set the -fPIC compile option for static libraries. #
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
get_property(SHARED_LIBS_SUPPORTED GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS)
|
||||
cmake_dependent_option(BUILD_SHARED_LIBS
|
||||
"Whether or not to build shared libraries" ON
|
||||
|
@ -178,21 +171,21 @@ if(BWC_ENABLE_PIC)
|
|||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
endif()
|
||||
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
# Add the project source code. #
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
add_subdirectory(src/library)
|
||||
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
# Add the utilities source code if requested. #
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
if(${TOOL})
|
||||
add_subdirectory(src/tools)
|
||||
endif()
|
||||
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
# Config-file packaging #
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
export(TARGETS bwclib NAMESPACE bwc:: FILE "bwc-targets.cmake")
|
||||
configure_file(${PROJECT_SOURCE_DIR}/bwc-config.cmake.in
|
||||
"${PROJECT_BINARY_DIR}/bwc-config.cmake" @ONLY)
|
||||
|
|
|
@ -1,3 +1,46 @@
|
|||
#*================================================================================================*#
|
||||
#| |#
|
||||
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
|
||||
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
|
||||
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
|
||||
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
|
||||
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
|
||||
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
|
||||
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
|
||||
#| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |#
|
||||
#| /$$ \ $$ | $$ |#
|
||||
#| | $$$$$$/ | $$ |#
|
||||
#| \______/ |__/ |#
|
||||
#| |#
|
||||
#| DESCRIPTION: |#
|
||||
#| ------------ |#
|
||||
#| |#
|
||||
#| Config that handles package versioning. |#
|
||||
#| |#
|
||||
#| -------------------------------------------------------------------------------------------- |#
|
||||
#| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart |#
|
||||
#| |#
|
||||
#| Redistribution and use in source and binary forms, with or without modification, are |#
|
||||
#| permitted provided that the following conditions are met: |#
|
||||
#| |#
|
||||
#| (1) Redistributions of source code must retain the above copyright notice, this list of |#
|
||||
#| conditions and the following disclaimer. |#
|
||||
#| |#
|
||||
#| (2) Redistributions in binary form must reproduce the above copyright notice, this list |#
|
||||
#| of conditions and the following disclaimer in the documentation and/or other |#
|
||||
#| materials provided with the distribution. |#
|
||||
#| |#
|
||||
#| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS |#
|
||||
#| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |#
|
||||
#| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |#
|
||||
#| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |#
|
||||
#| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |#
|
||||
#| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |#
|
||||
#| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |#
|
||||
#| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |#
|
||||
#| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |#
|
||||
#| |#
|
||||
#*================================================================================================*#
|
||||
set(PACKAGE_VERSION_MAJOR @BWC_VERSION_MAJOR@)
|
||||
set(PACKAGE_VERSION_MINOR @BWC_VERSION_MINOR@)
|
||||
set(PACKAGE_VERSION_PATCH @BWC_VERSION_PATCH@)
|
||||
|
|
|
@ -1,12 +1,53 @@
|
|||
# - Config file for the bwc package
|
||||
#
|
||||
# It defines the following variables
|
||||
# BWC_INCLUDE_DIRS - include directories for bwc
|
||||
# BWC_LIBRARIES - libraries to link against
|
||||
#
|
||||
# And the following imported targets:
|
||||
# bwc::bwclib
|
||||
|
||||
#*================================================================================================*#
|
||||
#| |#
|
||||
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
|
||||
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
|
||||
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
|
||||
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
|
||||
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
|
||||
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
|
||||
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
|
||||
#| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |#
|
||||
#| /$$ \ $$ | $$ |#
|
||||
#| | $$$$$$/ | $$ |#
|
||||
#| \______/ |__/ |#
|
||||
#| |#
|
||||
#| DESCRIPTION: |#
|
||||
#| ------------ |#
|
||||
#| |#
|
||||
#| Config file for the bwc package defining the following variables: |#
|
||||
#| |#
|
||||
#| BWC_INCLUDE_DIRS - include directories for bwc, |#
|
||||
#| BWC_LIBRARIES - libraries to link against, |#
|
||||
#| |#
|
||||
#| and the following imported targets: |#
|
||||
#| |#
|
||||
#| bwc::bwclib |#
|
||||
#| |#
|
||||
#| -------------------------------------------------------------------------------------------- |#
|
||||
#| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart |#
|
||||
#| |#
|
||||
#| Redistribution and use in source and binary forms, with or without modification, are |#
|
||||
#| permitted provided that the following conditions are met: |#
|
||||
#| |#
|
||||
#| (1) Redistributions of source code must retain the above copyright notice, this list of |#
|
||||
#| conditions and the following disclaimer. |#
|
||||
#| |#
|
||||
#| (2) Redistributions in binary form must reproduce the above copyright notice, this list |#
|
||||
#| of conditions and the following disclaimer in the documentation and/or other |#
|
||||
#| materials provided with the distribution. |#
|
||||
#| |#
|
||||
#| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS |#
|
||||
#| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |#
|
||||
#| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |#
|
||||
#| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |#
|
||||
#| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |#
|
||||
#| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |#
|
||||
#| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |#
|
||||
#| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |#
|
||||
#| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |#
|
||||
#| |#
|
||||
#*================================================================================================*#
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/bwc-config-version.cmake")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
|
|
@ -1,224 +1,94 @@
|
|||
/*==================================================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| File: bwc_bitstream.h ||
|
||||
|| ----- ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| This file describes a set of functions that can be used to create, manipulate and terminate ||
|
||||
|| a bitstream. These functions facilitate the creation or reading of a compressed bwc code- ||
|
||||
|| stream and can emit/extract information on a per bit, symbol (64-bit) or string basis. ||
|
||||
|| ||
|
||||
|| ||
|
||||
|| STRUCTS: ||
|
||||
|| -------- ||
|
||||
|| - ||
|
||||
|| ||
|
||||
|| PUBLIC FUNCTIONS: ||
|
||||
|| ----------------- ||
|
||||
|| - bwc_init_stream ||
|
||||
|| - bwc_emit_chunck ||
|
||||
|| - bwc_emit_symbol ||
|
||||
|| - bwc_emit_bit ||
|
||||
|| - bwc_get_chunck ||
|
||||
|| - bwc_get_symbol ||
|
||||
|| - bwc_get_bit ||
|
||||
|| - bwc_terminate_stream ||
|
||||
|| ||
|
||||
|| DEVELOPMENT HISTORY: ||
|
||||
|| -------------------- ||
|
||||
|| ||
|
||||
|| Date Author Change Id Release Description Of Change ||
|
||||
|| ---- ------ --------- ------- --------------------- ||
|
||||
|| 28.05.2018 Patrick Vogler B87D120 V 0.1.0 header file created ||
|
||||
|| ||
|
||||
|| -------------------------------------------------------------------------------------------------------------------- ||
|
||||
|| ||
|
||||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|
||||
|| ||
|
||||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|
||||
|| following conditions are met: ||
|
||||
|| ||
|
||||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|
||||
|| the following disclaimer. ||
|
||||
|| ||
|
||||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|
||||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|
||||
|| distribution. ||
|
||||
|| ||
|
||||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|
||||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|
||||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|
||||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|
||||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|
||||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|
||||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|
||||
|| ||
|
||||
\*==================================================================================================================================*/
|
||||
/*================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| 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 codestream and can emit/extract information on a per bit, ||
|
||||
|| symbol (64-bit) or string basis. ||
|
||||
|| ||
|
||||
|| -------------------------------------------------------------------------------------------- ||
|
||||
|| 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 BITSTREAM_H
|
||||
#define BITSTREAM_H
|
||||
/************************************************************************************************\
|
||||
|| _ _ _ ____ _ _ _ ___ ____ ||
|
||||
|| | |\ | | | | | | \ |___ ||
|
||||
|| | | \| |___ |___ |__| |__/ |___ ||
|
||||
|| ||
|
||||
\************************************************************************************************/
|
||||
#include "types.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* bwc_init_stream (uchar *const memory,
|
||||
uint32 const size,
|
||||
char const instr);
|
||||
//==========|==========================|======================|======|======|=====================
|
||||
void bwc_emit_chunck (bwc_stream *const stream,
|
||||
uchar const *const chunck,
|
||||
uint64 const size);
|
||||
//==========|==========================|======================|======|======|=====================
|
||||
void bwc_emit_symbol (bwc_stream *const stream,
|
||||
uint64 const symbol,
|
||||
uint8 const size);
|
||||
//==========|==========================|======================|======|======|=====================
|
||||
void bwc_emit_bit (bwc_stream *const stream,
|
||||
uint64 const bit);
|
||||
//==========|==========================|======================|======|======|=====================
|
||||
void flush_stream (bwc_stream *const stream);
|
||||
//==========|==========================|======================|======|======|=====================
|
||||
uchar* bwc_get_chunck (bwc_stream *const stream,
|
||||
uint64 const length);
|
||||
//==========|==========================|======================|======|======|=====================
|
||||
uint64 bwc_get_symbol (bwc_stream *const stream,
|
||||
uint8 const length);
|
||||
//==========|==========================|======================|======|======|=====================
|
||||
uchar bwc_get_bit (bwc_stream *const stream);
|
||||
//==========|==========================|======================|======|======|=====================
|
||||
uchar bwc_terminate_stream (bwc_stream *stream,
|
||||
bwc_packed_stream *const packed_stream);
|
||||
//==========|==========================|======================|======|======|=====================
|
||||
void release_packed_stream (bwc_packed_stream *const stream);
|
||||
#endif
|
|
@ -1,191 +1,107 @@
|
|||
/*==================================================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| File: codestream.h ||
|
||||
|| ----- ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| DESCRIPTION NEEDED. ||
|
||||
|| ||
|
||||
|| STRUCTS: ||
|
||||
|| -------- ||
|
||||
|| ||
|
||||
|| PUBLIC FUNCTIONS: ||
|
||||
|| ----------------- ||
|
||||
|| ||
|
||||
|| DEVELOPMENT HISTORY: ||
|
||||
|| -------------------- ||
|
||||
|| ||
|
||||
|| Date Author Change Id Release Description Of Change ||
|
||||
|| ---- ------ --------- ------- --------------------- ||
|
||||
|| 28.05.2018 Patrick Vogler B87D120 V 0.1.0 header file created ||
|
||||
|| ||
|
||||
|| -------------------------------------------------------------------------------------------------------------------- ||
|
||||
|| ||
|
||||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|
||||
|| ||
|
||||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|
||||
|| following conditions are met: ||
|
||||
|| ||
|
||||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|
||||
|| the following disclaimer. ||
|
||||
|| ||
|
||||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|
||||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|
||||
|| distribution. ||
|
||||
|| ||
|
||||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|
||||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|
||||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|
||||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|
||||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|
||||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|
||||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|
||||
|| ||
|
||||
\*==================================================================================================================================*/
|
||||
/*================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| ||
|
||||
|| 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: ||
|
||||
|| ||
|
||||
|| (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 CODESTREAM_H
|
||||
#define CODESTREAM_H
|
||||
|
||||
/************************************************************************************************************\
|
||||
|| _ _ _ ____ _ _ _ ___ ____ ||
|
||||
|| | |\ | | | | | | \ |___ ||
|
||||
|| | | \| |___ |___ |__| |__/ |___ ||
|
||||
|| ||
|
||||
\************************************************************************************************************/
|
||||
#include "types.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; \
|
||||
}
|
||||
/************************************************************************************************\
|
||||
|| _ _ ____ ____ ____ ____ ____ ||
|
||||
|| |\/| |__| | |__/ | | [__ ||
|
||||
|| | | | | |___ | \ |__| ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************/
|
||||
/*----------------------------------------------------------------------------------------------*\
|
||||
! !
|
||||
! 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(stream, delta) \
|
||||
{ \
|
||||
stream->L -= delta; \
|
||||
}
|
||||
|
||||
#define forward_stream(stream, delta) \
|
||||
{ \
|
||||
stream->L += delta; \
|
||||
}
|
||||
|
||||
#define get_access(stream) (uchar*)stream->memory + stream->L
|
||||
#define forward_stream(stream, delta) \
|
||||
{ \
|
||||
stream->L += delta; \
|
||||
}
|
||||
|
||||
/************************************************************************************************************\
|
||||
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|
||||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|
||||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************************/
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! FUNCTION NAME: void *test(void) !
|
||||
! -------------- !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! DESCRIPTION NEEDED !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
uchar
|
||||
assemble_main_header(bwc_field *const field);
|
||||
#define get_access(stream) (uchar*)stream->memory + stream->L
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! FUNCTION NAME: void *test(void) !
|
||||
! -------------- !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! DESCRIPTION NEEDED !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
bwc_field*
|
||||
bwc_parse_main_header(bwc_data *const data,bwc_stream *const stream);
|
||||
/************************************************************************************************\
|
||||
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|
||||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|
||||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************/
|
||||
uchar assemble_main_header (bwc_field *const field);
|
||||
//==========|==========================|======================|======|======|=====================
|
||||
bwc_field* bwc_parse_main_header (bwc_data *const data,
|
||||
bwc_stream *const stream);
|
||||
//==========|==========================|======================|======|======|=====================
|
||||
uchar codestream_write_aux (bwc_packed_stream *const header,
|
||||
bwc_packed_stream *const aux);
|
||||
//==========|==========================|======================|======|======|=====================
|
||||
uchar codestream_write_com (bwc_packed_stream *const header,
|
||||
bwc_packed_stream *const com);
|
||||
//==========|==========================|======================|======|======|=====================
|
||||
bwc_packed_stream* assemble_codestream (bwc_field *const field);
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! 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);
|
||||
//==========|==========================|======================|======|======|=====================
|
||||
bwc_field* parse_codestream (bwc_data *const data,
|
||||
uint8 const layer);
|
||||
#endif
|
|
@ -1,328 +1,299 @@
|
|||
/*==================================================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| File: constants.h ||
|
||||
|| ----- ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| DESCRIPTION NEEDED. ||
|
||||
|| ||
|
||||
|| STRUCTS: ||
|
||||
|| -------- ||
|
||||
|| ||
|
||||
|| PUBLIC FUNCTIONS: ||
|
||||
|| ----------------- ||
|
||||
|| ||
|
||||
|| DEVELOPMENT HISTORY: ||
|
||||
|| -------------------- ||
|
||||
|| ||
|
||||
|| Date Author Change Id Release Description Of Change ||
|
||||
|| ---- ------ --------- ------- --------------------- ||
|
||||
|| 16.10.2017 Patrick Vogler B87D120 V 0.1.0 header file created ||
|
||||
|| ||
|
||||
|| -------------------------------------------------------------------------------------------------------------------- ||
|
||||
|| ||
|
||||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|
||||
|| ||
|
||||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|
||||
|| following conditions are met: ||
|
||||
|| ||
|
||||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|
||||
|| the following disclaimer. ||
|
||||
|| ||
|
||||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|
||||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|
||||
|| distribution. ||
|
||||
|| ||
|
||||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|
||||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|
||||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|
||||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|
||||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|
||||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|
||||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|
||||
|| ||
|
||||
\*==================================================================================================================================*/
|
||||
/*================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| ||
|
||||
|| 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: ||
|
||||
|| ||
|
||||
|| (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 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 are used to identify the spatial and temporal dimensions. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------*/
|
||||
#define DIM_X 1 // 1st Spatial Dimension.
|
||||
#define DIM_Y 2 // 2nd Spatial Dimension.
|
||||
#define DIM_Z 4 // 3rd Spatial Dimension.
|
||||
#define DIM_TS 8 // Temporal Dimension.
|
||||
#define DIM_ALL 15 // All Dimensions.
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! 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 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 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
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! These Constants are used for codestream parsing. !
|
||||
! !
|
||||
! CONSTANTS: !
|
||||
! ----------- !
|
||||
! Constant Description !
|
||||
! -------- ----------- !
|
||||
! CODESTREAM_OK No errors detectet in Codestream !
|
||||
! CODESTREAM_ERROR Error detectet in Codestream !
|
||||
! CODESTREAM_SGI_READ Global data-set information read !
|
||||
! CODESTREAM_SGC_READ Global control parameters read !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 01.08.2019 Patrick Vogler B87D120 V 0.1.0 Constants created !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
#define CODESTREAM_OK 0x00
|
||||
#define CODESTREAM_ERROR 0x80
|
||||
#define CODESTREAM_SGI_READ 0x01
|
||||
#define CODESTREAM_SGC_READ 0x02
|
||||
#define CODESTREAM_SAX_READ 0x04
|
||||
#define CODESTREAM_COM_READ 0x08
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! ENUM NAME: bwc_dwt_filter !
|
||||
! ----------- !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! These constants describe the wavelet filter used during the transform stage. !
|
||||
! !
|
||||
! PARAMETERS: !
|
||||
! ----------- !
|
||||
! Constant Description !
|
||||
! -------- ----------- !
|
||||
! bwc_dwt_9_7 - Cohen Daubechies Feauveau 9/7 Wavelet !
|
||||
! bwc_dwt_5_3 - LeGall 5/3 Wavelet !
|
||||
! bwc_dwt_haar - Haar Wavelet !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 07.12.2017 Patrick Vogler B87D120 V 0.1.0 Enum created !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
typedef enum{
|
||||
bwc_dwt_9_7,
|
||||
bwc_dwt_5_3,
|
||||
bwc_dwt_haar
|
||||
} bwc_dwt_filter;
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! ENUM NAME: bwc_dwt_filter !
|
||||
! ----------- !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! These constants describe the wavelet filter used during the transform stage. !
|
||||
! !
|
||||
! PARAMETERS: !
|
||||
! ----------- !
|
||||
! Constant Description !
|
||||
! -------- ----------- !
|
||||
! bwc_dwt_9_7 - Cohen Daubechies Feauveau 9/7 Wavelet !
|
||||
! bwc_dwt_5_3 - LeGall 5/3 Wavelet !
|
||||
! bwc_dwt_haar - Haar Wavelet !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 07.12.2017 Patrick Vogler B87D120 V 0.1.0 Enum created !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
typedef enum{
|
||||
bwc_dwt_9_7,
|
||||
bwc_dwt_5_3,
|
||||
bwc_dwt_haar
|
||||
} bwc_dwt_filter;
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! ENUM NAME: bwc_prog_ord !
|
||||
! ----------- !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! These constants describe the progression order used to pack the codestream. !
|
||||
! The organisation of the codesstream is carried out according to the following 5 cases. !
|
||||
! !
|
||||
! LRCP: RLCP: !
|
||||
! ----- for each Quality Layer: ----- for each Resolution: !
|
||||
! for each Resolution: for each Quality Layer: !
|
||||
! for each Parameter: for each Parameter: !
|
||||
! for each Precinct: for each Precinct: !
|
||||
! include Packet include Packet !
|
||||
! !
|
||||
! RPCL: PCRL: !
|
||||
! ----- for each Resolution: ----- for each Precinct: !
|
||||
! for each Precinct: for each Parameter: !
|
||||
! for each Parameter: for each Resolution: !
|
||||
! for each Quality Layer: for each Quality Layer: !
|
||||
! include Packet include Packet !
|
||||
! !
|
||||
! CPRL: !
|
||||
! ----- for each Quality Layer: !
|
||||
! for each Resolution: !
|
||||
! for each Parameter: !
|
||||
! for each Precinct: !
|
||||
! include Packet !
|
||||
! !
|
||||
! PARAMETERS: !
|
||||
! ----------- !
|
||||
! Constant Description !
|
||||
! -------- ----------- !
|
||||
! bwc_prog_LRCP - LRCP progression order !
|
||||
! bwc_prog_RLCP - RLCP progression order !
|
||||
! bwc_prog_RPCL - RPCL progression order !
|
||||
! bwc_prog_PCRL - PCRL progression order !
|
||||
! bwc_prog_CPRL - CPRL progression order !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 07.12.2017 Patrick Vogler B87D120 V 0.1.0 Enum created !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
typedef enum{
|
||||
bwc_prog_LRCP,
|
||||
bwc_prog_RLCP,
|
||||
bwc_prog_RPCL,
|
||||
bwc_prog_PCRL,
|
||||
bwc_prog_CPRL
|
||||
} bwc_prog_ord;
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! ENUM NAME: bwc_prog_ord !
|
||||
! ----------- !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! These constants describe the progression order used to pack the codestream. !
|
||||
! The organisation of the codesstream is carried out according to the following 5 cases. !
|
||||
! !
|
||||
! LRCP: RLCP: !
|
||||
! ----- for each Quality Layer: ----- for each Resolution: !
|
||||
! for each Resolution: for each Quality Layer: !
|
||||
! for each Parameter: for each Parameter: !
|
||||
! for each Precinct: for each Precinct: !
|
||||
! include Packet include Packet !
|
||||
! !
|
||||
! RPCL: PCRL: !
|
||||
! ----- for each Resolution: ----- for each Precinct: !
|
||||
! for each Precinct: for each Parameter: !
|
||||
! for each Parameter: for each Resolution: !
|
||||
! for each Quality Layer: for each Quality Layer: !
|
||||
! include Packet include Packet !
|
||||
! !
|
||||
! CPRL: !
|
||||
! ----- for each Quality Layer: !
|
||||
! for each Resolution: !
|
||||
! for each Parameter: !
|
||||
! for each Precinct: !
|
||||
! include Packet !
|
||||
! !
|
||||
! PARAMETERS: !
|
||||
! ----------- !
|
||||
! Constant Description !
|
||||
! -------- ----------- !
|
||||
! bwc_prog_LRCP - LRCP progression order !
|
||||
! bwc_prog_RLCP - RLCP progression order !
|
||||
! bwc_prog_RPCL - RPCL progression order !
|
||||
! bwc_prog_PCRL - PCRL progression order !
|
||||
! bwc_prog_CPRL - CPRL progression order !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 07.12.2017 Patrick Vogler B87D120 V 0.1.0 Enum created !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
typedef enum{
|
||||
bwc_prog_LRCP,
|
||||
bwc_prog_RLCP,
|
||||
bwc_prog_RPCL,
|
||||
bwc_prog_PCRL,
|
||||
bwc_prog_CPRL
|
||||
} bwc_prog_ord;
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! ENUM NAME: bwc_quant_st !
|
||||
! ----------- !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! DESCRIPTION NEEDED !
|
||||
! !
|
||||
! PARAMETERS: !
|
||||
! ----------- !
|
||||
! Constant Description !
|
||||
! -------- ----------- !
|
||||
! - - !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 07.12.2017 Patrick Vogler B87D120 V 0.1.0 Enum created !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
typedef enum{
|
||||
bwc_qt_none,
|
||||
bwc_qt_derived,
|
||||
} bwc_quant_st;
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! ENUM NAME: bwc_quant_st !
|
||||
! ----------- !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! DESCRIPTION NEEDED !
|
||||
! !
|
||||
! PARAMETERS: !
|
||||
! ----------- !
|
||||
! Constant Description !
|
||||
! -------- ----------- !
|
||||
! - - !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 07.12.2017 Patrick Vogler B87D120 V 0.1.0 Enum created !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
typedef enum{
|
||||
bwc_qt_none,
|
||||
bwc_qt_derived,
|
||||
} bwc_quant_st;
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! ENUM NAME: bwc_tile_instr !
|
||||
! ----------- !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! DESCRIPTION NEEDED !
|
||||
! !
|
||||
! PARAMETERS: !
|
||||
! ----------- !
|
||||
! Constant Description !
|
||||
! -------- ----------- !
|
||||
! - - !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 17.04.2019 Patrick Vogler B87D120 V 0.1.0 Enum created !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
typedef enum{
|
||||
bwc_tile_sizeof,
|
||||
bwc_tile_numbof,
|
||||
} bwc_tile_instr;
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! ENUM NAME: bwc_tile_instr !
|
||||
! ----------- !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! DESCRIPTION NEEDED !
|
||||
! !
|
||||
! PARAMETERS: !
|
||||
! ----------- !
|
||||
! Constant Description !
|
||||
! -------- ----------- !
|
||||
! - - !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 17.04.2019 Patrick Vogler B87D120 V 0.1.0 Enum created !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
typedef enum{
|
||||
bwc_tile_sizeof,
|
||||
bwc_tile_numbof,
|
||||
} bwc_tile_instr;
|
||||
#endif
|
|
@ -1,328 +1,169 @@
|
|||
/*==================================================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| File: dwt.h ||
|
||||
|| ----- ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| DESCRIPTION NEEDED. ||
|
||||
|| ||
|
||||
|| STRUCTS: ||
|
||||
|| -------- ||
|
||||
|| ||
|
||||
|| PUBLIC FUNCTIONS: ||
|
||||
|| ----------------- ||
|
||||
|| ||
|
||||
|| DEVELOPMENT HISTORY: ||
|
||||
|| -------------------- ||
|
||||
|| ||
|
||||
|| Date Author Change Id Release Description Of Change ||
|
||||
|| ---- ------ --------- ------- --------------------- ||
|
||||
|| 21.03.2018 Patrick Vogler B87D120 V 0.1.0 header file created ||
|
||||
|| ||
|
||||
|| -------------------------------------------------------------------------------------------------------------------- ||
|
||||
|| ||
|
||||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|
||||
|| ||
|
||||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|
||||
|| following conditions are met: ||
|
||||
|| ||
|
||||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|
||||
|| the following disclaimer. ||
|
||||
|| ||
|
||||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|
||||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|
||||
|| distribution. ||
|
||||
|| ||
|
||||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|
||||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|
||||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|
||||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|
||||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|
||||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|
||||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|
||||
|| ||
|
||||
\*==================================================================================================================================*/
|
||||
/*================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| ||
|
||||
|| 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: ||
|
||||
|| ||
|
||||
|| (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 DWT_H
|
||||
#define DWT_H
|
||||
/************************************************************************************************************\
|
||||
|| _ _ _ ____ _ _ _ ___ ____ ||
|
||||
|| | |\ | | | | | | \ |___ ||
|
||||
|| | | \| |___ |___ |__| |__/ |___ ||
|
||||
|| ||
|
||||
\************************************************************************************************************/
|
||||
#include "types.h"
|
||||
/************************************************************************************************\
|
||||
|| _ _ _ ____ _ _ _ ___ ____ ||
|
||||
|| | |\ | | | | | | \ |___ ||
|
||||
|| | | \| |___ |___ |__| |__/ |___ ||
|
||||
|| ||
|
||||
\************************************************************************************************/
|
||||
#include "types.h"
|
||||
|
||||
/************************************************************************************************************\
|
||||
|| _ _ ____ ____ ____ ____ ____ ||
|
||||
|| |\/| |__| | |__/ | | [__ ||
|
||||
|| | | | | |___ | \ |__| ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************************/
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! This macro defines the maximum decomposition level up to which the wavelet filer energy gain !
|
||||
! is calculated. Beyond the maximum decomposition level the energy gain will only be !
|
||||
! approximated. !
|
||||
! !
|
||||
! Macros: !
|
||||
! ------- !
|
||||
! Macro Description !
|
||||
! ----- ----------- !
|
||||
! MAX_DECOMPOSITION_LEVELS - Maximum number of wavelet layers for which the energy !
|
||||
! gain is calculated. !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 20.03.2018 Patrick Vogler B87D120 V 0.1.0 Macros created !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
#define MAX_DECOMPOSITION_LEVELS 4
|
||||
/************************************************************************************************\
|
||||
|| _ _ ____ ____ ____ ____ ____ ||
|
||||
|| |\/| |__| | |__/ | | [__ ||
|
||||
|| | | | | |___ | \ |__| ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************/
|
||||
/*----------------------------------------------------------------------------------------------*\
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! Maximum number of wavelet layers for which the energy gain is calculated. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------*/
|
||||
#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. !
|
||||
! !
|
||||
! Macros: !
|
||||
! ------- !
|
||||
! Macro Description !
|
||||
! ----- ----------- !
|
||||
! DWT_9X7_H0 !
|
||||
! DWT_9X7_H1 !
|
||||
! DWT_9X7_H2 - Coefficients for the (9-7) !
|
||||
! DWT_9X7_H3 low pass synthesis filter. !
|
||||
! !
|
||||
! DWT_9X7_G0 !
|
||||
! DWT_9X7_G1 !
|
||||
! DWT_9X7_G2 !
|
||||
! DWT_9X7_G3 - Coefficients for the (9-7) !
|
||||
! DWT_9X7_G4 high pass synthesis filter. !
|
||||
! !
|
||||
! ALPHA !
|
||||
! BETA !
|
||||
! GAMMA !
|
||||
! DELTA !
|
||||
! KAPPA_H - Coefficients for the (9-7) !
|
||||
! KAPPA_L lifting scheme. !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 20.03.2018 Patrick Vogler B87D120 V 0.1.0 Macros created !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
#define DWT_9X7_H0 1.115087052457000f
|
||||
#define DWT_9X7_H1 0.591271763114250f
|
||||
#define DWT_9X7_H2 -0.057543526228500f
|
||||
#define DWT_9X7_H3 -0.091271763114250f
|
||||
/*----------------------------------------------------------------------------------------------*\
|
||||
! !
|
||||
! 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. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------*/
|
||||
#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_G2 -0.156446533057980f
|
||||
#define DWT_9X7_G3 0.033728236885750f
|
||||
#define DWT_9X7_G4 0.053497514821620f
|
||||
#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 BETA -0.052980118572961f
|
||||
#define GAMMA 0.882911075530934f
|
||||
#define DELTA 0.360523644801462f
|
||||
#define KAPPA_H 1.230174104914001f
|
||||
#define KAPPA_L 0.812893066115961f
|
||||
#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. !
|
||||
! !
|
||||
! 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
|
||||
/*----------------------------------------------------------------------------------------------*\
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! These macros define the irrational coefficients for the high and low pass !
|
||||
! synthesis filters associated with the (5-3) LeGall-Wavelet. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------*/
|
||||
#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_G2 -0.125f
|
||||
#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. !
|
||||
! !
|
||||
! 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
|
||||
/*----------------------------------------------------------------------------------------------*\
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! These macros define the irrational coefficients for the high and low pass !
|
||||
! synthesis filters associated with the Haar-Wavelet. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------*/
|
||||
#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. !
|
||||
! !
|
||||
! 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];
|
||||
/************************************************************************************************\
|
||||
|| ____ _ _ ___ ____ ____ _ _ ____ _ _ _ ____ ____ _ ____ ___ _ ____ ____ ||
|
||||
|| |___ \/ | |___ |__/ |\ | |__| | | | |__| |__/ | |__| |__] | |___ [__ ||
|
||||
|| |___ _/\_ | |___ | \ | \| | | |___ \/ | | | \ | | | |__] |___ |___ ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************/
|
||||
/*----------------------------------------------------------------------------------------------*\
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! 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. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------*/
|
||||
extern double DWT_ENERGY_GAIN_LUT[3][2 * MAX_DECOMP_LEVELS + 2];
|
||||
|
||||
/************************************************************************************************************\
|
||||
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|
||||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|
||||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************************/
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! FUNCTION NAME: uchar initialize_gain_lut() !
|
||||
! -------------- !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! This function calculates the energy gain factor Gb for the one dimensional, dyadic tree !
|
||||
! structured CDF-(9/7), LeGall-(5/3) and Haar wavelet transform with 5 levels. The energy !
|
||||
! gain factors are calculated according to equation (4.39) from JPEG2000 by David S. Taubman !
|
||||
! and Michael W. Marcellin (p. 193): !
|
||||
! !
|
||||
! s_L1[n] = g0[n], s_H1[n] = h0[n], !
|
||||
! s_Ld[n] = ∑(s_Ld-1[k]*g0[n-2k], k), s_Hd[n] = ∑(s_Hd-1[k]*g0[n-2k], k). !
|
||||
! !
|
||||
! The energy gain factors are stored in their corresponding lookup tables and used to calcu- !
|
||||
! late the energy gain for the multi dimensional wavelet transforms according to equation !
|
||||
! (4.40) from JPEG2000 by David S. Taubman and Michael W. Marcellin (p.193): !
|
||||
! !
|
||||
! s_LLD[n1,n2] = s_LD[n1] * s_LD[n2] => G_LLD = G_LD * G_LD !
|
||||
! s_HLD[n1,n2] = s_LD[n1] * s_HD[n2] => G_HLD = G_LD * G_HD !
|
||||
! s_LHD[n1,n2] = s_HD[n1] * s_LD[n2] => G_LHD = G_HD * G_LD !
|
||||
! s_HHD[n1,n2] = s_HD[n1] * s_HD[n2] => G_HHD = G_HD * G_HD !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
uchar
|
||||
initialize_gain_lut();
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! FUNCTION NAME: bwc_float get_dwt_energy_gain(bwc_field *field, uchar highband_flag, uint level) !
|
||||
! -------------- !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! This function evaluates the energy gain factor according to the the specified decomposition !
|
||||
! level. For decomposition levels larger than MAX_DECOMPOSITION_LEVELS the filter gain for !
|
||||
! the extra levels is approximated by multiplying the energy gain factor by 2. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
bwc_float
|
||||
get_dwt_energy_gain(bwc_field *field, uchar highband_flag, uint16 level);
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! FUNCTION NAME: uchar forward_discrete_wavelet_transform(bwc_field *const field, !
|
||||
! -------------- bwc_parameter *const parameter) !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! This function performs the forward discrete wavelet transform on the current tile param- !
|
||||
! eter. After loading the flow field samples for a row, column or spatial/temporal slice !
|
||||
! into a working buffer, a boundary extension operation is performed to ensure an approp. !
|
||||
! sample base. The working buffer is then transform using the wavelet kernel selected for !
|
||||
! the spatial or temporal dimension, sorted into high- and low-frequency samples and flushed !
|
||||
! back into the tile parameter memory block. This operation is performed for every row, !
|
||||
! column and spatial/temporal slice for ndecomp number of decomposition levels. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
uchar
|
||||
forward_discrete_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter);
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! FUNCTION NAME: uchar inverse_discrete_wavelet_transform(bwc_field *const field, !
|
||||
! -------------- bwc_parameter *const parameter) !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! This function performs the inverse discrete wavelet transform on the current tile param- !
|
||||
! eter. After loading the interweaved wavelet coefficients for a row, column or spatial/ !
|
||||
! temporal slice into a working buffer, a boundary extension operation is performed to !
|
||||
! ensure an appropriate sample base. The working buffer is then transform using the wave- !
|
||||
! let kernel selected for the spatial or temporal dimension and flushed back into the tile !
|
||||
! parameter memory block. This operation is performed for every row, column and spatial/ !
|
||||
! temporal slice for ndecomp number of decomposition levels. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
uchar
|
||||
inverse_discrete_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter);
|
||||
/************************************************************************************************\
|
||||
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|
||||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|
||||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************/
|
||||
uchar initialize_gain_lut ();
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
bwc_float get_dwt_energy_gain (bwc_field *const field,
|
||||
uchar const highband_flag,
|
||||
uint16 const level);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
uchar forward_wavelet_transform (bwc_field *const field,
|
||||
bwc_parameter *const parameter);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
uchar inverse_wavelet_transform (bwc_field *const field,
|
||||
bwc_parameter *const parameter);
|
||||
#endif
|
|
@ -1,380 +1,147 @@
|
|||
/*==================================================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| Version 0.1.1 ||
|
||||
|| ||
|
||||
|| File: bwc.h ||
|
||||
|| ----- ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| This header defines DESCRIPTION NEEDED. ||
|
||||
|| ||
|
||||
|| STRUCTS: ||
|
||||
|| -------- ||
|
||||
|| ||
|
||||
|| PUBLIC FUNCTIONS: ||
|
||||
|| ----------------- ||
|
||||
|| - bwc_kill_compression ||
|
||||
|| - bwc_add_param ||
|
||||
|| - bwc_set_quantization_style ||
|
||||
|| - bwc_set_progression ||
|
||||
|| - bwc_set_kernels ||
|
||||
|| - bwc_set_levels ||
|
||||
|| - bwc_set_codeblocks ||
|
||||
|| - bwc_set_qm ||
|
||||
|| - bwc_set_tiles ||
|
||||
|| - bwc_initialize_compression ||
|
||||
|| - bwc_create_compression ||
|
||||
|| ||
|
||||
|| DEVELOPMENT HISTORY: ||
|
||||
|| -------------------- ||
|
||||
|| ||
|
||||
|| Date Author Change Id Release Description Of Change ||
|
||||
|| ---- ------ --------- ------- --------------------- ||
|
||||
|| - Patrick Vogler B87D120 V 0.1.0 header file created ||
|
||||
|| ||
|
||||
|| -------------------------------------------------------------------------------------------------------------------- ||
|
||||
|| ||
|
||||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|
||||
|| ||
|
||||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|
||||
|| following conditions are met: ||
|
||||
|| ||
|
||||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|
||||
|| the following disclaimer. ||
|
||||
|| ||
|
||||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|
||||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|
||||
|| distribution. ||
|
||||
|| ||
|
||||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|
||||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|
||||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|
||||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|
||||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|
||||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|
||||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|
||||
|| ||
|
||||
\*==================================================================================================================================*/
|
||||
#ifndef BWC_H
|
||||
#define BWC_H
|
||||
/************************************************************************************************************\
|
||||
|| _ _ _ ____ _ _ _ ___ ____ ||
|
||||
|| | |\ | | | | | | \ |___ ||
|
||||
|| | | \| |___ |___ |__| |__/ |___ ||
|
||||
|| ||
|
||||
\************************************************************************************************************/
|
||||
#include "bitstream.h"
|
||||
#include "codestream.h"
|
||||
#include "constants.h"
|
||||
#include "macros.h"
|
||||
#include "mq_types.h"
|
||||
#include "types.h"
|
||||
/*================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| 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 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, 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_create_compression(bwc_field *field, char *rate_control) !
|
||||
! -------------- !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! This function creates the field structure used to compress a floating point array defined !
|
||||
! by the bwc_initialize function. For a compression run, the rate_control and instr arguments !
|
||||
! need to be passed to the function to properly set up the lossy compression stage. Here, the !
|
||||
! instr parameter defines whether rate control is defined by a BITRATE - a floating point val-!
|
||||
! ue defining the average number of bits per datapoint - and ACCURACY - an integer value de- !
|
||||
! fining the exponent of the maximum allowable error (i.e. 15 for err = 1e-15). !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
uchar
|
||||
bwc_create_compression(bwc_field *field, char *rate_control);
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! FUNCTION NAME: uchar bwc_compress(bwc_field *const field, bwc_float *const data) !
|
||||
! -------------- !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! Description needed. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
uchar
|
||||
bwc_compress(bwc_field *const field, bwc_data *const data);
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! FUNCTION NAME: void bwc_create_compression(bwc_field **field_ptr, char *rate_control, uchar instr) !
|
||||
! -------------- !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! This function parses the supplied bwc codestream and sets up the field structure used to !
|
||||
! decompress the numerical dataset. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
bwc_field *
|
||||
bwc_create_decompression(bwc_data *const data, uint8 layer);
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! FUNCTION NAME: void bwc_create_compression(bwc_field **field, float rate_control, uchar instr) !
|
||||
! -------------- !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! This function creates the field structure used to compress a floating point array defined !
|
||||
! by the bwc_initialize function at a prescribed bitrate or accuracy. In this context, the !
|
||||
! bitrate is a floating point value defining the average number of bits per datapoint and !
|
||||
! the accuracy is an integer value defining the exponent of the maximum allowable error !
|
||||
! (i.e. 15 for err = 1e-15). !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
uchar
|
||||
bwc_decompress(bwc_field *const field, bwc_data *const data);
|
||||
/************************************************************************************************\
|
||||
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|
||||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|
||||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************/
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
bwc_data* bwc_initialize_data (double *const field,
|
||||
uint64 const nX,
|
||||
uint64 const nY,
|
||||
uint64 const nZ,
|
||||
uint16 const nTS,
|
||||
uint8 const nPar,
|
||||
char *const file_extension);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
void bwc_add_param (bwc_data *const data,
|
||||
char *const name,
|
||||
uint8 const precision);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
void bwc_get_data (bwc_data *const data,
|
||||
uchar *const buffer,
|
||||
uint64 const size);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
void bwc_free_data (bwc_data *const data);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
uchar create_field (bwc_field *const field);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
void bwc_kill_compression (bwc_field *const field);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
bwc_field* bwc_initialize_field (bwc_data *const data);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
void bwc_set_error_resilience (bwc_field *const field);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
void bwc_set_quant_style (bwc_field *const field,
|
||||
bwc_quant_st const quantization_style);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
void bwc_set_quant_step_size (bwc_field *const field,
|
||||
double const delta);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
void bwc_set_progression (bwc_field *const field,
|
||||
bwc_prog_ord const progression);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
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 decompX,
|
||||
uint8 const decompY,
|
||||
uint8 const decompZ,
|
||||
uint8 const decompTS);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
void bwc_set_precincts (bwc_field *const field,
|
||||
uint8 const pX,
|
||||
uint8 const pY,
|
||||
uint8 const pZ,
|
||||
uint8 const pTS);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
void bwc_set_codeblocks (bwc_field *const field,
|
||||
uint8 const cbX,
|
||||
uint8 const cbY,
|
||||
uint8 const cbZ,
|
||||
uint8 const cbTS);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
void bwc_set_qm (bwc_field *const field,
|
||||
uint8 const Qm);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
void bwc_set_tiles (bwc_field *const field,
|
||||
uint64 const tilesX,
|
||||
uint64 const tilesY,
|
||||
uint64 const tilesZ,
|
||||
uint64 const tilesTS,
|
||||
bwc_tile_instr const instr);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
uchar bwc_create_compression (bwc_field *const field,
|
||||
char *const rate_control);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
uchar bwc_compress (bwc_field *const field,
|
||||
bwc_data *const data);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
bwc_field* bwc_create_decompression (bwc_data *const data,
|
||||
uint8 const layer);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
uchar bwc_decompress (bwc_field *const field,
|
||||
bwc_data *const data);
|
||||
#endif
|
|
@ -1,140 +1,82 @@
|
|||
/*==================================================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| File: macros.h ||
|
||||
|| ----- ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| DESCRIPTION NEEDED. ||
|
||||
|| ||
|
||||
|| STRUCTS: ||
|
||||
|| -------- ||
|
||||
|| ||
|
||||
|| PUBLIC FUNCTIONS: ||
|
||||
|| ----------------- ||
|
||||
|| ||
|
||||
|| DEVELOPMENT HISTORY: ||
|
||||
|| -------------------- ||
|
||||
|| ||
|
||||
|| Date Author Change Id Release Description Of Change ||
|
||||
|| ---- ------ --------- ------- --------------------- ||
|
||||
|| 29.05.2017 Patrick Vogler B87D120 V 0.1.0 header file created ||
|
||||
|| ||
|
||||
|| -------------------------------------------------------------------------------------------------------------------- ||
|
||||
|| ||
|
||||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|
||||
|| ||
|
||||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|
||||
|| following conditions are met: ||
|
||||
|| ||
|
||||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|
||||
|| the following disclaimer. ||
|
||||
|| ||
|
||||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|
||||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|
||||
|| distribution. ||
|
||||
|| ||
|
||||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|
||||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|
||||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|
||||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|
||||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|
||||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|
||||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|
||||
|| ||
|
||||
\*==================================================================================================================================*/
|
||||
/*================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| ||
|
||||
|| 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: ||
|
||||
|| ||
|
||||
|| (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_MACROSS_H
|
||||
#define BWC_MACROSS_H
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! These Macros are used to calculate the maximum and minimum between two values. !
|
||||
! !
|
||||
! Macros: !
|
||||
! ------- !
|
||||
! Macro Description !
|
||||
! ----- ----------- !
|
||||
! MAX(x, y) - Returns the maximum value of two values. !
|
||||
! !
|
||||
! MIN(x, y) - Returns the minimum value of two values. !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 21.03.2018 Patrick Vogler B87D120 V 0.1.0 Macros created !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
#define MAX(x, y) (((x) < (y))?(y):(x))
|
||||
#define MIN(x, y) (((x) > (y))?(y):(x))
|
||||
/*----------------------------------------------------------------------------------------------*\
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! These macros define simple mathematicall oprators. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------*/
|
||||
#define MAX(x, y) (((x) < (y))?(y):(x)) // Returns maximum between two values
|
||||
#define MIN(x, y) (((x) > (y))?(y):(x)) // Returns minimum between two values
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! This macro is used to evaluate the size of an array. !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 16.09.2019 Patrick Vogler B87D120 V 0.1.0 Macros created !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
#define GET_DIM(x) (sizeof(x)/sizeof(*(x)))
|
||||
/*----------------------------------------------------------------------------------------------*\
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! This macro is used to evaluate the size of an array. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------*/
|
||||
#define GET_DIM(x) (sizeof(x)/sizeof(*(x)))
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! These Constants describe the codestream markers used to create the embedded codestream. !
|
||||
! !
|
||||
! CONSTANTS: !
|
||||
! ----------- !
|
||||
! Constant Description !
|
||||
! -------- ----------- !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 01.12.2017 Patrick Vogler B87D120 V 0.1.0 Constants created !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
#define MEMERROR "o##########################################################o\n"\
|
||||
"| ERROR: Out of memory |\n"\
|
||||
"o##########################################################o\n"
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! These Constants describe the codestream markers used to create the embedded codestream. !
|
||||
! !
|
||||
! CONSTANTS: !
|
||||
! ----------- !
|
||||
! Constant Description !
|
||||
! -------- ----------- !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 01.12.2017 Patrick Vogler B87D120 V 0.1.0 Constants created !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
#define CSERROR "o##########################################################o\n"\
|
||||
"| ERROR: Invalid Codestream |\n"\
|
||||
/*----------------------------------------------------------------------------------------------*\
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! These Constants define common error messages used throughout the bwc library. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------*/
|
||||
#define MEMERROR "o##########################################################o\n"\
|
||||
"| ERROR: Out of memory |\n"\
|
||||
"o##########################################################o\n"
|
||||
|
||||
#define CSERROR "o##########################################################o\n"\
|
||||
"| ERROR: Invalid Codestream |\n"\
|
||||
"o##########################################################o\n"
|
||||
#endif
|
|
@ -1,155 +1,114 @@
|
|||
/*==================================================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| File: mq.h ||
|
||||
|| ----- ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| DESCRIPTION NEEDED. ||
|
||||
|| ||
|
||||
|| STRUCTS: ||
|
||||
|| -------- ||
|
||||
|| ||
|
||||
|| PUBLIC FUNCTIONS: ||
|
||||
|| ----------------- ||
|
||||
|| ||
|
||||
|| DEVELOPMENT HISTORY: ||
|
||||
|| -------------------- ||
|
||||
|| ||
|
||||
|| Date Author Change Id Release Description Of Change ||
|
||||
|| ---- ------ --------- ------- --------------------- ||
|
||||
|| 13.02.2019 Patrick Vogler B87D120 V 0.1.0 header file created ||
|
||||
|| ||
|
||||
|| -------------------------------------------------------------------------------------------------------------------- ||
|
||||
|| ||
|
||||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|
||||
|| ||
|
||||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|
||||
|| following conditions are met: ||
|
||||
|| ||
|
||||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|
||||
|| the following disclaimer. ||
|
||||
|| ||
|
||||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|
||||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|
||||
|| distribution. ||
|
||||
|| ||
|
||||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|
||||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|
||||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|
||||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|
||||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|
||||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|
||||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|
||||
|| ||
|
||||
\*==================================================================================================================================*/
|
||||
/*================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| 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. ||
|
||||
|| ||
|
||||
\*================================================================================================*/
|
||||
#ifndef MQ_H
|
||||
#define MQ_H
|
||||
/************************************************************************************************\
|
||||
|| _ _ _ ____ _ _ _ ___ ____ ||
|
||||
|| | |\ | | | | | | \ |___ ||
|
||||
|| | | \| |___ |___ |__| |__/ |___ ||
|
||||
|| ||
|
||||
\************************************************************************************************/
|
||||
#include "tier1.h"
|
||||
#include "types.h"
|
||||
|
||||
/************************************************************************************************************\
|
||||
|| _ _ _ ____ _ _ _ ___ ____ ||
|
||||
|| | |\ | | | | | | \ |___ ||
|
||||
|| | | \| |___ |___ |__| |__/ |___ ||
|
||||
|| ||
|
||||
\************************************************************************************************************/
|
||||
#include "types.h"
|
||||
/************************************************************************************************\
|
||||
|| ____ ____ _ _ ____ ___ ____ _ _ ___ ____ ||
|
||||
|| | | | |\ | [__ | |__| |\ | | [__ ||
|
||||
|| |___ |__| | \| ___] | | | | \| | ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************/
|
||||
/*----------------------------------------------------------------------------------------------*\
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! 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. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------*/
|
||||
#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
|
||||
|
||||
/************************************************************************************************************\
|
||||
|| ____ ____ _ _ ____ ___ ____ _ _ ___ ____ ||
|
||||
|| | | | |\ | [__ | |__| |\ | | [__ ||
|
||||
|| |___ |__| | \| ___] | | | | \| | ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************************/
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! These macros define the context state indices used by the mq coder for probability estima- !
|
||||
! tion. For a more thorough treatment of the context assignments see page 487 JPEG2000 by !
|
||||
! David S. Taubman and Michael W. Marcellin. !
|
||||
! !
|
||||
! Macros: !
|
||||
! ------- !
|
||||
! Macro Description !
|
||||
! ----- ----------- !
|
||||
! CONTEXT_SIG - Starting indices for the significance context labels. !
|
||||
! CONTEXT_RUN - Indices for the run context label. !
|
||||
! CONTEXT_SIGN - Starting indices for the sign context labels. !
|
||||
! CONTEXT_MAG - Starting indices for the magnitude context labels. !
|
||||
! CONTEXT_UNI - Indices for the uni context label. !
|
||||
! CONTEXT_TOTAL - Total number of context labels. !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 21.02.2019 Patrick Vogler B87D120 V 0.1.0 Macros created !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
#define CONTEXT_SIG 0
|
||||
#define CONTEXT_RUN 9
|
||||
#define CONTEXT_SIGN 10
|
||||
#define CONTEXT_MAG 15
|
||||
#define CONTEXT_UNI 18
|
||||
#define CONTEXT_TOTAL 19
|
||||
|
||||
/************************************************************************************************************\
|
||||
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|
||||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|
||||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************************/
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! TYPE NAME: Template !
|
||||
! ----------- !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! DESCRIPTION NEEDED !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
uchar
|
||||
initialize_bit_encoder(bwc_coder *const coder, const uint8 number_of_contexts);
|
||||
|
||||
uchar
|
||||
bit_encoder_next_run(bwc_bit_coder *const bitcoder);
|
||||
|
||||
void
|
||||
bit_encode(bwc_bit_coder *const bitcoder, const uint8 s, const uint8 k);
|
||||
|
||||
void
|
||||
bit_encoder_truncation_length_min(bwc_coder_state *const state);
|
||||
|
||||
void
|
||||
bit_encoder_termination(bwc_bit_coder *const bitcoder);
|
||||
|
||||
void
|
||||
free_bit_encoder(bwc_coder *const coder);
|
||||
|
||||
uchar
|
||||
initialize_bit_decoder(bwc_coder *const coder, const uint8 number_of_contexts, const int64 Lmax);
|
||||
|
||||
uint8
|
||||
bit_decode(bwc_bit_coder *const bitcoder, const uint8 k);
|
||||
|
||||
uint64
|
||||
bit_coder_get_no_bytes(bwc_bit_coder *const bitcoder);
|
||||
|
||||
void
|
||||
bit_coder_get_pass_lengths(bwc_bit_coder *const bitcoder, bwc_encoded_cblk *const encoded_cblk);
|
||||
|
||||
void
|
||||
bit_coder_reset_ptr(bwc_bit_coder *const bitcoder, uchar *const memory);
|
||||
/************************************************************************************************\
|
||||
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|
||||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|
||||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************/
|
||||
uchar initialize_mq_encoder (bwc_coder *const coder,
|
||||
uint8 const number_of_contexts);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
uchar mq_next_run (bwc_bit_coder *const bitcoder);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
void mq_bit_encode (bwc_bit_coder *const bitcoder,
|
||||
uint8 const s,
|
||||
uint8 const k);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
void mq_truncation_length_min (bwc_coder_state *const state);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
void mq_termination (bwc_bit_coder *const bitcoder);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
void free_mq_encoder (bwc_coder *const coder);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
uchar initialize_mq_decoder (bwc_coder *const coder,
|
||||
uint8 const number_of_contexts,
|
||||
int64 const Lmax);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
uint8 mq_bit_decode (bwc_bit_coder *const bitcoder,
|
||||
uint8 const k);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
uint64 mq_get_no_bytes (bwc_bit_coder *const bitcoder);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
void mq_get_pass_lengths (bwc_bit_coder *const bitcoder,
|
||||
bwc_encoded_cblk *const encoded_cblk);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
void mq_reset_ptr (bwc_bit_coder *const bitcoder,
|
||||
uchar *const memory);
|
||||
#endif
|
|
@ -1,222 +1,121 @@
|
|||
/*==================================================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| File: prim_types_double.h ||
|
||||
|| ----- ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| This header defines a set of derrived types used for the mq encoder during the entropy encoding stage of the big whoop ||
|
||||
|| compression algorithm. ||
|
||||
|| ||
|
||||
|| STRUCTS: ||
|
||||
|| -------- ||
|
||||
|| - bwc_context_state ||
|
||||
|| - bwc_coder_state ||
|
||||
|| - bwc_bit_coder ||
|
||||
|| ||
|
||||
|| DEVELOPMENT HISTORY: ||
|
||||
|| -------------------- ||
|
||||
|| ||
|
||||
|| Date Author Change Id Release Description Of Change ||
|
||||
|| ---- ------ --------- ------- --------------------- ||
|
||||
|| 20.02.2019 Patrick Vogler B87D120 V 0.1.0 header file created ||
|
||||
|| ||
|
||||
|| -------------------------------------------------------------------------------------------------------------------- ||
|
||||
|| ||
|
||||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|
||||
|| ||
|
||||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|
||||
|| following conditions are met: ||
|
||||
|| ||
|
||||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|
||||
|| the following disclaimer. ||
|
||||
|| ||
|
||||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|
||||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|
||||
|| distribution. ||
|
||||
|| ||
|
||||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|
||||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|
||||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|
||||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|
||||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|
||||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|
||||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|
||||
|| ||
|
||||
\*==================================================================================================================================*/
|
||||
/*================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| ||
|
||||
|| 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: ||
|
||||
|| ||
|
||||
|| (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 MQ_TYPES_H
|
||||
#define MQ_TYPES_H
|
||||
/************************************************************************************************\
|
||||
|| _ _ _ ____ _ _ _ ___ ____ ||
|
||||
|| | |\ | | | | | | \ |___ ||
|
||||
|| | | \| |___ |___ |__| |__/ |___ ||
|
||||
|| ||
|
||||
\************************************************************************************************/
|
||||
#include <stdint.h>
|
||||
|
||||
/************************************************************************************************************\
|
||||
|| _ _ _ ____ _ _ _ ___ ____ ||
|
||||
|| | |\ | | | | | | \ |___ ||
|
||||
|| | | \| |___ |___ |__| |__/ |___ ||
|
||||
|| ||
|
||||
\************************************************************************************************************/
|
||||
#include <stdint.h>
|
||||
/************************************************************************************************\
|
||||
|| ___ ____ ____ ____ _ _ _ ____ ___ ___ _ _ ___ ____ ____ ||
|
||||
|| | \ |___ |__/ |__/ | | | |___ | \ | \_/ |__] |___ [__ ||
|
||||
|| |__/ |___ | \ | \ | \/ |___ |__/ | | | |___ ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************/
|
||||
/*----------------------------------------------------------------------------------------------*\
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! This structure is used to directly access the parameter codeblocks during !
|
||||
! entropy (de-)encoding to facilitate shared memory parallelization. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------*/
|
||||
typedef struct context
|
||||
{
|
||||
uint16_t p; // LPS probability estimate
|
||||
uint8_t sk; // Most probable symbol
|
||||
|
||||
/************************************************************************************************************\
|
||||
|| ___ ____ ____ ____ _ _ _ ____ ___ ___ _ _ ___ ____ ____ ||
|
||||
|| | \ |___ |__/ |__/ | | | |___ | \ | \_/ |__] |___ [__ ||
|
||||
|| |__/ |___ | \ | \ | \/ |___ |__/ | | | |___ ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************************/
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! STRUCT NAME: bwc_context_state !
|
||||
! ----------- !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! - !
|
||||
! !
|
||||
! PARAMETERS: !
|
||||
! ----------- !
|
||||
! Variable Type Description !
|
||||
! -------- ---- ----------- !
|
||||
! p unsigned int(16 bit) - LPS Probability estimate. !
|
||||
! !
|
||||
! sk unsigned int(8 bit) - Most Probable Symbol. !
|
||||
! !
|
||||
! DEPENDENCIES: !
|
||||
! ------------- !
|
||||
! Variable Type Description !
|
||||
! -------- ---- ----------- !
|
||||
! MPS context* - New context if the coded symbol is a !
|
||||
! Most Probable Symbol (MPS). !
|
||||
! !
|
||||
! LPS context* - New context if the coded symbol is a !
|
||||
! Least Probable Symbol (LPS). !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 14.02.2019 Patrick Vogler B87D120 V 0.1.0 struct created !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
typedef struct context
|
||||
{
|
||||
uint16_t p;
|
||||
uint8_t sk;
|
||||
const struct context *const MPS;
|
||||
const struct context *const LPS;
|
||||
} bwc_context_state;
|
||||
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. !
|
||||
! !
|
||||
! C unsigned int(32 bit) - Lower bound register used to define !
|
||||
! the lower bound of the coding interval. !
|
||||
! !
|
||||
! A unsigned int(16 bit) - Length register used to define the up- !
|
||||
! bound of the coding interval. !
|
||||
! !
|
||||
! t int(8 bit) - Down counter which is used to evaluate !
|
||||
! when partially generated code bits !
|
||||
! should be moved out of the C register !
|
||||
! in to the temporary byte buffer b. !
|
||||
! !
|
||||
! b unsigned char* - Byte buffer. !
|
||||
! !
|
||||
! T unsigned char - Temporary byte buffer. !
|
||||
! !
|
||||
! DEPENDENCIES: !
|
||||
! ------------- !
|
||||
! Variable Type Description !
|
||||
! -------- ---- ----------- !
|
||||
! next state* - Coder state of the next coding pass. !
|
||||
! !
|
||||
! prev state* - Coder state of the previous coding !
|
||||
! pass. !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 14.02.2019 Patrick Vogler B87D120 V 0.1.0 struct created !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
typedef struct state
|
||||
{
|
||||
int64_t L;
|
||||
uint32_t C;
|
||||
uint16_t A;
|
||||
int8_t t;
|
||||
unsigned char *b;
|
||||
unsigned char T;
|
||||
struct state *next;
|
||||
struct state *prev;
|
||||
} bwc_coder_state;
|
||||
/*----------------------------------------------------------------------------------------------*\
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! DESCRIPTION NEEDED !
|
||||
! | | !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------*/
|
||||
typedef struct state
|
||||
{
|
||||
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
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! STRUCT NAME: bwc_bit_coder !
|
||||
! ----------- !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! - !
|
||||
! !
|
||||
! PARAMETERS: !
|
||||
! ----------- !
|
||||
! Variable Type Description !
|
||||
! -------- ---- ----------- !
|
||||
! Lmax unsigned int(64 bit) - Number of code bytes (used by decoder). !
|
||||
! !
|
||||
! nContext unsigned int(8 bit) - Number of context states that need to !
|
||||
! be tracked during (de)compression. !
|
||||
! !
|
||||
! b unsigned char* - Temporary byte buffer. !
|
||||
! !
|
||||
! DEPENDENCIES: !
|
||||
! ------------- !
|
||||
! Variable Type Description !
|
||||
! -------- ---- ----------- !
|
||||
! state bwc_coder_state* - Coder state for the current coding !
|
||||
! pass. !
|
||||
! !
|
||||
! context bwc_coder_state* - Context states for the current coding !
|
||||
! pass. !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 14.02.2019 Patrick Vogler B87D120 V 0.1.0 struct created !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
typedef struct
|
||||
{
|
||||
int64_t Lmax;
|
||||
uint8_t nContext;
|
||||
unsigned char *b;
|
||||
bwc_coder_state *state;
|
||||
bwc_context_state const **context;
|
||||
} bwc_bit_coder;
|
||||
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;
|
||||
|
||||
/*----------------------------------------------------------------------------------------------*\
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! DESCRIPTION NEEDED !
|
||||
! | | !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------*/
|
||||
typedef struct
|
||||
{
|
||||
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
|
|
@ -1,163 +1,133 @@
|
|||
/*==================================================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| File: prim_types_double.h ||
|
||||
|| ----- ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| This header defines a set of basic arithmetic types with specified widths to be used in ||
|
||||
|| the big whoop compression algorithm. The width of an arithmetic type is defined as the ||
|
||||
|| number of bits used to store its value. ||
|
||||
|| ||
|
||||
|| DEVELOPMENT HISTORY: ||
|
||||
|| -------------------- ||
|
||||
|| ||
|
||||
|| Date Author Change Id Release Description Of Change ||
|
||||
|| ---- ------ --------- ------- --------------------- ||
|
||||
|| 07.12.2017 Patrick Vogler B87D120 V 0.1.0 header file created ||
|
||||
|| ||
|
||||
|| -------------------------------------------------------------------------------------------------------------------- ||
|
||||
|| ||
|
||||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|
||||
|| ||
|
||||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|
||||
|| following conditions are met: ||
|
||||
|| ||
|
||||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|
||||
|| the following disclaimer. ||
|
||||
|| ||
|
||||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|
||||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|
||||
|| distribution. ||
|
||||
|| ||
|
||||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|
||||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|
||||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|
||||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|
||||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|
||||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|
||||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|
||||
|| ||
|
||||
\*==================================================================================================================================*/
|
||||
/*================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| ||
|
||||
|| 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: ||
|
||||
|| ||
|
||||
|| (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_PRIM_TYPES_DOUBLE_H
|
||||
#define BWC_PRIM_TYPES_DOUBLE_H
|
||||
/************************************************************************************************\
|
||||
|| _ _ _ ____ _ _ _ ___ ____ ||
|
||||
|| | |\ | | | | | | \ |___ ||
|
||||
|| | | \| |___ |___ |__| |__/ |___ ||
|
||||
|| ||
|
||||
\************************************************************************************************/
|
||||
#include <stdint.h>
|
||||
|
||||
/************************************************************************************************************\
|
||||
|| _ _ _ ____ _ _ _ ___ ____ ||
|
||||
|| | |\ | | | | | | \ |___ ||
|
||||
|| | | \| |___ |___ |__| |__/ |___ ||
|
||||
|| ||
|
||||
\************************************************************************************************************/
|
||||
#include <stdint.h>
|
||||
/************************************************************************************************\
|
||||
|| ___ ____ _ _ _ _ ___ _ _ _ ____ ___ _ _ ___ ____ ____ ||
|
||||
|| |__] |__/ | |\/| | | | | | |___ | \_/ |__] |___ [__ ||
|
||||
|| | | \ | | | | | | \/ |___ | | | |___ ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************/
|
||||
typedef unsigned char uchar;
|
||||
typedef unsigned short ushort;
|
||||
typedef unsigned int uint;
|
||||
|
||||
/************************************************************************************************************\
|
||||
|| ___ ____ _ _ _ _ ___ _ _ _ ____ ___ _ _ ___ ____ ____ ||
|
||||
|| |__] |__/ | |\/| | | | | | |___ | \_/ |__] |___ [__ ||
|
||||
|| | | \ | | | | | | \/ |___ | | | |___ ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************************/
|
||||
typedef unsigned char uchar;
|
||||
typedef unsigned short ushort;
|
||||
typedef unsigned int uint;
|
||||
typedef int8_t int8;
|
||||
typedef uint8_t uint8;
|
||||
typedef int16_t int16;
|
||||
typedef uint16_t uint16;
|
||||
typedef int32_t int32;
|
||||
typedef uint32_t uint32;
|
||||
typedef int64_t int64;
|
||||
typedef uint64_t uint64;
|
||||
|
||||
typedef int8_t int8;
|
||||
typedef uint8_t uint8;
|
||||
typedef int16_t int16;
|
||||
typedef uint16_t uint16;
|
||||
typedef int32_t int32;
|
||||
typedef uint32_t uint32;
|
||||
typedef int64_t int64;
|
||||
typedef uint64_t uint64;
|
||||
typedef double bwc_float;
|
||||
typedef uint64 bwc_raw;
|
||||
|
||||
typedef double bwc_float;
|
||||
typedef uint64 bwc_raw;
|
||||
/************************************************************************************************\
|
||||
|| _ _ ____ ____ ____ ____ ____ ||
|
||||
|| |\/| |__| | |__/ | | [__ ||
|
||||
|| | | | | |___ | \ |__| ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************/
|
||||
/*----------------------------------------------------------------------------------------------*\
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! These macros describe the minimum and maximum values for a double precision IEEE !
|
||||
! 754 floating point variable. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------*/
|
||||
#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 minimum and maximum values for a double precision IEEE 754 !
|
||||
! floating point variable. !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 07.12.2018 Patrick Vogler B87D120 V 0.1.0 Constants created !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
#define FLT_MAX 1.7976931348623157e+308
|
||||
#define FLT_MIN 2.2250738585072014e-308
|
||||
/*----------------------------------------------------------------------------------------------*\
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! These 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. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------*/
|
||||
#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 precision (in bits and bytes) of the primitive floating point !
|
||||
! type used during (de)compression as well as the number of bits used to represent the !
|
||||
! mantissa and exponent fields. !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 07.12.2018 Patrick Vogler B87D120 V 0.1.0 Constants created !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
#define PREC_BIT 63
|
||||
#define PREC_MANTISSA 52
|
||||
#define PREC_EXPONENT 11
|
||||
#define PREC_BYTE 8
|
||||
/*----------------------------------------------------------------------------------------------*\
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! These macros describe the bit masks used to access the sign, mantissa and !
|
||||
! exponent of the derrived floating point type. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------*/
|
||||
#define SIGN 0x8000000000000000 // Sign bit mask
|
||||
#define MANTISSA 0x000FFFFFFFFFFFFF // Mantissa bit mask
|
||||
#define EXPONENT 0x7FF0000000000000 // Exponent bit mask
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! These constants describe the bit masks used to access the sign, mantissa and exponent of !
|
||||
! the primitive floating point type used during (de)compression. !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 07.12.2018 Patrick Vogler B87D120 V 0.1.0 Constants created !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
#define SIGN 0x8000000000000000
|
||||
#define MANTISSA 0x000FFFFFFFFFFFFF
|
||||
#define EXPONENT 0x7FF0000000000000
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! This constants describe the maximum number of encoding passes during the entropy encoding !
|
||||
! stage. !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 03.07.2018 Patrick Vogler B87D120 V 0.1.0 Constants created !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
#define MAXIMUM_NO_PASSES (64 * 3) - 2
|
||||
/*----------------------------------------------------------------------------------------------*\
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! This macro describe the maximum number of possible encoding passes during the !
|
||||
! entropy encoding stage. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------*/
|
||||
#define MAXIMUM_NO_PASSES (64 * 3) - 2
|
||||
#endif
|
|
@ -1,163 +1,133 @@
|
|||
/*==================================================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| File: prim_types_single.h ||
|
||||
|| ----- ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| This header defines a set of basic arithmetic types with specified widths to be used in ||
|
||||
|| the big whoop compression algorithm. The width of an arithmetic type is defined as the ||
|
||||
|| number of bits used to store its value. ||
|
||||
|| ||
|
||||
|| DEVELOPMENT HISTORY: ||
|
||||
|| -------------------- ||
|
||||
|| ||
|
||||
|| Date Author Change Id Release Description Of Change ||
|
||||
|| ---- ------ --------- ------- --------------------- ||
|
||||
|| 07.12.2017 Patrick Vogler B87D120 V 0.1.0 header file created ||
|
||||
|| ||
|
||||
|| -------------------------------------------------------------------------------------------------------------------- ||
|
||||
|| ||
|
||||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|
||||
|| ||
|
||||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|
||||
|| following conditions are met: ||
|
||||
|| ||
|
||||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|
||||
|| the following disclaimer. ||
|
||||
|| ||
|
||||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|
||||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|
||||
|| distribution. ||
|
||||
|| ||
|
||||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|
||||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|
||||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|
||||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|
||||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|
||||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|
||||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|
||||
|| ||
|
||||
\*==================================================================================================================================*/
|
||||
/*================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| ||
|
||||
|| 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: ||
|
||||
|| ||
|
||||
|| (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_PRIM_TYPES_SINGLE_H
|
||||
#define BWC_PRIM_TYPES_SINGLE_H
|
||||
/************************************************************************************************\
|
||||
|| _ _ _ ____ _ _ _ ___ ____ ||
|
||||
|| | |\ | | | | | | \ |___ ||
|
||||
|| | | \| |___ |___ |__| |__/ |___ ||
|
||||
|| ||
|
||||
\************************************************************************************************/
|
||||
#include <stdint.h>
|
||||
|
||||
/************************************************************************************************************\
|
||||
|| _ _ _ ____ _ _ _ ___ ____ ||
|
||||
|| | |\ | | | | | | \ |___ ||
|
||||
|| | | \| |___ |___ |__| |__/ |___ ||
|
||||
|| ||
|
||||
\************************************************************************************************************/
|
||||
#include <stdint.h>
|
||||
/************************************************************************************************\
|
||||
|| ___ ____ _ _ _ _ ___ _ _ _ ____ ___ _ _ ___ ____ ____ ||
|
||||
|| |__] |__/ | |\/| | | | | | |___ | \_/ |__] |___ [__ ||
|
||||
|| | | \ | | | | | | \/ |___ | | | |___ ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************/
|
||||
typedef unsigned char uchar;
|
||||
typedef unsigned short ushort;
|
||||
typedef unsigned int uint;
|
||||
|
||||
/************************************************************************************************************\
|
||||
|| ___ ____ _ _ _ _ ___ _ _ _ ____ ___ _ _ ___ ____ ____ ||
|
||||
|| |__] |__/ | |\/| | | | | | |___ | \_/ |__] |___ [__ ||
|
||||
|| | | \ | | | | | | \/ |___ | | | |___ ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************************/
|
||||
typedef unsigned char uchar;
|
||||
typedef unsigned short ushort;
|
||||
typedef unsigned int uint;
|
||||
typedef int8_t int8;
|
||||
typedef uint8_t uint8;
|
||||
typedef int16_t int16;
|
||||
typedef uint16_t uint16;
|
||||
typedef int32_t int32;
|
||||
typedef uint32_t uint32;
|
||||
typedef int64_t int64;
|
||||
typedef uint64_t uint64;
|
||||
|
||||
typedef int8_t int8;
|
||||
typedef uint8_t uint8;
|
||||
typedef int16_t int16;
|
||||
typedef uint16_t uint16;
|
||||
typedef int32_t int32;
|
||||
typedef uint32_t uint32;
|
||||
typedef int64_t int64;
|
||||
typedef uint64_t uint64;
|
||||
typedef float bwc_float;
|
||||
typedef uint32 bwc_raw;
|
||||
|
||||
typedef float bwc_float;
|
||||
typedef uint32 bwc_raw;
|
||||
/************************************************************************************************\
|
||||
|| _ _ ____ ____ ____ ____ ____ ||
|
||||
|| |\/| |__| | |__/ | | [__ ||
|
||||
|| | | | | |___ | \ |__| ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************/
|
||||
/*----------------------------------------------------------------------------------------------*\
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! These macros describe the minimum and maximum values for a single precision IEEE !
|
||||
! 754 floating point variable. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------*/
|
||||
#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 minimum and maximum values for a double precision IEEE 754 !
|
||||
! floating point variable. !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 07.12.2018 Patrick Vogler B87D120 V 0.1.0 Constants created !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
#define FLT_MAX 1.70141183e+38
|
||||
#define FLT_MIN 1.17549435e-38
|
||||
/*----------------------------------------------------------------------------------------------*\
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! These 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. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------*/
|
||||
#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 precision (in bits and bytes) of the primitive floating point !
|
||||
! type used during (de)compression as well as the number of bits used to represent the !
|
||||
! mantissa and exponent fields. !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 07.12.2018 Patrick Vogler B87D120 V 0.1.0 Constants created !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
#define PREC_BIT 31
|
||||
#define PREC_MANTISSA 23
|
||||
#define PREC_EXPONENT 8
|
||||
#define PREC_BYTE 4
|
||||
/*----------------------------------------------------------------------------------------------*\
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! These macros describe the bit masks used to access the sign, mantissa and !
|
||||
! exponent of the derrived floating point type. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------*/
|
||||
#define SIGN 0x80000000 // Sign bit mask
|
||||
#define MANTISSA 0x007FFFFF // Mantissa bit mask
|
||||
#define EXPONENT 0x7F800000 // Exponent bit mask
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! These constants describe the bit masks used to access the sign, mantissa and exponent of !
|
||||
! the primitive floating point type used during (de)compression. !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 07.12.2018 Patrick Vogler B87D120 V 0.1.0 Constants created !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
#define SIGN 0x80000000
|
||||
#define MANTISSA 0x007FFFFF
|
||||
#define EXPONENT 0x7F800000
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! This constants describe the maximum number of encoding passes during the entropy encoding !
|
||||
! stage. !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 03.07.2018 Patrick Vogler B87D120 V 0.1.0 Constants created !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
#define MAXIMUM_NO_PASSES (32 * 3) - 2
|
||||
/*----------------------------------------------------------------------------------------------*\
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! This macro describe the maximum number of possible encoding passes during the !
|
||||
! entropy encoding stage. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------*/
|
||||
#define MAXIMUM_NO_PASSES (32 * 3) - 2
|
||||
#endif
|
|
@ -1,161 +1,95 @@
|
|||
/*==================================================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| File: tagtree.h ||
|
||||
|| ----- ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| DESCRIPTION NEEDED. ||
|
||||
|| ||
|
||||
|| STRUCTS: ||
|
||||
|| -------- ||
|
||||
|| ||
|
||||
|| PUBLIC FUNCTIONS: ||
|
||||
|| ----------------- ||
|
||||
|| ||
|
||||
|| DEVELOPMENT HISTORY: ||
|
||||
|| -------------------- ||
|
||||
|| ||
|
||||
|| Date Author Change Id Release Description Of Change ||
|
||||
|| ---- ------ --------- ------- --------------------- ||
|
||||
|| 18.05.2018 Patrick Vogler B87D120 V 0.1.0 header file created ||
|
||||
|| ||
|
||||
|| -------------------------------------------------------------------------------------------------------------------- ||
|
||||
|| ||
|
||||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|
||||
|| ||
|
||||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|
||||
|| following conditions are met: ||
|
||||
|| ||
|
||||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|
||||
|| the following disclaimer. ||
|
||||
|| ||
|
||||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|
||||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|
||||
|| distribution. ||
|
||||
|| ||
|
||||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|
||||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|
||||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|
||||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|
||||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|
||||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|
||||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|
||||
|| ||
|
||||
\*==================================================================================================================================*/
|
||||
/*================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| ||
|
||||
|| This file defines a tagtree procedure used to encode/decode two types of ||
|
||||
|| information found defining in a codeblock in specific quality layer: ||
|
||||
|| ||
|
||||
|| - The inclusion tag records if a codeblock has any contribution ||
|
||||
|| to a quality layer. ||
|
||||
|| - The number of leading bitplanes that are not significant/only ||
|
||||
|| populated by zero bits. ||
|
||||
|| ||
|
||||
|| For more information on the encoding/decoding process please refere to JPEG2000 ||
|
||||
|| by D. S. Taubman and M. W. Marcellin (p. 384). ||
|
||||
|| ||
|
||||
|| -------------------------------------------------------------------------------------------- ||
|
||||
|| 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 TAGTREE_H
|
||||
#define TAGTREE_H
|
||||
/************************************************************************************************\
|
||||
|| _ _ _ ____ _ _ _ ___ ____ ||
|
||||
|| | |\ | | | | | | \ |___ ||
|
||||
|| | | \| |___ |___ |__| |__/ |___ ||
|
||||
|| ||
|
||||
\************************************************************************************************/
|
||||
#include "types.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);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
void reset_tagtree (bwc_tagtree *const tagtree);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
bwc_tagtree* initialize_tagtree (uint64 const leafsX,
|
||||
uint64 const leafsY,
|
||||
uint64 const leafsZ,
|
||||
uint64 const leafsTS);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
uint16 tagtree_get_value (bwc_tagtree const *const tagtree,
|
||||
uint64 const leaf_index);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
void tagtree_set_value (bwc_tagtree *const tagtree,
|
||||
uint64 const leaf_index,
|
||||
uint16 const value);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
void encode_tagtree (bwc_tagtree *const tagtree,
|
||||
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
|
|
@ -1,153 +1,173 @@
|
|||
/*==================================================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| File: tier1.h ||
|
||||
|| ----- ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| DESCRIPTION NEEDED. ||
|
||||
|| ||
|
||||
|| STRUCTS: ||
|
||||
|| -------- ||
|
||||
|| ||
|
||||
|| PUBLIC FUNCTIONS: ||
|
||||
|| ----------------- ||
|
||||
|| ||
|
||||
|| DEVELOPMENT HISTORY: ||
|
||||
|| -------------------- ||
|
||||
|| ||
|
||||
|| Date Author Change Id Release Description Of Change ||
|
||||
|| ---- ------ --------- ------- --------------------- ||
|
||||
|| - Patrick Vogler B87D120 V 0.1.0 header file created ||
|
||||
|| ||
|
||||
|| -------------------------------------------------------------------------------------------------------------------- ||
|
||||
|| ||
|
||||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|
||||
|| ||
|
||||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|
||||
|| following conditions are met: ||
|
||||
|| ||
|
||||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|
||||
|| the following disclaimer. ||
|
||||
|| ||
|
||||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|
||||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|
||||
|| distribution. ||
|
||||
|| ||
|
||||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|
||||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|
||||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|
||||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|
||||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|
||||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|
||||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|
||||
|| ||
|
||||
\*==================================================================================================================================*/
|
||||
/*================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| ||
|
||||
|| 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: ||
|
||||
|| ||
|
||||
|| (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 TIER1_H
|
||||
#define TIER1_H
|
||||
/************************************************************************************************\
|
||||
|| _ _ _ ____ _ _ _ ___ ____ ||
|
||||
|| | |\ | | | | | | \ |___ ||
|
||||
|| | | \| |___ |___ |__| |__/ |___ ||
|
||||
|| ||
|
||||
\************************************************************************************************/
|
||||
#include "types.h"
|
||||
|
||||
/************************************************************************************************************\
|
||||
|| _ _ _ ____ _ _ _ ___ ____ ||
|
||||
|| | |\ | | | | | | \ |___ ||
|
||||
|| | | \| |___ |___ |__| |__/ |___ ||
|
||||
|| ||
|
||||
\************************************************************************************************************/
|
||||
#include "types.h"
|
||||
/************************************************************************************************\
|
||||
|| _ _ ____ ____ ____ ____ ____ ||
|
||||
|| |\/| |__| | |__/ | | [__ ||
|
||||
|| | | | | |___ | \ |__| ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************/
|
||||
/*----------------------------------------------------------------------------------------------*\
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! The macros listed indicate how many bits, from the current coding position, !
|
||||
! are used for error evaluation in the coding passes. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------*/
|
||||
#define DISTORTION_SIG 5 // Clean up/significance propagation pass.
|
||||
#define DISTORTION_MAG 6 // Magnitude refinement pass.
|
||||
|
||||
/************************************************************************************************************\
|
||||
|| _ _ ____ ____ ____ ____ ____ ||
|
||||
|| |\/| |__| | |__/ | | [__ ||
|
||||
|| | | | | |___ | \ |__| ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************************/
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! This macro defines the maximum decomposition level up to which the wavelet filer energy gain !
|
||||
! is calculated. Beyond the maximum decomposition level the energy gain will only be !
|
||||
! approximated. !
|
||||
! !
|
||||
! Macros: !
|
||||
! ------- !
|
||||
! Macro Description !
|
||||
! ----- ----------- !
|
||||
! MAX_DECOMPOSITION_LEVELS - Maximum number of wavelet layers for which the energy !
|
||||
! gain is calculated. !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 20.03.2018 Patrick Vogler B87D120 V 0.1.0 Macros created !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
#define DISTORTION_DELTA 0.5f
|
||||
#define DISTORTION_MANTISSA 5
|
||||
#define DISTORTION_PRECISION 6
|
||||
/************************************************************************************************\
|
||||
|| ___ ____ ____ ____ _ _ _ ____ ___ ___ _ _ ___ ____ ____ ||
|
||||
|| | \ |___ |__/ |__/ | | | |___ | \ | \_/ |__] |___ [__ ||
|
||||
|| |__/ |___ | \ | \ | \/ |___ |__/ | | | |___ ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************/
|
||||
/*----------------------------------------------------------------------------------------------*\
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! This structure holds the sign (xi), bitfield (bit) and state (delta, sigma and !
|
||||
! pi) information for four vertically adjacent samples for easy access during the !
|
||||
! entropy encoding stage. Here, the delayed significance is set once the first bit !
|
||||
! is encoded during the magnitude refinement pass, while the significance state !
|
||||
! sigma is set once the first non-zero bit is encoded for a specific sample. !
|
||||
! The stripe_* pointers are used to store the address of the left(l), upper(u), !
|
||||
! right(r) and lower(d) neighbour of a specific stripe for easy access. To !
|
||||
! facilitate distortion estimation the magnitude of the wavelet coefficients is !
|
||||
! stored in an appropriate sample array. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------*/
|
||||
typedef struct stripe
|
||||
{
|
||||
uint64 *sample; // Wavelet coef. for two adjacent stripes.
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! These macros define the irrational coefficients for the high and low pass synthesis filters !
|
||||
! associated with the (5-3) LeGall-Wavelet. !
|
||||
! !
|
||||
! Macros: !
|
||||
! ------- !
|
||||
! Macro Description !
|
||||
! ----- ----------- !
|
||||
! DWT_5X3_H0 - Coefficients for the (9-7) !
|
||||
! DWT_5X3_H1 low pass synthesis filter. !
|
||||
! !
|
||||
! DWT_5X3_G0 !
|
||||
! DWT_5X3_G1 - Coefficients for the (9-7) !
|
||||
! DWT_5X3_G2 high pass synthesis filter. !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 20.03.2018 Patrick Vogler B87D120 V 0.1.0 Macros created !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
#define DWT_5X3_H0 1.0f
|
||||
#define DWT_5X3_H1 0.5f
|
||||
uint8 delta; // Delayed sig. for two adjacent stripes.
|
||||
uint8 sigma; // Significance for two adjacent stripes.
|
||||
uint8 pi; // Cdng pass membership for adj. stripes.
|
||||
|
||||
#define DWT_5X3_G0 0.75f
|
||||
#define DWT_5X3_G1 -0.25f
|
||||
#define DWT_5X3_G2 -0.125f
|
||||
uint8 codingpass; // Last decoded coding pass.
|
||||
|
||||
/************************************************************************************************************\
|
||||
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|
||||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|
||||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************************/
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! TYPE NAME: Template !
|
||||
! ----------- !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! DESCRIPTION NEEDED !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
uchar
|
||||
t1_encode(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const parameter);
|
||||
uint8 bitplane; // Last decoded bitplane.
|
||||
uint8 *bit; // Bitplanes for vertically adj. stripes.
|
||||
uint8 xi; // Wvlt coef. sign bit for adj. stripes.
|
||||
|
||||
uchar
|
||||
t1_decode(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const parameter);
|
||||
struct stripe *stripe_u; // Upper stripe.
|
||||
struct stripe *stripe_r; // Right stripe.
|
||||
struct stripe *stripe_d; // Lower stripe.
|
||||
struct stripe *stripe_l; // Left stripe.
|
||||
} bwc_coder_stripe;
|
||||
|
||||
/*----------------------------------------------------------------------------------------------*\
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! This structure accumulates all necessary structures used to (de-)compress a !
|
||||
! codeblock of wavelet coefficients. The spatial and temporal dimension of the !
|
||||
! codeblock is defined by its width, height and number of slices (depth * dt). The !
|
||||
! codeblock itself is subdivided into so-called stripes that represent 4 vertical- !
|
||||
! ly adjacent coefficients. The parameter no_full_stripes stores overnumber of !
|
||||
! full stripes present in one slice. !
|
||||
! The look-up table sig2context is used to determine the coding context of a cur- !
|
||||
! ren bit according to its significance context within the codeblock bitplane. !
|
||||
! The look-up table is specific to a certain highband and is set accordingly. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------*/
|
||||
typedef struct
|
||||
{
|
||||
uchar highband_flag; // Flag indicating current wavelet subbnd.
|
||||
uint8 K; // Idx of the first significant bitplane.
|
||||
uchar erres; // Flag signaling error resilience.
|
||||
|
||||
uint64 no_full_stripe; // Number of full, vert. adjacent stripes.
|
||||
uint64 width, height; // Codeblock width and height.
|
||||
uint64 no_slice; // N.o. slices in the spec. codeblock.
|
||||
|
||||
uint8 const *sig2context; // Signifance-to-context loop-up table.
|
||||
bwc_bit_coder *bitcoder; // BWC bitcoder.
|
||||
|
||||
bwc_coder_stripe *data; // BWC coder stripe.
|
||||
|
||||
uint64 buff_size; // Size of packed stream.
|
||||
uint64 buff_incr; // Increment for packed stream assembly.
|
||||
uchar *compressed; // Compressed data chunck.
|
||||
} bwc_coder;
|
||||
|
||||
/************************************************************************************************************\
|
||||
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|
||||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|
||||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************************/
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! TYPE NAME: Template !
|
||||
! ----------- !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! DESCRIPTION NEEDED !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
uchar
|
||||
t1_encode(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const parameter);
|
||||
|
||||
uchar
|
||||
t1_decode(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const parameter);
|
||||
#endif
|
|
@ -1,133 +1,87 @@
|
|||
/*==================================================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| File: tier2.h ||
|
||||
|| ----- ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| DESCRIPTION NEEDED. ||
|
||||
|| ||
|
||||
|| STRUCTS: ||
|
||||
|| -------- ||
|
||||
|| ||
|
||||
|| PUBLIC FUNCTIONS: ||
|
||||
|| ----------------- ||
|
||||
|| - t2_encode ||
|
||||
|| ||
|
||||
|| DEVELOPMENT HISTORY: ||
|
||||
|| -------------------- ||
|
||||
|| ||
|
||||
|| Date Author Change Id Release Description Of Change ||
|
||||
|| ---- ------ --------- ------- --------------------- ||
|
||||
|| - Patrick Vogler B87D120 V 0.1.0 header file created ||
|
||||
|| ||
|
||||
|| -------------------------------------------------------------------------------------------------------------------- ||
|
||||
|| ||
|
||||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|
||||
|| ||
|
||||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|
||||
|| following conditions are met: ||
|
||||
|| ||
|
||||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|
||||
|| the following disclaimer. ||
|
||||
|| ||
|
||||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|
||||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|
||||
|| distribution. ||
|
||||
|| ||
|
||||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|
||||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|
||||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|
||||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|
||||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|
||||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|
||||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|
||||
|| ||
|
||||
\*==================================================================================================================================*/
|
||||
/*================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| ||
|
||||
|| 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: ||
|
||||
|| ||
|
||||
|| (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 TIER2_H
|
||||
#define TIER2_H
|
||||
/************************************************************************************************\
|
||||
|| _ _ _ ____ _ _ _ ___ ____ ||
|
||||
|| | |\ | | | | | | \ |___ ||
|
||||
|| | | \| |___ |___ |__| |__/ |___ ||
|
||||
|| ||
|
||||
\************************************************************************************************/
|
||||
#include "types.h"
|
||||
|
||||
/************************************************************************************************************\
|
||||
|| _ _ _ ____ _ _ _ ___ ____ ||
|
||||
|| | |\ | | | | | | \ |___ ||
|
||||
|| | | \| |___ |___ |__| |__/ |___ ||
|
||||
|| ||
|
||||
\************************************************************************************************************/
|
||||
#include "types.h"
|
||||
|
||||
/************************************************************************************************************\
|
||||
|| _ _ ____ ____ ____ ____ ____ ||
|
||||
|| |\/| |__| | |__/ | | [__ ||
|
||||
|| | | | | |___ | \ |__| ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************************/
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! This macro defines the initial packet header size. !
|
||||
! !
|
||||
! Macros: !
|
||||
! ------- !
|
||||
! Macro Description !
|
||||
! ----- ----------- !
|
||||
! PACKET_HEADER_SIZE - Initial packet header size. !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 10.05.2019 Patrick Vogler B87D120 V 0.1.0 Macros created !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
#define PACKET_HEADER_SIZE 512
|
||||
/************************************************************************************************\
|
||||
|| _ _ ____ ____ ____ ____ ____ ||
|
||||
|| |\/| |__| | |__/ | | [__ ||
|
||||
|| | | | | |___ | \ |__| ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************/
|
||||
/*----------------------------------------------------------------------------------------------*\
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! !
|
||||
! Definition of the initial codestream packet header size. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------*/
|
||||
#define PACKET_HEADER_SIZE 512
|
||||
|
||||
/************************************************************************************************************\
|
||||
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|
||||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|
||||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************************/
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! FUNCTION NAME: uchar t2_encode(bwc_field *const field, bwc_tile *const tile) !
|
||||
! -------------- !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! This function defines the rate control portion of the entropy encoding stage. In !
|
||||
! the first step, the quality layers are evaluated according to the bitrates de- !
|
||||
! fined by the user. The quality layers are then used to create the data packets !
|
||||
! that comprise the bwc codestream. !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
uchar
|
||||
t2_encode(bwc_field *const field, bwc_tile *const tile);
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! FUNCTION NAME: uchar parse_packet(bwc_field *const field, bwc_tile *const tile, !
|
||||
! -------------- bwc_packet *const packet, !
|
||||
! uint64 const body_size) !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! This function is used to parse a codestream packet for a given precinct (prec_idx) !
|
||||
! and quality layer (q_layer). !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
uchar
|
||||
parse_packet(bwc_field *const field, bwc_tile *const tile,
|
||||
bwc_packet *const packet,
|
||||
uint64 const body_size);
|
||||
/************************************************************************************************\
|
||||
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|
||||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|
||||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************/
|
||||
uchar t2_encode (bwc_field *const field,
|
||||
bwc_tile *const tile);
|
||||
//==========|==========================|======================|======|=======|====================
|
||||
uchar parse_packet (bwc_field *const field,
|
||||
bwc_tile *const tile,
|
||||
bwc_packet *const packet,
|
||||
uint64 const body_size);
|
||||
#endif
|
File diff suppressed because it is too large
Load diff
474
public_header.py
474
public_header.py
|
@ -1,54 +1,53 @@
|
|||
#*====================================================================================================================*#
|
||||
#| |#
|
||||
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
|
||||
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
|
||||
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
|
||||
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
|
||||
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
|
||||
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
|
||||
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
|
||||
#| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |#
|
||||
#| /$$ \ $$ | $$ |#
|
||||
#| | $$$$$$/ | $$ |#
|
||||
#| \______/ |__/ |#
|
||||
#| |#
|
||||
#| DESCRIPTION: |#
|
||||
#| ------------ |#
|
||||
#| This file describes python script used to assemble the public header file for the |#
|
||||
#| BigWhoop compression library. |#
|
||||
#| |#
|
||||
#| DEVELOPMENT HISTORY: |#
|
||||
#| -------------------- |#
|
||||
#| |#
|
||||
#| Date Author Change Id Release Description Of Change |#
|
||||
#| ---- ------ --------- ------- --------------------- |#
|
||||
#| 02.02.2020 Patrick Vogler B87D120 V 0.1.0 script created |#
|
||||
#| |#
|
||||
#| |#
|
||||
#| ------------------------------------------------------------------------------------------------------ |#
|
||||
#| |#
|
||||
#| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart |#
|
||||
#| |#
|
||||
#| Redistribution and use in source and binary forms, with or without modification, are permitted |#
|
||||
#| provided that the following conditions are met: |#
|
||||
#| |#
|
||||
#| (1) Redistributions of source code must retain the above copyright notice, this list of |#
|
||||
#| conditions and the following disclaimer. |#
|
||||
#| |#
|
||||
#| (2) Redistributions in binary form must reproduce the above copyright notice, this list |#
|
||||
#| of conditions and the following disclaimer in the documentation and/or other materials |#
|
||||
#| provided with the distribution. |#
|
||||
#| |#
|
||||
#| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED |#
|
||||
#| WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |#
|
||||
#| PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR |#
|
||||
#| ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |#
|
||||
#| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |#
|
||||
#| INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |#
|
||||
#| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |#
|
||||
#| ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |#
|
||||
#| |#
|
||||
#\====================================================================================================================/#
|
||||
#*================================================================================================*#
|
||||
#| |#
|
||||
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
|
||||
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
|
||||
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
|
||||
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
|
||||
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
|
||||
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
|
||||
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
|
||||
#| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |#
|
||||
#| /$$ \ $$ | $$ |#
|
||||
#| | $$$$$$/ | $$ |#
|
||||
#| \______/ |__/ |#
|
||||
#| |#
|
||||
#| DESCRIPTION: |#
|
||||
#| ------------ |#
|
||||
#| |#
|
||||
#| 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: |#
|
||||
#| |#
|
||||
#| (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. |#
|
||||
#| |#
|
||||
#*================================================================================================*#
|
||||
#**************************************************************************************************#
|
||||
#| _ _ _ ___ ____ ____ ___ |#
|
||||
#| | |\/| |__] | | |__/ | |#
|
||||
#| | | | | |__| | \ | |#
|
||||
#| |#
|
||||
#**************************************************************************************************#
|
||||
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,220 +80,254 @@ 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"
|
||||
"|| ||\n"
|
||||
"|| /$$$$$$$ /$$ /$$ /$$ /$$ ||\n"
|
||||
"|| | $$__ $$|__/ | $$ /$ | $$| $$ ||\n"
|
||||
"|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||\n"
|
||||
"|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||\n"
|
||||
"|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||\n"
|
||||
"|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||\n"
|
||||
"|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||\n"
|
||||
"|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||\n"
|
||||
"|| /$$ \ $$ | $$ ||\n"
|
||||
"|| | $$$$$$/ | $$ ||\n"
|
||||
"|| \______/ |__/ ||\n"
|
||||
"|| ||\n"
|
||||
"|| ||\n"
|
||||
"|| Version " +
|
||||
Version[-1] + " ||\n"
|
||||
"|| ||\n"
|
||||
"|| ------------------------------------------------------------------------------------------------------ ||\n"
|
||||
"|| ||\n"
|
||||
"|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||\n"
|
||||
"|| ||\n"
|
||||
"|| Redistribution and use in source and binary forms, with or without modification, are permitted provided ||\n"
|
||||
"|| that the following conditions are met: ||\n"
|
||||
"|| ||\n"
|
||||
"|| (1) Redistributions of source code must retain the above copyright notice, this list of ||\n"
|
||||
"|| conditions and the following disclaimer. ||\n"
|
||||
"|| ||\n"
|
||||
"|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||\n"
|
||||
"|| of conditions and the following disclaimer in the documentation and/or other materials ||\n"
|
||||
"|| provided with the distribution. ||\n"
|
||||
"|| ||\n"
|
||||
"|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED ||\n"
|
||||
"|| WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A ||\n"
|
||||
"|| PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ||\n"
|
||||
"|| ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ||\n"
|
||||
"|| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ||\n"
|
||||
"|| INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR ||\n"
|
||||
"|| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ||\n"
|
||||
"|| ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||\n"
|
||||
"|| ||\n"
|
||||
"\*====================================================================================================================*/\n"
|
||||
public_header.write("/*================================================================================================*\\\n"
|
||||
"|| ||\n"
|
||||
"|| /$$$$$$$ /$$ /$$ /$$ /$$ ||\n"
|
||||
"|| | $$__ $$|__/ | $$ /$ | $$| $$ ||\n"
|
||||
"|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||\n"
|
||||
"|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||\n"
|
||||
"|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||\n"
|
||||
"|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||\n"
|
||||
"|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||\n"
|
||||
"|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||\n"
|
||||
"|| /$$ \ $$ | $$ ||\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 ||\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 ||\n"
|
||||
"|| materials provided with the distribution. ||\n"
|
||||
"|| ||\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"
|
||||
"#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):
|
||||
public_header.write(line)
|
||||
elif("#define MAXIMUM_NO_PASSES" in line):
|
||||
public_header.write(line + "\n")
|
||||
break
|
||||
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)
|
||||
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)
|
||||
for file in header_files:
|
||||
with open(source.joinpath(file)) as f:
|
||||
for line in f:
|
||||
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")
|
||||
|
||||
print_flag = -1
|
||||
with open(source.joinpath('constants.h')) as f:
|
||||
for line in f:
|
||||
if(";" in line and print_flag == 1):
|
||||
print_flag = 0
|
||||
public_header.write(line)
|
||||
if("typedef" in line or print_flag == 1):
|
||||
if(print_flag == 0):
|
||||
public_header.write(deliminator)
|
||||
print_flag = 1
|
||||
public_header.write(line)
|
||||
f.close
|
||||
#----------------------------------------------------------#
|
||||
# Ingest enums with 'bwc_' prefix from all header files #
|
||||
# excluding prim_types_****.h. #
|
||||
#----------------------------------------------------------#
|
||||
title_length = 42
|
||||
|
||||
lspaces = ceil((116 - 64 - len(tab))/2)
|
||||
rspaces = floor((116 - 64 - len(tab))/2)
|
||||
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)
|
||||
public_header.write(buff)
|
||||
delimFlg = True
|
||||
buff = ""
|
||||
break
|
||||
line = next(f)
|
||||
f.close
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Ingest derived types with 'bwc_' prefix from all header #
|
||||
# files excluding prim_types_****.h. #
|
||||
#----------------------------------------------------------#
|
||||
title_length = 64
|
||||
|
||||
lspaces = ceil((text_width - 2*len(sbox) - title_length - len(tab))/2)
|
||||
rspaces = floor((text_width - 2*len(sbox) - title_length - len(tab))/2)
|
||||
|
||||
public_header.write("\n")
|
||||
public_header.write(ubox + tab + "||" + lspaces * " " + "___ ____ ____ ____ _ _ _ ____ ___ ___ _ _ ___ ____ ____" + rspaces * " " + "||\n" +
|
||||
tab + "||" + lspaces * " " + "| \ |___ |__/ |__/ | | | |___ | \ | \_/ |__] |___ [__ " + rspaces * " " + "||\n" +
|
||||
tab + "||" + lspaces * " " + "|__/ |___ | \ | \ | \/ |___ |__/ | | | |___ ___]" + rspaces * " " + "||\n" +
|
||||
tab + "||" + (116 - len(tab)) * " " + "||\n" + lbox)
|
||||
public_header.write(ubox + tab + sbox + lspaces * " " + "___ ____ ____ ____ _ _ _ ____ ___ ___ _ _ ___ ____ ____" + rspaces * " " + "||\n" +
|
||||
tab + sbox + lspaces * " " + "| \ |___ |__/ |__/ | | | |___ | \ | \_/ |__] |___ [__ " + rspaces * " " + "||\n" +
|
||||
tab + sbox + lspaces * " " + "|__/ |___ | \ | \ | \/ |___ |__/ | | | |___ ___]" + rspaces * " " + "||\n" +
|
||||
tab + sbox + (text_width - 2*len(sbox) - len(tab)) * " " + "||\n" + lbox)
|
||||
|
||||
printFlg = False
|
||||
delimFlg = False
|
||||
preProcFlg = False
|
||||
preProc = ""
|
||||
buff = ""
|
||||
brktCnt = 0
|
||||
|
||||
for file in ["mq_types.h", "types.h"]:
|
||||
for file in 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 (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)
|
||||
|
||||
public_header.write(tab + "#ifdef __cplusplus\n" +
|
||||
tab + "extern \"C\" {\n" +
|
||||
|
@ -295,27 +342,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)
|
||||
line = next(f)
|
||||
else:
|
||||
while ("#endif" not in line):
|
||||
line = next(f)
|
||||
if("#endif" in line):
|
||||
ltab = 0
|
||||
|
||||
if("#if defined" in line):
|
||||
line = next(f)
|
||||
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
|
||||
|
|
|
@ -239,7 +239,7 @@ read_eas3_header(bwc_data *const data)
|
|||
! Save the file pointer and data info structure in tempo- !
|
||||
! rary variables to make the code more readable. !
|
||||
\*--------------------------------------------------------*/
|
||||
fp = data->file.fp;
|
||||
fp = data->fp;
|
||||
info = &data->info;
|
||||
|
||||
/*--------------------------------------------------------*\
|
||||
|
@ -618,7 +618,7 @@ write_eas3_header(bwc_data *const data)
|
|||
! Save the file pointer and data info structure in tempo- !
|
||||
! rary variables to make the code more readable. !
|
||||
\*--------------------------------------------------------*/
|
||||
fp = data->file.fp;
|
||||
fp = data->fp;
|
||||
info = &data->info;
|
||||
|
||||
/*--------------------------------------------------------*\
|
||||
|
@ -866,7 +866,7 @@ read_eas3(char *const filename)
|
|||
! Open the specified file for reading. If the file doesn't !
|
||||
! exist, exit the bwc command-line tool. !
|
||||
\*--------------------------------------------------------*/
|
||||
if((data->file.fp = fopen(filename, "rb")) == NULL)
|
||||
if((data->fp = fopen(filename, "rb")) == NULL)
|
||||
{
|
||||
// error opening file
|
||||
fprintf(stderr, "o##########################################################o\n"\
|
||||
|
@ -891,10 +891,10 @@ read_eas3(char *const filename)
|
|||
! file and store the information in the bwc_gl_data struc- !
|
||||
! ture. !
|
||||
\*--------------------------------------------------------*/
|
||||
root = ftell(data->file.fp);
|
||||
fseek(data->file.fp, 0L, SEEK_END);
|
||||
Lfield = (ftell(data->file.fp) - root) / sizeof(double);
|
||||
fseek(data->file.fp, root, SEEK_SET);
|
||||
root = ftell(data->fp);
|
||||
fseek(data->fp, 0L, SEEK_END);
|
||||
Lfield = (ftell(data->fp) - root) / sizeof(double);
|
||||
fseek(data->fp, root, SEEK_SET);
|
||||
|
||||
/*--------------------------------------------------------*\
|
||||
! Check if the file_size coincide with the specified dimen-!
|
||||
|
@ -935,7 +935,7 @@ read_eas3(char *const filename)
|
|||
/*--------------------------------------------------------*\
|
||||
! Read the flow field data from the specified eas3 file. !
|
||||
\*--------------------------------------------------------*/
|
||||
if(fread(data->field.f, sizeof(float), Lfield, data->file.fp) != Lfield)
|
||||
if(fread(data->field.f, sizeof(float), Lfield, data->fp) != Lfield)
|
||||
{
|
||||
// invalid read
|
||||
fprintf(stderr, RDERROR);
|
||||
|
@ -971,7 +971,7 @@ read_eas3(char *const filename)
|
|||
/*--------------------------------------------------------*\
|
||||
! Read the flow field data from the specified eas3 file. !
|
||||
\*--------------------------------------------------------*/
|
||||
if(fread(data->field.d, sizeof(double), Lfield, data->file.fp) != Lfield)
|
||||
if(fread(data->field.d, sizeof(double), Lfield, data->fp) != Lfield)
|
||||
{
|
||||
// invalid read
|
||||
fprintf(stderr, RDERROR);
|
||||
|
@ -993,8 +993,8 @@ read_eas3(char *const filename)
|
|||
! Close the file pointer and return the bwc_data structure !
|
||||
! to the function caller. !
|
||||
\*--------------------------------------------------------*/
|
||||
fclose(data->file.fp);
|
||||
data->file.fp = NULL;
|
||||
fclose(data->fp);
|
||||
data->fp = NULL;
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -1051,7 +1051,7 @@ write_eas3(bwc_data *const data, char *const filename)
|
|||
! exist, discard its content. If the file cannot be creat- !
|
||||
! ed, exit the bwc command-line tool. !
|
||||
\*--------------------------------------------------------*/
|
||||
if((data->file.fp = fopen(filename, "wb")) == NULL)
|
||||
if((data->fp = fopen(filename, "wb")) == NULL)
|
||||
{
|
||||
// error opening file
|
||||
fprintf(stderr, "o##########################################################o\n"\
|
||||
|
@ -1090,7 +1090,7 @@ write_eas3(bwc_data *const data, char *const filename)
|
|||
/*--------------------------------------------------------*\
|
||||
! Write the flow field data to the specified eas3 file. !
|
||||
\*--------------------------------------------------------*/
|
||||
if(fwrite(data->field.f, sizeof(float), Lfield, data->file.fp) != Lfield)
|
||||
if(fwrite(data->field.f, sizeof(float), Lfield, data->fp) != Lfield)
|
||||
{
|
||||
// invalid read
|
||||
fprintf(stderr, WRTERROR);
|
||||
|
@ -1110,7 +1110,7 @@ write_eas3(bwc_data *const data, char *const filename)
|
|||
/*--------------------------------------------------------*\
|
||||
! Write the flow field data to the specified eas3 file. !
|
||||
\*--------------------------------------------------------*/
|
||||
if(fwrite(data->field.d, sizeof(double), Lfield, data->file.fp) != Lfield)
|
||||
if(fwrite(data->field.d, sizeof(double), Lfield, data->fp) != Lfield)
|
||||
{
|
||||
// invalid read
|
||||
fprintf(stderr, WRTERROR);
|
||||
|
@ -1121,7 +1121,7 @@ write_eas3(bwc_data *const data, char *const filename)
|
|||
/*--------------------------------------------------------*\
|
||||
! Close the file pointer and return to the function caller.!
|
||||
\*--------------------------------------------------------*/
|
||||
fclose(data->file.fp);
|
||||
data->file.fp = NULL;
|
||||
fclose(data->fp);
|
||||
data->fp = NULL;
|
||||
return 0;
|
||||
}
|
|
@ -1,57 +1,49 @@
|
|||
#*====================================================================================================================*#
|
||||
#| |#
|
||||
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
|
||||
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
|
||||
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
|
||||
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
|
||||
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
|
||||
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
|
||||
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
|
||||
#| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |#
|
||||
#| /$$ \ $$ | $$ |#
|
||||
#| | $$$$$$/ | $$ |#
|
||||
#| \______/ |__/ |#
|
||||
#| DESCRIPTION: |#
|
||||
#| ------------ |#
|
||||
#| Defines the cmake script for the libbwc library. |#
|
||||
#| |#
|
||||
#| |#
|
||||
#| DEVELOPMENT HISTORY: |#
|
||||
#| -------------------- |#
|
||||
#| |#
|
||||
#| Date Author Change Id Release Description Of Change |#
|
||||
#| ---- ------ --------- ------- --------------------- |#
|
||||
#| 30.08.2018 Patrick Vogler B87D120 V 0.1.0 cmake file created |#
|
||||
#| 15.10.2021 Patrick Vogler B880CA2 V 0.1.1 Added install rules |#
|
||||
#| |#
|
||||
#| |#
|
||||
#| ------------------------------------------------------------------------------------------------------ |#
|
||||
#| |#
|
||||
#| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart |#
|
||||
#| |#
|
||||
#| Redistribution and use in source and binary forms, with or without modification, are permitted |#
|
||||
#| provided that the following conditions are met: |#
|
||||
#| |#
|
||||
#| (1) Redistributions of source code must retain the above copyright notice, this list of |#
|
||||
#| conditions and the following disclaimer. |#
|
||||
#| |#
|
||||
#| (2) Redistributions in binary form must reproduce the above copyright notice, this list |#
|
||||
#| of conditions and the following disclaimer in the documentation and/or other materials |#
|
||||
#| provided with the distribution. |#
|
||||
#| |#
|
||||
#| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED |#
|
||||
#| WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |#
|
||||
#| PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR |#
|
||||
#| ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |#
|
||||
#| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |#
|
||||
#| INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |#
|
||||
#| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |#
|
||||
#| ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |#
|
||||
#| |#
|
||||
#*====================================================================================================================*#
|
||||
#*--------------------------------------------------------*#
|
||||
#*================================================================================================*#
|
||||
#| |#
|
||||
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
|
||||
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
|
||||
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
|
||||
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
|
||||
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
|
||||
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
|
||||
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
|
||||
#| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |#
|
||||
#| /$$ \ $$ | $$ |#
|
||||
#| | $$$$$$/ | $$ |#
|
||||
#| \______/ |__/ |#
|
||||
#| |#
|
||||
#| DESCRIPTION: |#
|
||||
#| ------------ |#
|
||||
#| |#
|
||||
#| Defines the cmake script for the libbwc 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. |#
|
||||
#| |#
|
||||
#*================================================================================================*#
|
||||
#----------------------------------------------------------#
|
||||
# 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()
|
||||
|
@ -86,46 +78,46 @@ add_library(bwclib ${BWC_LINK} bitstream.c
|
|||
tier2.c
|
||||
tagtree.c)
|
||||
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
# Set the target compile definition for the encoder/decod- #
|
||||
# er bit precision. #
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
if("${PREC}" STREQUAL "Single")
|
||||
target_compile_definitions(bwclib PRIVATE -DBWC_SINGLE_PRECISION)
|
||||
else()
|
||||
target_compile_definitions(bwclib PRIVATE -DBWC_DOUBLE_PRECISION)
|
||||
endif()
|
||||
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
# Set the 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
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include/library/public>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
# Link the BigWhoop library to the math.h library. #
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
target_link_libraries(bwclib PRIVATE m)
|
||||
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
# Setup the install directories and target exporting for #
|
||||
# config-file packaging. #
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
install( TARGETS bwclib
|
||||
EXPORT bwc-targets
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
# Define the output name for the BigWhoop library. #
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
set_property(TARGET bwclib PROPERTY OUTPUT_NAME bwc)
|
|
@ -1,82 +1,49 @@
|
|||
/*==================================================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| FILE NAME: bitstream.c ||
|
||||
|| ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| This file describes a set of functions that can be used to create, manipulate and terminate ||
|
||||
|| a bitstream. These functions facilitate the creation or reading of a compressed bwc code- ||
|
||||
|| stream and can emit/extract information on a per bit, symbol (64-bit) or string basis. ||
|
||||
|| ||
|
||||
|| ||
|
||||
|| FILE REFERENCES: ||
|
||||
|| ---------------- ||
|
||||
|| ||
|
||||
|| Name I/O Description ||
|
||||
|| ---- --- ----------- ||
|
||||
|| none - - ||
|
||||
|| ||
|
||||
|| ||
|
||||
|| PRIVATE FUNCTIONS: ||
|
||||
|| ------------------ ||
|
||||
|| - ||
|
||||
|| ||
|
||||
|| PUBLIC FUNCTIONS: ||
|
||||
|| ----------------- ||
|
||||
|| - bytes_used ||
|
||||
|| - bwc_init_stream ||
|
||||
|| - bwc_emit_chunck ||
|
||||
|| - bwc_emit_symbol ||
|
||||
|| - bwc_emit_bit ||
|
||||
|| - bwc_get_chunck ||
|
||||
|| - bwc_get_symbol ||
|
||||
|| - bwc_get_bit ||
|
||||
|| - bwc_terminate_stream ||
|
||||
|| ||
|
||||
|| DEVELOPMENT HISTORY: ||
|
||||
|| -------------------- ||
|
||||
|| ||
|
||||
|| Date Author Change Id Release Description Of Change ||
|
||||
|| ---- ------ --------- ------- --------------------- ||
|
||||
|| 28.05.2018 Patrick Vogler B87D120 V 0.1.0 source file created ||
|
||||
|| ||
|
||||
|| -------------------------------------------------------------------------------------------------------------------- ||
|
||||
|| ||
|
||||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|
||||
|| ||
|
||||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|
||||
|| following conditions are met: ||
|
||||
|| ||
|
||||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|
||||
|| the following disclaimer. ||
|
||||
|| ||
|
||||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|
||||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|
||||
|| distribution. ||
|
||||
|| ||
|
||||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|
||||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|
||||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|
||||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|
||||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|
||||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|
||||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|
||||
|| ||
|
||||
\*==================================================================================================================================*/
|
||||
|
||||
/*================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| ||
|
||||
|| This file 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. ||
|
||||
|| ||
|
||||
|| -------------------------------------------------------------------------------------------- ||
|
||||
|| 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. ||
|
||||
|| ||
|
||||
\*================================================================================================*/
|
||||
/************************************************************************************************************\
|
||||
|| _ _ _ ____ _ _ _ ___ ____ ||
|
||||
|| | |\ | | | | | | \ |___ ||
|
||||
|
@ -127,7 +94,7 @@
|
|||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
uint64
|
||||
bytes_used(bwc_stream *const stream)
|
||||
bytes_used(bwc_stream const *const stream)
|
||||
{
|
||||
if(stream->T == 0xFF)
|
||||
{
|
||||
|
|
|
@ -1,68 +1,49 @@
|
|||
/*==================================================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| FILE NAME: bitstream.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 ||
|
||||
|| ---- ------ --------- ------- --------------------- ||
|
||||
|| 28.05.2018 Patrick Vogler B87D120 V 0.1.0 source file created ||
|
||||
|| ||
|
||||
|| -------------------------------------------------------------------------------------------------------------------- ||
|
||||
|| ||
|
||||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|
||||
|| ||
|
||||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|
||||
|| following conditions are met: ||
|
||||
|| ||
|
||||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|
||||
|| the following disclaimer. ||
|
||||
|| ||
|
||||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|
||||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|
||||
|| distribution. ||
|
||||
|| ||
|
||||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|
||||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|
||||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|
||||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|
||||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|
||||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|
||||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|
||||
|| ||
|
||||
\*==================================================================================================================================*/
|
||||
/*================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| ||
|
||||
|| This file 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: ||
|
||||
|| ||
|
||||
|| (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. ||
|
||||
|| ||
|
||||
\*================================================================================================*/
|
||||
/************************************************************************************************************\
|
||||
|| _ _ _ ____ _ _ _ ___ ____ ||
|
||||
|| | |\ | | | | | | \ |___ ||
|
||||
|
@ -911,7 +892,7 @@ assemble_main_header(bwc_field *const field)
|
|||
|
||||
bwc_emit_symbol(stream, control->progression, 1);
|
||||
bwc_emit_symbol(stream, control->KernelX << 6 | control->KernelY << 4 |
|
||||
control->KernelZ << 2 | control->KernelTS, 1);
|
||||
control->KernelZ << 2 | control->KernelTS, 1);
|
||||
|
||||
bwc_emit_symbol(stream, control->decompX, 1);
|
||||
bwc_emit_symbol(stream, control->decompY, 1);
|
||||
|
@ -1145,7 +1126,7 @@ bwc_parse_main_header(bwc_data *const data,bwc_stream *const stream)
|
|||
|
||||
if(CSsgc & (0x01 << 1))
|
||||
{
|
||||
bwc_set_quantization_style(field, (bwc_quant_st)buff_long);
|
||||
bwc_set_quant_style(field, (bwc_quant_st)buff_long);
|
||||
}
|
||||
|
||||
buff_long = bwc_get_symbol(stream, 1);
|
||||
|
|
|
@ -1,82 +1,49 @@
|
|||
/*==================================================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| FILE NAME: dwt.c ||
|
||||
|| ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| DESCRIPTION NEEDED. ||
|
||||
|| ||
|
||||
|| FILE REFERENCES: ||
|
||||
|| ---------------- ||
|
||||
|| ||
|
||||
|| Name I/O Description ||
|
||||
|| ---- --- ----------- ||
|
||||
|| none - - ||
|
||||
|| ||
|
||||
|| ||
|
||||
|| PRIVATE FUNCTIONS: ||
|
||||
|| ------------------ ||
|
||||
|| - get_filter_taps ||
|
||||
|| - fill_forward_buffer ||
|
||||
|| - fill_inverse_buffer ||
|
||||
|| - whole_point_symmetric_extend ||
|
||||
|| - forward_9x7_CDF_wavelet_transform ||
|
||||
|| - inverse_9x7_CDF_wavelet_transform ||
|
||||
|| - forward_5x3_LeGall_wavelet_transform ||
|
||||
|| - inverse_5x3_LeGall_wavelet_transform ||
|
||||
|| - forward_Haar_wavelet_transform ||
|
||||
|| - inverse_Haar_wavelet_transform ||
|
||||
|| - buffer_flush_forward ||
|
||||
|| - buffer_flush_inverse ||
|
||||
|| ||
|
||||
|| PUBLIC FUNCTIONS: ||
|
||||
|| ----------------- ||
|
||||
|| - initialize_gain_lut ||
|
||||
|| - get_dwt_energy_gain ||
|
||||
|| ||
|
||||
|| DEVELOPMENT HISTORY: ||
|
||||
|| -------------------- ||
|
||||
|| ||
|
||||
|| Date Author Change Id Release Description Of Change ||
|
||||
|| ---- ------ --------- ------- --------------------- ||
|
||||
|| 19.03.2018 Patrick Vogler B87D120 V 0.1.0 source file created ||
|
||||
|| ||
|
||||
|| -------------------------------------------------------------------------------------------------------------------- ||
|
||||
|| ||
|
||||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|
||||
|| ||
|
||||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|
||||
|| following conditions are met: ||
|
||||
|| ||
|
||||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|
||||
|| the following disclaimer. ||
|
||||
|| ||
|
||||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|
||||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|
||||
|| distribution. ||
|
||||
|| ||
|
||||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|
||||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|
||||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|
||||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|
||||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|
||||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|
||||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|
||||
|| ||
|
||||
\*==================================================================================================================================*/
|
||||
/*================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| ||
|
||||
|| This file 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: ||
|
||||
|| ||
|
||||
|| (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. ||
|
||||
|| ||
|
||||
\*================================================================================================*/
|
||||
|
||||
/************************************************************************************************************\
|
||||
|| _ _ _ ____ _ _ _ ___ ____ ||
|
||||
|
@ -101,7 +68,7 @@
|
|||
|| |___ _/\_ | |___ | \ | \| | | |___ \/ | | | \ | | | |__] |___ |___ ___] ||
|
||||
|| ||
|
||||
\************************************************************************************************************/
|
||||
double DWT_ENERGY_GAIN_LUT[3][2 * MAX_DECOMPOSITION_LEVELS + 2];
|
||||
double DWT_ENERGY_GAIN_LUT[3][2 * MAX_DECOMP_LEVELS + 2];
|
||||
|
||||
/************************************************************************************************************\
|
||||
|| ___ ____ _ _ _ ____ ___ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|
||||
|
@ -1250,9 +1217,9 @@ initialize_gain_lut()
|
|||
! (5/3) and Haar wavelet transform by setting the energy !
|
||||
! gain factor for level zero to one. !
|
||||
\*--------------------------------------------------------*/
|
||||
DWT_ENERGY_GAIN_LUT[bwc_dwt_9_7][0] = DWT_ENERGY_GAIN_LUT[bwc_dwt_9_7][MAX_DECOMPOSITION_LEVELS + 1] = 1.0f;
|
||||
DWT_ENERGY_GAIN_LUT[bwc_dwt_5_3][0] = DWT_ENERGY_GAIN_LUT[bwc_dwt_5_3][MAX_DECOMPOSITION_LEVELS + 1] = 1.0f;
|
||||
DWT_ENERGY_GAIN_LUT[bwc_dwt_haar][0] = DWT_ENERGY_GAIN_LUT[bwc_dwt_haar][MAX_DECOMPOSITION_LEVELS + 1] = 1.0f;
|
||||
DWT_ENERGY_GAIN_LUT[bwc_dwt_9_7][0] = DWT_ENERGY_GAIN_LUT[bwc_dwt_9_7][MAX_DECOMP_LEVELS + 1] = 1.0f;
|
||||
DWT_ENERGY_GAIN_LUT[bwc_dwt_5_3][0] = DWT_ENERGY_GAIN_LUT[bwc_dwt_5_3][MAX_DECOMP_LEVELS + 1] = 1.0f;
|
||||
DWT_ENERGY_GAIN_LUT[bwc_dwt_haar][0] = DWT_ENERGY_GAIN_LUT[bwc_dwt_haar][MAX_DECOMP_LEVELS + 1] = 1.0f;
|
||||
|
||||
/*--------------------------------------------------------*\
|
||||
! Loop through the symmetric wavelet filter banks and as- !
|
||||
|
@ -1307,7 +1274,7 @@ initialize_gain_lut()
|
|||
/*--------------------------------------------------------*\
|
||||
! Loop through the remaining decomposition levels. !
|
||||
\*--------------------------------------------------------*/
|
||||
for(k = 1; k < MAX_DECOMPOSITION_LEVELS; ++k)
|
||||
for(k = 1; k < MAX_DECOMP_LEVELS; ++k)
|
||||
{
|
||||
/*--------------------------------------------------------*\
|
||||
! Assemble the low- or high-pass synthesis sequence for !
|
||||
|
@ -1346,7 +1313,7 @@ initialize_gain_lut()
|
|||
! high-pass energy gain factor and set the length of work !
|
||||
! buffer 1 to the corresponding high-pass filter length. !
|
||||
\*--------------------------------------------------------*/
|
||||
LUT += MAX_DECOMPOSITION_LEVELS + 1;
|
||||
LUT += MAX_DECOMP_LEVELS + 1;
|
||||
Length_Gb = Length[1];
|
||||
}
|
||||
/*--------------------------------------------------------*\
|
||||
|
@ -1399,7 +1366,7 @@ initialize_gain_lut()
|
|||
/*--------------------------------------------------------*\
|
||||
! Loop through the remaining decomposition levels. !
|
||||
\*--------------------------------------------------------*/
|
||||
for(k = 1; k < MAX_DECOMPOSITION_LEVELS; ++k)
|
||||
for(k = 1; k < MAX_DECOMP_LEVELS; ++k)
|
||||
{
|
||||
/*--------------------------------------------------------*\
|
||||
! Assemble the low- or high-pass synthesis sequence for !
|
||||
|
@ -1435,7 +1402,7 @@ initialize_gain_lut()
|
|||
! Calculate the energy gain factor for decomposition level !
|
||||
! i by evaluating the square norm of work buffer 1. !
|
||||
\*--------------------------------------------------------*/
|
||||
LUT += MAX_DECOMPOSITION_LEVELS + 1;
|
||||
LUT += MAX_DECOMP_LEVELS + 1;
|
||||
Length_Gb = Length[1];
|
||||
}
|
||||
/*--------------------------------------------------------*\
|
||||
|
@ -1457,9 +1424,9 @@ initialize_gain_lut()
|
|||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! This function evaluates the energy gain factor according to the the specified decomposition !
|
||||
! level. For decomposition levels larger than MAX_DECOMPOSITION_LEVELS the filter gain for !
|
||||
! the extra levels is approximated by multiplying the energy gain factor by 2. !
|
||||
! This function evaluates the energy gain factor according to the the specified decom- !
|
||||
! position level. For decomposition levels larger than MAX_DECOMP_LEVELS the filter gain !
|
||||
! for the extra levels is approximated by multiplying the energy gain factor by 2. !
|
||||
! !
|
||||
! PARAMETERS: !
|
||||
! ----------- !
|
||||
|
@ -1535,73 +1502,73 @@ get_dwt_energy_gain(bwc_field *const field, uchar highband_flag, uint16 level)
|
|||
/*--------------------------------------------------------*\
|
||||
! Multiply the energy gain factor with the filter gain of !
|
||||
! the wavelet kernel applied along the X-axis. For decom- !
|
||||
! position levels larger than MAX_DECOMPOSITION_LEVELS the !
|
||||
! energy gain for the extra levels is approximated by mul- !
|
||||
! tiplying it by 2. !
|
||||
! position levels larger than MAX_DECOMP_LEVELS the energy !
|
||||
! gain for the extra levels is approximated by multiplying !
|
||||
! it by 2. !
|
||||
\*--------------------------------------------------------*/
|
||||
if(level_X != 0)
|
||||
{
|
||||
while(level_X > MAX_DECOMPOSITION_LEVELS)
|
||||
while(level_X > MAX_DECOMP_LEVELS)
|
||||
{
|
||||
Gb *= 2.0f;
|
||||
level_X--;
|
||||
}
|
||||
|
||||
Gb *= DWT_ENERGY_GAIN_LUT[control->KernelX][level_X + ((highband_flag & DIM_X) * (MAX_DECOMPOSITION_LEVELS + 1))];
|
||||
Gb *= DWT_ENERGY_GAIN_LUT[control->KernelX][level_X + ((highband_flag & DIM_X) * (MAX_DECOMP_LEVELS + 1))];
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------*\
|
||||
! Multiply the energy gain factor with the filter gain of !
|
||||
! the wavelet kernel applied along the Y-axis. For decom- !
|
||||
! position levels larger than MAX_DECOMPOSITION_LEVELS the !
|
||||
! energy gain for the extra levels is approximated by mul- !
|
||||
! tiplying it by 2. !
|
||||
! position levels larger than MAX_DECOMP_LEVELS the energy !
|
||||
! gain for the extra levels is approximated by multiplying !
|
||||
! it by 2. !
|
||||
\*--------------------------------------------------------*/
|
||||
if(level_Y != 0)
|
||||
{
|
||||
while(level_Y > MAX_DECOMPOSITION_LEVELS)
|
||||
while(level_Y > MAX_DECOMP_LEVELS)
|
||||
{
|
||||
Gb *= 2.0f;
|
||||
level_Y--;
|
||||
}
|
||||
|
||||
Gb *= DWT_ENERGY_GAIN_LUT[control->KernelY][level_Y + (((highband_flag & DIM_Y) >> 1) * (MAX_DECOMPOSITION_LEVELS + 1))];
|
||||
Gb *= DWT_ENERGY_GAIN_LUT[control->KernelY][level_Y + (((highband_flag & DIM_Y) >> 1) * (MAX_DECOMP_LEVELS + 1))];
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------*\
|
||||
! Multiply the energy gain factor with the filter gain of !
|
||||
! the wavelet kernel applied along the Z-axis. For decom- !
|
||||
! position levels larger than MAX_DECOMPOSITION_LEVELS the !
|
||||
! energy gain for the extra levels is approximated by mul- !
|
||||
! tiplying it by 2. !
|
||||
! position levels larger than MAX_DECOMP_LEVELS the energy !
|
||||
! gain for the extra levels is approximated by multiplying !
|
||||
! it by 2. !
|
||||
\*--------------------------------------------------------*/
|
||||
if(level_Z != 0)
|
||||
{
|
||||
while(level_Z > MAX_DECOMPOSITION_LEVELS)
|
||||
while(level_Z > MAX_DECOMP_LEVELS)
|
||||
{
|
||||
Gb *= 2.0f;
|
||||
level_Z--;
|
||||
}
|
||||
|
||||
Gb *= DWT_ENERGY_GAIN_LUT[control->KernelZ][level_Z + (((highband_flag & DIM_Z) >> 2) * (MAX_DECOMPOSITION_LEVELS + 1))];
|
||||
Gb *= DWT_ENERGY_GAIN_LUT[control->KernelZ][level_Z + (((highband_flag & DIM_Z) >> 2) * (MAX_DECOMP_LEVELS + 1))];
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------*\
|
||||
! Multiply the energy gain factor with the filter gain of !
|
||||
! the wavelet kernel applied along the TS-axis. For decom- !
|
||||
! position levels larger than MAX_DECOMPOSITION_LEVELS the !
|
||||
! energy gain for the extra levels is approximated by mul- !
|
||||
! tiplying it by 2. !
|
||||
! position levels larger than MAX_DECOMP_LEVELS the energy !
|
||||
! gain for the extra levels is approximated by multiplying !
|
||||
! it by 2. !
|
||||
\*--------------------------------------------------------*/
|
||||
if(level_TS != 0)
|
||||
{
|
||||
while(level_TS > MAX_DECOMPOSITION_LEVELS)
|
||||
while(level_TS > MAX_DECOMP_LEVELS)
|
||||
{
|
||||
Gb *= 2.0f;
|
||||
level_TS--;
|
||||
}
|
||||
|
||||
Gb *= DWT_ENERGY_GAIN_LUT[control->KernelTS][level_TS + (((highband_flag & DIM_TS) >> 3) * (MAX_DECOMPOSITION_LEVELS + 1))];
|
||||
Gb *= DWT_ENERGY_GAIN_LUT[control->KernelTS][level_TS + (((highband_flag & DIM_TS) >> 3) * (MAX_DECOMP_LEVELS + 1))];
|
||||
}
|
||||
return (bwc_float)Gb;
|
||||
}
|
||||
|
@ -1645,7 +1612,7 @@ get_dwt_energy_gain(bwc_field *const field, uchar highband_flag, uint16 level)
|
|||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
uchar
|
||||
forward_discrete_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter)
|
||||
forward_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter)
|
||||
{
|
||||
/*-----------------------*\
|
||||
! DEFINE INT VARIABLES: !
|
||||
|
@ -2182,7 +2149,7 @@ forward_discrete_wavelet_transform(bwc_field *const field, bwc_parameter *const
|
|||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
uchar
|
||||
inverse_discrete_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter)
|
||||
inverse_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter)
|
||||
{
|
||||
/*-----------------------*\
|
||||
! DEFINE INT VARIABLES: !
|
||||
|
|
|
@ -1,87 +1,47 @@
|
|||
/*==================================================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| ||
|
||||
|| Version 0.1.1 ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| Big Whoop is a compression codec for the lossy compression of IEEE 754 floating point arrays defined on curvelinear ||
|
||||
|| compute grids. ||
|
||||
|| ||
|
||||
|| FILE REFERENCES: ||
|
||||
|| ---------------- ||
|
||||
|| ||
|
||||
|| Name I/O Description ||
|
||||
|| ---- --- ----------- ||
|
||||
|| none - - ||
|
||||
|| ||
|
||||
|| ||
|
||||
|| PRIVATE FUNCTIONS: ||
|
||||
|| ------------------ ||
|
||||
|| - initialize_precinct ||
|
||||
|| - subband_gain ||
|
||||
|| - initialize_subband ||
|
||||
|| - create_field ||
|
||||
|| ||
|
||||
|| PUBLIC FUNCTIONS: ||
|
||||
|| ----------------- ||
|
||||
|| - bwc_initialize_field ||
|
||||
|| - bwc_add_param ||
|
||||
|| - bwc_set_error_resilience ||
|
||||
|| - bwc_set_quantization_style ||
|
||||
|| - bwc_set_progression ||
|
||||
|| - bwc_set_kernels ||
|
||||
|| - bwc_set_decomp ||
|
||||
|| - bwc_set_precincts ||
|
||||
|| - bwc_set_codeblocks ||
|
||||
|| - bwc_set_qm ||
|
||||
|| - bwc_set_tiles ||
|
||||
|| - bwc_create_compression ||
|
||||
|| - bwc_kill_compression ||
|
||||
|| ||
|
||||
|| DEVELOPMENT HISTORY: ||
|
||||
|| -------------------- ||
|
||||
|| ||
|
||||
|| Date Author Change Id Release Description Of Change ||
|
||||
|| ---- ------ --------- ------- --------------------- ||
|
||||
|| 10.10.2017 Patrick Vogler B87D120 V 0.1.0 source file created ||
|
||||
|| ||
|
||||
|| -------------------------------------------------------------------------------------------------------------------- ||
|
||||
|| ||
|
||||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|
||||
|| ||
|
||||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|
||||
|| following conditions are met: ||
|
||||
|| ||
|
||||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|
||||
|| the following disclaimer. ||
|
||||
|| ||
|
||||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|
||||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|
||||
|| distribution. ||
|
||||
|| ||
|
||||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|
||||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|
||||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|
||||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|
||||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|
||||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|
||||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|
||||
|| ||
|
||||
\*==================================================================================================================================*/
|
||||
|
||||
/*================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| 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. ||
|
||||
|| ||
|
||||
\*================================================================================================*/
|
||||
/************************************************************************************************************\
|
||||
|| _ _ _ ____ _ _ _ ___ ____ ||
|
||||
|| | |\ | | | | | | \ |___ ||
|
||||
|
@ -1889,15 +1849,13 @@ bwc_free_data(bwc_data* data)
|
|||
{
|
||||
release_packed_stream(data->codestream.com);
|
||||
}
|
||||
if(data->file.fp)
|
||||
if(data->fp)
|
||||
{
|
||||
fclose(data->file.fp);
|
||||
fclose(data->fp);
|
||||
}
|
||||
free(data->codestream.data);
|
||||
free(data->codestream.aux);
|
||||
free(data->codestream.com);
|
||||
free(data->file.d_root);
|
||||
free(data->file.f_root);
|
||||
free(data->field.d);
|
||||
free(data->field.f);
|
||||
free(data);
|
||||
|
@ -2719,7 +2677,7 @@ bwc_set_error_resilience(bwc_field *const field)
|
|||
}
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! FUNCTION NAME: void bwc_set_quantization_style(bwc_field *const field, bwc_quant_st quantization_style) !
|
||||
! FUNCTION NAME: void bwc_set_quant_style(bwc_field *const field, bwc_quant_st quantization_style) !
|
||||
! -------------- !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
|
@ -2752,7 +2710,7 @@ bwc_set_error_resilience(bwc_field *const field)
|
|||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
void
|
||||
bwc_set_quantization_style(bwc_field *const field, bwc_quant_st quantization_style)
|
||||
bwc_set_quant_style(bwc_field *const field, bwc_quant_st quantization_style)
|
||||
{
|
||||
/*-----------------------*\
|
||||
! DEFINE STRUCTS: !
|
||||
|
@ -2785,7 +2743,7 @@ bwc_set_quantization_style(bwc_field *const field, bwc_quant_st quantization_sty
|
|||
}
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! FUNCTION NAME: void bwc_set_quantization_step_size(bwc_field *const field, double delta) !
|
||||
! FUNCTION NAME: void bwc_set_quant_step_size(bwc_field *const field, double delta) !
|
||||
! -------------- !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
|
@ -2818,7 +2776,7 @@ bwc_set_quantization_style(bwc_field *const field, bwc_quant_st quantization_sty
|
|||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
void
|
||||
bwc_set_quantization_step_size(bwc_field *const field, double delta)
|
||||
bwc_set_quant_step_size(bwc_field *const field, double delta)
|
||||
{
|
||||
/*-----------------------*\
|
||||
! DEFINE STRUCTS: !
|
||||
|
@ -4062,7 +4020,7 @@ bwc_compress(bwc_field *const field, bwc_data *const data)
|
|||
#else
|
||||
start = (double)clock();
|
||||
#endif
|
||||
if(forward_discrete_wavelet_transform(field, parameter))
|
||||
if(forward_wavelet_transform(field, parameter))
|
||||
{
|
||||
free(working_buffer);
|
||||
return 1;
|
||||
|
@ -4419,7 +4377,7 @@ bwc_decompress(bwc_field *const field, bwc_data *const data)
|
|||
#else
|
||||
start = (double)clock();
|
||||
#endif
|
||||
if(inverse_discrete_wavelet_transform(field, parameter))
|
||||
if(inverse_wavelet_transform(field, parameter))
|
||||
{
|
||||
free(working_buffer);
|
||||
return 1;
|
||||
|
|
135
src/library/mq.c
135
src/library/mq.c
|
@ -1,69 +1,47 @@
|
|||
/*==================================================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| 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. ||
|
||||
|| ||
|
||||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|
||||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|
||||
|| distribution. ||
|
||||
|| ||
|
||||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|
||||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|
||||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|
||||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|
||||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|
||||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|
||||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|
||||
|| ||
|
||||
\*==================================================================================================================================*/
|
||||
|
||||
/*================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| ||
|
||||
|| 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. ||
|
||||
|| ||
|
||||
\*================================================================================================*/
|
||||
/************************************************************************************************************\
|
||||
|| _ _ _ ____ _ _ _ ___ ____ ||
|
||||
|| | |\ | | | | | | \ |___ ||
|
||||
|
@ -77,6 +55,7 @@
|
|||
|
||||
#include "macros.h"
|
||||
#include "mq.h"
|
||||
#include "tier1.h"
|
||||
#include "types.h"
|
||||
|
||||
/************************************************************************************************************\
|
||||
|
@ -346,7 +325,7 @@ static const bwc_context_state context_state[94] =
|
|||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
uchar
|
||||
initialize_bit_encoder(bwc_coder *const coder, const uint8 number_of_contexts)
|
||||
initialize_mq_encoder(bwc_coder *const coder, const uint8 number_of_contexts)
|
||||
{
|
||||
/*-----------------------*\
|
||||
! DEFINE INT VARIABLES: !
|
||||
|
@ -427,7 +406,7 @@ initialize_bit_encoder(bwc_coder *const coder, const uint8 number_of_contexts)
|
|||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
uchar
|
||||
bit_encoder_next_run(bwc_bit_coder *const bitcoder)
|
||||
mq_next_run(bwc_bit_coder *const bitcoder)
|
||||
{
|
||||
/*-----------------------*\
|
||||
! DEFINE STRUCTS: !
|
||||
|
@ -496,7 +475,7 @@ bit_encoder_next_run(bwc_bit_coder *const bitcoder)
|
|||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
void
|
||||
bit_encode(bwc_bit_coder *const bitcoder, const uint8 s, const uint8 k)
|
||||
mq_bit_encode(bwc_bit_coder *const bitcoder, const uint8 s, const uint8 k)
|
||||
{
|
||||
/*-----------------------*\
|
||||
! DEFINE INT VARIABLES: !
|
||||
|
@ -605,7 +584,7 @@ bit_encode(bwc_bit_coder *const bitcoder, const uint8 s, const uint8 k)
|
|||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
void
|
||||
bit_encoder_truncation_length_min(bwc_coder_state *const state)
|
||||
mq_truncation_length_min(bwc_coder_state *const state)
|
||||
{
|
||||
/*-----------------------*\
|
||||
! DEFINE INT VARIABLES: !
|
||||
|
@ -724,7 +703,7 @@ bit_encoder_truncation_length_min(bwc_coder_state *const state)
|
|||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
void
|
||||
bit_encoder_termination(bwc_bit_coder *const bitcoder)
|
||||
mq_termination(bwc_bit_coder *const bitcoder)
|
||||
{
|
||||
/*-----------------------*\
|
||||
! DEFINE INT VARIABLES: !
|
||||
|
@ -774,7 +753,7 @@ bit_encoder_termination(bwc_bit_coder *const bitcoder)
|
|||
|
||||
while(state)
|
||||
{
|
||||
bit_encoder_truncation_length_min(state);
|
||||
mq_truncation_length_min(state);
|
||||
state = state->next;
|
||||
}
|
||||
}
|
||||
|
@ -808,7 +787,7 @@ bit_encoder_termination(bwc_bit_coder *const bitcoder)
|
|||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
void
|
||||
free_bit_encoder(bwc_coder *const coder)
|
||||
free_mq_encoder(bwc_coder *const coder)
|
||||
{
|
||||
/*-----------------------*\
|
||||
! DEFINE ASSERTIONS: !
|
||||
|
@ -864,7 +843,7 @@ free_bit_encoder(bwc_coder *const coder)
|
|||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
uchar
|
||||
initialize_bit_decoder(bwc_coder *const coder, const uint8 number_of_contexts, const int64 Lmax)
|
||||
initialize_mq_decoder(bwc_coder *const coder, const uint8 number_of_contexts, const int64 Lmax)
|
||||
{
|
||||
/*-----------------------*\
|
||||
! DEFINE INT VARIABLES: !
|
||||
|
@ -968,7 +947,7 @@ initialize_bit_decoder(bwc_coder *const coder, const uint8 number_of_contexts, c
|
|||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
uint8
|
||||
bit_decode(bwc_bit_coder *const bitcoder, const uint8 k)
|
||||
mq_bit_decode(bwc_bit_coder *const bitcoder, const uint8 k)
|
||||
{
|
||||
/*-----------------------*\
|
||||
! DEFINE INT VARIABLES: !
|
||||
|
@ -1078,7 +1057,7 @@ bit_decode(bwc_bit_coder *const bitcoder, const uint8 k)
|
|||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
uint64
|
||||
bit_coder_get_no_bytes(bwc_bit_coder *const bitcoder)
|
||||
mq_get_no_bytes(bwc_bit_coder *const bitcoder)
|
||||
{
|
||||
/*-----------------------*\
|
||||
! DEFINE ASSERTIONS: !
|
||||
|
@ -1117,7 +1096,7 @@ bit_coder_get_no_bytes(bwc_bit_coder *const bitcoder)
|
|||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
void
|
||||
bit_coder_reset_ptr(bwc_bit_coder *const bitcoder, uchar *const memory)
|
||||
mq_reset_ptr(bwc_bit_coder *const bitcoder, uchar *const memory)
|
||||
{
|
||||
/*-----------------------*\
|
||||
! DEFINE STRUCTS: !
|
||||
|
@ -1169,7 +1148,7 @@ bit_coder_reset_ptr(bwc_bit_coder *const bitcoder, uchar *const memory)
|
|||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
void
|
||||
bit_coder_get_pass_lengths(bwc_bit_coder *const bitcoder, bwc_encoded_cblk *const encoded_cblk)
|
||||
mq_get_pass_lengths(bwc_bit_coder *const bitcoder, bwc_encoded_cblk *const encoded_cblk)
|
||||
{
|
||||
/*-----------------------*\
|
||||
! DEFINE INT VARIABLES: !
|
||||
|
|
|
@ -1,76 +1,55 @@
|
|||
/*==================================================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| FILE NAME: tagtree.c ||
|
||||
|| ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| DESCRIPTION NEEDED. ||
|
||||
|| ||
|
||||
|| FILE REFERENCES: ||
|
||||
|| ---------------- ||
|
||||
|| ||
|
||||
|| Name I/O Description ||
|
||||
|| ---- --- ----------- ||
|
||||
|| none - - ||
|
||||
|| ||
|
||||
|| ||
|
||||
|| PRIVATE FUNCTIONS: ||
|
||||
|| ------------------ ||
|
||||
|| ||
|
||||
|| PUBLIC FUNCTIONS: ||
|
||||
|| ----------------- ||
|
||||
|| - kill_tagtree ||
|
||||
|| - reset_tagtree ||
|
||||
|| - tagtree_get_value ||
|
||||
|| - tagtree_set_value ||
|
||||
|| - initialize_tagtree ||
|
||||
|| - encode_tagtree ||
|
||||
|| - decode_tagtree ||
|
||||
|| ||
|
||||
|| DEVELOPMENT HISTORY: ||
|
||||
|| -------------------- ||
|
||||
|| ||
|
||||
|| Date Author Change Id Release Description Of Change ||
|
||||
|| ---- ------ --------- ------- --------------------- ||
|
||||
|| 18.05.2018 Patrick Vogler B87D120 V 0.1.0 source file created ||
|
||||
|| ||
|
||||
|| -------------------------------------------------------------------------------------------------------------------- ||
|
||||
|| ||
|
||||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|
||||
|| ||
|
||||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|
||||
|| following conditions are met: ||
|
||||
|| ||
|
||||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|
||||
|| the following disclaimer. ||
|
||||
|| ||
|
||||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|
||||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|
||||
|| distribution. ||
|
||||
|| ||
|
||||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|
||||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|
||||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|
||||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|
||||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|
||||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|
||||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|
||||
|| ||
|
||||
\*==================================================================================================================================*/
|
||||
|
||||
/*================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| ||
|
||||
|| This file defines a tagtree procedure used to encode/decode two types of ||
|
||||
|| information found defining in a codeblock in specific quality layer: ||
|
||||
|| ||
|
||||
|| - The inclusion tag records if a codeblock has any contribution ||
|
||||
|| to a quality layer. ||
|
||||
|| - The number of leading bitplanes that are not significant/only ||
|
||||
|| populated by zero bits. ||
|
||||
|| ||
|
||||
|| For more information on the encoding/decoding process please refere to JPEG2000 ||
|
||||
|| by D. S. Taubman and M. W. Marcellin (p. 384). ||
|
||||
|| ||
|
||||
|| -------------------------------------------------------------------------------------------- ||
|
||||
|| 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. ||
|
||||
|| ||
|
||||
\*================================================================================================*/
|
||||
/************************************************************************************************************\
|
||||
|| _ _ _ ____ _ _ _ ___ ____ ||
|
||||
|| | |\ | | | | | | \ |___ ||
|
||||
|
|
|
@ -1,69 +1,49 @@
|
|||
/*==================================================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| FILE NAME: tier1.c ||
|
||||
|| ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| DESCRIPTION NEEDED. ||
|
||||
|| ||
|
||||
|| FILE REFERENCES: ||
|
||||
|| ---------------- ||
|
||||
|| ||
|
||||
|| Name I/O Description ||
|
||||
|| ---- --- ----------- ||
|
||||
|| none - - ||
|
||||
|| ||
|
||||
|| ||
|
||||
|| PRIVATE FUNCTIONS: ||
|
||||
|| ------------------ ||
|
||||
|| ||
|
||||
|| PUBLIC FUNCTIONS: ||
|
||||
|| ----------------- ||
|
||||
|| ||
|
||||
|| DEVELOPMENT HISTORY: ||
|
||||
|| -------------------- ||
|
||||
|| ||
|
||||
|| Date Author Change Id Release Description Of Change ||
|
||||
|| ---- ------ --------- ------- --------------------- ||
|
||||
|| - Patrick Vogler B87D120 V 0.1.0 source file created ||
|
||||
|| ||
|
||||
|| -------------------------------------------------------------------------------------------------------------------- ||
|
||||
|| ||
|
||||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|
||||
|| ||
|
||||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|
||||
|| following conditions are met: ||
|
||||
|| ||
|
||||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|
||||
|| the following disclaimer. ||
|
||||
|| ||
|
||||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|
||||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|
||||
|| distribution. ||
|
||||
|| ||
|
||||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|
||||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|
||||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|
||||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|
||||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|
||||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|
||||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|
||||
|| ||
|
||||
\*==================================================================================================================================*/
|
||||
|
||||
/*================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| ||
|
||||
|| This file 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: ||
|
||||
|| ||
|
||||
|| (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. ||
|
||||
|| ||
|
||||
\*================================================================================================*/
|
||||
/************************************************************************************************************\
|
||||
|| _ _ _ ____ _ _ _ ___ ____ ||
|
||||
|| | |\ | | | | | | \ |___ ||
|
||||
|
@ -111,10 +91,10 @@
|
|||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
#define encode_segmark(bitcoder) \
|
||||
{ \
|
||||
bit_encode(bitcoder, 1, CONTEXT_UNI); \
|
||||
bit_encode(bitcoder, 0, CONTEXT_UNI); \
|
||||
bit_encode(bitcoder, 1, CONTEXT_UNI); \
|
||||
bit_encode(bitcoder, 0, CONTEXT_UNI); \
|
||||
mq_bit_encode(bitcoder, 1, CONTEXT_UNI); \
|
||||
mq_bit_encode(bitcoder, 0, CONTEXT_UNI); \
|
||||
mq_bit_encode(bitcoder, 1, CONTEXT_UNI); \
|
||||
mq_bit_encode(bitcoder, 0, CONTEXT_UNI); \
|
||||
}
|
||||
|
||||
/************************************************************************************************************\
|
||||
|
@ -1014,8 +994,8 @@ significance_propagation_enc_pass(bwc_coder *const coder, const int8 b)
|
|||
stripe = coder->data;
|
||||
rest = 4 - (coder->height & 0x03);
|
||||
stripe_mask = ~((0x0F >> ((coder->height & 0x03))) | 0xF0);
|
||||
dist_shift = (b < DISTORTION_MANTISSA) ? 0 : (b - DISTORTION_MANTISSA);
|
||||
dist_corr = (b < DISTORTION_MANTISSA) ? (DISTORTION_MANTISSA - b) : 0;
|
||||
dist_shift = (b < DISTORTION_SIG) ? 0 : (b - DISTORTION_SIG);
|
||||
dist_corr = (b < DISTORTION_SIG) ? (DISTORTION_SIG - b) : 0;
|
||||
|
||||
for(i = 0, k = 0; i < coder->no_slice; ++i)
|
||||
{
|
||||
|
@ -1053,7 +1033,7 @@ significance_propagation_enc_pass(bwc_coder *const coder, const int8 b)
|
|||
|
||||
if(k_sig)
|
||||
{
|
||||
bit_encode(coder->bitcoder, (uchar)((bit >> l) & 0x01), coder->sig2context[k_sig]);
|
||||
mq_bit_encode(coder->bitcoder, (uchar)((bit >> l) & 0x01), coder->sig2context[k_sig]);
|
||||
|
||||
if(bit & bit_mask)
|
||||
{
|
||||
|
@ -1075,8 +1055,8 @@ significance_propagation_enc_pass(bwc_coder *const coder, const int8 b)
|
|||
xi_h = SIG2XI[xi_h];
|
||||
xi_v = SIG2XI[xi_v];
|
||||
|
||||
bit_encode(coder->bitcoder, (uchar)(((bit_mask & stripe[k].xi) >> l)^XI2CONT[(xi_h << 2) | xi_v][1]),
|
||||
XI2CONT[(xi_h << 2) | xi_v][0]);
|
||||
mq_bit_encode(coder->bitcoder, (uchar)(((bit_mask & stripe[k].xi) >> l)^XI2CONT[(xi_h << 2) | xi_v][1]),
|
||||
XI2CONT[(xi_h << 2) | xi_v][0]);
|
||||
|
||||
mse += DISTORTION_TS_LUT[((stripe[k].sample[l] >> dist_shift) << dist_corr) & 0x1F];
|
||||
stripe[k].sigma |= bit_mask;
|
||||
|
@ -1126,7 +1106,7 @@ significance_propagation_enc_pass(bwc_coder *const coder, const int8 b)
|
|||
|
||||
if(k_sig && (stripe[k].sigma^bit_mask))
|
||||
{
|
||||
bit_encode(coder->bitcoder, (uchar)((bit >> l) & 0x01), coder->sig2context[k_sig]);
|
||||
mq_bit_encode(coder->bitcoder, (uchar)((bit >> l) & 0x01), coder->sig2context[k_sig]);
|
||||
|
||||
if(bit & bit_mask)
|
||||
{
|
||||
|
@ -1144,8 +1124,8 @@ significance_propagation_enc_pass(bwc_coder *const coder, const int8 b)
|
|||
xi_h = SIG2XI[xi_h];
|
||||
xi_v = SIG2XI[xi_v];
|
||||
|
||||
bit_encode(coder->bitcoder, (uchar)(((bit_mask & stripe[k].xi) >> l)^XI2CONT[(xi_h << 2) | xi_v][1]),
|
||||
XI2CONT[(xi_h << 2) | xi_v][0]);
|
||||
mq_bit_encode(coder->bitcoder, (uchar)(((bit_mask & stripe[k].xi) >> l)^XI2CONT[(xi_h << 2) | xi_v][1]),
|
||||
XI2CONT[(xi_h << 2) | xi_v][0]);
|
||||
|
||||
mse += DISTORTION_TS_LUT[((stripe[k].sample[l] >> dist_shift) << dist_corr) & 0x1F];
|
||||
stripe[k].sigma |= bit_mask;
|
||||
|
@ -1227,8 +1207,8 @@ magnitude_refinement_enc_pass(bwc_coder *const coder, const int8 b)
|
|||
stripe = coder->data;
|
||||
rest = 4 - (coder->height & 0x03);
|
||||
stripe_mask = ~((0x0F >> ((coder->height & 0x03))) | 0xF0);
|
||||
dist_shift = (b < DISTORTION_MANTISSA) ? 0 : (b - DISTORTION_MANTISSA);
|
||||
dist_corr = (b < DISTORTION_MANTISSA) ? (DISTORTION_MANTISSA - b) : 0;
|
||||
dist_shift = (b < DISTORTION_MAG) ? 0 : (b - DISTORTION_MAG);
|
||||
dist_corr = (b < DISTORTION_MAG) ? (DISTORTION_MAG - b) : 0;
|
||||
|
||||
for(i = 0, k = 0; i < coder->no_slice; ++i)
|
||||
{
|
||||
|
@ -1271,7 +1251,7 @@ magnitude_refinement_enc_pass(bwc_coder *const coder, const int8 b)
|
|||
}
|
||||
}
|
||||
|
||||
bit_encode(coder->bitcoder, (uchar)((bit >> l) & 0x01), k_mag);
|
||||
mq_bit_encode(coder->bitcoder, (uchar)((bit >> l) & 0x01), k_mag);
|
||||
|
||||
mse += DISTORTION_TM_LUT[((stripe[k].sample[l] >> dist_shift) << dist_corr) & 0x3F];
|
||||
stripe[k].delta |= bit_mask;
|
||||
|
@ -1313,7 +1293,7 @@ magnitude_refinement_enc_pass(bwc_coder *const coder, const int8 b)
|
|||
}
|
||||
}
|
||||
|
||||
bit_encode(coder->bitcoder, (uchar)((bit >> l) & 0x01), k_mag);
|
||||
mq_bit_encode(coder->bitcoder, (uchar)((bit >> l) & 0x01), k_mag);
|
||||
|
||||
mse += DISTORTION_TM_LUT[((stripe[k].sample[l] >> dist_shift) << dist_corr) & 0x3F];
|
||||
stripe[k].delta |= bit_mask;
|
||||
|
@ -1383,8 +1363,8 @@ cleanup_enc_pass(bwc_coder *const coder, const int8 b)
|
|||
mse = 0;
|
||||
stripe = coder->data;
|
||||
rest = 4 - (coder->height & 0x03);
|
||||
dist_shift = (b < DISTORTION_MANTISSA) ? 0 : (b - DISTORTION_MANTISSA);
|
||||
dist_corr = (b < DISTORTION_MANTISSA) ? (DISTORTION_MANTISSA - b) : 0;
|
||||
dist_shift = (b < DISTORTION_SIG) ? 0 : (b - DISTORTION_SIG);
|
||||
dist_corr = (b < DISTORTION_SIG) ? (DISTORTION_SIG - b) : 0;
|
||||
|
||||
for(i = 0, k = 0; i < coder->no_slice; ++i)
|
||||
{
|
||||
|
@ -1407,14 +1387,14 @@ cleanup_enc_pass(bwc_coder *const coder, const int8 b)
|
|||
r |= r >> 2;
|
||||
r = DISTORTION_LZ_LUT[r];
|
||||
|
||||
bit_encode(coder->bitcoder, (uchar)1, CONTEXT_RUN);
|
||||
bit_encode(coder->bitcoder, (uchar)r >> 1, CONTEXT_UNI);
|
||||
bit_encode(coder->bitcoder, (uchar)r&0x01, CONTEXT_UNI);
|
||||
mq_bit_encode(coder->bitcoder, (uchar)1, CONTEXT_RUN);
|
||||
mq_bit_encode(coder->bitcoder, (uchar)r >> 1, CONTEXT_UNI);
|
||||
mq_bit_encode(coder->bitcoder, (uchar)r&0x01, CONTEXT_UNI);
|
||||
}
|
||||
else
|
||||
{
|
||||
r = 4;
|
||||
bit_encode(coder->bitcoder, (uchar)0, CONTEXT_RUN);
|
||||
mq_bit_encode(coder->bitcoder, (uchar)0, CONTEXT_RUN);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1448,7 +1428,7 @@ cleanup_enc_pass(bwc_coder *const coder, const int8 b)
|
|||
(0x08 & stripe[k].stripe_d->stripe_r->sigma)) >> 3;
|
||||
}
|
||||
|
||||
bit_encode(coder->bitcoder, (uchar)((bit >> l) & 0x01), coder->sig2context[(15 * k_h + 5 * k_v + k_d) >> l]);
|
||||
mq_bit_encode(coder->bitcoder, (uchar)((bit >> l) & 0x01), coder->sig2context[(15 * k_h + 5 * k_v + k_d) >> l]);
|
||||
}
|
||||
if(bit & bit_mask)
|
||||
{
|
||||
|
@ -1470,8 +1450,8 @@ cleanup_enc_pass(bwc_coder *const coder, const int8 b)
|
|||
xi_h = SIG2XI[xi_h];
|
||||
xi_v = SIG2XI[xi_v];
|
||||
|
||||
bit_encode(coder->bitcoder, (uchar)(((bit_mask & stripe[k].xi) >> l)^XI2CONT[(xi_h << 2) | xi_v][1]),
|
||||
XI2CONT[(xi_h << 2) | xi_v][0]);
|
||||
mq_bit_encode(coder->bitcoder, (uchar)(((bit_mask & stripe[k].xi) >> l)^XI2CONT[(xi_h << 2) | xi_v][1]),
|
||||
XI2CONT[(xi_h << 2) | xi_v][0]);
|
||||
|
||||
mse += DISTORTION_TS_LUT[((stripe[k].sample[l] >> dist_shift) << dist_corr) & 0x1F];
|
||||
stripe[k].sigma |= bit_mask;
|
||||
|
@ -1503,7 +1483,7 @@ cleanup_enc_pass(bwc_coder *const coder, const int8 b)
|
|||
(0x01 & stripe[k].stripe_u->stripe_r->sigma)) << 3;
|
||||
}
|
||||
|
||||
bit_encode(coder->bitcoder, (uchar)((bit >> l) & 0x01), coder->sig2context[(15 * k_h + 5 * k_v + k_d) >> l]);
|
||||
mq_bit_encode(coder->bitcoder, (uchar)((bit >> l) & 0x01), coder->sig2context[(15 * k_h + 5 * k_v + k_d) >> l]);
|
||||
|
||||
if(bit & bit_mask)
|
||||
{
|
||||
|
@ -1521,8 +1501,8 @@ cleanup_enc_pass(bwc_coder *const coder, const int8 b)
|
|||
xi_h = SIG2XI[xi_h];
|
||||
xi_v = SIG2XI[xi_v];
|
||||
|
||||
bit_encode(coder->bitcoder, (uchar)(((bit_mask & stripe[k].xi) >> l)^XI2CONT[(xi_h << 2) | xi_v][1]),
|
||||
XI2CONT[(xi_h << 2) | xi_v][0]);
|
||||
mq_bit_encode(coder->bitcoder, (uchar)(((bit_mask & stripe[k].xi) >> l)^XI2CONT[(xi_h << 2) | xi_v][1]),
|
||||
XI2CONT[(xi_h << 2) | xi_v][0]);
|
||||
|
||||
mse += DISTORTION_TS_LUT[((stripe[k].sample[l] >> dist_shift) << dist_corr) & 0x1F];
|
||||
stripe[k].sigma |= bit_mask;
|
||||
|
@ -1630,7 +1610,7 @@ significance_propagation_dec_pass(bwc_coder *const coder, const int8 b)
|
|||
|
||||
if(k_sig)
|
||||
{
|
||||
bit = bit_decode(coder->bitcoder, coder->sig2context[k_sig]);
|
||||
bit = mq_bit_decode(coder->bitcoder, coder->sig2context[k_sig]);
|
||||
|
||||
if(bit)
|
||||
{
|
||||
|
@ -1654,7 +1634,7 @@ significance_propagation_dec_pass(bwc_coder *const coder, const int8 b)
|
|||
xi_h = SIG2XI[xi_h];
|
||||
xi_v = SIG2XI[xi_v];
|
||||
|
||||
stripe[k].xi |= ((XI2CONT[(xi_h << 2) | xi_v][1] ^ bit_decode(coder->bitcoder, XI2CONT[(xi_h << 2) | xi_v][0])) << l);
|
||||
stripe[k].xi |= ((XI2CONT[(xi_h << 2) | xi_v][1] ^ mq_bit_decode(coder->bitcoder, XI2CONT[(xi_h << 2) | xi_v][0])) << l);
|
||||
|
||||
stripe[k].sigma |= bit_mask;
|
||||
}
|
||||
|
@ -1703,7 +1683,7 @@ significance_propagation_dec_pass(bwc_coder *const coder, const int8 b)
|
|||
|
||||
if(k_sig && (stripe[k].sigma^bit_mask))
|
||||
{
|
||||
bit = bit_decode(coder->bitcoder, coder->sig2context[k_sig]);
|
||||
bit = mq_bit_decode(coder->bitcoder, coder->sig2context[k_sig]);
|
||||
|
||||
if(bit)
|
||||
{
|
||||
|
@ -1723,7 +1703,7 @@ significance_propagation_dec_pass(bwc_coder *const coder, const int8 b)
|
|||
xi_h = SIG2XI[xi_h];
|
||||
xi_v = SIG2XI[xi_v];
|
||||
|
||||
stripe[k].xi |= ((XI2CONT[(xi_h << 2) | xi_v][1] ^ bit_decode(coder->bitcoder, XI2CONT[(xi_h << 2) | xi_v][0])) << l);
|
||||
stripe[k].xi |= ((XI2CONT[(xi_h << 2) | xi_v][1] ^ mq_bit_decode(coder->bitcoder, XI2CONT[(xi_h << 2) | xi_v][0])) << l);
|
||||
|
||||
stripe[k].sigma |= bit_mask;
|
||||
}
|
||||
|
@ -1843,7 +1823,7 @@ magnitude_refinement_dec_pass(bwc_coder *const coder, const int8 b)
|
|||
}
|
||||
}
|
||||
|
||||
stripe[k].bit[b] |= (bit_decode(coder->bitcoder, k_mag) << l);
|
||||
stripe[k].bit[b] |= (mq_bit_decode(coder->bitcoder, k_mag) << l);
|
||||
|
||||
stripe[k].delta |= bit_mask;
|
||||
}
|
||||
|
@ -1884,7 +1864,7 @@ magnitude_refinement_dec_pass(bwc_coder *const coder, const int8 b)
|
|||
}
|
||||
}
|
||||
|
||||
stripe[k].bit[b] |= (bit_decode(coder->bitcoder, k_mag) << l);
|
||||
stripe[k].bit[b] |= (mq_bit_decode(coder->bitcoder, k_mag) << l);
|
||||
|
||||
stripe[k].delta |= bit_mask;
|
||||
}
|
||||
|
@ -1965,10 +1945,10 @@ cleanup_dec_pass(bwc_coder *const coder, const int8 b)
|
|||
!(0x01 & stripe[k].stripe_u->stripe_r->sigma) && !stripe[k].stripe_r->sigma &&
|
||||
!stripe[k].sigma)
|
||||
{
|
||||
if(bit_decode(coder->bitcoder, CONTEXT_RUN))
|
||||
if(mq_bit_decode(coder->bitcoder, CONTEXT_RUN))
|
||||
{
|
||||
r = bit_decode(coder->bitcoder, CONTEXT_UNI);
|
||||
r = (r << 1) + bit_decode(coder->bitcoder, CONTEXT_UNI);
|
||||
r = mq_bit_decode(coder->bitcoder, CONTEXT_UNI);
|
||||
r = (r << 1) + mq_bit_decode(coder->bitcoder, CONTEXT_UNI);
|
||||
bit |= (0x08 >> r);
|
||||
}
|
||||
else
|
||||
|
@ -2007,7 +1987,7 @@ cleanup_dec_pass(bwc_coder *const coder, const int8 b)
|
|||
(0x08 & stripe[k].stripe_d->stripe_r->sigma)) >> 3;
|
||||
}
|
||||
|
||||
bit |= (bit_decode(coder->bitcoder, coder->sig2context[(15 * k_h + 5 * k_v + k_d) >> l]) << l);
|
||||
bit |= (mq_bit_decode(coder->bitcoder, coder->sig2context[(15 * k_h + 5 * k_v + k_d) >> l]) << l);
|
||||
}
|
||||
if(bit & bit_mask)
|
||||
{
|
||||
|
@ -2029,7 +2009,7 @@ cleanup_dec_pass(bwc_coder *const coder, const int8 b)
|
|||
xi_h = SIG2XI[xi_h];
|
||||
xi_v = SIG2XI[xi_v];
|
||||
|
||||
stripe[k].xi |= ((XI2CONT[(xi_h << 2) | xi_v][1] ^ bit_decode(coder->bitcoder, XI2CONT[(xi_h << 2) | xi_v][0])) << l);
|
||||
stripe[k].xi |= ((XI2CONT[(xi_h << 2) | xi_v][1] ^ mq_bit_decode(coder->bitcoder, XI2CONT[(xi_h << 2) | xi_v][0])) << l);
|
||||
|
||||
stripe[k].sigma |= bit_mask;
|
||||
}
|
||||
|
@ -2063,7 +2043,7 @@ cleanup_dec_pass(bwc_coder *const coder, const int8 b)
|
|||
(0x01 & stripe[k].stripe_u->stripe_r->sigma)) << 3;
|
||||
}
|
||||
|
||||
bit |= (bit_decode(coder->bitcoder, coder->sig2context[(15 * k_h + 5 * k_v + k_d) >> l]) << l);
|
||||
bit |= (mq_bit_decode(coder->bitcoder, coder->sig2context[(15 * k_h + 5 * k_v + k_d) >> l]) << l);
|
||||
|
||||
if(bit & bit_mask)
|
||||
{
|
||||
|
@ -2081,7 +2061,7 @@ cleanup_dec_pass(bwc_coder *const coder, const int8 b)
|
|||
xi_h = SIG2XI[xi_h];
|
||||
xi_v = SIG2XI[xi_v];
|
||||
|
||||
stripe[k].xi |= ((XI2CONT[(xi_h << 2) | xi_v][1] ^ bit_decode(coder->bitcoder, XI2CONT[(xi_h << 2) | xi_v][0])) << l);
|
||||
stripe[k].xi |= ((XI2CONT[(xi_h << 2) | xi_v][1] ^ mq_bit_decode(coder->bitcoder, XI2CONT[(xi_h << 2) | xi_v][0])) << l);
|
||||
|
||||
stripe[k].sigma |= bit_mask;
|
||||
}
|
||||
|
@ -2488,7 +2468,7 @@ encode_codeblock(bwc_field *const field, bwc_cblk_access *const access,
|
|||
! Initialize the entropy encoder used for the current com- !
|
||||
! pression run. !
|
||||
\*--------------------------------------------------------*/
|
||||
if(initialize_bit_encoder(&coder, CONTEXT_TOTAL))
|
||||
if(initialize_mq_encoder(&coder, CONTEXT_TOTAL))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -2516,7 +2496,7 @@ encode_codeblock(bwc_field *const field, bwc_cblk_access *const access,
|
|||
/*--------------------------------------------------------*\
|
||||
! Reset the bit encoder for the next coding pass. !
|
||||
\*--------------------------------------------------------*/
|
||||
if(bit_encoder_next_run(coder.bitcoder))
|
||||
if(mq_next_run(coder.bitcoder))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -2528,7 +2508,7 @@ encode_codeblock(bwc_field *const field, bwc_cblk_access *const access,
|
|||
! Evaluate the number of bytes generated so far by the bit !
|
||||
! encoder and increase the buffer size if necessary. !
|
||||
\*--------------------------------------------------------*/
|
||||
if(coder.buff_size <= (bit_coder_get_no_bytes(coder.bitcoder) + coder.buff_incr))
|
||||
if(coder.buff_size <= (mq_get_no_bytes(coder.bitcoder) + coder.buff_incr))
|
||||
{
|
||||
coder.buff_size += ((uint64)k >> 1) * coder.buff_incr;
|
||||
coder.compressed = realloc(coder.compressed, coder.buff_size * sizeof(uchar));
|
||||
|
@ -2539,7 +2519,7 @@ encode_codeblock(bwc_field *const field, bwc_cblk_access *const access,
|
|||
return;
|
||||
}
|
||||
|
||||
bit_coder_reset_ptr(coder.bitcoder, coder.compressed);
|
||||
mq_reset_ptr(coder.bitcoder, coder.compressed);
|
||||
}
|
||||
/*--------------------------------------------------------*\
|
||||
! If the error resilience flag is set, encode a segmark !
|
||||
|
@ -2559,7 +2539,7 @@ encode_codeblock(bwc_field *const field, bwc_cblk_access *const access,
|
|||
! Evalute the number of bytes generated by the bit encoder !
|
||||
! and increase the buffer size if necessary. !
|
||||
\*--------------------------------------------------------*/
|
||||
if(coder.buff_size <= (bit_coder_get_no_bytes(coder.bitcoder) + 16))
|
||||
if(coder.buff_size <= (mq_get_no_bytes(coder.bitcoder) + 16))
|
||||
{
|
||||
coder.buff_size += 16;
|
||||
coder.compressed = realloc(coder.compressed, coder.buff_size * sizeof(uchar));
|
||||
|
@ -2570,13 +2550,13 @@ encode_codeblock(bwc_field *const field, bwc_cblk_access *const access,
|
|||
return;
|
||||
}
|
||||
|
||||
bit_coder_reset_ptr(coder.bitcoder, coder.compressed);
|
||||
mq_reset_ptr(coder.bitcoder, coder.compressed);
|
||||
}
|
||||
/*--------------------------------------------------------*\
|
||||
! Flush the remaining bits in the byte buffer to the coder !
|
||||
! output and calculate the minimum truncation lengths. !
|
||||
\*--------------------------------------------------------*/
|
||||
bit_encoder_termination(coder.bitcoder);
|
||||
mq_termination(coder.bitcoder);
|
||||
|
||||
/*--------------------------------------------------------*\
|
||||
! Save the number of significant bitplanes, insignificant !
|
||||
|
@ -2598,12 +2578,12 @@ encode_codeblock(bwc_field *const field, bwc_cblk_access *const access,
|
|||
! Save the lengths of the coding passes in the encoded !
|
||||
! codeblock structure. !
|
||||
\*--------------------------------------------------------*/
|
||||
bit_coder_get_pass_lengths(coder.bitcoder, encoded_cblk);
|
||||
mq_get_pass_lengths(coder.bitcoder, encoded_cblk);
|
||||
|
||||
/*--------------------------------------------------------*\
|
||||
! Free the entropy encoder structure. !
|
||||
\*--------------------------------------------------------*/
|
||||
free_bit_encoder(&coder);
|
||||
free_mq_encoder(&coder);
|
||||
|
||||
/*--------------------------------------------------------*\
|
||||
! Calculate the slope values of the distortion/rate convex !
|
||||
|
@ -2771,7 +2751,7 @@ decode_codeblock(bwc_field *const field, bwc_cblk_access *const access,
|
|||
! Initialize the entropy encoder used for the current com- !
|
||||
! pression run. !
|
||||
\*--------------------------------------------------------*/
|
||||
if(initialize_bit_decoder(&coder, CONTEXT_TOTAL, encoded_cblk->L[encoded_cblk->Z - 1]))
|
||||
if(initialize_mq_decoder(&coder, CONTEXT_TOTAL, encoded_cblk->L[encoded_cblk->Z - 1]))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -2787,10 +2767,10 @@ decode_codeblock(bwc_field *const field, bwc_cblk_access *const access,
|
|||
decoding_pass[i](&coder, k);
|
||||
}
|
||||
|
||||
if((coder.erres) && (((bit_decode(coder.bitcoder, CONTEXT_UNI) << 3) |
|
||||
(bit_decode(coder.bitcoder, CONTEXT_UNI) << 2) |
|
||||
(bit_decode(coder.bitcoder, CONTEXT_UNI) << 1) |
|
||||
bit_decode(coder.bitcoder, CONTEXT_UNI)) != 0x0A))
|
||||
if((coder.erres) && (((mq_bit_decode(coder.bitcoder, CONTEXT_UNI) << 3) |
|
||||
(mq_bit_decode(coder.bitcoder, CONTEXT_UNI) << 2) |
|
||||
(mq_bit_decode(coder.bitcoder, CONTEXT_UNI) << 1) |
|
||||
mq_bit_decode(coder.bitcoder, CONTEXT_UNI)) != 0x0A))
|
||||
{
|
||||
goto break_out;
|
||||
}
|
||||
|
@ -2808,7 +2788,7 @@ decode_codeblock(bwc_field *const field, bwc_cblk_access *const access,
|
|||
/*--------------------------------------------------------*\
|
||||
! Free the entropy encoder structure. !
|
||||
\*--------------------------------------------------------*/
|
||||
free_bit_encoder(&coder);
|
||||
free_mq_encoder(&coder);
|
||||
}
|
||||
|
||||
/************************************************************************************************************\
|
||||
|
|
|
@ -1,76 +1,49 @@
|
|||
/*==================================================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| FILE NAME: t2.c ||
|
||||
|| ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| DESCRIPTION NEEDED. ||
|
||||
|| ||
|
||||
|| FILE REFERENCES: ||
|
||||
|| ---------------- ||
|
||||
|| ||
|
||||
|| Name I/O Description ||
|
||||
|| ---- --- ----------- ||
|
||||
|| none - - ||
|
||||
|| ||
|
||||
|| ||
|
||||
|| PRIVATE FUNCTIONS: ||
|
||||
|| ------------------ ||
|
||||
|| - encode_length ||
|
||||
|| - decode_length ||
|
||||
|| - create_packet ||
|
||||
|| - create_packets ||
|
||||
|| - create_quality_layer ||
|
||||
|| - create_quality_layers ||
|
||||
|| ||
|
||||
|| PUBLIC FUNCTIONS: ||
|
||||
|| ----------------- ||
|
||||
|| - t2_encode ||
|
||||
|| ||
|
||||
|| DEVELOPMENT HISTORY: ||
|
||||
|| -------------------- ||
|
||||
|| ||
|
||||
|| Date Author Change Id Release Description Of Change ||
|
||||
|| ---- ------ --------- ------- --------------------- ||
|
||||
|| - Patrick Vogler B87D120 V 0.1.0 source file created ||
|
||||
|| ||
|
||||
|| -------------------------------------------------------------------------------------------------------------------- ||
|
||||
|| ||
|
||||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|
||||
|| ||
|
||||
|| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ||
|
||||
|| following conditions are met: ||
|
||||
|| ||
|
||||
|| (1) Redistributions of source code must retain the above copyright notice, this list of conditions and ||
|
||||
|| the following disclaimer. ||
|
||||
|| ||
|
||||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions ||
|
||||
|| and the following disclaimer in the documentation and/or other materials provided with the ||
|
||||
|| distribution. ||
|
||||
|| ||
|
||||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ||
|
||||
|| INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ||
|
||||
|| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ||
|
||||
|| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ||
|
||||
|| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ||
|
||||
|| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE ||
|
||||
|| USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|
||||
|| ||
|
||||
\*==================================================================================================================================*/
|
||||
|
||||
/*================================================================================================*\
|
||||
|| ||
|
||||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|
||||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|
||||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|
||||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|
||||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|
||||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|
||||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|
||||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|
||||
|| /$$ \ $$ | $$ ||
|
||||
|| | $$$$$$/ | $$ ||
|
||||
|| \______/ |__/ ||
|
||||
|| ||
|
||||
|| DESCRIPTION: ||
|
||||
|| ------------ ||
|
||||
|| ||
|
||||
|| This file 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: ||
|
||||
|| ||
|
||||
|| (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. ||
|
||||
|| ||
|
||||
\*================================================================================================*/
|
||||
/************************************************************************************************************\
|
||||
|| _ _ _ ____ _ _ _ ___ ____ ||
|
||||
|| | |\ | | | | | | \ |___ ||
|
||||
|
|
|
@ -1,65 +1,57 @@
|
|||
#*====================================================================================================================*#
|
||||
#| |#
|
||||
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
|
||||
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
|
||||
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
|
||||
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
|
||||
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
|
||||
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
|
||||
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
|
||||
#| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |#
|
||||
#| /$$ \ $$ | $$ |#
|
||||
#| | $$$$$$/ | $$ |#
|
||||
#| \______/ |__/ |#
|
||||
#| DESCRIPTION: |#
|
||||
#| ------------ |#
|
||||
#| Defines the cmake script for the BigWhoop command line tool. |#
|
||||
#| |#
|
||||
#| |#
|
||||
#| DEVELOPMENT HISTORY: |#
|
||||
#| -------------------- |#
|
||||
#| |#
|
||||
#| Date Author Change Id Release Description Of Change |#
|
||||
#| ---- ------ --------- ------- --------------------- |#
|
||||
#| 30.08.2018 Patrick Vogler B87D120 V 0.1.0 cmake file created |#
|
||||
#| 15.10.2021 Patrick Vogler B880CA2 V 0.1.1 Added install rules |#
|
||||
#| |#
|
||||
#| |#
|
||||
#| ------------------------------------------------------------------------------------------------------ |#
|
||||
#| |#
|
||||
#| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart |#
|
||||
#| |#
|
||||
#| Redistribution and use in source and binary forms, with or without modification, are permitted |#
|
||||
#| provided that the following conditions are met: |#
|
||||
#| |#
|
||||
#| (1) Redistributions of source code must retain the above copyright notice, this list of |#
|
||||
#| conditions and the following disclaimer. |#
|
||||
#| |#
|
||||
#| (2) Redistributions in binary form must reproduce the above copyright notice, this list |#
|
||||
#| of conditions and the following disclaimer in the documentation and/or other materials |#
|
||||
#| provided with the distribution. |#
|
||||
#| |#
|
||||
#| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED |#
|
||||
#| WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |#
|
||||
#| PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR |#
|
||||
#| ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |#
|
||||
#| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |#
|
||||
#| INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |#
|
||||
#| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |#
|
||||
#| ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |#
|
||||
#| |#
|
||||
#*====================================================================================================================*#
|
||||
#*--------------------------------------------------------*#
|
||||
#*================================================================================================*#
|
||||
#| |#
|
||||
#| /$$$$$$$ /$$ /$$ /$$ /$$ |#
|
||||
#| | $$__ $$|__/ | $$ /$ | $$| $$ |#
|
||||
#| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ |#
|
||||
#| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ |#
|
||||
#| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ |#
|
||||
#| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ |#
|
||||
#| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ |#
|
||||
#| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ |#
|
||||
#| /$$ \ $$ | $$ |#
|
||||
#| | $$$$$$/ | $$ |#
|
||||
#| \______/ |__/ |#
|
||||
#| |#
|
||||
#| DESCRIPTION: |#
|
||||
#| ------------ |#
|
||||
#| |#
|
||||
#| Defines the cmake script for the BigWhoop command line tool. |#
|
||||
#| |#
|
||||
#| -------------------------------------------------------------------------------------------- |#
|
||||
#| 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. |#
|
||||
#| |#
|
||||
#*================================================================================================*#
|
||||
#----------------------------------------------------------#
|
||||
# Add the bwc command line utility and get hash tool to #
|
||||
# the current project using the utility source files. #
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
add_executable(bwccmd bwccmdl.c
|
||||
../interfaces/reader/eas3.c)
|
||||
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
# Set the target compile definition for the requested file #
|
||||
# format support. #
|
||||
#*--------------------------------------------------------*#
|
||||
#----------------------------------------------------------#
|
||||
MESSAGE(STATUS "EAS3 file format support: ${BUILD_EAS3}")
|
||||
|
||||
if(${BUILD_EAS3})
|
||||
|
@ -70,24 +62,24 @@ 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)
|
|
@ -2845,9 +2845,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);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------*\
|
||||
|
@ -2856,7 +2856,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]);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------*\
|
||||
|
|
Loading…
Reference in a new issue