int main() { void ddct8x8s(int isgn, double **a); void ddct16x16s(int isgn, double **a); void putdata2d(int n1, int n2, double **a); double errorcheck2d(int n1, int n2, double scale, double **a); double err; int i; double aarr[NMAX][NMAX], *a[NMAX], barr[NMAX][NMAX], *b[NMAX]; for (i = 0; i < NMAX; i++) a[i] = aarr[i]; for (i = 0; i < NMAX; i++) b[i] = barr[i]; /* check of 8x8 DCT */ putdata2d(8, 8, a); ddct8x8s(-1, a); ddct8x8s(1, a); err = errorcheck2d(8, 8, 1.0, a); printf("ddct8x8s err= %g\n", err); /* check of 16x16 DCT */ putdata2d(16, 16, a); ddct16x16s(-1, a); ddct16x16s(1, a); err = errorcheck2d(16, 16, 1.0, a); printf("ddct16x16s err= %g\n", err); return 0; }
void dctNxN(int n, double **data, int* ip, double* w) { switch(n) { case 2: case 4: ddct2d(n, n, -1, data, NULL, ip, w); break; case 8: ddct8x8s(-1,data); break; case 16: ddct16x16s(-1,data); break; default: error("N (blocksize) wasn't a power of 2 in dctNxN"); //exit(1); break; } }