Slide 68
Slide 68 text
mRs = new RSC::RS();
mRs->init(RSC::RS_INIT_LOW_LATENCY | RSC::RS_INIT_SYNCHRONOUS);
mRsElement = RSC::Element::A_8(mRs);
mRsScript = RSC::ScriptIntrinsicBlur::create(mRs, mRsElement);
RSC::sp t = RSC::Type::create(mRs, mRsElement,
width, height, 0);
RSC::sp ain = RSC::Allocation::createTyped(mRs, t,
RS_ALLOCATION_MIPMAP_NONE, RS_ALLOCATION_USAGE_SCRIPT |
RS_ALLOCATION_USAGE_SHARED, inImage);
RSC::sp aout = RSC::Allocation::createTyped(mRs, t,
RS_ALLOCATION_MIPMAP_NONE, RS_ALLOCATION_USAGE_SCRIPT |
RS_ALLOCATION_USAGE_SHARED, outImage);
mRsScript->setRadius(radius);
mRsScript->setInput(ain);
mRsScript->forEach(aout);
This is how Android’s hardware renderer uses RenderScript intrinsics. This gives the renderer
a 2-3x boost over native code when applying blurs to textures.