Пример #1
0
        public void Test_CalculateDCDifferences()
        {
            // generate random array
            int[,] input = ArrayHelper.GetTwoDimensionalArrayOfLength(16);
            // do the zick zack
            List <int[]> output = ZickZack.ZickZackSortChannel(input);

            // Action
            int[] expected = new[] { 0, 8, 120, 8 };
            int[] actual   = Coefficients.CalculateDCDifferences(output);

            // Assertion
            actual.Should().BeEquivalentTo(expected);
        }
Пример #2
0
        public static void ZickZackTest()
        {
            // generate random array
            int[,] input = ArrayHelper.GetTwoDimensionalArrayOfLength(16);
            ArrayHelper.PrintArray(input);
            Console.WriteLine();

            // do the zick zack
            List <int[]> output = ZickZack.ZickZackSortChannel(input);

            ArrayHelper.PrintArray(output[0]);
            ArrayHelper.PrintArray(output[1]);
            ArrayHelper.PrintArray(output[2]);
            ArrayHelper.PrintArray(output[3]);

            // calculate DC values
            int[] dcValues = Coefficients.CalculateDCDifferences(output);
            ArrayHelper.PrintArray(dcValues);

            // calculate AC values
            List <List <ACEncode> > acEncoded = Coefficients.RunLengthEncodeACValues(output);
        }