This archive contains the implementation of RDLS-DWT and SS-DWT in JPEG 2000 (RDLS-SS-DWT v. 0.9), which was used in a research described in [1] and [2]. This software is intended for research purposes only; it is provided "as is"; author makes no warranty of any kind, either express or implied, with respect to this software. The RDLS-SS-DWT v. 0.9 is based on the IRIS-JP3D JPEG 2000 part 10 (JP3D) reference software developed by Tim Bruylants from Vrije Universiteit Brussel (VUB) and the Interdisciplinary Institute for BroadBand Technology (IBBT), version 1.1.1 (http://www.irissoftware.be/, see [3]). Since using IRIS-JP3D v. 1.1.1 requires acquiring a licence from its Authors (free for research purposes), the RDLS-SS-DWT v. 0.9 is distributed as a patch to the IRIS-JP3D v. 1.1.1. (c) 2015, 2016 Roman Starosolski The archive jp3d_1_1_1.rdls_ss.zip contains: -jp3d_1_1_1.rdls_ss.patch - a patch (unified output format) to IRIS-JP3D v. 1.1.1 source .c and .h files, -RS_vol_ops.c, RS_vol_ops.h, strtok_s.h - additional files needed to build RDLS-SS-DWT v. 0.9; strtok_s.h uses public domain strtok_r() function code by Charlie Gordon, from comp.lang.c 9/14/2007 -readme.txt - this file, -RS__transfpar.dat.* - sample text configuration files for RDLS-SS-DWT (see comments inside). -gcit.bat - batch file for GCC compilation of RDLS-SS-DWT, -test.bat - batch for testing compiled RDLS-SS-DWT and included configuration files. To obtain RDLS-SS-DWT unpack jp3d_1_1_1.rdls_ss.zip to the directory containing IRIS-JP3D v. 1.1.1 sources and apply the patch. E.g., using the GNU patch v. 2.5.9 (http://gnuwin32.sourceforge.net/packages/patch.htm) execute the following command: patch.exe -i jp3d_1_1_1.rdls_ss.patch. Description RDLS and SS were introduced to IRIS-JP3D v. 1.1.1 by altering its fdwt/idwt modules; other files were changed only in order to enable compiling the sources using GCC/VS. RDLS-SS-DWT configuration (subband filters to apply, steps to skip, additional operations to perform during compression/decompression) must be defined beforehand in configuration file RS__transfpar.dat palced in the directory in where the RDLS-SS-DWT is executed. Internal naming of denoising filters (e.g. in function names and comments in RS_vol_ops.c) is different to one used in [1, 2] (see below), having that in mind you may consult the commented sources for for additional informations. RDLS-SS-DWT is internally controlled by a few variables and 2 arrays: int fdwtOutputSave //save the FDWT output data as FDWTtransformed.raw, FDWTtransformed.descr, FDWTtransformed.PGM (for 3D processing save the first slice as PGM) ? int fdwtCalcEntropy //save the FDWT output data memoryless entropy of all subbands in file FDWTtransformed.H0 (see [1])? Implemented only for 2D processing int fdwtEntropyPredictor //number of predictor to apply before computing entropy: 0-none, 1-AVG (obsolete), 2-MED (obsolete) int idwtInputSave //save the IDWT input data as IDWTuntransformed.raw, IDWTuntransformed.descr, IDWTuntransformed.PGM ? int maxLevelDenoise //max transf. level at which denoising is performed, -1 for no denoising at all, levels are numbered from 0, if level>maxLevel then denoising is called, but uses NOP method int tranfSubbandDo[MAX_LEVELS][15] // perform or skip the FDWT/IDWT step for specific subband at specific level // MAX_LEVELS is the supported number of decomposition levels (5), level numbers start from 0, // [level][subbandId] == 1 perform DWT lifting step (e.g., just prediction or just update) resulting in creation of given subband, == 0 skip this step, // by default initialized to 1's, and changed based on transfParams, but may be set from RS__transfpar.dat // if the 2 complementary 1d DWT steps are skipped (e.g., 3 and 5, 7 and 11), reordering of coefficients is skipped as well in dwt_forward/inv_transform // no subbandId==0, any val. is ok., (1-14) subbands in 3D processing, (3,5,7,8,11,12) - subbands used in 2D mode. // subbandIds: // 1: H subband computed using 1D-DWT in Z direction from entire volume (3D) // 2: L subband computed using 1D-DWT in Z direction from entire volume (3D) // 3: H subband computed using 1D-DWT in Y direction from samples from subband of subbandId 2 (3D), H subband in Fig. 1B in [1] (2D) // 4: H subband computed using 1D-DWT in Y direction from samples from subband of subbandId 1 (3D) // 5: L subband computed using 1D-DWT in Y direction from samples from subband of subbandId 2 (3D), L subband in Fig. 1B in [1] (2D) // 6: L subband computed using 1D-DWT in Y direction from samples from subband of subbandId 1 (3D) // 7: H subband computed using 1D-DWT in X direction from samples from subband of subbandId 5 (3D), HL subband in Fig. 1C in [1] (2D) // 8: H subband computed using 1D-DWT in X direction from samples from subband of subbandId 3 (3D), HH subband in Fig. 1C in [1] (2D) // 9: H subband computed using 1D-DWT in X direction from samples from subband of subbandId 6 (3D), // 10: H subband computed using 1D-DWT in X direction from samples from subband of subbandId 4 (3D), // 11: L subband computed using 1D-DWT in X direction from samples from subband of subbandId 5 (3D), LL subband in Fig. 1C in [1] (2D) // 12: L subband computed using 1D-DWT in X direction from samples from subband of subbandId 3 (3D), LH subband in Fig. 1C in [1] (2D) // 13: L subband computed using 1D-DWT in X direction from samples from subband of subbandId 6 (3D), // 14: L subband computed using 1D-DWT in X direction from samples from subband of subbandId 4 (3D), // assuming that no SS is employed, subbands of subbandId 1-6 are in given decomposition level further transformed and not available as the final result of this decomposition level int transfParams[MAX_LEVELS][15][7] // denoising filters (or step skipping modes) for given level and subband, and parameters of denoising filters, used by RS_vol_subband_denoise // transfParams array indexes are: [level][subband][param], levels are numbered from 0, subbands from 1 (so index 0 is ignored), // the 7 parameters for given level an subband, are: // 0-subbandId (must match row number) // 1-tt (internal name: transform type) denoising filter / step skipping mode // 2-6 denoising filter parameters // parameter 1 and 2-6 allowed values: // tt=0 - NOP (None in [1]) no denoising or skipping, which results in regular DWT lifting step, 2-6 ignore // tt=1 - Smoothing filter (see [1]), 2-rx (window width is 2rx+1), 3-ry (window height is 2ry+1), 4-rz (window depth is 2rz+1), 5-window center point weight, 6-weight of each not-center window point // tt=2 - Median filter (see [1]) 2-rx, 3-ry, 4-rz, 5-6 ignore // tt=3 - RCRS-1 filter (see [1]) (internally denoted: RCRS) 2-rx, 3-ry, 4-rz, 5-6 ignore // tt=4 - obsolete filter (internally denoted: RCRS2) 2-rx, 3-ry, 4-rz, 5-6 ignore // tt=5 - RCRS-2 filter (see [1]) (internally denoted: RCRS3) 2-rx, 3-ry, 4-rz, 5-6 ignore // tt=6 - None in [2] - filter returning 0 for all samples, for skipping the lifting step without affecting the reorder step, used to test additional variants of SS-DWT BH (see [2]), 2-6 ignore // tt=100 - None in [2] - skip the step and if complementary step is skipped then the reorder will be skipped as well, basic mode for the SS-DWT, see [2] and bottom of initialize_RS_vol_ops // tt=101 - skip the step and its complementary step and reorder, used to test additional variants of SS-DWT BH (see [2]) and bottom of initialize_RS_vol_ops Configuration for RDLS-SS-DWT is given in text file RS__transfpar.dat, below commands are recognized: 1001 // read maxLevelDenoise, should be followed by an intreger, -1 disables RDLS and SS 1002 // read fdwtOutputSave, should be followed by 0 or 1 1003 // read idwtInputSave, should be followed by 0 or 1 1004 // read fdwtCalcEntropy, should be followed by 0 or 1 1005 // read fdwtEntropyPredictor, should be followed by 0, 1, or 2 1010 // read transfParams, should be followed by MAX_LEVELSx15x7 integers 1011 // read 1st page of transfParams (parameters for DWT level 0), copy it to all other pages, should be followed by 15x7 integers 1012 // read given number N of transfParams pages, should be followed by an integer (N) and Nx15x7 integers 1020 // read tranfSubbandDo, should be followed by MAX_LEVELSx15 integers (allowed values 0 and 1) 1021 // read 1st row of tranfSubbandDo (parameters for DWT level 0), copy it to others 1022 // read given number of tranfSubbandDo rows 9999 // all done, comments etc. in RS__transfpar.dat may be placed after this command Remarks - RDLS-SS-DWT v. 0.9 was tested in various Windows enviroments using 32-bit executables compiled using GCC-MinGW32 v. 4.8.1 and Microsoft VisualStudio 12 and 14, - RDLS-DWT and SS-DWT are implemented for JPEG2000 and JP3D, but only the 2D mode was thoroughly tested (so far), - RDLS-DWT and SS-DWT are implemented and tested for 5x3 kernel integer transforms, - Decomposition levels 0..5 are supported, the limit may be easily increased (but see below), thoroughly tested were 0 and 3-level decomposition, - When using higher levels of decomposition, RDLS-SS-DWT sometimes triggers assertion: "(hlast >= 0) && (hlast < (MAX_POSSIBLE_PASSES + 1)), file t1.c, line 265". In some cases swithing testing assertion off helps (compressed data is correctly decompressed). This problem also happenes in unmodified IRIS-JP3D v. 1.1.1, - The entire image was always compressed as a single tile, - RDLS-SS-DWT v. 0.9 was not optimized and should not be used for testing of speed; actually, the fdwt/idwt modules of IRIS-JP3D v. 1.1.1 were de-optimized prior to introducing RDLS and SS to them, - feel free to mail me (rstarosolski@polsl.pl, rstaros@gmail.com) in case of any questions or problems considering this software. References [1] R. Starosolski, “Application of reversible denoising and lifting steps to DWT in lossless JPEG 2000 for improved bitrates,” Signal Processing: Image Communication, Vol. 39, Part A, pp. 249-63, http://dx.doi.org/10.1016/j.image.2015.09.013, 2015. [2] R. Starosolski, “Skipping selected steps of DWT computation in lossless JPEG 2000 for improved bitrates,” submitted. [3] T. Bruylants, A. Munteanu, P. Schelkens, “Wavelet based volumetric medical image compression,” Signal Processing: Image Communication, vol. 31, pp. 112-133, DOI:10.1016/j.image.2014.12.007, 2015.