I am currently developing a dct based jpeg encoder and got stuck on a problem with the luminance channel. The chrominance values seem to be correct.
A few words to the encoding procedure. The picture is based on ycbcr color values. Cb and Cr Channel is subsampled by 2. So SubSampling is 4:2:0. dc and ac coefficients are dct encoded and quantized. Grouped to 8x8 blocks, the dc values are calculated by delta differences and theyre category, ac values are run length encoded. The dc and ac values are written interlaced in yyyycbcr format. All Huffman Codes seem to be correct and tools like jpeg snoop finish decoding procedure without any warning of bad markers or huffman codes. everything seems alright. Picture 1 is the original picture in ppm format.
This picture is read and transformed into a compressed jpeg format. picture 2 demonstrates the output of picture 1 after compression. Picture 3 shows the picture with max luminance values. all y channel values are set to 255 in picture 3. Any idea why the luminance channel is able to generate such a pattern in picture 2 ?