Ok so my question is pretty much identical to this: Converting preview frame to bitmap
However his answer is no good, and trying to use it doesn\'t solve my problem.
Ok so the problem was the decodeYUV method which I got from a different stackoverflow post here: Converting YUV->RGB(Image processing)->YUV during onPreviewFrame in android? didn't quite work.
But I replaced that with what I think must be the original decodeYUV method from here: http://code.google.com/p/android/issues/detail?id=823 an
The key point here is that there are a (large) number of different YUV encodings, and an even larger list of names used for them. A lot of information about all the different variants (and their names) is given by fourcc, although 420SP isn't mentionned explicitly. Looking here, it looks like:
In this case, therefore, you are decoding NV12 (as opposed to NV21) and so the order of U and V is swapped around compared to the answer you quote in your answer. In case it helps, I have provided some code here.