24 static unsigned int to_int(
double d ) ;
30 unsigned int g_colourspace_y(
unsigned int r ,
unsigned int g ,
unsigned int b )
33 ((
double)r)/255.*219.*0.299 +
34 ((
double)g)/255.*219.*0.587 +
35 ((
double)b)/255.*219.*0.114 ) ;
38 unsigned int g_colourspace_u(
unsigned int r ,
unsigned int g ,
unsigned int b )
41 -((
double)r)/255.*224.*0.169
42 -((
double)g)/255.*224.*0.331 +
43 ((
double)b)/255.*224.*0.5 ) ;
46 unsigned int g_colourspace_v(
unsigned int r ,
unsigned int g ,
unsigned int b )
49 ((
double)r)/255.*224.*0.5 +
50 -((
double)g)/255.*224.*0.419 +
51 -((
double)b)/255.*224.*0.081 ) ;
54 unsigned int g_colourspace_r(
unsigned int y ,
unsigned int ,
unsigned int v )
57 ((
double)(y)-16.)*255./219. +
58 ((
double)(v)-128.)*255./112.*0.701 ) ;
61 unsigned int g_colourspace_g(
unsigned int y ,
unsigned int u ,
unsigned int v )
64 ((
double)(y)-16.)*255./219. +
65 -((
double)(u)-128.)*255./112.*0.886*0.114/0.587 +
66 -((
double)(v)-128.)*255./112.*0.701*0.299/0.587 ) ;
69 unsigned int g_colourspace_b(
unsigned int y ,
unsigned int u ,
unsigned int )
72 ((
double)(y)-16.)*255./219. +
73 ((
double)(u)-128.)*255./112.*0.886 ) ;
76 static unsigned int to_int(
double d )
78 int i = (int)(d+0.5) ;
79 return i < 0 ? 0U : ( i > 255 ? 255U : (
unsigned int)i ) ;