格式就不说了,直接看代码:
public final static int NV21_TO_yuv420P(byte[] dst, byte[] src, int w, int h) { int ysize = w * h; int usize = w * h * 1 / 4; byte[] dsttmp = dst; // y System.arraycopy(src, 0, dst, 0, ysize); // u, 1/4 int srcPointer = ysize; int dstPointer = ysize; int count = usize; while (count > 0) { srcPointer++; dst[dstPointer] = src[srcPointer]; dstPointer++; srcPointer++; count--; } // v, 1/4 srcPointer = ysize; count = usize; while (count > 0) { dst[dstPointer] = src[srcPointer]; dstPointer++; srcPointer += 2; count--; } dst = dsttmp; // _EF_TIME_DEBUG_END(0x000414141); return 0; }