Added implementation switching based on -V parameter
This commit is contained in:
@@ -199,13 +199,19 @@ int main(int argc, char** argv)
|
|||||||
bytesPerColour = 1;
|
bytesPerColour = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char *tempArr = malloc(width*abs(height)*bytesPerColour);// allocate image array on the heap to support large images as the stack is usually only 8 MB big
|
ssize_t absolute_height = height >= 0 ? height : height * - 1;
|
||||||
|
unsigned char *tempArr = malloc(width*absolute_height*bytesPerColour);// allocate image array on the heap to support large images as the stack is usually only 8 MB big
|
||||||
if(tempArr == NULL) {
|
if(tempArr == NULL) {
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("yashar\n");
|
printf("yashar\n");
|
||||||
tricorn_simd(complexA,width,height,resolution,n,colored,tempArr);
|
if(version_to_use == 0) {
|
||||||
|
tricorn_simd(complexA,width,height,resolution,n,colored,tempArr);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tricorn(complexA,width,height,resolution,n,colored,tempArr);
|
||||||
|
}
|
||||||
printf("yashar\n");
|
printf("yashar\n");
|
||||||
save_bmp(output_data,tempArr,width,height,colored);
|
save_bmp(output_data,tempArr,width,height,colored);
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ void tricorn_simd(float complex start, size_t width, ssize_t height, float res,
|
|||||||
__m128 c_imag_vector = _mm_set1_ps(c_imag);
|
__m128 c_imag_vector = _mm_set1_ps(c_imag);
|
||||||
|
|
||||||
size_t x = 0;
|
size_t x = 0;
|
||||||
for(; x < simd_width;x += 4) { //Simd
|
for(; x < simd_width;x += 4) { //SIMD Loop
|
||||||
float c_real = c_start_real + (x*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 c_real_vector = _mm_setr_ps(c_real,c_real+1.0f*res,c_real+2.0f*res,c_real+3.0f*res);
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ void tricorn_simd(float complex start, size_t width, ssize_t height, float res,
|
|||||||
__m128 real2 = _mm_mul_ps(real,real);
|
__m128 real2 = _mm_mul_ps(real,real);
|
||||||
__m128 imag2 = _mm_mul_ps(imag,imag);
|
__m128 imag2 = _mm_mul_ps(imag,imag);
|
||||||
|
|
||||||
__m128 unbounded = _mm_cmplt_ps(_mm_add_ps(real2,imag2),four);
|
__m128 unbounded = _mm_cmple_ps(_mm_add_ps(real2,imag2),four);
|
||||||
__m128i unbounded_i = _mm_castps_si128(unbounded);
|
__m128i unbounded_i = _mm_castps_si128(unbounded);
|
||||||
|
|
||||||
active_mask = _mm_and_si128(active_mask,unbounded_i);
|
active_mask = _mm_and_si128(active_mask,unbounded_i);
|
||||||
|
|||||||
Reference in New Issue
Block a user