[FFmpeg-user] Does converting to yuv444p by default make sense?
Nicolas George
nicolas.george at normalesup.org
Wed Jul 31 12:02:54 CEST 2013
Le duodi 12 thermidor, an CCXXI, thljcl a écrit :
> Basically, if you've learned linear algebra before, you may understand right
> away why YUV444p can represent all colors from R'G'B'. Before you denounce
> my answer, please watch the video first to see if there is anything wrong
> with my math.
There is something wrong with your math: you forget that the pixel formats
do not correspond to vector spaces, but to only discrete parallelepipeds.
There are only a few affine bijections from a parallelepipeds to another,
and the RGB <-> YUV conversion is not one of them: at least one of the
parallelepipeds overflows the other.
As it happens, the YUV parallelepiped is wider than the RGB cube, so your
claim that RGB -> YUV is lossless stands on that regard; only you did not
provide the full proof, so you do not get the full mark. But the opposite
direction does not work: for example, full chroma with no luma maps to pixel
values of 278, which is not possible.
And there is the discrete issue. Since the YUV parallelepiped is larger than
the RGB cube, if they hold the same number of discrete points, the YUV
discrete points are further apart, and several RGB points will fall on the
same YUV point. The matrix has a determinant of about 6.4, that is 2.7 extra
bits, so if you want perfect RGB -> YUV conversion from 8-bits depth, you
need at least 9-bits depth on the YUV side. It may become apparent in
gradients.
Regards,
--
Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20130731/a8575810/attachment.asc>
More information about the ffmpeg-user
mailing list