public void ProcessFrame(ProcessVideoFrameContext context)
        {
            var inputDirect3DSurface = context.InputFrame.Direct3DSurface;

            float anyDpi = 96.0f;
            var   width  = context.OutputFrame.Direct3DSurface.Description.Width;
            var   height = context.OutputFrame.Direct3DSurface.Description.Height;

            // Part 1: Apply effect using Imaging SDK
            CanvasRenderTarget renderTarget = new CanvasRenderTarget(canvasDevice, (float)width, (float)height, anyDpi);

            if (inputDirect3DSurface != null && renderTarget != null)
            {
                if (m_direct3DSurfaceImageSource == null)
                {
                    m_direct3DSurfaceImageSource = new Direct3DSurfaceImageSource();
                }

                m_direct3DSurfaceImageSource.Direct3DSurface = inputDirect3DSurface;
                ((IImageConsumer)m_grayScaleEffect).Source   = m_direct3DSurfaceImageSource;

                if (m_direct3DSurfaceRenderer == null)
                {
                    m_direct3DSurfaceRenderer = new Direct3DSurfaceRenderer();
                }

                m_direct3DSurfaceRenderer.Direct3DSurface = renderTarget;
                m_direct3DSurfaceRenderer.Source          = m_grayScaleEffect;

                var task = m_direct3DSurfaceRenderer.RenderAsync().AsTask();
                task.Wait();

                m_direct3DSurfaceRenderer.Direct3DSurface    = null;
                m_direct3DSurfaceImageSource.Direct3DSurface = null;
            }

            // Part 2: Apply another effect using Win2D
            var size   = context.OutputFrame.Direct3DSurface.Description.Width * context.OutputFrame.Direct3DSurface.Description.Height;
            var colors = Enumerable.Repeat(Colors.Black, size).ToArray();

            var inputBitmap = CanvasBitmap.CreateFromColors(canvasDevice, colors, width, height, anyDpi);

            inputBitmap.CopyPixelsFromBitmap(renderTarget);

            using (CanvasRenderTarget output = CanvasRenderTarget.CreateFromDirect3D11Surface(canvasDevice, context.OutputFrame.Direct3DSurface))
                using (CanvasDrawingSession ds = output.CreateDrawingSession())
                {
                    TimeSpan time = context.InputFrame.RelativeTime.HasValue ? context.InputFrame.RelativeTime.Value : new TimeSpan();

                    float dispX = (float)Math.Cos(time.TotalSeconds) * 75f;
                    float dispY = (float)Math.Sin(time.TotalSeconds) * 75f;

                    ds.Clear(Colors.Black);

                    var dispMap = new DisplacementMapEffect()
                    {
                        Source         = inputBitmap,
                        XChannelSelect = EffectChannelSelect.Red,
                        YChannelSelect = EffectChannelSelect.Green,
                        Amount         = 100f,
                        Displacement   = new Transform2DEffect()
                        {
                            TransformMatrix = Matrix3x2.CreateTranslation(dispX, dispY),
                            Source          = new BorderEffect()
                            {
                                ExtendX = CanvasEdgeBehavior.Mirror,
                                ExtendY = CanvasEdgeBehavior.Mirror,
                                Source  = new TurbulenceEffect()
                                {
                                    Octaves = 3
                                }
                            }
                        }
                    };

                    ds.DrawImage(dispMap, -25f, -25f);
                }

            ((IDisposable)renderTarget).Dispose();
            ((IDisposable)inputBitmap).Dispose();
        }