Android decodeYUV420SP results in green images?

此生再无相见时 提交于 2019-12-02 02:51:37
Neil Townsend

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:

  • 420P is the same as YV12. 'P' appears to stand for planar: there are three 'planes' of data one after the other: Y, U and then V. (Or, in YV21, which is also a 420P encoding, Y, V and then U.)
  • 420SP is the same as NV12 (which is the same as NV21 but with U and V swapped around). 'SP' appears to stand for 'semi-planar', and so '420SP' could, technically, refer to either NV21 or NV12.

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.

Daniel Jonker

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!