[argyllcms] RGB > primaries / secondaries equations ?!
- From: lee scratchy <leescratchy@xxxxxxxxxxx>
- To: <argyllcms@xxxxxxxxxxxxx>
- Date: Tue, 13 May 2008 15:11:38 +0000
hi there,
a friend of mine is skilled enough to make Pixel Shader scripts usable in
KMPlayer and MPC HC.
he made some for sharpen, deinterlace, convergence for misconverged displays,
etc etc
he offered to make one for setting up the saturations of primaries/secondaries
this might come in very handy for my HC3100 projector, where the CYAN
saturation is definitely not high enough...
but he needs to know the equations that can do RGB> primaries/secondaries, and
then primaries/secondaries> RGB.
anyone's got a clue please ?
here's a PS script that enables to change the saturation/hue, but not for each
color :
sampler s0 : register(s0);
float4 p0 : register(c0);
float4 p1 : register(c1);
#define width (p0[0])
#define height (p0[1])
#define counter (p0[2])
#define clock (p0[3])
#define one_over_width (p1[0])
#define one_over_height (p1[1])
#define PI acos(-1)
#define lumR (0.299)
#define lumG (0.587)
#define lumB (0.114)
// linear RGB:
//#define lumR (0.3086)
//#define lumG (0.6094)
//#define lumB (0.0820)
#define saturation 1.5
float4 main(float2 tex : TEXCOORD0) : COLOR
{
float4 c0 = tex2D(s0, tex);
float satCompl = 1.0 - saturation;
float satComplR = lumR * satCompl;
float satComplG = lumG * satCompl;
float satComplB = lumB * satCompl;
float r=(satComplR + saturation)*c0.r + satComplG*c0.g + satComplB*c0.b;
float g=satComplR*c0.r + (satComplG + saturation)*c0.g + satComplB*c0.b;
float b=satComplR*c0.r + satComplG*c0.g + (satComplB + saturation)*c0.b;
return float4(r,g,b,0);
}
TIA,
-Maxime
_________________________________________________________________
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx
Other related posts: