iuv2rgb

Syntax

int iuv2rgb(int i, int u, int v, int z)

Arguments

i
i value
u
u value
v
v value
z
Determines which value is returned. z=0 for Red, z=1 for Green, z=2 for Blue

Return

Returns the red, green or blue value depending on the value of z

Description

Lets you convert YUV values to RGB values.

Example

%ffp 

ctl(0): "Y Adjust",range=(-255,255),val=0
ctl(1): "U Adjust",range=(-255,255),val=0
ctl(2): "V Adjust",range=(-255,255),val=0


ForEveryTile:
{
	int r,g,b,i,u,v;

	for (y=y_start; y<y_end; y++){
		updateProgress(y,y_end);
	for (x=x_start; x<x_end; x++){ 

		r=src(x,y,0);
		g=src(x,y,1);
		b=src(x,y,2);
		
		i=rgb2iuv(r,g,b,0) + ctl(0);
		u=rgb2iuv(r,g,b,1) + ctl(1);
		v=rgb2iuv(r,g,b,2) + ctl(2);

		r=iuv2rgb(i,u,v,0);
		g=iuv2rgb(i,u,v,1);
		b=iuv2rgb(i,u,v,2);

		pset(x, y, 0,  r);
		pset(x, y, 1,  g);
		pset(x, y, 2,  b);

	}}

	return true;
}

Also see

rgb2iuv

Comments

Everyone can add his comments about his experiences with this function here. Tips for using it are welcome, too.