Currently, I do follow steps:
- Get data byte array of frame from camera (YUV format)
- Upload YUV data then draw to FBO (shader included rgb convert, blur some pixel …)
- Convert texture of FBO to I420 frame, then readback data (I used YuvConverter of chromium:
(https://chromium.googlesource.com/external/webrtc/+/HEAD/sdk/android/api/org/webrtc/YuvConverter.java)
It will work perfectly if frame width is multiple of 16. If frame width is multiple of 8 or 4, coordinate and color of some first column would be wrong. I tried GLES20.glPixelStrorei(GL_PACK/UNPACK_ALIGNMENT, 1);
before call GLES20.glReadPixel
, but this no effect.
From what I described, do you have any clues or approachs to find the root cause ? many thanks!