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.

 

Go Back   Doom9's Forum > Programming and Hacking > Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 11th May 2020, 15:51   #1  |  Link
wswartzendruber
Registered User
 
wswartzendruber's Avatar
 
Join Date: Feb 2008
Posts: 68
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.
wswartzendruber is offline   Reply With Quote
Old 12th May 2020, 19:25   #2  |  Link
shekh
Registered User
 
Join Date: Mar 2015
Posts: 755
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
shekh is offline   Reply With Quote
Old 24th September 2020, 11:57   #3  |  Link
HowardWow1997
Registered User
 
HowardWow1997's Avatar
 
Join Date: Sep 2020
Location: Wilmington
Posts: 7
Quote:
Originally Posted by shekh View Post
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")
Thank you for this
HowardWow1997 is offline   Reply With Quote
Old 24th September 2020, 14:35   #4  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,529
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.
__________________
There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order.
foxyshadis is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Jump


All times are GMT +1. The time now is 08:54.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.