Пример #1
0
 public long GetDifrent(ImageToCompare image)
 {
     if (UseAvx)
     {
         return(DifrentAvx(image));
     }
     else
     {
         return(DifrentArrey(image));
     }
 }
Пример #2
0
        private long DifrentArrey(ImageToCompare image)
        {
            long Difrent = 0;

            byte[] toComper = image.arrey;
            for (int i = 0; i < arrey.Length; i++)
            {
                Difrent += Math.Abs(arrey[i] - toComper[i]);
            }
            return(Difrent);
        }
Пример #3
0
        private long DifrentAvx(ImageToCompare image)
        {
            long Difrent = 0;
            int  i       = 0;
            List <Vector <short> > vectorsToCompare = image.vectors;

            while (i < vectors.Count)
            {
                Vector <short> AgregateSum = Vector <short> .Zero;
                for (int j = 0; j < 254 && i < vectors.Count; j++, i++)
                {
                    AgregateSum += Vector.Abs((vectors[i] - vectorsToCompare[i]));
                }

                for (int j = 0; j < Vector <short> .Count; j++)
                {
                    Difrent += AgregateSum[j];
                }
            }
            return(Difrent);
        }