fun invDct8x8(input: Array<DoubleArray>, output: Array<IntArray>) { val temp = Array(NJPEG) { DoubleArray( NJPEG ) } var temp1 = 0.0 var i = 0 var j = 0 var k = 0 i = 0 while (i < NJPEG) { j = 0 while (j < NJPEG) { temp[i][j] = 0.0 k = 0 while (k < NJPEG) { temp[i][j] += input[i][k] * this.C.get(k).get(j) k++ } j++ } i++ } i = 0 while (i < NJPEG) { j = 0 while (j < NJPEG) { temp1 = 0.0 k = 0 while (k < NJPEG) { temp1 += this.Ct.get(i).get(k) * temp[k][j] k++ } temp1 += 128.0 output[i][j] = com.sun.imageio.plugins.common.ImageUtil.pixelRange(round(temp1)) j++ } i++ } }
Perform inverse DCT on the 8x8 matrix