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

📄 amf_biquad.c

📁 ADI SHARC DSP 音频算法标准模块库
💻 C
字号:
// Copyright(c) 2005 Analog Devices, Inc. All Rights Reserved.
// This software is proprietary and confidential to Analog Devices, Inc. and its licensors.

// File    : $Id: //depot/development/visualaudio/modules/2.5.0/SHARC/Source/AMF_Biquad.c#3 $ 
// Part of : VisualAudio V2.5.0 
// Updated : $Date: 2006/10/12 $ by $Author: Fernando $



#include "AMF_Biquad.h"
#include "VA_GeneralHelperFunctions.h"

// N-order Biquad filter

void AMF_Biquad_Render(AMF_Biquad * restrict instance,float * restrict * buffers,int tickSize);

// NOTE: The C version of this function is for reference only (it is
//       intended just to show the general algorithm that the module
//       uses), and it may not have been fully tested
#if 0        // Example C code.

SEG_MOD_FAST_CODE  void AMF_Biquad_Render(AMF_Biquad * restrict instance,float * restrict * buffers,int tickSize) {
    int i;
    float *state = &instance->state[0];        // state buffer
    float pm *coefs = &instance->coefs[0];        // filter coefs
    float tmp;
    float *in = buffers[0]; // Don't use restrict because we say they can alias (see .h file)
    float *out = buffers[1];
    float d1,d2,n0,n1,n2,s1,s2;
    int ind1, ind2;
    
    d1 = coefs[0];
    d2 = coefs[1];
    n0 = coefs[2];
    n1 = coefs[3];
    n2 = coefs[4];
    ind1 = 1; // should work if ticksize is always even...
    ind2 = 0;

    // DF2
    for (i=0; i<tickSize; i++) {
        tmp = in[i] + d1 * state[ind1] + d2 * state[ind2];    
        out[i] = n0 * tmp + n1 * state[ind1] + n2 * state[ind2];        
        state[ind2] = tmp;
        // ind1 = (ind1 + 1) % 2; // circular-buffer pointer manipulation
        // ind2 = (ind2 + 1) % 2; // circular-buffer pointer manipulation
        ind1 ^= 1; // circular-buffer pointer manipulation
        ind2 ^= 1; // circular-buffer pointer manipulation
    }
}
#endif

SEG_MOD_SLOW_CONST const AMF_ModuleClass AMFClassBiquad = {
    
    /* Flags */
    0,
     
    /* Render function */
    (AMF_RenderFunction)AMF_Biquad_Render,  // render function 
    
    /* Default bypass */
    (void *)0,
    
    /* Input descriptor - 1 input, and it is mono. */
    1, 0,

    /* Output descriptor - 1 output, and it is mono. */
    1, 0,
};


⌨️ 快捷键说明

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