MediaCodec has a limitation FPS of decoding, I want to break that, so I need to render frames by myself, instead of internal feature of MediaCodec.
I assume that only RGB565 can be render to SurfaceView on Android platform. I've been searching for many solutions of YUV420->RGB565 on Android, but all solutions need separated Y U V data, but separating YUV420SP data into Y U V would cost much time.
How do i fix that?
Thanks for all who helps.
@Codo
if(colorFmt == 21) {
int nSize = bufferInfo.size / 6;
byte[] buf = new byte[bufferInfo.size];
byte[] y = new byte[nSize * 4];
byte[] u = new byte[nSize];
byte[] v = new byte[nSize];
ByteBuffer decoded = mc.getOutputBuffer(outputBufferIndex);
if(decoded != null) {
decoded.get(buf);
System.arraycopy(buf, 0, y, 0, nSize * 4);
for(int i = 0; i < nSize; ++i) {
u[i] = buf[nSize*4 + i*2];
v[i] = buf[nSize*4 + i*2 + 1];
}
}