📄 amf_msmatrix.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_MSMatrix.c#3 $
// Part of : VisualAudio V2.5.0
// Updated : $Date: 2006/10/12 $ by $Author: Fernando $
#include "AMF_MSMatrix.h"
#define ONE_OVER_SQRT2 0.70710678118654752440084436210485
void AMF_MSMatrix_Render(AMF_MSMatrix * restrict instance,float * restrict * buffers,int tickSize);
void AMF_MSMatrix_Bypass(AMF_MSMatrix * 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_MSMatrix_Render(AMF_MSMatrix * restrict instance,float * restrict * buffers,int tickSize) {
int i;
float *in1 = buffers[0];
float *in2 = buffers[1];
float *out1 = buffers[2];
float *out2 = buffers[3];
for (i=0; i<tickSize; i++) {
out1[i]=(in1[i]+in2[i])*ONE_OVER_SQRT2;
out2[i]=(in1[i]-in2[i])*ONE_OVER_SQRT2;
}
}
#endif
// custom bypass
// copies inputs to outputs
#pragma optimize_for_space
SEG_MOD_FAST_CODE void AMF_MSMatrix_Bypass(AMF_MSMatrix * restrict instance, float * restrict * buffers, int tickSize) {
int i,k;
float *monoIn;
float *out;
for (k=0; k<2; k++) {
monoIn = buffers[k];
out = buffers[k+2];
for (i=0; i<tickSize; i++) {
out[i] = monoIn[i];
}
}
}
SEG_MOD_SLOW_CONST const AMF_ModuleClass AMFClassMSMatrix = {
/* Flags */
0,
/* Render function */
(AMF_RenderFunction)AMF_MSMatrix_Render,
/* Custom bypass */
(AMF_RenderFunction)AMF_MSMatrix_Bypass,
/* Input descriptor - 2 inputs, and they are mono. */
2, 0,
/* Output descriptor - 2 outputs, and they are mono. */
2, 0,
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -