casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
timeblockencoder.h
Go to the documentation of this file.
1 #ifndef DYSCO_TIME_BLOCK_ENCODER_H
2 #define DYSCO_TIME_BLOCK_ENCODER_H
3 
4 #include "stochasticencoder.h"
5 #include "timeblockbuffer.h"
6 #include "uvector.h"
7 
8 #include <complex>
9 #include <random>
10 #include <vector>
11 
13  public:
14  RMSMeasurement() : _count(0), _value(0.0) {}
15 
16  void Include(const std::complex<double> &val) {
17  if (isfinite(val)) {
18  _count++;
19  _value += val.real() * val.real() + val.imag() * val.imag();
20  }
21  }
22 
23  double RMS() const { return sqrt(_value / (_count * 2)); }
24 
25  private:
26  static bool isfinite(const std::complex<double> &val) {
27  return std::isfinite(val.real()) && std::isfinite(val.imag());
28  }
29 
30  size_t _count;
31  double _value;
32 };
33 
35  public:
37  typedef typename TimeBlockBuffer<std::complex<float>>::DataRow FBufferRow;
40 
41  typedef unsigned symbol_t;
42 
43  virtual ~TimeBlockEncoder() {}
44 
45  virtual void EncodeWithDithering(
46  const dyscostman::StochasticEncoder<float> &gausEncoder, FBuffer &buffer,
47  float *metaBuffer, symbol_t *symbolBuffer, size_t antennaCount,
48  std::mt19937 &rnd) = 0;
49 
50  virtual void EncodeWithoutDithering(
51  const dyscostman::StochasticEncoder<float> &gausEncoder, FBuffer &buffer,
52  float *metaBuffer, symbol_t *symbolBuffer, size_t antennaCount) = 0;
53 
54  virtual void InitializeDecode(const float *metaBuffer, size_t nRow,
55  size_t nAntennae) = 0;
56 
57  virtual void Decode(const dyscostman::StochasticEncoder<float> &gausEncoder,
58  FBuffer &buffer, const symbol_t *symbolBuffer,
59  size_t blockRow, size_t antenna1, size_t antenna2) = 0;
60 
61  virtual size_t SymbolCount(size_t nRow, size_t nPol,
62  size_t nChannels) const = 0;
63 
64  virtual size_t SymbolCount(size_t nRow) const = 0;
65 
66  virtual size_t SymbolsPerRow() const = 0;
67 
68  virtual size_t MetaDataCount(size_t nRow, size_t nPol, size_t nChannels,
69  size_t nAntennae) const = 0;
70 
71  protected:
73 };
74 
75 #endif
virtual ~TimeBlockEncoder()
virtual size_t SymbolsPerRow() const =0
virtual size_t SymbolCount(size_t nRow, size_t nPol, size_t nChannels) const =0
static bool isfinite(const std::complex< double > &val)
bool isfinite(const std::complex< T > &val)
virtual void EncodeWithoutDithering(const dyscostman::StochasticEncoder< float > &gausEncoder, FBuffer &buffer, float *metaBuffer, symbol_t *symbolBuffer, size_t antennaCount)=0
virtual void Decode(const dyscostman::StochasticEncoder< float > &gausEncoder, FBuffer &buffer, const symbol_t *symbolBuffer, size_t blockRow, size_t antenna1, size_t antenna2)=0
virtual size_t MetaDataCount(size_t nRow, size_t nPol, size_t nChannels, size_t nAntennae) const =0
LatticeExprNode sqrt(const LatticeExprNode &expr)
virtual void EncodeWithDithering(const dyscostman::StochasticEncoder< float > &gausEncoder, FBuffer &buffer, float *metaBuffer, symbol_t *symbolBuffer, size_t antennaCount, std::mt19937 &rnd)=0
Header file for uvector and its relational and swap functions.
TimeBlockBuffer< std::complex< float > > FBuffer
TimeBlockBuffer< std::complex< double > > DBuffer
virtual void InitializeDecode(const float *metaBuffer, size_t nRow, size_t nAntennae)=0
double RMS() const
Lossy encoder for stochastic values.
TimeBlockBuffer< std::complex< double > >::DataRow DBufferRow
TimeBlockBuffer< std::complex< float > >::DataRow FBufferRow
void Include(const std::complex< double > &val)