INNER CODE UNIT · Java
loadNV21Image
githubhaohao/NDK_OpenGLES_3_0 · app/src/main/java/com/byteflow/app/MainActivity.java:626
private void loadNV21Image() {
InputStream is = null;
try {
is = getAssets().open("YUV_Image_840x1074.NV21");
} catch (IOException e) {
e.printStackTrace();
}
int lenght = 0;
try {
lenght = is.available();
byte[] buffer = new byte[lenght];
is.read(buffer);
mGLRender.setImageData(IMAGE_FORMAT_NV21, 840, 1074, buffer);
} catch (IOException e) {
e.printStackTrace();
} finally {
try