📄 amf_agcnmaxabs_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_AGCNMaxAbs_S_Render.asm#3 $
// Part of : VisualAudio V2.5.0
// Updated : $Date: 2006/10/12 $ by $Author: Fernando $
// Module Name : AMF_AGCNMaxAbs_S_Render.asm
// DSP Processor : ADSP21161
// Original Author : Mark A Wilson
// Date : 7/03/03
//====================================================================================
// Processor resources used for AMF_AGCNMaxAbs_S_Render.asm:
// 52 words pmem INTERNAL
// (573+392*(inputPinCount-1)) cycles, tickSize=128
// (61 + 2*tickSize + 4*tickSize/2 + (inputCount-1)*(8 + 3*tickSize))
// (61 + 4*tickSize (inputCount-1)*(8 + 3*tickSize))
//
// Revision history:
//
// 05/29/03 Mark Wilson Created
// 07/03/03 Tim Stilson Fixed bug with inputPinCount > 1
// 07/03/03 Tim Stilson Optimized
// 08/15/03 Tim Stilson some code-size optimizations
//
//====================================================================================
#if 1
#include "processor.h"
#include "AMF_AGCNMaxAbs_S.h"
#include "asm_macros.h"
#include "asm_sprt.h"
.global _AMF_AGCNMaxAbs_S_Render;
.segment /pm SEG_MOD_FAST_CODE ;
//.segment /pm seg_pmco;
_AMF_AGCNMaxAbs_S_Render:
//====================================================================================
//AMF_AGCNMaxAbs_S_Render_prologue:
entry;
//module entry arguments passed in registers:
// r4 = instance (AMF_SmoothScaler * restrict)
// r8 = * buffers (float * restrict)
// r12 = int tickSize
//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;
//------------------------------------------------------------------------------------
AMF_AGCNMaxAbs_S_Render_setup:
i1=r8; // i1->*buffers
i4=r4; // i4->testModuleInstance[0]
r8=dm(AMF_AGCNMaxAbs_S_inputPinCount,i4); // r8=instance->b.inputPinCount
m4=r8;
i0=dm(m4,i1); // i0=*out=out=buffers[inputPinCount]
r0=r8+1;
m4=r0;
i2=dm(m4,i1); // scratch = buffers[inputPinCount+1]
i13=i2; // remember it
r0=dm(i1,m6); // r0=in=buffers[0], i1->buffers[1]
i4=r0; // i4=*in
bit set mode1 PEYEN; // enter SIMD
m4=2;
// abs first input into scratch, l&r separately
f1=dm(i4,m4); // f1=inL/inR
LCNTR=r12, DO AMF_AGCNMaxAbs_S_Render_loop1_end UNTIL LCE;
f2=abs f1, f1=dm(i4,m4); // f2 = absL/R, get next input
AMF_AGCNMaxAbs_S_Render_loop1_end:
dm(i2,m4)=f2; // scratchL/R=f2
bit clr mode1 PEYEN; // leave SIMD
r8=r8-1; // r8=inputPinCount-1 (this should be fine to do in SIMD or SISD)
if LE Jump AMF_AGCNMaxAbs_S_Render_epilogue;
//NEVER load the LCNTR with zero
// abs rest of the inputs and max into scratch (channels still separate)
LCNTR=r8, DO AMF_AGCNMaxAbs_S_Render_loop2_end UNTIL LCE;
//i1->*buffers
r1=dm(i1,m6); //r1=in=buffers[k]
i4=r1; //i4=*in = buffers[k]
bit set mode1 PEYEN; // enter SIMD
i2=i13; // restore *out
f1=dm(i4,m4); //f1=inL/R
LCNTR=r12, DO AMF_AGCNMaxAbs_S_Render_loop21_end UNTIL LCE;
f1=abs f1, f2=dm(i2,m5); //f=absL/R, f2=scracthL/R
f2=max(f1,f2), f1=dm(i4,m4); //f2=max, f1=next in
AMF_AGCNMaxAbs_S_Render_loop21_end:
dm(i2,m4)=f2; //out[i+1]=f2
AMF_AGCNMaxAbs_S_Render_loop2_end:
bit clr mode1 PEYEN; // leave SIMD (should be fine to do r1=dm(...) above in SIMD or SISD)
AMF_AGCNMaxAbs_S_Render_epilogue:
bit set mode1 PEYEN; // enter SIMD
i2=i13;
r12=lshift r12 by -1; // the next loop does 2 samples at a time
// now max the channels together into mono
f1=dm(i2,m4); // f1 = [scrL(i) scrR(i)]
LCNTR=r12, DO AMF_AGCNMaxAbs_S_Render_loop3_end UNTIL LCE;
f2=dm(i2,m4); // f2 = [scrL(i+1) scrR(i+1)]
f2<->s1; // f1 = [scrL(i) scrL(i+1)], f2 = [scrR(i) scrR(i+1)];
f2=max(f1,f2), f1=dm(i2,m4); // max(l,r), read next in
AMF_AGCNMaxAbs_S_Render_loop3_end:
dm(i0,m4)=f2; // write out
bit clr mode1 PEYEN; // leave SIMD
nop;
//====================================================================================
I2=gets(1);
I1=gets(2);
I0=gets(3);
mode1=gets(4);
alter(4);
//------------------------------------------------------------------------------------
_AMF_AGCNMaxAbs_S_Render.END:
leaf_exit; // C-rth requires this instead of rts
//------------------------------------------------------------------------------------
.endseg;
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -