Updated version not working, rolled back for now.  Also performing a 3D DCT on groups instead of 2D DCT + Hadamard.