Abstract
Discrete cosine and sine transforms closely approximate the Karhunen–Loeve transform for first-order Markov stationary signals with high and low correlation coefficients, respectively. Discrete sinusoidal transforms can be used in data compression, digital filtering, spectral analysis and pattern recognition. Short-time transforms based on discrete sinusoidal transforms are suitable for the adaptive processing and time–frequency analysis of quasi-stationary data. The generalized sliding discrete transform is a type of short-time transform, that is, a fixed-length windowed transform that slides over a signal with an arbitrary integer step. In this paper, eight fast algorithms for calculating various sliding sinusoidal transforms based on a generalized solution of a second-order linear nonhomogeneous difference equation and pruned discrete sine transforms are proposed. The performances of the algorithms in terms of computational complexity and execution time were compared with those of recursive sliding and fast discrete sinusoidal algorithms. The low complexity of the proposed algorithms resulted in significant time savings.
Keywords:
short-time transform; discrete cosine transform; discrete sine transform sliding algorithm; signal processing MSC:
42A32; 65T50
1. Introduction
Discrete cosine transform (DCT) and discrete sine transform (DST) are two of the most common unitary transforms in signal processing due to their close approximation to the Karhunen–Loeve transform (KLT) [1]. For signals with a correlation coefficient close to one, DCT provides a better approximation of KLT than DST, whereas DST is closer to KLT when the correlation coefficient is less than 0.5. Because KLT consists of eigenvectors of the covariance matrix of data, there is no single unique transform for all random processes, and there are no fast algorithms. In contrast, DCT and DST are data-independent, and many fast algorithms have been proposed.
Discrete sinusoidal transforms were originally introduced to process long-term stationary data [2]. They have found widespread application in various forms of signal processing such as data coding [3], adaptive digital filtering [4], image enhancement [5], interpolation [6,7]. Short-time signal processing [8] is an appropriate technique for time–frequency analyses and processing nonstationary data, such as ECG signal processing [9], spectral analysis and speech processing [10], adaptive linear filtering [5,11], radar emitter recognition [12], spectral analysis of biological signals [13], heart sound classification [14], and time–frequency analyses of supply voltage systems [15]. The hopping discrete transform [16,17,18] is a time series of equidistant windowed signal transforms. The generalized sliding discrete transform is a type of short-time transform in which a fixed-length windowed transform slides over a signal with arbitrary integer steps. In this case, the window signal is constantly updated with new samples, and the old samples are discarded. To obtain an acceptable spectral resolution, the window size must be such that the signal in the window can be considered approximately stationary. DCT and DST are important unitary transforms for the spectral analysis of time-varying signals. Because the computation of discrete sinusoidal transforms in a window sliding over a signal with one sample step is computationally expensive, fast algorithms have been proposed to compute eight types of transforms using recursive equations [19,20].
When the signal spectrum changes slowly, the window can move more than one sample at a time to speed up the spectral analysis. To quickly calculate the DCT in a window moving with small integer steps, a recursive sliding algorithm was proposed [21]. Recursive equations and fast algorithms have been proposed for calculating various types of generalized sliding DCTs [22] that can be turned as a trade-off between hardware consumption and performance.
Four types of DCT and four types of DST were classified [23]. This paper proposes eight fast algorithms for calculating sliding discrete sinusoidal transforms based on the derived recursive equations and fast-pruned DSTs. The contribution of this work is as follows:
- A generalized solution of a second-order linear nonhomogeneous difference equation is obtained using the unilateral z-transform.
- Based on the generalized solution, eight generalized sliding sinusoidal transforms are proposed.
- Fast algorithms have been proposed for computing generalized sliding sinusoidal transforms. The algorithms are based on the derived recursive equations and fast-pruned DSTs.
- The performance of the proposed algorithms in terms of computational complexity and execution time is compared with those of recursive sliding and fast sinusoidal algorithms.
The remainder of this paper is organized as follows. Section 2 introduces the notation and recalls the sliding discrete sinusoidal transforms. A generalized solution of a second-order linear nonhomogeneous difference equation and generalized sliding sinusoidal transforms are presented in Section 2. The design of the fast algorithms is presented in Section 3. In Section 4, the performances of the proposed, recursive sliding and well-known fast discrete sinusoidal algorithms with respect to computational complexity and execution time are presented and discussed. Section 5 summarizes our findings.
2. Generalized Sliding Discrete Sinusoidal Transforms
2.1. Sliding Discrete Sinusoidal Transforms
Let us recall the definition of sliding discrete sinusoidal transforms [20] using the following notation: , , where N is the transform order, and .
The sliding cosine transforms (SCT) of types I, II, III, and IV can be defined as
where is the input signal; and are integers; for SCT-I, the signal window size is , and for other cosine transforms the window size is ; for SCT-I, the transform coefficients around time are , whereas for other cosine transforms the coefficients are .
The sliding sine transforms (SST) of types I, II, III, and IV are given as
where is the input signal; and are integers; for SST-I, the signal window size is , and for other sine transforms the window size is ; for SST-I, the transform coefficients around time are , whereas for other sine transforms the coefficients are .
The recursive relationships between three consecutive spectra for all sliding sinusoidal transforms are completely determined by a second-order linear nonhomogeneous difference equation, as follows [20]:
The parameters and for all sliding transforms are listed in Table 1. The parameter for all transforms is equal to one. Note that, for a fixed , Equation (9) is a liner constant-coefficient difference equation. Next, we determine a generalized solution to this equation.
Table 1.
Parameters of recursive equations for sliding sinusoidal transforms.
2.2. Generalized Solution of Second-Order Linear Nonhomogeneous Difference Equation
The second-order constant-coefficient difference equation is given as follows:
where , is a given real sequence, k is integer, and . The objective is to find a generalized solution to Equation (2) with the initial values , where K is an integer, and . To solve the problem, we first find the solution of Equation (10), assuming that the initial values are given. The unilateral z-transform [8] is used to analyze casual systems (inputs are specified for ) described by linear constant-coefficient difference equations with prescribed initial conditions. The bilateral and unilateral z-transforms differ significantly in their time-shifting properties. By applying the unilateral z-transform and using its shifting property, the equation can be written as
where are the z-transforms of , respectively. Note that when solving the equation using the unilateral z-transform, the initial values are already considered. To simplify the inverse z-transform, we define the following rational function:
where are the roots of the denominator, and .
Next, Equation (11) is rewritten as
can be represented by expanding into partial fractions as follows:
According to Table 15 of [8], the inverse z-transform can be calculated as
Considering that for , and using the shifting and convolution properties (see Table 16 of [8]), the solution of the difference equation given in Equation (2) has the form
Using Equations (12), (15) and (16) can be rewritten as
Now, suppose that are given; then, can be expressed from (17) as follows:
Finally, substituting into Equation (17) and considering that , one can arrive at a generalized solution of the problem as follows:
We are interested in the relationship between three equidistant values of the function: , and . This simplifies the equation:
2.3. Recursive Equations for Generalized Sliding Sinusoidal Transforms
Sliding sinusoidal transforms based on the recursive Equation (20) are referred to as generalized sliding discrete sinusoidal transforms. The transforms are computed in a window sliding over the signal with an integer step . The parameters for all generalized sliding sinusoidal transforms are listed in Table 2.
Table 2.
Parameters for generalized sliding sinusoidal transforms.
It can be seen that the parameters are described by the same equation with different arguments, that is, . Therefore, by substituting into Equation (20), we can obtain a second-order recursive equation common to all generalized sliding sinusoidal transforms as follows:
where and .
From Equation (21), one can obtain recursive equations for a generalized SCT of types I, II, III and IV, respectively, as
Similarly, recursive equations can be derived for a generalized SST of types I, II, III and IV, respectively, as
Next, recursive Equations (22)–(25) are used to develop fast algorithms for computing generalized sliding sinusoidal transforms.
3. Fast Algorithms for Computing Generalized Sliding Sinusoidal Transforms
3.1. Fast-Pruned Discrete Sine Transforms
We design two fast-pruned DSTs that will be useful in the future. The sum in the first term in Equations (22) and (24) has the form:
Suppose that , , and in is fixed; then, Equation (26) is a pruned DST of type I (DST-I). If has a power of 2, then the decimation-in-time algorithm [24] recursively splits the input DST-I into two half-length DST-I transforms with even and odd indices, as follows:
where
with ,, and [.] denotes the integer part.
This recursive procedure can be used to design a fast-pruned DST-I algorithm. Figure 1 shows a flow graph for and .
Figure 1.
Flow graph of a fast-pruned DST-I algorithm, N = 16 and K = 5.
The solid and dashed blue lines represent transfer factors of 1 and −1, respectively. A circle indicates the addition if more than one input line is on the left. on the graph means multiplication by the coefficient .
The computational complexity of the pruned DST-I algorithm with respect to additions and multiplications can be estimated recursively: and , respectively. Here, the initial condition for the computational complexity is given as .
Consider the sum in the first term in Equations (23) and (25), which can be written as
Similarly, for and fixed in , this is a pruned DST of type III (DST-III). If has a power of 2, then the decimation-in-time algorithm [24] recursively decomposes the input DST-III into two half-length DST-III transforms as follows:
where
with ,.
A flow graph of the fast-pruned DST-III algorithm designed on the basis of Equations (30)–(32) is shown in Figure 2, and . means multiplication by the coefficient .
Figure 2.
Flow graph of a fast-pruned DST-III algorithm, N = 16 and K = 5.
The computational complexity of the pruned DST-III algorithm with respect to additions and multiplications can be also estimated with the following recursive equations: and , respectively. The initial condition is given as
3.2. Fast Generalized Sliding Sinusoidal Transforms
To use the designed fast-pruned algorithms, we first decompose given in Table 1 into components that do not depend on (see Table 3).
Table 3.
Decomposition of into s-independent components.
It can be seen that is s-independent, whereas each of and takes only two values depending on the parity of s. Using the components of , one can define and express the first terms of generalized sliding sinusoidal transforms (see recursive Equations (22)–(25)) in terms of the fast-pruned DST algorithms as follows:
Here, and denote the fast-pruned DST-I and DST-III algorithms over the input signal , respectively.
Finally, by substituting Equations (33)–(40) into recursive Equations (22)–(25), we can obtain a fast implementation of all generalized sliding sinusoidal transforms. To more clearly illustrate the design of the proposed algorithms, a simple example for computing the generalized DST-I coefficients for , and is provided in Appendix A.
3.3. Analysis of Computational Complexity
Taking into account Equations (22)–(25) and (33)–(40), Table 3, and the complexity of fast-pruned DST-I and DST-III algorithms, the computational complexity of the proposed generalized sliding sinusoidal transforms can be estimated as shown in Table 4.
Table 4.
Complexity of fast-generalized sliding sinusoidal transforms.
Note that the calculation of from around time k requires the addition of . Coefficients have already been calculated and stored at time . Additional costs are also required to calculate the initial K coefficients for each .
The proposed algorithms require 2N memory locations to store the transform coefficients computed at times 0 and K. Note that no additional memory is required to store the output, as the recursive calculation is made “in-place” using the memory originally occupied by the computed coefficients at time 0. The algorithms also need additional memory locations for each pruned DST for storing and factors. Depending on the type of generalized sinusoidal transform, additional memory locations are required to store , and sinusoidal weights.
4. Results
Fast radix-2 algorithms are the most popular fast algorithms for computing discrete sinusoidal transforms. In this section, the performance of the proposed algorithms in terms of computational costs and execution time is compared with that of fast radix-2 algorithms when computing generalized sliding sinusoidal transforms. In addition, the computational complexity of the proposed GSCTs is compared with that of recursive generalized sliding cosine algorithms [22].
Table 5 and Table 6 show the computational complexity of the proposed algorithms in terms of additions and multiplications, respectively, when step is varied and window size N is fixed.
Table 5.
Complexity of the proposed algorithms in terms of additions, N = 256.
Table 6.
Complexity of the proposed algorithms in terms of multiplications, N = 256.
First, the computational complexity of the proposed GSCTs was compared with that of recursive generalized sliding cosine algorithms [22]. The complexity of the latter algorithms with respect to additions and multiplications is presented in Table 7 and Table 8, respectively.
Table 7.
Complexity of recursive sliding DCT algorithms [22] in terms of additions, N = 256.
Table 8.
Complexity of recursive sliding DCT algorithms [22] in terms of multiplications, N = 256.
One can observe that the proposed GSCTs are superior to the corresponding recursive generalized sliding cosine algorithms.
Next, the performance of the proposed algorithms was compared with that of fast radix-2 DCT and DST algorithms. The computational complexity of common fast radix-2 DCT/DST algorithms with respect to additions and multiplications is listed in Table 9.
Table 9.
Complexity of fast DCT/DST algorithms in terms of additions/multiplications; N = 256.
It can be seen that the proposed algorithms GCST-I, GSST-I, GCST-II, GSST-II, GCST-IV, and GSST-IV outperform the corresponding fast algorithms for a wide range of parameter K. The proposed algorithms GCST-III and GSST-III are only efficient for small K values.
Table 10 and Table 11 show how the computational complexity with respect to additions and multiplications changes as window size N varies and K is fixed. It can be seen that, as window size N increases, the gain in the proposed algorithms increases in terms of computational complexity.
Table 10.
Complexity of the proposed algorithms in terms of additions, K = 16.
Table 11.
Complexity of the proposed algorithms in terms of multiplications, K = 16.
The actual running time of an algorithm depends on the hardware and software characteristics and the specific implementation of the algorithm. The purpose of the following simulation was to demonstrate that the theoretical computational complexity of the tested algorithms closely correlates with the execution time of the implemented algorithms. All the tested algorithms were implemented on a laptop with an Intel Core i7-2630QM processor and 8 GB RAM using MATLAB R2016a.
All the experiments were repeated 100 times to ensure statistically correct results, and the average runtime results for each algorithm were calculated. Figure 3 and Figure 4 show the runtime performance of the proposed GSCT-I, GCST-II, GCST-III, GCST-IV, and corresponding fast radix-2 algorithms.
Figure 3.
Running time (milliseconds) of the tested DCT-I and DCT-II algorithms per window when N = 256 and K varies.
Figure 4.
Running time (milliseconds) of the tested DCT-III and DCT-IV algorithms per window when N = 256 and K varies.
5. Conclusions
A generalized solution of a second-order linear nonhomogeneous difference equation was derived. Based on the generalized solution, eight generalized sliding sinusoidal transforms are proposed. Fast algorithms were developed to compute generalized sliding sinusoidal transforms. The algorithms were based on the derived recursive equations and designed fast-pruned DSTs. The performance of the proposed algorithms in terms of computational complexity and execution time was compared with that of recursive generalized sliding cosine transforms and fast discrete sinusoidal algorithms. GCST-I, GSST-I, GCST-II, GSST-II, GCST-IV, and GSST-IV outperformed the corresponding fast algorithms for a wide range of parameters. It was also shown that the obtained theoretical results were in good agreement with the experimental results.
Funding
This research received no external funding.
Data Availability Statement
The data presented in this study are available on request from the corresponding author.
Acknowledgments
The author thanks the Russian Science Foundation, grant No. 22-19-20071.
Conflicts of Interest
The author declares no conflict of interest.
Appendix A
The output coefficients are computed at time . Two coefficients can be borrowed from time . Auxiliary data are calculated as
The output coefficients are calculated as follows:
The algorithm complexity is 24 multiplications and 49 additions.
References
- Jain, A.K. A fast Karhunen-Loeve transform for a class of random processes. IEEE Trans. Commun. 1976, 24, 1023–1029. [Google Scholar] [CrossRef]
- Jain, A.K. A sinusoidal family of unitary transforms. IEEE Trans. Pattern Anal. Mach. Intell. 1979, PAMI-1, 356–365. [Google Scholar] [CrossRef]
- Rose, K.; Heiman, A.; Dinstein, I. DCT/DST alternate-transform image coding. IEEE Trans. Commun. 1990, 38, 94–101. [Google Scholar] [CrossRef]
- Lee, J.; Un, C. Performance of transform-domain LMS adaptive digital filters. IEEE Trans. Acoust. Speech Signal Process. 1986, 34, 499–510. [Google Scholar] [CrossRef]
- Kober, V. Robust and efficient algorithm of image enhancement. IEEE Trans. Consum. Electron. 2006, 52, 655–659. [Google Scholar] [CrossRef]
- Wang, Z.; Wang, L. Interpolation using the fast discrete sine transform. Signal Process. 1992, 26, 131–137. [Google Scholar] [CrossRef]
- Kim, M.; Lee, Y.-L. Discrete sine transform-based interpolation filter for video compression. Symmetry 2017, 9, 257. [Google Scholar] [CrossRef]
- Oppenheim, A.V.; Schafer, R.W. Discrete-Time Signal Processing, 3rd ed.; Prentice-Hall: Upper Saddle River, NJ, USA, 2009. [Google Scholar]
- Sharma, R.R.; Kumar, M.; Pachori, R.B. Joint time-frequency domain-based CAD disease sensing system using ECG signals. IEEE Sensors J. 2019, 19, 3912–3920. [Google Scholar] [CrossRef]
- Portnoff, M. Short-time Fourier analysis of sampled speech. IEEE Trans. Acoust. Speech Signal Process. 1981, 29, 364–373. [Google Scholar] [CrossRef]
- Shi, J.; Zheng, J.; Liu, X.; Xiang, W.; Zhang, Q. Novel short-time fractional Fourier transform: Theory, implementation, and applications. IEEE Trans. Signal Process. 2020, 68, 3280–3295. [Google Scholar] [CrossRef]
- Wang, X.; Huang, G.; Zhou, Z.; Tian, W.; Yao, J.; Gao, J. Radar emitter recognition based on the energy cumulant of short-time Fourier transform and reinforced deep belief network. Sensors 2018, 18, 3103. [Google Scholar] [CrossRef]
- Wang, Y.; Veluvolu, K.C. Time-frequency analysis of non-stationary biological signals with sparse linear regression based Fourier linear combiner. Sensors 2017, 17, 1386. [Google Scholar] [CrossRef]
- Thalmayer, A.; Zeising, S.; Fischer, G.; Kirchner, J. A robust and real-time capable envelope-based algorithm for heart sound classification: Validation under different physiological conditions. Sensors 2020, 20, 972. [Google Scholar] [CrossRef]
- Priyadarshini, M.S.; Krishna, D.; Kumar, K.V.; Amaresh, K.; Goud, B.S.; Bajaj, M.; Altameem, T.; El-Shafai, W.; Fouda, M.M. Significance of harmonic filters by computation of short-time Fourier transform-based time–frequency representation of supply voltage. Energies 2023, 16, 2194. [Google Scholar] [CrossRef]
- Park, C.; Ko, S. The hopping discrete Fourier transform. IEEE Signal Process. Mag. 2014, 31, 135–139. [Google Scholar] [CrossRef]
- Kober, V. Fast recursive computation of sliding DHT with arbitrary step. Sensors 2020, 20, 5556. [Google Scholar] [CrossRef]
- Kober, V. Fast hopping discrete sine transform. IEEE Access 2021, 9, 94293–94298. [Google Scholar] [CrossRef]
- Xi, J.; Chiraro, J.F. Computing running DCT’s and DST’s based on their second-order shift properties. IEEE Trans. Circuits Syst. I 2000, 47, 779–783. [Google Scholar] [CrossRef]
- Kober, V. Fast algorithms for the computation of sliding discrete sinusoidal transforms. IEEE Trans. Signal Process. 2004, 52, 1704–1710. [Google Scholar] [CrossRef]
- Kober, V. Recursive algorithms for computing sliding DCT with arbitrary step. IEEE Sensors 2021, 21, 11507–11513. [Google Scholar] [CrossRef]
- Qian, L.; Luo, S.; He, S.; Chen, G. Recursive algorithms for direct computation of generalized sliding discrete cosine transforms. In Proceedings of the 3rd International Congress on Image and Signal Processing, Yantai, China, 16–18 October 2010; pp. 3017–3020. [Google Scholar] [CrossRef]
- Wang, Z. Fast algorithms for the discrete W transform and for the discrete Fourier transform. IEEE Trans. Acoust. Speech Signal Process. 1984, 32, 803–816. [Google Scholar] [CrossRef]
- Yip, P.; Rao, K.R. Fast decimation-in-time algorithms for a family of discrete sine and cosine transforms. Circuits Syst. Signal Process. 1984, 3, 387–408. [Google Scholar] [CrossRef]
- Hou, H.S. A fast recursive algorithm for computing the discrete cosine transform. IEEE Trans. Acoust. Speech Signal Process. 1987, 35, 1455–1461. [Google Scholar] [CrossRef]
- Wang, Z. Fast discrete sine transform algorithms. Signal Process. 1990, 19, 91–102. [Google Scholar] [CrossRef]
- Britanak, V. On the discrete cosine computation. Signal Process. 1994, 40, 183–194. [Google Scholar] [CrossRef]
- Britanak, V. A unified discrete cosine and sine transform computation. Signal Process. 1995, 43, 333–339. [Google Scholar] [CrossRef]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2023 by the author. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).