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

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




//    Module Name     : AMF_BiquadSmoothed_S_Render.asm 
//    DSP Processor   : ADSP21161
//    Original Author : Sami Saab, ported to VA by Tim Stilson    
//    Date               : 6/17/03
//====================================================================================
// Processor resources used:
//  65+31 words pmem INTERNAL (+31 for _AMF_BiquadSmoothedCoefUpdateOdd) 
//  787 cycles for tickSize=128 (147 + 5*tickSize) (includes call to coef smoother)
// (SIMD used)
//====================================================================================

#if 1

    ////////////////////////////////////////////////////////////////////////////////
    // File Name:   Biquad_float_asm.asm
    // Author:      Sami Saab, Analog Devices, (408) 382-3348
    // Description: This file implements the BiquadFloat filter
    ////////////////////////////////////////////////////////////////////////////////

    ////////////////////////////////////////////////////////////////////////////////
    //
    // History:
    //
    // 6/23/03 Tim Stilson: created from AMF_Biquad2a_Render.asm
    // 8/15/03 Tim Stilson: some code-size optimizations
    //
    ////////////////////////////////////////////////////////////////////////////////

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

// global routines
.global    _AMF_BiquadSmoothed_S_Render;    
.extern _AMF_BiquadSmoothedCoefUpdateOdd;

.segment /pm SEG_MOD_FAST_CODE;

////////////////////////////////////////////////////////////////////////////////
// BiquadSmoothed_S filter

_AMF_BiquadSmoothed_S_Render:
    

    //////////////////////////////// do the coef smoothing    
    // remember my inputs
    puts = r4;
    puts = r8;
    puts = r12;
    
    i4=r4;                    //i4->testModuleInstance[0]
    
    r0=dm(AMF_BiquadSmoothed_S_CoefsSmoothing,i4);
    puts = r0;
    
    r8=dm(AMF_BiquadSmoothed_S_Coefs,i4);                    
    r4=dm(AMF_BiquadSmoothed_S_CoefsTarget,i4);                    

    r12 = 5; // # of coefs to smooth
    
    cjump _AMF_BiquadSmoothedCoefUpdateOdd(db);
    dm(i7,m7)=r2;
    dm(i7,m7)=pc;
    alter(1); // eat up the stack location used by the 4th argument to that call

    // restore my inputs
    r12 = gets(1);
    r8 = gets(2);
    r4 = gets(3);
    alter(3);
    
    //////////////////////////////// now on to the rest of the thing
     // push context on stack

     puts = mode1;
    puts = r3;
    puts = r5;
    puts = r6;
    puts = r9;
    r0 = i1; puts = r0;
    r0 = i2; puts = r0;
    r0 = m2; puts = r0;
    puts = i9; 

    bit set mode1 PEYEN |                // enable Y processing element
                  BDCST9;                // enable broadcast loads on i9

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

    i4=r4;                    //i4->testModuleInstance[0]
    
       
 // initialize coefficient pointer
    b9=dm(AMF_BiquadSmoothed_S_Coefs,i4);    // b12 & i12 point to filter coefficients
    l9 = 5;                               // l12 = number of coefficients
    
 // initialize states pointers
    b4=dm(AMF_BiquadSmoothed_S_State,i4);                          // i4 points to 1st state
    l4 = 4;                                // l4 = number of filter states
    m2 = 2; m4 = 4;
    
    r3 = r12;                     // r3 = number of output samples
                      
////////////////////////////////////////////////////////////////////////////////
 //                                         f9 = load input,  f0 = a1
                                            f9 = dm(i1,m2),   f0 = pm(i9,m14);
                                            
 //                                         f5 = load state1, f1 = a2
                                            f5 = dm(i4,m2),   f1 = pm(i9,m14);
                                            
 //     f12 = a1*state1,                    f6 = load state2, f4 = b0
        f12 = f0 * f5,                      f6 = dm(i4,m4),   f4 = pm(i9,m14);
        
 //     f12 = a2*state2, f8 = f9+a1*state1,                   f2 = b1
        f12 = f1 * f6,   f8 = f9 + f12,                       f2 = pm(i9,m14);
        
    lcntr = r3, do (pc,5) until lce;
    
     // f12 = b1*state1, f5 = f8+a2*state2 = new state,       f3 = b2
        f12 = f2 * f5,   f5 = f8 + f12,                       f3 = pm(i9,m14);
        
     // f8 = b0*new state,                  store new state,  f0 = a1
        f8 = f4 * f5,                       dm(i4,m2) = f5,   f0 = pm(i9,m14);
        
     // f12 = b2*state2, f8 = f8+b1*state1, f6 = load state2, f1 = a2
        f12 = f3 * f6,   f8 = f8 + f12,     f6 = dm(i4,m4),   f1 = pm(i9,m14);
        
     // f12 = a1*state1, f8 = f8+b2*state2, f9 = load input,  f4 = b0
        f12 = f0 * f5,   f8 = f8 + f12,     f9 = dm(i1,m2),   f4 = pm(i9,m14);
        
     // f12 = a2*state2, f8 = f9-a1*state1, store output,     f2 = b1
        f12 = f1 * f6,   f8 = f9 + f12,     dm(i2,m2) = f8,   f2 = pm(i9,m14);
////////////////////////////////////////////////////////////////////////////////

    bit clr mode1 PEYEN | BDCST9;              // disable circular buffers and Y processing
        
 // reset length registers
    l4  = 0; l9 = 0;
    
 // pop context off stack
    i9 = gets(1);
    m2 = gets(2);
    i2 = gets(3);
    i1 = gets(4);
    r9 = gets(5);
    r6 = gets(6);
    r5 = gets(7);
    r3 = gets(8);
    mode1=gets(9);
    alter(9);
    
//------------------------------------------------------------------------------------
_AMF_BiquadSmoothed_S_Render.END:
    leaf_exit; // C-rth requires this instead of rts
//------------------------------------------------------------------------------------
    
.endseg;
#endif

⌨️ 快捷键说明

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