diff --git a/RTCP/Cobalt/CoInterface/src/CorrelatedData.cc b/RTCP/Cobalt/CoInterface/src/CorrelatedData.cc index 83ec3a1c14885697420360f028029db3a3693365..c207e63c26040dd8a44573226f287f78e734cd77 100644 --- a/RTCP/Cobalt/CoInterface/src/CorrelatedData.cc +++ b/RTCP/Cobalt/CoInterface/src/CorrelatedData.cc @@ -76,8 +76,7 @@ namespace LOFAR itsAlignment, allocator, true), - itsNrBytesPerNrValidSamples( - maxNrValidSamples < 256 ? 1 : maxNrValidSamples < 65536 ? 2 : 4) + itsNrBytesPerNrValidSamples(nrBytesPerNrValidSamples(maxNrValidSamples)) { init(nrChannels, allocator); } @@ -100,8 +99,7 @@ namespace LOFAR [NR_POLARIZATIONS], visibilities, false), - itsNrBytesPerNrValidSamples( - maxNrValidSamples < 256 ? 1 : maxNrValidSamples < 65536 ? 2 : 4) + itsNrBytesPerNrValidSamples(nrBytesPerNrValidSamples(maxNrValidSamples)) { ASSERT(this->visibilities.num_elements() == nrVisibilities); init(nrChannels, allocator); @@ -114,11 +112,14 @@ namespace LOFAR unsigned alignment) { const size_t nrBaselines = nrStations * (nrStations + 1) / 2; - const size_t nrBytesPerNrValidSamples = - maxNrValidSamples < 256 ? 1 : maxNrValidSamples < 65536 ? 2 : 4; - return nrBaselines * nrChannels * NR_POLARIZATIONS * NR_POLARIZATIONS * sizeof(float) + alignment - + nrBaselines * nrChannels * nrBytesPerNrValidSamples + 2 * alignment; + return nrBaselines * nrChannels * NR_POLARIZATIONS * NR_POLARIZATIONS * sizeof (fcomplex) + alignment + + nrBaselines * nrChannels * nrBytesPerNrValidSamples(maxNrValidSamples) + 2 * alignment; // nrValidSamples are aligned and padded + } + + + size_t CorrelatedData::nrBytesPerNrValidSamples(size_t maxNrValidSamples) { + return maxNrValidSamples < 256 ? 1 : maxNrValidSamples < 65536 ? 2 : 4; } diff --git a/RTCP/Cobalt/CoInterface/src/CorrelatedData.h b/RTCP/Cobalt/CoInterface/src/CorrelatedData.h index b0f177da676dcac0435eda21b209de6e2bdc7710..0efe2c42eee2159552a7148307d407e5fc6e221e 100644 --- a/RTCP/Cobalt/CoInterface/src/CorrelatedData.h +++ b/RTCP/Cobalt/CoInterface/src/CorrelatedData.h @@ -93,6 +93,8 @@ namespace LOFAR Matrix<uint32_t> itsNrValidSamples4; // [nrBaselines][nrChannels] Matrix<uint16_t> itsNrValidSamples2; // [nrBaselines][nrChannels] Matrix<uint8_t> itsNrValidSamples1; // [nrBaselines][nrChannels] + + static size_t nrBytesPerNrValidSamples(size_t maxNrValidSamples); };