Here I'll touch a bit on the wavelet filters used in this image compression algorithm and then I'll summarize the way the filters are implemented.
These filters are crucial for achieving efficient lossless and near-lossless compression. The filters are non-linear approximations to linear high-pass/low-pass filter pairs, and the nonlinearity arises from the use of roundoff operations.
The ICER algorithm should allow a user to utilize one of seven reversible integer wavelet transforms. These transforms produce integer outputs and are exactly invertible when the input consists of integers. The wavelet transforms are computed in essentially the same way but use different choices of filter coefficients.
ICER provides seven types of filters, labeled as Filter A through F, and an additional filter called Filter Q. Filter A is essentially the same as the "Reversible Two-Six" transform, and the others are from the referenced literature.
For each filter type, there are four filter parameters: α−1, α0, α1, and β. These parameters determine the behavior of the high-pass filter output.
The table below lists the filter parameters for each filter type:
Table 1
| Filter | α−1 | α0 | α1 | β |
|---|---|---|---|---|
| A | 0 | 1/4 | 1/4 | 0 |
| B | 0 | 2/8 | 3/8 | 2/8 |
| C | -1/16 | 4/16 | 8/16 | 6/16 |
| D | 0 | 4/16 | 5/16 | 2/16 |
| E | 0 | 3/16 | 8/16 | 6/16 |
| F | 0 | 3/16 | 9/16 | 8/16 |
| Q | 0 | 1/4 | 1/4 | 1/4 |
The Filters sub-directory contains the implementations of the low-pass and high-pass filters used in the wavelet transformation process utilzing the parameters described in table 1.
- Low-Pass Filter (LowPassFilters.py)
The low-pass filter is responsible for smoothing the input data and preserving the low-frequency components. It takes an input data array and computes the output values as follows:
-
For even-length data, it computes the first (N / 2) - 1 outputs using the average of the current data point and the next data point.
-
For odd-length data, it computes the output values as for even-length data and sets the last output value as the last data point.
This follows the equation:
- High-Pass Filter (HighPassFilters.py)
The high-pass filter is responsible for detecting the high-frequency components or rapid changes in the input data. It takes an input data array, the low-pass filter outputs, and filter parameters. The filter computes the following:
- d(n) values, which represent the difference between adjacent data points.
- r(n) values, which represent the difference between adjacent low-pass filter outputs.
- High-pass filter outputs, which are computed based on the filter parameters and the computed d(n) and r(n) values.
The high-pass filter output computation varies depending on the current index value and the filter parameters. The implemented conditions cover different edge cases, such as the first and last output values and specific parameter configurations.
This follows the equation: