Loading...
Searching...
No Matches
aftimeblockencoder.h
Go to the documentation of this file.
#ifndef DYSCO_AFTIME_BLOCK_ENCODER_H
#define DYSCO_AFTIME_BLOCK_ENCODER_H
#include "stochasticencoder.h"
#include "timeblockbuffer.h"
#include "uvector.h"
#include <complex>
#include <random>
#include <vector>
#include "timeblockencoder.h"
class AFTimeBlockEncoder : public TimeBlockEncoder {
public:
AFTimeBlockEncoder(size_t nPol, size_t nChannels, bool fitToMaximum);
virtual ~AFTimeBlockEncoder() override;
virtual void EncodeWithDithering(
const dyscostman::StochasticEncoder<float> &gausEncoder, FBuffer &buffer,
float *metaBuffer, symbol_t *symbolBuffer, size_t antennaCount,
std::mt19937 &rnd) final override {
encode<true>(gausEncoder, buffer, metaBuffer, symbolBuffer, antennaCount,
&rnd);
}
virtual void EncodeWithoutDithering(
const dyscostman::StochasticEncoder<float> &gausEncoder, FBuffer &buffer,
float *metaBuffer, symbol_t *symbolBuffer,
size_t antennaCount) final override {
encode<false>(gausEncoder, buffer, metaBuffer, symbolBuffer, antennaCount,
0);
}
virtual void InitializeDecode(const float *metaBuffer, size_t nRow,
size_t nAntennae) final override;
virtual void Decode(const dyscostman::StochasticEncoder<float> &gausEncoder,
FBuffer &buffer, const symbol_t *symbolBuffer,
size_t blockRow, size_t antenna1,
size_t antenna2) final override;
virtual size_t SymbolCount(size_t nRow, size_t nPol,
size_t nChannels) const final override {
return nRow * nChannels * nPol * 2 /*complex*/;
}
virtual size_t SymbolCount(size_t nRow) const final override {
return nRow * _nChannels * _nPol * 2 /*complex*/;
}
virtual size_t SymbolsPerRow() const final override {
return _nChannels * _nPol * 2 /*complex*/;
}
virtual size_t MetaDataCount(size_t /*nRow*/, size_t nPol, size_t nChannels,
size_t nAntennae) const final override {
return nPol * (nChannels + nAntennae);
}
void Normalize(const dyscostman::StochasticEncoder<float> &gausEncoder,
TimeBlockBuffer<std::complex<float>> &buffer,
size_t antennaCount);
private:
void calculateAntennaeRMS(const std::vector<DBufferRow> &data,
size_t polIndex, size_t antennaCount);
template <bool UseDithering>
void encode(const dyscostman::StochasticEncoder<float> &gausEncoder,
const FBuffer &buffer, float *metaBuffer, symbol_t *symbolBuffer,
size_t antennaCount, std::mt19937 *rnd);
void changeAntennaFactor(std::vector<DBufferRow> &data, float *metaBuffer,
size_t antennaIndex, size_t antennaCount,
size_t polIndex, double factor);
void fitToMaximum(std::vector<DBufferRow> &data, float *metaBuffer,
const dyscostman::StochasticEncoder<float> &gausEncoder,
size_t antennaCount);
size_t _nPol, _nChannels;
bool _fitToMaximum;
ao::uvector<double> _rmsPerChannel, _rmsPerAntenna;
std::uniform_int_distribution<unsigned> _ditherDist;
};
#endif
AFTimeBlockEncoder::_ditherDist
std::uniform_int_distribution< unsigned > _ditherDist
Definition aftimeblockencoder.h:87
AFTimeBlockEncoder::AFTimeBlockEncoder
AFTimeBlockEncoder(size_t nPol, size_t nChannels, bool fitToMaximum)
AFTimeBlockEncoder::_rmsPerChannel
ao::uvector< double > _rmsPerChannel
Definition aftimeblockencoder.h:86
AFTimeBlockEncoder::~AFTimeBlockEncoder
virtual ~AFTimeBlockEncoder() override
AFTimeBlockEncoder::EncodeWithDithering
virtual void EncodeWithDithering(const dyscostman::StochasticEncoder< float > &gausEncoder, FBuffer &buffer, float *metaBuffer, symbol_t *symbolBuffer, size_t antennaCount, std::mt19937 &rnd) final override
Definition aftimeblockencoder.h:20
AFTimeBlockEncoder::SymbolCount
virtual size_t SymbolCount(size_t nRow, size_t nPol, size_t nChannels) const final override
Definition aftimeblockencoder.h:44
AFTimeBlockEncoder::encode
void encode(const dyscostman::StochasticEncoder< float > &gausEncoder, const FBuffer &buffer, float *metaBuffer, symbol_t *symbolBuffer, size_t antennaCount, std::mt19937 *rnd)
AFTimeBlockEncoder::_nPol
size_t _nPol
Definition aftimeblockencoder.h:83
AFTimeBlockEncoder::SymbolsPerRow
virtual size_t SymbolsPerRow() const final override
Definition aftimeblockencoder.h:53
AFTimeBlockEncoder::Normalize
void Normalize(const dyscostman::StochasticEncoder< float > &gausEncoder, TimeBlockBuffer< std::complex< float > > &buffer, size_t antennaCount)
AFTimeBlockEncoder::MetaDataCount
virtual size_t MetaDataCount(size_t, size_t nPol, size_t nChannels, size_t nAntennae) const final override
Definition aftimeblockencoder.h:57
AFTimeBlockEncoder::_rmsPerAntenna
ao::uvector< double > _rmsPerAntenna
Definition aftimeblockencoder.h:86
AFTimeBlockEncoder::SymbolCount
virtual size_t SymbolCount(size_t nRow) const final override
Definition aftimeblockencoder.h:49
AFTimeBlockEncoder::fitToMaximum
void fitToMaximum(std::vector< DBufferRow > &data, float *metaBuffer, const dyscostman::StochasticEncoder< float > &gausEncoder, size_t antennaCount)
AFTimeBlockEncoder::changeAntennaFactor
void changeAntennaFactor(std::vector< DBufferRow > &data, float *metaBuffer, size_t antennaIndex, size_t antennaCount, size_t polIndex, double factor)
AFTimeBlockEncoder::calculateAntennaeRMS
void calculateAntennaeRMS(const std::vector< DBufferRow > &data, size_t polIndex, size_t antennaCount)
AFTimeBlockEncoder::_fitToMaximum
bool _fitToMaximum
Definition aftimeblockencoder.h:84
AFTimeBlockEncoder::InitializeDecode
virtual void InitializeDecode(const float *metaBuffer, size_t nRow, size_t nAntennae) final override
AFTimeBlockEncoder::_nChannels
size_t _nChannels
Definition aftimeblockencoder.h:83
AFTimeBlockEncoder::EncodeWithoutDithering
virtual void EncodeWithoutDithering(const dyscostman::StochasticEncoder< float > &gausEncoder, FBuffer &buffer, float *metaBuffer, symbol_t *symbolBuffer, size_t antennaCount) final override
Definition aftimeblockencoder.h:28
AFTimeBlockEncoder::Decode
virtual void Decode(const dyscostman::StochasticEncoder< float > &gausEncoder, FBuffer &buffer, const symbol_t *symbolBuffer, size_t blockRow, size_t antenna1, size_t antenna2) final override
TimeBlockBuffer
Definition timeblockbuffer.h:10
TimeBlockEncoder::FBuffer
TimeBlockBuffer< std::complex< float > > FBuffer
Definition timeblockencoder.h:36
TimeBlockEncoder::symbol_t
unsigned symbol_t
Definition timeblockencoder.h:41
TimeBlockEncoder::TimeBlockEncoder
TimeBlockEncoder()
Definition timeblockencoder.h:72
ao::uvector
A container similar to std::vector, but one that allows construction without initializing its element...
Definition uvector.h:74
dyscostman::StochasticEncoder
Lossy encoder for stochastic values.
Definition stochasticencoder.h:32
stochasticencoder.h
timeblockbuffer.h
timeblockencoder.h
uvector.h
Header file for uvector and its relational and swap functions.