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

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




//    Module Name     : AMF_Mixer2x1Smoothed_Render.asm 
//    DSP Processor   : ADSP21161
//    Original Author : Mark A Wilson   
//    Date            : 4/18/03
//====================================================================================
// Processor resources used:
//  52 words pmem INTERNAL
// 325 cycles, tickSize=128 (69 + 4*tickSize/2)
//====================================================================================
// Revision History:
//      4/18/2003 Mark Wilson       Created 
//      7/14/2003 Tim Stilson       Optimized
//      7/30/2003 Tim Stilson       Fixed bug where last output words weren't written
//====================================================================================
// ASSUMPTION: tickSize is always multiple of 2

#if 1   

#include "processor.h"
#include "AMF_Mixer2x1Smoothed.h"
#include "asm_macros.h"
#include "asm_sprt.h"

.global _AMF_Mixer2x1Smoothed_Render;           ;

.segment /pm SEG_MOD_FAST_CODE;
_AMF_Mixer2x1Smoothed_Render:

//====================================================================================
                            
    puts=mode1;
    puts=r5;
    puts=r6;
    puts=r13;
    puts=r14;
    puts=r15;
    R0=I0; puts=R0;
    R0=I1; puts=R0;
    R0=I2; puts=R0;

    i1=r8;                          // i1->*buffers
    
    i0=dm(0,i1);                    // i0->buffers[0]
    i4=dm(1,i1);                    // i4->buffers[1]
    i2=dm(2,i1);                    // i2->buffers[1]

    i1=r4;                          //i1->testModuleInstance[0]
    
    r12 = lshift r12 by -1;
    r12 = r12-1;                            // first iter will be done outside loop

    f5=1.0;                                                  // f5= 1.0
                f4=dm(AMF_Mixer2x1Smoothed_AmpsSmoothing,i1);// f4= float AmpsSmoothing = instance->AmpsSmoothing
    f4=f5-f4,   f0=dm(AMF_Mixer2x1Smoothed_Amp,i1);          // f4 = 1-r, f0=Amp[0]
    nop; // get around a multiplier-stall anomaly

    // fixup (1-r) and r for updating every other sample...  (1-r) -> (1-r)^2, r -> 1-((1-r)^2) (i.e. new(r) = 1 - new(1-r))

    f4=f4*f4,   f1=dm(AMF_Mixer2x1Smoothed_Amp+1,i1);        // f4 = (1-r)^2, f1=Amp[1]
    f5=f5-f4,   f13=dm(AMF_Mixer2x1Smoothed_AmpTarget,i1);   // f5 = (1-new(1-r)), f13=AmpTargets[0]
    f13=f13*f5, f14=dm(AMF_Mixer2x1Smoothed_AmpTarget+1,i1); // f13= AmpTarget[0]*r, f14=AmpTargets[1]
    f14=f14*f5;                                              // f14= AmpTarget[1]*r

    s0=f0;   // the above are done in SISD because we can't do broadcast loads since the struct may be off-chip
    s1=f1;
    s4=f4;
    s13=f13;
    s14=f14;

    bit set mode1 PEYEN;           // Enable PEy:SIMD - 1 cycle needed to take effect
    m4 = 2;

        // Amp = Amps * (1-r) + AmpTargets * r;

        f8=f0*f4,                 f5=dm(i0,m4);     // f8=cur[0]*(1-r), f5=in1[i/i+1]
        f8=f1*f4,   f0=f8+f13,    f6=dm(i4,m4);     // f8=cur[1]*(1-r), f0=cur[0]=cur[0]*(1-r)+target[0]*r, f6=in2[i/i+1]
        f8=f0*f5,   f1=f8+f14;                      // f8=in1*cur[0], f1=cur[1]*(1-r)+target[1]*r
        f15=f1*f6;                                  // f6=in2*cur[1]
        f8=f0*f4,   f15=f8+f15,   f5=dm(i0,m4);     // f15=mix, (next iter, f8=cur[0]*(1-r)), read next in1
    LCNTR=r12, DO AMF_Mixer2x1Smoothed_Render_loop_end UNTIL LCE;
        f8=f1*f4,   f0=f8+f13,    f6=dm(i4,m4);     // f8=cur[1]*(1-r), f0=cur[0]=cur[0]*(1-r)+target[0]*r, f6=in2[i/i+1]
        f8=f0*f5,   f1=f8+f14,    dm(i2,m4)=f15;    // f8=in1*cur[0], f1=cur[1]=cur[1]*(1-r)+target[1]*r, write previous out
        f15=f1*f6;                                  // f15=in2*cur[1]
AMF_Mixer2x1Smoothed_Render_loop_end: 
        f8=f0*f4,   f15=f8+f15,   f5=dm(i0,m4);     // f15=mix, (next iter, f8=cur[0]*(1-r)), read next in1
        
    dm(i2,m4)=f15;                  // write last out
    bit clr mode1 PEYEN;            // Disable PEy:SIMD - 1 cycle needed to take effect
    nop;

    dm(AMF_Mixer2x1Smoothed_Amp,i1)=f0;     // update Amp[0]
    dm(AMF_Mixer2x1Smoothed_Amp+1,i1)=f1;       // update Amp[1]
    
//====================================================================================
//AMF_Mixer2x1Smoothed_Render_epilogue:

    I2=gets(1);
    I1=gets(2);
    I0=gets(3);
    r15=gets(4);
    r14=gets(5);
    r13=gets(6);
    r6=gets(7);
    r5=gets(8);
    mode1=gets(9);
    alter(9);

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

⌨️ 快捷键说明

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