# DC Coefficient of JPEG Block

Suppose I take a grayscale image and break it into 8x8 pixel blocks, then take the DCT of those blocks. What is the DC coefficient of the block in relation to the whole image?

To simplify I'm thinking of this in 1D. I have a row of 64 pixels and I break it into length 8 vectors. I pick one of these 8-vectors and take its DCT. The average of the 8-vector is not the DC term of the entire 64-row. Now suppose I took the DCT of the entire 64-row. What coefficient in the 64-pixel-DCT would the DC term of the 8-pixel-DCT be projected onto?

EDIT: Thank you for the replies so far. The context of this question is I'm trying to assign a cyles/pixel value to the DC coefficient of the 8-pixel sub-block, but in the context of the whole 64-block. Its clear to me now that the DC coefficient of the 64-block is the average of the DC coefficients of each of the 8-blocks. But while the 8-block is a sample of the 64-block it doesn't make sense to me to say that the 8-block DC coefficient is actually 0 cycles/pixel. For example, one could represent nonzero frequencies using only these 8-block DC coefficients.

The $$8\times 8$$ 2D DCT-II transformation is defined, for integer indices $$(u,v)$$ as:

$$D[u,v] = c_uc_v \sum_{m=0}^7 \sum_{n=0}^7 \cos \left(\frac{(2m+1)\pi u}{16} \right) \cos \left(\frac{(2n+1)\pi v}{16} \right) I[m,n]$$

with $$c_{w} = 1/\sqrt{8}$$ if $$w=0$$, and $$c_{w} = 1/4$$ if $$1\le w <8$$. This factor is related to the orthogonality of the transformation. Details are given at The Discrete Cosine Transform (DCT).

For the DC coefficient, we have $$u=v=0$$, hence $$D[0,0] = \frac{\sum_{m=0}^7 \sum_{n=0}^7 I(m,n)}{8}$$ so it is a quantity proportional to the block average. Note that this coefficient is subsequently scaled and quantized or rounded.

Now, for a 1D DCT-II on the vectorized $$i[m]$$ ($$I[r,s] = i[r+8s]$$). The DC coefficient of each of the eight $$8\times 1$$ sub-blocks $$k$$, is $$d_k[0] = \frac{1}{\sqrt {8}}\sum_{m=8k}^{8k+7}i[m]$$ and the DC coefficient of the complete $$64\times 1$$ blocks, for is $$d[0] = \frac{1}{\sqrt {64}}\sum_{m=0}^{63}i[m].$$

Hence, $$D[0,0]=d[0]= \frac{1}{\sqrt{8}}\sum_{k=0}^7 d_k[0].$$

A $$64$$ 1D DCT on a vectorized $$8\times 8$$ block does not give a $$8\times 8$$ 2D DCT, yet one can recover the average intensity.

The DC coefficient, of the 2D-DCT (discrete cosine transform) of an 8 x 8 image block, represents the average value of the samples within the 8 x 8 block.

For your question, if you compute 8 different 1D-DCTs of 1 x 8 rows or 8 x 1 columns of this 8 x 8 block, then the DC coefficient of 2D-DCT of this 8 x 8 block will be the average of individual DC coefficients of 8 x 1 (or 1 x 8) 1D-DCTs.