📄 amf_delayallpassoffchip_4coef_s.c
字号:
// Copyright(c) 2005 Analog Devices, Inc. All Rights Reserved. ADI Confidential.
#include "AMF_DelayAllpassOffChip_4Coef_S.h"
void AMF_DelayAllpassOffChip_4Coef_S_Render(AMF_DelayAllpassOffChip_4Coef_S * restrict instance,float * restrict * buffers,int tickSize);
#if 0
#pragma optimize_for_speed
SEG_MOD_FAST_CODE void AMF_DelayAllpassOffChip_4Coef_S_Render(AMF_DelayAllpassOffChip_4Coef_S * restrict instance,float * restrict * buffers,int tickSize) {
int delay = instance->delay; // delay in samples
int delaySize =instance->delaySize;
float *delayBuffer = &instance->delayBuffer[0]; // delay buffer
int writeIndex = instance->delayWritePtr-delayBuffer; // delay index
int i;
float tmp;
float *in = buffers[0];
float *out = buffers[0];
float pm *bufPtr;
float *tmpbuf = buffers[2];
float pm *readBufPtr;
float al0, al1, al2, al3;
// weird kludge to get the compiler to actually set the B0 register...
readBufPtr = (float pm *)((int)delayBuffer);
readBufPtr = (float pm *)__builtin_circptr(readBufPtr, writeIndex-delay*2, (float pm *)((int)delayBuffer), delaySize*2);
#pragma loop_count(8,256,8)
#pragma no_alias
for (i=0; i<2*tickSize; i++) {
out[i] = *readBufPtr;
readBufPtr = (float pm *)__builtin_circptr(readBufPtr, 1, (float pm *)((int)delayBuffer), delaySize*2);
}
// do the sum at the front of the delay
al2 = instance->AL2;
al3 = instance->AL3;
#pragma loop_count(8,256,8)
#pragma no_alias
#pragma SIMD_for
for (i=0; i<2*tickSize; i++) {
tmpbuf[i] = al2*in[i] + al3*out[i];
}
// weird kludge to get the compiler to actually set the B0 register...
bufPtr = (float pm *)((int)delayBuffer);
bufPtr = (float pm *)__builtin_circptr(bufPtr, writeIndex, (float pm *)((int)delayBuffer), delaySize*2);
#pragma loop_count(8,256,8)
#pragma no_alias
for (i=0; i<2*tickSize; i++) {
bufPtr[0] = tmpbuf[i];
bufPtr = (float pm *)__builtin_circptr(bufPtr, 1, (float pm *)((int)delayBuffer), delaySize*2);
}
instance->delayWritePtr = (float *)bufPtr;
// if we DMA'ed the above transfer, we could overlap this computation with it
// do the sum at the output
al0 = instance->AL0;
al1 = instance->AL1;
#pragma loop_count(8,256,8)
#pragma no_alias
#pragma SIMD_for
for (i=0; i<2*tickSize; i++) {
out[i] = al0*in[i] + al1*out[i];
}
}
#endif
SEG_MOD_SLOW_CONST const AMF_ModuleClass AMFClassDelayAllpassOffChip_4Coef_S = {
/* Flags */
0,
/** Reference to render function. */
(AMF_RenderFunction)AMF_DelayAllpassOffChip_4Coef_S_Render, // render function
/* Default bypass */
(void *)0,
/* Input descriptor - 1 input, and it is stereo. */
1, AMF_StereoPin(0),
/* Output descriptor - 1 output, and it is stereo. */
1, AMF_StereoPin(0),
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -