示例#1
0
文件: rb2rgb.c 项目: jbmulligan/quip
static int init_matrices(SINGLE_QSP_ARG_DECL)
{
	float *ptr;
	int i,j;

	if( c2p_dp == NULL ){
		warn("init_matrices: need to specify object for c2p_mat");
		return(-1);
	}
	if( p2c_dp == NULL ){
		warn("init_matrices: need to specify object for p2c_mat");
		return(-1);
	}
	ptr = (float *)OBJ_DATA_PTR(p2c_dp);
	for(i=0;i<3;i++)
		for(j=0;j<3;j++)
			*ptr++ = p2c_mat[i][j];
	dp_copy(c2p_dp,p2c_dp);
	dt_invert(c2p_dp);
	ptr = (float *)OBJ_DATA_PTR(c2p_dp);
	for(i=0;i<3;i++)
		for(j=0;j<3;j++)
			c2p_mat[i][j] = *ptr++;
	return(0);
}
示例#2
0
文件: xmvi.c 项目: E-LLP/QuIP
static void x_get_frame(QSP_ARG_DECL  Movie *mvip,uint32_t n,Data_Obj *dp)
{
	Data_Obj *src_dp;

	src_dp = (Data_Obj *)mvip->mvi_data;

	if( OBJ_FRAMES(src_dp) > 1 ){
		/* BUG won't work right if nseqs > 1 ... */
		char index[16];
		sprintf(index,"[%d]",n);
		src_dp = index_data(QSP_ARG  src_dp,index);
	}

	if( dp_same(QSP_ARG  src_dp,dp,"x_get_frame") ) return;

	dp_copy(QSP_ARG  dp,src_dp);
}
示例#3
0
文件: rb2rgb.c 项目: jbmulligan/quip
static int install_white(SINGLE_QSP_ARG_DECL)
{
	int j,k;
	float wc[3];	/* white chromaticity */
	float uv[3];	/* unit vector */
	float *ptr;

	if( init_matrices(SINGLE_QSP_ARG) < 0 ) return(-1);

	/* we assume we already have the white point */
	if( ! know_white )
		error1("install_white:  white point not defined!?");


	for(j=0;j<3;j++) wc[j] = _white[j];
showvec(wc);
	rgb2rb(wc);	/* now we have the chromaticity of the white point */
advise("white transformed to opponent space");
showvec(wc);

	for(j=0;j<3;j++) uv[j] = wc[j];
	uv[0]+= 0.1;	/* take a step in the red cone direction */
	rb2rgb(uv);
	for(j=0;j<3;j++) uv[j] -= _white[j];

	/* now have an rgb vector for an red cone step */
	/* normalize this relative to the white point */
	/* this is to guarantee that amp. of +-1 won't overflow */
advise("red cone vector");
showvec(wc);

	wnorm(uv);

	/* now set the entries of the o2p matrix */
	for(j=0;j<3;j++) o2p_mat[j][0] = uv[j];

	for(j=0;j<3;j++) uv[j] = wc[j];
	uv[1]+= 0.1;	/* take a step in the blue cone  direction */
	rb2rgb(uv);
	for(j=0;j<3;j++) uv[j] -= _white[j];

	/* now have an rgb vector for a blue cone step */

	wnorm(uv);

	for(j=0;j<3;j++) o2p_mat[j][1] = uv[j];

	for(j=0;j<3;j++) uv[j] = _white[j];
	wnorm(uv);
	for(j=0;j<3;j++) o2p_mat[j][2] = uv[j];

	ptr = (float *)OBJ_DATA_PTR(o2p_dp);
	for(j=0;j<3;j++)
		for(k=0;k<3;k++)
			*ptr++ = o2p_mat[j][k];
	dp_copy(p2o_dp,o2p_dp);
	dt_invert(p2o_dp);
	ptr = (float *)OBJ_DATA_PTR(p2o_dp);
	for(j=0;j<3;j++)
		for(k=0;k<3;k++)
			p2o_mat[j][k] = *ptr++;

	return(0);
}