Content deleted Content added
→Multidimensional DCTs: some stuff Tag: Reverted |
m →External links: HTTP to HTTPS for SourceForge |
||
(25 intermediate revisions by 12 users not shown) | |||
Line 1:
{{Short description|Technique used in signal processing and data compression}}
A '''discrete cosine transform''' ('''DCT''') expresses a finite sequence of [[data points]] in terms of a sum of [[cosine]] functions oscillating at different [[frequency|frequencies]]. The DCT, first proposed by [[Nasir Ahmed (engineer)|Nasir Ahmed]] in 1972, is a widely used transformation technique in [[signal processing]] and [[data compression]]. It is used in most [[digital media]], including [[digital images]] (such as [[JPEG]] and [[HEIF]]), [[digital video]] (such as [[MPEG]] and {{nowrap|[[H.26x]]}}), [[digital audio]] (such as [[Dolby Digital]], [[MP3]] and [[Advanced Audio Coding|AAC]]), [[digital television]] (such as [[SDTV]], [[HDTV]] and [[Video on demand|VOD]]), [[digital radio]] (such as [[AAC+]] and [[DAB+]]), and [[speech coding]] (such as [[AAC-LD]], [[Siren (codec)|Siren]] and [[Opus (audio format)|Opus]]). DCTs are also important to numerous other applications in [[science and engineering]], such as [[digital signal processing]], [[telecommunication]] devices, reducing [[network bandwidth]] usage, and [[spectral method]]s for the numerical solution of [[partial differential equations]].
Line 12 ⟶ 11:
== History ==
The DCT was first conceived by [[Nasir Ahmed (engineer)|Nasir Ahmed
Since its introduction in 1974, there has been significant research on the DCT.<ref name="t81"/> In 1977, Wen-Hsiung Chen published a paper with C. Harrison Smith and Stanley C. Fralick presenting a fast DCT algorithm.<ref name="A Fast Computational Algorithm for">{{cite journal |last1=Chen |first1=Wen-Hsiung |last2=Smith |first2=C. H. |last3=Fralick |first3=S. C. |title=A Fast Computational Algorithm for the Discrete Cosine Transform |journal=[[IEEE Transactions on Communications]] |date=September 1977 |volume=25 |issue=9 |pages=1004–1009 |doi=10.1109/TCOM.1977.1093941}}</ref><ref name="t81"/> Further developments include a 1978 paper by M. J. Narasimha and A. M. Peterson, and a 1984 paper by B. G. Lee.<ref name="t81"/> These research papers, along with the original 1974 Ahmed paper and the 1977 Chen paper, were cited by the [[Joint Photographic Experts Group]] as the basis for [[JPEG]]'s lossy image compression algorithm in 1992.<ref name="t81"/><ref name="chen">{{cite journal |last1=Smith |first1=C. |last2=Fralick |first2=S. |title=A Fast Computational Algorithm for the Discrete Cosine Transform |journal=IEEE Transactions on Communications |date=1977 |volume=25 |issue=9 |pages=1004–1009 |doi=10.1109/TCOM.1977.1093941 |issn=0090-6778}}</ref>
Line 60 ⟶ 59:
**[[Image processing]] — [[digital image processing]],<ref name="Stankovic"/> [[image analysis]], [[content-based image retrieval]], [[corner detection]], directional block-wise [[Sparse approximation|image representation]], [[edge detection]], [[image enhancement]], [[image fusion]], [[image segmentation]], [[interpolation]], [[image noise]] level estimation, mirroring, rotation, [[Just-noticeable difference|just-noticeable distortion]] (JND) profile, [[spatiotemporal]] masking effects, [[foveated imaging]]<ref name="Ochoa"/>
**[[Image quality]] assessment — DCT-based quality degradation metric (DCT QM)<ref name="Ochoa"/>
**[[Image reconstruction]] — directional [[image texture|textures]] auto inspection,
*[[Medical technology]]
**[[Electrocardiography]] (ECG) — [[vectorcardiography]] (VCG)<ref name="Ochoa"/>
Line 258 ⟶ 257:
===Compression artifacts===
A common issue with DCT compression in [[digital media]] are blocky [[compression artifacts]],<ref name="Katsaggelos">{{cite book |last1=Katsaggelos |first1=Aggelos K. |last2=Babacan |first2=S. Derin |last3=Chun-Jen |first3=Tsai |title=The Essential Guide to Image Processing |date=2009 |publisher=[[Academic Press]] |isbn=9780123744579 |pages=349–383|chapter=Chapter 15 - Iterative Image Restoration}}</ref> caused by DCT blocks.<ref name="Alikhani">{{cite web |last1=Alikhani |first1=Darya |title=Beyond resolution: Rosa Menkman's glitch art |url=http://postmatter.merimedia.com/articles/archive-2012-2016/2015/51-rosa-menkman/ |website=POSTmatter |date=April 1, 2015 |access-date=19 October 2019 |archive-date=19 October 2019 |archive-url=https://web.archive.org/web/20191019082218/http://postmatter.merimedia.com/articles/archive-2012-2016/2015/51-rosa-menkman/ |url-status=dead }}</ref> In a DCT algorithm, an image (or frame in an image sequence) is divided into square blocks which are processed independently from each other, then the DCT blocks is taken within each block and the resulting DCT coefficients are [[Quantization (signal processing)|quantized]]. This process can cause blocking artifacts, primarily at high [[data compression ratio]]s.<ref name="Katsaggelos"/> This can also cause the [[mosquito noise]] effect, commonly found in [[digital video]].<ref>{{cite web |title=Mosquito noise |url=https://www.pcmag.com/encyclopedia/term/55914/mosquito-noise |website=[[PC Magazine]] |access-date=19 October 2019}}</ref
DCT blocks are often used in [[glitch art]].<ref name="Alikhani"/> The artist [[Rosa Menkman]] makes use of DCT-based compression artifacts in her glitch art,<ref name="Menkman">{{cite book |last1=Menkman |first1=Rosa |title=The Glitch Moment(um) |url=https://networkcultures.org/_uploads/NN%234_RosaMenkman.pdf |publisher=Institute of Network Cultures |isbn=978-90-816021-6-7 |date=October 2011 |access-date=19 October 2019}}</ref> particularly the DCT blocks found in most [[digital media]] formats such as [[JPEG]] digital images and [[MP3]]
==Informal overview==
Like any Fourier-related transform,
The Fourier-related transforms that operate on a function over a finite [[___domain of a function|___domain]], such as the DFT or DCT or a [[Fourier series]], can be thought of as implicitly defining an ''extension'' of that function outside the ___domain. That is, once you write a function <math>f(x)</math> as a sum of sinusoids, you can evaluate that sum at any <math>x</math>, even for <math>x</math> where the original <math>f(x)</math> was not specified. The DFT, like the Fourier series, implies a [[periodic function|periodic]] extension of the original function. A DCT, like a [[
[[Image:DCT-symmetries.svg|thumb|right|350px|Illustration of the implicit even/odd extensions of DCT input data, for ''N''=11 data points (red dots), for the four most common types of DCT (types I-IV). Note the subtle differences at the interfaces between the data and the extensions: in DCT-II and DCT-IV both the end points are replicated in the extensions but not in DCT-I or DCT-III (and a zero point is inserted at the sign reversal extension in DCT-III).]]
However, because DCTs operate on ''finite'', ''discrete'' sequences, two issues arise that do not apply for the continuous cosine transform. First, one has to specify whether the function is even or odd at ''both'' the left and right boundaries of the ___domain (i.e. the min-''n'' and max-''n'' boundaries in the definitions below, respectively). Second, one has to specify around ''what point'' the function is even or odd. In particular, consider a sequence ''abcd'' of four equally spaced data points, and say that we specify an even ''left'' boundary. There are two sensible possibilities: either the data are even about the sample ''a'', in which case the even extension is ''dcbabcd'', or the data are even about the point ''halfway'' between ''a'' and the previous point, in which case the even extension is ''dcbaabcd'' (''a'' is repeated).
Each boundary can be either even or odd (2 choices per boundary) and can be symmetric about a data point or the point halfway between two data points (2 choices per boundary), for a total of 2 × 2 × 2 × 2 = 16 possibilities. These choices lead to all the standard variations of DCTs and also [[discrete sine transform]]s (DSTs). Half of these possibilities, those where the ''left'' boundary is even, correspond to the 8 types of DCT; the other half are the 8 types of DST.
These different boundary conditions strongly affect the applications of the transform and lead to uniquely useful properties for the various DCT types. Most directly, when using Fourier-related transforms to solve [[partial differential equation]]s by [[spectral method]]s, the boundary conditions are directly specified as a part of the problem being solved. Or, for the
In particular, it is well known that any [[Classification of discontinuities|discontinuities]] in a function reduce the [[rate of convergence]] of the Fourier series
== Formal definition ==
Line 287 ⟶ 286:
\qquad \text{ for } ~ k = 0,\ \ldots\ N-1 ~.</math>
Some authors further multiply the <math>x_0 </math> and <math> x_{N-1} </math> terms by <math> \sqrt{2\,}\
The DCT-I is exactly equivalent (up to an overall scale factor of 2), to a
Note, however, that the DCT-I is not defined for <math>
Thus, the DCT-I corresponds to the boundary conditions: <math>
=== DCT-II ===
Line 300 ⟶ 299:
\qquad \text{ for } ~ k = 0,\ \dots\ N-1 ~.</math>
The DCT-II is probably the most commonly used form, and is often simply referred to as
This transform is exactly equivalent (up to an overall scale factor of 2) to a
Some authors further multiply the <math>
The DCT-II implies the boundary conditions: <math>
=== DCT-III ===
Line 314 ⟶ 313:
\qquad \text{ for } ~ k = 0,\ \ldots\ N-1 ~.</math>
Because it is the inverse of DCT-II up to a scale factor (see below), this form is sometimes simply referred to as
Some authors divide the <math>x_0</math> term by <math>\sqrt{2}</math> instead of by 2 (resulting in an overall <math>x_0/\sqrt{2}</math> term) and multiply the resulting matrix by an overall scale factor of <math display="inline"> \sqrt{2/N}</math> (see above for the corresponding change in DCT-II), so that the DCT-II and DCT-III are transposes of one another. This makes the DCT-III matrix [[orthogonal matrix|orthogonal]], but breaks the direct correspondence with a real-even
The DCT-III implies the boundary conditions: <math>x_n</math> is even around <math>n = 0</math> and odd around <math>n = N ;</math> <math>X_k</math> is even around <math>k = -1/2</math> and even around <math>k = N - 1/2.</math>
Line 329 ⟶ 328:
A variant of the DCT-IV, where data from different transforms are ''overlapped'', is called the [[modified discrete cosine transform]] (MDCT).<ref>{{harvnb|Malvar|1992}}</ref>
The DCT-IV implies the boundary conditions: <math>
=== DCT V-VIII ===
DCTs of types I–IV treat both boundaries consistently regarding the point of symmetry: they are even/odd around either a data point for both boundaries or halfway between two data points for both boundaries. By contrast, DCTs of types V-VIII imply boundaries that are even/odd around a data point for one boundary and halfway between two data points for the other boundary.
In other words, DCT types I–IV are equivalent to real-even
However, these variants seem to be rarely used in practice. One reason, perhaps, is that [[Fast Fourier transform|FFT]] algorithms for odd-length DFTs are generally more complicated than [[Fast Fourier transform|FFT]] algorithms for even-length DFTs (e.g. the simplest radix-2 algorithms are only for even lengths), and this increased intricacy carries over to the DCTs as described below.
Line 343 ⟶ 342:
Using the normalization conventions above, the inverse of DCT-I is DCT-I multiplied by 2/(''N'' − 1). The inverse of DCT-IV is DCT-IV multiplied by 2/''N''. The inverse of DCT-II is DCT-III multiplied by 2/''N'' and vice versa.<ref name="pubRaoYip"/>
Like for the
== Multidimensional DCTs ==
Multidimensional variants of the various DCT types follow straightforwardly from the one-dimensional definitions: they are simply a separable product (equivalently, a composition) of DCTs along each dimension.
=== M-D DCT-II ===
For example, a two-dimensional DCT-II of an image or a matrix is simply the one-dimensional DCT-II, from above, performed along the rows and then along the columns (or vice versa). That is, the 2D DCT-II is given by the formula (omitting normalization and other scale factors, as above):
:<math>
\begin{align}
X_{k_1,k_2} &=
\sum_{n_1=0}^{N_1-1}
\left( \sum_{n_2=0}^{N_2-1}
x_{n_1,n_2}
\cos \left[\frac{\pi}{N_2} \left(n_2+\frac{1}{2}\right) k_2 \right]\right)
\cos \left[\frac{\pi}{N_1} \left(n_1+\frac{1}{2}\right) k_1 \right]\\
&= \sum_{n_1=0}^{N_1-1}
\sum_{n_2=0}^{N_2-1}
x_{n_1,n_2}
\cos \left[\frac{\pi}{N_1} \left(n_1+\frac{1}{2}\right) k_1 \right]
\cos \left[\frac{\pi}{N_2} \left(n_2+\frac{1}{2}\right) k_2 \right] .
\end{align}
</math>
:The inverse of a multi-dimensional DCT is just a separable product of the inverses of the corresponding one-dimensional DCTs (see above), e.g. the one-dimensional inverses applied along one dimension at a time in a row-column algorithm.
The ''3-D DCT-II'' is only the extension of ''2-D DCT-II'' in three dimensional space and mathematically can be calculated by the formula
:<math>
X_{k_1,k_2,k_3} =
\sum_{n_1=0}^{N_1-1}
\sum_{n_2=0}^{N_2-1}
\sum_{n_3=0}^{N_3-1}
x_{n_1,n_2,n_3}
\cos \left[\frac{\pi}{N_1} \left(n_1+\frac{1}{2}\right) k_1 \right]
\cos \left[\frac{\pi}{N_2} \left(n_2+\frac{1}{2}\right) k_2 \right]
\cos \left[\frac{\pi}{N_3} \left(n_3+\frac{1}{2}\right) k_3 \right],\quad
\text{for } k_i = 0,1,2,\dots,N_i-1.
</math>
The inverse of '''3-D DCT-II''' is '''3-D DCT-III''' and can be computed from the formula given by
:<math>
x_{n_1,n_2,n_3} =
\sum_{k_1=0}^{N_1-1}
\sum_{k_2=0}^{N_2-1}
\sum_{k_3=0}^{N_3-1}
X_{k_1,k_2,k_3}
\cos \left[\frac{\pi}{N_1} \left(n_1+\frac{1}{2}\right) k_1 \right]
\cos \left[\frac{\pi}{N_2} \left(n_2+\frac{1}{2}\right) k_2 \right]
\cos \left[\frac{\pi}{N_3} \left(n_3+\frac{1}{2}\right) k_3 \right],\quad
\text{for } n_i=0,1,2,\dots,N_i-1.
</math>
Technically, computing a two-, three- (or -multi) dimensional DCT by sequences of one-dimensional DCTs along each dimension is known as a ''row-column'' algorithm. As with [[fast Fourier transform#Multidimensional FFTs|multidimensional FFT algorithms]], however, there exist other methods to compute the same thing while performing the computations in a different order (i.e. interleaving/combining the algorithms for the different dimensions). Owing to the rapid growth in the applications based on the 3-D DCT, several fast algorithms are developed for the computation of 3-D DCT-II. Vector-Radix algorithms are applied for computing M-D DCT to reduce the computational complexity and to increase the computational speed. To compute 3-D DCT-II efficiently, a fast algorithm, Vector-Radix Decimation in Frequency (VR DIF) algorithm was developed.
====3-D DCT-II VR DIF====
In order to apply the VR DIF algorithm the input data is to be formulated and rearranged as follows.<ref>{{cite journal|doi=10.1049/ip-f-2.1990.0063|title=Direct methods for computing discrete sinusoidal transforms|year=1990|last1=Chan|first1=S.C.|last2=Ho|first2=K.L.|journal=IEE Proceedings F - Radar and Signal Processing|volume=137|issue=6|page=433}}</ref><ref name=":0">{{cite journal|first1=O.|last1=Alshibami|first2=S.|last2=Boussakta|title=Three-dimensional algorithm for the 3-D DCT-III|journal=Proc. Sixth Int. Symp. Commun., Theory Applications|date=July 2001|pages=104–107}}</ref> The transform size ''N × N × N'' is assumed to be 2.
[[File:Stages of the 3-D DCT-II VR DIF algorithm.jpg|thumb|The four basic stages of computing 3-D DCT-II using VR DIF Algorithm.|336x336px]]
:<math>
\begin{array}{lcl}\tilde{x}(n_1,n_2,n_3) =x(2n_1,2n_2,2n_3)\\
\tilde{x}(n_1,n_2,N-n_3-1)=x(2n_1,2n_2,2n_3+1)\\
\tilde{x}(n_1,N-n_2-1,n_3)=x(2n_1,2n_2+1,2n_3)\\
\tilde{x}(n_1,N-n_2-1,N-n_3-1)=x(2n_1,2n_2+1,2n_3+1)\\
\tilde{x}(N-n_1-1,n_2,n_3)=x(2n_1+1,2n_2,2n_3)\\
\tilde{x}(N-n_1-1,n_2,N-n_3-1)=x(2n_1+1,2n_2,2n_3+1)\\
\tilde{x}(N-n_1-1,N-n_2-1,n_3)=x(2n_1+1,2n_2+1,2n_3)\\
\tilde{x}(N-n_1-1,N-n_2-1,N-n_3-1)=x(2n_1+1,2n_2+1,2n_3+1)\\
\end{array}
</math>
:where <math>0\leq n_1,n_2,n_3 \leq \frac{N}{2} -1</math>
The figure to the adjacent shows the four stages that are involved in calculating 3-D DCT-II using VR DIF algorithm. The first stage is the 3-D reordering using the index mapping illustrated by the above equations. The second stage is the butterfly calculation. Each butterfly calculates eight points together as shown in the figure just below, where <math>c(\varphi_i)=\cos(\varphi_i)</math>.
The original 3-D DCT-II now can be written as
:<math>X(k_1,k_2,k_3)=\sum_{n_1=1}^{N-1}\sum_{n_2=1}^{N-1}\sum_{n_3=1}^{N-1}\tilde{x}(n_1,n_2,n_3) \cos(\varphi k_1)\cos(\varphi k_2)\cos(\varphi k_3)
</math>
where <math>\varphi_i= \frac{\pi}{2N}(4N_i+1),\text{ and } i= 1,2,3.</math>
If the even and the odd parts of <math>k_1,k_2</math> and <math>k_3</math> and are considered, the general formula for the calculation of the 3-D DCT-II can be expressed as [[File:Single butterfly of the 3-D DCT-II VR DIF algorithm.jpg|thumb|The single butterfly stage of VR DIF algorithm.|310x310px]]
:<math>X(k_1,k_2,k_3)=\sum_{n_1=1}^{\tfrac N 2 -1}\sum_{n_2=1}^{\tfrac N 2 -1}\sum_{n_1=1}^{\tfrac N 2 -1}\tilde{x}_{ijl}(n_1,n_2,n_3) \cos(\varphi (2k_1+i)\cos(\varphi (2k_2+j)
\cos(\varphi (2k_3+l))</math>
where
: <math>\tilde{x}_{ijl}(n_1,n_2,n_3)=\tilde{x}(n_1,n_2,n_3)+(-1)^l\tilde{x}\left(n_1,n_2,n_3+\frac{n}{2}\right) </math>
: <math>+(-1)^j\tilde{x}\left(n_1,n_2+\frac{n}{2},n_3\right)+(-1)^{j+l}\tilde{x}\left(n_1,n_2+\frac{n}{2},n_3+\frac{n}{2}\right) </math>
: <math>+(-1)^i\tilde{x}\left(n_1+\frac{n}{2},n_2,n_3\right)+(-1)^{i+j}\tilde{x}\left(n_1+\frac{n}{2}+\frac{n}{2},n_2,n_3\right) </math>
: <math>+(-1)^{i+l}\tilde{x}\left(n_1+\frac{n}{2},n_2,n_3+\frac{n}{3}\right)</math>
: <math>+(-1)^{i+j+l}\tilde{x}\left(n_1+\frac{n}{2},n_2+\frac{n}{2},n_3+\frac{n}{2}\right) \text{ where } i,j,l= 0 \text{ or } 1.</math>
===== Arithmetic complexity =====
The whole 3-D DCT calculation needs <math>~ [\log_2 N] ~</math> stages, and each stage involves <math>~ \tfrac{1}{8}\ N^3 ~</math> butterflies. The whole 3-D DCT requires <math>~ \left[ \tfrac{1}{8}\ N^3 \log_2 N \right] ~</math> butterflies to be computed. Each butterfly requires seven real multiplications (including trivial multiplications) and 24 real additions (including trivial additions). Therefore, the total number of real multiplications needed for this stage is <math>~ \left[ \tfrac{7}{8}\ N^3\ \log_2 N \right] ~,</math> and the total number of real additions i.e. including the post-additions (recursive additions) which can be calculated directly after the butterfly stage or after the bit-reverse stage are given by<ref name=":0" /> <math>~ \underbrace{\left[\frac{3}{2}N^3 \log_2N\right]}_\text{Real}+\underbrace{\left[\frac{3}{2}N^3 \log_2N-3N^3+3N^2\right]}_\text{Recursive} = \left[\frac{9}{2}N^3 \log_2N-3N^3+3N^2\right] ~.</math>
The conventional method to calculate MD-DCT-II is using a Row-Column-Frame (RCF) approach which is computationally complex and less productive on most advanced recent hardware platforms. The number of multiplications required to compute VR DIF Algorithm when compared to RCF algorithm are quite a few in number. The number of Multiplications and additions involved in RCF approach are given by <math>~\left[\frac{3}{2}N^3 \log_2 N \right]~</math> and <math>~ \left[\frac{9}{2}N^3 \log_2 N - 3N^3 + 3N^2 \right] ~,</math> respectively. From Table 1, it can be seen that the total number
{| class="wikitable sortable"
|+TABLE 1
Comparison of VR DIF & RCF Algorithms for computing 3D-DCT-II
!Transform Size
!3D VR Mults
!RCF Mults
!3D VR Adds
!RCF Adds
|-
|8 × 8 × 8
|2.625
|4.5
|10.875
|10.875
|-
|16 × 16 × 16
|3.5
|6
|15.188
|15.188
|-
|32 × 32 × 32
|4.375
|7.5
|19.594
|19.594
|-
|64 × 64 × 64
|5.25
|9
|24.047
|24.047
|}
of multiplications associated with the 3-D DCT VR algorithm is less than that associated with the RCF approach by more than 40%. In addition, the RCF approach involves matrix transpose and more indexing and data swapping than the new VR algorithm. This makes the 3-D DCT VR algorithm more efficient and better suited for 3-D applications that involve the 3-D DCT-II such as video compression and other 3-D image processing applications.
The main consideration in choosing a fast algorithm is to avoid computational and structural complexities. As the technology of computers and DSPs advances, the execution time of arithmetic operations (multiplications and additions) is becoming very fast, and regular computational structure becomes the most important factor.<ref>{{cite journal |doi=10.1109/78.827550 |title=On the computation of two-dimensional DCT |year=2000 |last1=Guoan Bi |last2=Gang Li |last3=Kai-Kuang Ma |last4=Tan |first4=T.C. |journal=IEEE Transactions on Signal Processing |volume=48 |issue=4 |pages=1171–1183 |bibcode=2000ITSP...48.1171B}}</ref> Therefore, although the above proposed 3-D VR algorithm does not achieve the theoretical lower bound on the number of multiplications,<ref>{{cite journal |doi=10.1109/18.144722 |title=On the multiplicative complexity of discrete cosine transforms |date=July 1992a |last1=Feig |first1=E. |last2=Winograd |first2=S. |journal=IEEE Transactions on Information Theory |volume=38 |issue=4 |pages=1387–1391}}</ref> it has a simpler computational structure as compared to other 3-D DCT algorithms. It can be implemented in place using a single butterfly and possesses the properties of the [[Cooley–Tukey FFT algorithm]] in 3-D. Hence, the 3-D VR presents a good choice for reducing arithmetic operations in the calculation of the 3-D DCT-II, while keeping the simple structure that characterize butterfly-style [[Cooley–Tukey FFT algorithm]]s.
[[File:DCT-8x8.png|thumb|250px|Two-dimensional DCT frequencies from the [[JPEG#Discrete cosine transform|JPEG DCT]]]]
The image to the right shows a combination of horizontal and vertical frequencies for an {{nobr| 8 × 8 }} <math>(~ N_1 = N_2 = 8 ~)</math> two-dimensional DCT. Each step from left to right and top to bottom is an increase in frequency by 1/2 cycle.
For example, moving right one from the top-left square yields a half-cycle increase in the horizontal frequency. Another move to the right yields two half-cycles. A move down yields two half-cycles horizontally and a half-cycle vertically. The source data {{nobr|( 8×8 )}} is transformed to a [[linear combination]] of these 64 frequency squares.
=== MD-DCT-IV ===
The M-D DCT-IV is just an extension of 1-D DCT-IV on to {{mvar|M}} dimensional ___domain. The 2-D DCT-IV of a matrix or an image is given by
:<math> X_{k,\ell} =
\sum_{n=0}^{N-1} \; \sum_{m=0}^{M-1} \ x_{n,m} \cos\left(\ \frac{\,( 2 m + 1 )( 2 k + 1 )\ \pi \,}{4N} \ \right) \cos\left(\ \frac{\, ( 2n + 1 )( 2 \ell + 1 )\ \pi \,}{4M} \ \right) ~,</math>
: for <math>~~ k = 0,\ 1,\ 2\ \ldots\ N-1 ~~</math> and <math>~~ \ell= 0,\ 1,\ 2,\ \ldots\ M-1 ~.</math>
We can compute the MD DCT-IV using the regular row-column method or we can use the polynomial transform method<ref>{{cite book |last=Nussbaumer |first=H.J. |title=Fast Fourier transform and convolution algorithms |publisher=Springer-Verlag |___location=New York |date=1981 |edition=1st }}</ref> for the fast and efficient computation. The main idea of this algorithm is to use the Polynomial Transform to convert the multidimensional DCT into a series of 1-D DCTs directly. MD DCT-IV also has several applications in various fields.
== Computation ==
Line 558 ⟶ 506:
Specialized DCT algorithms, on the other hand, see widespread use for transforms of small, fixed sizes such as the {{nobr| 8 × 8 }} DCT-II used in [[JPEG]] compression, or the small DCTs (or MDCTs) typically used in audio compression. (Reduced code size may also be a reason to use a specialized DCT for embedded-device applications.)
In fact, even the DCT algorithms using an ordinary FFT are sometimes equivalent to pruning the redundant operations from a larger FFT of real-symmetric data, and they can even be optimal from the perspective of arithmetic counts. For example, a type-II DCT is equivalent to a DFT of size <math>~ 4N ~</math> with real-even symmetry whose even-indexed elements are zero. One of the most common methods for computing this via an FFT (e.g. the method used in [[FFTPACK]] and [[Fastest Fourier Transform in the West|FFTW]]) was described by {{harvtxt|Narasimha|Peterson|1978}} and {{harvtxt|Makhoul|1980}}, and this method in hindsight can be seen as one step of a radix-4 decimation-in-time Cooley–Tukey algorithm applied to the "logical" real-even DFT corresponding to the DCT-II.{{efn|
The radix-4 step reduces the size <math>~ 4N ~</math> DFT to four size <math>~ N ~</math> DFTs of real data, two of which are zero, and two of which are equal to one another by the even symmetry. Hence giving a single size <math>~ N ~</math> FFT of real data plus <math>~ \mathcal{O}(N) ~</math> [[butterfly (FFT algorithm)|butterflies]], once the trivial and / or duplicate parts are eliminated and / or merged.
}}
Line 569 ⟶ 517:
==Example of IDCT==
[[File:DCT filter comparison.png|thumb|right|An example showing eight different filters applied to a test image (top left) by multiplying its DCT spectrum (top right) with each filter.]]
Consider this {{resx|8x8}} [[grayscale image]] of capital letter A.
[[File:letter-a-8x8.png|frame|center|Original size, scaled 10x (nearest neighbor), scaled 10x (bilinear).]]
Line 685 ⟶ 633:
* Takuya Ooura: General Purpose FFT Package, [http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html FFT Package 1-dim / 2-dim]. Free C & FORTRAN libraries for computing fast DCTs (types II–III) in one, two or three dimensions, power of 2 sizes.
* Tim Kientzle: Fast algorithms for computing the 8-point DCT and IDCT, [http://drdobbs.com/parallel/184410889 Algorithm Alley].
* [
{{Compression Methods|state=expanded}}
Line 698 ⟶ 646:
[[Category:Data compression]]
[[Category:Image compression]]
[[Category:H.26x]]
[[Category:JPEG]]
|