13 #include <framework/utilities/Utils.h>
22 unsigned int ilog2(
unsigned int v);
46 void putNBits(
unsigned int value,
unsigned int n)
48 unsigned int bpos =
m_pos % 32, wpos =
m_pos / 32;
49 value &= 0xffffffffu >> (32 - n);
53 if (bpos + n > 32)
m_store[wpos + 1] = value >> (32 - bpos);
63 unsigned int bpos =
m_pos % 32, wpos =
m_pos / 32;
66 unsigned int res =
m_store[wpos] >> bpos;
67 if (bpos + n > 32) res |=
m_store[wpos + 1] << (32 - bpos);
69 return res & (0xffffffffu >> (32 - n));
size_t getPos() const
Get current position in the stream.
std::vector< unsigned int > m_store
The bit storage.
void resize()
Resize data vector to the current position.
void setPos(size_t pos)
Set position in the stream.
BitStream(int n)
Constructor with the reserved and cleared storage prepared for incoming bits.
BitStream()
Default constructor for ROOT.
size_t m_pos
Current position in the storage.
unsigned int getNBits(unsigned int n)
Fetch n bits.
void putNBits(unsigned int value, unsigned int n)
Push n least significant bits of "value" to the stream.
std::vector< unsigned int > & getStore()
Get data vector.
ECL waveform compression/decompression to/from the BitStream storage with the BASE algorithm.
void compress(BitStream &out, const int *adc) override
Compress the ECL waveform.
void uncompress(BitStream &out, int *adc) override
Decompress the ECL waveform.
Abstract class (interface) for ECL waveform compression/decompression to/from the BitStream storage.
virtual void uncompress(BitStream &in, int *adc)=0
Decompress the ECL waveform.
virtual void compress(BitStream &out, const int *adc)=0
Compress the ECL waveform.
virtual ~ECLCompress()
virtual destructure
ECL waveform compression/decompression to/from the BitStream storage based on the Discrete Cosine Tra...
const width_t * m_widths
Bit widths for the DCT coefficients for prefix encoding.
ECLDCTCompress(double scale, double c0, width_t *w)
Constructor for DCT based compression algorithm.
void compress(BitStream &out, const int *adc) override
Compress the ECL waveform.
const double m_scale
Scale factor for quantization.
const double m_c0
Average waveform amplitude.
void uncompress(BitStream &out, int *adc) override
Decompress the ECL waveform.
ECL waveform compression/decompression to/from the BitStream storage with the DELTA algorithm.
void compress(BitStream &out, const int *adc) override
Compress the ECL waveform.
void uncompress(BitStream &out, int *adc) override
Decompress the ECL waveform.
#define branch_unlikely(x)
A macro to tell the compiler that the argument x will be very likely be false.
Abstract base class for different kinds of events.
Bit widths for the prefix coding to encode integers which are mainly concentrated around zero and pro...
unsigned char w0
Progressive bit width to encode an integer value.
unsigned char w2
Progressive bit width to encode an integer value.
unsigned char w1
Progressive bit width to encode an integer value.
unsigned char w3
Progressive bit width to encode an integer value.