News for hackers. Stuff that matters.
Re:John Carmack on JPEG by cornstalks on Friday June 04, 2021 @07:32PM (#27400341)
Mathematically Y'CbCr is a lossless conversion of RGB. Practically there are some losses, though, especially if you use video-range.

4:1:1 is half of RGB but I've never seen anyone ever use it. Pretty much everything in use today (at the consumer level) uses 4:2:0. It's good enough for today's standards (AV1 Main profile only supports 4:0:0 and 4:2:0).

Re:John Carmack on JPEG by layoutIfNeeded on Saturday June 05, 2021 @07:53AM (#27404151)
>Mathematically Y'CbCr is a lossless conversion of RGB.

Assuming infinite precision, sure.

Interestingly however, there's a closely related color space called YCoCg, that actually does achieve lossless coversion to/from RGB (this lossless variant is often referred to as YCoCg-R, the R stands for "reversible"): https://en.wikipedia.org/wiki/YCoCg#The_lifting-based_YCoCg-...

Re:John Carmack on JPEG by pdq on Friday June 04, 2021 @08:54PM (#27400919)
This is correct, with one subtlety.

YUV to RGB conversion (and vice-versa) requires use of conversion coefficients (BT.470, BT.709, etc): https://en.wikipedia.org/wiki/YUV

Different apps/algorithms can choose their own coefficients, so you get a slightly different RGB colors. If you converted RGB back to YUV with a different set of coefficients, you would get a different result.

Re:John Carmack on JPEG by astrange on Saturday June 05, 2021 @01:53AM (#27402581)
JPEG specifies the matrix, I think it's the same as BT.470. It's fairly easy to guess the intent even if the metadata is missing (which, well, it usually is) - just have to know if the source is a video or not and then if it's HD or not.
Re:John Carmack on JPEG by cvwright on Friday June 04, 2021 @07:59PM (#27400561)
What’s 4:1:1? What people call 4:2:0 is actually 4 pixels of Y and 1 each of Cb and Cr.
Re:John Carmack on JPEG by cornstalks on Friday June 04, 2021 @08:20PM (#27400720)
Wikipedia has a decent article with visuals: https://en.wikipedia.org/wiki/Chroma_subsampling#Sampling_sy...

The difference between 4:1:1 and 4:2:0 is that in 4:1:1 the chroma covers a 1x4 line of pixels whereas in 4:2:0 the chroma covers a 2x2 square of pixels.

Re:John Carmack on JPEG by cvwright on Saturday June 05, 2021 @12:44PM (#27406537)
TIL. Thanks!