// // Simple class to keep track of incoming frame count, // and to process the newest one in the processing thread // public void OnBufferAvailable(Allocation a) { a.IoReceive(); mHdrYuvToRGBScript.SetInput(a); // Run processing pass if (mMode != ModeNormal) { if (mMode == ModeHdr) { mHdrColorMatrixScript.ForEach(mPrevAllocation, mOutputAllocation); } else { int cutPointX = (mFrameCounter & 1) == 0 ? 0 : mDimensions.Width / 2; mOutputAllocation.Copy2DRangeFrom(cutPointX, 0, mDimensions.Width / 2, mDimensions.Height, mPrevAllocation, cutPointX, 0); } mHdrYuvToRGBScript.ForEach(mPrevAllocation); if (mMode == ModeHdr) { mHdrBlendScript.ForEachDstOver(mPrevAllocation, mOutputAllocation); } else { int cutPointX = (mFrameCounter & 1) == 1 ? 0 : mDimensions.Width / 2; mOutputAllocation.Copy2DRangeFrom(cutPointX, 0, mDimensions.Width / 2, mDimensions.Height, mPrevAllocation, cutPointX, 0); } } else { mHdrYuvToRGBScript.ForEach(mOutputAllocation); } mFrameCounter++; mOutputAllocation.IoSend(); }