Program page
Features :
- multithreading,
- antialiasing
edit the makefile and removing the word "-Werror" on line 4
Choose number of threads :
time ./mandel `./parsexpf sample2.xpf` -w 1000 -h 1000 -j 1 -a 3 | pnmtopng > sample2.png
1 thread = 2m0.094s
2 threads = 1m3.010s
3 threads = 1m6.056s
4 threads = 1m8.880s
So for me ( AMD Turion 64 X2) 2 threads give the best result
Optimisation of most inner loop : do not use slow complex type, use double instead.
Change function :
int calc_point(double cx, double cy, int iMax) {
int i;
double Zx, Zy;
double Zx2, Zy2; /* Zx2=Zx*Zx; Zy2=Zy*Zy */
Zx=0.0; /* initial value of orbit = critical point Z= 0 */
Zy=0.0;
Zx2=Zx*Zx;
Zy2=Zy*Zy;
for (i=0;i < iMax && ((Zx2+Zy2)<4);i++)
{
Zy=2*Zx*Zy + cy;
Zx=Zx2-Zy2 + cx;
Zx2=Zx*Zx;
Zy2=Zy*Zy;
};
if(i >= iMax) return -1;
return i;
}
It gives :
complex type : 2m38.179s (old function)
double type : 1m3.010s ( new function)
Main page
Autor: Adam Majewski
Feel free to e-mail me. (:-)) adammaj1-at-o2-dot--pl
Strona utworzona przy pomocy programu: EditPlus www.editplus.com
About