Im developing in android, and want to convert the byte-array from the camera's previewCallback, which is in YUV-format, to rgb-format.

I have used the function given in this answer: [Getting frames from Video Image in Android](https://stackoverflow.com/questions/1893072/getting-frames-from-video-image-in-android)

It works perfectly in java, but my problem is that I want to make the function in c++ (I'm using the ndk, and not very familiar with c++).

I have tried to create the function in c++, but it always makes strange results (eg the picture is all green).

Does anyone have a similar function or this function working in c++? 

Thanks.