GNU Radio's IEEE802_11 Package
viterbi_decoder/base.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016 Bastian Bloessl <bloessl@ccs-labs.org>
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17#ifndef INCLUDED_IEEE802_11_VITERBI_DECODER_BASE_H
18#define INCLUDED_IEEE802_11_VITERBI_DECODER_BASE_H
19
20#include "../utils.h"
21
22namespace gr {
23namespace ieee802_11 {
24
25// Maximum number of traceback bytes
26#define TRACEBACK_MAX 24
27
28/* This Viterbi decoder was taken from the gr-dvbt module of
29 * GNU Radio. It is an SSE2 version of the Viterbi Decoder
30 * created by Phil Karn. The SSE2 version was made by Bogdan
31 * Diaconescu. For more info see: gr-dvbt/lib/d_viterbi.h
32 */
33class base
34{
35public:
38 virtual uint8_t* decode(ofdm_param* ofdm, frame_param* frame, uint8_t* in) = 0;
39
40protected:
41 // Position in circular buffer where the current decoded byte is stored
43 // Metrics for each state
44 alignas(16) unsigned char d_mmresult[64];
45 // Paths for each state
46 alignas(16) unsigned char d_ppresult[TRACEBACK_MAX][64];
47
49 int d_k;
52 const unsigned char* d_depuncture_pattern;
53
55 uint8_t d_decoded[MAX_ENCODED_BITS * 3 / 4];
56
57 static const unsigned char PARTAB[256];
58 static const unsigned char PUNCTURE_1_2[2];
59 static const unsigned char PUNCTURE_2_3[4];
60 static const unsigned char PUNCTURE_3_4[6];
61
62 virtual void reset() = 0;
63 uint8_t* depuncture(uint8_t* in);
64};
65
66} // namespace ieee802_11
67} // namespace gr
68
69#endif /* INCLUDED_IEEE802_11_VITERBI_DECODER_BASE_H */
Definition utils.h:80
unsigned char d_mmresult[64]
Definition viterbi_decoder/base.h:44
int d_ntraceback
Definition viterbi_decoder/base.h:48
virtual uint8_t * decode(ofdm_param *ofdm, frame_param *frame, uint8_t *in)=0
int d_store_pos
Definition viterbi_decoder/base.h:42
static const unsigned char PUNCTURE_3_4[6]
Definition viterbi_decoder/base.h:60
static const unsigned char PUNCTURE_1_2[2]
Definition viterbi_decoder/base.h:58
frame_param * d_frame
Definition viterbi_decoder/base.h:51
static const unsigned char PARTAB[256]
Definition viterbi_decoder/base.h:57
static const unsigned char PUNCTURE_2_3[4]
Definition viterbi_decoder/base.h:59
int d_k
Definition viterbi_decoder/base.h:49
uint8_t * depuncture(uint8_t *in)
uint8_t d_decoded[MAX_ENCODED_BITS *3/4]
Definition viterbi_decoder/base.h:55
unsigned char d_ppresult[TRACEBACK_MAX][64]
Definition viterbi_decoder/base.h:46
ofdm_param * d_ofdm
Definition viterbi_decoder/base.h:50
const unsigned char * d_depuncture_pattern
Definition viterbi_decoder/base.h:52
uint8_t d_depunctured[MAX_ENCODED_BITS]
Definition viterbi_decoder/base.h:54
virtual void reset()=0
Definition utils.h:58
Definition chunks_to_symbols.h:24
Definition chunks_to_symbols.h:23
#define MAX_ENCODED_BITS
Definition utils.h:32
#define TRACEBACK_MAX
Definition viterbi_decoder/base.h:26