Example #1
0
static void do_ycca_to_rgba_normalized(bNode *node, float *out, float *in)
{
	/*un-normalize the normalize from above */
	in[0]=(in[0]*255.0)+16;
	in[1]=(in[1]*255.0)+128;
	in[2]=(in[2]*255.0)+128;
	ycc_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2]);
	out[3]=in[3];
}
void ConvertYCCToRGBOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
	float inputColor[4];
	this->m_inputOperation->read(inputColor, x, y, sampler);

	/* need to un-normalize the data */
	/* R,G,B --> Y,Cb,Cr */
	mul_v3_fl(inputColor, 255.0f);

	ycc_to_rgb(inputColor[0], inputColor[1], inputColor[2], &output[0], &output[1], &output[2], this->m_mode);
	output[3] = inputColor[3];
}
Example #3
0
static void do_comb_ycca_jfif(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4)
{
	float r,g,b;
	float y, cb, cr;

	/*need to un-normalize the data*/
	y=in1[0]*255;
	cb=in2[0]*255;
	cr=in3[0]*255;

	ycc_to_rgb(y,cb,cr, &r, &g, &b, BLI_YCC_JFIF_0_255);
	
	out[0] = r;
	out[1] = g;
	out[2] = b;
	out[3] = in4[0];
}
Example #4
0
static void do_ycca_to_rgba_normalized(bNode *UNUSED(node), float *out, float *in)
{
   /*un-normalize the normalize from above */
   in[0]=(in[0]+1.0)/2.0;
   in[1]=(in[1]+1.0)/2.0;
   in[2]=(in[2]+1.0)/2.0;

   in[0]=(in[0]*255.0);
   in[1]=(in[1]*255.0);
   in[2]=(in[2]*255.0);

//	in[0]=(in[0]*255.0)+16;
//	in[1]=(in[1]*255.0)+128;
//	in[2]=(in[2]*255.0)+128;
	ycc_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
	out[3]=in[3];
}
Example #5
0
static void node_composit_exec_combycca(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
	/* stack order out: 1 ycca channels */
	/* stack order in: 4 value channels */
	
	/* input no image? then only color operation */
	if((in[0]->data==NULL) && (in[1]->data==NULL) && (in[2]->data==NULL) && (in[3]->data==NULL)) {
		float y = in[0]->vec[0] * 255;
		float cb = in[1]->vec[0] * 255;
		float cr = in[2]->vec[0] * 255;
		
		switch(node->custom1)
		{
		case 1:
			ycc_to_rgb(y, cb, cr, &out[0]->vec[0], &out[0]->vec[1], &out[0]->vec[2], BLI_YCC_ITU_BT709);
			break;
		case 2:
			ycc_to_rgb(y, cb, cr, &out[0]->vec[0], &out[0]->vec[1], &out[0]->vec[2], BLI_YCC_JFIF_0_255);
			break;
		case 0:
		default:
			ycc_to_rgb(y, cb, cr, &out[0]->vec[0], &out[0]->vec[1], &out[0]->vec[2], BLI_YCC_ITU_BT601);
			break;
		}
		
		out[0]->vec[3] = in[3]->vec[0];
	}
	else {
		/* make output size of first available input image */
		CompBuf *cbuf;
		CompBuf *stackbuf;

		/* allocate a CompBuf the size of the first available input */
		if (in[0]->data) cbuf = in[0]->data;
		else if (in[1]->data) cbuf = in[1]->data;
		else if (in[2]->data) cbuf = in[2]->data;
		else cbuf = in[3]->data;
		
		stackbuf = alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* allocs */
		
		
		switch(node->custom1)
		{
		case 1:
			composit4_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec, 
			                          in[2]->data, in[2]->vec, in[3]->data, in[3]->vec, 
			                          do_comb_ycca_709, CB_VAL, CB_VAL, CB_VAL, CB_VAL);
			break;
		
		case 2:
			composit4_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec, 
			                          in[2]->data, in[2]->vec, in[3]->data, in[3]->vec, 
			                          do_comb_ycca_jfif, CB_VAL, CB_VAL, CB_VAL, CB_VAL);
			break;
		case 0:
		default:
			composit4_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec, 
			                          in[2]->data, in[2]->vec, in[3]->data, in[3]->vec, 
			                          do_comb_ycca_601, CB_VAL, CB_VAL, CB_VAL, CB_VAL);
			break;
		}

		out[0]->data= stackbuf;
	}	
}