📄 amf_volumefletchermunson_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_VolumeFletcherMunson_S_Render.asm#3 $
// Part of : VisualAudio V2.5.0
// Updated : $Date: 2006/10/12 $ by $Author: Fernando $
// Module Name : AMF_VolumeFletcherMunson_S_Render.asm
// DSP Processor : ADSP21161
// Original Author : Tim Stilson
// Date : 7/22/03
//====================================================================================
// Processor resources used:
// 73 words pmem INTERNAL
// (68 + 10*tickSize)
//====================================================================================
// Revision History
//
// 7/22/03 Tim Stilson: started, based on AMF_BassToneControl2_Render.asm
// 8/25/03 Tim Stilson: returned to it and completed first pass
// 8/26/03 Tim Stilson: debugged and tested
// 5/15/06 Tim Stilson: fixed a bug due to L0 not being cleared afer first loop (hidden if &in[] < &aux[])
#if 1
#include "processor.h"
#include "AMF_VolumeFletcherMunson_S.h"
#include "asm_macros.h"
#include "asm_sprt.h"
.global _AMF_VolumeFletcherMunson_S_Render; ;
.segment /pm SEG_MOD_FAST_CODE;
_AMF_VolumeFletcherMunson_S_Render:
//====================================================================================
//push call preserve regs to stack here once stack call params are retrieved
puts = mode1;
r0=i0; puts = r0;
r0=i1; puts = r0;
r0=i2; puts = r0;
r0=b0; puts = r0;
puts = r3;
puts = r5;
puts = r6;
puts = r9;
puts = r13;
puts = r14;
i1=r8; // i1->buffers[]
i4=dm(0,i1); // i4=input[]
s14=i4; // remember it
i2=dm(1,i1); // i2=output[]
s13=i2; // remember it
i1=r4; // i1->testModuleInstance[0]
////////////// allpass biquad: b0=b0, b1=b1, b2=1, a1=b1, a2=b0 (non-negated), based on Sami's biquad
// initialize states pointers
r0=dm(AMF_VolumeFletcherMunson_S_AuxPtr,i1); // &aux
b0=r0; // i0 points to 1st state
l0=4; // l0 = number of filter states
r1 = r12; // ticksize
f3=dm(AMF_VolumeFletcherMunson_S_b0,i1); // f3/s2 = b0 = a2
s3=f3;
f2=dm(AMF_VolumeFletcherMunson_S_b1,i1); // f2/s2 = b1 = a1
s2=f2;
bit set mode1 PEYEN;
m4=2;
f0=1.0; // f0/s0 = b2 = 1.0
////////////////////////////////////////////////////////////////////////////////
// f9 = load input
// f5 = load state1, move to other side
// f12 = a1*state1, f6 = load state2, stay here
// f12 = a2*state2, f8 = f9-a1*state1,
// loop:
// f12 = b1*state1, f5 = f8-a2*state2 =new state,
// f8 = b0*new state, store new state, move to other side
// f12 = b2*state2, f8 = f8+b1*state1, f6 = load state2, stay here
// f12 = a1*state1, f8 = f8+b2*state2, f9 = load input
// f12 = a2*state2, f8 = f9-a1*state1, store output
////////////////////////////////////////////////////////////////////////////////
f9 = dm(i4,m4);
f5 = dm(i0,m4);
f12 = f2 * f5, f6 = dm(i0,m5);
f12 = f3 * f6, f8 = f9 - f12;
lcntr = r1, do (pc,5) until lce;
f12 = f2 * f5, f5 = f8 - f12;
f8 = f3 * f5, dm(i0,m4) = f5;
f12 = f0 * f6, f8 = f8 + f12, f6 = dm(i0,m5);
f12 = f2 * f5, f8 = f8 + f12, f9 = dm(i4,m4);
f12 = f3 * f6, f8 = f9 - f12, dm(i2,m4) = f8;
////////////////////////////////////////////////////////////////////////////////
i0 = s14; // restore *in;
i4 = s13; // restore *out;
i2 = s13; // *out also (output of allpass);
l0=0; // turn off circbuf on I0
bit clr mode1 PEYEN; // drop out of SIMD to calculate smoothing stuff (can't do these with broadcast, unfortunately)
nop;
f4=dm(AMF_VolumeFletcherMunson_S_AmpSmoothing,i1); // f4 = float ampSmoothing = instance->ampSmoothing
f8=1.0;
f3=f8-f4, f13=dm(AMF_VolumeFletcherMunson_S_AmpTarget,i1); // f3 = oneMinusRate = 1.0 - ampSmoothing, f13 = ampTarget
f14=dm(AMF_VolumeFletcherMunson_S_LowAmpTarget,i1); // f14 = lowAmpTarget
f13=f13*f4, f5=dm(AMF_VolumeFletcherMunson_S_Amp,i1); // f13 = ampTarget * ampSmoothing, f5 = amp
f14=f14*f4, f6=dm(AMF_VolumeFletcherMunson_S_LowAmp,i1); // f14 = lowAmpTarget * ampSmoothing, f6 = lowAmp
s3=f3; // the above calc and loads are done in SISD because we can't do broadcast loads since the struct may be off-chip
s5=f5;
s6=f6;
s13=f13;
s14=f14;
bit set mode1 PEYEN;
nop;
f4=0.5; // f4/s4=0.5, used inside loop
f8=dm(i0,m4); // f8/s8 = in[i/i+1]
f12=dm(i2,m4); // f12/s12 = allpass[i/i+1]
f0=f8+f12, f12=f8-f12; // f0=in+ap, f12=in-ap
f8=f0*f5; // f8=amp*(in+ap)
LCNTR=r1, DO AMF_VolumeFletcherMunson_S_loop2_end UNTIL LCE;
f12=f12*f6; // f8=lowAmp*(in-ap)
f8=f3*f5, f0=f8+f12, f12=dm(i2,m4); // f8=amp*(1-r), f0=amp*(in+ap)+lowAmp*(in-ap), f12 = next allpass
f0=f0*f4, f5=f8+f13, f8=dm(i0,m4); // f0=0.5*(amp(in+ap)+lowAmp(in-ap)), f5=amp*(1-r)+target*r, f8=next in
f8=f3*f6, f0=f8+f12, f12=f8-f12, dm(i4,m4)=f0; // f8=lowAmp*(1-r), next[f0=in+ap, f12=in-ap], send output
AMF_VolumeFletcherMunson_S_loop2_end:
f8=f0*f5, f6=f8+f14; // f8=amp*(in+ap), f6=lowAmp*(1-r)+targetLow*r
bit clr mode1 PEYEN;
nop;
dm(AMF_VolumeFletcherMunson_S_Amp,i1)=f5; // instance->amp=last amp
dm(AMF_VolumeFletcherMunson_S_LowAmp,i1)=f6; // instance->amp=last amp
r14 = gets(1);
r13 = gets(2);
r9 = gets(3);
r6 = gets(4);
r5 = gets(5);
r3 = gets(6);
b0 = gets(7);
i2 = gets(8);
i1 = gets(9);
i0 = gets(10);
mode1=gets(11);
alter(11);
//------------------------------------------------------------------------------------
_AMF_VolumeFletcherMunson_S_Render.END:
leaf_exit; // C-rth requires this instead of rts
//------------------------------------------------------------------------------------
.endseg;
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -