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

📄 qpsk.c

📁 详细的OFDM设计过程
💻 C
字号:
#define LEN 	128
#define LENFFT 	127
#define LENFFT2 124


void qpsk(float *output, unsigned int *input)
{
	const short im_p4[] = {-1, 1, 1, 1, -1, -1, 1, -1};
	
	short i, tmp=0;	// The tmp is the index number which defines the value of the bits defined by b. 
	short b2=0;		// which int[x] from input should be used.
	short b3=0;		// which bit in the int is our first bit to consider.
					// '0' indicates the first int.
					// '0' indicates the first bit of an int. 
	for(i=0; i<LEN; i++){
		
		tmp = (input[b2]&(0x03 << b3)) >> b3;		// get the 2 bits and shift to become a correct index
		output[i*2] = im_p4[tmp*2];
		output[i*2+1] = im_p4[tmp*2+1];
		
		b3 +=2;
		if(b3==32){
			
			b3=0;
			b2++;
		}
	}
}

void qpskfft(float *output, unsigned int *input, short index)
{
	const short im_p4[8] = {-1, 1, 1, 1, -1, -1, 1, -1};
	
	short i, tmp;		//The tmp is the index number which defines the value of the bits defined by b. 
						// '0' indicates the first int.
						// '0' indicates the first bit of an int. 
	short b2=0;			//which int[x] from input should be used.
	short b3=index; 	// which bit in the int is our first bit to consider.


		
	for(i=0; i<LENFFT; i++){
		
		tmp = (input[b2]&(0x03 << b3)) >> b3;		// get the 2 bits and shift to become a correct index
		output[i*2] = im_p4[tmp*2];
		output[i*2+1] = im_p4[tmp*2+1];
		
		b3 +=2;
		if(b3==32){
			
			b3=0;
			b2++;
		}
	}
	
}

void qpskfft2(float *output, unsigned int *input, short index)
{
	const short im_p4[8] = {-1, 1, 1, 1, -1, -1, 1, -1};
	
	short i, tmp;		//The tmp is the index number which defines the value of the bits defined by b. 
						// '0' indicates the first int.
						// '0' indicates the first bit of an int. 
	short b2=0;			//which int[x] from input should be used.
	short b3=index; 	// which bit in the int is our first bit to consider.


		
	for(i=0; i<LENFFT2; i++){
		
		tmp = (input[b2]&(0x03 << b3)) >> b3;		// get the 2 bits and shift to become a correct index
		output[i*2] = im_p4[tmp*2];
		output[i*2+1] = im_p4[tmp*2+1];
		
		b3 +=2;
		if(b3==32){
			
			b3=0;
			b2++;
		}
	}
	
}

⌨️ 快捷键说明

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