Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { public static int YUVFrameByteSize(int wid, int hei) { int yStride = (int) Math.ceil(wid / 16.0) * 16; int uvStride = (int) Math.ceil((yStride / 2) / 16.0) * 16; int ySize = yStride * hei; int uvSize = uvStride * hei / 2; return ySize + uvSize * 2; } }