Replacement reference DCT implementation.