40 int traceBack (
int * out,
int * m_pathMemory0,
int * m_pathMemory1,
int * m_pathMemory2,
int * m_pathMemory3) {
41 enum FEC_STATE { S0, S1, S2, S3 } state;
47 for (loop=329; loop >= 0; loop--, length++) {
51 if (m_pathMemory0[loop]) {
60 if (m_pathMemory1[loop]) {
69 if (m_pathMemory2[loop]) {
78 if (m_pathMemory3[loop]) {
96 void viterbiDecode (
int n,
int *data,
int *m_pathMemory0,
int *m_pathMemory1,
int *m_pathMemory2,
int *m_pathMemory3,
int *m_pathMetric) {
104 metric[0]=(data[1]^0)+(data[0]^0);
105 metric[1]=(data[1]^1)+(data[0]^1);
106 metric[2]=(data[1]^1)+(data[0]^0);
107 metric[3]=(data[1]^0)+(data[0]^1);
108 metric[4]=(data[1]^1)+(data[0]^1);
109 metric[5]=(data[1]^0)+(data[0]^0);
110 metric[6]=(data[1]^0)+(data[0]^1);
111 metric[7]=(data[1]^1)+(data[0]^0);
114 m1=metric[0]+m_pathMetric[0];
115 m2=metric[4]+m_pathMetric[2];
125 m1=metric[1]+m_pathMetric[0];
126 m2=metric[5]+m_pathMetric[2];
136 m1=metric[2]+m_pathMetric[1];
137 m2=metric[6]+m_pathMetric[3];
147 m1=metric[3]+m_pathMetric[1];
148 m2=metric[7]+m_pathMetric[3];
157 for (loop=0;loop<4;loop++) {
158 m_pathMetric[loop]=tempMetric[loop];
169 int m_pathMemory0[330];
170 int m_pathMemory1[330];
171 int m_pathMemory2[330];
172 int m_pathMemory3[330];
179 memset(m_pathMemory0,0,330*
sizeof(
int));
180 memset(m_pathMemory1,0,330*
sizeof(
int));
181 memset(m_pathMemory2,0,330*
sizeof(
int));
182 memset(m_pathMemory3,0,330*
sizeof(
int));
184 for (loop=0;loop<4;loop++) {
185 m_pathMetric[loop]=0;
189 for (loop2=0;loop2<660;loop2+=2, n++) {
204 viterbiDecode(n, data, m_pathMemory0, m_pathMemory1, m_pathMemory2, m_pathMemory3, m_pathMetric);
207 outLen=
traceBack(out, m_pathMemory0, m_path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270 1,0,1,0,0,1,1,1,0,0,1,1,1,1,0,1,1,0,1,0,0,0,0,1,0,1,0,1,0,1,1,1,
271 1,1,0,1,0,0,1,0,1,0,0,0,1,1,0,1,1,1,0,0,0,1,1,1,1,1,1,1,0,0,0,0,
272 1,1,1,0,1,1,1,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,
273 0,1,1,0,0,0,1,0,1,1,1,0,1,0,1,1,0,1,1,0,0,0,0,0,1,1,0,0,1,1,0,1,
274 0,1,0,0,1,1,1,0,0,1,1,1,1,0,1,1,0,1,0,0,0,0,1,0,1,0,1,0,1,1,1,1,
275 1,0,1,0,0,1,0,1,0,0,0,1,1,0,1,1,1,0,0,0,1,1,1,1,1,1,1,0,0,0,0,1,
276 1,1,0,1,1,1,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,
277 1,1,0,0,0,1,0,1,1,1,0,1,0,1,1,0,1,1,0,0,0,0,0,1,1,0,0,1,1,0,1,0,
278 1,0,0,1,1,1,0,0,1,1,1,1,0,1,1,0};
280 const int SCRAMBLER_TABLE_BITS_LENGTH=720;
286 for (loop=0; loop < 660; loop++) {
287 out[loop] = in[loop] ^ SCRAMBLER_TABLE_BITS[m_count++];
289 if (m_count >= SCRAMBLER_TABLE_BITS_LENGTH) {
int FECdecoder(int *in, int *out)
Definition: descramble.h:166
void scramble(int *in, int *out)
function scramble
Definition: descramble.h:253
int traceBack(int *out, int *m_pathMemory0, int *m_pathMemory1, int *m_pathMemory2, int *m_pathMemory3)
Definition: descramble.h:40
void viterbiDecode(int n, int *data, int *m_pathMemory0, int *m_pathMemory1, int *m_pathMemory2, int *m_pathMemory3, int *m_pathMetric)
Definition: descramble.h:96
void deinterleave(int *in, int *out)
Definition: descramble.h:226