diff options
author | Thomas White <taw@physics.org> | 2023-09-23 17:57:20 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2023-09-23 19:37:40 +0200 |
commit | 1a0580e817a0f60505e38c8dd29f9e4eeeae0558 (patch) | |
tree | 4cb92f99fbf100bfab226ea94012da262d4bda77 /libcrystfel/src/image.h | |
parent | cee7ee0b8a4cafa1f8f3c67518f86c895520f5a6 (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 'libcrystfel/src/image.h')
-rw-r--r-- | libcrystfel/src/image.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/libcrystfel/src/image.h b/libcrystfel/src/image.h index 8930ffe7..eafc5f83 100644 --- a/libcrystfel/src/image.h +++ b/libcrystfel/src/image.h @@ -75,6 +75,8 @@ struct imagefeature { /** An opaque type representing a list of image features */ typedef struct _imagefeaturelist ImageFeatureList; +typedef struct _image_data_arrays ImageDataArrays; + #define HEADER_CACHE_SIZE (128) @@ -179,6 +181,9 @@ struct image /** List of peaks found in the image */ ImageFeatureList *features; + /** Re-usable data array structure, or NULL if not used */ + ImageDataArrays *ida; + }; #ifdef __cplusplus @@ -226,7 +231,8 @@ extern struct image *image_read(const DataTemplate *dtempl, const char *filename, const char *event, int no_image_data, - int no_mask_data); + int no_mask_data, + ImageDataArrays *ida); extern struct image *image_create_for_simulation(const DataTemplate *dtempl); extern struct image *image_read_data_block(const DataTemplate *dtempl, @@ -236,7 +242,8 @@ extern struct image *image_read_data_block(const DataTemplate *dtempl, DataSourceType type, int serial, int no_image_data, - int no_mask_data); + int no_mask_data, + ImageDataArrays *ida); extern void image_free(struct image *image); extern int image_read_header_float(struct image *image, const char *from, @@ -265,6 +272,10 @@ extern ImageFeatureList *image_read_peaks(const DataTemplate *dtempl, extern char **image_expand_frames(const DataTemplate *dtempl, const char *filename, int *nframes); +extern ImageDataArrays *image_data_arrays_new(void); + +extern void image_data_arrays_free(ImageDataArrays *ida); + extern int image_create_dp_bad(struct image *image, const DataTemplate *dtempl); |