⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 amf_agcnmaxabs_render.asm

📁 ADI SHARC DSP 音频算法标准模块库
💻 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_Render.asm#3 $ 
// Part of : VisualAudio V2.5.0 
// Updated : $Date: 2006/10/12 $ by $Author: Fernando $




//    Module Name     : AMF_AGCNMaxAbs_Render.asm 
//    DSP Processor   : ADSP21161
//    Original Author : Mark A Wilson   
//    Date            : 7/03/03
//====================================================================================
// Processor resources used for AMF_AGCNMaxAbs_Render.asm:
//   41 words pmem INTERNAL
//   (162 + 199*(inputPinCount-1)) cycles, tickSize=128
//   (34 + 2*tickSize/2 + (inputPinCount-1)*(7 + 3*tickSize/2))
//
//    Revision history:
//
//      10/06/2003  Tim Stilson           Created from AMF_AGCNMaxAbs_S_Render.asm
//
//====================================================================================

#if 1

#include "processor.h"
#include "AMF_AGCNMaxAbs.h"
#include "asm_macros.h"
#include "asm_sprt.h"
 
.global _AMF_AGCNMaxAbs_Render;           

.segment /pm SEG_MOD_FAST_CODE    ; 
//.segment /pm seg_pmco;
_AMF_AGCNMaxAbs_Render:

//====================================================================================
//AMF_AGCNMaxAbs_Render_prologue:
    entry;    
                            
//module entry arguments passed in registers: 
//  r4  = instance  (AMFmoothScaler * 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_Render_setup:
    i1=r8;                                    // i1->*buffers

    i4=r4;                                    // i4->testModuleInstance[0]
    r8=dm(AMF_AGCNMaxAbs_inputPinCount,i4);     // r8=instance->b.inputPinCount
    m4=r8;
    
    i0=dm(m4,i1);                             // i0=*out=out=buffers[inputPinCount]

    i2=i0;                                      // "scratch" = out = buffers[inputPinCount]
    i13=i2;                                   // remember it

    r0=dm(i1,m6);                             // r0=in=buffers[0], i1->buffers[1]
    i4=r0;                                    // i4=*in

    r12 = lshift r12 by -1;

    bit set mode1 PEYEN;                      // enter SIMD
    m4=2;
    
    // abs first input into scratch
        f1=dm(i4,m4);                         // f1=in[i/i+1]
    LCNTR=r12, DO AMF_AGCNMaxAbs_Render_loop1_end UNTIL LCE;
        f2=abs f1,      f1=dm(i4,m4);         // f2 = abs(in[i/i+1]), get next inputs
AMF_AGCNMaxAbs_Render_loop1_end: 
        dm(i2,m4)=f2;                         // scratch[i/i+1]=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_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_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=in
        LCNTR=r12, DO AMF_AGCNMaxAbs_Render_loop21_end UNTIL LCE;
            f1=abs f1,      f2=dm(i2,m5);   //f=abs[i/i+1], f2=scratch[i/i+1]
            f2=max(f1,f2),  f1=dm(i4,m4);   //f2=max, f1=next in
AMF_AGCNMaxAbs_Render_loop21_end:     
            dm(i2,m4)=f2;                   //out[i/i+1]=f2
    
AMF_AGCNMaxAbs_Render_loop2_end: 
        bit clr mode1 PEYEN;                // leave SIMD (should be fine to do r1=dm(...) above in SIMD or SISD)
   
AMF_AGCNMaxAbs_Render_epilogue:
    nop;
    
//====================================================================================
    I2=gets(1);
    I1=gets(2);
    I0=gets(3);
    mode1=gets(4);
    alter(4);
    
//------------------------------------------------------------------------------------
_AMF_AGCNMaxAbs_Render.END:
    leaf_exit; // C-rth requires this instead of rts
//------------------------------------------------------------------------------------
.endseg;
#endif  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -