Example #1
0
File: utils.c Project: AEUG/400plus
void calculate_dof(int focal_length, int focus_distance, int av, char *min, char *max) {
	float fl =    1.0f * focal_length;
	float fd = 1000.0f * focus_distance;

	float fn = float_pow(2.0f, ((float)av / 8.0f - 1) / 2.0f); // Precise F-Number = 2^(n/2), 1/8 EV resolution
	float cof = 0.019f; // Circle of confusion

	// Hyperfocal
	float hf  = fl + fl * fl / (fn * cof);
	float aux = fd * (hf - fl) / 1000.0f;

	// Min distance
	display_float(min, aux / (hf + fd - 2.0f * fl));

	// Max distance
	if (hf >= fd)
		display_float(max, aux / (hf - fd));
	else
		sprintf(max, "%s", LP_WORD(L_S_INFINITE));
}
Example #2
0
void *
mandel_start(void *arg)
{
    float xmin = -2;
    float xmax = 1.0;
    float ymin = -1.5;
    float ymax = 1.5;
    struct mandelthr *args = arg;

#if (NEWSSE2)
    display_sse2(WIDTH, HEIGHT, xmin, xmax, ymin, ymax, args->yofs, args->ylim);
#elif (SSE2)
    display_sse2(WIDTH, HEIGHT, xmin, xmax, ymin, ymax, args->yofs, args->ylim);
#elif (DOUBLE)
    display_double(WIDTH, HEIGHT, xmin, xmax, ymin, ymax, args->yofs, args->ylim);
#elif (FLOAT)
    display_float(WIDTH, HEIGHT, xmin, xmax, ymin, ymax, args->yofs, args->ylim);
#endif
    g_mandel.nthr--;

    pthread_exit(NULL);
}