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). 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 2D DCT-II is given by the formula (omitting normalization and other scale factors, as above) : \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} 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 : 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. The inverse of
3-D DCT-II is
3-D DCT-III and can be computed from the formula : 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. 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
multidimensional FFT algorithms, however, there exist other methods to compute the same thing while performing the computations in a different order (i.e., interleaving or combining the algorithms for the different dimensions). Owing to the rapid growth in the applications based on the 3-D DCT, several fast algorithms have been 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. Vector-Radix Decimation in Frequency (VR DIF) is an example of an algorithm to compute a 3-D DCT-II efficiently.
3-D DCT-II VR DIF In order to apply the VR DIF algorithm, the input data must be formulated and rearranged as follows. The transform size
N × N × N is assumed to be 2. : \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} :where 0\leq n_1,n_2,n_3 \leq \frac{N}{2} -1 The adjacent figure 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 c(\varphi_i)=\cos(\varphi_i). The original 3-D DCT-II can now be written as :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) :where \varphi_i= \frac{\pi}{2N}(4N_i+1),\text{ and } i= 1,2,3. If the even and the odd parts of k_1,k_2 and k_3 are considered, the general formula for the calculation of the 3-D DCT-II can be expressed as :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)) : where :: \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) :: +(-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) :: +(-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) :: +(-1)^{i+l}\tilde{x}\left(n_1+\frac{n}{2},n_2,n_3+\frac{n}{3}\right) :: +(-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.
Arithmetic complexity The whole 3-D DCT calculation needs ~ [\log_2 N] ~ stages, and each stage involves ~ \tfrac{1}{8}\ N^3 ~ butterflies. The whole 3-D DCT requires ~ \left[ \tfrac{1}{8}\ N^3 \log_2 N \right] ~ 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 ~ \left[ \tfrac{7}{8}\ N^3\ \log_2 N \right] ~, 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 Therefore, although the above proposed 3-D VR algorithm does not achieve the theoretical lower bound on the number of multiplications, 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 characterizes butterfly-style Cooley–Tukey FFT algorithms. The image to the right shows a combination of horizontal and vertical frequencies for an (~ N_1 = N_2 = 8 ~) two-dimensional DCT. Each step from left to right and top to bottom is an increase in frequency by a half-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 () 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 -dimensional domain. The 2-D DCT-IV of a matrix or an image is given by : 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) ~, : for ~~ k = 0,\ 1,\ 2\ \ldots\ N-1 ~~ and ~~ \ell= 0,\ 1,\ 2,\ \ldots\ M-1 ~. We can compute the MD DCT-IV using the regular row-column method or we can use the polynomial transform method 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 ==