2 #include "PixelmapperFrameBiDi.h"
3 #include "helpers/ScopeImage.h"
4 #include "helpers/ScopeMultiImage.h"
8 PixelmapperFrameBiDi::PixelmapperFrameBiDi()
9 : PixelmapperBasic(ScannerTypeHelper::Regular, ScannerVectorTypeHelper::Bidirectional) {
13 PixelmapperResult result(Nothing);
15 const uint32_t multiplier = _currentavgcount;
16 const uint32_t divisor = std::max<uint32_t>(1, _currentavgcount + 1);
17 const uint32_t halfdivisor = std::max<uint32_t>(1, divisor >> 2);
23 for ( uint32_t c = 0 ; c < _chunk->NChannels() ; c++ ) {
26 std::vector<uint16_t>*
const dataptr(imagedata.GetData());
28 chunkit = _chunk->lastmapped[c];
30 channelend = std::begin(_chunk->data)+(c+1)*_chunk->PerChannel();
34 auto lookupend = std::end(*
lookup);
35 for ( ; (lookit != lookupend) && (chunkit != channelend) ; lookit++, chunkit++ ) {
37 n = (
static_cast<uint32_t
>(dataptr->operator[](*lookit)) * multiplier) +
static_cast<uint32_t
>(*chunkit);
38 dataptr->operator[](*lookit) =
static_cast<uint16_t
>( n / divisor + ((n%divisor)>halfdivisor?1u:0u) );
41 _chunk->lastmapped[c] = chunkit;
44 if ( lookit == std::end(*
lookup) ) {
46 result = PixelmapperResult(result | FrameComplete);
51 if ( chunkit == channelend )
52 result = PixelmapperResult(result | EndOfChunk);
std::vector< uint16_t >::iterator iterator
Iterator over the data vector.
Gives RAII safe access (read&write) to the pixeldata of a ScopeImage.
This is the include file for standard system include files, or project specific include files that ar...
PixelmapperResult LookupChunk(DaqChunkPtr const _chunk, const uint16_t &_currentavgcount) override
Maps a chunk via the lookup vector.
std::shared_ptr< const std::vector< std::size_t > > lookup
for position lookup
ScopeMultiImagePtr current_frame
pointer to the current frame to be mapped into
std::vector< std::size_t >::const_iterator lastlookup
last position in lookup where we looked up last time