public static void Forward ( double [ ] data ) { double [ ] result = new double [ data . length ] ; double sum ; double scale = Math . sqrt ( 2.0 / data . length ) ; for ( int f = 0 ; f < data . length ; f ++ ) { sum = 0 ; for ( int t = 0 ; t < data . length ; t ++ ) { double cos = Math . cos ( ( ( 2.0 * t + 1.0 ) * f * Math . PI ) / ( 2.0 * data . length ) ) ; sum += data [ t ] * cos * alpha ( f ) ; } result [ f ] = scale * sum ; } for ( int i = 0 ; i < data . length ; i ++ ) { data [ i ] = result [ i ] ; } }
1 - D Forward Discrete Cosine Transform .