Ejemplo n.º 1
0
        private void EnqueueStandardHeadClip()
        {
            var isDuplicate =
                queue.Count > 0 &&
                !currentFrame.IsDifferentFrom(queue.Last);

            //Don't add duplicates to frame history
            if (isDuplicate)
            {
                return;
            }

            //Subclip head
            subclippedHead.DrawFrame(currentFrame, 0, 0, 1, 0,
                                     Space.HeadOffset.X, Space.HeadOffset.Y);

            //Resize to standard into stdHeadClip
            subclippedHead.ScaleHQ(Space.StandardWidth, Space.StandardHeight, stdHeadClip.Bitmap);

            //We're computing T-1 frame's antenna positions
            //T-2 frame should be the last frame part of the background
            if (queue.Count >= FastMotionHistLength - 1)
            {
                //Because T has not been added yet, T-2 is still T-1
                var forBackground = queue.GetNthBeforeLast(1);

                //BG update takes a while, do it in parallel
                backgroundUpdater = new Thread(() =>
                {
                    //Add to background queue
                    background.Append(forBackground);
                });

                backgroundUpdater.Start();
            }

            //Enque into the buffer
            //Remove oldest frame
            if (queue.Count >= FastMotionHistLength)
            {
                queue.RemoveFirst();
            }

            //Add new one
            queue.Enqueue(stdHeadClip);
        }