Confusion on YUV NV21 conversion to RGB

First of all, I am not super experienced with image encoding (has some limited exposure to this about a year ago). So, take my answer with grain of salt.

However, I believe you are right. I think in their code both
a) V and U are flipped
b) R and B are flipped

I have a feeling that when both of these things are flipped, it will produce the same result as if they arent’ flipped. That’s the reason why you can find wrong code in many places (originally, somebody got it wrong and after it was copied all over the places, because the resulting code works (however, variables named incorrectly)).

Here is another example of code (which works the same as yours):
http://www.41post.com/3470/programming/android-retrieving-the-camera-preview-as-a-pixel-array

Leave a Comment