7 inline void print_image(
int width,
int height,
int max,
unsigned char img[width][height])
10 printf(
"P2\n%d %d\n%d\n", width, height, max);
11 for (j = 0; j < height; j++)
13 for (i = 0; i < width; i++)
16 printf(
"%d ",
img[i][j]);
24 #define DECIMAL_PLACES 28 25 #define int2fixed(num) ((num) << DECIMAL_PLACES) 26 #define fixedmul(a, b) ((((long long)a) * ((long long)b)) >> DECIMAL_PLACES) 27 #define fixed2int(num) ((num) >> DECIMAL_PLACES) 35 #define OPS_PER_ACCEL HEIGHT/NUM_ACCEL 54 for (i = 0; i <
WIDTH; i++)
57 int x_0 =
int2fixed(-2) + ((((3 << 20) * i / WIDTH) ) << 8);
58 int y_0 =
int2fixed(-1) + ((((2 << 20) * (j + startidx) /
HEIGHT) ) << 8);
64 unsigned char fiter = 0;
66 for (iter = 0; iter <
MAX_ITER; iter++)
78 unsigned char colour = (fiter >=
MAX_ITER) ? 0 : 1;
106 final_result += count[i];
119 for (j = 0; j <
HEIGHT; j++)
121 for (i = 0; i <
WIDTH; i++)
123 final[i][j] =
img[i][j];
134 printf(
"Count: %d\n", final_result);
135 if (final_result == 12013)
void print_image(int width, int height, int max, unsigned char img[width][height])
volatile unsigned char img[WIDTH][HEIGHT]
x
Return the smallest n such that 2^n >= _x.