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

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




//    Module Name     : AMF_Biquad_Render.asm 
//    DSP Processor   : ADSP21161
//    Original Author : Sami Saab, ported to VA by Tim Stilson    
//    Date               : 6/17/03
//====================================================================================
// Processor resources used:
//  53 words pmem INTERNAL
//  728 cycles for tickSize=128 (88 + 5*tickSize)
// (SIMD NOT 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/17/03 Tim Stilson:
    //      - changed input arguments to match AMF conventions and lookup into state structure.
    //      - removed writeback of final state pointer.  Now only works with even tick lengths, 
    //        but tick size is defined to be a power of two, so that works out.
    // 8/15/03 Tim Stilson:
    //    - some code-size optimizations
    //
    ////////////////////////////////////////////////////////////////////////////////

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

// global routines
.global    _AMF_Biquad_Render;            ;

.segment /pm SEG_MOD_FAST_CODE;

////////////////////////////////////////////////////////////////////////////////
// biquad filter
//
// r4     = pointer to module instance
// r8     = pointer to buffers array
// r12    = number of samples to process
// i4 + 0 = pointer to input samples
// i4 + 1 = pointer to output samples
// 
// f0  = a1
// f1  = a2
// f2  = b1
// f3  = b2, r3 = number of output samples
// f4  = b0
// f5  = state1
// f6  = state2
// i1  = pointer to input samples
// i2  = pointer to output samples
// i4  = filter states
// i12 = pointer to coefficients

_AMF_Biquad_Render:
    
 // push context on stack
     puts = mode1;
    puts = r3;
    puts = r5;
    puts = r6;
    puts = r9;
    r0 = i1; puts = r0;
    r0 = i2; puts = r0;
    r0 = i3; puts = r0;
    r0 = m2; 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
    m4=AMF_Biquad_Coefs;
    b12=dm(m4,i4);                     // b12 & i12 point to filter coefficients
//      r4=dm(m4,i4);
//    b12 = r4;
    l12 = 5;                           // l12 = number of coefficients
    m12 = 1;
    
 // initialize states pointers
    m4=AMF_Biquad_State;
    b4=dm(m4,i4);                      // i4 points to 1st state
    l4 = 2;                            // l4 = number of filter states
    m2 = 1; m4 = 2;
    
    r3 = r12;                     // r3 = number of output samples
                      
////////////////////////////////////////////////////////////////////////////////
 //                                         f9 = load input,  f0 = a1
                                            f9 = dm(i1,m2),   f0 = pm(i12,m12);
                                            
 //                                         f5 = load state1, f1 = a2
                                            f5 = dm(i4,m2),   f1 = pm(i12,m12);
                                            
 //     f12 = a1*state1,                    f6 = load state2, f4 = b0
        f12 = f0 * f5,                      f6 = dm(i4,m4),   f4 = pm(i12,m12);
        
 //     f12 = a2*state2, f8 = f9+a1*state1,                   f2 = b1
        f12 = f1 * f6,   f8 = f9 + f12,                       f2 = pm(i12,m12);
        
    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,m12);
        
     // f8 = b0*new state,                  store new state,  f0 = a1
        f8 = f4 * f5,                       dm(i4,m2) = f5,   f0 = pm(i12,m12);
        
     // 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,m12);
        
     // f12 = a1*state1, f8 = f8+b2*state2, f9 = load input,  f4 = b0
        f12 = f0 * f5,   f8 = f8 + f12,     f9 = dm(i1,m2),   f4 = pm(i12,m12);
        
     // f12 = a2*state2, f8 = f9-a1*state1, store output,     f2 = b1
        f12 = f1 * f6,   f8 = f9 + f12,     dm(i2,m2) = f8,   f2 = pm(i12,m12);
////////////////////////////////////////////////////////////////////////////////

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

 // pop context off stack
    m2 = gets(1);
    i3 = 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_Biquad_Render.END:
    leaf_exit; // C-rth requires this instead of rts
//------------------------------------------------------------------------------------
    
.endseg;
#endif

⌨️ 快捷键说明

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