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

📄 skeleton.asm

📁 ADI BF DSP的几种常用的图象滤波汇编优化后的代码
💻 ASM
📖 第 1 页 / 共 2 页
字号:
    A0+=R0.L *R7.L(IS) ||R0=B[P5](Z);
                            // fetch x(1,0) 
    R2=(A0+=R0.L *R7.L)(IS);
    CC=R2==0;               // check if result is zero
    IF !CC R2=R7;           // if not R2==1
    P5-=P3;                 // Initialize P5 to  input array
    B[P4++]=R2;             // store the result
    MNOP||R0=B[P5++](z);    // fetch X(0,0)

    LSETUP(D_FIRST_ROW_ST,D_FIRST_ROW_END)LC0=P1>>1;
                            // loop counter COL-2 
D_FIRST_ROW_ST:
        A0=R0.L *R7.L(IS) ||R0=B[P5++](z);
                            // fetch X(0,1) 
        A1=R0.L * R7.L, A0+=R0.L*R7.L(IS)||R0=B[P5++](z);
                            // fetch X(0,2) 
        A1+=R0.L*R7.L,A0+=R0.L*R7.L(IS)||R0=B[P5](Z);
                            // fetch x(0,3) 
        P5=P5+P1;               // increment P5 to fetch x(1,1)
        A1+=R0.L*R7.L(IS) ||R0=B[P5++](Z);
                            // fetch X(1,1) 
        R2=(A0+=R0.L *R7.L)(IS)||R0=B[P5](Z);
        P5-=P3;             // Decrement P5 to process next data
        R1=(A1+=R0.L*R7.L)(IS)||R0=B[P5++](Z);
        CC=R2==0;           // check if result is 0
        IF !CC R2=R7;       // if not r2==1
        B[P4++]=R2;         // store the result
        CC=R1==0;
        IF !CC R1=R7;
D_FIRST_ROW_END:
        B[P4++]=R1;
                            // store second result 
    A0=R0.L*R7.L (IS) ||R0=B[P5](z);
                            // fetch x(0,n-1) 
    P5=P5+P3;                     
    A0+=R0.L * R7.L (IS)|| R0=B[P5++](z) ;
                            // fetch x(1,N-1) 
    R2=(A0+=R0.L *R7.L)(IS) ;            
    CC=R2==0;               // check if result is zero
    IF !CC R2=R7;                             
    P5=M2;                  // Initialize P5 to starting of erosion output array
    B[P4++]=R2;             // store output of last element in first row
    
//////////////// DILATION  MIDDLE  LOOP   /////////////////////////////////////
    P2=M1;                  // ROW-2

    LSETUP(D_ROW_ST,D_ROW_END)LC0=P2;
                            // loop counter == ROW-2 (M-2) 
    P2=R3;                  // Initialized to 2*COL
    MNOP||R0=B[P5](z);      // fetch x(0,0)
    MNOP;                   // MNOP to remove IAU stall
D_ROW_ST:
        P5=P5+P3; // adjust P5 to next row
        A0=R0.L*R7.L(IS)||R0=B[P5++](z) ;
                            // fetch x(1,0) 
        A0+=R0.L* R7.L(IS)|| R0=B[P5++](z);
                            // fetch x(1,1) 
        P5=P5+P1;               // adjust P5 to next row
        A0+=R0.L*R7.L (IS)||R0=B[P5++](z);
                            // fetch first element of the row 
        P5-=P2;             // P5 modified to starting of the row
        R2=(A0+=R0.L*R7.L)(IS)|| R0=B[P5++](Z);
        CC=R2==0;
        IF !CC R2=R7;
        B[P4++]=R2 ;        // store the output
    
//////////////////// DILATION  CORE LOOP  ////////////////////////////////////
// Here data is processed to get two pixels output at a time
        LSETUP(D_COL_ST,D_COL_END)LC1=P1>>1;
                            // loop counter ==(COL-2)/2 
D_COL_ST:   A0=R0.L*R7.L(IS) ||R0=B[P5](z);
                            // fetch x(0,2) 
            MNOP||R3=W[P5++P1](Z);
                            // move  P5 to starting of next row
            A1=R0.L * R7.L(IS)||R0=B[P5++](z);
                            // fetch x(1,0) 
            A0+=R0.L *R7.L(IS)|| R0=B[P5++](z) ;
                            // fetch x(1,1) 
            A1+=R0.L * R7.L,A0+=R0.L *R7.L(IS) ||R0=B[P5++](z);
                            // fetch x(1,2) 
            A1+= R0.L *R7.L ,A0+=R0.L *R7.L(IS)||R0=B[P5++](z);
                            // fetch x(1,3) 
            P5=P5+P0;               // move P5 to starting of next row
            A1+= R0.L *R7.L(IS)||R0=B[P5++](z);
                            // fetch x(2,0) 
            R2=(A0+=R0.L*R7.L)(IS)  ||R0=B[P5++](z);
                            // fetch x(2,1) 
            P5-=P2;         // modify P5 to process next set of data
            R3=(A1+=R0.L *R7.L)(IS)||R0=B[P5++](Z);
            CC=R2==0;       // compare r2  with threshold
            IF !CC R2=R7;   // if false r2==1
            B[P4++]=R2;     // store first output
            CC=R3==0;       // compare r3 with zero
            IF !CC R3=R7;   // if false  r3==1
D_COL_END:  B[P4++]=R3;
                            // store next output 
        P5=P5+P1;           // increment P5
        A0=R0.L *R7.L (IS)||R0=B[P5++](z);
                            // fetch x(0,N-2) 
        A0+=R0.L *R7.L (IS)||R0=B[P5](z);
                            // fetch  X(1,N-2) 
        P5=P5+P3;           // increment P5 to next row
        A0+=R0.L*R7.L(IS) ||R0=B[P5++](z) ;
                            // fetch  X(1,N-1) 
        P5-=P2;             // modify P5 to starting of previous  row
        R2=(A0+=R0.L *R7.L)(IS)||R0=B[P5](Z);
                            // fetch h01 
        CC=R2==0;
        IF !CC R2=R7;  
D_ROW_END:
        B[P4++]=R2;   
    
///////////////////  DILATION LAST ROW   //////////////////////////////////
    P5=P5+P3;               // modify P5 to next row
    A0=R0.L *R7.L(IS)||R0=B[P5++](Z);
                            // fetch x(M-2,1) 
    A0+=R0.L*R7.L(IS)||R0=B[P5](z);
                            // fetch x(M-1,0) 
    P5-=P3;      
    R2=(A0+=R0.L *R7.L) (IS)||R0=B[P5++](z);
                            // fetch x(M-2,0) 
    CC=R2==0;
    IF !CC R2=R7;
    B[P4++]=R2;             // store the result
    MNOP;

    LSETUP(D_LAST_ROW_ST,D_LAST_ROW_END)LC0=P1>>1;
D_LAST_ROW_ST:
        A0=R0.L *R7.L(IS) ||R0=B[P5](z) ;
                            // fetch x(M-1,0) 
        P5=P5+P1; 
        A1=R0.L *R7.L(IS) ||R0=B[P5++](Z);
                            // fetch x(M-1,1) 
        A0+=R0.L *R7.L(IS)||R0=B[P5++](z);
                            // fetch x(M-1,2) 
        A1+=R0.L *R7.L,A0+=R0.L*R7.L(IS)||R0=B[P5++](Z);
        A1+=R0.L*R7.L,R2=(A0+=R0.L*R7.L)(IS)|| R0=B[P5](Z);
        P5-=P3;
        R1=(A1+=R0.L *R7.L)(IS)||R0=B[P5++](Z);
                            // fetch h00 
        CC=R2==0;
        IF !CC R2=R7;
        B[P4++]=R2;         // store the result
        CC=R1==0;
        IF !CC R1=R7;
D_LAST_ROW_END:
        B[P4++]=R1;
    
    P5=P5+P1;               // last output processed here
    A0=R0.L*R7.L(IS)||R0=B[P5++](z);
                            // fetch  x(m-1,N-2) 
    A0+=R0.L *R7.L (IS)||R0=B[P5](z);
                            // fetch  x(m-1,N-1) 
    R2=(A0+=R0.L *R7.L )(IS);
    CC=R2==0;
    IF !CC R2=R7;
    B[P4++]=R2 ;            // store the final output pixel
    
// In this loop Difference between EROSION and OPEN 
//function calculated and ORed with
                            // Previous partial result
    P3=M0;                  // Number of elements to process i.e ROW * COL
    P0=I3;
    P4=SP;                  // Address where result of OPEN is stored
    P1=I0;                  // Address where result of EROSION is stored
    R0=B[P1++](Z);          // fetch first element of EROSION result
    R1=B[P4++](Z);          // fetch first element of OPEN  result
    P2=P0;     
    R3=B[P2++](Z); 
    
    LSETUP(DIFF_ST,DIFF_END)LC0=P3;
DIFF_ST:
        R2=R1-R0(NS)|| R0=B[P4++](Z);
                            // En(A)-OPEN(EN(A),B) 
        R2=ABS R2 ||R1=B[P1++](Z);
        R2=R3|R2;           // OR with previous result
        R3=B[P2++](Z);
DIFF_END:
        B[P0++]=R2;         // store the result
    
    SP=SP+P3;               // Restore stack pointer
    (R7:4,P5:3)=[SP++];     // POP R7-4 and P5-3
    RTS;
    NOP;                    // To avoid one stall if LINK or UNLINK happens to 
                            //be the  next instruction in the memory.

⌨️ 快捷键说明

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