在进行nv21旋转的时候遇到将*2替换成<<1时超出数组范围的错误,在此记录一下
private static byte[] rote(byte[] nv21, int width, int height) {
int ySize = width * height;
byte[] ret = new byte[ySize * 3 >> 1];
for (int y = 0; y < width; ++y) {
for (int x = 0; x < height; ++x) {
ret[y * height + x] = nv21[x * width + width - y];
ret[ySize + (y >> 1) * height + (x >> 1) * 2] = nv21[ySize + (x >> 1) * width + ((width - y - 1) >> 1) * 2];
ret[ySize + (y >> 1) * height + (x >> 1) * 2 + 1] = nv21[ySize + (x >> 1) * width + ((width - y - 1) >> 1) * 2 + 1];
}
}
return ret;
}