in HdrViewfinder/Application/src/main/java/com/example/android/hdrviewfinder/ViewfinderProcessor.java [126:155]
public void run() {
// Find out how many frames have arrived
int pendingFrames;
synchronized(this) {
pendingFrames = mPendingFrames;
mPendingFrames = 0;
// Discard extra messages in case processing is slower than frame rate
mProcessingHandler.removeCallbacks(this);
}
// Get to newest input
for (int i = 0; i < pendingFrames; i++) {
mInputAllocation.ioReceive();
}
mHdrMergeScript.set_gFrameCounter(mFrameCounter++);
mHdrMergeScript.set_gCurrentFrame(mInputAllocation);
mHdrMergeScript.set_gCutPointX(mCutPointX);
if (mCheckMerge && mMode == MODE_HDR) {
mHdrMergeScript.set_gDoMerge(1);
} else {
mHdrMergeScript.set_gDoMerge(0);
}
// Run processing pass
mHdrMergeScript.forEach_mergeHdrFrames(mPrevAllocation, mOutputAllocation);
mOutputAllocation.ioSend();
}