📄 amf_delayallpassoffchip_s.c
字号:
// Copyright(c) 2005 Analog Devices, Inc. All Rights Reserved. ADI Confidential.
#include "AMF_DelayAllpassOffChip_S.h"
void AMF_DelayAllpassOffChip_S_Render(AMF_DelayAllpassOffChip_S * restrict instance,float * restrict * buffers,int tickSize);
#if 0
#pragma optimize_for_speed
SEG_MOD_FAST_CODE void AMF_DelayAllpassOffChip_S_Render(AMF_DelayAllpassOffChip_S * restrict instance,float * restrict * buffers,int tickSize) {
int delay = instance->delay; // delay in samples
float *delayBuffer = &instance->delayBuffer[0]; // delay buffer
int writeIndex = instance->delayWritePtr-delayBuffer; // delay index
int i;
float tmp;
AMF_Signal *in = buffers[0];
AMF_Signal *out = buffers[1];
float pm *readBufPtr;
float pm *writePtr;
float coef = instance->coef;
float *tmpbuf = buffers[2];
int delayLength = delay*2;
// bring the data from delayBuffer on chip
// weird kludge to get the compiler to actually set the B0 register...
readBufPtr = (float pm *)((int)delayBuffer);
readBufPtr = (float pm *)__builtin_circptr(readBufPtr, writeIndex, (float pm *)((int)delayBuffer), delayLength);
#pragma loop_count(8,256,8)
#pragma no_alias
for (i=0; i<2*tickSize; i++) {
tmpbuf[i] = *readBufPtr;
readBufPtr = (float pm *)__builtin_circptr(readBufPtr, 1, (float pm *)((int)delayBuffer), delayLength);
}
#pragma loop_count(8,256,8)
for (i=0; i<2*tickSize; i++) {
tmp = tmpbuf[i] + coef*in[i];
tmpbuf[i] = in[i] - coef*tmp; // make sure we read in[] before writing out[], to allow aliasing
out[i] = tmp;
}
// write data to off chip memory
// weird kludge to get the compiler to actually set the B0 register...
writePtr = (float pm *)((int)delayBuffer);
writePtr = (float pm *)__builtin_circptr(writePtr, writeIndex, (float pm *)((int)delayBuffer), delayLength);
#pragma loop_count(8,256,8)
#pragma no_alias
for (i=0; i<2*tickSize; i++) {
*writePtr = tmpbuf[i];
writePtr = (float pm *)__builtin_circptr(writePtr, 1, (float pm *)((int)delayBuffer), delayLength);
}
instance->delayWritePtr = (float *)writePtr;
}
#endif
SEG_MOD_SLOW_CONST const AMF_ModuleClass AMFClassDelayAllpassOffChip_S = {
/* Flags */
0,
/** Reference to render function. */
(AMF_RenderFunction)AMF_DelayAllpassOffChip_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 + -