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

📄 amf_fir_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_FIR_Render.asm#3 $ 
// Part of : VisualAudio V2.5.0 
// Updated : $Date: 2006/10/12 $ by $Author: Fernando $




//    Module Name     : AMF_FIR_Render.asm 
//    DSP Processor   : ADSP21161
//    Original Author : Tim Stilson    
//    Date               : 6/30/03
//====================================================================================
// Processor resources used:
// 55 words pmem INTERNAL
// cycles ~= 82+(TICKSIZE*(10 + 0.5*NTAPS + 2*(NTAPS<10))
// (SIMD used)
//====================================================================================



#if 1

    ////////////////////////////////////////////////////////////////////////////////
    //
    // History:
    //
    // 6/30/03 Tim Stilson: created based on AMF_FIR.c
    // 7/1/03  Tim Stilson: verified and measured
    // 8/15/03 Tim Stilson: some code-size optimizations
    //
    ////////////////////////////////////////////////////////////////////////////////

#include "processor.h"
#include "AMF_FIR.h"
#include <asm_sprt.h>

// global routines
.global    _AMF_FIR_Render;            ;

.segment /pm SEG_MOD_FAST_CODE;

////////////////////////////////////////////////////////////////////////////////
// FIR filter
//
_AMF_FIR_Render:
    
 // push context on stack
     puts=mode1;
    puts=i11;
    r0=i0; puts=r0;
    r0=i1; puts=r0;
    r0=i2; puts=r0;
    r0=b1; puts=r0;
                  

    i4=r8;                    // i4->*buffers
    
 // initialize input and output samples pointers
    i0=dm(0,i4);            // i1->buffers[0], input
    i2=dm(1,i4);            // i2->buffers[1], output

    i4=r4;                    //i4->testModuleInstance[0]
    
       
 // initialize coefficient pointer
    b1=dm(AMF_FIR_Coefs,i4);                     // b0 & i0 point to filter coefficients
    
    r2=dm(AMF_FIR_FilterSize,i4);                // # taps
    l1 = r2;
    l12 = r2;
    r0 = r2;
    
        
    // fixup innerloop count for SIMD and initial iteration outside loop
    r2=lshift r2 by -1;
    r2 = r2-1;
    r2 = r2-1;


 // initialize states pointers
    b12=dm(AMF_FIR_StateBuffer,i4);                    // b12 points to start of stateBuffer array

    i11=i12;
    r4=i12;
    r0=r0+r4;
    i12=dm(AMF_FIR_StatePtr,i4);                           // i12 points to current location in stateBuffer array
    i13 = r0;                                           // points to "right after" the stateBuffer array

         
    m4 = 2;
    m12 = 2;

        f0=dm(i0,m6);                                    // f0/s0 = in[0]
    lcntr=r12, do AMF_FIR_SampleLoop until lce;
        pm(i12,m13)=f0;                                    // stateBuffer[stateIndex]=in[i];
        bit set MODE1 PEYEN;        
        nop;
        r8=r8-r8,      f4=dm(i1,m4), f0=pm(i12,m12);    // clear acc, r4/s4=coefs[0/1] 
        f12=f0*f4,     f4=dm(i1,m4), f0=pm(i12,m12);    // f12=stateBuffer*coef, r4/s4=next coefs, r0/s0=next states
        lcntr=r2, do AMF_FIR_TapLoop until lce;
AMF_FIR_TapLoop:
            f12=f0*f4, f8=f8+f12, f4=dm(i1,m4), f0=pm(i12,m12); // f12=stateBuffer*coef, r8+=stateBuffer*coef, r4/s4=next coefs, r0/s0=next states
        f12=f0*f4, f8=f8+f12,    f0=pm(i11,m13);            // f12=stateBuffer*coef, r8+=stateBuffer*coef, get first elem of stateBuffer array
        f8=f8+f12,        pm(i13,m13)=f0;                    // f8+=lasts stateBuffer*coef, copy start of stateBuffer array to beyond end (for SIMD reads which cross circ buffer boundary)
        bit clr mode1 PEYEN;                            // Disable PEy:SIMD
        f0<->s8;                                        // get other half of the SIMD (same in SIMD or SISD)
        f8=f8+f0,        f0=dm(i0,m6);                    // sum the two halves of the SIMD, f0=next in
AMF_FIR_SampleLoop:
        dm(i2,m6)=f8, f8=pm(i12,m15);                    // store out, dummy read to update stateIndex for next sample


    dm(AMF_FIR_StatePtr,i4)=i12;                        // i4 points to 1st state

 // reset length registers
     l12 = 0;
    l1 = 0;

 // pop context off stack
    b1 = gets(1);
    i2 = gets(2);
    i1 = gets(3);
    i0 = gets(4);
    i11 = gets(5);
    mode1=gets(6);
    alter(6);
    
//------------------------------------------------------------------------------------
_AMF_FIR_Render.END:
    leaf_exit; // C-rth requires this instead of rts
//------------------------------------------------------------------------------------
    
.endseg;
#endif

⌨️ 快捷键说明

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