Merge branch 'ICSHWI-10278_timestamping' into 'dev'

Collect timestamping from camera frames

See merge request epics-modules/adhama!3
This commit is contained in:
Douglas Araujo
2022-09-27 12:41:07 +00:00
4 changed files with 19 additions and 10 deletions

4
.gitignore vendored
View File

@@ -4,4 +4,6 @@ O.*
/dbd
.cvsignore
*.db
*.db.*
*.db.*
pv.list
core.*

View File

@@ -473,7 +473,6 @@ return 0;
}
//============================================================================
void Hama::imageTask(){
epicsTimeStamp imageStamp;
int status;
unsigned char *image;
int acquire;
@@ -484,7 +483,6 @@ epicsTimeStamp imageStamp;
int imageMode=0;
int totalImages=0;
uint64_t prevAcquisitionCount = 0;
epicsTimeStamp startTime; // endTime;
DCAMCAP_TRANSFERINFO captransferinfo;
//static const char *functionName = "imageTask";
@@ -514,13 +512,12 @@ epicsTimeStamp imageStamp;
else {
acquire = 1;
/* Get the current time */
epicsTimeGetCurrent(&startTime);
prevAcquisitionCount = 0;
}
}
/* Added this delay for the thread not to hog the processor. No need to run on full speed. */
epicsThreadSleep(0.001);
//epicsThreadSleep(0.001);
// get image transfer status.
unlock();
@@ -549,7 +546,10 @@ epicsTimeStamp imageStamp;
memset(image, 0, width * 2 * height);
count++;
accessCapturedImage(m_hdcam, captransferinfo.nNewestFrameIndex, image, width * 2, width, height);
int32 ts_sec = 0, ts_microsec = 0;
accessCapturedImage(m_hdcam, captransferinfo.nNewestFrameIndex, image,
width * 2, width, height, ts_sec, ts_microsec);
getIntegerParam(NDArrayCallbacks, &callback);
if(callback) {
@@ -564,8 +564,7 @@ epicsTimeStamp imageStamp;
if(pImage) {
pImage->uniqueId = count;
pImage->timeStamp = imageStamp.secPastEpoch +
(imageStamp.nsec / 1.0e9);
pImage->timeStamp = ts_sec + (ts_microsec / 1.0e6);
updateTimeStamp(&pImage->epicsTS);
memcpy(pImage->pData, (epicsUInt16 *)image, pImage->dataSize);
@@ -1052,7 +1051,9 @@ inline void* memcpy_s( void* dst, size_t dstsize, const void* src, size_t srclen
return memcpy( dst, src, srclen );
}
asynStatus Hama::accessCapturedImage(HDCAM hdcam, int32 iFrame, void* buf, int32 rowbytes, int32 cx, int32 cy )
asynStatus Hama::accessCapturedImage(HDCAM hdcam, int32 iFrame, void* buf,
int32 rowbytes, int32 cx, int32 cy,
int32& ts_sec, int32& ts_microsec)
{
DCAMERR err;
@@ -1074,6 +1075,10 @@ asynStatus Hama::accessCapturedImage(HDCAM hdcam, int32 iFrame, void* buf, int32
return asynError;
}
// Get timestamp from the the frame
ts_sec = bufframe.timestamp.sec;
ts_microsec = bufframe.timestamp.microsec;
// copy target ROI
int32 copyrowbytes = cx * 2;
char* pSrc = (char*)bufframe.buf;

View File

@@ -269,7 +269,7 @@ private:
asynStatus startAcquire(void);
asynStatus stopAcquire(void);
void getImageInformation(HDCAM hdcam, int32& pixeltype, int32& width, int32& rowbytes, int32& height, int32& framebytes);
asynStatus accessCapturedImage(HDCAM hdcam, int32 iFrame, void* buf, int32 rowbytes, int32 cx, int32 cy);
asynStatus accessCapturedImage(HDCAM hdcam, int32 iFrame, void* buf, int32 rowbytes, int32 cx, int32 cy, int32& ts_sec, int32& ts_microsec);
asynStatus imageTransferStatus(HDCAM hdcam, DCAMCAP_TRANSFERINFO &captransferinfo);

View File

@@ -44,3 +44,5 @@ dbpf Hama:cam1:PoolUsedMem.SCAN 0
dbpf Hama:image1:EnableCallbacks 1
epicsThreadSleep(1.0)
dbl > pv.list