Discrete Hartley transform
A discrete Hartley transform (DHT) is a Fourier-related transform of discrete, periodic data similar to the discrete Fourier transform (DFT), with analogous applications in signal processing and related fields. Its main distinction from the DFT is that it transforms real inputs to real outputs, with no intrinsic involvement of complex numbers. Just as the DFT is the discrete analogue of the continuous Fourier transform (FT), the DHT is the discrete analogue of the continuous Hartley transform (HT), introduced by Ralph V. L. Hartley in 1942.[1]
Because there are fast algorithms for the DHT analogous to the fast Fourier transform (FFT), the DHT was originally proposed by Ronald N. Bracewell in 1983[2] as a more efficient computational tool in the common case where the data are purely real. It was subsequently argued, however, that specialized FFT algorithms for real inputs or outputs can ordinarily be found with slightly fewer operations than any corresponding algorithm for the DHT.
Definition
Formally, the discrete Hartley transform is a linear, invertible function H: Rn → Rn (where R denotes the set of real numbers). The N real numbers x0, ..., xN−1 are transformed into the N real numbers H0, ..., HN−1 according to the formula
- [math]\displaystyle{ H_k = \sum_{n=0}^{N-1} x_n \operatorname{cas} \left( \frac{2 \pi}{N} n k \right) = \sum_{n=0}^{N-1} x_n \left[ \cos \left( \frac{2 \pi}{N} n k \right) + \sin \left( \frac{2 \pi}{N} n k \right) \right] \quad \quad k = 0, \dots, N-1 . }[/math]
The combination [math]\displaystyle{ \cos(z) + \sin(z) }[/math] [math]\displaystyle{ = \sqrt{2} \cos\left(z-\frac\pi 4\right) }[/math] is sometimes denoted cas(z), and should not be confused with cis(z) = eiz = cos(z) + i sin(z), or e−iz = cis(−z) which appears in the DFT definition (where i is the imaginary unit).
As with the DFT, the overall scale factor in front of the transform and the sign of the sine term are a matter of convention. Although these conventions occasionally vary between authors, they do not affect the essential properties of the transform.
Properties
The transform can be interpreted as the multiplication of the vector (x0, ...., xN−1) by an N-by-N matrix; therefore, the discrete Hartley transform is a linear operator. The matrix is invertible; the inverse transformation, which allows one to recover the xn from the Hk, is simply the DHT of Hk multiplied by 1/N. That is, the DHT is its own inverse (involutory), up to an overall scale factor.
The DHT can be used to compute the DFT, and vice versa. For real inputs xn, the DFT output Xk has a real part (Hk + HN−k)/2 and an imaginary part (HN−k − Hk)/2. Conversely, the DHT is equivalent to computing the DFT of xn multiplied by 1 + i, then taking the real part of the result.
As with the DFT, a cyclic convolution z = x∗y of two vectors x = (xn) and y = (yn) to produce a vector z = (zn), all of length N, becomes a simple operation after the DHT. In particular, suppose that the vectors X, Y, and Z denote the DHT of x, y, and z respectively. Then the elements of Z are given by:
- [math]\displaystyle{ \begin{matrix} Z_k & = & \left[ X_k \left( Y_k + Y_{N-k} \right) + X_{N-k} \left( Y_k - Y_{N-k} \right) \right] / 2 \\ Z_{N-k} & = & \left[ X_{N-k} \left( Y_k + Y_{N-k} \right) - X_k \left( Y_k - Y_{N-k} \right) \right] / 2 \end{matrix} }[/math]
where we take all of the vectors to be periodic in N (XN = X0, et cetera). Thus, just as the DFT transforms a convolution into a pointwise multiplication of complex numbers (pairs of real and imaginary parts), the DHT transforms a convolution into a simple combination of pairs of real frequency components. The inverse DHT then yields the desired vector z. In this way, a fast algorithm for the DHT (see below) yields a fast algorithm for convolution. (This is slightly more expensive than the corresponding procedure for the DFT, not including the costs of the transforms below, because the pairwise operation above requires 8 real-arithmetic operations compared to the 6 of a complex multiplication. This count doesn't include the division by 2, which can be absorbed e.g. into the 1/N normalization of the inverse DHT.)
Fast algorithms
Just as for the DFT, evaluating the DHT definition directly would require O(N2) arithmetical operations (see Big O notation). There are fast algorithms similar to the FFT, however, that compute the same result in only O(N log N) operations. Nearly every FFT algorithm, from Cooley–Tukey to prime-factor to Winograd (1985)[3] to Bruun's (1993),[4] has a direct analogue for the discrete Hartley transform. (However, a few of the more exotic FFT algorithms, such as the QFT, have not yet been investigated in the context of the DHT.)
In particular, the DHT analogue of the Cooley–Tukey algorithm is commonly known as the fast Hartley transform (FHT) algorithm, and was first described by Bracewell in 1984.[5] This FHT algorithm, at least when applied to power-of-two sizes N, is the subject of the United States patent number 4,646,256, issued in 1987 to Stanford University. Stanford placed this patent in the public domain in 1994 (Bracewell, 1995).[6]
As mentioned above, DHT algorithms are typically slightly less efficient (in terms of the number of floating-point operations) than the corresponding DFT algorithm (FFT) specialized for real inputs (or outputs). This was first argued by Sorensen et al. (1987)[7] and Duhamel & Vetterli (1987).[8] The latter authors obtained what appears to be the lowest published operation count for the DHT of power-of-two sizes, employing a split-radix algorithm (similar to the split-radix FFT) that breaks a DHT of length N into a DHT of length N/2 and two real-input DFTs (not DHTs) of length N/4. In this way, they argued that a DHT of power-of-two length can be computed with, at best, 2 more additions than the corresponding number of arithmetic operations for the real-input DFT.
On present-day computers, performance is determined more by cache and CPU pipeline considerations than by strict operation counts, and a slight difference in arithmetic cost is unlikely to be significant. Since FHT and real-input FFT algorithms have similar computational structures, neither appears to have a substantial a priori speed advantage (Miodrag Popović (engineer)|Popović (sr) and Šević, 1994).[9] As a practical matter, highly optimized real-input FFT libraries are available from many sources (e.g. from CPU vendors such as Intel), whereas highly optimized DHT libraries are less common.
On the other hand, the redundant computations in FFTs due to real inputs are more difficult to eliminate for large prime N, despite the existence of O(N log N) complex-data algorithms for such cases, because the redundancies are hidden behind intricate permutations and/or phase rotations in those algorithms. In contrast, a standard prime-size FFT algorithm, Rader's algorithm, can be directly applied to the DHT of real data for roughly a factor of two less computation than that of the equivalent complex FFT (Frigo and Johnson, 2005).[10] On the other hand, a non-DHT-based adaptation of Rader's algorithm for real-input DFTs is also possible (Chu & Burrus, 1982).[11]
Multi-Dimensional Discrete Hartley Transform (MD-DHT)
The rD-DHT (MD-DHT with "r" dimensions) is given by
[math]\displaystyle{ X(k_1,k_2,...,k_r)=\sum_{n_1=0}^{N_1-1} \sum_{n_2=0}^{N_2-1} \dots \sum_{n_r=0}^{N_r-1} x(n_1,n_2,...,n_r){\rm cas}(\frac{2\pi n_1 k_1}{N_1}+\dots +\frac{2\pi n_r k_r}{N_r}), }[/math]
with [math]\displaystyle{ k_i = 0,1,\ldots, N_i-1 }[/math] and where [math]\displaystyle{ {\rm cas}(x)=\cos(x)+\sin(x). }[/math]
Similar to the 1-D case, as a real and symmetric transform, the MD-DHT is simpler than the MD-DFT. For one, the inverse DHT is identical to the forward transform, with the addition of a scaling factor;
and second, since the kernel is real, it avoids the computational complexity of complex numbers. Additionally, the DFT is directly obtainable from the DHT by a simple additive operation (Bracewell, 1983).[2]
The MD-DHT is widely used in areas like image and optical signal processing. Specific applications include computer vision, high-definition television, and teleconferencing, areas that process or analyze motion images (Zeng, 2000).[12]
Fast algorithms for the MD-DHT
As computing speed keeps increasing, bigger multidimensional problems become computationally feasible, requiring the need for fast multidimensional algorithms. Three such algorithms follow.
In pursuit of separability for efficiency, we consider the following transform (Bracewell, 1983),[2]
[math]\displaystyle{ \hat{X}(k_1,k_2,...,k_r)=\sum_{n_1=0}^{N_1-1} \sum_{n_2=0}^{N_2-1} \dots \sum_{n_r=0}^{N_r-1} x(n_1,n_2,...,n_r){\rm cas}(\frac{2\pi n_1 k_1}{N_1}) \dots {\rm cas}(\frac{2\pi n_r k_r}{N_r}). }[/math]
It was shown in Bortfeld (1995),[13] that the two can be related by a few additions. For example, in 3-D,
[math]\displaystyle{ X(k_1,k_2,k_3) = \frac{1}{2} [\hat{X}(k_1,k_2,-k_3)+\hat{X}(k_1,-k_2,k_3)+\hat{X}(-k_1,k_2,k_3)-\hat{X}(-k_1,-k_2,-k_3)]. }[/math]
For [math]\displaystyle{ \hat{X} }[/math], row-column algorithms can then be implemented. This technique is commonly used due to the simplicity of such R-C algorithms, but they are not optimized for general M-D spaces.
Other fast algorithms have been developed, such as radix-2, radix-4, and split radix. For example, Boussakta (2000)[14] developed the 3-D vector radix,
[math]\displaystyle{ X(k_1,k_2,...,k_r)=\sum_{n_1=0}^{N-1} \sum_{n_2=0}^{N-1}\sum_{n_r=0}^{N-1} x(n_1,n_2,n_3){\rm cas}(\frac{2\pi}{N}(n_1 k_1+n_2 k_2 +n_3 k_3)) }[/math]
[math]\displaystyle{ =\sum_{n_1:even}\sum_{n_2:even}\sum_{n_3:even}+\sum_{n_1:even}\sum_{n_2:even}\sum_{n_3:odd}+\sum_{n_1:even}\sum_{n_2:odd}\sum_{n_3:even} }[/math]
[math]\displaystyle{ +\sum_{n_1:even}\sum_{n_2:odd}\sum_{n_3:odd}+\sum_{n_1:odd}\sum_{n_2:even}\sum_{n_3:even}+\sum_{n_1:odd}\sum_{n_2:even}\sum_{n_3:odd} }[/math]
[math]\displaystyle{ +\sum_{n_1:odd}\sum_{n_2:odd}\sum_{n_3:even}+\sum_{n_1:odd}\sum_{n_2:odd}\sum_{n_3:odd}. }[/math]
It was also presented in Boussakta (2000)[14] that this 3D-vector radix algorithm takes [math]\displaystyle{ (\frac{7}{4})N^3 \log_2 N }[/math] multiplications and [math]\displaystyle{ (\frac{31}{8})N^3 \log_2 N }[/math] additions compared to [math]\displaystyle{ 3N^3 \log_2 N }[/math] multiplications and [math]\displaystyle{ (\frac{9}{2})N^3 \log_2 N+3N^2 }[/math] additions from the row-column approach. The drawback is that the implementation of these radix-type of algorithms is hard to generalize for signals of arbitrary dimensions.
Number theoretic transforms have also been used for solving the MD-DHT, since they perform extremely fast convolutions. In Boussakta (1988),[15] it was shown how to decompose the MD-DHT transform into a form consisting of convolutions:
For the 2-D case (the 3-D case is also covered in the stated reference),
[math]\displaystyle{ X(k,l)=\sum_{n=0}^{N-1} \sum_{m=0}^{M-1}x(n,m){\rm cas}(\frac{2\pi nk}{N}+\frac{2\pi ml}{M}),\; }[/math] [math]\displaystyle{ k=0,1,\ldots ,N-1 }[/math] , [math]\displaystyle{ l=0,1,\ldots,M-1 }[/math]
can be decomposed into 1-D and 2-D circular convolutions as follows,
[math]\displaystyle{ X(k,l)=\begin{cases} X_1(k,0) \\ X_2(0,l) \\ X_3(k,l)\end{cases} }[/math]
where
[math]\displaystyle{ X_1(k,0)=\sum_{n=0}^{N-1} (\sum_{m=0}^{M-1}x(n,m)){\rm cas}(\frac{2\pi nk}{N}),\; }[/math] [math]\displaystyle{ k=0,1,\ldots,N-1 }[/math]
[math]\displaystyle{ X_2(0,l)=\sum_{m=0}^{M-1} (\sum_{n=0}^{N-1}x(n,m)){\rm cas}(\frac{2\pi ml}{M}),\; }[/math] [math]\displaystyle{ l=1,2,\dots, M-1 }[/math]
[math]\displaystyle{ X_3(k,l)=\sum_{n=0}^{N-1} \sum_{m=0}^{M-1}x(n,m){\rm cas}(\frac{2\pi nk}{N}+\frac{2\pi ml}{M})\;, }[/math]
[math]\displaystyle{ k=1,2,\ldots, N-1 }[/math]
[math]\displaystyle{ l=1,2,\ldots,M-1. }[/math]
Developing [math]\displaystyle{ X_3 }[/math] further,
[math]\displaystyle{ X_3(k,l)=\sum_{n=0}^{N-1}x(n,0){\rm cas}(\frac{2\pi nk}{N})+\sum_{m=1}^{M-1} x(0,m){\rm cas}(\frac{2\pi ml}{M}) }[/math]
[math]\displaystyle{ +\sum_{n=1}^{N-1} \sum_{m=1}^{M-1}x(n,m){\rm cas}(\frac{2\pi nk}{N}+\frac{2\pi ml}{M}). }[/math]
At this point we present the Fermat number transform (FNT). The tth Fermat number is given by [math]\displaystyle{ F_t=2^b+1 }[/math], with [math]\displaystyle{ b=2^t }[/math]. The well known Fermat numbers are for [math]\displaystyle{ t=0,1,2,3,4,5,6 }[/math] ([math]\displaystyle{ F_t }[/math] is prime for [math]\displaystyle{ 0\le t \le 4 }[/math]), (Boussakta, 1988).[15] The Fermat number transform is given by
[math]\displaystyle{ X(k,l)=\sum_{n=0}^{N-1} \sum_{m=0}^{M-1}x(n,m)\alpha_{1}^{nk}\alpha_{2}^{ml} \mod F_t }[/math]
with [math]\displaystyle{ k=0,\ldots, N-1, l=0,\ldots,M-1 }[/math]. [math]\displaystyle{ \alpha_1 }[/math] and [math]\displaystyle{ \alpha_2 }[/math] are roots of unity of order [math]\displaystyle{ N }[/math] and [math]\displaystyle{ M }[/math] respectively [math]\displaystyle{ (\alpha_{1}^{N}=\alpha_{2}^{M}=1 \mod F_t) }[/math].
Going back to the decomposition, the last term for [math]\displaystyle{ X_3(k,l) }[/math] will be denoted as [math]\displaystyle{ X_4(k,l) }[/math], then
[math]\displaystyle{ X_4(k,l)=\sum_{n=1}^{N-1} \sum_{m=1}^{M-1}x(n,m){\rm cas}(\frac{2\pi nk}{N}+\frac{2\pi ml}{M}), }[/math]
[math]\displaystyle{ k=1,2,\ldots,N-1 }[/math]
[math]\displaystyle{ l=1,2,\ldots,M-1. }[/math]
If [math]\displaystyle{ g_1 }[/math] and [math]\displaystyle{ g_2 }[/math] are primitive roots of [math]\displaystyle{ N }[/math] and [math]\displaystyle{ M }[/math] (which are guaranteed to exist if [math]\displaystyle{ M }[/math] and [math]\displaystyle{ N }[/math] are prime) then [math]\displaystyle{ g_1 }[/math] and [math]\displaystyle{ g_2 }[/math] map [math]\displaystyle{ (n,m) }[/math] to [math]\displaystyle{ (g_1^{n}\mod N, g_2^m\mod M). }[/math] So, mapping [math]\displaystyle{ n,m,k }[/math] and [math]\displaystyle{ l }[/math] to [math]\displaystyle{ g_1^{-n},g_2^{-m}, g_1^k }[/math] and [math]\displaystyle{ g_2^l }[/math], one gets the following,
[math]\displaystyle{ X_4(g_1^k,g_2^l)=\sum_{n=0}^{N-2} \sum_{m=0}^{M-2}x(g_1^{-n},g_2^{-m}){\rm cas}(\frac{2\pi g_1^{ (-n+k)}}{N}+\frac{2\pi g_2^{(-m+l)}}{M}), }[/math]
[math]\displaystyle{ k=0,1,\ldots,N-2 }[/math]
[math]\displaystyle{ l=0,1,\ldots,M-2 }[/math].
Which is now a circular convolution. With [math]\displaystyle{ Y(k,l)=X_4(g_1^k,g_2^l) }[/math], [math]\displaystyle{ y(n,m)=x(g_1^{-n},g_2^{-m}) }[/math], and [math]\displaystyle{ h(n,m)={\rm cas}(\frac{2\pi g_1^n}{N}+\frac{2\pi g_2^m}{M}) }[/math], one has
[math]\displaystyle{ Y(k,l)=\sum_{n=0}^{N-2} \sum_{m=0}^{M-2}y(n,m)h(\lt k-n\gt _N,\lt l-m\gt _M) }[/math]
[math]\displaystyle{ Y(k,l)=FNT^{-1} \{FNT[y(n,m)]\otimes FNT[h(n,m)] }[/math]
where [math]\displaystyle{ \otimes }[/math] denotes term by term multiplication. It was also stated in (Boussakta, 1988)[15] that this algorithm reduces the number of multiplications by a factor of 8–20 over other DHT algorithms at a cost of a slight increase in the number of shift and add operations, which are assumed to be simpler than multiplications. The drawback of this algorithm is the constraint that each dimension of the transform has a primitive root.
References
- ↑ "A More Symmetrical Fourier Analysis Applied to Transmission Problems". Proceedings of the IRE 30 (3): 144–150. March 1942. doi:10.1109/JRPROC.1942.234333.
- ↑ 2.0 2.1 2.2 "Discrete Hartley Transform". Journal of the Optical Society of America 73 (12): 1832–1835. 1983. doi:10.1364/josa.73.001832.
- ↑ "On computing the discrete Hartley transform". IEEE Transactions on Acoustics, Speech, and Signal Processing ASSP-33 (4): 1231–1238. 1985.
- ↑ "Fast discrete transform by means of eigenpolynomials". Computers & Mathematics with Applications 26 (9): 35–52. 1993. doi:10.1016/0898-1221(93)90004-f.
- ↑ "The Fast Hartley Transform". Proceedings of the IEEE 72 (8): 1010–1018. 1984. doi:10.1109/proc.1984.12968.
- ↑ "Computing with the Hartley Transform". Computers in Physics 9 (4): 373–379. 1995. doi:10.1063/1.168534. Bibcode: 1995ComPh...9..373B.
- ↑ "Real-valued fast Fourier transform algorithms". IEEE Transactions on Acoustics, Speech, and Signal Processing ASSP-35 (6): 849–863. 1987.
- ↑ "Improved Fourier and Hartley transform algorithms: application to cyclic convolution of real data". IEEE Transactions on Acoustics, Speech, and Signal Processing ASSP-35: 818–824. 1987.
- ↑ "A new look at the comparison of the fast Hartley and Fourier transforms". IEEE Transactions on Signal Processing 42 (8): 2178–2182. 1994. doi:10.1109/78.301854. Bibcode: 1994ITSP...42.2178P.
- ↑ "The Design and Implementation of FFTW3". Proceedings of the IEEE 93 (2): 216–231. 2005. doi:10.1109/jproc.2004.840301. http://fftw.org/fftw-paper-ieee.pdf.}
- ↑ "A prime factor FTT [sic] algorithm using distributed arithmetic". IEEE Transactions on Acoustics, Speech, and Signal Processing 30 (2): 217–227. 1982. doi:10.1109/tassp.1982.1163875.
- ↑ "Polynomial Transform Algorithms for Multidimensional Discrete Hartley Transform". IEEE International Symposium on Circuits and Systems (V): 517–520. 2000.
- ↑ "Calculation of Multidimensional Hartley Transforms Using One-Dimensional Fourier Transforms". IEEE Transactions on Signal Processing 43 (5): 1306–1310. 1995. doi:10.1109/78.382424. Bibcode: 1995ITSP...43.1306B.
- ↑ 14.0 14.1 "Fast Algorithm for the 3-D Discrete Hartley Transform". International Conference on Acoustics, Speech, and Signal Processing '00 (4): 2302–2305. 2000.
- ↑ 15.0 15.1 15.2 "Fast Multidimensional Discrete Hartley Transform using Fermat Number Transform". IEE Proceedings G - Electronic Circuits and Systems 135 (6): 235–237. 1988. doi:10.1049/ip-g-1.1988.0036.
Further reading
- The Hartley Transform (1 ed.). Oxford University Press. 1986. ISBN 978-0-19503969-6.
- "Fast Multidimensional Discrete Hartley Transform using Fermat Number Transform". IEE Proceedings G - Electronic Circuits and Systems 135 (6): 235–237. 1988. doi:10.1049/ip-g-1.1988.0036.
- "Basefield transforms with the convolution property". Proceedings of the IEEE 82 (3): 400–412. 1994. doi:10.1109/5.272145. https://infoscience.epfl.ch/record/33890/files/HongVD94.pdf.
- "Faster than Fast Fourier". BYTE 13 (4): 293–300. 1988.
- Olnejniczak, Kraig J.; Heydt, Gerald T. (March 1994). "Scanning the Special Section on the Hartley transform". Proceedings of the IEEE 82: 372–380. (NB. Contains extensive bibliography.)
Original source: https://en.wikipedia.org/wiki/Discrete Hartley transform.
Read more |