Home > Archive > Compression > January 2006 > Chroma Subsampling [Was: JPEG decoding]
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Chroma Subsampling [Was: JPEG decoding]
|
|
| Bill Tuthill 2006-01-23, 6:55 pm |
| David Harmon <source@netcom.com> wrote:
>
> It looks like only the most aggressive chroma subsampling option in
> Paint Shop Pro version 9.0 causes [MS Windows] any trouble opening.
> That option is designated as:
> YCbCR 4x4 2x2 2x2
GIMP (old version I use) provides three choices of chroma subsampling for
JPEG save: 1x1 1x1 1x1 (none), 2x2 1x1 1x1 (xv), and 2x1 1x1 1x1 (digicam).
ImageMagick has only the first two, called -sampling_factor 1x1 and 2x2.
PaintShopPro version 9 offers *many* more chroma subsampling options!!
It has both 2x1 1x1 1x1 and 1x2 1x1 1x1. Is there a practical difference?
Most DSLR and digital cameras produce 2x1 1x1 1x1 according to jpegdump,
also called 4:2:2, not 1x2 1x1 1x1.
Why would anyone use these offbeat chroma subsampling choices in PSP 9?
2x2 2x1 2x1
4x2 1x1 1x1
2x4 1x1 1x1
4x1 1x1 1x1
1x4 1x1 1x1
4x1 2x1 2x1
1x4 1x2 1x2
4x4 2x2 2x2 (causes compatibility problems, see above)
| |
| Ben Rudiak-Gould 2006-01-23, 6:55 pm |
| Bill Tuthill wrote:
>David Harmon <source@netcom.com> wrote:
As far as I can tell from section A.1.1 of ITU T.81, that's the same as 2x2
1x1 1x1, except that the MCU is larger: 24 blocks instead of 6.
Implementations are only required to support 10 blocks per MCU (section
B.2.3). So this subsampling option is (a) not compliant with the standard
and (b) even if it were compliant would be visually identical to 2x2 1x1
1x1. Conclusion: either the authors of Paint Shop Pro don't understand the
JPEG standard, or I don't.
[color=darkred]
> PaintShopPro version 9 offers *many* more chroma subsampling options!!
> It has both 2x1 1x1 1x1 and 1x2 1x1 1x1. Is there a practical difference?
For display on an analog raster-scanned screen like a CRT, 2x1 is better
than 1x2. I can't think of any situation where 1x2 would be better than 2x1,
unless you plan to rotate the image 90 degrees and then display it on a CRT.
> Why would anyone use these offbeat chroma subsampling choices in PSP 9?
> 2x2 2x1 2x1
> 4x1 2x1 2x1
> 1x4 1x2 1x2
> 4x4 2x2 2x2 (causes compatibility problems, see above)
The four that I quoted above are visually indistinguishable from 1x2 1x1
1x1, 2x1 1x1 1x1, 1x2 1x1 1x1, and 2x2 1x1 1x1 respectively, making them
entirely pointless. They all have an MCU size within the limit, except for
the one marked as having compatibility problems.
-- Ben
| |
| Bill Tuthill 2006-01-24, 9:55 pm |
| In comp.compression Ben Rudiak-Gould <br276deleteme@cam.ac.uk> wrote:
>
> As far as I can tell from section A.1.1 of ITU T.81, that's the same as 2x2
> 1x1 1x1, except that the MCU is larger: 24 blocks instead of 6.
> Implementations are only required to support 10 blocks per MCU (section
> B.2.3). So this subsampling option is (a) not compliant with the standard
> and (b) even if it were compliant would be visually identical to 2x2 1x1
> 1x1. Conclusion: either the authors of Paint Shop Pro don't understand the
> JPEG standard, or I don't.
I would bet on the former.
> For display on an analog raster-scanned screen like a CRT, 2x1 is better
> than 1x2. I can't think of any situation where 1x2 would be better than 2x1,
> unless you plan to rotate the image 90 degrees and then display it on a CRT.
Some EXIF headers specify that an image should be rotated, but I have not
yet studied whether such images use 1x2 JPEG encoding.
> The four that I quoted above are visually indistinguishable from 1x2 1x1
> 1x1, 2x1 1x1 1x1, 1x2 1x1 1x1, and 2x2 1x1 1x1 respectively, making them
> entirely pointless. They all have an MCU size within the limit, except for
> the one marked as having compatibility problems.
Thanks very much for all the good information. It sounds like Gimp offers
the three most important JPEG chroma subsampling options. I would guess
digital camera vendors are using 2x1 1x1 1x1 instead of 1x1 1x1 1x1 because
it creates much smaller files (often 2/3 at Q99) without creating as many
blocking artifacts as 2x2, which is not all that much more compact.
| |
| Pete Fraser 2006-01-24, 9:55 pm |
|
"Bill Tuthill" <can@spam.co> wrote in message news:43d6bf0f@news.meer.net...
> I would guess
> digital camera vendors are using 2x1 1x1 1x1 instead of 1x1 1x1 1x1
> because
> it creates much smaller files (often 2/3 at Q99) without creating as many
> blocking artifacts as 2x2, which is not all that much more compact.
I'd be surprised if a reduction to 2/3 was seen in anything other than
the most extraordinary of circumstances.
Sure, going from a 4:4:4 to a 4:2:2 color space reduces the raw data
by 1/3, but that ignores the decorelative effect of the color space
transform
as well as the fact that most DSC images use a more severe quantizing
table for chroma.
| |
| Bill Tuthill 2006-01-25, 6:55 pm |
| Pete Fraser <pfraser@covad.net> wrote:
>
>
> I'd be surprised if a reduction to 2/3 was seen in anything other than
> the most extraordinary of circumstances.
I tried it before posting with one image (full of vegetative detail)
and will try it again with another image (portrait with less detail).
[wait]
Similar results; the 4:2:2 encoding is 68% the size of the 4:4:4 image.
Perhaps reducing IJG Q99 would produce different results, but Q99 is
about what most DSLR vendors use for ExtraFine JPEG.
> Sure, going from a 4:4:4 to a 4:2:2 color space reduces the raw data
> by 1/3, but that ignores the decorelative effect of the color space
> transform as well as the fact that most DSC images use a more severe
> quantizing table for chroma.
Just goes to show: theory sometimes fails to predict practice.
| |
| Pete Fraser 2006-01-25, 6:55 pm |
|
"Bill Tuthill" <can@spam.co> wrote in message news:43d7b728@news.meer.net...
> Pete Fraser <pfraser@covad.net> wrote:
>
> I tried it before posting with one image (full of vegetative detail)
> and will try it again with another image (portrait with less detail).
> [wait]
> Similar results; the 4:2:2 encoding is 68% the size of the 4:4:4 image.
> Perhaps reducing IJG Q99 would produce different results, but Q99 is
> about what most DSLR vendors use for ExtraFine JPEG.
>
Do you have a DSC that allows you to switch between 4:4:4 and 4:2:2,
or are you going from RAW format to JPEG with an external app?
Are you using the same tables for Y and C?
| |
| Bill Tuthill 2006-01-25, 6:55 pm |
| Pete Fraser <pfraser@covad.net> wrote:
>
>
> Do you have a DSC that allows you to switch between 4:4:4 and 4:2:2,
> or are you going from RAW format to JPEG with an external app?
Do some digicams (maybe you mean Sony DSC models) permit switching?
I've never heard of that option.
GIMP has the option of using 4:1:1, 4:2:2, or 4:4:4 for JPEG saves.
So I used Gimp on Linux for my test. It surprised me that 4:1:1 (2x2)
was not significantly more compact than 4:2:2.
> Are you using the same tables for Y and C?
I don't know. Gimp uses the IJG libraries, so perhaps somebody with
more JPEG knowledge could say.
Too bad ImageMagick does not (yet) support 4:2:2.
| |
| Pete Fraser 2006-01-25, 6:55 pm |
| "Bill Tuthill" <can@spam.co> wrote in message news:43d7d8c5@news.meer.net...
> Pete Fraser <pfraser@covad.net> wrote:
>
> Do some digicams (maybe you mean Sony DSC models) permit switching?
> I've never heard of that option.
I'd never heard of that option either. We were talking about camera encoding
though, and I inferred from something you said that you had a way of
switching.
>
> Gimp has the option of using 4:1:1, 4:2:2, or 4:4:4 for JPEG saves.
> So I used Gimp on Linux for my test. It surprised me that 4:1:1 (2x2)
> was not significantly more compact than 4:2:2.
I regret introducing the 4:2:2 nomenclature into this conversation.
I think when you're talking about 2x2 you're talking about what is called
4:2:0 (U and V sub-sampled by 2 in horizontal and vertical).
Don't ask me why they call that 4:2:0. They must have been drunk.
>
>
> I don't know. Gimp uses the IJG libraries, so perhaps somebody with
> more JPEG knowledge could say.
If you want to email me a JPEG, I can tell in 30 seconds using a binary
editor.
| |
| Jasen Betts 2006-01-26, 3:55 am |
| On 2006-01-25, Bill Tuthill <can@spam.co> wrote:
> Pete Fraser <pfraser@covad.net> wrote:
>
> Do some digicams (maybe you mean Sony DSC models) permit switching?
> I've never heard of that option.
>
> Gimp has the option of using 4:1:1, 4:2:2, or 4:4:4 for JPEG saves.
> So I used Gimp on Linux for my test. It surprised me that 4:1:1 (2x2)
> was not significantly more compact than 4:2:2.
>
>
> I don't know. Gimp uses the IJG libraries, so perhaps somebody with
> more JPEG knowledge could say.
according to aptitude: Gimp depends on libjpeg62
ldd however dosen's show any linkage, so it must be linked as a plugin
(eg using g_module from libg).
I hid libjpeg. Gimp started up Ok.
but when I tried to save a jpeg:
..GIMP Message
..
..Plug-In crashed: "jpeg"
..(/usr/lib/gimp/2.0/plug-ins/jpeg)
..
..The dying Plug-In may have messed up GIMP's internal state. You may want to
..save your images and restart Gimp to be on the safe side.
..
..
> Too bad ImageMagick does not (yet) support 4:2:2.
ImageMagick uses libjpeg too.
..
..jasen@clunker:~$ ldd /usr/bin/convert | grep jpeg
.. libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0xb79e2000)
..
If you want more flexibility install libjpeg-progs
(that's djpeg,cjpeg,jpegtran etc...)
and check out the wizard.doc file.
Bye.
Jasen
| |
| Martin Brown 2006-01-26, 7:55 am |
| Ben Rudiak-Gould wrote:
> Bill Tuthill wrote:
>
>
> As far as I can tell from section A.1.1 of ITU T.81, that's the same as
> 2x2 1x1 1x1, except that the MCU is larger: 24 blocks instead of 6.
> Implementations are only required to support 10 blocks per MCU (section
> B.2.3). So this subsampling option is (a) not compliant with the
> standard and (b) even if it were compliant would be visually identical
> to 2x2 1x1 1x1. Conclusion: either the authors of Paint Shop Pro don't
> understand the JPEG standard, or I don't.
I believe you are correct. The chroma subsampling in PS Pro v9 is
demonstrably broken. It reduces certain awkward test cases of saturated
red (or blue) dots on a black background to a grey mush using the
default JPEG subampling of 2x2 1x1 1x1.
A quick prod with the wizard suggests that the following subsamplings
1x1 1x1 1x1
1x2 1x1 1x1
2x2 2x1 2x1
1x4 1x1 1x1
1x4 1x2 1x2
Do what I would expect and that the others show gross chroma artefacts
on this simple but demanding line art test case.
IJG and other JPEG codecs retain more colour information. It looks like
Paintshop Pro v9 subsamples chroma detail very crudely by dropping
unwanted pixels compared to earlier versions and other applications.
It is a testament to how robust JPEG encoding is that hardly anybody has
actually noticed this issue on real images. Digital cameras do not
sample chroma detail finely enough for this to cause real damage.
>
>
> For display on an analog raster-scanned screen like a CRT, 2x1 is better
> than 1x2. I can't think of any situation where 1x2 would be better than
> 2x1, unless you plan to rotate the image 90 degrees and then display it
> on a CRT.
>
>
> The four that I quoted above are visually indistinguishable from 1x2 1x1
> 1x1, 2x1 1x1 1x1, 1x2 1x1 1x1, and 2x2 1x1 1x1 respectively, making them
> entirely pointless. They all have an MCU size within the limit, except
> for the one marked as having compatibility problems.
I can see no point in them offering the redundant ones beyond adding to
the "features" list (as opposed to providing a real benefit).
4x4 1x1 1x1
Might sometimes be worth having but at 18 blocks/MCU is out of spec.
Regards,
Martin Brown
| |
| Bill Tuthill 2006-01-26, 6:55 pm |
| Pete Fraser <pfraser@covad.net> wrote:
>
> I regret introducing the 4:2:2 nomenclature into this conversation.
> I think when you're talking about 2x2 you're talking about what is called
> 4:2:0 (U and V sub-sampled by 2 in horizontal and vertical).
> Don't ask me why they call that 4:2:0. They must have been drunk.
That nomenclature should be OK on comp.compression, where participants
are supposed to be smart. We aren't on a Photoshop newsgroup, ya know.
This Wikipedia article uses that nomenclature:
http://en.wikipedia.org/wiki/Chroma_subsampling
You could be correct that ImageMagick 2x2 subsampling (and xv default)
is 4:2:0, but this JPEG introduction says 4:1:1, see Chroma sub-sampling:
http://photo.net/learn/jpeg/
The more I read the Wikipedia article, the more I think you're correct.
P.S. Thanks to Jasen Betts for the information about Gimp and libjpeg.
| |
| Pete Fraser 2006-01-26, 6:55 pm |
|
"Bill Tuthill" <can@spam.co> wrote in message news:43d90203@news.meer.net...
> You could be correct that ImageMagick 2x2 subsampling (and xv default)
> is 4:2:0, but this JPEG introduction says 4:1:1, see Chroma sub-sampling:
>
> http://photo.net/learn/jpeg/
Yes. It's wrong on a number of issues.
Article> For historical reasons the standard 1:1 chroma sampling is
sometimes called 4:4:4
True
Article> and the lower quality 2:1 sub-sampling is called 4:1:1.
Wrong. It's 4:2:2. (Chroma subsampled by 2 horizontally).
Article> The 4:2:2 option is an old standard from the television industry
which is seldom used.
Wrong. It's used all over the place in TV studios and professional gear.
Article> One exception seems to be consumer digicams which use the 4:2:2
sub-sampling.
True for DSCs. DV uses 4:1:1 for NTSC and 4:2:0 for PAL.
| |
| Bill Tuthill 2006-01-29, 6:55 pm |
| Pete Fraser <pfraser@covad.net> wrote:
>
> It's wrong on a number of issues.
>
> Article> and the lower quality 2:1 sub-sampling is called 4:1:1.
>
> Wrong. It's 4:2:2. (Chroma subsampled by 2 horizontally).
Perhaps we have a terminology issue.
What is the chroma subsampling type of ImageMagick -sampling_factor 2x2
or Gimp 2x2 1x1 1x1 ?? These appear to be the same. Jpegdump reports:
Baseline JPEG width 1068, height 800 components 3
id 1 horizontal sampling 2, vertical sampling 2, quantization table 0
id 2 horizontal sampling 1, vertical sampling 1, quantization table 1
id 3 horizontal sampling 1, vertical sampling 1, quantization table 1
Is this 4:1:1 or 4:2:0 as per http://en.wikipedia.org/wiki/YUV_4:2:0 ?
TIA.
| |
| Ben Rudiak-Gould 2006-01-29, 6:55 pm |
| NNTP-Posting-Host: br276.dow.private.cam.ac.uk
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
User-Agent: Thunderbird 1.5 (Windows/20051201)
In-Reply-To: <43dd0021@news.meer.net>
Xref: number1.nntp.dca.giganews.com comp.compression:68046
Bill Tuthill wrote:
> Is this 4:1:1 or 4:2:0 as per http://en.wikipedia.org/wiki/YUV_4:2:0 ?
Here's the correspondence:
4:4:4 1x1 1x1 1x1
4:2:2 2x1 1x1 1x1
4:2:0 2x2 1x1 1x1
4:1:1 4x1 1x1 1x1
-- Ben
| |
| Pete Fraser 2006-01-29, 6:55 pm |
| X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-Complaints-To: abuse@supernews.com
Lines: 39
Xref: number1.nntp.dca.giganews.com comp.compression:68047
"Bill Tuthill" <can@spam.co> wrote in message news:43dd0021@news.meer.net...
> Pete Fraser <pfraser@covad.net> wrote:
>
> Perhaps we have a terminology issue.
>
> What is the chroma subsampling type of ImageMagick -sampling_factor 2x2
> or Gimp 2x2 1x1 1x1 ?? These appear to be the same. Jpegdump reports:
>
> Baseline JPEG width 1068, height 800 components 3
> id 1 horizontal sampling 2, vertical sampling 2, quantization table 0
> id 2 horizontal sampling 1, vertical sampling 1, quantization table 1
> id 3 horizontal sampling 1, vertical sampling 1, quantization table 1
>
> Is this 4:1:1 or 4:2:0 as per http://en.wikipedia.org/wiki/YUV_4:2:0 ?
That's 4:2:0. I hate this way of talking about things, as it just doesn't
make sense. Anyway, that's what they call it. Don't blame me.
The original talk of 4:4:4, 4:2:2 and 4:1:1 came out of tests
performed by the European Broadcasting Union on digital video.
These tests led to a EBU standard, then to CCIR601 et al.
The numbers were never supposed to consider vertical sub-sampling,
but be used to represent a heirarchy of different luma sampling rates,
and corresponding chroma horizontal sub-sampling factore.
Some time later sombody decided that 4:2:0 could be used
to represent chroma that had been sub-sampled by 2 in V and H.
|
|
|
|
|