From f269d912c0a8c382f48cc821f69a1ee72e973c83 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 29 Apr 2021 14:44:24 +0200 Subject: MsgPack: Handle floating-point data, fix array read --- libcrystfel/src/image-msgpack.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'libcrystfel/src') diff --git a/libcrystfel/src/image-msgpack.c b/libcrystfel/src/image-msgpack.c index d1249345..e1c9bb66 100644 --- a/libcrystfel/src/image-msgpack.c +++ b/libcrystfel/src/image-msgpack.c @@ -392,6 +392,7 @@ static int load_msgpack_data(struct panel_template *p, int fs, ss; float *fdata; + int32_t *in_data = (int32_t *)data_obj->via.bin.ptr; fdata = malloc(PANEL_WIDTH(p) * PANEL_HEIGHT(p) * sizeof(float)); if ( fdata == NULL ) return 1; @@ -399,7 +400,25 @@ static int load_msgpack_data(struct panel_template *p, for ( ss=0; ssorig_min_fs + (ss+p->orig_min_ss)*data_size_fs; - fdata[fs+ss*PANEL_WIDTH(p)] = data_obj->via.bin.ptr[idx]; + fdata[fs+ss*PANEL_WIDTH(p)] = in_data[idx]; + } + } + + data = fdata; + + } else if ( strcmp(dtype, "via.bin.ptr; + + fdata = malloc(PANEL_WIDTH(p) * PANEL_HEIGHT(p) * sizeof(float)); + if ( fdata == NULL ) return 1; + + for ( ss=0; ssorig_min_fs + (ss+p->orig_min_ss)*data_size_fs; + fdata[fs+ss*PANEL_WIDTH(p)] = in_data[idx]; } } -- cgit v1.2.3