SnapshotVideoRenderer.java 文件源码

java
阅读 20 收藏 0 点赞 0 评论 0

项目:video-quickstart-android 作者:
private YuvImage fastI420ToYuvImage(ByteBuffer[] yuvPlanes,
                                    int[] yuvStrides,
                                    int width,
                                    int height) {
    byte[] bytes = new byte[width * height * 3 / 2];
    int i = 0;
    for (int row = 0 ; row < height ; row++) {
        for (int col = 0 ; col < width ; col++) {
            bytes[i++] = yuvPlanes[0].get(col + row * yuvStrides[0]);
        }
    }
    for (int row = 0 ; row < height / 2 ; row++) {
        for (int col = 0 ; col < width / 2; col++) {
            bytes[i++] = yuvPlanes[2].get(col + row * yuvStrides[2]);
            bytes[i++] = yuvPlanes[1].get(col + row * yuvStrides[1]);
        }
    }
    return new YuvImage(bytes, NV21, width, height, null);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号