Mercurial > hg > wm
diff Meerwald/dct.c @ 3:acb6967ee76d
update to 0.5
author | Peter Meerwald <pmeerw@cosy.sbg.ac.at> |
---|---|
date | Tue, 14 Aug 2007 21:11:21 +0200 |
parents | be303a3f5ea8 |
children | f83ef905a63d |
line wrap: on
line diff
--- a/Meerwald/dct.c Tue Aug 14 19:59:48 2007 +0200 +++ b/Meerwald/dct.c Tue Aug 14 21:11:21 2007 +0200 @@ -45,7 +45,7 @@ } }while((1<<dct_NxN_log2N)<N); if (dct_NxN_costable) free(dct_NxN_costable); - dct_NxN_costable = (double*) malloc(N * sizeof(double)); + dct_NxN_costable = malloc(N * sizeof(double)); #ifdef DEBUG if(!dct_NxN_costable){ fprintf(stderr, "Unable to allocate C array\n"); @@ -78,7 +78,7 @@ N = width; M = height; - dct_NxN_tmp = (double *) malloc(height * sizeof(double)); + dct_NxN_tmp = malloc(height * sizeof(double)); #ifdef DEBUG if (!dct_NxN_tmp) { fprintf(stderr, "init_dct_NxN(): failed to allocate memory\n"); @@ -246,7 +246,7 @@ for (u=0; u < N; u++) for (v=0; v < M; v++) - dcts[u][v] = ((int) pixels[u][v]-128); + dcts[u][v] = ((int) pixels[u][v] - 128); for (u=0; u<=M-1; u++){ fct_noscale(dcts[u]); @@ -539,7 +539,7 @@ for ( j = 0 ; j < NJPEG ; j++ ) { temp[ i ][ j ] = 0.0; for ( k = 0 ; k < NJPEG ; k++ ) - temp[ i ][ j ] += ( (int) input[ i ][ k ]) * + temp[ i ][ j ] += ( (int) input[ i ][ k ] - 128 ) * Ct[ k ][ j ]; } } @@ -593,6 +593,7 @@ temp1 = 0.0; for ( k = 0 ; k < NJPEG ; k++ ) temp1 += Ct[ i ][ k ] * temp[ k ][ j ]; + temp1 += 128.0; output[i][j] = PIXELRANGE(ROUND(temp1)); } }