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

📄 test_imdct12.c

📁 嵌入式系统开发中
💻 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_imdct12.c
Description : This is the test file for the testing of functionality of
              of imdct12()
*******************************************************************************/
#include<stdio.h>
#include"imdct12_data.h"

int error_flag = 0;
void (*f1)();
int cycle_count[10];
void _imdct12();

main()
{
    int i,j, error;
    short in[12], out[12];
    f1 = _imdct12;

// Test Case 1 : Input is a constant signal   
    
    for(i = 0; i < 6;i++)
        in[i] = const_data1;

    cycle_count[0] = Compute_Cycle_Count(in, out);
                        //This function inturn calls imdct12()
    for(i=0;i<12;i++)
    {
        error = out[i] - exp_dc[i];
        if(error < 0)
            error = -error;
        if(error > MAX_PERMISSIBLE_ERROR)
        {
            error_flag = error_flag | 1;
        }
    }

// Test Case 2 : Input is an impulse  

    in[0] = const_data1;

    for(i = 1;i < 6; i++)
        in[i] = const_data2;

    cycle_count[1] = Compute_Cycle_Count(in, out);
                        //This function inturn calls imdct12()
    for(i=0;i<12;i++)
    {
        error = out[i] - exp_imp[i];
        if(error < 0)
            error = -error;
        if(error > MAX_PERMISSIBLE_ERROR)
        {
            error_flag = error_flag | 2;
        }
    }

// Test Case 3 : Input is random signal

    cycle_count[2] = Compute_Cycle_Count(in_rand, out);
                        //This function inturn calls imdct12()

    for(i=0;i<12;i++)
    {
        error = out[i] - exp_rand[i];
        if(error < 0)
            error = -error;
        if(error > MAX_PERMISSIBLE_ERROR)
        {
            error_flag = error_flag | 4;
        }
    }

    #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");
        if(error_flag & 4)
            printf("Test Case 3 failed\n");
        else
            printf("Test Case 3 passed\n");
    #endif
    printf("cycle_count[0]=%d,cycle_count[1]=%d,cycle_count[2]=%d\n",cycle_count[0],cycle_count[1],cycle_count[2]);
    
}

⌨️ 快捷键说明

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