📄 amf_mixernxmsmoothed_s_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_MixerNxMSmoothed_S_Render.asm#3 $
// Part of : VisualAudio V2.5.0
// Updated : $Date: 2006/10/12 $ by $Author: Fernando $
// Module Name : AMF_MixerNxMSmoothed_S_Render.asm
// DSP Processor : ADSP21161
// Original Author : Tim Stilson
// Date : 1/8/2004
//====================================================================================
// Processor resources used:
// 99 words pmem INTERNAL
// 5741 cycles for tickSize=128 (2 in, 8 out, all gains nonzero)
// cycles: 53 + numOutputs*(45 + 2*tickSize + (numInputs-1)*(23 + 3*tickSize))
//====================================================================================
// Revision History:
// 1/08/2004 Tim Stilson - Created from AMF_MixerNXMSmoothed_Render.asm
#if 1
#include <processor.h>
#include "AMF_MixerNxMSmoothed_S.h"
#include "asm_sprt.h"
.global _AMF_MixerNxMSmoothed_S_Render;
.segment /pm SEG_MOD_FAST_CODE;
//.segment /pm seg_pmco;
_AMF_MixerNxMSmoothed_S_Render:
//====================================================================================
//module entry arguments passed in registers:
// r2 = instance (AMF_MixerNxMSmoothed_S * restrict)
// r8 = * buffers (float * restrict)
// r12 = int tickSize
//push call preserve regs to stack here once stack call params are retrieved
puts=mode1;
r0=m3; puts=r0;
r0=i3; puts=r0;
puts=r14;
puts=r13;
puts=r11;
puts=r9;
puts=r7;
puts=r6;
puts=r5;
r0=i2; puts=r0;
r0=i0; puts=r0;
r0=m0; puts=r0;
r0=i1; puts=r0;
//------------------------------------------------------------------------------------
AMF_MixerNxMSmoothed_S_Render_setup:
i4=r4; //i4->testModuleInstance[0]
// Size of this array is inputPinCount * outputPinCount
i3=dm(AMF_MixerNxMSmoothed_S_Amps,i4); // f1=float dm *Amps = &instance->Amps[[0]
// Size of this array is inputPinCount * outputPinCount
i2=dm(AMF_MixerNxMSmoothed_S_AmpsTarget,i4); // f4=float dm *AmpsTarget = &instance->AmpsTargets[[0]
f0=dm(AMF_MixerNxMSmoothed_S_AmpsSmoothing,i4); // f0= float AmpsSmoothing = instance->AmpsSmoothing
s0=f0;
r2=dm(AMF_MixerNxMSmoothed_S_inputPinCount,i4); // r2= int inputPinCount = instance->inputPinCount
r5=dm(AMF_MixerNxMSmoothed_S_outputPinCount,i4); // r5= int outputPinCount= instance->outputPinCount
i4=r8; // i4->*buffers
m0=2; // tickSize loop index for SIMD mode
f8=1.0; // f8= 1.0
f8=f8-f0; // f8 = float oneMinusRate = 1.0 - AmpsSmoothing
s8=f8; // s8=f8, for SIMD inside loop
r6=0; // r6=outNum=0
// r5=outputPinCount
//for (outNum=0; outNum<outputPinCount; outNum++)
LCNTR=r5, DO AMF_MixerNxMSmoothed_S_Render_loop1_end UNTIL LCE;
//loop assumptions: r12=tickSize/2, r2=inputPinCount; r6=outNum; i4->buffers[0]
r7=0; //r7=inNum=0
//r2 = inputPinCount
r13=r2+r6; //r13 = inputPinCount + outNum
m4=r13;
s5=dm(m4,i4); //s5 = out = buffers[inputPinCount + outNum]
i1=s5; //i1->out
r9=0; //outWritten = 0
s9=0; //to make sure SIMD conditionals work right
//for (inNum=0; inNum<inputPinCount; inNum++)
LCNTR=r2, DO AMF_MixerNxMSmoothed_S_Render_loop2_end UNTIL LCE;
//loop assumptions: r12=tickSize/2; r5=outputPinCount; r6=outNum; r9=outWritten;r7=inNum; i3->amp
r13=r7*r5(ssi); //r13= inNum*outputPinCount, (ssf) default so force (ssi)
r13=r13+r6; //r13=(inNum*outputPinCount)+outNum]
m3=r13; //m3=r13
f4=dm(m3,i2); //f4=AmpsTarget = AmpsTargets[inNum*outputPinCount+outNum]
s4=f4;
f11=abs f4, f1=dm(m3,i3); //f1=Amps = Ampss[inNum*outputPinCount+outNum]
f13=abs f1, s1=f1;
f14=1e-10;
f13=f13+f11;
comp(f13,f14);
//if (Amps != 0.0 && AmpsTarget != 0.0) or: if ((|Amps|+|AmpsTarget|)<epsilon)...
IF le JUMP AMF_MixerNxMSmoothed_S_Render_simd_off;
m4=r7; //m4=r7=inNum
i1=s5; //reset out pointer
bit set mode1 PEYEN; // Enable PEy:SIMD
i0=dm(m4,i4); //i0 =in = buffers[inNum], this should be fine in either SIMD or SISD
r9=pass r9;
//if (!outWritten)
IF ne JUMP AMF_MixerNxMSmoothed_S_Render_out2(db);
f11=f1*f8; //f11=Amps * oneMinusRate (ssf)
f13=f4*f0; //f13=AmpsTarget * AmpsSmoothing (ssf)
AMF_MixerNxMSmoothed_S_Render_out1:
r9=1; //outWritten = 1
f4=dm(i0,m0); // read first input
LCNTR=r12, DO AMF_MixerNxMSmoothed_S_Render_out1_loop_end UNTIL LCE;
f14=f1*f4, f1=f11+f13, f4=dm(i0,m0); // f14 = in[i] * Amps, f1=cur*(1-r)+t*r for next iter, read next in
AMF_MixerNxMSmoothed_S_Render_out1_loop_end:
f11=f1*f8, dm(i1,m0)=f14; // f11=cur*(1-r), out[i++]=f14
jump AMF_MixerNxMSmoothed_S_Render_simd_off;
//else out[i] += in[i] * amp;
AMF_MixerNxMSmoothed_S_Render_out2:
f4=dm(i0,m0); // read first in
LCNTR=r12, DO AMF_MixerNxMSmoothed_S_Render_out2_loop_end UNTIL LCE;
f14=f1*f4, f1=f11+f13, f4=dm(i1,m5); // f14 = in[i] * Amps, f1=cur*(1-r)+t*r for next iter, f4= out[i]
f14=f4+f14, f4=dm(i0,m0); // f14= out[i] + (in[i] * Amps), read next in
AMF_MixerNxMSmoothed_S_Render_out2_loop_end:
f11=f1*f8, dm(i1,m0)=f14; // out[i++] += f14
AMF_MixerNxMSmoothed_S_Render_simd_off:
bit clr mode1 PEYEN; // Disable PEy:SIMD
r7=r7+1; // inNum++
AMF_MixerNxMSmoothed_S_Render_loop2_end:
dm(m3,i3)=f1; // remember Amps for next tick
bit set mode1 PEYEN; // Enable PEy:SIMD
nop; // force the pass to be done in SIMD
r9=pass r9;
//if (!outWritten), zero this output
IF ne JUMP AMF_MixerNxMSmoothed_S_Render_simd_off_2(db);
f14=0.0;
nop; // nop needed because of delayed branch
AMF_MixerNxMSmoothed_S_Render_out3:
// for (i=0; i<tickSize; i++)
LCNTR=r12, DO AMF_MixerNxMSmoothed_S_Render_out3_loop_end UNTIL LCE;
AMF_MixerNxMSmoothed_S_Render_out3_loop_end:
dm(i1,m0)=f14; // out[i++] = 0.0;
nop;
AMF_MixerNxMSmoothed_S_Render_simd_off_2:
bit clr mode1 PEYEN; // Disable PEy:SIMD
AMF_MixerNxMSmoothed_S_Render_loop1_end:
r6=r6+1; // outNum++
//====================================================================================
//AMF_MixerNxMSmoothed_S_Render_epilogue:
i1=gets(1);
m0=gets(2);
i0=gets(3);
i2=gets(4);
r5=gets(5);
r6=gets(6);
r7=gets(7);
r9=gets(8);
r11=gets(9);
r13=gets(10);
r14=gets(11);
i3=gets(12);
m3=gets(13);
mode1=gets(14);
alter(14);
//------------------------------------------------------------------------------------
_AMF_MixerNxMSmoothed_S_Render.END:
leaf_exit; // C-rth requires this instead of rts
//------------------------------------------------------------------------------------
.endseg;
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -