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. |
11th May 2020, 15:51 | #1 | Link |
hlg-tools Maintainer
Join Date: Feb 2008
Posts: 413
|
How Is YUV410P10LE Encoded?
ADDENDUM: 420, not 410
I'm trying to figure out how YUV420P10LE is encoded. I surmise that first there are the luminance values, one for each pixel. Next, there are the Cb values, one for every four pixels. Then, there are the Cr values, also one for every four pixels. Y, I assume, has 0 to represent the darkest amount of light and 1023 to represent the most amount of light. But how in the world are Cb and Cr mapped onto the color plane? I wasn't able to figure this out. Are they two's compliment? I ultimately want to convert to and from RGB, given the appropriate colorspace constants. Last edited by wswartzendruber; 11th May 2020 at 22:08. |
12th May 2020, 19:25 | #2 | Link |
Registered User
Join Date: Mar 2015
Posts: 775
|
Hope this will help:
yes it is plane by plane as you suggested. 1) get uint16 values 2) upscale Cb and Cr to picture dimensions (2x wide and 2x high) 3) conversion to RGB Y is unsigned value with range 0 to 1023 (0 may be darkest or not - depends on full range flag) subtract 512 from Cb/Cr to get signed value (useful signed range -512 to 511) Refer to formulas here http://www.vapoursynth.com/doc/functions/resize.html (bottom of page "pixel range")
__________________
VirtualDub2 |
24th September 2020, 11:57 | #3 | Link | |
Registered User
Join Date: Sep 2020
Location: Wilmington
Posts: 7
|
Quote:
|
|
24th September 2020, 14:35 | #4 | Link |
Angel of Night
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,559
|
If you're obtaining yuv420p10le then it's probably coming directly from ffmpeg, since other software tends to use the term P210. You should have ffmpeg upconvert it to yuv420p16le (or yuv444p16le) for you so that you don't have to do the messy work; it'll do it faster and better anyway.
|
18th December 2020, 02:00 | #5 | Link | |
hlg-tools Maintainer
Join Date: Feb 2008
Posts: 413
|
Quote:
Now, another question: I have noticed that increasing the Y value does brighten a pixel, but also causes to appear desaturated. It looks like I have to modify the Cb and Cr components when I adjust Y. How does this work? EDIT: Bonus question: Is it true that some YCbCr combinations are outside of the RGB colorspace? Are such values invalid? |
|
18th December 2020, 21:03 | #6 | Link | |||
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Quote:
If you had red $FF0000, it would be fully saturated, whereas $FF8080 would have a lot of impurity in it (white, governed by the lowest component). [EDIT: Nah, above aint quite right, it involves max channel as well as min channel, the closer the lowest channel gets to the highest channel , the less is the saturation. Sat = Something like 1.0 - (min / max), or if max==0.0 then 0.0] If you in YUV raise Y, so you are increasing white component and so less saturated. Quote:
but ColorYUV(cont_u=8,cont_v=8) would raise U & V contrast [approx saturation increase] from center $80 [moving out from center] whereas ColorYUV(cont_u= -8,cont_v= -8) would reduce saturation. U & V contrast would normally be kept same else color shift. The numbers dont quite work right changing Y, you cant really say how U & V should be changed, but maybe both in same [contrast] direction as Y change although by how much [and may not be possible] to get exactly right [and probably not same change for both U & V]. Also, would change all the colors in image differently, the numbers just dont work well for YUV. Quote:
Also, YUV = $FFFFFF or $FF0000 would be fully saturation white, just cant happen, they are mythical colors outside of RGB colorspace. [Or also $00FF00 or $0000FF, or $FFFF00, or $FF00FF, all totally impossible, as are many others] Others may [and probably will] give a better reply to your perfectly good questions [I did my best, it was crap ].
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 19th December 2020 at 19:09. |
|||
Thread Tools | Search this Thread |
Display Modes | |
|
|