zoukankan      html  css  js  c++  java
  • Discrete cosine transform(离散余弦转换)

    A discrete cosine transform (DCT) expresses a finite sequence of data points in terms of a sum of cosine functions oscillating at different frequencies. DCTs are important to numerous applications in science and engineering, from lossy compression of audio (e.g. MP3) and images (e.g. JPEG) (where small high-frequency components can be discarded), to spectral methods for the numerical solution of partial differential equations. The use of cosine rather than sine functions is critical for compression, since it turns out (as described below) that fewer cosine functions are needed to approximate a typical signal, whereas for differential equations the cosines express a particular choice of boundary conditions.

    离散余弦变换(DCT)以不同频率振荡的余弦函数之和来表示数据点的有限序列。DCT对科学和工程中的很多应用都很重要,从音频(例如MP3)和图像(例如JPEG)的有损压缩(其中可以丢弃小的高频分量),到偏微分方程数值解的谱方法。使用余弦函数而不是正弦函数这一点至关重要,因为事实证明(如下所述)近似典型信号需要较少的余弦函数,而对于微分方程,余弦表示了边界条件的特定选择。

    In particular, 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 a periodically extended sequence. DCTs are equivalent to DFTs of roughly twice 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 and/or output data are shifted by half a sample. There are eight standard DCT variants, of which four are common.

    特别地,DCT是类似于离散傅立叶变换(DFT)的傅立叶相关变换,但仅使用实数。DCT一般与周期并对称扩展序列的傅立叶级数系数有关,而DFT与周期扩展序列的傅立叶级数系数有关。DCT相当于长度的大约两倍的DFT,对偶对称的实数据进行操作(因为实函数和偶函数的傅里叶变换是实函数和偶函数),而在一些变型中,输入和/或输出数据被半个样本移位。有八种标准的DCT变体,其中四种是常见的。

    The most common variant of discrete cosine transform is the type-II DCT, which is often called simply "the DCT".[1][2] 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 oddfunctions, and the modified discrete cosine transform (MDCT), which is based on a DCT of overlapping data. Multidimensional DCTs (MD DCTs) are developed to extend the concept of DCT on MD Signals. There are several algorithms to compute MD DCT. A new variety of fast algorithms are also developed to reduce the computational complexity of implementing DCT.

    离散余弦变换最常见的变形是DCT II型,他经常被简单地称为“DCT算法”。它的逆,DCT III型,相应地通常被简单地称为“逆DCT”或“IDCT”。两个相关的变换是离散正弦变换(DST)和基于重叠数据DCT的修正离散余弦变换(MDCT)。多维DCT(MD DCTs)被开发出来用来扩展了DCT在MD信号上的概念。有多种计算MD DCT的算法。还开发了一种新的快速算法,以减少实现DCT的计算复杂度。

    目录

    1Applications 应用

         1.1JPEG JPEG

    2Informal overview 非正式概述

    3Formal definition 正式定义

       3.1DCT-I DCT-I

       3.2DCT-II DCT-II

       3.3DCT-III DCT-III

       3.4DCT-IV DCT-IV

       3.5DCT V-VIII DCT V-VIII

    4Inverse transforms 逆转换

    5Multidimensional DCTs 多维DCT

       5.1M-D DCT-II M-D DCT-II

         5.1.13-D DCT-II VR DIF 3-D DCT-II VR DIF

           5.1.1.1Arithmetic complexity 算术复杂性

        5.2MD-DCT-IV MD-DCT-IV

    6Computation 计算

    7Example of IDCT IDCT的例子

    8See also 另外

    9Notes 注意

    10Citations 引用

    11References 参考

    12Further reading 额外阅读

    13External links 外部链接

     

    1. Applications 应用

    The DCT, and in particular the DCT-II, is often used in signal and image processing, especially for lossy compression, because it has a strong "energy compaction" property:[1][2] 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 is optimal in the decorrelation sense). As explained below, this stems from the boundary conditions implicit in the cosine functions.

    DCT,尤其是DCT-II,经常应用在信号和图像处理,尤其是有损压缩,因为它具有很强的“能量压缩”特性:在典型的应用中,大多数信号信息往往集中在DCT的几个低频分量中。对于强关联马尔可夫过程,DCT可以接近Karhunen-Loève变换的压缩效率(这在解相关意义上的最优的)。如下文所解释的,这源于余弦函数中隐含的边界条件。

    A related transform, the modified discrete cosine transform, or MDCT (based on the DCT-IV), is used in AAC, Vorbis, WMA, and MP3 audio compression.

    一种相关的变换,修正的离散余弦转换,或者MDCT(基于DCT-IV),用在AAC,Vorbis,WMA和MP3音频压缩。

    DCTs are also widely employed in solving partial differential equations by spectral methods, where the different variants of the DCT correspond to slightly different even/odd boundary conditions at the two ends of the array.

    DCT还广泛应用于通过谱方法解决偏微分方程,其中DCT的不同变型对应于阵列两端的稍微不同的偶/奇边界条件。

    DCTs are also 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.

    DCT还与切比雪夫多项式密切相关,而且快速DCT算法(如下所示)通过一系列的切比雪夫多项式用在任意函数的切比雪夫估计中,例如Clenshaw–Curtis求积分。

    1.1 JPEG

    Main article: JPEG § Discrete cosine transform

    The DCT is used in JPEG image compression, MJPEG, MPEG, DV, Daala, and Theora video compression. There, the two-dimensional DCT-II of  NxN blocks are computed and the results are quantized and entropy coded. In this case, 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) 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.

    DCT应用在JPEG图像压缩,MJPEG,MPEG,DV,Daala和Theora视频压缩。在这里,计算NXN块的二维DCT-II,并对结果进行量化和熵编码。在这种情况下,N通常为8,并且将DCT-II公式应用于块的每一行和列。结果是一个8×8变换系数数组,其中(0,0)元素(左上)是DC(0频率)成分,而具有垂直和水平索引值增加的条目表示较高的垂直和水平空间频率。

    Multidimensional DCTs (MD DCTs) have several applications mainly 3-D DCT-II has several new applications like Hyperspectral Imaging coding systems,[3] variable temporal length 3-D DCT coding,[4] video coding algorithms,[5] adaptive video coding [6] and 3-D Compression.[7] Due to enhancement in the hardware, software and introduction of several fast algorithms, the necessity of using M-D DCTs is rapidly increasing. DCT-IV has gained popularity for its applications in fast implementation of real-valued polyphase filtering banks,[8] lapped orthogonal transform[9][10] and cosine-modulated wavelet bases.[11]

     2. Informal overview 非正式概述

    Like any Fourier-related transform, discrete cosine transforms (DCTs) express a function or a signal in terms of a sum of sinusoids with different frequencies and amplitudes. Like the discrete Fourier transform (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 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 {displaystyle f(x)} f(x) as a sum of sinusoids, you can evaluate that sum at any {displaystyle x} x, even for {displaystyle x} x where the original {displaystyle f(x)} 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 finitediscrete 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).

    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 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 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, 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 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, 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 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.

     3. Formal definition

    Formally, the discrete cosine transform is a linear, invertible function {displaystyle f:mathbb {R} ^{N} o mathbb {R} ^{N}} f:mathbb{R}^{N} omathbb{R}^{N} (where {displaystyle mathbb {R} } mathbb {R} denotes the set of real numbers), or equivalently an invertible N × N square matrix. There are several variants of the DCT with slightly modified definitions. The N real numbers x0, ..., xN-1 are transformed into the N real numbers X0, ..., XN-1 according to one of the formulas:

    3.1 DCT-I

     

    3.2 DCT-II

    3.3 DCT-III

    3.4 DCT-IV

    3.5 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.

  • 相关阅读:
    JAVA-容器(5)-Map
    JAVA-容器(4)-Set
    数据脏读-非重复读-幻读
    JAVA-容器(3)-List
    JAVA-容器(2)-Collection
    JAVA-容器(1)
    Arrays排序
    JAVA-虚拟机(3)-调优
    zip解压缩
    rabbitMQ、activeMQ、zeroMQ、Kafka、Redis 比较
  • 原文地址:https://www.cnblogs.com/2008nmj/p/9537484.html
Copyright © 2011-2022 走看看