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

📄 tr8x8dct.c

📁 dct,离散余弦变换汇编原代码
💻 C
字号:
/****************************************************************************
Copyright (c) 2000 Analog Devices Inc. All rights reserved.
*****************************************************************************

File name: tr8x8dct.c

Description : This is the test file for the testing of functionality of
              of forward 8x8 DCT.

Date : 9th Oct. 2000.
***************************************************************************/

#include <stdio.h>
#include "tr8x8dct.h"

#define PI 3.14159265358979
#define PRINT_ON_ERROR

void main (void)
{
int n, i, j, error, error_flag = 0;
fract16 in[64], temp[64];  //8x8


n = 8;

//Test case when all the input values are set to zero.

printf("Testing property 1.......\n");

for(i=0; i<64; i++)
  in[i] = 0;

_r8x8dct(in, coef, temp);


for (i = 0; i < 64; i++)
	{
	if (in[i] != 0)
		{	 
			error_flag = 1; 
			printf("Failed\n\n");
#ifdef PRINT_ON_ERROR
	 printf("Expected Result : Output[%d] = 0x%4.4x \n", i, 0x0000);
	 printf("Calculated Result : Output[%d] = 0x%4.4x \n", i, in[i]);
#endif
		}
	}


//Test case when there is an impulse value of 255.

printf("Testing property 2.......\n");

for(i=0; i<64; i++)
  in[i] = 0;

  in[0] = 255;

_r8x8dct(in, coef, temp);

for (i = 0; i < 64; i++)
	{
	error = in[i] - Testcase2_out[i];
	if (abs(error) > 1)
		{	 
			error_flag = 1; 
			printf("Failed\n\n");
#ifdef PRINT_ON_ERROR
	 printf("Expected Result : Output[%d] = 0x%4.4x \n", i, Testcase2_out[i]);
	 printf("Calculated Result : Output[%d] = 0x%4.4x \n", i, in[i]);
#endif
		}
	}
	


//Test case when all the input value are set to 25 (DC).

printf("Testing property 3.......\n");

for(i=0; i<64; i++)
  in[i] = 25;

_r8x8dct(in, coef, temp);

for (i = 0; i < 64; i++)
	{
	error = in[i] - Testcase3_out[i];
	if (abs(error) > 1)
		{	 
			error_flag = 1; 
			printf("Failed\n\n");
#ifdef PRINT_ON_ERROR
	 printf("Expected Result : Output[%d] = 0x%4.4x \n", i, Testcase3_out[i]);
	 printf("Calculated Result : Output[%d] = 0x%4.4x \n", i, in[i]);
#endif
		}
	}

//Test when the input is multifrequency.

printf("Testing property 4.......\n");

for(i=0; i<64; i++)
  in[i] = Testcase4_In[i];

_r8x8dct(in, coef, temp);

for (i = 0; i < 64; i++)
	{
	error = in[i] - Testcase4_out[i];
	if (abs(error) > 4)
		{	 
			error_flag = 1; 
			printf("Failed\n\n");
#ifdef PRINT_ON_ERROR
	 printf("Expected Result : Output[%d] = 0x%4.4x \n", i, Testcase4_out[i]);
	 printf("Calculated Result : Output[%d] = 0x%4.4x \n", i, in[i]);
#endif
		}
	}

}

⌨️ 快捷键说明

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