📄 tlevinson.c
字号:
/*******************************************************************************
Copyright(c) 2000 - 2002 Analog Devices. All Rights Reserved.
Developed by Joint Development Software Application Team, IPDC, Bangalore, India
for Blackfin DSPs ( Micro Signal Architecture 1.0 specification).
By using this module you agree to the terms of the Analog Devices License
Agreement for DSP Software.
********************************************************************************
File Name : tlevinson.c
Description : This modules tests the Levinson-Durbin Algorithm in
levinson.asm. o/p lpc coefficients are in 4.12 format
Function used is fract32 _levinson(fract32 *PtrAutoCorr,
fract16 *PtrLpcCoeff, fract16 *PtrReflCoeff)
*******************************************************************************/
#include <stdio.h>
#include "ldvalues.h"
int error_flag = 0;
void (*f1)();
int cycle_count[10];
void _levinson();
main()
{
int i,error;
f1 = _levinson;
/* Test1 begins here */
cycle_count[0] = Compute_Cycle_Count(AutoCorr1, PtrLpcCalcd, PtrReflCoeff);
//This function inturn calls levinson()
for(i=0;i<FiltOrd+1;i++)
{
error=LpcExpd1[i]- PtrLpcCalcd[i];
if(error < 0)
error = -error;
if(error > MAX_PERMISSIBLE_ERROR)
{
error_flag = error_flag | 1;
break;
}
}
/* Test2 begins here */
cycle_count[1] = Compute_Cycle_Count(AutoCorr2, PtrLpcCalcd, PtrReflCoeff);
for(i=0;i<FiltOrd+1;i++)
{
error=(LpcExpd2[i]- PtrLpcCalcd[i]);
if(error < 0)
error = -error;
if(error > MAX_PERMISSIBLE_ERROR)
{
error_flag = error_flag | 2;
break;
}
}
/* Test3 begins here */
cycle_count[2] = Compute_Cycle_Count(AutoCorr3, PtrLpcCalcd, PtrReflCoeff);
for(i=0;i<FiltOrd+1;i++)
{
error=(LpcExpd3[i]- PtrLpcCalcd[i]);
if(error < 0)
error = -error;
if(error > MAX_PERMISSIBLE_ERROR)
{
error_flag = error_flag | 4;
break;
}
}
#ifdef PRINTF_SUPPORT
if(error_flag & 1)
printf("Test Case 1 failed\n");
else
printf("Test Case 1 passed\n");
if(error_flag & 2)
printf("Test Case 2 failed\n");
else
printf("Test Case 2 passed\n");
if(error_flag & 4)
printf("Test Case 3 failed\n");
else
printf("Test Case 3 passed\n");
#endif
printf("cycle_count[0]=%d,cycle_count[1]=%d,cycle_count[2]=%d\n",cycle_count[0],cycle_count[1],cycle_count[2]);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -