Ejemplo n.º 1
0
        public void araitimer(float[][] testArie, int tasks, int count)
        {
            TimeSpan time = TimeSpan.Zero;

            for (int i = 0; i < count; i++)
            {
                Stopwatch sw = new Stopwatch();
                sw.Start();
                DCT.taskSeperater(testArie, tasks);
                DCT.DirectDCTTaskSeparator(testArie, tasks);
                sw.Stop();
                time = bestwert(sw.Elapsed, time);
            }
            //var time = mittelwertZeit(sw.Elapsed, count);
            Console.WriteLine($"Matrix Arai Optimized:{ time} Count {tasks}");

            Stopwatch sw2 = new Stopwatch();
        }
Ejemplo n.º 2
0
        public void PerformanceTest()
        {
            //Generate test picture as onedimensional array and fill it with the correct values
            float[] testValues = new float[65536];

            for (int i = 0; i < 65536; i++)
            {
                testValues[i] = (i % 256 + (i / 256) * 8) % 256;
            }

            Stopwatch watch              = new Stopwatch();
            Stopwatch recordTime         = new Stopwatch();
            var       recordArai         = TimeSpan.Zero;
            var       recordDCT          = TimeSpan.Zero;
            var       recordSeparatedDCT = TimeSpan.Zero;

            //Arai test
            watch.Start();
            while (watch.ElapsedMilliseconds < 10000)
            {
                recordTime.Start();

                float[][] listOfBlocks = Bilderaufteilen(testValues, 256, 256);
                //DCT.araiAranger(listOfBlocks);//-------------------------------------------
                //listOfBlocks = Bilderaufteilen(testValues, 256, 256);
                //DCT.DirectDCTAranger(listOfBlocks);//---------------------------
                listOfBlocks = DCT.taskSeperater(listOfBlocks, 100);

                float[] outputValues = CombineBlocksToPicture(listOfBlocks, 256, 256);

                recordTime.Stop();

                recordArai = bestwert(recordTime.Elapsed, recordArai);

                recordTime.Reset();
            }
            watch.Reset();

            //DCT test
            watch.Start();
            while (watch.ElapsedMilliseconds < 10000)
            {
                recordTime.Start();

                float[][] listOfBlocks = Bilderaufteilen(testValues, 256, 256);

                listOfBlocks = DCT.DirectDCTTaskSeparator(listOfBlocks, 100);

                float[] outputValues = CombineBlocksToPicture(listOfBlocks, 256, 256);

                recordTime.Stop();

                recordDCT = bestwert(recordTime.Elapsed, recordDCT);

                recordTime.Reset();
            }
            watch.Reset();

            //DCT test
            watch.Start();
            while (watch.ElapsedMilliseconds < 10000)
            {
                recordTime.Start();

                float[][] listOfBlocks = Bilderaufteilen(testValues, 256, 256);

                listOfBlocks = DCT.SeparatedDCTTaskSeparator(listOfBlocks, 100);

                float[] outputValues = CombineBlocksToPicture(listOfBlocks, 256, 256);

                recordTime.Stop();

                recordSeparatedDCT = bestwert(recordTime.Elapsed, recordDCT);

                recordTime.Reset();
            }
            watch.Reset();

            Console.WriteLine($"Arai Record Time: {recordArai}");
            Console.WriteLine($"Direct DCT Record Time: {recordDCT}");
            Console.WriteLine($"Separated DCT Record Time: {recordSeparatedDCT}");
            Console.ReadKey();
        }