Discrete cosine transform (DCT) is an invertible matrix transformation commonly used to analyze signals (e.g. audio, images, video) in the frequency domain. In contrast to the FFT, the DCT maps real vectors to real vectors. The DCT is oftentimes used to provide an alternative feature representation (e.g. spectrogram representations of audio and video) useful for classification and frequency-domain analysis.
Ideally, an implementation of the DCT should allow both forward and inverse transforms. It should also work for any numeric datatype and both 1D and 2D data.