www.pudn.com > Blackfin_Mpeg_2_4.zip > test_full_search_mpeg2.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_full_search_mpeg2.c 
Description : This is the test file for the testing of functionality of 
              of full_search_mpeg2. 
*******************************************************************************/ 
#include  
#include "results.h" 
 
extern void _full_search_mpeg2(unsigned char *, unsigned char *, signed char *, 
                               signed char *, int, int, int); 
 
int error_flag = 0; 
void (*f1)(); 
int cycle_count[10]; 
 
void _full_search_mpeg2(); 
 
main() 
{ 
    char *exp_u, *exp_v; 
    int i, j, m = ROWS, n = COLUMNS, BM = ROWS/16, BN = COLUMNS/16, diff; 
    int search_factor; 
 
    f1 = _full_search_mpeg2; 
     
    /* Search_factor = 1, 2, or 3 */ 
    search_factor = 2; 
 
    if (search_factor == 1) 
    { 
        exp_u = exp_mu_1; 
        exp_v = exp_mv_1; 
    } 
    else if (search_factor == 2) 
    { 
        exp_u = exp_mu_2; 
        exp_v = exp_mv_2; 
    } 
    else if (search_factor == 3) 
    { 
        exp_u = exp_mu_3; 
        exp_v = exp_mv_3; 
    } 
    else 
    { 
        error_flag = error_flag | 0xffff; 
    } 
 
//Test case 1 
 
    for(i = 0;i < ROWS; i++) 
    { 
        for(j = 0;j < COLUMNS; j++) 
        { 
            target[i*COLUMNS+j] = 100; 
            reference[i*COLUMNS+j] = 0; 
        } 
    } 
    for(i = VER;i < VER + 16; i++) 
    {    
        for(j = HOR;j < HOR + 16; j++) 
        { 
            reference[i*COLUMNS+j] = 80; 
            reference[(i+16)*COLUMNS+(j-16)] = 80; 
            reference[(i+32)*COLUMNS+(j+32)] = 80; 
            reference[(i+48)*COLUMNS+j] = 80; 
            reference[(i+64)*COLUMNS+(j-16)] = 80; 
        } 
    } 
 
    _full_search_mpeg2(target, reference, mu, mv, m, n, search_factor); 
 
    for(i = 0; i