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

📄 amf_agcnmaxabs.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_AGCNMaxAbs.c#3 $ 
// Part of : VisualAudio V2.5.0 
// Updated : $Date: 2006/10/12 $ by $Author: Fernando $



#include "AMF_AGCNMaxAbs.h"
#include <math.h>

void AMF_AGCNMaxAbs_Render(AMF_AGCNMaxAbs * 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
SEG_MOD_FAST_CODE  void AMF_AGCNMaxAbs_Render(AMF_AGCNMaxAbs * restrict instance,float * restrict * buffers, int tickSize) {
    int numInputs = instance->b.inputPinCount;
    int i,k;
    float *out = buffers[numInputs];
    float *in;
    float abs;
#if 1
    in = buffers[0];
    // Could rewrite this so that aliasing is OK
    // but I suspect this formulation is faster.
    for (i=0; i<tickSize; i++) {
        out[i] = fabsf(in[i]);
    }
    for (k=1; k<numInputs; k++) {
        in = buffers[k];
        for (i=0; i<tickSize; i++) {
            abs = fabsf(in[i]);
            out[i] = fmaxf(out[i],abs);
        }
    }
#else
    // Alternative formulation that would allow aliasing:
    float val;
    for (i=0; i<tickSize; i++) {
        val = 0.0;
        for (k=0; k<numInputs; k++) {
            val = fmaxf(val,fabs(buffers[k][i]));
        }
        out[i] = val;
    }
#endif    
}
#endif

SEG_MOD_SLOW_CONST const AMF_ModuleVariableClass AMFClassAGCNMaxAbs = {
    AMFModuleClassFlag_VARIABLE_PIN_COUNT, // flags
    (AMF_RenderFunction)AMF_AGCNMaxAbs_Render,  // render function 
    (void *)0 // default bypass
};






⌨️ 快捷键说明

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