Click here to Skip to main content
Licence Zlib
First Posted 29 Nov 2005
Views 346,308
Bookmarked 78 times

Generating Fractals with SSE/SSE2

By | 29 Nov 2005 | Article
An article on generating Mandelbrot and Julia sets using Intel's Streaming SIMD Extensions (SSE, SSE2).
 

License

This article, along with any associated source code and files, is licensed under The zlib/libpng License

About the Author

Peter Kankowski

Software Developer

Russian Federation Russian Federation

Member

Peter lives in Siberia, the land of sleeping sun, beautiful mountains, and infinitely deep snow. He recently started a wiki about algorithms and code optimization, where people could share their ideas, learn, and teach others.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
Generalsource contains a virus PinmemberCem Usta21:57 3 May '09  
GeneralRe: source contains a virus Pinmembersergeykkk15:29 25 Aug '11  
GeneralRe: source contains a virus PinmemberPeter Kankowski16:31 25 Aug '11  
GeneralRe: source contains a virus Pinmembersergeykkk18:28 25 Aug '11  
GeneralFractal Dimension Indicator Formula Code PinmemberYIYI2223:50 30 Jul '08  
Generaltypo PinmemberSavageJ20:11 3 Jun '06  
GeneralSimplified Program PinmemberPeter Kankowski18:30 26 May '06  
If you just need to see the algorithm, but don't want to struggle through assembler and DirectDraw code, you can download the simplified program. Certainly, it's slower than the SSE code, but it's very easy to understand.
 
Dominique asked me to publish this simple program. Here is his e-mail to me (published with his permission):
Dominique wrote:
Peter,
 
I just downloaded your fractal program from
 
http://www.codeproject.com/cpp/fractalssse.asp
 
I have managed to import it as a project to my Microsoft Visual C++ .NET version 7.0.9955 and compiled and linked it and it runs really fine.
 
I am studying the iteration of transendental functions in my PhD, so I look at iterating, for example, functions like f(z) = c exp(z) where c is the parameter.
 
I’d like to customize your code so it calculates julia sets for such functions, and I want to ask for your permission.
I have only a basic level of skill in C++ coding and no skill in assembler, but it looks like I might just need to alter the PaintJuliaFPU method in factals.cpp.
I had the intention of adding
 
#include <math.h>
 
to the tech.h file and using the exp function from math.h but I notice you have commented out the
 
#include <math.h>
 
line in tech.h. Can you remember if there was any particular reason for this?
 
Are you, in principle, prepared to let me make some modifications to my copy of your code?
 
I hope this email gets to you.
 
Dominique
 

 
Peter wrote:
Dominique,
 
Are you, in principle, prepared to let me make some modifications to my copy of your code?
Certainly, you can make any modifications. If you will distribute the modified version, credits would be appreciated (just mention me somewhere in your readme file or help file).
 
But it may be easier for you to start from small and simple code base. The program from my article is bloated with trivial details such as switching between SSE and FPU modes or creating DirectDraw surfaces. If you don’t need SSE or DirectDraw, you may found this small program useful. It has poor performance, but is easier to understand and modify.
 
#include line in tech.h. Can you remember if there was any particular reason for this?
The standard functions from math.h require startup code, which increases size of the executable by 27 Kb. I replaced these functions with their home-made analogs [atod(), ceil(), dtoi(), and so on] to keep the file size small. If you wish to exclude the startup code too, use intrinsic transcendental functions described in the article by Dierk “Chaos” Ohlerich. I included them in the small program mentioned above.

 
Peter Kankowski
GeneralIterations greater than 64 [modified] Pinmemberzenzero11:46 26 May '06  
GeneralRe: Iterations greater than 64 Pinmemberzenzero13:22 26 May '06  
GeneralRe: Iterations greater than 64 PinmemberPeter Kankowski18:23 26 May '06  
GeneralRe: Iterations greater than 64 Pinmemberzenzero1:08 27 May '06  
GeneralCould not compile on VS 2005 Pinmemberzenzero7:54 26 May '06  
GeneralRe: Could not compile on VS 2005 Pinmemberzenzero10:20 26 May '06  
GeneralBenchmark PinmemberxKuemmelx12:42 8 May '06  
GeneralRe: Benchmark PinmemberPeter Kankowski14:45 9 May '06  
GeneralRe: Benchmark PinmemberxKuemmelx21:54 10 May '06  
GeneralRe: Benchmark PinmemberxKuemmelx11:34 15 May '06  
GeneralAnother approach, removing branches PinmemberArne Thormodsen12:24 10 Apr '06  
GeneralRe: Another approach, removing branches PinmemberPeter Kankowski0:25 11 Apr '06  
GeneralRe: Another approach, removing branches PinmemberArne Thormodsen13:33 11 Apr '06  
GeneralCode Questions/Comments PinmemberxKuemmelx2:40 8 Mar '06  
GeneralRe: Code Questions/Comments PinmemberPeter Kankowski15:51 8 Mar '06  
GeneralRe: Code Questions/Comments PinmemberxKuemmelx20:24 8 Mar '06  
GeneralRe: Code Questions/Comments PinmemberPeter Kankowski1:29 9 Mar '06  
GeneralFFFF: Open Source Pinmembermaihem7:49 15 Jan '06  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120529.1 | Last Updated 29 Nov 2005
Article Copyright 2005 by Peter Kankowski
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid