aboutsummaryrefslogtreecommitdiff
path: root/src/process_image.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2023-09-23 17:57:20 +0200
committerThomas White <taw@physics.org>2023-09-23 19:37:40 +0200
commit1a0580e817a0f60505e38c8dd29f9e4eeeae0558 (patch)
tree4cb92f99fbf100bfab226ea94012da262d4bda77 /src/process_image.c
parentcee7ee0b8a4cafa1f8f3c67518f86c895520f5a6 (diff)
indexamajig: Re-use the image data arrays
We noticed that constant freeing and re-allocating the (potentially quite large) arrays resulted in much lower performance. Since we know that all images have the same data layout, we can safely re-use the arrays. This gives a large speedup.
Diffstat (limited to 'src/process_image.c')
-rw-r--r--src/process_image.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/process_image.c b/src/process_image.c
index 6212e361..57a994ac 100644
--- a/src/process_image.c
+++ b/src/process_image.c
@@ -108,7 +108,8 @@ static struct image *file_wait_open_read(const char *filename,
signed int wait_for_file,
int cookie,
int no_image_data,
- int no_mask_data)
+ int no_mask_data,
+ ImageDataArrays *ida)
{
signed int file_wait_time = wait_for_file;
int wait_message_done = 0;
@@ -154,7 +155,7 @@ static struct image *file_wait_open_read(const char *filename,
profile_start("image-read");
image = image_read(dtempl, filename, event,
- no_image_data, no_mask_data);
+ no_image_data, no_mask_data, ida);
profile_end("image-read");
if ( image == NULL ) {
if ( wait_for_file && !read_retry_done ) {
@@ -179,7 +180,7 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs,
Stream *st, int cookie, const char *tmpdir,
int serial, struct sb_shm *sb_shared,
char *last_task, struct im_asapo *asapostuff,
- Mille *mille)
+ Mille *mille, ImageDataArrays *ida)
{
struct image *image;
int i;
@@ -200,7 +201,8 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs,
iargs->data_format,
serial,
iargs->no_image_data,
- iargs->no_mask_data);
+ iargs->no_mask_data,
+ ida);
profile_end("read-zmq-data");
if ( image == NULL ) return;
@@ -222,7 +224,8 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs,
iargs->data_format,
serial,
iargs->no_image_data,
- iargs->no_mask_data);
+ iargs->no_mask_data,
+ ida);
profile_end("read-asapo-data");
if ( image == NULL ) return;
@@ -240,7 +243,8 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs,
iargs->wait_for_file,
cookie,
iargs->no_image_data,
- iargs->no_mask_data);
+ iargs->no_mask_data,
+ ida);
profile_end("file-wait-open-read");
if ( image == NULL ) {
if ( iargs->wait_for_file != 0 ) {