[FFmpeg-user] Does converting to yuv444p by default make sense?
thljcl
jiachielee at live.com
Wed Jul 31 16:47:05 CEST 2013
I only attempt to calculate the original value for R (0-255), G (0-255), and
B (0-255). As far as I understand, RGB color space is NOT vector space and I
did not see it as such.
I realized that RGB color space is not a vector space from the very
beginning. The reason is quite simple. For a 3-channels 24-bit RGB color
space, it is a set with only limited number of elements, which is 16,777,216
number of colors. In a vector space, without regards to the actual inner
product space structure, we generally do not have a boundary for a given
field of number. But each color is represented by three unique numbers; in
this case, it is similar to a coordinate system used for describing
Euclidean Space. But as you pointed out, only non-negative integer value is
allowed for R, G, and B; the number is between 0-255, at least in the case
for sRGB color space.
But if I understood correctly, YCbCr is NOT an absolute color space. What is
an absolute color space? It is a color space in which colors are
unambiguous, that is, where the interpretation of colors in the space are
colorimetrically defined without reference to external factors. There are
different ways to define absolute color space. Two examples are CIEXZY and
sRGB. In other words, colors cannot be defined unambiguously without
absolute color space. If YCbCr is not an absolute color space, without
knowing how the absolute color space that it is mapped to being defined, we
cannot have unambiguously defined colors either.
As I said before there are many linear map standards being used, I only use
one example to clarify how they re-encode color information in YCbCr. We DO
NOT and ARE NOT able to define colors without absolute color space, thus
cannot define colors with YCbCr alone. Say we are able to define all
16,777,216 number of colors in sRGB color space; the representation of color
in YCbCr is a merely an affine map from the absolute color space; not the
other way around.
Put it in another way, I merely treated R’, G’, and B’ as three unknowns in
a system of three independent linear equations, which are being used to
define color in an absolute color space; but in the example of the video I
showed, is it possible to find unique solution with a known given affine map
and three known values for Y, Cb, and Cr? The answer is yes. If only 0-255
is allowed for the definition of color in each channel of R’, G’, and B’,
there is no way the inverse affine map will yield a negative value or any
other values. In fact, if the affine map is used, there will be exactly
16,777,216 number of possible values of Y, Cb, and Cr since they are defined
from an affine transformation from a RGB color space.
That said, as you can see from the video, due to rounding, it’s still need
to make appropriate rounding or quantization to fulfill the complete
one-to-one relationship. Granted, if YCbCr is treated as an absolute color
space, and other values other than the 16,777,216 number of values are
allowed, solving the equations may lead us to negative values or
non-integers as you suggested.
The fact to the matter is, different device or software or operating system
may use different absolute color space. But YCbCr is not one of them.
So, why we specifically define an affine map to yield YCbCr representations,
a simple way to say is that we separate the color information to three
different channels, instead of Red, Green, Blue, we choose Luma, Chroma Red
Difference, and Chroma Blue difference. That’s not strictly true however.
One would point out that if there is no chroma information, it would be
grayscale or black and white. But the truth is since YCbCr is defined as
affine map to the RGB color space, different levels of “gray” or “black” and
“white” can actually still be represented by three numbers, R, G, and B. In
particular, Black is represented by “0,0,0” in sRGB. Every single color
requires three numbers in sRGB. Even if there is only 256 colors in gray
scale, the colors are still represented by three numbers.
256 × 1 × 1= 256
In other words, in gray scale, in YCbCr representations, we only needs a
single unique but maybe different number for both Cb and Cr channels;
whereas in Y channels, 256 numbers are allowed. Unlike sRGB, these 256
numbers in Y channels are not necessarily integers. In the original sRGB
color space, there are also 256 numbers required, but each time the number
for each channel, namely, R, G, and B would change accordingly. That’s why
re-encoding to the relative color space YCbCr makes sense as human eyes are
less sensitive to the change in chroma information compared with luma
information. This re-encoding provides the foundation for chroma
subsampling, which is to reduce the number of pixels to store chroma
information for a given sample. But makes no mistake. The colors are still
defined by sRGB representation in Windows PC or other RGB color space in
other systems. YCbCr is merely a representation given by affine map. That’s
all.
--
View this message in context: http://ffmpeg-users.933282.n4.nabble.com/Does-converting-to-yuv444p-by-default-make-sense-tp4660219p4660374.html
Sent from the FFmpeg-users mailing list archive at Nabble.com.
More information about the ffmpeg-user
mailing list