text2babu
Member level 3
Hello friends, here is the code of convolutional encoding and decoding, convolutional encoding is simple enough, but the logic in decoding is not understandable. can u tell me what logic is he putting here.
convolutional encoder:
UINT16 SR = 0;
UINT16 uPoly1 = 11001;
UINT16 uPoly2 = 11011;
UINT8 ucDataMask = 0x01;
INT i;
for (i = 0 ; i < iBitCount ; i++)
{
SR <<= 1;
SR |= (*puc8PackedData & ucDataMask) ? 1 : 0;
pucUnpackedOutput[*piImTable++] = Xor8((UINT8)(SR & uPoly1));
pucUnpackedOutput[*piImTable++] = Xor8((UINT8)(SR & uPoly2));
ucDataMask<<=1;
if (!ucDataMask)
ucDataMask = 0x01, puc8PackedData++;
}
Convolutional decoder:
uPoly1 >>= 1;
uPoly2 >>= 1; //why these two polynomials have been shifted which is not shifted in encoder
for (i = 0 ; i < iOutputBitCount ; i++)
{
bit1 = pucUnpackedInput;
bit1 ^= Xor8((UINT8)(SR & uPoly1)) ? 1 : 0;
bit2 = pucUnpackedInput;
bit2 ^= Xor8((UINT8)(SR & uPoly2)) ? 1 : 0;
if (bit1 != bit2) iErrors++;
SR <<= 1;
if (bit1) // Write bit to packed output and SR
{
*puc8PackedOutput |= ucDataMask;
SR |= 0x01;
}
// move output byte/bit pointer
ucDataMask <<= 1;
if (!ucDataMask) ucDataMask = 0x01, puc8PackedOutput++;
}
what is the logic behind this decoder, can anybody draw the sequential diagram with xor gates and tell me.
convolutional encoder:
UINT16 SR = 0;
UINT16 uPoly1 = 11001;
UINT16 uPoly2 = 11011;
UINT8 ucDataMask = 0x01;
INT i;
for (i = 0 ; i < iBitCount ; i++)
{
SR <<= 1;
SR |= (*puc8PackedData & ucDataMask) ? 1 : 0;
pucUnpackedOutput[*piImTable++] = Xor8((UINT8)(SR & uPoly1));
pucUnpackedOutput[*piImTable++] = Xor8((UINT8)(SR & uPoly2));
ucDataMask<<=1;
if (!ucDataMask)
ucDataMask = 0x01, puc8PackedData++;
}
Convolutional decoder:
uPoly1 >>= 1;
uPoly2 >>= 1; //why these two polynomials have been shifted which is not shifted in encoder
for (i = 0 ; i < iOutputBitCount ; i++)
{
bit1 = pucUnpackedInput;
bit1 ^= Xor8((UINT8)(SR & uPoly1)) ? 1 : 0;
bit2 = pucUnpackedInput;
bit2 ^= Xor8((UINT8)(SR & uPoly2)) ? 1 : 0;
if (bit1 != bit2) iErrors++;
SR <<= 1;
if (bit1) // Write bit to packed output and SR
{
*puc8PackedOutput |= ucDataMask;
SR |= 0x01;
}
// move output byte/bit pointer
ucDataMask <<= 1;
if (!ucDataMask) ucDataMask = 0x01, puc8PackedOutput++;
}
what is the logic behind this decoder, can anybody draw the sequential diagram with xor gates and tell me.