www.pudn.com > three_step_search.rar > init_tss.asm


/******************************************************************************* 
Copyright(c) 2000 - 2002 Analog Devices. All Rights Reserved. 
Developed by Joint Development Software Application Team, IPDC, Bangalore, India 
for Blackfin DSPs  ( Micro Signal Architecture 1.0 specification). 
 
By using this module you agree to the terms of the Analog Devices License 
Agreement for DSP Software.  
******************************************************************************** 
Module Name     : init_tss.asm 
Label Name      : __init_tss 
Version         :   1.0 
Change History  : 
 
                Version     Date          Author            Comments 
                1.0         04/12/2001    Vijay             Original  
 
Description     : This routine initializes the tss_struct structure, which is 
                  used by the TSS motion vector estimation code. The  
                  initialization is done as follows: 
 
                  tss_struct tss; 
                  tss.hmv[9] = {0, -SS, 0, SS, -SS, SS, -SS, 0, SS}; 
                  tss.vmv[9] = {0, -SS, -SS, -SS, 0,0, SS, SS, SS}; 
                  tss.modifier[0] = 0; 
                  for(i=1;i<9;i++) 
                  { 
                    tss.modifier[i]   = tss.vmv[i]*WINWIDTH+tss.hmv[i]; 
                    tss.modifier[i+8] = (tss.vmv[i]/2)*WINWIDTH+(tss.hmv[i]/2);  
                    tss.modifier[i+16] = (tss.vmv[i]/4)*WINWIDTH+(tss.hmv[i]/4); 
                  } 
                  where SS is the initial step size 
                  WINWIDTH is the width of the reference window 
                  The / operator represents an integer division 
 
Prototype       : void _init_tss(tss_struct *ptr_tss, int WINWIDTH, int SS);  
 
Registers used  : R0-R3, I0-I3, M0, M1, L0-L3, P0, P1. 
 
Performance     : 
                Code size   : 192 Bytes. 
                Cycle count : 154 Cycles. 
*******************************************************************************/ 
.section L1_code; 
.align 8; 
.global __init_tss; 
.extern _vhpel; 
.extern _hhpel; 
 
__init_tss: 
 
    L0 = 0; 
    L1 = 0; 
    L2 = 0; 
    L3 = 0; 
    I2 = R0; 
    I3 = R0; 
    P1 = R0; 
    I0.L = _vhpel; 
    I0.H = _vhpel; 
    I1.L = _hhpel; 
    I1.H = _hhpel; 
    M0 = 18; 
    M1 = 16; 
    P0 = 9; 
    P1 += 36; 
 
    LSETUP(ST_MOD_STEP1, END_MOD_STEP1) LC0 = P0; 
    I3 += M0 || R0.L = W[I0++];  
ST_MOD_STEP1: 
        R0.L = R2.L*R0.L (IS) || R3.L = W[I1++];     
        R3.L = R2.L*R3.L (IS) || W[I2++] = R0.L; 
                            // Store vmv[i]  
        R0.L = R1.L*R0.L (IS) || W[I3++] = R3.L; 
                            // Store hmv[i]  
        R3.L = R0.L + R3.L (S) || R0.L = W[I0++];    
END_MOD_STEP1: 
        W[P1++] = R3;       // Store modifier[i] 
    P0 = 8; 
    R2 = R2 >> 1 || I0 -= M0; 
    I1 -= M1 || R0.L = W[I0++]; 
 
    LSETUP(ST_MOD_STEP2, END_MOD_STEP2) LC0 = P0;                
ST_MOD_STEP2: 
        R0.L = R2.L*R0.L (IS) || R3.L = W[I1++];     
        R3.L = R2.L*R3.L (IS); 
        R0.L = R1.L*R0.L (IS); 
        R3.L = R0.L + R3.L (S) || R0.L = W[I0++]; 
END_MOD_STEP2: 
        W[P1++] = R3;       // Store modifier[i] 
    R2 = R2 >> 1 || I0 -= M0; 
    I1 -= M1 || R0.L = W[I0++]; 
 
    LSETUP(ST_MOD_STEP3, END_MOD_STEP3) LC0 = P0; 
ST_MOD_STEP3: 
        R0.L = R2.L*R0.L (IS) || R3.L = W[I1++];     
        R3.L = R2.L*R3.L (IS); 
        R0.L = R1.L*R0.L (IS); 
        R3.L = R0.L + R3.L (S) || R0.L = W[I0++];    
END_MOD_STEP3: 
        W[P1++] = R3;       // Store modifier[i] 
    RTS; 
__init_tss.end: