Added: Pregenerated lookup table

This commit is contained in:
Yashar Alan Zenker
2026-07-17 11:53:16 +02:00
parent 1ead5be671
commit dc4b8bfaef
6 changed files with 287 additions and 38 deletions
+1 -10
View File
@@ -1,4 +1,5 @@
#include "tricorn_V3.h"
#include "color_table.h"
static void* compute(void * args);
static unsigned converge(float c_real, float c_imag, unsigned n);
@@ -22,7 +23,6 @@ typedef struct {
const_args* consts;
} compute_args;
unsigned char color_lookup_table[256][3];
@@ -37,13 +37,6 @@ unsigned char color_lookup_table[256][3];
* @param img Pointer to the pre-allocated memory buffer where the bitmap data will be stored.
*/
void tricorn_V3(float complex start, size_t width, ssize_t height, float res, unsigned n, _Bool color, unsigned char* img){
if(color) {
for (int i = 0; i < 256; i++) {
color_lookup_table[i][0] = (unsigned char)((i * 3) % 255);
color_lookup_table[i][1] = (unsigned char)((i * 2) % 255);
color_lookup_table[i][2] = (unsigned char)((i * 5) % 255);
}
}
const ssize_t min_rows_per_thread = 10;
const _Bool flipped = height < 0;
@@ -56,8 +49,6 @@ void tricorn_V3(float complex start, size_t width, ssize_t height, float res, un
while((abs_height/thread_count) < min_rows_per_thread) thread_count--;
else thread_count = 1;
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;