在進行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;
}