EightBitOne.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/EightBitOne.h
10 
11 #ifndef __EightBitOne_h
12 #define __EightBitOne_h
13 
14 #include "dsp/NLowLookup.h"
15 
16 namespace dsp
17 {
19  class EightBitOne : public NLowLookup
20  {
21 
22  public:
23 
24  EightBitOne (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  nlow = 0;
36 
37  unsigned total = 0;
38 
39  for (unsigned idat = 0; idat < ndat; idat++)
40  {
41  output[idat * output_incr] = lookup[ *input ];
42  nlow += nlow_lookup[ *input ];
43  total += *input;
44 
45  ++ input;
46  }
47 
48  bad = (total == 0);
49  }
50  };
51 
52 }
53 
54 #endif
Contains all Baseband Data Reduction Library classes.
Definition: ASCIIObservation.h:17
Unpack one 8-bit samples per byte from an array of bytes.
Definition: EightBitOne.h:24
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

Generated using doxygen 1.8.17