Skip to content

rzwm/YUVRGBFormulaGenerator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YUVRGBFormulaGenerator

YUV and RGB conversion formula generator.

Welcome to YUV and RGB conversion formula generator!

Which formula do you want to generate?
->0: BT.601
->1: BT.709
->Other: Customize
Please select:
0

Do you want output fixed point formula the same time?
->0: NO!
->Other: YES!
Please select:
1
Please input Scale(an integer to convert float to fixed point):
1024

BT.601
Parameters:
W_R:   0.299000
W_G:   0.587000
W_B:   0.114000
U_max: 0.436000
V_max: 0.615000
Scale: 1024

Y->[0, 255] U->[-255U_max, 255U_max] V->[-255V_max, 255V_max]
Y =  0.299000R + 0.587000G + 0.114000B
U = -0.147138R - 0.288862G + 0.436000B
V =  0.615000R - 0.514986G - 0.100014B
R = Y + 1.139837V
G = Y - 0.394652U - 0.580599V
B = Y + 2.032110U
Y = (306R + 601G + 117B + 512) / 1024
U = (-151R - 296G + 446B + 512) / 1024
V = (630R - 527G - 102B + 512) / 1024
R = (1024Y + 1167V + 512) / 1024
G = (1024Y - 404U - 595V + 512) / 1024
B = (1024Y + 2081U + 512) / 1024

Y->[16, 235] U->[16, 240] V->[16, 240]
Y =  0.256788R + 0.504129G + 0.097906B + 16
U = -0.148223R - 0.290993G + 0.439216B + 128
V =  0.439216R - 0.367788G - 0.071427B + 128
R = 1.164384(Y - 16) + 1.596027(V - 128)
G = 1.164384(Y - 16) - 0.391762(U - 128) - 0.812968(V - 128)
B = 1.164384(Y - 16) + 2.017232(U - 128)
Y = (263R + 516G + 96B + 16 + 512) / 1024
U = (-152R - 298G + 450B + 128 + 512) / 1024
V = (450R - 377G - 73B + 128 + 512) / 1024
R = (1192(Y - 16) + 1634(V - 128) + 512) / 1024
G = (1192(Y - 16) - 401(U - 128) - 832(V - 128) + 512) / 1024
B = (1192(Y - 16) + 2066(U - 128) + 512) / 1024

Y->[0, 255] U->[0, 255] V->[0, 255]
Y =  0.299000R + 0.587000G + 0.114000B
U = -0.168736R - 0.331264G + 0.500000B + 128
V =  0.500000R - 0.418688G - 0.081312B + 128
R = Y + 1.402000(V - 128)
G = Y - 0.344136(U - 128) - 0.714136(V - 128)
B = Y + 1.772000(U - 128)
Y =  (306R + 601G + 117B + 512) / 1024
U = (-173R - 339G + 512B + 128 + 512) / 1024
V =  (512R - 429G - 83B + 128 + 512) / 1024
R = (1024Y + 1436(V - 128) + 512) / 1024
G = (1024Y - 352(U - 128) - 731(V - 128) + 512) / 1024
B = (1024Y + 1815(U - 128) + 512) / 1024

Done!

Releases

No releases published

Packages

No packages published

Languages