From e3dcc28902b649c2572552f5ab22d996695b0da5 Mon Sep 17 00:00:00 2001 From: Patrick Vogler Date: Thu, 22 Feb 2024 17:20:38 +0100 Subject: [PATCH] Cleanup of constant and macro definitions. --- include/library/private/constants.h | 285 +++++----------------------- include/library/private/macros.h | 61 +++++- include/library/private/tier1.h | 33 ++-- public_header.py | 4 +- 4 files changed, 120 insertions(+), 263 deletions(-) diff --git a/include/library/private/constants.h b/include/library/private/constants.h index fc81586..7cb1b56 100755 --- a/include/library/private/constants.h +++ b/include/library/private/constants.h @@ -48,252 +48,59 @@ ! DESCRIPTION: ! ! ------------ ! ! ! - ! These constants are used to identify the spatial and temporal dimensions. ! + ! These constants are used to signal spatial or temporal the wavelet filter. ! ! ! \*----------------------------------------------------------------------------------------------*/ - #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 codestream markers used to create the embedded codestream. ! - ! ! - ! CONSTANTS: ! - ! ----------- ! - ! Constant Description ! - ! -------- ----------- ! - ! SOC - Start of code-stream ! - ! SGI - Global data-set information ! - ! SGC - Global control parameters ! - ! SAX - Auxiliary data-set information ! - ! TLM - Packet lengths: main header ! - ! PLM - Packet lengths: tile-part ! - ! PPM - Quantization default ! - ! COM - Comment ! - ! EOH - End of header ! - ! PLT - Packed packet headers: main header ! - ! PPT - Packed packet headers: tile-part ! - ! SOT - Start of tile ! - ! SOP - Start of packet ! - ! EPH - End of packet header ! - ! SOD - Start of data ! - ! EOC - End of code-stream ! - ! ! - ! DEVELOPMENT HISTORY: ! - ! -------------------- ! - ! ! - ! Date Author Change Id Release Description Of Change ! - ! ---- ------ --------- ------- --------------------- ! - ! 01.12.2017 Patrick Vogler B87D120 V 0.1.0 Constants created ! - \*----------------------------------------------------------------------------------------------------------*/ - #define SOC 0xFF50 - #define SGI 0xFF51 - #define SGC 0xFF52 - #define SAX 0xFF53 - #define TLM 0xFF54 - #define PLM 0xFF55 - #define PPM 0xFF56 - #define COM 0xFF57 - #define EOH 0xFF58 - #define PLT 0xFF60 - #define PPT 0xFF61 - #define SOT 0xFF90 - #define SOP 0xFF91 - #define EPH 0xFF92 - #define SOD 0xFF93 - #define EOC 0xFFFF - - /*----------------------------------------------------------------------------------------------------------*\ - ! DESCRIPTION: ! - ! ------------ ! - ! ! - ! These Constants are used for codestream parsing. ! - ! ! - ! CONSTANTS: ! - ! ----------- ! - ! Constant Description ! - ! -------- ----------- ! - ! CODESTREAM_OK No errors detectet in Codestream ! - ! CODESTREAM_ERROR Error detectet in Codestream ! - ! CODESTREAM_SGI_READ Global data-set information read ! - ! CODESTREAM_SGC_READ Global control parameters read ! - ! ! - ! DEVELOPMENT HISTORY: ! - ! -------------------- ! - ! ! - ! Date Author Change Id Release Description Of Change ! - ! ---- ------ --------- ------- --------------------- ! - ! 01.08.2019 Patrick Vogler B87D120 V 0.1.0 Constants created ! - \*----------------------------------------------------------------------------------------------------------*/ - #define CODESTREAM_OK 0x00 - #define CODESTREAM_ERROR 0x80 - #define CODESTREAM_SGI_READ 0x01 - #define CODESTREAM_SGC_READ 0x02 - #define CODESTREAM_SAX_READ 0x04 - #define CODESTREAM_COM_READ 0x08 - - /*----------------------------------------------------------------------------------------------------------*\ - ! ENUM NAME: bwc_dwt_filter ! - ! ----------- ! - ! ! - ! DESCRIPTION: ! - ! ------------ ! - ! ! - ! These constants describe the wavelet filter used during the transform stage. ! - ! ! - ! PARAMETERS: ! - ! ----------- ! - ! Constant Description ! - ! -------- ----------- ! - ! bwc_dwt_9_7 - Cohen Daubechies Feauveau 9/7 Wavelet ! - ! bwc_dwt_5_3 - LeGall 5/3 Wavelet ! - ! bwc_dwt_haar - Haar Wavelet ! - ! ! - ! DEVELOPMENT HISTORY: ! - ! -------------------- ! - ! ! - ! Date Author Change Id Release Description Of Change ! - ! ---- ------ --------- ------- --------------------- ! - ! 07.12.2017 Patrick Vogler B87D120 V 0.1.0 Enum created ! - ! ! - \*----------------------------------------------------------------------------------------------------------*/ - typedef enum{ - bwc_dwt_9_7, - bwc_dwt_5_3, - bwc_dwt_haar + typedef enum + { + bwc_dwt_9_7, // Cohen Daubechies Feauveau 9/7 Wavelet + bwc_dwt_5_3, // LeGall 5/3 Wavelet + bwc_dwt_haar // Haar Wavelet } bwc_dwt_filter; - /*----------------------------------------------------------------------------------------------------------*\ - ! ENUM NAME: bwc_prog_ord ! - ! ----------- ! - ! ! - ! DESCRIPTION: ! - ! ------------ ! - ! ! - ! These constants describe the progression order used to pack the codestream. ! - ! The organisation of the codesstream is carried out according to the following 5 cases. ! - ! ! - ! 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 + /*----------------------------------------------------------------------------------------------*\ + ! ! + ! DESCRIPTION: ! + ! ------------ ! + ! ! + ! These constants are used to signal the packing order of the codestream. ! + ! ! + \*----------------------------------------------------------------------------------------------*/ + typedef enum + { + bwc_prog_LRCP, // Layer / Resolution / Parameter / Packet + bwc_prog_RLCP, // Resolution / Layer / Parameter / Packet + bwc_prog_RPCL, // Resolution / Packet / Parameter / Layer + bwc_prog_PCRL, // Packet / Parameter / Resolution / Layer + bwc_prog_CPRL // Parameter / Packet / Resolution / Layer } bwc_prog_ord; - /*----------------------------------------------------------------------------------------------------------*\ - ! ENUM NAME: bwc_quant_st ! - ! ----------- ! - ! ! - ! DESCRIPTION: ! - ! ------------ ! - ! DESCRIPTION NEEDED ! - ! ! - ! PARAMETERS: ! - ! ----------- ! - ! Constant Description ! - ! -------- ----------- ! - ! - - ! - ! ! - ! 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, + /*----------------------------------------------------------------------------------------------*\ + ! ! + ! DESCRIPTION: ! + ! ------------ ! + ! ! + ! These constants are used to signal the quantisation style during ! + ! (de)coompression. ! + ! ! + \*----------------------------------------------------------------------------------------------*/ + typedef enum + { + bwc_qt_none, // No quantization + bwc_qt_derived, // Derrived according to Taubman/Marcellin } bwc_quant_st; - /*----------------------------------------------------------------------------------------------------------*\ - ! ENUM NAME: bwc_tile_instr ! - ! ----------- ! - ! ! - ! DESCRIPTION: ! - ! ------------ ! - ! DESCRIPTION NEEDED ! - ! ! - ! PARAMETERS: ! - ! ----------- ! - ! Constant Description ! - ! -------- ----------- ! - ! - - ! - ! ! - ! 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, + /*----------------------------------------------------------------------------------------------*\ + ! ! + ! DESCRIPTION: ! + ! ------------ ! + ! ! + ! These constants are used to signal dataset tiling by the function caller. ! + ! ! + \*----------------------------------------------------------------------------------------------*/ + typedef enum + { + bwc_tile_sizeof, // Tiling defined by size of one tile + bwc_tile_numbof, // Tiling defined by the number of tiles } bwc_tile_instr; #endif \ No newline at end of file diff --git a/include/library/private/macros.h b/include/library/private/macros.h index 9d0a9a3..855d567 100755 --- a/include/library/private/macros.h +++ b/include/library/private/macros.h @@ -43,6 +43,61 @@ \*================================================================================================*/ #ifndef BWC_MACROSS_H #define BWC_MACROSS_H + /*----------------------------------------------------------------------------------------------*\ + ! ! + ! DESCRIPTION: ! + ! ------------ ! + ! ! + ! These constants are used to identify the spatial and temporal dimensions. ! + ! ! + \*----------------------------------------------------------------------------------------------*/ + #define DIM_X 1 // 1st. spacial direction + #define DIM_Y 2 // 2nd. spacial direction + #define DIM_Z 4 // 3rd. spacial direction + #define DIM_TS 8 // temporal direction + #define DIM_ALL 15 // all dimensions + + /*----------------------------------------------------------------------------------------------*\ + ! ! + ! DESCRIPTION: ! + ! ------------ ! + ! ! + ! These Constants define codestream markers used to create the embedded codestream. ! + ! ! + \*----------------------------------------------------------------------------------------------*/ + #define SOC 0xFF50 // Start of codestream + #define SGI 0xFF51 // Global data-set information + #define SGC 0xFF52 // Global control parameters + #define SAX 0xFF53 // Auxiliary data-set information + #define TLM 0xFF54 // Packet lengths: main header + #define PLM 0xFF55 // Packet lengths: tile-part + #define PPM 0xFF56 // Quantization default + #define COM 0xFF57 // Comment + #define EOH 0xFF58 // End of header + #define PLT 0xFF60 // Packed packet headers: main header + #define PPT 0xFF61 // Packed packet headers: tile-part + #define SOT 0xFF90 // Start of tile + #define SOP 0xFF91 // Start of packet + #define EPH 0xFF92 // End of packet header + #define SOD 0xFF93 // Start of data + #define EOC 0xFFFF // End of code-stream + + + /*----------------------------------------------------------------------------------------------*\ + ! ! + ! DESCRIPTION: ! + ! ------------ ! + ! ! + ! These macros define flags used for codestream parsing. ! + ! ! + \*----------------------------------------------------------------------------------------------*/ + #define CODESTREAM_OK 0x00 // No errors detected in Codestream + #define CODESTREAM_ERROR 0x80 // Error detexted in Codestream + #define CODESTREAM_SGI_READ 0x01 // Global data-set information read + #define CODESTREAM_SGC_READ 0x02 // Global control parameters read + #define CODESTREAM_SAX_READ 0x08 // Auxiliary information block read + #define CODESTREAM_COM_READ 0x10 // Comment block read + /*----------------------------------------------------------------------------------------------*\ ! ! ! DESCRIPTION: ! @@ -76,7 +131,7 @@ "| ERROR: Out of memory |\n"\ "o##########################################################o\n" - #define CSERROR "o##########################################################o\n"\ - "| ERROR: Invalid Codestream |\n"\ - "o##########################################################o\n" + #define CSERROR "o##########################################################o\n"\ + "| ERROR: Invalid Codestream |\n"\ + "o##########################################################o\n" #endif \ No newline at end of file diff --git a/include/library/private/tier1.h b/include/library/private/tier1.h index 9ce8a36..13f60eb 100755 --- a/include/library/private/tier1.h +++ b/include/library/private/tier1.h @@ -150,24 +150,19 @@ uchar *compressed; // Compressed data chunck. } bwc_coder; - /************************************************************************************************************\ - || ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ || - || |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ || - || | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] || - || || - \************************************************************************************************************/ - /*----------------------------------------------------------------------------------------------------------*\ - ! TYPE NAME: Template ! - ! ----------- ! - ! ! - ! DESCRIPTION: ! - ! ------------ ! - ! DESCRIPTION NEEDED ! - ! ! - \*----------------------------------------------------------------------------------------------------------*/ - uchar - t1_encode(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const parameter); + /************************************************************************************************\ + || ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ || + || |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ || + || | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] || + || || + \************************************************************************************************/ + uchar t1_encode (bwc_field *const field, + bwc_tile *const tile, + bwc_parameter *const parameter); + //==========|==========================|======================|======|=======|==================== + uchar t1_decode (bwc_field *const field, + bwc_tile *const tile, + bwc_parameter *const parameter); + - uchar - t1_decode(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const parameter); #endif \ No newline at end of file diff --git a/public_header.py b/public_header.py index 7f41500..595ebd8 100644 --- a/public_header.py +++ b/public_header.py @@ -330,7 +330,7 @@ public_header.write("\n" + ubox + tab + sbox + lspaces * " " + "___ _ _ ___ _ tab + sbox + (text_width - 2*len(sbox) - len(tab)) * " " + "||\n" + lbox) public_header.write(tab + "#ifdef __cplusplus\n" + - tab + "extern \"C\" {\n" + + tab + tab + "extern \"C\" {\n" + tab + "#endif\n\n") files = os.listdir("include/library/private") @@ -369,7 +369,7 @@ for file in files: f.close public_header.write("\n" + tab + "#ifdef __cplusplus\n" + - tab + "}\n" + + tab + tab + "}\n" + tab + "#endif\n") public_header.write("#endif")