It appears the code did indeed have a bug
1.6 compiled and worked fine. I'm going to start faffing around with the code now to see how much I can break it.
If I'm happy to just work in RGB32 can I safely delete all the other colour space code?
I'll probably be asking some more questions very soon...