/** * @file Dct.h * * Discrete Cosine Transform (DCT) calculation. * * This file is part of the Aquila DSP library. * Aquila is free software, licensed under the MIT/X11 License. A copy of * the license is provided with the library in the LICENSE file. * * @package Aquila * @version 3.0.0-dev * @author Zbigniew Siciarz * @date 2007-2014 * @license http://www.opensource.org/licenses/mit-license.php MIT * @since 3.0.0 */ #ifndef DCT_H #define DCT_H #include "../global.h" #include #include #include #include namespace Aquila { /** * An implementation of the Discrete Cosine Transform. */ class AQUILA_EXPORT Dct { public: /** * Initializes the transform. */ Dct(): cosineCache() { } /** * Destroys the transform object. */ ~Dct() { clearCosineCache(); } std::vector dct(const std::vector& data, std::size_t outputLength); private: /** * Key type for the cache, using input and output length. */ typedef std::pair cosineCacheKeyType; /** * Cache type. */ typedef std::map cosineCacheType; /** * Cache object, implemented as a map. */ cosineCacheType cosineCache; double** getCachedCosines(std::size_t inputLength, std::size_t outputLength); void clearCosineCache(); }; } #endif // DCT_H