📄 amf_tonecontrolbass_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_ToneControlBass_S_Render.asm#3 $
// Part of : VisualAudio V2.5.0
// Updated : $Date: 2006/10/12 $ by $Author: Fernando $
// Module Name : AMF_ToneControlBass_S_Render.asm
// DSP Processor : ADSP21161
// Description : Tone control bass (stereo) audio module ASM file.
// Owner : Analog Devices
// Original Author : Mark A Wilson, further optimized by Tim Stilson
// Date : 6/26/03
//====================================================================================
// Processor resources used:
// 63 words pmem INTERNAL
// 989 cycles, tickSize=128 (93 + 7*tickSize)
//====================================================================================
// Revision History
//
// 5/19/03 Mark Wilson: created
// 6/26/03 Tim Stilson: further optimized
// 8/15/03 Tim Stilson: some code-size optimizations
#if 1 // ASM render code
#include "processor.h"
#include "AMF_ToneControlBass_S.h"
#include "asm_macros.h"
#include "asm_sprt.h"
.global _AMF_ToneControlBass_S_Render; ;
.segment /pm SEG_MOD_FAST_CODE;
_AMF_ToneControlBass_S_Render:
//====================================================================================
//AMF_ToneControlBass_S_prologue:
//module entry arguments passed in registers:
// r4 = instance (AMF_ToneControlBass_S * restrict)
// r8 = * buffers (float * restrict)
// r12 = int tickSize
puts=mode1;
r0=i0; puts = r0;
puts = r5;
puts = r6;
puts = r7;
puts = r9;
puts = r10;
puts = r13;
puts = r14;
//------------------------------------------------------------------------------------
AMF_ToneControlBass_S_setup:
i4=r4; // i4->testModuleInstance[0]
f10=dm(AMF_ToneControlBass_S_AmpSmoothing,i4); // f10= float ampSmoothing = instance->ampSmoothing {constant}
s10=f10;
f4=dm(AMF_ToneControlBass_S_AmpTarget,i4); // f4= float ampTarget = instance->ampTarget {constant}
s4=f4;
f0=dm(AMF_ToneControlBass_S_B0,i4); // f0= b0 {constant}
s0=f0;
i12=dm(AMF_ToneControlBass_SAux,i4); // 12-> instance->*aux
f2=pm(0,i12); // f2= instance->aux->currentAmp
s2=f2;
i4=r8; // i4->*buffers
i0=dm(0,i4); // i0->buffers[0]
i4=dm(1,i4); // i4->buffers[1]
bit set mode1 PEYEN; // Enable PEy:SIMD - needs 1 cycle before use
m4=2; // SIMD index
f1=0.5; // f1=s1 = 0.5 ...used inside loop
f6=1.0; // f6=s6 = 1.0
f6=f6-f10; // f6/s6 = oneMinusRate = 1.0 - AmpSmoothing
f14=f2*f6; // f14/s14 = currentAmp * oneMinusRate
f10=f4*f10, f4=pm(1,i12); // f10/s10 = ampTarget * ampSmoothing, f4/s10 = state[0/1]
r12 = r12-1, f8=dm(i0,m4); // decrement f12 because doing first iter outside loop, f8/s8=in[i/i+1] (Note m4=2)
f2=f10+f14; // f2/s2 = currentAmp = currentAmp * oneMinusRate + ampTarget * ampSmoothing
f7=f0*f4; // f7/s7= b0 * state[0/1]
f7=f8-f7; // f7/s7= tmp[0/1] = in[i/i+1] - b0 * state[0/1]
f9=f0*f7; // f9/s9= b0 * tmp[0/1]
f13=f9+f4, f4=f7; // f13/s13= allPass[0/1] = b0 * tmp[0/1] + state[0/1]
// f4= state[0/1] = tmp[0/1]
// f13/s13 = currentAmp * oneMinusRate {used for next loop iteration}
f13=f2*f6, f7=f8+f13, f14=f8-f13; // f7/s7= in[i/i+1] + allPass[0/1], f14/s14= in[i/i+1] - allPass[0/1]
f8=f2*f7; // f8/s8= currentAmp * (in[i/i+1] + allPass[0/1])
// f7/s7= b0 * state[0/1]
// instance->currentAmp = f2 ... Done inside loop (before it's updated for next iter)
f7=f0*f4, f5=f8+f14, pm(0,i12)=f2; // f5/s5= currentAmp * (in[i/i+1] + allPass[0/1]) + (in[i/i+1] - allPass[0/1])
// f9/s9= out[i/i+1] = 0.5 * ( currentAmp * (in[i/i+1] + allPass[0/1]) + (in[i/i+1] - allPass[0/1]) );
// f2/s2 = currentAmp = currentAmp * oneMinusRate + ampTarget * ampSmoothing
// f8/s8=in[i/i+1] (Note m4=2)
f9=f1*f5, f2=f10+f13, f8=dm(i0,m4);
AMF_ToneControlBass_S_loop_start:
// for (i=0; i<tickSize; i++) ... tickSize now passed in r12
LCNTR=r12, DO AMF_ToneControlBass_S_loop_end UNTIL LCE;
// out = f9
f7=f8-f7, dm(i4,m4)=f9; // f7/s7= tmp[0/1] = in[i/i+1] - b0 * state[0/1]
f9=f0*f7; // f9/s9= b0 * tmp[0/1]
f13=f9+f4, f4=f7; // f13/s13= allPass[0/1] = b0 * tmp[0/1] + state[0/1]
// f4= state[0/1] = tmp[0/1]
// f13/s13 = currentAmp * oneMinusRate {used for next loop iteration}
f13=f2*f6, f7=f8+f13, f14=f8-f13; // f7/s7= in[i/i+1] + allPass[0/1], f14/s14= in[i/i+1] - allPass[0/1]
f8=f2*f7; // f8/s8= currentAmp * (in[i/i+1] + allPass[0/1])
// f7/s7= b0 * state[0/1], for next iter
// instance->currentAmp = f2 ... Done inside loop (before it's updated for next iter)
f7=f0*f4, f5=f8+f14, pm(0,i12)=f2; // f5/s5= currentAmp * (in[i/i+1] + allPass[0/1]) + (in[i/i+1] - allPass[0/1])
// f9/s9= out[i/i+1] = 0.5 * ( currentAmp * (in[i/i+1] + allPass[0/1]) + (in[i/i+1] - allPass[0/1]) );
// f2/s2 = currentAmp = currentAmp * oneMinusRate + ampTarget * ampSmoothing
// f8/s8=in[i/i+1] (Note m4=2)
AMF_ToneControlBass_S_loop_end:
f9=f1*f5, f2=f10+f13, f8=dm(i0,m4);
dm(i4,m4)=f9; // last out = f9
pm(1,i12)=f4; // instance->aux->state[0] = state[0], instance->aux->state[1] = state[1]
bit clr mode1 PEYEN; // Disable PEy:SIMD
// nop; // (don't need a nop because at worst, s14 will get clobbered, but s14 is a scratch reg)
//====================================================================================
AMF_ToneControlBass_S_epilogue:
r14 = gets(1);
r13 = gets(2);
r10 = gets(3);
r9 = gets(4);
r7 = gets(5);
r6 = gets(6);
r5 = gets(7);
i0 = gets(8);
mode1=gets(9);
alter(9);
//------------------------------------------------------------------------------------
_AMF_ToneControlBass_S_Render.END:
leaf_exit; // C-rth requires this instead of rts
//------------------------------------------------------------------------------------
.endseg;
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -