# Is DCT (Discrete Cosine Transform) of Type-2 lossless or lossy?

As I know, in general, the DCT is lossless. But I'm not exactly sure about Type-2 of DCT. Is it lossless or lossy?

• Yes, it is lossless. Obviously due to it's properties (de-correlation of an input and concentration of most of the information in lower bins) it is being used in lossy algorithms.
– jojeck
Commented Dec 16, 2015 at 12:47
• Thanks kindly explain. Would you please let me know more about" de-correlation of an input and concentration of most of the information in lower bins"? I think your explain is very understnd Commented Dec 16, 2015 at 13:06
• it is lossy. roundoff error. Commented Dec 16, 2015 at 14:22

Mostly yes, but it depends on the context. Let us elaborate.

DCT-II is one of the many forms of Discrete Cosine Transforms, and probably the most widely used one, as it is (somehow) present in JPEG or MP3 formats. "Lossy" often refer to the compression standard which uses it, because the main loss results from quantization (and generally not the transform by itself). By itself, the transform is invertible, even more orthogonal or orthonormal, so in theory you have no loss (it is bijective).

As @Fat32 points out, its coefficients sometimes involve cosines, hence irrational numbers (except at specific values) that are not easily represented in finite arithmetic (float or int), and can induce round-off errors.

But:

• DCT-II of size $1$ is $1$, DCT-II of size 2 (unnormalized) is: \begin{smallmatrix} 1 & 1 \\1 & -1\end{smallmatrix} so DCT-II can be lossless (in special cases though),
• For integer data (like images), it seems possible, with enough bit-depth computations (related to the initial integer range and the DCT size), to remain practically lossless, as you know that the transform/inverse transform result should be integer,
• Very accurate integer, or dyadic approximations exist, meant for integer hardware: for instance the binDCT.

My final answer is thus: DCT-II is mostly lossless, if you take care of it.

• I'm now upvoting and it becomes neutral now! Commented Dec 18, 2015 at 0:13
• This great move deserves a reward! Commented Dec 18, 2015 at 0:14
• the fact that it works is enough! Commented Dec 18, 2015 at 0:16