dsp::Mark4TwoBitTable Class Reference

Look-up tables for conversion from Mark4 two-bit to floating point numbers. More...

#include <Mark4TwoBitTable.h>

Inheritance diagram for dsp::Mark4TwoBitTable:
dsp::TwoBitTable dsp::BitTable Reference::Able Reference::HeapTracked

Public Member Functions

 Mark4TwoBitTable (Type type)
 Constructor.
 
 ~Mark4TwoBitTable ()
 Destructor.
 
virtual unsigned twobit (unsigned byte, unsigned sample) const
 Return the 2-bit number from byte corresponding to sample. More...
 
- Public Member Functions inherited from dsp::TwoBitTable
 TwoBitTable (Type type, bool reverse_bits=false)
 Constructor.
 
void set_lo_val (float lo_val)
 Set the value of the low voltage state.
 
float get_lo_val () const
 Return the value of the low voltage state.
 
void set_hi_val (float hi_val)
 Set the value of the high voltage state.
 
float get_hi_val () const
 Return the value of the high voltage state.
 
void set_reverse_2bit (bool flag=true)
 Set the reverse_2bit attribute.
 
bool get_reverse_2bit () const
 Get the reverse_2bit value.
 
void rebuild ()
 Build a two-bit table with the current attributes.
 
void generate_unique_values (float *vals) const
 Generate a look-up table for 2-bit to floating point conversion.
 
- Public Member Functions inherited from dsp::BitTable
 BitTable (unsigned nbit, Type type, bool reverse_bits=false)
 Constructor.
 
virtual ~BitTable ()
 Destructor.
 
void set_effective_nbit (unsigned bits)
 Set the effective number of bits. More...
 
unsigned get_effective_nbit () const
 
void set_order (Order)
 Set the order of the samples in each byte.
 
Order get_order () const
 
void set_zero_is_a_threshold (bool)
 Set to true if zero is a threshold; set to false if zero is a value. More...
 
bool get_zero_is_a_threshold () const
 
unsigned get_values_per_byte () const
 Get the number of floating point values per byte, 8/N.
 
unsigned get_unique_values () const
 Get the number of unique values of an N-bit integer, 2^N.
 
double get_scale () const
 Get the scale factor used to normalize the variance to unity.
 
Type get_type () const
 Return the digitization convention.
 
const float * get_values (unsigned byte=0) const
 Returns pointer to values_per_byte floats represented by byte.
 
void generate (float *table) const
 Generate a look-up table for conversion to floating point. More...
 
virtual unsigned extract (unsigned byte, unsigned i) const
 Extract the ith sample from byte. More...
 
virtual double get_optimal_variance () const
 Return the optimal variance of normally distributed samples.
 
virtual double get_nlow_threshold () const
 Return the optimal threshold closest to and less than unity.
 
virtual void get_nlow_lookup (char *nlow_lookup) const
 Return the number of low voltage states in each of 256 bytes.
 
- Public Member Functions inherited from Reference::Able
 Able (const Able &)
 
Ableoperator= (const Able &)
 
unsigned get_reference_count () const
 
- Public Member Functions inherited from Reference::HeapTracked
 HeapTracked (const HeapTracked &)
 
HeapTrackedoperator= (const HeapTracked &)
 
bool __is_on_heap () const
 

Additional Inherited Members

- Public Types inherited from dsp::BitTable
enum  Type { OffsetBinary, TwosComplement, SignMagnitude }
 Interpretation of the bits in each value.
 
enum  Order { MostToLeast, LeastToMost }
 The order of values in each byte (bit significance)
 
- Static Public Member Functions inherited from Reference::Able
static size_t get_instance_count ()
 
- Static Public Member Functions inherited from Reference::HeapTracked
static void * operator new (size_t size, void *ptr=0)
 
static void operator delete (void *location, void *ptr)
 
static void operator delete (void *location)
 
static size_t get_heap_queue_size ()
 
- Static Public Attributes inherited from dsp::BitTable
static const unsigned bits_per_byte = 8
 Number of bits per bytes.
 
static const unsigned unique_bytes = 1 << bits_per_byte
 Number of unique 8-bit combinations.
 
- Protected Member Functions inherited from dsp::BitTable
void build ()
 Build the lookup table.
 
void destroy ()
 Destroy the lookup table.
 
- Protected Member Functions inherited from Reference::Able
Handle__reference (bool active) const
 
void __dereference (bool auto_delete=true) const
 
- Protected Attributes inherited from dsp::TwoBitTable
float lo_val
 Value of voltage in low state.
 
float hi_val
 Value of voltage in high state.
 
bool reverse_2bit
 Flip the two data bits - that is SignMag becomes MagSign.
 
- Protected Attributes inherited from dsp::BitTable
float * table
 For each unsigned char, values of the two output voltage states.
 
Type type
 Digitization convention.
 
const unsigned nbit
 Number of bits.
 
unsigned zero_is_a_threshold
 Zero is a threshold.
 
unsigned effective_nbit
 The effective number of bits.
 
const bool reverse_bits
 Reverse the order of the bits.
 
Order order
 The order of the samples in each byte.
 
const unsigned values_per_byte
 Number of N-bit values per byte.
 
const unsigned unique_values
 Number of unique N-bit values.
 
const unsigned nbit_mask
 N-bit mask.
 
double scale
 The scale factor used to normalize the variance to unity.
 

Detailed Description

Look-up tables for conversion from Mark4 two-bit to floating point numbers.

The conversion scheme is specific to the ordering of bits in Mark4 data

Member Function Documentation

◆ twobit()

unsigned dsp::Mark4TwoBitTable::twobit ( unsigned  byte,
unsigned  sample 
) const
virtual

Return the 2-bit number from byte corresponding to sample.

Each byte is interpreted as follows:

MSB: l3 l2 l1 l0 m3 m2 m1 m0 :LSB

Where each two bit timesample is given by its most significant bit, mX, and least significant bit, lX, and each byte contains four time samples: m0l0, m1l1, m2l2, m3l3.

Parameters
bytethe byte pattern containing four time samples
samplethe sample to extract from the byte

The documentation for this class was generated from the following files:

Generated using doxygen 1.8.17