View Single Post
  #12  
Old 25-04-12, 01:18
robski robski is offline
Senior Member
 
Join Date: Dec 2005
Location: Kent UK
Posts: 3,755
Default

Hi Harry

The first thing to remember about jpeg compression is that is designed to take advantage of the weaknesses of the Human vision system. i.e severely nobbles the Colour (chroma channels Cr , Cb) before affecting the sharpness which is maintained in the black and white component ( luminance channel).

If you save a colour image in the bmp format and then save the same image in a heavily compressed jpeg format and then compare the two you will often notice a slight colour shift.

I've taken a look at the internals of your original and wpf resampled file.

The first thing to note is that the ICC profile information has been striped out of the wpf down sampled version. This could have some impact on browsers that now attempt to implement the profile ( I don't pretend to be up to speed on this aspect ).

The chroma sub-sampling is the same in both cases. (2 x 2) this is where 2 pixels on a Cr line and the 2 on the next row are merged in one. The same is applied to the Cb channel. In simple terms the colour components of a 1024 x1024 image have become 512 x 512. The luminance sub-sampling of ( 1 x 1 ) means the the black and white component is unchanged.


For you to understand the next difference I need to explain part of the jpeg process that occurs for the luminance and chroma channels. The image is broken down into 8 x 8 pixel blocks. A Discrete Cosine transform (DCT) is applied to each block. Yes this sounds very complicated but in essence it is measuring the strength of 64 frequencies in that block and replacing 64 image values with 64 strength values. The values in the top left hand corner of the matrix represent lowest frequency components and the bottom right hand corner the highest frequency components.

The next step is what has the biggest impact on the amount of compression when you operate the quality slider in Photoshop or similar setting in other programs. A Quantization table ( containing 64 values ) is used to divide the 64 strength values by. A higher value in the table has the effect of reducing the strength of that frequency component to zero. There are different sets of tables for each quality (slider) setting. Just out of interest there are no standard sets of values in the tables and they differ with different software and camera. That is why the tables used are embedded in the jpeg file so that any application can decode the image correctly.

Heavy compression is obtained by reducing most of the higher frequency components of the image to zero and if you go far enough the 8 x 8 block becomes a single blob.

Below are the table values for each file. In the down sampled version you can see much higher values in the chroma table which will reduce the chroma quality.

PS. Just to add a couple of illustrations of Y (luminance) and Chroma channels (Cr & Cb) and the frequency components ( or patterns if that helps the explanation ) that the DCT process is looking for in a 8 pixel x 8 pixel block. Yes - Jpeg compression involves a number of complex stages ( some of the concepts can be hard to grasp like converting apples to oranges because that works better for you ). What you have above is only part of the story. For example the image is not stored as RGB but converted to a YCrCb colour space which is similar to Lab colour space found in Photoshop.
Attached Images
File Type: jpg dqt.jpg (117.7 KB, 8 views)
File Type: jpg convrgb.jpg (70.7 KB, 6 views)
File Type: jpg dct.jpg (119.8 KB, 5 views)
__________________
Rob

-----------------------------------------------------
Solar powered Box Brownie Mk2

Captain Sunshine, to be such a man as he, and walk so pure between the earth and the sea.

WPF Gallery
Birdforum Gallery

Last edited by robski; 26-04-12 at 00:51.
Reply With Quote