📄 amf_mixernxm_ds_render.asm
字号:
// 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_MixerNxM_DS_Render.asm#3 $
// Part of : VisualAudio V2.5.0
// Updated : $Date: 2006/10/12 $ by $Author: Fernando $
// Module Name : AMF_MixerNxM_DS_Render.asm
// DSP Processor : ADSP21161
// Original Author : Tim Stilson
// Date : 1/8/2004
//====================================================================================
// Processor resources used:
// 102 words pmem INTERNAL
// 5661 cycles (new API) for tickSize=128 (2 in, 8 out, all gains nonzero)
// cycles: 61 + numOutputs*(38 + 2*tickSize + (numInputs-1)*(22 + 3*tickSize))
//====================================================================================
// Revision History:
// 1/08/2004 Tim Stilson - Created from AMF_MixerNXM_Render.asm
#if 1
#include <processor.h>
#include "AMF_MixerNxM_DS.h"
#include "asm_sprt.h"
.global _AMF_MixerNxM_DS_Render;
.segment /pm SEG_MOD_FAST_CODE;
//.segment /pm seg_pmco;
_AMF_MixerNxM_DS_Render:
//====================================================================================
//MF_MixerNxM_DS_Render_prologue:
entry;
//module entry arguments passed in registers:
// r4 = instance (AMF_MixerNxM_DS * restrict)
// r8 = * buffers (float * restrict)
// r12 = int tickSize
//Make sure that any stack arguments are retreived before preserving any regs to stack
//module entry arguments passed on stack:
// r0=gets(5); //stack->*outputs
// r1=gets(4); //stack->*inputs
// etc...
//(NOTE: There are no stack arguments passed for this module)
//push call preserve regs to stack here once stack call params are retrieved
save_reg;
// save_i0;
// save_i1;
//expand the macros above and optimize for this module...
puts=mode1;
R0=I3; puts=R0;
R0=I2; puts=R0;
R0=I0; puts=R0;
R0=M0; puts=R0;
R0=I1; puts=R0;
//------------------------------------------------------------------------------------
AMF_MixerNxM_DS_Render_setup:
i4=r4; //i4->testModuleInstance[0]
r0=r12; // r0 = tickSize
r1=dm(AMF_MixerNxM_DS_inputPinCount,i4); // r1= int inputPinCount = instance->inputPinCount {=2}
r2=dm(AMF_MixerNxM_DS_outputPinCount,i4); // r2= int outputPinCount = instance->outputPinCount {=8}
i3=dm(AMF_MixerNxM_DS_Amps,i4); // i3-> amps {=&s[0]}
i4=r8; //i4->buffers
m0=2; // tickSize loop index in SIMD mode
r3=0; // r3=outNum=0
// r2=outputPinCount
//
//for (outNum=0; outNum<outputPinCount; outNum++)
LCNTR=r2, DO AMF_MixerNxM_DS_Render_loop1_end UNTIL LCE;
//loop assumptions: r0=tickSize/2, r1=inputPinCount; r3=outNum; i4->buffers[0]
r7=0; // r7=inNum=0
r4=r1+r3; //r4 = inputPinCount + outNum
m4=r4;
r10=dm(m4,i4); //r10 = out = buffers[inputPinCount + outNum]
i1=r10; //i1->out
r6=0; //outWritten = 0
s6=0; //to make sure SIMD conditionals work out
//for (inNum=0; inNum<inputPinCount; inNum++)
LCNTR=r1, DO AMF_MixerNxM_DS_Render_loop2_end UNTIL LCE;
//loop assumptions: r0=tickSize/2; r2=outputPinCount; r3=outNum; r6=outWritten;r7=inNum; i3->amp
r4=r7*r2(ssi); //r4= inNum*outputPinCount, (ssf) default so force (ssi)
r4=r4+r3; //r4=(inNum*outputPinCount)+outNum]
r4=lshift r4 by 1; //r4 *= 2 (because there are 2 gains per i/o pair in DualStereo)
bit set mode1 PEYEN; // Enable PEy:SIMD
m4=r4; //m12=r4
f4=dm(m4,i3); //f4/s4 =ampL/R = amps[(inNum*outputPinCount)+outNum, +1]
f4=pass f4;
// FIXME Change this to amp > EPSILON
//if (amp != 0.0) {
IF eq JUMP AMF_MixerNxM_DS_Render_loop2_end;
m4=r7; //m4=r7=inNum
i0=dm(m4,i4); //i0 = in = buffers[inNum]
r6=pass r6;
//if (!outWritten)
IF ne JUMP AMF_MixerNxM_DS_Render_out2(db);
f9=dm(i0,m0); // f9 = first input
i1=r10; //reset out pointer
AMF_MixerNxM_DS_Render_out1:
r6=1; //outWritten = 1
// for (i=0; i<tickSize; i++)
LCNTR=r0, DO AMF_MixerNxM_DS_Render_out1_loop_end UNTIL LCE;
f8=f9*f4, f9=dm(i0,m0); // f8 = in[i] * amp, f1=in[i++]
AMF_MixerNxM_DS_Render_out1_loop_end:
dm(i1,m0)=f8; // out[i++]=f8
jump AMF_MixerNxM_DS_Render_simd_off;
//else out[i] += in[i] * amp;
AMF_MixerNxM_DS_Render_out2:
i2=i1;
// for (i=0; i<tickSize; i++)
f5=dm(i2,m0); // f5 = out[i]
LCNTR=r0, DO AMF_MixerNxM_DS_Render_out2_loop_end UNTIL LCE;
f8=f9*f4, f9=dm(i0,m0); // f8 = in[i] * amp, f1=in[i++]
f8=f8+f5, f5=dm(i2,m0); // f8 = out[i] + (in[i] * amp), f5 = next out[i]
AMF_MixerNxM_DS_Render_out2_loop_end:
dm(i1,m0)=f8; // out[i++] += f8
AMF_MixerNxM_DS_Render_simd_off:
bit clr mode1 PEYEN; // Disable PEy:SIMD
AMF_MixerNxM_DS_Render_loop2_end:
r7=r7+1;
bit set mode1 PEYEN; // Enable PEy:SIMD
nop; // force next instr to be SIMD no matter what
r6=pass r6;
//if (!outWritten), zero out this output
IF ne JUMP AMF_MixerNxM_DS_Render_simd_off_2(db);
i1=r10; // reset out ptr just to be safe
f5=0.0;
AMF_MixerNxM_DS_Render_out3:
// for (i=0; i<tickSize; i++)
LCNTR=r0, DO AMF_MixerNxM_DS_Render_out3_loop_end UNTIL LCE;
AMF_MixerNxM_DS_Render_out3_loop_end:
dm(i1,m0)=f5; // out[i] = 0.0;
nop;
AMF_MixerNxM_DS_Render_simd_off_2:
bit clr mode1 PEYEN; // Disable PEy:SIMD
AMF_MixerNxM_DS_Render_loop1_end:
r3=r3+1;
//====================================================================================
AMF_MixerNxM_DS_Render_epilogue:
// restore_i1;
// restore_i0;
// restore_reg;
//expand the macros above and optimize for this module...
I1=gets(1);
M0=gets(2);
I0=gets(3);
I2=gets(4);
I3=gets(5);
mode1=gets(6);
alter(6);
restore_reg;
//------------------------------------------------------------------------------------
_AMF_MixerNxM_DS_Render.END:
leaf_exit; // C-rth requires this instead of rts
//------------------------------------------------------------------------------------
.endseg;
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -