# DCT Implementation

The questions below are due on Monday May 17, 2021; 10:00:00 PM.

You are not logged in.

Note that this link will take you to an external site (https://shimmer.csail.mit.edu) to authenticate, and then you will be redirected back to this page.

Part 1

In the box below, implement a function dct(x), which computes the DCT coefficients associated with a given input sequence x (given as a NumPy array). It should return another NumPy array containing the DCT coefficients.

Since the DCT results should be purely real, your function should return a NumPy array of floats, not complex numbers (note that you can find the real part of an array x by doing x.real).

Implement this function directly from the formula, without using a DFT.

Part 2

In the box below, implement a function dct(x), which computes the DCT coefficients associated with a given input sequence x (given as a NumPy array). It should return another NumPy array containing the DCT coefficients.

Since the DCT results should be purely real, your function should return a NumPy array of floats, not complex numbers (note that you can find the real part of an array x by doing x.real).

Implement this function using a DFT, not by direct translation of the formula.

Part 3: 2D

In the box below, implement a function dct2(x), which computes the DCT coefficients associated with a given input array x (given as a NumPy array). Your function should return another NumPy array containing the DCT coefficients, where out[0,0] corresponds to the DC term. Note that, as with the DFT, we can break this transform down into two smaller 1-D transforms.

You may assume a working copy of the dct function is available for you in the box below (i.e., you do not need to paste your definition of dct below).