fun_ofdm
1.0
802.11a Physical Layer for USRP
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Enumerations
Enumerator
Macros
Pages
viterbi.h
Go to the documentation of this file.
1
8
#ifndef VITERBI_H
9
#define VITERBI_H
10
11
#pragma once
12
13
#include <vector>
14
#include <stdlib.h>
15
#include <math.h>
16
#include <memory.h>
17
18
#include <pmmintrin.h>
19
#include <emmintrin.h>
20
#include <xmmintrin.h>
21
#include <mmintrin.h>
22
23
#define K 7
24
#define RATE 2
25
#define POLYS { 121, 91 }
26
#define NUMSTATES 64
27
#define DECISIONTYPE unsigned char
28
#define DECISIONTYPE_BITSIZE 8
29
#define COMPUTETYPE unsigned char
30
31
namespace
fun
32
{
33
//decision_t is a BIT vector
34
36
typedef
union
{
37
DECISIONTYPE
t[
NUMSTATES
/
DECISIONTYPE_BITSIZE
];
38
unsigned
int
w[
NUMSTATES
/32];
39
unsigned
short
s[
NUMSTATES
/16];
40
unsigned
char
c[
NUMSTATES
/8];
41
}
decision_t
__attribute__ ((aligned (16)));
42
44
typedef
union
{
45
COMPUTETYPE
t[
NUMSTATES
];
46
}
metric_t
__attribute__ ((aligned (16)));
47
53
struct
v
{
54
__attribute__
((aligned (16)))
metric_t
metrics1;
/* path metric buffer 1 */
55
__attribute__
((aligned (16)))
metric_t
metrics2;
/* path metric buffer 2 */
56
metric_t
*
old_metrics
,*
new_metrics
;
/* Pointers to path metrics, swapped on every bit */
57
decision_t
*
decisions
;
/* decisions */
58
void (*
update_blk
)(
struct
v
*vp,
const
COMPUTETYPE
*syms,
int
nbits);
59
};
60
64
class
viterbi
65
{
66
private
:
67
68
COMPUTETYPE
Branchtab[
NUMSTATES
/2*
RATE
]
__attribute__
((aligned (16)));
69
70
void
viterbi_chainback
(
struct
v
*vp,
71
unsigned
char
*data,
/* Decoded output data */
72
unsigned
int
nbits,
/* Number of data bits */
73
unsigned
int
endstate) ;
74
75
void
FULL_SPIRAL
(
int
nbits,
unsigned
char
*Y,
unsigned
char
*X,
const
unsigned
char
*syms,
unsigned
char
*dec,
unsigned
char
*Branchtab);
76
81
struct
v
*
viterbi_alloc
(
int
len);
82
87
void
viterbi_free
(
struct
v
*vp);
88
94
void
viterbi_init
(
struct
v
*vp,
int
starting_state);
95
105
void
viterbi_decode
(
struct
v
*vp,
const
COMPUTETYPE
*symbols,
unsigned
char
*data,
int
nbits);
106
108
void
viterbi_update_blk_SPIRAL
(
struct
v
*vp,
const
COMPUTETYPE
*syms,
int
nbits);
109
//void viterbi_spiral(struct v *vp);
110
111
public
:
112
119
void
conv_decode
(
unsigned
char
* symbols,
unsigned
char
* data,
int
data_bits);
120
127
void
conv_encode
(
unsigned
char
* data,
unsigned
char
* symbols,
int
data_bits);
128
};
129
130
}
131
132
133
#endif // VITERBI_H
src
viterbi.h
Generated on Mon Oct 20 2014 10:26:27 for fun_ofdm by
1.8.4