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

📄 t_fir_interp_spl.c

📁 blackfin 533 DSP上优化的多速率数字滤波程序源码。
💻 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      : fir_interp_spl.c
Description    : This modules tests the fir_interp_spl function.
*******************************************************************************/
#include"mds_def.h"
#include "tfir.h"

void (*f1)();
int cycle_count[10];
int error_flag = 0;

extern void _fir_interp_spl(const fract16 *in, fract16 *out, int Ninp,
fract16 *h, int L, int M, int LBYM, fract16 *d);

void main()
{          
    fract16 outputmag;
    fract32 accout;
    int nsamples,error;
    int i;
  
    f1 = _fir_interp_spl;
    nsamples=256;  // No: of inputs


//Test : Low pass Test, polyphase filter length L%4=0
//Description: Input data is read from the header file and consists of 
//sinusoidal signal whose normalised frequency = 0.1,the signal amplitude = 1/4,
//Stored number of samples = 260, Filter cutoff = 0.3 (normalised)
        
    outputmag = 0;    // Clear to accumlate filtered output power 

    for (i = 0; i < 16; i++)
    {
        d[i] = 0;
    }

    for (i = 0; i < nsamples; i++)
    {
      in[i] = FIRINPUT1[i]>> 2;            
    }

// For testing purposes testa and testb are used
// Testa finds interpolated filter output for Ni/2 samples and dslay line gts 
// updated.
// Testb finds interpolated filter output for the next Ni/2 samples with the 
// delay line previously updated by testa.

    cycle_count[0] = Compute_Cycle_Count(in, out,nsamples/2, h, 16, 2, 8, d);
                            //This function inturn calls fir_interp_spl()
                                                    // Testa

    cycle_count[1] = Compute_Cycle_Count(&in[nsamples/2], &out[nsamples],
                                            nsamples/2, h, 16, 2, 8, d);
                            //This function inturn calls fir_interp_spl()
                                                    // Testb

    accout = 0;
    for (i = 0; i < 512; i++)
    {
        accout += out[i] * out[i];
    }

    outputmag = accout>> NBITS1;

    error = outputmag - thresh;

    if(error<0) error = -error;    
 
    if(error > MAX_PERMISSIBLE_ERROR)  
    {
        error_flag = error_flag | 1;
    }

    #ifdef PRINTF_SUPPORT
        if(error_flag & 1)
            printf("Test Case failed\n");
        else
            printf("Test Case passed\n");
    #endif
    printf("cycle_count[0]=%d,cycle_count[1]=%d\n",cycle_count[0],cycle_count[1]);
    
}

⌨️ 快捷键说明

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