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

📄 dctalloc.c

📁 su 的源代码库
💻 C
字号:
/* Copyright (c) Colorado School of Mines, 2006.*//* All rights reserved.                       *//*********************** self documentation **********************//*****************************************************************************DCTALLOC - ALLOCate space for transform tables for 1D DCTdctivAlloc - allocate space for the transform table for dctivdctAlloc - allocate space for the transform table for dct******************************************************************************Function Prototype:float **dctivAlloc(int n);float **dctAlloc(int n);******************************************************************************dctivAlloc:Input:n         length of the signaldctAlloc:n         length of the signal******************************************************************************Author:		Tong Chen, 06/01/95*****************************************************************************//**************** end self doc ********************************/#include "comp.h"float **dctivAlloc(int n)/*****************************************************************************dctivAlloc - generate the transform table for dctiv******************************************************************************n         length of the signal******************************************************************************Author:		Tong Chen, 06/01/95*****************************************************************************/{	float **c;	int i, j;	float c1, c2;	c = alloc2float(n, n);	/* initialize the transform matrix */	c1 = 1./sqrt(.5*n);	c2 = PI/n;	for(j=0; j<n; j++)	   for(i=0; i<n; i++)		c[j][i] = c1*cos((i+.5)*(j+.5)*c2);		/* return the table */	return (c);}float **dctAlloc(int n)/*****************************************************************************dctAlloc - generate the transform table for dct******************************************************************************n         length of the signal******************************************************************************Author:		Tong Chen, 06/01/95*****************************************************************************/{	float **c;	int i, j;	float c1, c2, c3;	c = alloc2float(n, n);	/* initialize the transform matrix */	c1 = 1./sqrt(n);	c2 = 1./sqrt(.5*n);	c3 = .5*PI/n;	for(i=0; i<n; i++) c[0][i] = c1;		for(j=1; j<n; j++)	   for(i=0; i<n; i++)		c[j][i] = c2*cos((2.*i+1.)*j*c3);		/* return the table */	return (c);}

⌨️ 快捷键说明

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