Merge "Support typed YUV allocations."
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2012 The Android Open Source Project
|
||||
* Copyright (C) 2013 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -906,7 +906,8 @@ public class Element extends BaseObj {
|
||||
dk == DataKind.PIXEL_LA ||
|
||||
dk == DataKind.PIXEL_RGB ||
|
||||
dk == DataKind.PIXEL_RGBA ||
|
||||
dk == DataKind.PIXEL_DEPTH)) {
|
||||
dk == DataKind.PIXEL_DEPTH ||
|
||||
dk == DataKind.PIXEL_YUV)) {
|
||||
throw new RSIllegalArgumentException("Unsupported DataKind");
|
||||
}
|
||||
if (!(dt == DataType.UNSIGNED_8 ||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
* Copyright (C) 2013 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -80,8 +80,13 @@ public class RsYuv implements TextureView.SurfaceTextureListener
|
||||
Type t = tb.create();
|
||||
mAllocationOut = Allocation.createTyped(mRS, t, Allocation.USAGE_SCRIPT |
|
||||
Allocation.USAGE_IO_OUTPUT);
|
||||
mAllocationIn = Allocation.createSized(mRS, Element.U8(mRS), (mHeight * mWidth) +
|
||||
((mHeight / 2) * (mWidth / 2) * 2));
|
||||
|
||||
|
||||
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);
|
||||
mYuv.setInput(mAllocationIn);
|
||||
setupSurface();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user