www.pudn.com > three_step_search.rar > test_three_step_search.c


/******************************************************************************* 
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.  
******************************************************************************** 
File name   : test_three_step_search.c 
Description : This C file is used to test the Three step search motion  
              estimation. The target and reference data are generated. It  
              initializes the input/output structure to be passed to the TSS  
              routine and calls it. The output is checked against the expected  
              result. 
*******************************************************************************/ 
#include  
#include "ttss.h" 
 
void three_step_search(); 
void _init_tss(); 
void (*f1)(); 
int cycle_count[10]; 
int error_flag = 0; 
 
main() 
{ 
    int i,j,p; 
    short *exp_vmv, *exp_hmv; 
 
    f1 = three_step_search; 
 
    tss_in_out.winwidth = WINWIDTH; 
    tss_in_out.step_size = SS; 
    tss_in_out.ptr_tss = &tss; 
 
//Test case 1 : 
 
/****************** Initialization of tss specific structure ******************/ 
    _init_tss(&tss, WINWIDTH, SS);  
/******************************************************************************/ 
 
    if (SS == 4) 
    { 
        exp_vmv = exp_vmv_4; 
        exp_hmv = exp_hmv_4; 
    } 
    else if (SS == 9) 
    { 
        exp_vmv = exp_vmv_9; 
        exp_hmv = exp_hmv_9; 
    } 
    else 
    { 
//      printf("Test results not available (Specify 4, or 9)\n"); 
//      exit(0); 
    } 
 
/**************** Target and Reference block initialization *****************/ 
    for(i=0;i<16;i++) 
        for(j=0;j<16;j++) 
            target[i*16+j] = 100; 
 
    for(i = 0;i < ROWS; i++) 
        for(j = 0;j < COLUMNS; j++) 
            reference[i*COLUMNS+j] = 0; 
 
    for(i = 0;i < 16; i++) 
        for(j = 32;j < 32 + 16; j++) 
        { 
            reference[i*COLUMNS+j] = 80; 
            reference[(i+16)*COLUMNS+(j-16)] = 80;   
            reference[(i+32)*COLUMNS+(j+32)] = 80;   
        } 
 
    ptr = reference + 16*(COLUMNS+1) - (SR*(COLUMNS+1)); 
    for(p=0;p<4;p++) 
    { 
        for(i=0;i