/* Viterbi decoder for arbitrary convolutional code * viterbi27 and viterbi37 for the r=1/2 and r=1/3 K=7 codes are faster * Copyright 1999 Phil Karn, KA9Q * May be used under the terms of the GNU Public License */ /** Modified by Ismael: code is variable instead of constant */ extern unsigned char Partab[]; /* Parity lookup table */ inline int parity(int x) { x ^= (x >> 16); x ^= (x >> 8); return Partab[x & 0xff]; } /* Convolutionally encode data into binary symbols */ encode( unsigned char *symbols, unsigned char *data, unsigned int nbytes, unsigned int startstate, unsigned int endstate, /** added by Ismael */ int N, int K, unsigned int *Polys) { int i,j; unsigned int encstate = startstate; while(nbytes-- != 0){ for(i=7;i>=0;i--){ encstate = (encstate << 1) | ((*data >> i) & 1); for(j=0;j=0;i--){ encstate = (encstate << 1) | ((endstate >> i) & 1); for(j=0;j