www.pudn.com > DaVinci_Qam.zip > Test_qam_gen_unpack_lookup.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_qam_gen_unpack_lookup.c 
Description     : This function tests qam_gen_unpack_lookup with 2 test cases  
                  and finds cycle count for qam size of 8 and number of  
                  symbols = 255 and 256. 
                    1. Test1 - Number of symbols = 255 
                    2. Test1 - Number of symbols = 256 
*******************************************************************************/ 
#include "qamdata.h" 
 
extern void qam_gen_unpack_lookup(short *iptr, short *optr, short *lookuptable,  
                                  int n); 
 
int error_flag = 0; 
void (*f1)(); 
int cycle_count[10]; 
 
void main() 
    { 
    int n; 
    short i; 
 
    f1 = (void(*)()) qam_gen_unpack_lookup;                             
 
// Test1 - Number of symbols = 255 
 
    n = 255; 
 
    cycle_count[0] = Compute_Cycle_Count(iptr, optr, optr8, n); 
                            //This function inturn calls qam_gen_unpack_lookup() 
    for(i=0; i<2*n; i+=2) 
        if( (optr[i] != optr8[i]) || (optr[i+1] != optr8[i+1]) )  
        { 
            error_flag = error_flag | 1; 
        } 
 
// Test2 - Number of symbols = 256 
 
    n = 256; 
 
    cycle_count[1] = Compute_Cycle_Count(iptr, optr, optr8, n); 
                            //This function inturn calls qam_gen_unpack_lookup() 
    for(i=0; i<2*n; i+=2) 
        if( (optr[i] != optr8[i]) || (optr[i+1] != optr8[i+1]) ) 
        { 
            error_flag = error_flag | 2; 
        } 
    #ifdef PRINTF_SUPPORT 
        if(error_flag & 1) 
            printf("Test Case 1 failed\n"); 
        else 
            printf("Test Case 1 passed\n"); 
        if(error_flag & 2) 
            printf("Test Case 2 failed\n"); 
        else 
            printf("Test Case 2 passed\n"); 
    #endif 
 
    printf("cycle_count[0]=%d,cycle_count[1]=%d\n",cycle_count[0],cycle_count[1]); 
     
}