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

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




//    Module Name     : AMF_FIR_S_Render.asm 
//    DSP Processor   : ADSP21161
//    Original Author : Tim Stilson    
//    Date               : 7/1/03
//====================================================================================
// Processor resources used:
// 47 words pmem INTERNAL
// 1225 cycles (3 taps) (MINIMUM # taps)
// 1352 cycles (4 taps)
// 1229 cycles (5 taps)
// 1613 cycles (8 taps)
// 2635 cycles (16 taps)
// 8780 cycles (64 taps)
// cycles ~= 74+(TICKSIZE*(4 + NTAPS + 2*(NTAPS<5))
// (SIMD used)
//====================================================================================

#if 1

    ////////////////////////////////////////////////////////////////////////////////
    //
    // History:
    //
    // 7/1/03  Tim Stilson: created based on AMF_FIR2b_Render.asm
    // 8/15/03 Tim Stilson: some code-size optimizations
    //
    ////////////////////////////////////////////////////////////////////////////////

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

// global routines
.global    _AMF_FIR_S_Render;            ;

.segment /pm SEG_MOD_FAST_CODE;

////////////////////////////////////////////////////////////////////////////////
// FIR_S filter
//
_AMF_FIR_S_Render:
    
 // push context on stack
     puts=mode1;
     puts=m11;
    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_S_Coefs,i4);                     // b0 & i0 point to filter coefficients
    
    r2=dm(AMF_FIR_S_FilterSize,i4);                // # taps
    l1 = r2;
    r0=r2+r2;    // state buffer length = 2*N
    l12 = r0;
    
    // fixup innerloop count for SIMD and initial iteration outside loop
    r2 = r2-1;
    r2 = r2-1;

 // initialize states pointers
    b12=dm(AMF_FIR_S_StateBuffer,i4);                   // b12 points to start of state buffer
    i12=dm(AMF_FIR_S_StatePtr,i4);                         // i12 points to current state

     
    bit set MODE1 BDCST1 | PEYEN;        
    m4 = 2;
    m12 = 2;
    m11 = -2;

        f0=dm(i0,m4);                                    // f0/s0 = in[0]
    lcntr=r12, do AMF_FIR_S_SampleLoop until lce;
        r8=r8-r8,      f4=dm(i1,m6), pm(i12,m12)=f0;    // clear acc, r4/s4=coefs[0], StateBuffer[stateIndex/+1]=in[i/i+1];
        f12=f0*f4,     f4=dm(i1,m6), f0=pm(i12,m12);     // f12=StateBuffer*coef, r4/s4=next coef, r0/s0=next states
        lcntr=r2, do AMF_FIR_S_TapLoop until lce;
AMF_FIR_S_TapLoop:
            f12=f0*f4, f8=f8+f12, f4=dm(i1,m6), f0=pm(i12,m12); // f12=StateBuffer*coef, r8+=StateBuffer*coef, r4/s4=next coef, r0/s0=next states
        f12=f0*f4, f8=f8+f12;                            // f12=StateBuffer*coef, r8+=StateBuffer*coef
        f8=f8+f12,    f0=dm(i0,m4);                        // r8+= last StateBuffer*coef, f0 = next in
AMF_FIR_S_SampleLoop:
        dm(i2,m4)=f8, f8=pm(i12,m11);                    // store out, dummy read to update stateIndex for next sample

    bit clr mode1 BDCST1 | PEYEN;    // Disable PEy:SIMD
     l12 = 0;

    dm(AMF_FIR_S_StatePtr,i4)=i12;                      // i4 points to 1st state
    l1 = 0;

 // pop context off stack
    b1 = gets(1);
    i2 = gets(2);
    i1 = gets(3);
    i0 = gets(4);
    m11 = gets(5);
    mode1=gets(6);
    alter(6);

//------------------------------------------------------------------------------------
_AMF_FIR_S_Render.END:
    leaf_exit; // C-rth requires this instead of rts
//------------------------------------------------------------------------------------
    
.endseg;
#endif

⌨️ 快捷键说明

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