Fixed: Made negative sign handling and according direction consistent across all implemenatations
This commit is contained in:
@@ -19,17 +19,19 @@ void tricorn_V3(float complex start, size_t width, ssize_t height, float res, un
|
||||
|
||||
// Absolute height for iteration purposes
|
||||
ssize_t actual_height = height < 0 ? (ssize_t)(-height) : height;
|
||||
ssize_t imag_step = height < 0 ? -1:1;
|
||||
size_t simd_width = (width / 4) * 4;
|
||||
|
||||
// Depending on the sign of height we generate the image top-down or bottom up
|
||||
// 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 = cimag(start);
|
||||
float c_start_imag = height > 0 ? cimag(start) : cimag(start) + (height * imag_direction) * res;
|
||||
|
||||
__m128 four = _mm_set1_ps(4.0f);
|
||||
__m128 minus_two = _mm_set1_ps(-2.0f);
|
||||
|
||||
for(ssize_t y = 0; y < actual_height;y++) {
|
||||
float c_imag = c_start_imag - (y*imag_step) * res;
|
||||
float c_imag = c_start_imag + (y * imag_direction) * res;
|
||||
__m128 c_imag_vector = _mm_set1_ps(c_imag);
|
||||
|
||||
size_t x = 0;
|
||||
|
||||
Reference in New Issue
Block a user