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

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




//    Module Name     : AMF_BiquadSmoothed_Render.asm 
//    DSP Processor   : ADSP21161
//    Original Author : Sami Saab, ported to VA by Tim Stilson    
//    Date               : 6/20/03
//====================================================================================
// Processor resources used:
//  59+31 words pmem INTERNAL (+31 for _AMF_BiquadSmoothedCoefUpdateOdd)
//  780 cycles for tickSize=128 (140 + 5*tickSize) (includes call to coef smoother)
// (SIMD NOT USED) (simd used in _AMF_BiquadSmoothedCoefUpdateOdd)
//====================================================================================

#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/20/03 Tim Stilson:  created from AMF_Biquad_Render.asm
    // 6/23/03 Tim Stilson:  debugged call to coef update fn and verified by ear
    // 8/15/03 Tim Stilson:  some code-size optimizations
    //
    ////////////////////////////////////////////////////////////////////////////////

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

// global routines
.global    _AMF_BiquadSmoothed_Render;    
.extern _AMF_BiquadSmoothedCoefUpdateOdd;

.segment /pm SEG_MOD_FAST_CODE;

////////////////////////////////////////////////////////////////////////////////
// BiquadSmoothed filter

_AMF_BiquadSmoothed_Render:
    
    
    ///////////////////////////// do the coef smoothing    
    // remember my inputs
    puts = r4;
    puts = r8;
    puts = r12;
    
    i4=r4;                    //i4->testModuleInstance[0]
    
    r0=dm(AMF_BiquadSmoothed_CoefsSmoothing,i4);
    puts = r0;
    
    r8=dm(AMF_BiquadSmoothed_Coefs,i4);                    
    r4=dm(AMF_BiquadSmoothed_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;
    
    bit set mode1 CBUFEN;              // enable circular buffers
                  
    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
    b12=dm(AMF_BiquadSmoothed_Coefs,i4); // b12 & i12 point to filter coefficients
    l12 = 5;                           // l12 = number of coefficients
    
 // initialize states pointers
    b4=dm(AMF_BiquadSmoothed_State,i4);  // i4 points to 1st state
    l4 = 2;                            // l4 = number of filter states
    m4 = 2;
    
    r3 = r12;                     // r3 = number of output samples
                      
////////////////////////////////////////////////////////////////////////////////
 //                                         f9 = load input,  f0 = a1
                                            f9 = dm(i1,m6),   f0 = pm(i12,m14);
                                            
 //                                         f5 = load state1, f1 = a2
                                            f5 = dm(i4,m6),   f1 = pm(i12,m14);
                                            
 //     f12 = a1*state1,                    f6 = load state2, f4 = b0
        f12 = f0 * f5,                      f6 = dm(i4,m4),   f4 = pm(i12,m14);
        
 //     f12 = a2*state2, f8 = f9+a1*state1,                   f2 = b1
        f12 = f1 * f6,   f8 = f9 + f12,                       f2 = pm(i12,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(i12,m14);
        
     // f8 = b0*new state,                  store new state,  f0 = a1
        f8 = f4 * f5,                       dm(i4,m6) = f5,   f0 = pm(i12,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(i12,m14);
        
     // f12 = a1*state1, f8 = f8+b2*state2, f9 = load input,  f4 = b0
        f12 = f0 * f5,   f8 = f8 + f12,     f9 = dm(i1,m6),   f4 = pm(i12,m14);
        
     // f12 = a2*state2, f8 = f9-a1*state1, store output,     f2 = b1
        f12 = f1 * f6,   f8 = f9 + f12,     dm(i2,m6) = f8,   f2 = pm(i12,m14);
////////////////////////////////////////////////////////////////////////////////

 // reset length registers
    l4  = 0; l12 = 0;
    
 // pop context off stack
    i2 = gets(1);
    i1 = gets(2);
    r9 = gets(3);
    r6 = gets(4);
    r5 = gets(5);
    r3 = gets(6);
    mode1=gets(7);
    alter(7);

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

⌨️ 快捷键说明

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