How many 8x8 JPEGs exist with distinct DCT given a quality level? For a given quality of image (or quality of compression), Multiple 8x8 JPEG images can have the same DCT (Discrete cosine transform) matrix, for a given quality of JPEG compression. I want to find the number of those 8 by 8 JPEG files which have different DCT codes.

I write the question in a different way:


  Assume a set $A$ of images, which is initially empty. We consider all possible DCT's for 8 by 8 Jpegs one by one, and convert each one to an image. If the image already exists in the set $A$, we throw it away, otherwise, we put it in set $A$. After we are done with all possible DCT's, how many images are in the set $A$? (what is the cardinality of $A$?)


Wikipedia has the formula for the DCT conversion. But I cannot realize from that how to find what I need. I am wondering how to solve it or if that is already solved in the literature. Any idea?
Well, $8\times 8$ is simply 64 individual values. 

Now, if you had a quantization matrix $Q$ (dimensions $8\times 8$) with all $1$s, you'd have 8 bit to spend on every entry in your DFT, so that's 

$$(256)^{8 \times 8}=({2^8})^{(8 \times 8)} = 2^{512}$$

possible different DFTs.

Now, typically, that's not happening, since quantization matrices restrict the possible values that can end up being non-zero.

The number of possible values is relative easy to figure out: You take the maximum value for each entry, 255, and divide it by the quantization matrix value, round that down; that leads you to the number of possible combinations being

$$ N = \prod_{i = 1, j = 1}^{8,8} \left\lfloor\frac{255}{Q_{i,j}}\right\rfloor$$