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

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




//    Module Name     : AMF_BiquadSmoothedCoefUpdate.asm 
//    DSP Processor   : ADSP21161
//    Original Author : Tim Stilson    
//    Date               : 6/20/03
//====================================================================================
// Processor resources used:
//    words pmem INTERNAL
//  cycles for tickSize=128
// (simd NOT USED)
//====================================================================================

#if 1

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

// global routines
.global    _AMF_BiquadSmoothedCoefUpdateEven;
.global    _AMF_BiquadSmoothedCoefUpdateOdd;

.segment /pm SEG_MOD_FAST_CODE;

////////////////////////////////////////////////////////////////////////////////
//
// r4     = pointer to target coefs (pm)
// r8     = pointer to current coefs (pm)
// r12    = length of coef set (must be even)
// i6 + 1 = smoothing coef

_AMF_BiquadSmoothedCoefUpdateEven:
    
    puts = mode1;
    puts = i9;

    r0 = dm(1,i6);                // coef
    s0 = r0;

    i9=r4;                    // targets
    i12=r8;                    // currents

    
    m12 = 2;
    i13 = i12;
    r12 = lshift r12 by -1; 

    bit set mode1 PEYEN;              // enable SIMD 
    r12 = r12 - 1;    // first iteration of loop is done outside, also do the "nop" for the peyen

    f1 = 1.0;
    f1 = f1 - f0;                // 1-coef
                                       f2 = pm(i9,m12);        // target
            f8 = f0*f2,                f4 = pm(i12,m12);        // target*coef, get current
            f4 = f1*f4,                f2 = pm(i9,m12);        // current*(1-coef), get next target
            f8 = f8+f4,                f4 = pm(i12,m12);        // target*coef + current*(1-coef), get next current
    lcntr = r12, do loopEnd until lce;
            f8 = f0*f2,                pm(i13,m12)=f8;            // target*coef, write prevoius out
            f4 = f1*f4,                f2 = pm(i9,m12);        // current*(1-coef), get next target
loopEnd:    f8 = f8+f4,                f4 = pm(i12,m12);        // target*coef + current*(1-coef), get next current
                                    pm(i13,m12) = f8;        // write last out

    bit clr mode1 PEYEN;              // disable SIMD

    i9 = gets(1);
    mode1=gets(2);
    alter(2);
//------------------------------------------------------------------------------------
_AMF_BiquadSmoothedCoefUpdateEven.END:
    leaf_exit; // C-rth requires this instead of rts
//------------------------------------------------------------------------------------


/////////////////////////////////////
//
// This one is for when the caller knows the count is odd
//
/////////////////////////////////////
// r4     = pointer to target coefs (pm)
// r8     = pointer to current coefs (pm)
// r12    = length of coef set (must be odd)
// i6 + 1 = smoothing coef

 _AMF_BiquadSmoothedCoefUpdateOdd:
     puts = mode1;
    puts = i9;

    r0 = dm(1,i6);                // coef
    s0 = r0;

    i9=r4;                    // targets
    i12=r8;                    // currents

    
    m12 = 2;
    i13 = i12;
    r12 = r12 - 1;
    r12 = lshift r12 by -1; // r12 = (even part of count)/2

    bit set mode1 PEYEN;              // enable SIMD 
    r12 = r12 - 1;    // first iteration of loop is done outside, also do the "nop" for the peyen
    
    f1 = 1.0;
    f1 = f1 - f0;                // 1-coef
                                       f2 = pm(i9,m12);        // target
            f8 = f0*f2,                f4 = pm(i12,m12);        // target*coef, get current
            f4 = f1*f4,                f2 = pm(i9,m12);        // current*(1-coef), get next target
            f8 = f8+f4,                f4 = pm(i12,m12);        // target*coef + current*(1-coef), get next current
    lcntr = r12, do loopEnd2 until lce;
            f8 = f0*f2,                pm(i13,m12)=f8;            // target*coef, write prevoius out
            f4 = f1*f4,                f2 = pm(i9,m12);        // current*(1-coef), get next target
loopEnd2:    f8 = f8+f4,                f4 = pm(i12,m12);        // target*coef + current*(1-coef), get next current
                                    pm(i13,m12) = f8;        // write last out

    bit clr mode1 PEYEN;              // disable SIMD
    nop;

    // Do the last one w/o SIMD, current would already have been loaded in previous loop

                // re-doing the target read because a 21161N Shadow Write Buffer anomaly can cause the
                // last target read in the above loop to get the wrong value in some situations
            f4 = f1*f4,                f2 = pm(-2,i9);            // current*(1-coef), f2=target
            f8 = f0*f2;                                        // target*coef
            f8 = f8+f4;                                        // target*coef + current*(1-coef)
                                    pm(i13,m12) = f8;        // write last out

    i9 = gets(1);
    mode1=gets(2);
    alter(2);

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

⌨️ 快捷键说明

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