FourBitTwo.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2008 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // dspsr/Kernel/Classes/dsp/FourBitTwo.h
10 
11 #ifndef __FourBitTwo_h
12 #define __FourBitTwo_h
13 
14 #include "dsp/NLowLookup.h"
15 
16 namespace dsp
17 {
19  class FourBitTwo : public NLowLookup
20  {
21 
22  public:
23 
24  FourBitTwo (BitTable* table) : NLowLookup (table) { bad = false; }
25 
26  bool bad;
27 
28  template<class Iterator>
29  inline void prepare (const Iterator& input, unsigned ndat) { }
30 
31  template<class Iterator>
32  inline void unpack (Iterator& input, unsigned ndat,
33  float* output, unsigned output_incr, unsigned& nlow)
34  {
35  const unsigned ndat2 = ndat/2;
36  nlow = 0;
37 
38  unsigned total = 0;
39 
40  for (unsigned idat = 0; idat < ndat2; idat++)
41  {
42  unsigned index = *input;
43  total += index;
44 
45  ++ input;
46 
47  *output = lookup[ index*2 ]; output += output_incr;
48  *output = lookup[ index*2 + 1 ]; output += output_incr;
49 
50  nlow += nlow_lookup [index];
51  }
52 
53  bad = (total == 0);
54  }
55  };
56 
57 }
58 
59 #endif
Contains all Baseband Data Reduction Library classes.
Definition: ASCIIObservation.h:17
Manage now lookup table for ExcisionUnpacker derived classes.
Definition: NLowLookup.h:24
Look-up table for converting N-bit digitized to floating point numbers.
Definition: BitTable.h:22
Unpack two 4-bit samples per byte from an array of bytes.
Definition: FourBitTwo.h:24

Generated using doxygen 1.8.17