4:2:0 JPEG chroma subsampling
Posted: 2011-04-13T13:18:33-07:00
Does anyone know how the chroma subsampling for JPEG 4:2:0 compression is done within IM?
Are the chroma channels averaged one group of four (2x2) pixels at a time? Or is some variant of nearest neighbour used? Is box filtering part of the standard?
I am wondering if using another low-pass filter than box filtering with the CbCr channels (Cubic or Quadratic (cubic or quadratic B-spline smoothing or its distort variant) or gaussian blur) and then using 4:4:4 (no chroma subsampling) instead of 4:2:0 but with a lower quality level would give better results (for a given file size).
The logic is that the Discrete Cosine Transform "converges" the fastest when the input is smoothest (including, unfortunately, the "periodic extension" of the input data). Given that box filtering is not that good of a low-pass filter, the gain in convergence rate obtained by a better chroma "smoother" may beat the fact that box filtering can be used to halve the sampling rate, and further more lead to more localized artifacts (8x8 blocks in chroma instead of 16x16).
Are the chroma channels averaged one group of four (2x2) pixels at a time? Or is some variant of nearest neighbour used? Is box filtering part of the standard?
I am wondering if using another low-pass filter than box filtering with the CbCr channels (Cubic or Quadratic (cubic or quadratic B-spline smoothing or its distort variant) or gaussian blur) and then using 4:4:4 (no chroma subsampling) instead of 4:2:0 but with a lower quality level would give better results (for a given file size).
The logic is that the Discrete Cosine Transform "converges" the fastest when the input is smoothest (including, unfortunately, the "periodic extension" of the input data). Given that box filtering is not that good of a low-pass filter, the gain in convergence rate obtained by a better chroma "smoother" may beat the fact that box filtering can be used to halve the sampling rate, and further more lead to more localized artifacts (8x8 blocks in chroma instead of 16x16).