123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- #include <stdio.h>
- #include <stdint.h>
- #include <starpu.h>
- struct Params
- {
- float cr;
- float ci;
- unsigned taskx;
- unsigned tasky;
- unsigned width;
- unsigned height;
- };
- static inline long long jlstarpu_max(long long a, long long b)
- {
- return (a > b) ? a : b;
- }
- static inline long long jlstarpu_interval_size(long long start, long long step, long long stop)
- {
- if (stop >= start){
- return jlstarpu_max(0, (stop - start + 1) / step);
- } else {
- return jlstarpu_max(0, (stop - start - 1) / step);
- }
- }
- void mandelbrot(void** buffers_86BwRM71, void* cl_arg_86BwRM71)
- {
- uint32_t ld_o2BQqRir = (uint32_t) (STARPU_MATRIX_GET_LD(buffers_86BwRM71[(1) - (1)]));
- int64_t* ptr_o2BQqRir = (int64_t*) (STARPU_MATRIX_GET_PTR(buffers_86BwRM71[(1) - (1)]));
-
- double* ptr_Ul4Ys0Mt = (double*) (STARPU_VECTOR_GET_PTR(buffers_86BwRM71[(2) - (1)]));
- int64_t* ptr_cE3zj60d = (int64_t*) (STARPU_VECTOR_GET_PTR(buffers_86BwRM71[(3) - (1)]));
- int64_t local_width = (int64_t) (STARPU_MATRIX_GET_NY(buffers_86BwRM71[(1) - (1)]));
- int64_t local_height = (int64_t) (STARPU_MATRIX_GET_NX(buffers_86BwRM71[(1) - (1)]));
- double conv_limit = (double) (2.0);
-
-
-
-
-
-
-
-
-
-
-
-
- int64_t start_qxJwMzwA = (int64_t) (1);
- int64_t stop_qxJwMzwA = (int64_t) (local_width);
- int64_t x;
- for (x = start_qxJwMzwA ; x <= stop_qxJwMzwA ; x += 1)
- {
-
- int64_t start_ekV9GHK1 = (int64_t) (1);
- int64_t stop_ekV9GHK1 = (int64_t) (local_height);
- int64_t y;
- for (y = start_ekV9GHK1 ; y <= stop_ekV9GHK1 ; y += 1)
- {
-
- double max_iterations = (double) (ptr_Ul4Ys0Mt[(5) - (1)]);
- double zoom = (double) ((ptr_Ul4Ys0Mt[(3) - (1)]) * (0.25296875));
-
-
-
-
-
-
-
-
- int64_t X = (int64_t) ((x) + ((local_width) * ((ptr_cE3zj60d[(2) - (1)]) - (1))));
- int64_t Y = (int64_t) ((y) + ((local_height) * ((ptr_cE3zj60d[(1) - (1)]) - (1))));
- double cr = (double) ((ptr_Ul4Ys0Mt[(1) - (1)]) + (((X) - ((ptr_Ul4Ys0Mt[(3) - (1)]) / (2))) / (zoom)));
- double ci = (double) ((ptr_Ul4Ys0Mt[(2) - (1)]) + (((Y) - ((ptr_Ul4Ys0Mt[(4) - (1)]) / (2))) / (zoom)));
-
- double zi = (double) (ci);
- double zr = (double) (cr);
- int64_t n = (int64_t) (0);
- float m = zr * zr + zi * zi;
-
-
-
-
- for (n = 0; n < max_iterations && m < conv_limit * conv_limit; n++)
- {
- double tmp = (double) ((((zr) * (zr)) - ((zi) * (zi))) + (cr));
- zi = ((2) * (zr) * (zi)) + (ci);
- zr = tmp;
-
- m = zr*zr + zi*zi;
-
- }
- ;
-
-
- if ((n) < (max_iterations))
- {
- ptr_o2BQqRir[((y) + (((x) - (1)) * (ld_o2BQqRir))) - (1)] = 255 * (1.0 * n / (max_iterations));
- } else
- {
- ptr_o2BQqRir[((y) + (((x) - (1)) * (ld_o2BQqRir))) - (1)] = 0;
- }
- ;
- }
- ;
- }
- ;
- }
|