The modified discrete cosine transform ( MDCT ) is a transform based on the type-IV discrete cosine transform (DCT-IV), with the additional property of being lapped : it is designed to be performed on consecutive blocks of a larger dataset , where subsequent blocks are overlapped so that the last half of one block coincides with the first half of the next block. This overlapping, in addition to the energy-compaction qualities of the DCT, makes the MDCT especially attractive for signal compression applications, since it helps to avoid artifacts stemming from the block boundaries. As a result of these advantages, the MDCT is the most widely used lossy compression technique in audio data compression . It is employed in most modern audio coding standards , including MP3 , Dolby Digital (AC-3), Vorbis (Ogg), Windows Media Audio (WMA), ATRAC , Cook , Advanced Audio Coding (AAC), High-Definition Coding (HDC), LDAC , Dolby AC-4 , and MPEG-H 3D Audio , as well as speech coding standards such as AAC-LD (LD-MDCT), G.722.1 , G.729.1 , CELT , and Opus .
86-583: The discrete cosine transform (DCT) was first proposed by Nasir Ahmed in 1972, and demonstrated by Ahmed with T. Natarajan and K. R. Rao in 1974. The MDCT was later proposed by John P. Princen, A.W. Johnson and Alan B. Bradley at the University of Surrey in 1987, following earlier work by Princen and Bradley (1986) to develop the MDCT's underlying principle of time-domain aliasing cancellation (TDAC), described below. (There also exists an analogous transform,
172-402: A b c d e {\displaystyle a\ b\ c\ d\ e} is exactly equivalent to a DFT of eight real numbers a b c d e d c b {\displaystyle a\ b\ c\ d\ e\ d\ c\ b} (even symmetry), divided by two. (In contrast, DCT types II-IV involve
258-426: A videotelephone scene with image quality comparable to an intra-frame coder requiring 2-bit per pixel. In 1979, Anil K. Jain and Jaswant R. Jain further developed motion-compensated DCT video compression, also called block motion compensation. This led to Chen developing a practical video compression algorithm, called motion-compensated DCT or adaptive scene coding, in 1981. Motion-compensated DCT later became
344-1016: A . This is the reason for using a window function that reduces the components near the boundaries of the input sequence ( a , b , c , d ) towards 0. Above, the TDAC property was proved for the ordinary MDCT, showing that adding IMDCTs of subsequent blocks in their overlapping half recovers the original data. The derivation of this inverse property for the windowed MDCT is only slightly more complicated. Consider to overlapping consecutive sets of 2 N inputs ( A , B ) and ( B , C ), for blocks A , B , C of size N . Recall from above that when ( A , B ) {\displaystyle (A,B)} and ( B , C ) {\displaystyle (B,C)} are MDCTed, IMDCTed, and added in their overlapping half, we obtain ( B + B R ) / 2 + ( B − B R ) / 2 = B {\displaystyle (B+B_{R})/2+(B-B_{R})/2=B} ,
430-610: 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 quantized . This process can cause blocking artifacts, primarily at high data compression ratios . This can also cause the mosquito noise effect, commonly found in digital video . DCT blocks are often used in glitch art . The artist Rosa Menkman makes use of DCT-based compression artifacts in her glitch art, particularly
516-401: A continuous extension at the boundaries (although the slope is generally discontinuous). This is why DCTs, and in particular DCTs of types I, II, V, and VI (the types that have two even boundaries) generally perform better for signal compression than DFTs and DSTs. In practice, a type-II DCT is usually preferred for such applications, in part for reasons of computational convenience. Formally,
602-406: 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. 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
688-829: A finite sequence of data points in terms of a sum of cosine functions oscillating at different frequencies . The DCT, first proposed by 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 H.26x ), digital audio (such as Dolby Digital , MP3 and AAC ), digital television (such as SDTV , HDTV and VOD ), digital radio (such as AAC+ and DAB+ ), and speech coding (such as AAC-LD , Siren and 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 methods for
774-485: A function over a finite 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 f ( x ) {\displaystyle f(x)} as a sum of sinusoids, you can evaluate that sum at any x {\displaystyle x} , even for x {\displaystyle x} where
860-697: A half-sample shift in the equivalent DFT.) Note, however, that the DCT-I is not defined for N {\displaystyle N} less than 2, while all other DCT types are defined for any positive N . {\displaystyle N.} Thus, the DCT-I corresponds to the boundary conditions: x n {\displaystyle x_{n}} is even around n = 0 {\displaystyle n=0} and even around n = N − 1 {\displaystyle n=N-1} ; similarly for X k . {\displaystyle X_{k}.} The DCT-II
946-423: A hybrid DCT- FFT algorithm), Advanced Audio Coding (AAC), and Vorbis ( Ogg ). Nasir Ahmed also developed a lossless DCT algorithm with Giridhar Mandyam and Neeraj Magotra at the University of New Mexico in 1995. This allows the DCT technique to be used for lossless compression of images. It is a modification of the original DCT algorithm, and incorporates elements of inverse DCT and delta modulation . It
SECTION 10
#17327725172461032-399: A length-one DFT (odd length) of a single number a , corresponds to a DCT-V of length N = 1. {\displaystyle N=1.} ) 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. Like for
1118-475: A scaling can be chosen that allows the DCT to be computed with fewer multiplications. The DCT-II implies the boundary conditions: x n {\displaystyle x_{n}} is even around n = − 1 / 2 {\displaystyle n=-1/2} and even around n = N − 1 / 2 ; {\displaystyle n=N-1/2\,;} X k {\displaystyle X_{k}}
1204-414: Is a more effective lossless compression algorithm than entropy coding . Lossless DCT is also known as LDCT. The DCT is the most widely used transformation technique in signal processing , and by far the most widely used linear transform in data compression . Uncompressed digital media as well as lossless compression have high memory and bandwidth requirements, which is significantly reduced by
1290-478: Is also possible using 2 N signal followed by a multiplication by half shift. This is demonstrated by Makhoul . Some authors further multiply the X 0 {\displaystyle X_{0}} term by 1 / N {\displaystyle 1/{\sqrt {N\,}}\,} and multiply the rest of the matrix by an overall scale factor of 2 / N {\textstyle {\sqrt {{2}/{N}}}} (see below for
1376-509: Is by far the most commonly used format for the recording, compression and distribution of video content, used by 91% of video developers, followed by HEVC which is used by 43% of developers. Multidimensional DCTs (MD DCTs) have several applications, mainly 3-D DCTs such as the 3-D DCT-II, which has several new applications like Hyperspectral Imaging coding systems, variable temporal length 3-D DCT coding, video coding algorithms, adaptive video coding and 3-D Compression. Due to enhancement in
1462-596: Is designed to be suitable for use with the modified discrete cosine transform (MDCT). The KBD window function is defined in terms of the Kaiser window of length N +1, by the formula : This defines a window of length 2 N , where by construction d n satisfies the Princen-Bradley condition for the MDCT (using the fact that w N − n = w n ): d n + ( d n + N ) = 1 (interpreting n and n + N modulo 2 N ). The KBD window
1548-433: Is equivalent to a DCT-IV of the N inputs (− c R − d , a − b R ). The DCT-IV is designed for the case where the function at the right boundary is odd, and therefore the values near the right boundary are close to 0. If the input signal is smooth, this is the case: the rightmost components of a and b R are consecutive in the input sequence ( a , b , c , d ), and therefore their difference
1634-615: Is even around k = 0 {\displaystyle k=0} and odd around k = N . {\displaystyle k=N.} Because it is the inverse of DCT-II up to a scale factor (see below), this form is sometimes simply referred to as "the inverse DCT" ("IDCT"). Some authors divide the x 0 {\displaystyle x_{0}} term by 2 {\displaystyle {\sqrt {2}}} instead of by 2 (resulting in an overall x 0 / 2 {\displaystyle x_{0}/{\sqrt {2}}} term) and multiply
1720-677: Is even around n = 0 {\displaystyle n=0} and odd around n = N ; {\displaystyle n=N;} X k {\displaystyle X_{k}} is even around k = − 1 / 2 {\displaystyle k=-1/2} and even around k = N − 1 / 2. {\displaystyle k=N-1/2.} The DCT-IV matrix becomes orthogonal (and thus, being clearly symmetric, its own inverse) if one further multiplies by an overall scale factor of 2 / N . {\textstyle {\sqrt {2/N}}.} A variant of
1806-543: Is even or odd), since the corresponding DFT is of length 2 ( N − 1 ) {\displaystyle 2(N-1)} (for DCT-I) or 4 N {\displaystyle 4N} (for DCT-II & III) or 8 N {\displaystyle 8N} (for DCT-IV). The four additional types of discrete cosine transform correspond essentially to real-even DFTs of logically odd order, which have factors of N ± 1 / 2 {\displaystyle N\pm {1}/{2}} in
SECTION 20
#17327725172461892-440: Is now called the type-II DCT (DCT-II), as well as the type-III inverse DCT (IDCT). Since its introduction in 1974, there has been significant research on the DCT. In 1977, Wen-Hsiung Chen published a paper with C. Harrison Smith and Stanley C. Fralick presenting a fast DCT algorithm. Further developments include a 1978 paper by M. J. Narasimha and A. M. Peterson, and a 1984 paper by B. G. Lee. These research papers, along with
1978-715: Is optimal in the decorrelation sense). As explained below, this stems from the boundary conditions implicit in the cosine functions. DCTs are widely employed in solving partial differential equations by spectral methods , where the different variants of the DCT correspond to slightly different even and odd boundary conditions at the two ends of the array. DCTs are closely related to Chebyshev polynomials , and fast DCT algorithms (below) are used in Chebyshev approximation of arbitrary functions by series of Chebyshev polynomials, for example in Clenshaw–Curtis quadrature . The DCT
2064-1147: Is probably the most commonly used form, and is often simply referred to as "the DCT". This transform is exactly equivalent (up to an overall scale factor of 2) to a DFT of 4 N {\displaystyle 4N} real inputs of even symmetry where the even-indexed elements are zero. That is, it is half of the DFT of the 4 N {\displaystyle 4N} inputs y n , {\displaystyle y_{n},} where y 2 n = 0 , {\displaystyle y_{2n}=0,} y 2 n + 1 = x n {\displaystyle y_{2n+1}=x_{n}} for 0 ≤ n < N , {\displaystyle 0\leq n<N,} y 2 N = 0 , {\displaystyle y_{2N}=0,} and y 4 N − n = y n {\displaystyle y_{4N-n}=y_{n}} for 0 < n < 2 N . {\displaystyle 0<n<2N.} DCT-II transformation
2150-400: Is small. Let us look at the middle of the interval: if we rewrite the above expression as (− c R − d , a − b R ) = (− d , a )−( b , c ) R , the second term, ( b , c ) R , gives a smooth transition in the middle. However, in the first term, (− d , a ), there is a potential discontinuity where the right end of − d meets the left end of
2236-544: Is widely implemented in digital signal processors (DSP), as well as digital signal processing software. Many companies have developed DSPs based on DCT technology. DCTs are widely used for applications such as encoding , decoding, video, audio, multiplexing , control signals, signaling , and analog-to-digital conversion . DCTs are also commonly used for high-definition television (HDTV) encoder/decoder chips . A common issue with DCT compression in digital media are blocky compression artifacts , caused by DCT blocks. In
2322-412: Is widely used in many applications, which include the following. The DCT-II is an important image compression technique. It is used in image compression standards such as JPEG , and video compression standards such as H.26x , MJPEG , MPEG , DV , Theora and Daala . There, the two-dimensional DCT-II of N × N {\displaystyle N\times N} blocks are computed and
2408-423: The DFT , the normalization factor in front of these transform definitions is merely a convention and differs between treatments. For example, some authors multiply the transforms by 2 / N {\textstyle {\sqrt {2/N}}} so that the inverse does not require any additional multiplicative factor. Combined with appropriate factors of √ 2 (see above), this can be used to make
2494-487: The DPSS window which maximizes the energy concentration in the main lobe but which is difficult to compute. The Kaiser window and its Fourier transform are given by : where : For digital signal processing , the function can be sampled symmetrically as : where the length of the window is N + 1 , {\displaystyle N+1,} and N can be even or odd. (see A list of window functions ) In
2580-539: The N real numbers X 0 , ..., X N -1 according to the formula: (The normalization coefficient in front of this transform, here unity, is an arbitrary convention and differs between treatments. Only the product of the normalizations of the MDCT and the IMDCT, below, is constrained.) The inverse MDCT is known as the IMDCT . Because there are different numbers of inputs and outputs, at first glance it might seem that
2666-525: The DCT lossy compression technique, capable of achieving data compression ratios from 8:1 to 14:1 for near-studio-quality, up to 100:1 for acceptable-quality content. DCT compression standards are used in digital media technologies, such as digital images , digital photos , digital video , streaming media , digital television , streaming television , video on demand (VOD), digital cinema , high-definition video (HD video), and high-definition television (HDTV). The DCT, and in particular
Modified discrete cosine transform - Misplaced Pages Continue
2752-403: The DCT blocks found in most digital media formats such as JPEG digital images and MP3 audio. Another example is Jpegs by German photographer Thomas Ruff , which uses intentional JPEG artifacts as the basis of the picture's style. Like any Fourier-related transform, DCTs express a function or a signal in terms of a sum of sinusoids with different frequencies and amplitudes . Like
2838-450: The DCT with slightly modified definitions. The N real numbers x 0 , … x N − 1 {\displaystyle ~x_{0},\ \ldots \ x_{N-1}~} are transformed into the N real numbers X 0 , … , X N − 1 {\displaystyle X_{0},\,\ldots ,\,X_{N-1}} according to one of
2924-643: The DCT, is used in Advanced Video Coding (AVC), introduced in 2003, and High Efficiency Video Coding (HEVC), introduced in 2013. The integer DCT is also used in the High Efficiency Image Format (HEIF), which uses a subset of the HEVC video coding format for coding still images. AVC uses 4 x 4 and 8 x 8 blocks. HEVC and HEIF use varied block sizes between 4 x 4 and 32 x 32 pixels . As of 2019 , AVC
3010-388: The DCT-I matrix orthogonal but breaks the direct correspondence with a real-even DFT . The DCT-I is exactly equivalent (up to an overall scale factor of 2), to a DFT of 2 ( N − 1 ) {\displaystyle 2(N-1)} real numbers with even symmetry. For example, a DCT-I of N = 5 {\displaystyle N=5} real numbers
3096-522: The DCT-II, is often used in signal and image processing, especially for lossy compression, because it has a strong energy compaction property. In typical applications, most of the signal information tends to be concentrated in a few low-frequency components of the DCT. For strongly correlated Markov processes , the DCT can approach the compaction efficiency of the Karhunen-Loève transform (which
3182-655: The DCT-IV, where data from different transforms are overlapped , is called the modified discrete cosine transform (MDCT). The DCT-IV implies the boundary conditions: x n {\displaystyle x_{n}} is even around n = − 1 / 2 {\displaystyle n=-1/2} and odd around n = N − 1 / 2 ; {\displaystyle n=N-1/2;} similarly for X k . {\displaystyle X_{k}.} DCTs of types I–IV treat both boundaries consistently regarding
3268-483: The DFT, a DCT operates on a function at a finite number of discrete data points . The obvious distinction between a DCT and a DFT is that the former uses only cosine functions, while the latter uses both cosines and sines (in the form of complex exponentials ). However, this visible difference is merely a consequence of a deeper distinction: a DCT implies different boundary conditions from the DFT or other related transforms. The Fourier-related transforms that operate on
3354-480: The Fourier transform, the first null after the main lobe occurs at f = 1 + α 2 L , {\displaystyle f={\tfrac {\sqrt {1+\alpha ^{2}}}{L}},} which is just 1 + α 2 {\displaystyle {\sqrt {1+\alpha ^{2}}}} in units of N ( DFT "bins" ). As α increases, the main lobe increases in width, and
3440-402: The IMDCT formula above is precisely 1/2 of the DCT-IV (which is its own inverse), where the output is extended (via the boundary conditions) to a length 2 N and shifted back to the left by N /2. The inverse DCT-IV would simply give back the inputs (− c R − d , a − b R ) from above. When this is extended via the boundary conditions and shifted, one obtains: Half of
3526-484: The IMDCT outputs are thus redundant, as b − a R = −( a − b R ) R , and likewise for the last two terms. If we group the input into bigger blocks A , B of size N , where A = ( a , b ) and B = ( c , d ), we can write this result in a simpler way: One can now understand how TDAC works. Suppose that one computes the MDCT of the subsequent, 50% overlapped, 2 N block ( B , C ). The IMDCT will then yield, analogous to
Modified discrete cosine transform - Misplaced Pages Continue
3612-462: The IMDCT.) In principle, x and y could have different window functions, and the window function could also change from one block to the next (especially for the case where data blocks of different sizes are combined), but for simplicity we consider the common case of identical window functions for equal-sized blocks. The transform remains invertible (that is, TDAC works), for a symmetric window w n = w 2 N −1− n , as long as w satisfies
3698-476: The MDCT is somewhat unusual compared to other Fourier-related transforms in that it has half as many outputs as inputs (instead of the same number). In particular, it is a linear function F : R 2 N → R N {\displaystyle F\colon \mathbf {R} ^{2N}\to \mathbf {R} ^{N}} (where R denotes the set of real numbers ). The 2 N real numbers x 0 , ..., x 2 N -1 are transformed into
3784-422: The MDCT should not be invertible. However, perfect invertibility is achieved by adding the overlapped IMDCTs of subsequent overlapping blocks, causing the errors to cancel and the original data to be retrieved; this technique is known as time-domain aliasing cancellation ( TDAC ). The IMDCT transforms N real numbers X 0 , ..., X N -1 into 2 N real numbers y 0 , ..., y 2 N -1 according to
3870-456: The MDST, based on the discrete sine transform , as well as other, rarely used, forms of the MDCT based on different types of DCT or DCT/DST combinations.) In MP3, the MDCT is not applied to the audio signal directly, but rather to the output of a 32-band polyphase quadrature filter (PQF) bank. The output of this MDCT is postprocessed by an alias reduction formula to reduce the typical aliasing of
3956-449: The PQF filter bank. Such a combination of a filter bank with an MDCT is called a hybrid filter bank or a subband MDCT. AAC, on the other hand, normally uses a pure MDCT; only the (rarely used) MPEG-4 AAC-SSR variant (by Sony ) uses a four-band PQF bank followed by an MDCT. Similar to MP3, ATRAC uses stacked quadrature mirror filters (QMF) followed by an MDCT. As a lapped transform,
4042-442: The Princen-Bradley condition: Various window functions are used. A window that produces a form known as a modulated lapped transform (MLT) is given by and is used for MP3 and MPEG-2 AAC, and for Vorbis. AC-3 uses a Kaiser–Bessel derived (KBD) window , and MPEG-4 AAC can also use a KBD window. Note that windows applied to the MDCT are different from windows used for some other types of signal analysis, since they must fulfill
4128-547: The Princen–Bradley condition. One of the reasons for this difference is that MDCT windows are applied twice, for both the MDCT (analysis) and the IMDCT (synthesis). As can be seen by inspection of the definitions, for even N the MDCT is essentially equivalent to a DCT-IV, where the input is shifted by N /2 and two N -blocks of data are transformed at once. By examining this equivalence more carefully, important properties like TDAC can be easily derived. In order to define
4214-413: The above: ( B − B R , C + C R ) / 2. When this is added with the previous IMDCT result in the overlapping half, the reversed terms cancel and one obtains simply B , recovering the original data. The origin of the term "time-domain aliasing cancellation" is now clear. The use of input data that extend beyond the boundaries of the logical DCT-IV causes the data to be aliased in
4300-399: The boundary conditions are responsible for the "energy compactification" properties that make DCTs useful for image and audio compression, because the boundaries affect the rate of convergence of any Fourier-like series. In particular, it is well known that any discontinuities in a function reduce the rate of convergence of the Fourier series, so that more sinusoids are needed to represent
4386-527: The columns (or vice versa). That is, the 2D DCT-II is given by the formula (omitting normalization and other scale factors, as above): Kaiser window#Kaiser–Bessel-derived (KBD) window The Kaiser window , also known as the Kaiser–Bessel window , was developed by James Kaiser at Bell Laboratories . It is a one-parameter family of window functions used in finite impulse response filter design and spectral analysis . The Kaiser window approximates
SECTION 50
#17327725172464472-533: The combinations to cancel when they are added. For odd N (which are rarely used in practice), N /2 is not an integer so the MDCT is not simply a shift permutation of a DCT-IV. In this case, the additional shift by half a sample means that the MDCT/IMDCT becomes equivalent to the DCT-III/II, and the analysis is analogous to the above. We have seen above that the MDCT of 2 N inputs ( a , b , c , d )
4558-459: The concept of DCT to multidimensional signals. A variety of fast algorithms have been developed to reduce the computational complexity of implementing DCT. One of these is the integer DCT (IntDCT), an integer approximation of the standard DCT, used in several ISO/IEC and ITU-T international standards. DCT compression, also known as block compression, compresses data in sets of discrete DCT blocks. DCT blocks sizes including 8x8 pixels for
4644-515: The corresponding change in DCT-III). This makes the DCT-II matrix orthogonal , but breaks the direct correspondence with a real-even DFT of half-shifted input. This is the normalization used by Matlab , for example, see. In many applications, such as JPEG , the scaling is arbitrary because scale factors can be combined with a subsequent computational step (e.g. the quantization step in JPEG ), and
4730-432: 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). These choices lead to all the standard variations of DCTs and also discrete sine transforms (DSTs). Each boundary can be either even or odd (2 choices per boundary) and can be symmetric about
4816-466: The denominators of the cosine arguments. However, these variants seem to be rarely used in practice. One reason, perhaps, is that FFT algorithms for odd-length DFTs are generally more complicated than 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. (The trivial real-even array,
4902-402: The discrete cosine transform is a linear , invertible function f : R N → R N {\displaystyle f:\mathbb {R} ^{N}\to \mathbb {R} ^{N}} (where R {\displaystyle \mathbb {R} } denotes the set of real numbers ), or equivalently an invertible N × N square matrix . There are several variants of
4988-469: The formula: (Like for the DCT-IV , an orthogonal transform, the inverse has the same form as the forward transform.) In the case of a windowed MDCT with the usual window normalization (see below), the normalization coefficient in front of the IMDCT should be multiplied by 2 (i.e., becoming 2/ N ). Although the direct application of the MDCT formula would require O( N ) operations, it is possible to compute
5074-775: The formulas: Some authors further multiply the x 0 {\displaystyle x_{0}} and x N − 1 {\displaystyle x_{N-1}} terms by 2 , {\displaystyle {\sqrt {2\,}}\,,} and correspondingly multiply the X 0 {\displaystyle X_{0}} and X N − 1 {\displaystyle X_{N-1}} terms by 1 / 2 , {\displaystyle 1/{\sqrt {2\,}}\,,} which, if one further multiplies by an overall scale factor of 2 N − 1 , {\displaystyle {\sqrt {{\tfrac {2}{N-1\,}}\,}},} , makes
5160-411: 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
5246-501: The function with a given accuracy. The same principle governs the usefulness of the DFT and other transforms for signal compression; the smoother a function is, the fewer terms in its DFT or DCT are required to represent it accurately, and the more it can be compressed. (Here, we think of the DFT or DCT as approximations for the Fourier series or cosine series of a function, respectively, in order to talk about its "smoothness".) However,
SECTION 60
#17327725172465332-408: The hardware, software and introduction of several fast algorithms, the necessity of using MD DCTs is rapidly increasing. DCT-IV has gained popularity for its applications in fast implementation of real-valued polyphase filtering banks, lapped orthogonal transform and cosine-modulated wavelet bases. DCT plays an important role in digital signal processing specifically data compression . The DCT
5418-489: The implicit periodicity of the DFT means that discontinuities usually occur at the boundaries: any random segment of a signal is unlikely to have the same value at both the left and right boundaries. (A similar problem arises for the DST, in which the odd left boundary condition implies a discontinuity for any function that does not happen to be zero at that boundary.) In contrast, a DCT where both boundaries are even always yields
5504-409: The inputs into four blocks ( a , b , c , d ) each of size N /2. If we shift these to the right by N /2 (from the + N /2 term in the MDCT definition), then ( b , c , d ) extend past the end of the N DCT-IV inputs, so we must "fold" them back according to the boundary conditions described above. (In this way, any algorithm to compute the DCT-IV can be trivially applied to the MDCT.) Similarly,
5590-400: The length, operating on real data with even symmetry (since the Fourier transform of a real and even function is real and even), whereas in some variants the input or output data are shifted by half a sample. There are eight standard DCT variants, of which four are common. The most common variant of discrete cosine transform is the type-II DCT, which is often called simply the DCT . This was
5676-421: The multiplication by 1/2, because the IMDCT normalization differs by a factor of 2 in the windowed case.) Similarly, the windowed MDCT and IMDCT of ( B , C ) {\displaystyle (B,C)} yields, in its first- N half: When we add these two halves together, we obtain: recovering the original data. Discrete cosine transform A discrete cosine transform ( DCT ) expresses
5762-442: The numerical solution of partial differential equations . A DCT is a Fourier-related transform similar to the discrete Fourier transform (DFT), but using only real numbers . The DCTs are generally related to Fourier series coefficients of a periodically and symmetrically extended sequence whereas DFTs are related to Fourier series coefficients of only periodically extended sequences. DCTs are equivalent to DFTs of roughly twice
5848-447: The original f ( x ) {\displaystyle f(x)} was not specified. The DFT, like the Fourier series, implies a periodic extension of the original function. A DCT, like a cosine transform , implies an even extension of the original function. 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
5934-556: 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. The discrete sine transform (DST) was derived from the DCT, by replacing the Neumann condition at x=0 with a Dirichlet condition . The DST was described in the 1974 DCT paper by Ahmed, Natarajan and Rao. A type-I DST (DST-I)
6020-476: The original DCT as first proposed by Ahmed. Its inverse, the type-III DCT, is correspondingly often called simply the inverse DCT or the IDCT . Two related transforms are the discrete sine transform (DST), which is equivalent to a DFT of real and odd functions , and the modified discrete cosine transform (MDCT), which is based on a DCT of overlapping data. Multidimensional DCTs (MD DCTs) are developed to extend
6106-600: The original data. Now we suppose that we multiply both the MDCT inputs and the IMDCT outputs by a window function of length 2 N . As above, we assume a symmetric window function, which is therefore of the form ( W , W R ) {\displaystyle (W,W_{R})} where W is a length- N vector and R denotes reversal as before. Then the Princen-Bradley condition can be written as W 2 + W R 2 = ( 1 , 1 , … ) {\displaystyle W^{2}+W_{R}^{2}=(1,1,\ldots )} , with
6192-452: 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 DFTs of even order (regardless of whether N {\displaystyle N}
6278-1823: The precise relationship to the DCT-IV, one must realize that the DCT-IV corresponds to alternating even/odd boundary conditions: even at its left boundary (around n = −1/2), odd at its right boundary (around n = N − 1/2), and so on (instead of periodic boundaries as for a DFT ). This follows from the identities cos [ π N ( − n − 1 + 1 2 ) ( k + 1 2 ) ] = cos [ π N ( n + 1 2 ) ( k + 1 2 ) ] {\displaystyle \cos \left[{\frac {\pi }{N}}\left(-n-1+{\frac {1}{2}}\right)\left(k+{\frac {1}{2}}\right)\right]=\cos \left[{\frac {\pi }{N}}\left(n+{\frac {1}{2}}\right)\left(k+{\frac {1}{2}}\right)\right]} and cos [ π N ( 2 N − n − 1 + 1 2 ) ( k + 1 2 ) ] = − cos [ π N ( n + 1 2 ) ( k + 1 2 ) ] {\displaystyle \cos \left[{\frac {\pi }{N}}\left(2N-n-1+{\frac {1}{2}}\right)\left(k+{\frac {1}{2}}\right)\right]=-\cos \left[{\frac {\pi }{N}}\left(n+{\frac {1}{2}}\right)\left(k+{\frac {1}{2}}\right)\right]} . Thus, if its inputs are an array x of length N , we can imagine extending this array to ( x , − x R , − x , x R , ...) and so on, where x R denotes x in reverse order. Consider an MDCT with 2 N inputs and N outputs, where we divide
6364-579: The resulting matrix by an overall scale factor of 2 / N {\textstyle {\sqrt {2/N}}} (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 , but breaks the direct correspondence with a real-even DFT of half-shifted output. The DCT-III implies the boundary conditions: x n {\displaystyle x_{n}}
6450-611: The results are quantized and entropy coded . In this case, N {\displaystyle N} is typically 8 and the DCT-II formula is applied to each row and column of the block. The result is an 8 × 8 transform coefficient array in which the ( 0 , 0 ) {\displaystyle (0,0)} element (top-left) is the DC (zero-frequency) component and entries with increasing vertical and horizontal index values represent higher vertical and horizontal spatial frequencies. The integer DCT, an integer approximation of
6536-447: The same thing with only O( N log N ) complexity by recursively factorizing the computation, as in the fast Fourier transform (FFT). One can also compute MDCTs via other transforms, typically a DFT (FFT) or a DCT, combined with O( N ) pre- and post-processing steps. Also, as described below, any algorithm for the DCT-IV immediately provides a method to compute the MDCT and IMDCT of even size. In typical signal-compression applications,
6622-457: The same way that frequencies beyond the Nyquist frequency are aliased to lower frequencies, except that this aliasing occurs in the time domain instead of the frequency domain: we cannot distinguish the contributions of a and of b R to the MDCT of ( a , b , c , d ), or equivalently, to the result of The combinations c − d R and so on, have precisely the right signs for
6708-501: The side lobes decrease in amplitude. α = 0 corresponds to a rectangular window. For large α, the shape of the Kaiser window (in both time and frequency domain) tends to a Gaussian curve. The Kaiser window is nearly optimal in the sense of its peak's concentration around frequency 0. {\displaystyle 0.} A related window function is the Kaiser–Bessel-derived (KBD) window, which
6794-451: The squares and additions performed elementwise. Therefore, instead of MDCTing ( A , B ) {\displaystyle (A,B)} , we now MDCT ( W A , W R B ) {\displaystyle (WA,W_{R}B)} (with all multiplications performed elementwise). When this is IMDCTed and multiplied again (elementwise) by the window function, the last- N half becomes: (Note that we no longer have
6880-425: The standard DCT, and varied integer DCT sizes between 4x4 and 32x32 pixels. The DCT has a strong energy compaction property, capable of achieving high quality at high data compression ratios . However, blocky compression artifacts can appear when heavy DCT compression is applied. The DCT was first conceived by Nasir Ahmed , T. Natarajan and K. R. Rao while working at Kansas State University . The concept
6966-424: The standard coding technique for video compression from the late 1980s onwards. A DCT variant, the modified discrete cosine transform (MDCT), was developed by John P. Princen, A.W. Johnson and Alan B. Bradley at the University of Surrey in 1987, following earlier work by Princen and Bradley in 1986. The MDCT is used in most modern audio compression formats, such as Dolby Digital (AC-3), MP3 (which uses
7052-400: The transform matrix orthogonal . 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. 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
7138-416: The transform properties are further improved by using a window function w n ( n = 0, ..., 2 N −1) that is multiplied with x n in the MDCT and with y n in the IMDCT formulas, above, in order to avoid discontinuities at the n = 0 and 2 N boundaries by making the function go smoothly to zero at those points. (That is, the window function is applied to the data before the MDCT or after
7224-467: The various DCT types. Most directly, when using Fourier-related transforms to solve partial differential equations by spectral methods , the boundary conditions are directly specified as a part of the problem being solved. Or, for the MDCT (based on the type-IV DCT), the boundary conditions are intimately involved in the MDCT's critical property of time-domain aliasing cancellation. In a more subtle fashion,
7310-514: Was later described by Anil K. Jain in 1976, and a type-II DST (DST-II) was then described by H.B. Kekra and J.K. Solanka in 1978. In 1975, John A. Roese and Guner S. Robinson adapted the DCT for inter-frame motion-compensated video coding . They experimented with the DCT and the fast Fourier transform (FFT), developing inter-frame hybrid coders for both, and found that the DCT is the most efficient due to its reduced complexity, capable of compressing image data down to 0.25- bit per pixel for
7396-507: Was proposed to the National Science Foundation in 1972. The DCT was originally intended for image compression . Ahmed developed a practical DCT algorithm with his PhD students T. Raj Natarajan, Wills Dietrich, and Jeremy Fries, and his friend Dr. K. R. Rao at the University of Texas at Arlington in 1973. They presented their results in a January 1974 paper, titled Discrete Cosine Transform . It described what
#245754