Search code examples
androidrenderscript

android - renderscript processing previous frames


renderscript is powerful to do matrix calculation,but if I want to processing the differential between current frame and previous frame.

What's the right method to do it:

  1. Save previous frame in renderscript then do calculation after new frames coming in.
  2. Save previous frame in java and send both frame to renderscript?

Method 2 should be functional but not sure if method 1 possible! How can I do that.


Solution

  • Method 2 should do the trick, you will need two Allocations, say aOld and aNew.

    Have a look at ScriptIntrinsicBlend, especially the forEachSubtract - method.