Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <jbakker>2021-06-11 16:55:09 +0300
committerJeroen Bakker <jeroen@blender.org>2021-06-11 16:55:22 +0300
commit7b30a3e98def6f9f158da0e315b7077655acfd20 (patch)
tree0299bf5e27e36e9f6c9b26ce8d2beb4452a95463 /source/blender/blenkernel/intern/image_gen.c
parent7b76a160a4647b17c1a55da4bd40e8f549225568 (diff)
Performance: Use parallel range for ImBuf scanline processor.
Scanline processor did its own heurestic what didn't scale well when having a multiple cores. In stead of using our own code this patch will leave it to TBB to determine how to split the scanlines over the available threads. Performance of the IMB_transform before this change was 0.002123s, with this change 0.001601s. This change increases performance in other areas as well including color management conversions. Reviewed By: zeddb Differential Revision: https://developer.blender.org/D11578
Diffstat (limited to 'source/blender/blenkernel/intern/image_gen.c')
-rw-r--r--source/blender/blenkernel/intern/image_gen.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c
index ceb13c4955e..1a0cc8c2924 100644
--- a/source/blender/blenkernel/intern/image_gen.c
+++ b/source/blender/blenkernel/intern/image_gen.c
@@ -69,10 +69,11 @@ static void image_buf_fill_color_slice(
}
}
-static void image_buf_fill_color_thread_do(void *data_v, int start_scanline, int num_scanlines)
+static void image_buf_fill_color_thread_do(void *data_v, int scanline)
{
FillColorThreadData *data = (FillColorThreadData *)data_v;
- size_t offset = ((size_t)start_scanline) * data->width * 4;
+ const int num_scanlines = 1;
+ size_t offset = ((size_t)scanline) * data->width * 4;
unsigned char *rect = (data->rect != NULL) ? (data->rect + offset) : NULL;
float *rect_float = (data->rect_float != NULL) ? (data->rect_float + offset) : NULL;
image_buf_fill_color_slice(rect, rect_float, data->width, num_scanlines, data->color);
@@ -197,13 +198,14 @@ typedef struct FillCheckerThreadData {
int width;
} FillCheckerThreadData;
-static void image_buf_fill_checker_thread_do(void *data_v, int start_scanline, int num_scanlines)
+static void image_buf_fill_checker_thread_do(void *data_v, int scanline)
{
FillCheckerThreadData *data = (FillCheckerThreadData *)data_v;
- size_t offset = ((size_t)start_scanline) * data->width * 4;
+ size_t offset = ((size_t)scanline) * data->width * 4;
+ const int num_scanlines = 1;
unsigned char *rect = (data->rect != NULL) ? (data->rect + offset) : NULL;
float *rect_float = (data->rect_float != NULL) ? (data->rect_float + offset) : NULL;
- image_buf_fill_checker_slice(rect, rect_float, data->width, num_scanlines, start_scanline);
+ image_buf_fill_checker_slice(rect, rect_float, data->width, num_scanlines, scanline);
}
void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int width, int height)
@@ -444,16 +446,15 @@ typedef struct FillCheckerColorThreadData {
int width, height;
} FillCheckerColorThreadData;
-static void checker_board_color_prepare_thread_do(void *data_v,
- int start_scanline,
- int num_scanlines)
+static void checker_board_color_prepare_thread_do(void *data_v, int scanline)
{
FillCheckerColorThreadData *data = (FillCheckerColorThreadData *)data_v;
- size_t offset = ((size_t)data->width) * start_scanline * 4;
+ const int num_scanlines = 1;
+ size_t offset = ((size_t)data->width) * scanline * 4;
unsigned char *rect = (data->rect != NULL) ? (data->rect + offset) : NULL;
float *rect_float = (data->rect_float != NULL) ? (data->rect_float + offset) : NULL;
checker_board_color_prepare_slice(
- rect, rect_float, data->width, num_scanlines, start_scanline, data->height);
+ rect, rect_float, data->width, num_scanlines, scanline, data->height);
}
void BKE_image_buf_fill_checker_color(unsigned char *rect,