Forgot Password
Pentax Camera Forums Home
 

Reply
Show Printable Version Search this Thread
2 Likes  #1
File Formats & Colour Sub-Sampling Compared
Posted By: dosdan, 12-11-2009, 12:22 AM

Graphics packages & RAW converters offer different output formats with different colour sub-sampling options.

Colour sub-sampling is specified as a ratio. For example, 4:4:4 is just the ratio of the colour components, Y:Cb:Cr, where Y = luminance, Cb = blue difference, Cr = red difference. In this article I'll use the alternate term for YCbCr, YCC. The colour components are not sub-sampled in 4:4:4:, but are sub-sampled (a form of compression that groups colour components into block of pixels) in the more common 4:2:2, 4:2:0 or 4:1:1 varieties. The eye is not very sensitive to the loss of colour resolution (it's more sensitive to the loss of luminance resolution - black & white) so you can usually sub-sample the colour stuff to reduce the filesize, without much visible effect.

The example below shows the same crop processed using the two different colour sub-sampling methods. You can see in the "colour compressed" version on the left how, at the areas indicated, the colour variations have been simplified compared to the same areas on the right.





Here is an example of a full-sized (14.6 Mpixels - Pentax K20D) PEF saved with 2 different TIFF formats & also as 100% quality JPEGs with 3 different colour sub-sampling schemes in SilkyPix:

Format Filesize Comp. to 8-bit TIFF Comments
TIFF-16 bit 85,071 KB 200% Only needed if more PP is to be performed.
TIFF-8 bit 42,585 KB 100% Good for final output.
YCC444 12,977 KB 30% aka 1x1 (H x V) chroma sub-sampling, but no chroma sub-sampling applied. 132%. Not EXIF compliant.
YCC422 9,818 KB 23% aka 2x1 (H x V) chroma sub-sampling. Taken as 100% JPEG size ref. Common for DSLRs.
YCC420 7,611 KB 18% aka 2x2 (H x V) chroma sub-sampling. 78%. Common for Web use.

YCC411 would be the same size as YCC420, but is not EXIF 2.21 complaint.

TIFF is usually RGB444, but can also use YCC444

From EXIF 2.2 spec, page 5:
4.4.3 Pixel Composition and Sampling
The combination of pixel composition and pixel sampling for image data shall be RGB 4:4:4 and either Y:Cb:Cr = 4:2:2 or Y:Cb:Cr = 4:2:0.
Which indicates that JPEG YCC422 & JPEG YCC420 should be used for maximum comparability.

Outside the field of photography, Y'CbCr411 is also used in NTSC SD DV encoding, while Y'CbCr420 is used for both PAL SD DV & for HDV encoding.


**********************************************


TIFF can have optional lossless compression (usually LZW). As an example of TIFF compression, I've processed this album shot of a Kookaburra, but used the uncompressed TIFF version converted from RAW, not from the JPEG version shown here. (Click on it to see larger version):




Program TIFF Compression Relative Filesize Comments
Silkypix Pro 4.1 None 100%  
SilkyPix Pro 4.1 LZW low 114.9% 
Silkypix Pro 4.1 LZW high 74.6% 
Infranview 4.25 LZW 112% EXIF was stripped off
FastStone 4.0 LZW 67.8% 
XnView 1.97 Binary: LZW, Colour: No Compression 98.9% 
XnView 1.97 Binary: LZW, Colour: LZW 112% 
XnView 1.97 Binary: LZW, Colour: LZW+Prediction 67% 
XnView 1.97 Binary: No Compression, Colour: LZW+Prediction 67% 

The high compression programs appear to use LZW+Prediction (XnView & Silkypix mention this explicitly - Silkypix uses it for "LZW high"). Some programs can't handle LZW+Prediction.

LZW compression by itself was unsuccessful with this particular photo and increased the size of the resultant file. But, with simpler photos, TIFF LZW-only compression may be of benefit:




Here are the results with this photo outputted from the Silkypix Pro RAW Converter:

TIFF Compression Relative Filesize 
None 100% 
LZW low (LZW) 88.5% 
LZW high (LZW+Prediction) 40.0% 

Infranview strips off EXIF when it saves TIFF files & does not offer LZW+Prediction.


**********************************************


I'll now explain the relationship between Mpixels & the TIFF (8-bit) filesize.

Consider a "14.6 Mpixel" camera (Pentax K20D). The size of the original image in the RAW format is 4688(w) x 3124(h) pixels. Multiply W * H = 14,645,312 = 14.6 Mpixels (camera manufacturers use 1 million pixels = 1 Mpixel).

Now not all these pixels contain info that ends up in the final photo. There is a strip of black-level data included on the outside. The actual size of the output of the RAW converter is 4672 x 3104 = 14,501,888 = 14.5 Mpixels.

Ok, that's Mpixels. To get bytes, multiply by 3 (8 bits = 1 byte. There are 3 bytes per pixel used to indicate the RGB colour of each pixel - 24 bits, hence "24-bit colour")
= 4672 x 3104 x 3 = 43,505,664.

The value mentioned in the table for an 8-bit TIFF is 42,585 KB. Why the difference? Well in KB (the size shown in Windows Explorer under "Properties"), we typically use 2^10 = 1,024 instead of 1,000. So 43,505,664/1,024 = 42,486 KB. (That's the case with general computer. However, HDD manufacturers use 1,000,000 instead of 2^20 - 1,048,576 - because they can quote a 4.8% larger "MB" value that way. And by using 1,000,000,000 for a GB, instead of 2^30, they get a 7.4% bigger value. Finally, with 1,000,000,000,000 for a TB, instead of 2^40, they can quote a 10% bigger figure.)

There is also a slight overhead from the TIFF file-format header, hence the final filesize of 42,585 KB. Divide by 1,024 again to get the MB value, 41.6 MB.


Dan.

Last edited by dosdan; 11-11-2011 at 01:12 PM.
Views: 9,832
09-03-2010, 07:27 PM   #2
Pentaxian
dosdan's Avatar

Join Date: Dec 2007
Location: Brisbane, Australia
Photos: Gallery | Albums
Posts: 1,699
Original Poster
A good page demonstrating JPEG chroma subsampling is found here.


Dan
Reply

Bookmarks
  • Submit Thread to Facebook Facebook
  • Submit Thread to Twitter Twitter
  • Submit Thread to Digg Digg
Tags - Make this thread easier to find by adding keywords to it!
colour, compression, filesize, kb, prediction, silkypix, size, tiff
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads
Thread Thread Starter Forum Replies Last Post
Canon 5D MarkII scores same or better than 50mp & 39mp Medium Formats at DXO Samsungian Non-Pentax Cameras: Canon, Nikon, etc. 6 12-14-2009 09:19 AM
K7 compared to K20/K10 CA & PF knumbnutz Pentax DSLR Discussion 10 10-04-2009 07:21 PM
Info. on 77mm Ltd. (Compared to 70mm & then 31mm) jk333 Pentax SLR Lens Discussion 5 05-05-2009 01:26 PM
K20D or Samsung P&S? Pix compared. SpecialK Post Your Photos! 8 11-30-2008 05:51 PM
compression and file formats, some clarification? Gooshin Digital Processing, Software, and Printing 12 02-24-2008 06:31 PM



All times are GMT -7. The time now is 08:01 PM. | See also: NikonForums.com, CanonForums.com part of our network of photo forums!
  • Red (Default)
  • Green
  • Gray
  • Dark
  • Dark Yellow
  • Dark Blue
  • Old Red
  • Old Green
  • Old Gray
  • Dial-Up Style
Hello! It's great to see you back on the forum! Have you considered joining the community?
register
Creating a FREE ACCOUNT takes under a minute, removes ads, and lets you post! [Dismiss]
Top