How to use ScriptIntrinsicYuvToRGB (converting byte[] yuv to byte[] rgba)

前端 未结 5 758
清酒与你
清酒与你 2020-12-01 09:40

I have byte[] yuvByteArray (540x360 image captured from Camera.PreviewCallback.onPreviewFrame method and dumped into assets/yuv.bin fi

5条回答
  •  渐次进展
    2020-12-01 10:32

    Our internal test app uses the following sequence to create the YUV allocation.

        tb = new Type.Builder(mRS, Element.createPixel(mRS, 
                  Element.DataType.UNSIGNED_8, Element.DataKind.PIXEL_YUV));
        tb.setX(mWidth);
        tb.setY(mHeight);
        tb.setYuvFormat(android.graphics.ImageFormat.NV21);
        mAllocationIn = Allocation.createTyped(mRS, tb.create(), Allocation.USAGE_SCRIPT);
    

    Then inside the callback that new YUV data is available do

        mAllocationIn.copyFrom(theYuvByteArray);
    

提交回复
热议问题