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

📄 filter.h

📁 DSP 5416 有限冲击响应滤波器( FIR )算法
💻 H
字号:
/******************************************************************************/
/*  Copyright 2006 by SEED Electronic Technology LTD.                         */
/*  All rights reserved. SEED Electronic Technology LTD.                      */
/*  Restricted rights to use, duplicate or disclose this code are             */
/*  granted through contract.                                                 */
/******************************************************************************/


/******************************************************************************/
/*  Tiltle:filter.h                                                           */
/*  Platform:TMS320C5416                                                      */
/*  Author:Marine@seeddsp.com                                                 */
/*  Purpose:filter coeffients and function prototype definations              */
/*  Version:1.0   Dec25,2006   Marine@seeddsp.com                             */
/*  Rivision:                                                                 */
/******************************************************************************/



/*********************************************************************************

//FIR defination

*********************************************************************************/

#define ORDER_FIR 51
#define ROUND_FIR 16

//FIR inverse coeffecient h(50)~h(0),order 50


//Fp=500 Ft=1000

short hfir[]={
            -4050,2630,2046,1689,1471,1354,1306,1298,1321,1359,
            1413,1472,1537,1600,1663,1721,1779,1831,1880,1921,
            1958,1988,2013,2030,2041,2044,2041,2030,2013,1988,
            1958,1921,1880,1831,1779,1721,1663,1600,1537,1472,
            1413,1359,1321,1298,1306,1354,1471,1689,2046,2630,
            -4050 };


void fir_filter(const short x[],const short h[],short y[],int n,int m,int s); 
/*********************************************************************************

//IIR defination

*********************************************************************************/

//IIR coeffectient DirectForm II second order
            
#define ORDER_IIR 3
#define ROUND_IIR 16

//SOS
//b01 b11 b21 1 a11 a21
//b02 b12 b22 1 a12 a22
//b03 b13 b23 1 a13 a23

//        b0k+b1k*z(-1)+b2k*z(-2) 
//H(z)=g-------------------------
//         1+a1k*z(-1)+a2k*z(-2) 
/*
short SOS[]={1024, 2048, 1024, 1024, -1951, 944,
             1024, 2048, 1024, 1024, -1836, 828,
             1024, 1024, 0   , 1024, -898,  0};
*/

//Now that SOS0[6*i+3]==1
//and after left shift 10 bits SOS[6*i+3]==1024
//so for convenience of algorithm,no division needed
//set SOSr[6*i+3]=10

short SOSr[]={1024, 2048, 1024, 10, -1951, 944,
             1024, 2048, 1024, 10, -1836, 828,
             1024, 1024, 0   , 10, -898,  0};
                         
short G[]={269,253,4031};



void iir_filter(const short x[],const short sos[],const short g[],
                short y[],int m,int s);



/*********************************************************************************

//End of file

*********************************************************************************/

⌨️ 快捷键说明

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