public void invDctNxM(double[][] dcts,int[][] pixels){
  int x=0;
  int y=0;
  int i=0;
  int j=0;
  double t=0.0;
  double cx0=Math.sqrt(1.0 / this.N);
  double cy0=Math.sqrt(1.0 / this.M);
  for (x=0; x < this.N; x++) {
    for (y=0; y < this.M; y++) {
      t=cx0 * cy0 * dcts[0][0];
      for (i=1; i < this.N; i++) {
        t+=cy0 * dcts[i][0] * this.nxmCosTableX[x][i];
      }
      for (j=1; j < this.M; j++) {
        t+=cx0 * dcts[0][j] * this.nxmCosTableY[y][j];
      }
      for (i=1; i < this.N; i++) {
        for (j=1; j < this.M; j++) {
          t+=dcts[i][j] * this.nxmCosTableX[x][i] * this.nxmCosTableY[y][j];
        }
      }
      pixels[x][y]=ImageUtil.pixelRange((int)(t + 128.5));
    }
  }
}

public void invDctNxM ( double [ ] [ ] dcts , int [ ] [ ] pixels ) { int x = 0 ; int y = 0 ; int i = 0 ; int j = 0 ; double t = 0.0 ; double cx0 = Math . sqrt ( 1.0 / this . N ) ; double cy0 = Math . sqrt ( 1.0 / this . M ) ; for ( x = 0 ; x < this . N ; x ++ ) { for ( y = 0 ; y < this . M ; y ++ ) { t = cx0 * cy0 * dcts [ 0 ] [ 0 ] ; for ( i = 1 ; i < this . N ; i ++ ) { t += cy0 * dcts [ i ] [ 0 ] * this . nxmCosTableX [ x ] [ i ] ; } for ( j = 1 ; j < this . M ; j ++ ) { t += cx0 * dcts [ 0 ] [ j ] * this . nxmCosTableY [ y ] [ j ] ; } for ( i = 1 ; i < this . N ; i ++ ) { for ( j = 1 ; j < this . M ; j ++ ) { t += dcts [ i ] [ j ] * this . nxmCosTableX [ x ] [ i ] * this . nxmCosTableY [ y ] [ j ] ; } } pixels [ x ] [ y ] = ImageUtil . pixelRange ( ( int ) ( t + 128.5 ) ) ; } } }
perform inverse dct on the n x m matrix
