diff --git a/Implementierung/tricorn.c b/Implementierung/tricorn.c index 7f779a6..6546027 100644 --- a/Implementierung/tricorn.c +++ b/Implementierung/tricorn.c @@ -50,7 +50,7 @@ void tricorn(float complex start, size_t width, ssize_t height, float res, unsig const size_t y_step = (abs_height+thread_count-1)/thread_count; const float start_r = crealf(start); const float directional_res = (flipped ? -1.0f: 1.0f)*res; - const float start_i = height > 0 ? cimag(start) : cimag(start) + (height * directional_res); + const float start_i = height > 0 ? cimag(start) : cimag(start) + ((abs_height - 1) * res); const_args* consts = malloc(sizeof(*consts)); consts->width = width; diff --git a/Implementierung/tricorn_V2.c b/Implementierung/tricorn_V2.c index 3a7783c..9e9a947 100644 --- a/Implementierung/tricorn_V2.c +++ b/Implementierung/tricorn_V2.c @@ -23,7 +23,7 @@ void tricorn_V2(float complex start, size_t width, ssize_t height, float res, un // As we iterate from the top always, if it is negative we would have to start at the end of the imaginary part and go in the oposite direction when generating ssize_t imag_direction = height < 0 ? -1 : 1; float c_start_real = creal(start); - float c_start_imag = height > 0 ? cimag(start) : creal(start) + (imag_direction * height * res);; + float c_start_imag = height > 0 ? cimag(start) : cimag(start) + ((actual_height-1) * res);; float vertical_step = imag_direction * res; diff --git a/Implementierung/tricorn_V3.c b/Implementierung/tricorn_V3.c index 4305d5f..96974f4 100644 --- a/Implementierung/tricorn_V3.c +++ b/Implementierung/tricorn_V3.c @@ -25,7 +25,7 @@ void tricorn_V3(float complex start, size_t width, ssize_t height, float res, un // As we iterate the image buffer from the top, if height is negative we would have to start at the end of the imaginary part and go in the oposite direction when generating ssize_t imag_direction = height < 0 ? -1 : 1; float c_start_real = creal(start); - float c_start_imag = height > 0 ? cimag(start) : cimag(start) + (height * imag_direction) * res; + float c_start_imag = height > 0 ? cimag(start) : cimag(start) + (actual_height - 1) * res; __m128 four = _mm_set1_ps(4.0f); __m128 minus_two = _mm_set1_ps(-2.0f); diff --git a/Implementierung/tricorn_V4.c b/Implementierung/tricorn_V4.c index 735fbf8..ebe38a0 100644 --- a/Implementierung/tricorn_V4.c +++ b/Implementierung/tricorn_V4.c @@ -24,7 +24,7 @@ void tricorn_V4(float complex start, size_t width, ssize_t height, float res, un // As we iterate the image buffer from the top, if height is negative we would have to start at the end of the imaginary part and go in the oposite direction when generating ssize_t imag_direction = height < 0 ? -1 : 1; float c_start_real = creal(start); - float c_start_imag = height > 0 ? cimag(start) : cimag(start) + (height * imag_direction) * res; + float c_start_imag = height > 0 ? cimag(start) : cimag(start) + (actual_height - 1) * res; __m128 four = _mm_set1_ps(4.0f); __m128 minus_two = _mm_set1_ps(-2.0f); @@ -108,8 +108,8 @@ void tricorn_V4(float complex start, size_t width, ssize_t height, float res, un img[position + 2] = ((value*5) % 255); } } - c_imag -= vertical_step; - c_imag_vector = _mm_sub_ps(c_imag_vector,vertical_step_vector); + c_imag += vertical_step; + c_imag_vector = _mm_add_ps(c_imag_vector,vertical_step_vector); } }