⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stcdecodeing.cpp

📁 在vc上做的802.16d ofdm phy的仿真
💻 CPP
字号:
#include "typedef.h"
#include "stcDecodeing.h"


void stcDecodeing (Uint8 stcFlag,
				   Int16 *pStcDecodeIn,
				   Uint16 stcDecodeInLength, //2*201
				   ChannelEstResult *pPreambleChEstRes,
				   Int16 *pStcDecodeOut)
{
	Int16 modChannel0;
	Int16 modChannel1;
	Int16 compTap[4];
	Int16 bitWidth = 11;//(averagebitwidth-1)
	int i;	
	for (i = 0; i < stcDecodeInLength / 2; i++)
	{		
		if (i == 100)
		{
			compTap[0] = 0;
			compTap[1] = 0;
			compTap[2] = 0;
			compTap[3] = 0;
		
		}
		else
		{
			modChannel0 = (pPreambleChEstRes[0].ChEstOut[2*i] * pPreambleChEstRes[0].ChEstOut[2*i]
						+ pPreambleChEstRes[0].ChEstOut[2*i+1] * pPreambleChEstRes[0].ChEstOut[2*i+1]) 
						>> bitWidth;
			modChannel1 = (pPreambleChEstRes[1].ChEstOut[2*i] * pPreambleChEstRes[1].ChEstOut[2*i]
						+ pPreambleChEstRes[1].ChEstOut[2*i+1] * pPreambleChEstRes[1].ChEstOut[2*i+1]) 
						>> bitWidth;
						
			compTap[0] = (pPreambleChEstRes[0].ChEstOut[2*i] << bitWidth) 
							/ (modChannel0 + modChannel1);
			compTap[1] = (pPreambleChEstRes[0].ChEstOut[2*i+1] << bitWidth) 
							/ (modChannel0 + modChannel1);
						
			compTap[2] = (pPreambleChEstRes[1].ChEstOut[2*i] << bitWidth) 
							/ (modChannel0 + modChannel1);
			compTap[3] = (pPreambleChEstRes[1].ChEstOut[2*i+1] << bitWidth) 
							/ (modChannel0 + modChannel1);
		}
		
		pStcDecodeOut[2*i] = (pStcDecodeIn[2*i] * compTap[0] 
						  + pStcDecodeIn[2*i+1] * compTap[1]
						  + pStcDecodeIn[2*i+402] * compTap[2]
						  + pStcDecodeIn[2*i+403] * compTap[3]) >> bitWidth;
							  
		pStcDecodeOut[2*i+1] = (pStcDecodeIn[2*i+1] * compTap[0]
						  - pStcDecodeIn[2*i] * compTap[1]
						  -	pStcDecodeIn[2*i+403] * compTap[2]
						  + pStcDecodeIn[2*i+402] * compTap[3]) >> bitWidth;
							  
		pStcDecodeOut[2*i+402] = (pStcDecodeIn[2*i] * compTap[2] 
						  + pStcDecodeIn[2*i+1] * compTap[3]
						  - pStcDecodeIn[2*i+402] * compTap[0]
						  - pStcDecodeIn[2*i+403] * compTap[1]) >> bitWidth;
							  
		pStcDecodeOut[2*i+403] = (pStcDecodeIn[2*i+1] * compTap[2]
						  - pStcDecodeIn[2*i] * compTap[3]
						  +	pStcDecodeIn[2*i+403] * compTap[0]
						  - pStcDecodeIn[2*i+402] * compTap[1]) >> bitWidth;
	}
	//stc decode and 去处信道响应
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -