📄 fixpoint_leaky_lmstest.c
字号:
//
// Project: Experiment 10.7.3 AEC using C55x Intrinsics - Chapter 10
// File name: fixPoint_leaky_lmsTest.c
//
// Description: This is the fixed-point leaky LMS experiment's test program
//
// For the book "Real Time Digital Signal Processing:
// Implementation and Application, 2nd Ed"
// By Sen M. Kuo, Bob H. Lee, and Wenshun Tian
// Publisher: John Wiley and Sons, Ltd
//
// Tools used: CCS v.2.12.07
// TMS320VC5510 DSK Rev-C
//
#include <stdio.h>
#include <stdlib.h>
#include "fixPoint_leaky_lms.h"
LMS lmsObj;
LMS *lms = &lmsObj;
DTALK dtObj;
DTALK *dt = &dtObj;
short w[L+1];
short x[L+1];
void main()
{
short i;
FILE *fpIn,*fpDes,*fpErr;
char temp1[2],temp2[2];
// Open input file for read input data
if ((fpIn = fopen("..\\data\\rtfar.pcm", "rb"))== NULL)
{
printf("Can't open input data file\n");
exit(0);
}
// Open desired file for read desired input data
if ((fpDes = fopen("..\\data\\rtmic.pcm", "rb"))== NULL)
{
printf("Can't open desired data file\n");
exit(0);
}
// Open file for write output
fpErr = fopen("..\\data\\aecout.pcm", "wb");
aec_init(lms,dt);
// Clear data and tap delay lines
lms->w = w;
lms->x = x;
for (i=0; i<=lms->order; i++)
{
lms->w[i] = 0;
lms->x[i] = 0;
}
// Filter test
while ((fread(temp1, sizeof(char), 2, fpIn) == 2)&&
(fread(temp2, sizeof(char), 2, fpDes)== 2) )
{
// Get 16-bit PCM input and desired data
lms->in = (temp1[0]&0xFF)|(temp1[1]<<8);
lms->des = (temp2[0]&0xFF)|(temp2[1]<<8);
// Double_talk detector
fixPoint_double_talk(dt,lms);
// Filter the data
fixPoint_leaky_lms(dt,lms);
// Non linear processing
fixPoint_nlp(dt,lms);
// Write the output and error data to 16-bit PCM
temp2[0] = (lms->err&0xFF);
temp2[1] = (lms->err>>8)&0xFF;
fwrite(temp2, sizeof(char), 2, fpErr);
}
fclose(fpIn);
fclose(fpDes);
fclose(fpErr);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -