improve mavlink_dcm_to_quaternion

This came up during work for a python quaternion module for pymavlink: I ported the c code from mavlink_conversions.h and it failed the unit tests I set up for the python module.

The python version of this new algorithm passes the unit test. This c version is not tested and it would of course make sense to introduce tests here as well.

The algorithm stems from http://www.cs.ucr.edu/~vbz/resources/quatut.pdf and I ported it to python first and re-ported it to more readable c (from my point of view).

My suggestion is to leave this here so that people are aware that there is a problem with the conversion function until we can test it. The PX4 project currently aims for setting up a good unit testing framework. Hence we can maybe profit from that effort in the near future.