Benoit, you are much closer to the core math than I am and I think that its not really a good idea port the OpenCV code - at least not for me. :)
OpenCV does not - support fixed size specializations - handle complex numbers
I will simply send you the code I have so you may take a look at it. As I said before, the original code is gone from OpenCV. At least I cannot find it in the SVN and the old CVS repository seems to be down.