private void NV21toI420SemiPlanar(byte[] nv21bytes,byte[] i420bytes,int width,int height){
  System.arraycopy(nv21bytes,0,i420bytes,0,width * height);
  for (int i=width * height; i < nv21bytes.length; i+=2) {
    i420bytes[i]=nv21bytes[i + 1];
    i420bytes[i + 1]=nv21bytes[i];
  }
}

private void NV21toI420SemiPlanar ( byte [ ] nv21bytes , byte [ ] i420bytes , int width , int height ) { System . arraycopy ( nv21bytes , 0 , i420bytes , 0 , width * height ) ; for ( int i = width * height ; i < nv21bytes . length ; i += 2 ) { i420bytes [ i ] = nv21bytes [ i + 1 ] ; i420bytes [ i + 1 ] = nv21bytes [ i ] ; } }
nv21 is a 4 : 2 : 0 ycbcr , for 1 nv21 pixel : yyyyyyyy vuvu i420yuvsemiplanar is a 4 : 2 : 0 yuv , for a single i420 pixel : yyyyyyyy uvuv apply nv21 to i420yuvsemiplanar ( nv12 ) refer to https : / / wiki . videolan . org / yuv /
