📄 channeldecoding.cpp
字号:
#include "global_var.h"
#include "typedef.h"
#include "globalMacro.h"
#include "dataDemodulation.h"
#include "ccDecoding.h"
#include "deInterleaving.h"
#include "deRandomization.h"
#include "rsErrPuncDecoding.h"
#include <fstream.h>
#include <iomanip.h>
/******************************************************
********************************************************/
void channelDecoding (DlRxBurstParam *pDlRxBurstParam,
Int16 *pDlRxBurstIn)
{
OfdmSymbolParam *pDlOfdmSymbolParam;
Uint8 modulationType;
Uint8 subChannelIndex;
// Uint16 randVector;
Uint16 rsParityBytes;
Uint16 rsDecodingOutLength;
Uint8 rsDecodeStatus;
Uint8 ccRate;
Uint16 ccDecodingOutLength;
Uint16 dataDemodOutLength;
Uint16 deModulatInLenth;
Uint16 Ncbps;
Uint8 Ncpc;
Int16 dataDemodOut[1152];
int i;
PilotParam *pilot;
pilot = &g_dlRxPilotParam;
subChannelIndex = (*pDlRxBurstParam).subChannelIndex;
rsDecodeStatus = (*pDlRxBurstParam).rsDecErrStatus;
deModulatInLenth = PREAMBLE_FREQ_FULL_SIZE;
ofstream out;
if ((*pDlRxBurstParam).subChannelIndex == 16)
{
if ((*pDlRxBurstParam).burstIndex == 0
||(*pDlRxBurstParam).burstIndex == g_dlTxStcStartTime.Burst)
{
pDlOfdmSymbolParam = &g_ssDlFchOfdmSymbolParam;
rsDecodingOutLength = (*pDlOfdmSymbolParam).uncodedBlockSize;
rsParityBytes = (*pDlOfdmSymbolParam).rsParityBytes;
ccDecodingOutLength = rsDecodingOutLength + rsParityBytes;
ccRate = (*pDlOfdmSymbolParam).ccRate;
dataDemodOutLength = 8 * (*pDlOfdmSymbolParam).codedBlockSize;
Ncbps = 16 * (*pDlOfdmSymbolParam).ncbpss;
Ncpc = (*pDlOfdmSymbolParam).ncpc;
modulationType = (*pDlOfdmSymbolParam).modulation;
}
else
{
if ((*pDlRxBurstParam).burstIndex == 1
||(*pDlRxBurstParam).burstIndex == (g_dlRxStcStartTime.Burst + 1))
{
pDlOfdmSymbolParam = g_ssDlFirstBurstOfdmSymbolParam;
rsDecodingOutLength = pDlOfdmSymbolParam[(*pDlRxBurstParam).rateId].uncodedBlockSize;
rsParityBytes = pDlOfdmSymbolParam[(*pDlRxBurstParam).rateId].rsParityBytes;
ccDecodingOutLength = rsDecodingOutLength + rsParityBytes;
ccRate = pDlOfdmSymbolParam[(*pDlRxBurstParam).rateId].ccRate;
dataDemodOutLength = 8 * pDlOfdmSymbolParam[(*pDlRxBurstParam).rateId].codedBlockSize;
Ncbps = 16 * pDlOfdmSymbolParam[(*pDlRxBurstParam).rateId].ncbpss;
Ncpc = pDlOfdmSymbolParam[(*pDlRxBurstParam).rateId].ncpc;
modulationType = pDlOfdmSymbolParam[(*pDlRxBurstParam).rateId].modulation;
}
else
{
pDlOfdmSymbolParam = g_ssDlOfdmSymbolParam;
rsDecodingOutLength = pDlOfdmSymbolParam[(*pDlRxBurstParam).diuc].uncodedBlockSize;
rsParityBytes = pDlOfdmSymbolParam[(*pDlRxBurstParam).diuc].rsParityBytes;
ccDecodingOutLength = rsDecodingOutLength + rsParityBytes;
ccRate = pDlOfdmSymbolParam[(*pDlRxBurstParam).diuc].ccRate;
dataDemodOutLength = 8 * pDlOfdmSymbolParam[(*pDlRxBurstParam).diuc].codedBlockSize;
Ncbps = 16 * pDlOfdmSymbolParam[(*pDlRxBurstParam).diuc].ncbpss;
Ncpc = pDlOfdmSymbolParam[(*pDlRxBurstParam).diuc].ncpc;
modulationType = pDlOfdmSymbolParam[(*pDlRxBurstParam).diuc].modulation;
}
}
dataDemodulation (pDlRxBurstIn,
deModulatInLenth,
g_dlRxSoftDecBits,
modulationType,
g_dlRxDataDemodOutBuff,
dataDemodOutLength);
// deInterleaving
/*
out.open("temp\\datademodoutsoft.txt",ios::app);
for (i = 0; i < dataDemodOutLength; i++)
{
out << setw(8) << (Int16)g_dlRxDataDemodOutBuff[i];
}
out.close();
*/
out.open("temp\\datademodout.txt",ios::app);
for (i = 0; i < dataDemodOutLength; i++)
{
if (g_dlRxDataDemodOutBuff[i] >= 0)
{
dataDemodOut[i] = 0;
}
else
{
dataDemodOut[i] = 1;
}
out << setw(8) << (Int16)dataDemodOut[i];
}
out.close();
deInterleaving (g_dlRxDataDemodOutBuff,
Ncbps,
Ncpc,
g_dlRxDeinterleaveOutBuff);
// rs_cc decoding
ccDecoding (0,
pDlRxBurstParam,
g_dlRxDeinterleaveOutBuff,
dataDemodOutLength,
ccRate,
g_dlRxCcDecodeOutBuff,
ccDecodingOutLength);
rsErrPuncDecoding (g_dlRxCcDecodeOutBuff,
ccDecodingOutLength,
rsParityBytes,
g_dlRxRsDecodeOutBuff,
rsDecodingOutLength,
rsDecodeStatus);
if ((*pDlRxBurstParam).ofdmSymIndex == (*pDlRxBurstParam).burstSizeSym - 1)
{
derandomization (0,
pDlRxBurstParam,
g_dlRxBurstIndex,
g_dlRxRsDecodeOutBuff,
rsDecodingOutLength - 1,
&g_dlRxRandVector,
g_dlRxDeRandOutBuff);
g_dlRxDeRandOutBuff[rsDecodingOutLength-1] = 0;
}
else
{
derandomization (0,
pDlRxBurstParam,
g_dlRxBurstIndex,
g_dlRxRsDecodeOutBuff,
rsDecodingOutLength,
&g_dlRxRandVector,
g_dlRxDeRandOutBuff);
}
/*
out.open("temp\\putout.txt",ios::app);
for (i = 0; i < rsDecodingOutLength; i++)
{
out << setw(8) << (Int16)g_dlRxDeRandOutBuff[i];
if ((i + 1) % 8 == 0)
{
out << endl;
}
}
//out << endl;
out.close();
*/
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -