
ECE 8440 - UNIT 20 1 The Discrete Cosine Transform • similar to the DFT •has advantages over the DFT in applicaons involving data compression (e.g., coding of speech and image signals) • can be computed by using an algorithm that applies the DFT to a modified input. Before defining the Discrete Cosine Transform, consider the general representaon of a transform of a finite length 8me domain signal : x(n) N-1 A(k) = x(n) * (n) (analysis equaon)∑ φk (equaon 8.147) n=0 1 N-1 x(n) = A(k) (n) (synthesis equaon)∑ φk (equaon 8.148) N k=0 φ (n) The sequences in the above expressions are called k basis sequences and are orthogonal to each other, so that they sasfy: N-1 1 ⎧1, m = k (n) * (n) = ∑ φk φm ⎨ N k=0 ⎩0, m ≠ k. φ (n) For the DFT, the are the periodic complex exponen8al sequences: k j2πkn/N φk (n) = e . There are some orthogonal transforms which yield a real-valued sequence when is real A(k) x(n) 2 valued. These include: • Haar Transforms • Hadamard Transforms • Hartley Transforms • Discrete Cosine Transform φ (n) The Discrete Cosine Transform uses cosine func8ons for the basis func8ons. k Important proper8es of cosine func8ons when used as basis func8ons for a transform: • periodic (like the exponen8als used by the DFT) • even symmetry To begin the development of the DCT, consider the 4-point signal shown below: Each of the 8 versions of the DCT is based on extending an N-point sequence into a periodic 3 sequence which has certain symmetry proper8es, as described below: Type-1 Periodic Extension The first version of the DCT, called DCT-1, is based on extending into the periodic signal x(n) x (n) 1 using "Type-1 periodic extension." For the above , the Type-1 periodic extension is shown x(n) below: Figure 8.25 Center of even symmetry: - The last point of x(n) ( n = N-1, where N is the number of points in x(n)) Period of 2N - 2 = 6 x1(n): Type-2 Periodic Extension 4 x (n) The second version of the DCT is based on extending into the periodic signal using x(n) 2 "Type-2 periodic extension." For the above , the Type-2 periodic extension is shown below: x(n) Figure 8.25 Center of even symmetry: 1 - Half-sample point aer last sample where N = number of points in x(n)). ("n" = N - , 2 2N = 8 Period of x2(n): Type-3 Periodic Extension 5 x (n) The third version of the DCT is based on extending x(n) into the periodic signal using 3 "Type-3 periodic extension." For the above x(n), the Type-3 periodic extension is shown below: Figure 8.25 Center of odd symmetry - Point aer the last point of x(n) (n = N, where N = length of x(n)) (Note that x(N) must be 0.) Center of even symmetry: - The point n = 2N Period of x (n): 3 4N = 16 Type-4 Periodic Extension 6 x (n) S8ll another version of the DCT, called DCT-4, is based on extending x(n) into the periodic signal 4 using "Type-4 periodic extension." For the above x(n), the Type-4 periodic extension is shown below: Figure 8.25 Center of odd symmetry: 1 - Half-sample point aer last point of x(n) where N = number of points in x(n)) ("n" = N - , 2 Center of even symmetry: 1 - The point where N = number of points in x(n)) "n" = 2N + , 2 Period of x 4(n): 4N = 16 Four versions of the DCT are closely related to the extended signals shown above. 7 These are: DCT - 1 ↔ x1(n) DCT - 2 ↔ x (n) 2 DCT - 3 ↔ x (n) 3 DCT - 4 ↔ x (n) 4 Definion of DCT-1 First, note from the plot of , shown again below, that we could create a signal similar to by x (n) x1(n) 1 adding a periodic extension of x(n) ( aer appending N-2 0’s) to a periodic extension of x(-n) (also with N-2 appended 0’s). Note that both extensions have the same period of 2N-2. (Repeat of figure shown on a previous slide.) x (n) x(n) (The resul8ng signal would be same as except that the first and last points in would overlap 1 with the first and last points in when both are periodically extended, as described above.) x(-n) x (n) To compensate for the "double value" terms we define a pre-scaled signal as α 8 x (n) = α(n)x(n) α where ⎧ 1 ⎪ , n = 0 and N -1 α(n) = ⎨2 ⎪ ⎩1, 1 ≤ n ≤ N - 2 Then, adding the periodic extensions of and with period = will create the x (n) x (-n) 2N − 2 = 6 α α x (n) signal we defined earlier as . This can be formally expressed as 1 (equaon 8.150) x (n) = x [((n)) ] + x [((-n)) ] 1 α 2N-2 α 2N-2 We now formally define the DCT-1 of an N-point signal and the inverse DCT-1 by the following two equaons: N−1 c1 ⎛ πkn ⎞ X (k) = 2 α(n)x(n)cos , 0 ≤ k ≤ N-1 ∑ ⎜ N − 1⎟ n=0 ⎝ ⎠ N−1 1 c1 ⎛ πkn ⎞ x(n) = α(k)X (k)cos ⎜ ⎟, 0 ≤ k ≤ N-1 N − 1∑ ⎝ N − 1⎠ k =0 where is the same sequence as used in defining . α(k) x (n) α Definion of DCT-2 9 x (n) The DCT-2 transform is related to , the second version of a periodic sequence based on x(n). 2 x (n) x (n) x(n) Note from the plot of that we could create by adding a periodic extension of 2 2 (with period = 2N) to a periodic extension of x(-n-1), also with period = 2N. (Repeat of figure shown on a previous slide.) The resul8ng signal would be exactly the same as since there are no overlaps involved x (n) 2 x (n) x(n) when the two contribu8ons are added. We can formally express in terms of as 2 follows: (equaon 8.154) x (n) = x[((n)) ] + x[((-n -1)) ] 2 2N 2N We now formally define the DCT-2 and its inverse by the following two equaons: N−1 ⎛ πk(2n + 1)⎞ Xc2(k) = 2 x(n)cos , 0 ≤ k ≤ N-1 ∑ ⎜ 2N ⎟ n=0 ⎝ ⎠ 1 N−1 ⎛ πk(2n + 1)⎞ x(n) = β(k)Xc2(k)cos , 0 ≤ n ≤ N-1 N ∑ ⎜ 2N ⎟ n=0 ⎝ ⎠ The weigh8ng func8on used in the above expression for the inverse DCT-2 is defined as β(k) 10 follows: ⎧1 ⎪ , k = 0 β(k) = ⎨2 ⎪1, 1 ≤ k ≤ N -1. ⎩ The sequences and the obtained for the 4-point signal used to form the c1 c2 x(n) x (n) X (k) X (k) 1 and described above are shown below: x (n) 2 c1 c2 Although and are normally evaluated only for the range (for the above X (k) X (k) 0 ≤ k ≤ N-1 example, N = 4), if we do evaluate them outside this range, they exhibit symmetry proper8es. However, it is not always the same type of symmetry associated the periodically extended 8me c1 x (n) c2 signal it is related to. That is, has Type 1 symmetry, like . However, has Type X (k) 1 X (k) x (n) 3 symmetry, not the Type 2 symmetry of . 2 Relaon Between the DCT-1 and the DFT 11 Consider one period of the periodic 8me signal associated with DCT-1: (eqn. 8.161) x (n) = x [((n)) ] + x [((-n)) ] = x (n) n = 0,1, ... ,2N-3 1 α 2N-2 α 2N-2 1 1 where as before is the original N-point sequence with its endpoints mul8plied by . xα (n) x(n) 2 Note that the number of points in is . x1(n) 2N − 2 Now take the point 2N − 2 DFT of : x1(n) X (k) = X (k) + X* (k) = 2Re{X (k)}, k=0,1,...,2N-3 1 α α α (See property 10 of the DFT (in Table 8.1) and property 10 of the DFS (in Tables 8.2) X (k) x (n) x (n) where is the 2N -2 point DFT of aer is zero-padded to extend its length from α α α N to 2N-2 . Re{X (k)} X (k) Finally, expressing using cosines, we can write the above expression for as α 1 N−1 ⎛ 2πkn ⎞ N−1 ⎛ πkn ⎞ X (k) = 2Re{X (k)} = 2 α(n)x(n)cos = 2 α(n)x(n)cos , 0 ≤ k ≤ 2N − 1. 1 α ∑ ⎜ 2N − 2⎟ ∑ ⎜ N − 1⎟ n=0 ⎝ ⎠ n=0 ⎝ ⎠ c1 Note that the right side of the above expression is the same expression we used to define , X (k) the DCT-1 of x(n). Therefore, we can find the DCT-1 of an N-point signal as follows: 12 x (n) = α(n)x(n) 0 ≤ n ≤ N-1 1. Form α x (n) = x [((n)) ] + x [((-n)) ] = x (n) n = 0,1, ... ,2N-3 2. Form 1 α 2N-2 α 2N-2 1 3. Take the 2N-2 point DFT of to get x (n) X (k) 1 1 4. Extract the first N terms of to form . (This provides terms for .) X (k) Xc1(k) 0 ≤ k ≤ N-1 1 OR (the simpler approach) 1. Form x (n) = α(n)x(n) 0 ≤ n ≤ N-1 α 2. "Zero-pad” with N-2 zeros to create a sequence over the range .
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages19 Page
-
File Size-