Monday, 15 February 2010

Android Renderscript create allocation on nexus 7 causes error -



Android Renderscript create allocation on nexus 7 causes error -

i trying convert photographic camera preview frame yuv format bitmap next code:

myuvtorgbscript = scriptintrinsicyuvtorgb.create(mrs, element.rgba_8888(mrs)); final allocation allocationin = allocation.createsized(mrs, element.u8(mrs), (mpreviewwidth * mpreviewheight) + ((mpreviewheight / 2) * (mpreviewwidth / 2) * 2)); allocationin.copyfrom(mpreviewframe); final bitmap previewbitmap = bitmap.createbitmap(mpreviewwidth, mpreviewheight, bitmap.config.argb_8888); final allocation allocationout = allocation.createfrombitmap(mrs, previewbitmap); myuvtorgbscript.setinput(allocationin); myuvtorgbscript.foreach(allocationout); allocationin.destroy(); allocationout.destroy(); if (previewbitmap != null) { homecoming previewbitmap; } else homecoming null;

this code works ok on 2 phones android 4.1, on nexus 7(2013) android 4.4.3 next lines appears on every preview frame:

w/adreno-rs﹕ <rsdvendorallocationsetuptexture:647>: error: runtime texture creation failed err: -10 image: 0x0 alloc: 0xad720000 w/adreno-rs﹕ <rsdvendorallocationsetuptexture:649>: error: runtime texture creation failed type: 8 kind: 0 elesize: 1

and no conversion occurs. debugging located line causes log messages:

final allocation allocationin = allocation.createsized(mrs, element.u8(mrs), (mpreviewwidth * mpreviewheight) + ((mpreviewheight / 2) * (mpreviewwidth / 2) * 2));

also tried allocationin creation:

final type.builder tb = new type.builder(mrs, element.u8(mrs)); tb.setx(mpreviewframe.length); final allocation allocationin = allocation.createtyped(mrs, tb.create(), allocation.usage_script);

but causes same error log lines , no conversion occurs. thoughts how prepare it?

you forgetting re-create allocation preview bitmap. after phone call foreach(), should do:

allocationout.copyto(previewbitmap);

android renderscript

No comments:

Post a Comment