📄 t_err_diffusion.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 : t_err_diffusion.c
Purpose : This function tests the err_diffusion function.
*******************************************************************************/
#include<stdio.h>
#include "err_diffusion.h"
int error_flag=0;
void (*f1)();
int cycle_count[10];
void _err_diffusion();
main()
{
int i,j,k;
float f;
int row,col,error,thresh;
f1 = _err_diffusion;
row=8;
col=8;
thresh =50;
for(i=0;i<9;i++)
temp[i] = zero_in;
//test 1: Input 8x8 matrix ,
cycle_count[0] = Compute_Cycle_Count(input1,row,col,temp,output,thresh);
//This function inturn calls err_diffusion()
for(i=0;i<64;i++)
{
error=output[i]-exp_output1[i];
if(error < 0) error = -error;
if(error > MAX_PERMISSIBLE_ERROR)
{
error_flag = error_flag | 1;
}
}
// test 2:
for(i=0;i<17;i++)
temp[i]=zero_in;
row=8;
col=16;
thresh =50;
cycle_count[1] = Compute_Cycle_Count(input2,row,col,temp,output,thresh);
//This function inturn calls err_diffusion()
for(i=0;i<8*16;i++)
{
error=output[i] - exp_output2[i];
if(error < 0) error = -error;
if(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 + -