How to convert DFT to DCT I've been trying to find a fast 16 point dct2 and dct3 implementation, however I could only find it in literature expressed as mathematical equations, which honestly I couldn't understand. 

However I did find a code generator that outputs dft transforms. The main problem I have is the DFT and Inverse DFT don't have the same numbers going in and out. 

// Before DFT              // After DFT and IDFT
inputArray[ 0] = 12;       outputArray[ 0] = 184;
inputArray[ 1] = 12;       outputArray[ 1] = 194;   
inputArray[ 2] = 12;       outputArray[ 2] = 178;
inputArray[ 3] = 14;       outputArray[ 3] = 198;
inputArray[ 4] =  8;       outputArray[ 4] = 155;  
inputArray[ 5] = 10;       outputArray[ 5] = 141;
inputArray[ 6] = 12;       outputArray[ 6] = 164;
inputArray[ 7] = 12;       outputArray[ 7] = 149;
inputArray[ 8] = 12;       outputArray[ 8] = 138;
inputArray[ 9] = 12;       outputArray[ 9] = 121; 
inputArray[10] = 12;       outputArray[10] = 107;
inputArray[11] = 12;       outputArray[11] = 90;
inputArray[12] = 12;       outputArray[12] = 74;  
inputArray[13] = 12;       outputArray[13] = 55;
inputArray[14] = 12;       outputArray[14] = 37;
inputArray[15] = 12;       outputArray[15] = 19; 


I realized the first 5 or so indexes do equal the inputs when divided by 16, however this trend doesn't continue as you go down.

Is this the expected behavior? Or is there something else I need to do the get a proper conversion?

Also I did find an 8 point dct that works well and gives the proper results, is there anyway to expand that into a fast 16 point dct?

Edit:

The reason I want to find a fast 16x16 DCT is because I'm working on a javascript video codec that supports transparency. 

So after inter frame prediction is finished I'm left with a lot of residue. Because it's in javascript, and it's processing 24 frames a second I need the fastest way possible to compress and decompress this residue.
It depends on which DCT (there are more than four of them), the idea is to take your original data and append to it a mirror-reflection copy of that data.  Now your data is twice as long, and you perform an FFT on twice the length.  but you have some symmetry to it that allows you to toss half of the data in the result of the DFT.

exactly how, depends on if it's DCT I, DCT II, DCT III, DCT IV, or the "MDCT" or whatever is the DCT flavor of the month.

looks like something useful here.  it may need further exploration.