📄 viterbi23.h
字号:
/* Viterbi decorder for convolution code [2 1 3] HEADER Code rate 1/2 constrained len(K) 3 Use hard decision jinle@2008.2.29*/#ifndef _VITERBI_213_H_#define _VITERBI_213_H_//#define VITERBI_DEBUG#define KL 3 //constrained len#define STATE_NUM 4 //(2^(KL-1)) number of states#define PATH_DEPTH 5 //Path depth#define MAX_COLUMN PATH_DEPTH+1 //5 path need 6 grid#ifndef TRUE #define TRUE 0#endif#ifndef FALSE #define FALSE 1#endif#define UPPER 0 //upper path#define LOWER 1 //lower path#define NOT_VALID -1//As we know when K=3, all state for decoding is 2^(K-1) = 4//So we define below structures stand for each grid, and total statestypedef struct Grid{ unsigned char acc_metric; //accumulated metric unsigned char lastgrid; //last_grid}Grid;//Viterbi decorder handlertypedef struct ViterbiDec{ Grid grids[MAX_COLUMN][STATE_NUM]; unsigned char column_pointer; _Bool beInited;}ViterbiDec;//Stand for 4 grid in same row's output data in encoder//both upper and lower pathunsigned char Viterbi23_output_table[4][2] ={ {0, 3}, {2, 1}, {3, 0}, {1, 2},};//Stand for 4 grid in same row's last state number//both upper and lower pathunsigned char Viterbi23_last_state_table[4][2] ={ {0, 1}, {2, 3}, {0, 1}, {2, 3},};//[From][to][value] -1 stand for invalidchar Viterbi23_path2value[4][4] = { {0, -1, 1, -1}, //Form 0 to 0,1,2,3 {0, -1, 1, -1}, //Form 1 to 0,1,2,3 {-1, 0, -1, 1}, //Form 2 to 0,1,2,3 {-1, 0, -1, 1}, //Form 3 to 0,1,2,3};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -