Пример #1
0
int main(){
  vsip_init((void*)0);
  acos_f();
  asin_f();
  atan2_f();
  atan_f();
  cos_f();
  sin_f();
  sqrt_f();
  tan_f();
  ceil_f();
  exp_f();
  exp10_f();
  floor_f();
  fmod_f();
  hypot_f();
  log_f();
  log10_f();
  mag_f();
  max_f();
  min_f();
  pow_f();
  rsqrt_f();
  sinh_f();
  tanh_f();
  cosh_f();
  arg_f();
  cadd_f();
  cdiv_f();
  cexp_f();
  cjmul_f();
  cmul_f();
  clog_f();
  cmag_f();
  cmagsq_f();
  cmplx_f();
  cneg_f();
  conj_f();
  crecip_f();
  csqrt_f();
  csub_f(0);
  imag_f();
  real_f();
  polar_f();
  rect_f();
  vsip_finalize((void*)0);
  return 0;
}
Пример #2
0
void rgb_to_hsv(float R, float G, float B,float *H, float *S, float *V)
{
	//Conversion into HSV color space to get Hue
	float r = R / 255.0f;
	float g = G / 255.0f;
	float b = B / 255.0f;

	float h, s, v; // h:0-360.0, s:0.0-1.0, v:0.0-1.0

	float max = max_f(r, g, b);
	float min = min_f(r, g, b);

	v = max;

	if (max == 0.0f) {
		s = 0;
		h = 0;
	}
	else if (max - min == 0.0f) {
		s = 0;
		h = 0;
	}
	else {
		s = (max - min) / max;

		if (max == r) {
			h = 60 * ((g - b) / (max - min)) + 0;
		}
		else if (max == g) {
			h = 60 * ((b - r) / (max - min)) + 120;
		}
		else {
			h = 60 * ((r - g) / (max - min)) + 240;
		}
	}

	if (h < 0) h += 360.0f;

	*H = (unsigned char)(h);       // dst_h : 0-360
	*S = (unsigned char)(s * 255); // dst_s : 0-255
	*V = (unsigned char)(v * 255); // dst_v : 0-255
}
Пример #3
0
double getRealPrecision_float(float valueRangeSize, int errBoundMode, double absErrBound, double relBoundRatio, int *status)
{
	int state = SZ_SCES;
	double precision = 0;
	if(errBoundMode==ABS)
		precision = absErrBound; 
	else if(errBoundMode==REL)
		precision = relBoundRatio*valueRangeSize;
	else if(errBoundMode==ABS_AND_REL)
		precision = min_f(absErrBound, relBoundRatio*valueRangeSize);
	else if(errBoundMode==ABS_OR_REL)
		precision = max_f(absErrBound, relBoundRatio*valueRangeSize);
	else if(errBoundMode==PW_REL)
		precision = -1;
	else
	{
		printf("Error: error-bound-mode is incorrect!\n");
		state = SZ_BERR;
	}
	*status = state;
	return precision;
}
Пример #4
0
float clamp_f(float val, float min, float max)
{
  return min_f(max_f(val, min), max);
}