29 size = ibuf->
x * ibuf->
y;
43 size = ibuf->
x * ibuf->
y;
70 void *init_customdata,
71 void(init_handle)(
void *handle,
int start_line,
int tot_line,
void *customdata),
72 void *(do_thread)(
void *))
74 const int lines_per_task = 64;
79 int total_tasks = (buffer_lines + lines_per_task - 1) / lines_per_task;
84 handles =
MEM_callocN(handle_size * total_tasks,
"processor apply threaded handles");
88 for (i = 0; i < total_tasks; i++) {
89 int lines_per_current_task;
90 void *handle = ((
char *)handles) + handle_size * i;
92 if (i < total_tasks - 1) {
93 lines_per_current_task = lines_per_task;
96 lines_per_current_task = buffer_lines - start_line;
99 init_handle(handle, start_line, lines_per_current_task, init_customdata);
103 start_line += lines_per_task;
124 data->
do_thread(data->custom_data, scanline);
134 data.custom_data = custom_data;
148 size_t a = size_t(x) *
y;
149 float *fp = rect_float;
152 const float mul = 1.0f - fp[3];
162 size_t a = size_t(x) *
y;
169 else if (cp[3] == 0) {
170 cp[0] = backcol[0] * 255;
171 cp[1] = backcol[1] * 255;
172 cp[2] = backcol[2] * 255;
175 float alpha = cp[3] / 255.0;
176 float mul = 1.0f - alpha;
178 cp[0] = (cp[0] * alpha) +
mul * backcol[0];
179 cp[1] = (cp[1] * alpha) +
mul * backcol[1];
180 cp[2] = (cp[2] * alpha) +
mul * backcol[2];
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
void * BLI_task_pool_user_data(TaskPool *pool)
void BLI_task_pool_work_and_wait(TaskPool *pool)
void BLI_task_parallel_range(int start, int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings)
TaskPool * BLI_task_pool_create(void *userdata, eTaskPriority priority)
BLI_INLINE void BLI_parallel_range_settings_defaults(TaskParallelSettings *settings)
void BLI_task_pool_free(TaskPool *pool)
void BLI_task_pool_push(TaskPool *pool, TaskRunFunction run, void *taskdata, bool free_taskdata, TaskFreeFunction freedata)
void(*)(void *custom_data, int scanline) ScanlineThreadFunc
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
static void mul(btAlignedObjectArray< T > &items, const Q &value)
static void processor_apply_func(TaskPool *__restrict pool, void *taskdata)
void IMB_processor_apply_threaded(int buffer_lines, int handle_size, void *init_customdata, void(init_handle)(void *handle, int start_line, int tot_line, void *customdata), void *(do_thread)(void *))
void IMB_alpha_under_color_byte(uchar *rect, int x, int y, const float backcol[3])
void IMB_processor_apply_threaded_scanlines(int total_scanlines, ScanlineThreadFunc do_thread, void *custom_data)
static void processor_apply_parallel(void *__restrict userdata, const int scanline, const TaskParallelTLS *__restrict)
void IMB_convert_rgba_to_abgr(ImBuf *ibuf)
void IMB_alpha_under_color_float(float *rect_float, int x, int y, float backcol[3])
void MEM_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
ImBufFloatBuffer float_buffer
ImBufByteBuffer byte_buffer
ScanlineThreadFunc do_thread