2 #include "../../../tests/catch2/catch.hpp"
3 #include "../../tests/testMacrosINDI.hpp"
5 #include "../streamWriter.hpp"
72 for(
size_t rr =0; rr < m_sw->
m_width; ++rr)
74 for(
size_t cc =0; cc < m_sw->
m_height; ++cc)
87 curr_timing[1] = pp + 1000;
88 curr_timing[2] = pp + 2000;
116 xrif_error_t xrv = xrif_new(&xrif);
118 char header[XRIF_HEADER_SIZE];
120 FILE * fp_xrif = fopen(m_sw->
m_fname,
"rb");
121 size_t nr = fread(header, 1, XRIF_HEADER_SIZE, fp_xrif);
123 if(nr != XRIF_HEADER_SIZE)
130 uint32_t header_size;
131 xrif_read_header(xrif, &header_size , header);
134 if(xrif_width(xrif) != m_sw->
m_width)
140 if(xrif_height(xrif) != m_sw->
m_height)
146 if(xrif_depth(xrif) != 1)
152 if(xrif_frames(xrif) != stop-start )
161 nr = fread(xrif->raw_buffer, 1, xrif->compressed_size, fp_xrif);
163 if(nr != xrif->compressed_size)
165 std::cerr <<
"error reading compressed image buffer.\n";
169 xrv = xrif_decode(xrif);
170 if(xrv != XRIF_NOERROR)
172 std::cerr <<
"error decoding compressed image buffer. Code: " << xrv <<
"\n";
185 std::cerr <<
"Buffers don't match: " << badpix <<
" bad pixels.\n";
198 SCENARIO(
"streamWriter Configuration",
"[streamWriter]" )
200 GIVEN(
"A default constructed streamWriter")
205 WHEN(
"default configurations")
214 SCENARIO(
"streamWriter encoding data",
"[streamWriter]" )
216 GIVEN(
"A default constructed streamWriter and a 120x120 uint16 stream")
221 WHEN(
"writing full 1st chunk")
223 int circBuffLength = 10;
224 int writeChunkLength = 5;
236 WHEN(
"writing full 2nd chunk")
238 int circBuffLength = 10;
239 int writeChunkLength = 5;
251 WHEN(
"writing partial 1st chunk")
253 int circBuffLength = 10;
254 int writeChunkLength = 5;
266 WHEN(
"writing partial 2nd chunk")
268 int circBuffLength = 10;
269 int writeChunkLength = 5;
size_t m_circBuffLength
The length of the circular buffer, in frames.
int initialize_xrif()
Initialize the xrif system.
uint64_t * m_timingCircBuff
uint8_t m_dataType
The ImageStreamIO type code.
int m_typeSize
The pixel byte depth.
uint64_t m_currSaveStart
The circular buffer position at which to start saving.
size_t m_writeChunkLength
The number of frames to write at a time.
size_t m_height
The height of the image.
uint64_t m_currSaveStopFrameNo
The frame number of the image at which saving stopped (for logging)
int allocate_circbufs()
Worker function to allocate the circular buffers.
char * m_rawImageCircBuff
int allocate_xrif()
Worker function to configure and allocate the xrif handles.
std::string m_rawimageDir
The path where files will be saved.
int m_writing
Controls whether or not images are being written, and sequences start and stop of writing.
int doEncode()
Function called when semaphore is raised to do the encode and write.
uint64_t m_currSaveStop
The circular buffer position at which to stop saving.
size_t m_width
The width of the image.
SCENARIO("streamWriter Configuration", "[streamWriter]")
int setup_xrif(int writeChunkLength)
int write_frames(int start, int stop)
int setup_circbufs(int width, int height, int dataType, int circBuffLength)
int fill_circbuf_uint16()
int comp_frames_uint16(size_t start, size_t stop)
std::string rawimageDir()
streamWriter_test(streamWriter *sw)