diff --git a/Implementierung/tricorn.c b/Implementierung/tricorn.c index 2f48332..eacf159 100644 --- a/Implementierung/tricorn.c +++ b/Implementierung/tricorn.c @@ -13,7 +13,7 @@ void tricorn(float complex start, size_t width, ssize_t height, float res, unsig for(size_t i = 0; i < width; i++){ for(ssize_t j = 0; j < height; j++){ - unsigned value = converge(start + (i*res - I*j*res),n); + unsigned value = converge(start + (i*res - I*j*res),n+1); // Pixel value position in the output array size_t position = (j*width +i) * bytesPerColor; @@ -37,14 +37,15 @@ static unsigned converge(float complex position,unsigned n){ complex float result = 0; for(unsigned i = 0; i < n; i++){ - // Application of the given complex equation with m = 2 - result = cpowf(conjf(result),2) + position; - - // Detection of unbounded behaviour + // Detection of unbounded behaviour // If the magnitude of the result vector is greater than the convergence limit, we know that the function will grow unbounded // Current convergence limit taken from mandelbrot set if(sqrtf(powf (crealf(result),2)+powf(cimagf(result),2)) > convergenceLimit) return 255-4*(i % 64); + + // Application of the given complex equation with m = 2 + result = cpowf(conjf(result),2) + position; + } return 0; } \ No newline at end of file diff --git a/Implementierung/tricorn_simd.c b/Implementierung/tricorn_simd.c index de6cea7..cc474c0 100644 --- a/Implementierung/tricorn_simd.c +++ b/Implementierung/tricorn_simd.c @@ -26,8 +26,8 @@ void tricorn_simd(float complex start, size_t width, ssize_t height, float res, float c_real = c_start_real + (x*res); __m128 c_real_vector = _mm_setr_ps(c_real,c_real+1.0f*res,c_real+2.0f*res,c_real+3.0f*res); - __m128 real = c_real_vector; - __m128 imag = c_imag_vector; + __m128 real = _mm_setzero_ps(); + __m128 imag = _mm_setzero_ps(); __m128i iterations = _mm_setzero_si128(); __m128i active_mask = _mm_set1_epi32(-1);