The scaling in question is only for the intermediate results of the
forward DCT, and the coefficients are subsequently descaled during
quantization. DCT coefficients are normally in the range of -1024 to
1023 for 8-bit precision, so it is expected that the luminance DC
coefficient should be -1024 for pure black when there is no quantization
(quality = 100.) However, the libjpeg forward DCT implementation
actually produces a luminance DC coefficient of -8192 for pure black,
and that value is subsequently descaled by 8 when it is quantized.
As to why the DCT coefficients are in the range of -1024 to 1023 for
8-bit precision, bear in mind that DCT coefficients are an expression of
the frequencies within an 8x8 block of samples. (A sample is, in this
case, the Y, Cb, or Cr value for one pixel.) For the DC coefficient, the
more general 2D DCT formula (refer to
https://dsp.stackexchange.com/questions/60801/dc-coefficient-of-jpeg-block)
reduces to the sum of all 64 sample values divided by 8. So the
luminance DC coefficient for an 8x8 block of pure black would be -128 *
64 / 8, which is the same as -128 * 8.
DRC