dct

Functions

int main(int argc, char *argv[])

dct [ option ] [ infile ]

  • -l int

    • DCT length (1L)

  • -q int

    • input format

      • 0 real and imaginary parts

      • 1 real part

  • -o int

    • output format

      • 0 real and imaginary parts

      • 1 real part

      • 2 imaginary part

      • 3 amplitude spectrum

      • 4 power spectrum

  • infile str

    • double-type data sequence

  • stdout

    • double-type DCT sequence

Parameters:
  • argc[in] Number of arguments.

  • argv[in] Argument vector.

Returns:

0 on success, 1 on failure.

See also

idct

class DiscreteCosineTransform

Calculate DCT-II of complex-valued input data.

The inputs are L-length order complex-valued data:

Re(x(0)),Re(x(1)),,Re(x(L1)),Im(x(0)),Im(x(1)),,Im(x(L1)).
The outputs are
Re(X(0)),Re(X(1)),,Re(X(L1)),Im(X(0)),Im(X(1)),,Im(X(L1)).
They are computed as
X(k)=2Lc(k)n=0L1x(n)cos(πL(n+12)k),
where
c(k)={1/2,k=01.1k<L

Public Functions

explicit DiscreteCosineTransform(int dct_length)
Parameters:

dct_length[in] DCT length, L.

inline int GetDctLength() const
Returns:

DCT length.

inline bool IsValid() const
Returns:

True if this object is valid.

bool Run(const std::vector<double> &real_part_input, const std::vector<double> &imag_part_input, std::vector<double> *real_part_output, std::vector<double> *imag_part_output, DiscreteCosineTransform::Buffer *buffer) const
Parameters:
  • real_part_input[in] L-length real part of input.

  • imag_part_input[in] L-length imaginary part of input.

  • real_part_output[out] L-length real part of output.

  • imag_part_output[out] L-length imaginary part of output.

  • buffer[out] Buffer.

Returns:

True on success, false on failure.

bool Run(std::vector<double> *real_part, std::vector<double> *imag_part, DiscreteCosineTransform::Buffer *buffer) const
Parameters:
  • real_part[inout] L-length real part.

  • imag_part[inout] L-length imaginary part.

  • buffer[out] Buffer.

Returns:

True on success, false on failure.

class Buffer

Buffer for DiscreteCosineTransform class.