1 2 #ifndef VITER_H 3 #define VITER_H 4 5 // Spread memory touched by different threads at least 64B apart which I assume is the cache line size. This should avoid memory write contention. 6 #define VITER_CACHE_LINE_GAP ((64+sizeof(viter_state)-1)/sizeof(viter_state)) 7 8 typedef struct { 9 double a, r, g, b, total; 10 } viter_state; 11 12 typedef void (*viter_callback)(hist_item *item, float diff); 13 14 LIQ_PRIVATE void viter_init(const colormap *map, const unsigned int max_threads, viter_state state[]); 15 LIQ_PRIVATE void viter_update_color(const f_pixel acolor, const float value, const colormap *map, unsigned int match, const unsigned int thread, viter_state average_color[]); 16 LIQ_PRIVATE void viter_finalize(colormap *map, const unsigned int max_threads, const viter_state state[]); 17 LIQ_PRIVATE double viter_do_iteration(histogram *hist, colormap *const map, const float min_opaque_val, viter_callback callback, const bool fast_palette); 18 19 #endif 20