YUV420p conversion incorrect color
TinTran64 opened this issue · comments
TinTran64 commented
I've been trying to convert a YUV420 buffer to ARGB but the output image is not in correct color. I've also tried NV21 and NV12 but still no luck :(
In the sample files has the yuv file that I used ffmpeg extract and an jpeg file of how the frame should be displaying
val w = 956
val h = 1080
val yuvBuffer = I420Buffer.allocate(w, h)
yuvBuffer.asBuffer().put(byteArray)
val argbBuffer = ArgbBuffer.allocate(w, h)
yuvBuffer.convertTo(rgbaBuffer)
val bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888)
bitmap.copyPixelsFromBuffer(argbBuffer.asBuffer())
Zenichi Amano commented
Use AbgrBuffer instead of ArgbBuffer
The order of the data in ARGB_8888 is RGBA in memory.
TinTran64 commented
Zenichi Amano commented
please use AbgrBuffer
TinTran64 commented
Oh! Sorry I thought you mean RGBA..... It's working now. Thank you so much!