📄 amf_agcnmaxabs_s.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_S.c#3 $
// Part of : VisualAudio V2.5.0
// Updated : $Date: 2006/10/12 $ by $Author: Fernando $
#include "AMF_AGCNMaxAbs_S.h"
#include <math.h>
void AMF_AGCNMaxAbs_S_Render(AMF_AGCNMaxAbs_S * 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_S_Render(AMF_AGCNMaxAbs_S * restrict instance,float * restrict * buffers,int tickSize) {
int numInputs = instance->b.inputPinCount;
int i,j,k;
float *out = buffers[numInputs];
float *in;
float absL, absR, maxLR;
#if 1
in = buffers[0];
// Could rewrite this so that aliasing is OK
// but I suspect this formulation is faster.
for (i=0,j=0; i<tickSize; i++,j+=2) {
absL = fabsf(in[j]);
absR = fabsf(in[j+1]);
out[i] = fmaxf(absL, absR);
}
for (k=1; k<numInputs; k++) {
in = buffers[k];
for (i=0,j=0; i<tickSize; i++,j+=2) {
absL = fabsf(in[j]);
absR = fabsf(in[j+1]);
maxLR = fmaxf(absL, absR);
out[i] = fmaxf(out[i],maxLR);
}
}
#else
// Alternative formulation that would allow aliasing:
float val;
for (i=0, j=0; i<tickSize; i++,j+=2) {
val = 0.0;
for (k=0; k<numInputs; k++) {
val = fmaxf(val,fabs(buffers[k][j]));
val = fmaxf(val,fabs(buffers[k][j+1]));
}
out[i] = val;
}
#endif
}
#endif
SEG_MOD_SLOW_CONST const AMF_ModuleVariableClass AMFClassAGCNMaxAbs_S = {
AMFModuleClassFlag_VARIABLE_PIN_COUNT, // flags
(AMF_RenderFunction) AMF_AGCNMaxAbs_S_Render, // render function
(void *)0 // default
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -