Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 Doom9's Forum YUV to RGB Conversion
 Register FAQ Calendar Search Today's Posts Mark Forums Read

 26th February 2021, 08:34 #1  |  Link Valentin Nikin Registered User   Join Date: Feb 2021 Posts: 4 YUV to RGB Conversion Hello! https://en.wikipedia.org/wiki/YUV#Co...on_to/from_RGB Can someone explain to me where from Umax and Vmax coefficients? In BT.601 and BT.709 standards nothing about this values.
 26th February 2021, 09:06 #2  |  Link Sharc Registered User   Join Date: May 2006 Posts: 3,977 You won't find Umax and Vmax in the current ITU-R BT.601-7 document which refers to digital TV. U,V has its roots in analog color TV. Digital systems define Cb,Cr rather than U,V. You may find these links helpful: https://software.intel.com/content/w...ml?language=en The basic equations are Y'= 0.299*R' + 0.587*G' + 0.114*B' U'= -0.147*R' - 0.289*G' + 0.436*B' = 0.492*(B'- Y') V'= 0.615*R' - 0.515*G' - 0.100*B' = 0.877*(R'- Y') With R'G'B' in the range of [0,1] the maximum value of V' becomes 0.615 (for R'G'B'=[1,0,0]), and the maximum value of U' becomes 0.436 (for R'G'B'=[0,0,1]). For the various conversion matrices see here: https://web.archive.org/web/20120403...onversion.html For analog TV the "YUV - RGB Color Format Conversion" matrix applies. In the digital realm there is no U,V, but unfortunately it is often used in exchange of Cb, Cr which is not correct. Last edited by Sharc; 27th February 2021 at 15:26. Reason: Links and clarifications added
 27th August 2021, 19:36 #3  |  Link Balling Registered User   Join Date: Feb 2020 Posts: 529 Umax and Vmax are also present in BT.601/BT.709 standards. Both of them are set to 1/2 though. Also Umax and Vmax of old analog are defined in BT.470. There was an error made there though. 0.493 is incorrect as given there. It was too late to correct it though. Last edited by Balling; 28th August 2021 at 15:41.
28th August 2021, 09:04   #4  |  Link
Sharc
Registered User

Join Date: May 2006
Posts: 3,977
Quote:
 Originally Posted by Balling Umax and Vmax are also present in BT.609/BT.709 standards. Both of them are set to 1/2 though. Also Umax and Vmax of old analog are defined in BT.470. There was an error made there though. 0.493 is incorrect as given there. It was too late to correct it though.
What should it be then: 0.492 or 0.5?

28th August 2021, 15:40   #5  |  Link
Balling
Registered User

Join Date: Feb 2020
Posts: 529
Quote:
 Originally Posted by Sharc What should it be then: 0.492 or 0.5?
0.4926. In practice all hardware decoders used that number in a form of 1/2.03, so... that it is not Umax or Vmax and has nothing to do with 1/2 Umax=Vmax in digital standards. You confused that in previous post.

You can read it in SMPTE 170M but I will quote for you:

(It should be noted that there is an apparent error in the 1953 calculations of these reduction factors. Although the
calculations were performed to a high degree of precision, a luminance matrix coefficient of 0.115 was used for blue
instead of the correct 0.114. This resulted in values of 0.493 and 0.877 for B-Y and R-Y, respectively. These were
normally approximated to 1/2.03 and 1/1.14, respectively. The error was not significant in the equations published to an
accuracy of two significant figures, but it is significant for the higher precision equations used in this standard. The values
quoted below and used in this standard are derived from the correct luminance matrix.) (Lower case is used to distinguish
the reduced values:
b-y = 0.492111...(B-Y); (4)
r-y = 0.877283...(R-Y).)

Last edited by Balling; 30th March 2023 at 09:55.

 28th August 2021, 16:10 #6  |  Link Sharc Registered User   Join Date: May 2006 Posts: 3,977 Thank you for clarifying.
28th August 2021, 16:22   #7  |  Link
Balling
Registered User

Join Date: Feb 2020
Posts: 529
Quote:
 Originally Posted by Sharc Thank you for clarifying.
Just again. 0.5 and 0.493 are not the same values. at all. Umax and Vmax in BT.470 were 0.436 and 0.615 respectivly while in digital realm both became 0.5. Please note that NTSC further applied 33 degree rotation matrix and swapped U' and V' to get Y'IQ. So U' is Q and V' becomes I. Okay?

Last edited by Balling; 28th August 2021 at 16:29.

 28th August 2021, 23:53 #8  |  Link Sharc Registered User   Join Date: May 2006 Posts: 3,977 I knew the 0.436 and 0.615 of BT.470 but I wasn't aware that both became 0.5 in the digital realm. Thanks.
 14th January 2022, 09:04 #9  |  Link kura Registered User   Join Date: Jan 2022 Posts: 1 Hello. I am not good at English, so I am using automatic translation. I apologize if there are any incorrect expressions. In conclusion, Umax and Umin can be derived from the following equations. Umax = (1-Wb)*SQRT(((Wg/3+Wb-2*Wr*Wb)*((1-Wr+Wb)/3+Wb))/(Wg*(Wg+2*Wb*Wr))) Vmax = (1-Wr)*SQRT(((Wg/3+Wb-2*Wr*Wb)*((1-Wr+Wb)/3+Wb))/(Wg*(Wg+2*Wb*Wr))) The reason for this comes from the inequality explained here on p. 107. https://drive.uqu.edu.sa/_/mskhayat/...timedia_2e.pdf This means that Y'±√(U^2+V^2) must be exactly in the range of -1/3 to 4/3. It is important to note that there is symmetry in the Y'UV space, so you only need to examine Y'+√(U^2+V^2) ≤ 4/3. Let U = Cu*(B'-Y'), V = Cv*(R'-Y'). The goal is to find the conditions under which the parallelepiped in Y'UV space, transferred by linear transformation of the RGB cube, fits exactly into the cone of Y'+√(U^2+V^2) = Y'+√(Cu^2*(B'-Y')^2+Cv^2*(R'-Y')^2) ≤ 4/3. You will soon see that you only need to test each vertex of the parallelepiped. For example, if vertex (R', G', B')=(1, 0, 0), then Y'=Wr, so the inequality is the following ellipse of Cu and Cv. Wr^2*Cu^2+(1-Wr)^2*Cv^2≤(4/3-Wr)^2 By finding the equations of the ellipses for the 8 vertices and examining their common parts, you can find 2 such ellipses whose overlapping parts satisfy the inequalities of the remaining 6 ellipses. The RGB values corresponding to those 2 ellipses are (1, 1, 0) and (0, 1, 1). Finally, the point where the boundaries of the 2 ellipses intersect gives Umax and Umin. (1-Wb)^2*Cu^2+Wb^2*Cv^2 = (1/3+Wb)^2 Wr^2*Cu^2+(1-Wr)^2*Cv^2 = (1/3+Wr)^2 Umax = Cu/(1-Wb) Vmax = Cv/(1-Wr) I hope this helps you.

 Tags conversion, rgb, yuv

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements and Chat     General Discussion     News     Forum / Site Suggestions & Help General     Decrypting     Newbies     DVD2AVI / DGIndex     Audio encoding     Subtitles     Linux, Mac OS X, & Co Capturing and Editing Video     Avisynth Usage     Avisynth Development     VapourSynth     Capturing Video     DV     HDTV / DVB / TiVo     NLE - Non Linear Editing     VirtualDub, VDubMod & AviDemux     New and alternative a/v containers Video Encoding     (Auto) Gordian Knot     MPEG-4 ASP     MPEG-4 Encoder GUIs     MPEG-4 AVC / H.264     High Efficiency Video Coding (HEVC)     New and alternative video codecs     MPEG-2 Encoding     VP9 and AV1 (HD) DVD, Blu-ray & (S)VCD     One click suites for DVD backup and DVD creation     DVD & BD Rebuilder     (HD) DVD & Blu-ray authoring     Advanced authoring     IFO/VOB Editors     DVD burning Hardware & Software     Software players     Hardware players     PC Hard & Software Programming and Hacking     Development     Translations

All times are GMT +1. The time now is 07:17.

 Doom9.org - Archive - Top