Пример #1
0
        public void TestNoOverlay()
        {
            Frame testFrame = new Frame(new YuvKA.VideoModel.Size(80, 80));

            for (int x = 0; x < testFrame.Size.Width; x++)
            {
                for (int y = 0; y < testFrame.Size.Height; y++)
                {
                    testFrame[x, y] = new Rgb(111, 111, 111);
                }
            }
            Frame[]     input = { testFrame };
            OverlayNode node  = new OverlayNode {
                Type = new NoOverlay()
            };

            node.ProcessCore(input, 0);
            List <Frame> output = new List <Frame>();

            for (int x = 0; x < testFrame.Size.Width; x++)
            {
                for (int y = 0; y < testFrame.Size.Height; y++)
                {
                    Assert.Equal(testFrame[x, y], node.Data[x, y]);
                }
            }
        }
Пример #2
0
 private Config()
 {
     Gui         = GuiNode.GetDefault();
     ContextMenu = ContextMenuNode.GetDefault();
     Overlay     = OverlayNode.GetDefault();
     Diagnostics = DiagnosticsNode.GetDefault();
 }
Пример #3
0
        public void ArtifactOverlay()
        {
            Frame testFrame = new Frame(new YuvKA.VideoModel.Size(80, 80));

            for (int x = 0; x < testFrame.Size.Width; x++)
            {
                for (int y = 0; y < testFrame.Size.Height; y++)
                {
                    testFrame[x, y] = new Rgb(111, 111, 111);
                }
            }
            Frame alteredTestFrame = new Frame(testFrame.Size);

            for (int x = 0; x < testFrame.Size.Width; x++)
            {
                for (int y = 0; y < testFrame.Size.Height; y++)
                {
                    alteredTestFrame[x, y] = new Rgb((byte)(x + y), (byte)(x + y), (byte)(x + y));
                }
            }
            Frame[]     input = { alteredTestFrame, testFrame };
            OverlayNode node  = new OverlayNode {
                Type = new ArtifactsOverlay()
            };

            node.ProcessCore(input, 0);
            List <Frame> output = new List <Frame>();

            output.Add(node.Data);
            YuvEncoder.Encode(@"..\..\..\..\output\ArtifactOverlayTest_80x80.yuv", output);
        }
Пример #4
0
 private Config(GuiNode gui, ContextMenuNode contextMenu, OverlayNode overlay, DiagnosticsNode diagnostics)
 {
     Gui         = gui;
     ContextMenu = contextMenu;
     Overlay     = overlay;
     Diagnostics = diagnostics;
 }
Пример #5
0
        OverlayNodeView NewNodeView(OverlayNode on)
        {
            OverlayNodeView v = new OverlayNodeView(on);

            canvas1.Children.Add(v);
            return(v);
        }
Пример #6
0
        public void TestVecorOverlay()
        {
            Frame testFrame = new Frame(new YuvKA.VideoModel.Size(64, 48));

            for (int x = 0; x < testFrame.Size.Width; x++)
            {
                for (int y = 0; y < testFrame.Size.Height; y++)
                {
                    testFrame[x, y] = new Rgb(111, 111, 111);
                }
            }
            MacroblockDecision[] decisions = new MacroblockDecision[12];
            decisions[0] = new MacroblockDecision {
                Movement = new Vector(0.0, 12.0)
            };
            decisions[1] = new MacroblockDecision {
                Movement = new Vector(12.0, 12.0)
            };
            decisions[2] = new MacroblockDecision {
                Movement = new Vector(12.0, 0.0)
            };
            decisions[3] = new MacroblockDecision {
                Movement = new Vector(12.0, -12.0)
            };
            decisions[4] = new MacroblockDecision {
                Movement = new Vector(3.0, -12.0)
            };
            decisions[5] = new MacroblockDecision {
                Movement = new Vector(-38.0, -15.0)
            };
            decisions[6] = new MacroblockDecision {
                Movement = new Vector(-120.0, 0.0)
            };
            decisions[7] = new MacroblockDecision {
                Movement = new Vector(-20.0, 20.0)
            };
            decisions[8] = new MacroblockDecision {
                Movement = new Vector(4.0, 0.0)
            };
            decisions[9] = new MacroblockDecision {
                Movement = new Vector(0.0, 4.0)
            };
            decisions[10] = new MacroblockDecision {
                Movement = new Vector(4.0, 4.0)
            };
            decisions[11] = new MacroblockDecision {
                Movement = new Vector(-4.0, 0.0)
            };
            Frame[]     input = { new AnnotatedFrame(testFrame, decisions) };
            OverlayNode node  = new OverlayNode {
                Type = new MoveVectorsOverlay()
            };

            node.ProcessCore(input, 0);
            List <Frame> output = new List <Frame>();

            output.Add(node.Data);
            YuvEncoder.Encode(@"..\..\..\..\output\VectorOverlayTest_64x48.yuv", output);
        }
Пример #7
0
        public static void Draw(this OverlayNode on, Graphics dc, int Height)
        {
            Pen        p   = on.IsSelected ? PensAndBrushes.OverlayNodeSelPen : PensAndBrushes.OverlayNodePen;
            RectangleF lBB = on.BB.UpsideDown(Height).ToRectangleF();

            dc.DrawLine(p, lBB.TopLeft(), lBB.BottomRight());
            dc.DrawLine(p, lBB.BottomLeft(), lBB.TopRight());
        }
Пример #8
0
        public override void OnRightMouseButtonDown(OverlayShape item, Point p, TEMouseArgs e)
        {
            //base.OnRightMouseButtonDown(item, p, e);

            // if a node is selected, unselect it
            if (curSel != null)
            {
                curSel    = null;
                e.Handled = true;   // we don't want anything else to happen (contextmenu opening etc)
            }
        }
Пример #9
0
        public void GlobalTest10()
        {
            MainViewModel     mvm = MainViewModelTest.GetInstance();
            PipelineViewModel pvm = mvm.PipelineViewModel;

            // Step 1: The user clicks "New" to create a new pipeline
            mvm.Clear();
            Assert.Empty(mvm.Model.Graph.Nodes);
            var mock = new Mock <IDragEventInfo>();

            // Step 2: Create each type of node once by drag-and-drop
            VideoInputNode    vin = (VideoInputNode)AddNode <VideoInputNode>(pvm, mock, new Point(10, 30));
            AdditiveMergeNode amn = (AdditiveMergeNode)AddNode <AdditiveMergeNode>(pvm, mock, new Point(30, 30));
            BlurNode          bn  = (BlurNode)AddNode <BlurNode>(pvm, mock, new Point(50, 30));
            BrightnessContrastSaturationNode bcsn =
                (BrightnessContrastSaturationNode)AddNode <BrightnessContrastSaturationNode>(pvm, mock, new Point(70, 30));
            ColorInputNode            cin   = (ColorInputNode)AddNode <ColorInputNode>(pvm, mock, new Point(10, 50));
            DelayNode                 dln   = (DelayNode)AddNode <DelayNode>(pvm, mock, new Point(90, 30));
            DiagramNode               dgn   = (DiagramNode)AddNode <DiagramNode>(pvm, mock, new Point(110, 30));
            DifferenceNode            dfn   = (DifferenceNode)AddNode <DifferenceNode>(pvm, mock, new Point(30, 50));
            HistogramNode             hn    = (HistogramNode)AddNode <HistogramNode>(pvm, mock, new Point(50, 50));
            ImageInputNode            imin  = (ImageInputNode)AddNode <ImageInputNode>(pvm, mock, new Point(70, 50));
            InverterNode              invn  = (InverterNode)AddNode <InverterNode>(pvm, mock, new Point(90, 50));
            NoiseInputNode            nin   = (NoiseInputNode)AddNode <NoiseInputNode>(pvm, mock, new Point(110, 50));
            OverlayNode               on    = (OverlayNode)AddNode <OverlayNode>(pvm, mock, new Point(10, 70));
            RgbSplitNode              rgbsn = (RgbSplitNode)AddNode <RgbSplitNode>(pvm, mock, new Point(30, 70));
            WeightedAveragedMergeNode wamn  =
                (WeightedAveragedMergeNode)AddNode <WeightedAveragedMergeNode>(pvm, mock, new Point(50, 70));

            // Step 3: Create the edges
            mvm.Model.Graph.AddEdge(vin.Outputs[0], bn.Inputs[0]);
            Assert.Equal(vin.Outputs[0], bn.Inputs[0].Source);
            amn.Inputs.Add(new Node.Input());
            mvm.Model.Graph.AddEdge(vin.Outputs[0], amn.Inputs[0]);
            Assert.Equal(vin.Outputs[0], amn.Inputs[0].Source);
            mvm.Model.Graph.AddEdge(bn.Outputs[0], dln.Inputs[0]);
            Assert.Equal(bn.Outputs[0], dln.Inputs[0].Source);
            mvm.Model.Graph.AddEdge(dln.Outputs[0], dfn.Inputs[0]);
            Assert.Equal(dln.Outputs[0], dfn.Inputs[0].Source);
            mvm.Model.Graph.AddEdge(imin.Outputs[0], dfn.Inputs[1]);
            Assert.Equal(imin.Outputs[0], dfn.Inputs[1].Source);
            mvm.Model.Graph.AddEdge(dfn.Outputs[0], invn.Inputs[0]);
            Assert.Equal(dfn.Outputs[0], invn.Inputs[0].Source);
            mvm.Model.Graph.AddEdge(invn.Outputs[0], on.Inputs[0]);
            Assert.Equal(invn.Outputs[0], on.Inputs[0].Source);
            mvm.Model.Graph.AddEdge(vin.Outputs[0], on.Inputs[1]);
            Assert.Equal(vin.Outputs[0], on.Inputs[1].Source);
            mvm.Model.Graph.AddEdge(vin.Outputs[0], rgbsn.Inputs[0]);
            Assert.Equal(vin.Outputs[0], rgbsn.Inputs[0].Source);
            mvm.Model.Graph.AddEdge(rgbsn.Outputs[2], hn.Inputs[0]);
            Assert.Equal(rgbsn.Outputs[2], hn.Inputs[0].Source);
        }
Пример #10
0
        public void TestOverlayNode()
        {
            OverlayNode node = new OverlayNode();

            Assert.Equal(false, node.InputIsValid);
            NoiseInputNode noise = new NoiseInputNode();

            node.Inputs[0].Source = noise.Outputs[0];
            Assert.Equal(true, node.InputIsValid);
            Frame[] input = { new Frame(new YuvKA.VideoModel.Size(5, 5)) };
            node.Type = new ArtifactsOverlay();
            node.ProcessCore(input, 0);
            node.Type = new BlocksOverlay();
            node.ProcessCore(input, 0);
            node.Type = new MoveVectorsOverlay();
            node.ProcessCore(input, 0);
        }
Пример #11
0
        public void TestGeneralFunctions()
        {
            IOverlayType noOverlay    = new NoOverlay();
            IOverlayType blockOverlay = new BlocksOverlay();

            IoC.GetAllInstances = nope => new List <object> {
                noOverlay, blockOverlay
            };
            IoC.GetInstance = IoCAggregator;
            OverlayNode      node = new OverlayNode();
            OverlayViewModel vm   = new OverlayViewModel(node);

            var inputNodeMock = new Mock <InputNode>(1);

            inputNodeMock.SetupGet(i => i.OutputHasLogfile).Returns(true);
            inputNodeMock.SetupGet(i => i.InputIsValid).Returns(true);

            //Test the available Types
            node.Inputs[0].Source = inputNodeMock.Object.Outputs[0];
            Assert.Equal("No Overlay", vm.TypeTuples.First().Item1);

            //Test altering the chosen Type
            node.Type = blockOverlay;
            Assert.Equal("Macroblock-Overlay", vm.ChosenType.Item1);
            ColorInputNode color = new ColorInputNode();

            color.Size            = new Size(512, 512);
            node.Inputs[0].Source = color.Outputs[0];
            vm.ChosenType         = new System.Tuple <string, IOverlayType>("No Overlay", noOverlay);
            Assert.Equal("No Overlay", vm.ChosenType.Item1);
            //Test "Handling" a message(The result has be inspected manually)
            node.Type = noOverlay;
            Frame[] input = { new Frame(new Size(512, 512)) };
            node.ProcessCore(input, 0);
            vm.Handle(null);

            using (var fileStream = new FileStream(@"..\..\..\..\output\thisIsBlack.png", FileMode.Create)) {
                BitmapEncoder encoder = new PngBitmapEncoder();
                encoder.Frames.Add(BitmapFrame.Create(vm.RenderedImage));
                encoder.Save(fileStream);
            }
        }
Пример #12
0
        public static Config TryParse(ConfigNode node)
        {
            if (node != null)
            {
                var gui = GuiNode.TryParse(node.GetNode("GUI")) ??
                          GuiNode.GetDefault();

                var contextMenu = ContextMenuNode.TryParse(node.GetNode("CONTEXT_MENU")) ??
                                  ContextMenuNode.GetDefault();

                var overlay = OverlayNode.TryParse(node.GetNode("OVERLAY")) ??
                              OverlayNode.GetDefault();

                var diagnostics = DiagnosticsNode.TryParse(node.GetNode("DIAGNOSTICS")) ??
                                  DiagnosticsNode.GetDefault();

                return(new Config(gui, contextMenu, overlay, diagnostics));
            }

            Log.Debug("Could not parse missing HOT_SPOT node");
            return(null);
        }
Пример #13
0
 void doShiftSelItemsRelative(Point RelShift, List <OverlayShape> AllItems, Dictionary <OverlayNode, Point> origPositions)
 {
     foreach (OverlayShape o in AllItems)
     {
         if (o is OverlayScope)
         {
             if (SelectedItems.Contains(o))
             {
                 o.ShiftItemRelative(RelShift);
             }
             else
             {
                 ShiftSelItemsInParseTree(RelShift, (o as OverlayScope).children);
             }
         }
         else if (o is OverlayNode && SelectedItems.Contains(o))
         {
             OverlayNode on = o as OverlayNode;
             on.tikzitem.SetAbsPos(new Point(origPositions[on].X + RelShift.X, origPositions[on].Y + RelShift.Y));
             on.tikzitem.UpdateText();
         }
     }
 }
Пример #14
0
		public void TestGeneralFunctions()
		{
			IOverlayType noOverlay = new NoOverlay();
			IOverlayType blockOverlay = new BlocksOverlay();
			IoC.GetAllInstances = nope => new List<object> { noOverlay, blockOverlay };
			IoC.GetInstance = IoCAggregator;
			OverlayNode node = new OverlayNode();
			OverlayViewModel vm = new OverlayViewModel(node);

			var inputNodeMock = new Mock<InputNode>(1);
			inputNodeMock.SetupGet(i => i.OutputHasLogfile).Returns(true);
			inputNodeMock.SetupGet(i => i.InputIsValid).Returns(true);

			//Test the available Types
			node.Inputs[0].Source = inputNodeMock.Object.Outputs[0];
			Assert.Equal("No Overlay", vm.TypeTuples.First().Item1);

			//Test altering the chosen Type
			node.Type = blockOverlay;
			Assert.Equal("Macroblock-Overlay", vm.ChosenType.Item1);
			ColorInputNode color = new ColorInputNode();
			color.Size = new Size(512, 512);
			node.Inputs[0].Source = color.Outputs[0];
			vm.ChosenType = new System.Tuple<string, IOverlayType>("No Overlay", noOverlay);
			Assert.Equal("No Overlay", vm.ChosenType.Item1);
			//Test "Handling" a message(The result has be inspected manually)
			node.Type = noOverlay;
			Frame[] input = { new Frame(new Size(512, 512)) };
			node.ProcessCore(input, 0);
			vm.Handle(null);

			using (var fileStream = new FileStream(@"..\..\..\..\output\thisIsBlack.png", FileMode.Create)) {
				BitmapEncoder encoder = new PngBitmapEncoder();
				encoder.Frames.Add(BitmapFrame.Create(vm.RenderedImage));
				encoder.Save(fileStream);
			}
		}
Пример #15
0
 public OverlayNodeView(OverlayNode on) : base(on)
 {
     Width  = 10;
     Height = 10;
     Fill   = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)); // necessary?
 }
Пример #16
0
        public void Test50()
        {
            // Some necessary initializations.
            MainViewModel mvm           = MainViewModelTest.GetInstance();
            var           windowManMock = new Mock <IWindowManagerEx>();
            var           vm            = MainViewModelTest.GetInstance(cont => cont.ComposeExportedValue <IWindowManagerEx>(windowManMock.Object));
            var           conductorMock = new Mock <IConductor>();


            // Step 1: Create simple pipeline.
            //
            //	[color]---[overlay]
            //		   \ /
            //			X
            //		   / \
            //  [noise]---[diagram]
            NoiseInputNode noise = new NoiseInputNode();

            mvm.Model.Graph.AddNode(noise);
            ColorInputNode color = new ColorInputNode();

            mvm.Model.Graph.AddNode(color);
            DiagramNode diagram = new DiagramNode();

            diagram.Inputs.Add(new Node.Input());
            diagram.Inputs.Add(new Node.Input());
            mvm.Model.Graph.AddNode(diagram);
            OverlayNode overlay = new OverlayNode();

            mvm.Model.Graph.AddNode(overlay);
            Assert.Contains(noise, mvm.Model.Graph.Nodes);
            Assert.Contains(color, mvm.Model.Graph.Nodes);
            Assert.Contains(diagram, mvm.Model.Graph.Nodes);
            Assert.Contains(overlay, mvm.Model.Graph.Nodes);

            mvm.Model.Graph.AddEdge(noise.Outputs[0], overlay.Inputs[0]);
            mvm.Model.Graph.AddEdge(noise.Outputs[0], diagram.Inputs[0]);
            mvm.Model.Graph.AddEdge(color.Outputs[0], overlay.Inputs[1]);
            mvm.Model.Graph.AddEdge(color.Outputs[0], diagram.Inputs[1]);
            Assert.Equal(noise.Outputs[0], overlay.Inputs[0].Source);
            Assert.Equal(noise.Outputs[0], diagram.Inputs[0].Source);
            Assert.Equal(color.Outputs[0], overlay.Inputs[1].Source);
            Assert.Equal(color.Outputs[0], diagram.Inputs[1].Source);

            // Step 2: Disable diagram node and open overlay node.
            diagram.IsEnabled = false;
            IGraphType pixelDiff = new PixelDiff();
            IGraphType psnr      = new PeakSignalNoiseRatio();

            IoC.GetAllInstances = type => new List <IGraphType> {
                pixelDiff, psnr
            };
            var overlayWindow = new OverlayViewModel(overlay)
            {
                Parent = conductorMock.Object
            };
            var diagramWindow = new DiagramViewModel(diagram)
            {
                Parent = conductorMock.Object
            };

            ((IActivate)overlayWindow).Activate();
            conductorMock.Setup(c => c.DeactivateItem(overlayWindow, true))
            .Callback(() => ((IDeactivate)overlayWindow).Deactivate(close: true))
            .Verifiable();

            mvm.OpenWindow(overlayWindow);
            Assert.Contains(overlayWindow, mvm.OpenWindows);

            // Step 3: Start pipeline and add an overlay in the overlay node.
            mvm.Model.Start(mvm.Model.Graph.Nodes);
            overlay.Type = new ArtifactsOverlay();

            // Step 4: Remove selected overlay.
            overlay.Type = new NoOverlay();

            // Step 5: Stop pipeline and close overlay node.
            mvm.Model.Stop();
            mvm.CloseWindows(overlay);
            Assert.DoesNotContain(overlayWindow, mvm.OpenWindows);

            // Step 6: Re-enable diagram node and open it.
            diagram.IsEnabled = true;
            mvm.OpenWindow(diagramWindow);
            Assert.Contains(diagramWindow, mvm.OpenWindows);

            // Step 7: Choose a reference video and add a diagram graph.
            diagramWindow.Reference   = new Tuple <string, Node.Input>(diagramWindow.GetVideoName(diagram.Inputs[0]), diagram.Inputs[0]);
            diagramWindow.ChosenVideo = new Tuple <string, Node.Input>(diagramWindow.GetVideoName(diagram.Inputs[1]), diagram.Inputs[1]);
            diagramWindow.AddGraph();
            diagramWindow.Graphs.ElementAt(0).CurrentType = new GraphTypeViewModel(pixelDiff);

            // Step 8: Start pipeline again and change diagram graph type.
            mvm.Model.Start(mvm.Model.Graph.Nodes);
            diagramWindow.Graphs.ElementAt(0).CurrentType = new GraphTypeViewModel(psnr);

            // Step 9: Remove the diagram graph.
            DiagramGraphViewModel dgvm = diagramWindow.Graphs.ElementAt(0);

            diagramWindow.DeleteGraph(dgvm);
            Assert.DoesNotContain(dgvm, diagramWindow.Graphs);
        }
Пример #17
0
        public override void OnLeftMouseButtonDown(OverlayShape item, Point p, TEMouseArgs e)
        {
            if (!(item is OverlayNode))
            {
                curSel = null;
                return;
            }
            OverlayNode n = item as OverlayNode;

            // make sure a referenceable item is selected... otherwise we cannot add an edge
            if (!IsReferenceable(item))
            {
                MainWindow.AddStatusLine("Only items that are referenceable (=can be given names) can be connected with the edge tool.");
                return;
            }

            if (curSel == null)
            {
                curSel = n;
                return;
            }

            // make sure both nodes involved are nodes

            /*  if (!(curSel.tikzitem is Tikz_Node) || !(n.tikzitem is Tikz_Node))
             * {
             *    String which = ""; String verb = "is";
             *    if (!(curSel.tikzitem is Tikz_Node) && !(n.tikzitem is Tikz_Node))
             *    { which = "Both"; verb = "are"; }
             *    else if (!(curSel.tikzitem is Tikz_Node))
             *        which = "The first";
             *    else if (!(n.tikzitem is Tikz_Node))
             *        which = "The second";
             *    MainWindow.AddStatusLine(which + " of the selected coordinates " + verb + " not a node (i.e. not defined with \\node but rather with \\draw or \\path)", true);
             *    curSel = null;
             *    return; // hack
             * } */

            //the return from above must not interfere with BeginModify()
            overlay.BeginUpdate();

            // add an edge curSel to n
            //bool lcreated;
            //if (EnsureCurAddToExists(out lcreated))

            //always create new \draw command. otherwise it can happen that the \draw-command
            //is above the \node-definition which causes an error while compiling the latex code.
            if (AddNewCurAddTo())
            {
                // make sure both nodes involved have names
                Parser.Tikz_Node t1 = MakeReferenceableNode(curSel.tikzitem),
                                 t2 = MakeReferenceableNode(n.tikzitem);

                Parser.Tikz_Coord tc1 = new Parser.Tikz_Coord();
                tc1.type = Parser.Tikz_CoordType.Named;
                Parser.Tikz_Coord tc2 = new Parser.Tikz_Coord();
                tc2.type = Parser.Tikz_CoordType.Named;

                curAddTo.AddChild(new Parser.Tikz_Something(" "));
                curAddTo.AddChild(tc1);
                if (t1 == t2)
                {
                    curAddTo.AddChild(new Parser.Tikz_Something(" edge[loop, looseness=20] "));
                }
                else
                {
                    curAddTo.AddChild(new Parser.Tikz_Something(" edge "));
                }
                curAddTo.AddChild(tc2);
                //tpict.AddChild(tp);

                // make sure both nodes have names

                /*              Tikz_Picture tpict = overlay.ParseTree.GetTikzPicture();
                 *            if (t1.name == "")
                 *            {
                 *                t1.SetName(tpict.GetUniqueName());
                 *                t1.UpdateText();
                 *            }
                 *            if (t2.name == "")
                 *            {
                 *                t2.SetName(tpict.GetUniqueName());
                 *                t2.UpdateText();
                 *            }
                 */
                tc1.nameref = t1.name;
                tc2.nameref = t2.name;
                //tc1.UpdateText();
                curAddTo.UpdateText();
                //tpict.UpdateText();
                //                    txtCode_TextChanged

                //RedrawObjects();
                //if (OnModified != null)
                //    OnModified.Invoke();

                //edge was drawn. release currently selected node.
                curSel = null;

                //will neither want to path tool to start from this last select nodes.
                curAddTo = null;
            }
            //forgetting to call EndModify causes weird "No undo group should be open at this point"-message.
            overlay.EndUpdate();
        }
Пример #18
0
 public override void OnDeactivate()
 {
     base.OnDeactivate();
     curSel = null;
 }
Пример #19
0
		public void TestOverlayNode()
		{
			OverlayNode node = new OverlayNode();
			Assert.Equal(false, node.InputIsValid);
			NoiseInputNode noise = new NoiseInputNode();
			node.Inputs[0].Source = noise.Outputs[0];
			Assert.Equal(true, node.InputIsValid);
			Frame[] input = { new Frame(new YuvKA.VideoModel.Size(5, 5)) };
			node.Type = new ArtifactsOverlay();
			node.ProcessCore(input, 0);
			node.Type = new BlocksOverlay();
			node.ProcessCore(input, 0);
			node.Type = new MoveVectorsOverlay();
			node.ProcessCore(input, 0);
		}
Пример #20
0
        public void TestMacroBlockOverlay()
        {
            Frame testFrame = new Frame(new YuvKA.VideoModel.Size(64, 64));

            for (int x = 0; x < testFrame.Size.Width; x++)
            {
                for (int y = 0; y < testFrame.Size.Height; y++)
                {
                    testFrame[x, y] = new Rgb(111, 111, 111);
                }
            }
            MacroblockDecision[] decisions = new MacroblockDecision[16];
            decisions[0] = new MacroblockDecision {
                PartitioningDecision = MacroblockPartitioning.InterSkip
            };
            decisions[1] = new MacroblockDecision {
                PartitioningDecision = MacroblockPartitioning.Inter16x16
            };
            decisions[2] = new MacroblockDecision {
                PartitioningDecision = MacroblockPartitioning.Inter16x8
            };
            decisions[3] = new MacroblockDecision {
                PartitioningDecision = MacroblockPartitioning.Inter8x16
            };
            decisions[4] = new MacroblockDecision {
                PartitioningDecision = MacroblockPartitioning.Inter8x8
            };
            decisions[5] = new MacroblockDecision {
                PartitioningDecision = MacroblockPartitioning.Inter4x8
            };
            decisions[6] = new MacroblockDecision {
                PartitioningDecision = MacroblockPartitioning.Inter8x4
            };
            decisions[7] = new MacroblockDecision {
                PartitioningDecision = MacroblockPartitioning.Inter4x4
            };
            decisions[8] = new MacroblockDecision {
                PartitioningDecision = MacroblockPartitioning.Intra16x16
            };
            decisions[9] = new MacroblockDecision {
                PartitioningDecision = MacroblockPartitioning.Intra8x8
            };
            decisions[10] = new MacroblockDecision {
                PartitioningDecision = MacroblockPartitioning.Intra4x4
            };
            decisions[11] = new MacroblockDecision {
                PartitioningDecision = MacroblockPartitioning.Unknown
            };
            decisions[12] = new MacroblockDecision {
                PartitioningDecision = MacroblockPartitioning.Inter8x8OrBelow
            };
            decisions[13] = new MacroblockDecision {
                PartitioningDecision = MacroblockPartitioning.IntraPCM
            };
            decisions[14] = new MacroblockDecision {
                PartitioningDecision = null
            };
            decisions[15] = new MacroblockDecision {
                PartitioningDecision = MacroblockPartitioning.Unknown
            };
            Frame[]     input = { new AnnotatedFrame(testFrame, decisions) };
            OverlayNode node  = new OverlayNode {
                Type = new BlocksOverlay()
            };

            node.ProcessCore(input, 0);
            List <Frame> output = new List <Frame>();

            output.Add(node.Data);
            YuvEncoder.Encode(@"..\..\..\..\output\BlockOverlayTest_64x64.yuv", output);
        }
Пример #21
0
		public void TestNoOverlay()
		{
			Frame testFrame = new Frame(new YuvKA.VideoModel.Size(80, 80));
			for (int x = 0; x < testFrame.Size.Width; x++) {
				for (int y = 0; y < testFrame.Size.Height; y++) {
					testFrame[x, y] = new Rgb(111, 111, 111);
				}
			}
			Frame[] input = { testFrame };
			OverlayNode node = new OverlayNode { Type = new NoOverlay() };
			node.ProcessCore(input, 0);
			List<Frame> output = new List<Frame>();
			for (int x = 0; x < testFrame.Size.Width; x++) {
				for (int y = 0; y < testFrame.Size.Height; y++) {
					Assert.Equal(testFrame[x, y], node.Data[x, y]);
				}
			}
		}
Пример #22
0
		public void ArtifactOverlay()
		{
			Frame testFrame = new Frame(new YuvKA.VideoModel.Size(80, 80));
			for (int x = 0; x < testFrame.Size.Width; x++) {
				for (int y = 0; y < testFrame.Size.Height; y++) {
					testFrame[x, y] = new Rgb(111, 111, 111);
				}
			}
			Frame alteredTestFrame = new Frame(testFrame.Size);
			for (int x = 0; x < testFrame.Size.Width; x++) {
				for (int y = 0; y < testFrame.Size.Height; y++) {
					alteredTestFrame[x, y] = new Rgb((byte)(x + y), (byte)(x + y), (byte)(x + y));
				}
			}
			Frame[] input = { alteredTestFrame, testFrame };
			OverlayNode node = new OverlayNode { Type = new ArtifactsOverlay() };
			node.ProcessCore(input, 0);
			List<Frame> output = new List<Frame>();
			output.Add(node.Data);
			YuvEncoder.Encode(@"..\..\..\..\output\ArtifactOverlayTest_80x80.yuv", output);
		}
Пример #23
0
		public void TestVecorOverlay()
		{
			Frame testFrame = new Frame(new YuvKA.VideoModel.Size(64, 48));
			for (int x = 0; x < testFrame.Size.Width; x++) {
				for (int y = 0; y < testFrame.Size.Height; y++) {
					testFrame[x, y] = new Rgb(111, 111, 111);
				}
			}
			MacroblockDecision[] decisions = new MacroblockDecision[12];
			decisions[0] = new MacroblockDecision { Movement = new Vector(0.0, 12.0) };
			decisions[1] = new MacroblockDecision { Movement = new Vector(12.0, 12.0) };
			decisions[2] = new MacroblockDecision { Movement = new Vector(12.0, 0.0) };
			decisions[3] = new MacroblockDecision { Movement = new Vector(12.0, -12.0) };
			decisions[4] = new MacroblockDecision { Movement = new Vector(3.0, -12.0) };
			decisions[5] = new MacroblockDecision { Movement = new Vector(-38.0, -15.0) };
			decisions[6] = new MacroblockDecision { Movement = new Vector(-120.0, 0.0) };
			decisions[7] = new MacroblockDecision { Movement = new Vector(-20.0, 20.0) };
			decisions[8] = new MacroblockDecision { Movement = new Vector(4.0, 0.0) };
			decisions[9] = new MacroblockDecision { Movement = new Vector(0.0, 4.0) };
			decisions[10] = new MacroblockDecision { Movement = new Vector(4.0, 4.0) };
			decisions[11] = new MacroblockDecision { Movement = new Vector(-4.0, 0.0) };
			Frame[] input = { new AnnotatedFrame(testFrame, decisions) };
			OverlayNode node = new OverlayNode { Type = new MoveVectorsOverlay() };
			node.ProcessCore(input, 0);
			List<Frame> output = new List<Frame>();
			output.Add(node.Data);
			YuvEncoder.Encode(@"..\..\..\..\output\VectorOverlayTest_64x48.yuv", output);
		}
Пример #24
0
		public void TestMacroBlockOverlay()
		{
			Frame testFrame = new Frame(new YuvKA.VideoModel.Size(64, 64));
			for (int x = 0; x < testFrame.Size.Width; x++) {
				for (int y = 0; y < testFrame.Size.Height; y++) {
					testFrame[x, y] = new Rgb(111, 111, 111);
				}
			}
			MacroblockDecision[] decisions = new MacroblockDecision[16];
			decisions[0] = new MacroblockDecision { PartitioningDecision = MacroblockPartitioning.InterSkip };
			decisions[1] = new MacroblockDecision { PartitioningDecision = MacroblockPartitioning.Inter16x16 };
			decisions[2] = new MacroblockDecision { PartitioningDecision = MacroblockPartitioning.Inter16x8 };
			decisions[3] = new MacroblockDecision { PartitioningDecision = MacroblockPartitioning.Inter8x16 };
			decisions[4] = new MacroblockDecision { PartitioningDecision = MacroblockPartitioning.Inter8x8 };
			decisions[5] = new MacroblockDecision { PartitioningDecision = MacroblockPartitioning.Inter4x8 };
			decisions[6] = new MacroblockDecision { PartitioningDecision = MacroblockPartitioning.Inter8x4 };
			decisions[7] = new MacroblockDecision { PartitioningDecision = MacroblockPartitioning.Inter4x4 };
			decisions[8] = new MacroblockDecision { PartitioningDecision = MacroblockPartitioning.Intra16x16 };
			decisions[9] = new MacroblockDecision { PartitioningDecision = MacroblockPartitioning.Intra8x8 };
			decisions[10] = new MacroblockDecision { PartitioningDecision = MacroblockPartitioning.Intra4x4 };
			decisions[11] = new MacroblockDecision { PartitioningDecision = MacroblockPartitioning.Unknown };
			decisions[12] = new MacroblockDecision { PartitioningDecision = MacroblockPartitioning.Inter8x8OrBelow };
			decisions[13] = new MacroblockDecision { PartitioningDecision = MacroblockPartitioning.IntraPCM };
			decisions[14] = new MacroblockDecision { PartitioningDecision = null };
			decisions[15] = new MacroblockDecision { PartitioningDecision = MacroblockPartitioning.Unknown };
			Frame[] input = { new AnnotatedFrame(testFrame, decisions) };
			OverlayNode node = new OverlayNode { Type = new BlocksOverlay() };
			node.ProcessCore(input, 0);
			List<Frame> output = new List<Frame>();
			output.Add(node.Data);
			YuvEncoder.Encode(@"..\..\..\..\output\BlockOverlayTest_64x64.yuv", output);
		}
Пример #25
0
 public OverlayViewModel(OverlayNode node)
     : base(node, null)
 {
     NodeModel = node;
 }