viterbi decoder: add viterbi decoder base class

Add a viterbi decoder base class that viterbi decoder
implementations can inherit from.
This commit is contained in:
Stephen Wolfe
2016-11-07 15:00:30 -05:00
parent 9cf628359b
commit 528536e3f2
7 changed files with 185 additions and 240 deletions
+3 -32
View File
@@ -17,38 +17,24 @@
#ifndef INCLUDED_IEEE802_11_VITERBI_DECODER_GENERIC_H
#define INCLUDED_IEEE802_11_VITERBI_DECODER_GENERIC_H
#include "utils.h"
#include "base.h"
namespace gr {
namespace ieee802_11 {
// Maximum number of traceback bytes
#define TRACEBACK_MAX 24
/* This Viterbi decoder was taken from the gr-dvbt module of
* GNU Radio. It is an SSE2 version of the Viterbi Decoder
* created by Phil Karn. The SSE2 version was made by Bogdan
* Diaconescu. For more info see: gr-dvbt/lib/d_viterbi.h
*/
class viterbi_decoder
class viterbi_decoder : public base
{
public:
viterbi_decoder();
virtual ~viterbi_decoder();
uint8_t* decode(ofdm_param *ofdm, frame_param *frame, uint8_t *in);
virtual uint8_t* decode(ofdm_param *ofdm, frame_param *frame, uint8_t *in);
private:
// Position in circular buffer where the current decoded byte is stored
int d_store_pos;
// Metrics for each state
unsigned char d_mmresult[64] __attribute__((aligned(16)));
// Paths for each state
unsigned char d_ppresult[TRACEBACK_MAX][64] __attribute__((aligned(16)));
union branchtab27 {
unsigned char c[32];
} d_branchtab27_generic[2];
@@ -58,22 +44,7 @@ private:
unsigned char d_path0_generic[64] __attribute__ ((aligned(16)));
unsigned char d_path1_generic[64] __attribute__ ((aligned(16)));
int d_ntraceback;
int d_k;
ofdm_param *d_ofdm;
frame_param *d_frame;
const unsigned char *d_depuncture_pattern;
uint8_t d_depunctured[MAX_ENCODED_BITS];
uint8_t d_decoded[MAX_ENCODED_BITS * 3 / 4];
static const unsigned char PARTAB[256];
static const unsigned char PUNCTURE_1_2[2];
static const unsigned char PUNCTURE_2_3[4];
static const unsigned char PUNCTURE_3_4[6];
void reset();
uint8_t* depuncture(uint8_t *in);
void viterbi_chunks_init_generic();
void viterbi_butterfly2_generic(unsigned char *symbols,