From 51bd146178fb1448cb5be0d8aa65de72ee3994d9 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Mon, 29 Jun 2015 16:52:52 +0200 Subject: [PATCH] flip bytes incorporated --- slsDetectorCalibration/eigerHalfModuleData.h | 37 +++++++++++--------- slsDetectorCalibration/slsDetectorData.h | 2 +- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/slsDetectorCalibration/eigerHalfModuleData.h b/slsDetectorCalibration/eigerHalfModuleData.h index 1b3f23def..62064a3aa 100644 --- a/slsDetectorCalibration/eigerHalfModuleData.h +++ b/slsDetectorCalibration/eigerHalfModuleData.h @@ -256,11 +256,11 @@ public: */ virtual uint32_t getChannel(char *data, int ix, int iy, int dr) { - uint32_t m=0; + uint32_t m=0, n = 0; uint64_t t; int numBytes,divFactor,pixelval; - //cout <<"ix:"<=0 && ix=0 && iy=0 && dataMap[iy][ix]> (pixelval*4); cout <<"value:"<< value << endl; - return ((t >> (pixelval*4)) & 0xf)^m; - else if(dr == 8) - //uint8_t value = t >> (pixelval*8); cout <<"value:"<< value << endl; - return ((t >> (pixelval*8)) & 0xff)^m; - else if(dr == 16){ - //uint16_t value = t >> (pixelval*16); cout <<"value:"<< value << endl; - return ((t >> (pixelval*16)) & 0xffff)^m; - }else{ - //uint32_t value = t >> (pixelval*32); cout <<"value:"<< value << endl; - return ((t >> (pixelval*32)) & 0xffffffff)^m; - } + /*//big endian + t = ((uint64_t)(*((uint64_t*)(((char*)data)+(dataMap[iy][newix]))))); + if(dr == 4) return ((t >> (pixelval*4)) & 0xf)^m; + else if(dr == 8) return ((t >> (pixelval*8)) & 0xff)^m; + else if(dr == 16) return ((t >> (pixelval*16)) & 0xffff)^m; + else return ((t >> (pixelval*32)) & 0xffffffff)^m; + */ + + //little endian + n = ((uint32_t)(*((uint32_t*)(((char*)data)+(dataMap[iy][ix]))))); + if(dr == 4) return (n & 0xf)^m; + else if(dr == 8) return (n & 0xff)^m; + else if(dr == 16) return (n & 0xffff)^m; + else return (n & 0xffffffff)^m; + + }; diff --git a/slsDetectorCalibration/slsDetectorData.h b/slsDetectorCalibration/slsDetectorData.h index bfb284bc0..c17d30ec1 100644 --- a/slsDetectorCalibration/slsDetectorData.h +++ b/slsDetectorCalibration/slsDetectorData.h @@ -93,7 +93,7 @@ class slsDetectorData { void setDataMap(int **dMap=NULL) { - int ip; + /* int ip;*/ if (dMap==NULL) { for (int iy=0; iy