public long GetDifrent(ImageToCompare image) { if (UseAvx) { return(DifrentAvx(image)); } else { return(DifrentArrey(image)); } }
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); }
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); }