Merge "Support typed YUV allocations."

This commit is contained in:
Jason Sams
2013-02-16 02:53:46 +00:00
committed by Android (Google) Code Review
3 changed files with 11 additions and 5 deletions

View File

@@ -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 ||

View File

@@ -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.

View File

@@ -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();