public void invDctNxN(double[][] dcts,int[][] pixels){
  int u=0;
  int v=0;
  double two_over_sqrtncolsnrows=2.0 / Math.sqrt((double)this.N * this.M);
  double[][] tmp=null;
  tmp=new double[this.N][this.N];
  for (u=0; u < this.N; u++) {
    for (v=0; v < this.M; v++) {
      tmp[u][v]=dcts[u][v];
    }
  }
  for (u=0; u <= this.M - 1; u++) {
    invFctNoScale(tmp[u]);
  }
  for (v=0; v <= this.N - 1; v++) {
    for (u=0; u <= this.M - 1; u++) {
      this.nxnTmp[u]=tmp[u][v];
    }
    invFctNoScale(this.nxnTmp);
    for (u=0; u <= this.M - 1; u++) {
      tmp[u][v]=this.nxnTmp[u] * two_over_sqrtncolsnrows;
    }
  }
  for (u=0; u < this.N; u++) {
    for (v=0; v < this.M; v++) {
      pixels[u][v]=ImageUtil.pixelRange((int)(tmp[u][v] + 128.5));
    }
  }
  tmp=null;
}

public void invDctNxN ( double [ ] [ ] dcts , int [ ] [ ] pixels ) { int u = 0 ; int v = 0 ; double two_over_sqrtncolsnrows = 2.0 / Math . sqrt ( ( double ) this . N * this . M ) ; double [ ] [ ] tmp = null ; tmp = new double [ this . N ] [ this . N ] ; for ( u = 0 ; u < this . N ; u ++ ) { for ( v = 0 ; v < this . M ; v ++ ) { tmp [ u ] [ v ] = dcts [ u ] [ v ] ; } } for ( u = 0 ; u <= this . M - 1 ; u ++ ) { invFctNoScale ( tmp [ u ] ) ; } for ( v = 0 ; v <= this . N - 1 ; v ++ ) { for ( u = 0 ; u <= this . M - 1 ; u ++ ) { this . nxnTmp [ u ] = tmp [ u ] [ v ] ; } invFctNoScale ( this . nxnTmp ) ; for ( u = 0 ; u <= this . M - 1 ; u ++ ) { tmp [ u ] [ v ] = this . nxnTmp [ u ] * two_over_sqrtncolsnrows ; } } for ( u = 0 ; u < this . N ; u ++ ) { for ( v = 0 ; v < this . M ; v ++ ) { pixels [ u ] [ v ] = ImageUtil . pixelRange ( ( int ) ( tmp [ u ] [ v ] + 128.5 ) ) ; } } tmp = null ; }
perform inverse dct on the n x n matrix
