示例#1
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);
        }
示例#2
0
		/// <summary>
		/// Copy ctor taking the frame to use and the macroblock decisions per frame as parameters
		/// </summary>
		public AnnotatedFrame(Frame frame, MacroblockDecision[] decisions)
			: base(frame)
		{
			Decisions = new MacroblockDecision[frame.Size.Width / 16, frame.Size.Height / 16];
			for (int i = 0; i < decisions.Length; i++ )
			{
				Decisions[i % (frame.Size.Width / 16), i / (frame.Size.Width / 16)] = decisions[i];
			}
		}
示例#3
0
 /// <summary>
 /// Copy ctor taking the frame to use and the macroblock decisions per frame as parameters
 /// </summary>
 public AnnotatedFrame(Frame frame, MacroblockDecision[] decisions)
     : base(frame)
 {
     Decisions = new MacroblockDecision[frame.Size.Width / 16, frame.Size.Height / 16];
     for (int i = 0; i < decisions.Length; i++)
     {
         Decisions[i % (frame.Size.Width / 16), i / (frame.Size.Width / 16)] = decisions[i];
     }
 }
示例#4
0
		/// <summary>
		/// Ctor taking the supposed frame size and the macroblock decisions per frame as parameters
		/// </summary>
		public AnnotatedFrame(Size size, MacroblockDecision[,] decisions)
			: base(size)
		{
			Decisions = decisions;
		}
示例#5
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);
        }