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

📄 test_conv2d5x5_gen.c

📁 ADI BF535 DSP 图象5*5卷积计算汇编优化源码
💻 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_conv2d5x5_gen.c
Description     : This function tests _conv2d5x5_gen with 2 test cases and finds
                  cycle count for input sizes of 5x5, 10x15 and 16x16.
                 1. Test1 - Random test with output not overflowing i/p = 5 x 5
                 2. Test2 - Random test with output not overflowing i/p = 16 x16
*******************************************************************************/
#include "conv2d5x5_gen.h"

extern void _conv2d5x5_gen(fract16 in[], short row, short col, fract16 mask[], 
                           fract16 out[]);

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

void main (void)
{
    int row, col;
    int i, error;

    f1 = (void(*)()) _conv2d5x5_gen;    // Function Pointer

// ************************************************************
// Test1 - Random test with output not overflowing i/p = 5 x 5
// ************************************************************
    row = 5, col = 5;   
        
    for(i=0; i<row*col; i++)    in[i] =in5_5[i];
    for(i=0; i<25; i++)         mask[i]=mask5_5[i];
    for(i=0; i<row*col; i++)    out[i] =1000;

    cycle_count[0] = Compute_Cycle_Count(in, row, col, mask, out);
                                //This function inturn calls conv2d5x5_gen()

    for(i=0; i<row*col; i++)
    {
        error = out[i] - out5_5[i];
        if (abs(error) > MAX_PERMISSIBLE_ERROR)
        {    
            error_flag = error_flag | 1;
        }
    }
// ************************************************************
// Test2 - Random test with output not overflowing i/p = 16 x 16
// ************************************************************
    row = 16, col = 16; 
        
    for(i=0; i<row*col; i++)    in[i] =in5_16[i];
    for(i=0; i<25; i++)         mask[i]=mask5_16[i];
    for(i=0; i<row*col; i++)    out[i] =1000;

    cycle_count[1] = Compute_Cycle_Count(in, row, col, mask, out);
                                //This function inturn calls conv2d5x5_gen()

    for(i=0; i<row*col; i++)
    {
        error = out[i] - out5_16[i];
        if (abs(error) > MAX_PERMISSIBLE_ERROR)
        {    
            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
}

⌨️ 快捷键说明

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